@snabcentr/vue-ui-lib 2.16.0 → 2.16.2

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.
@@ -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 Cr=function(){return Cr=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Cr.apply(this,arguments)},Ou={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"}},cn={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},Ss=500,Vu=function(){function e(t,n){return this.core=t,this.$LG=n,this.settings=Cr(Cr({},Ou),this.core.settings),this}return e.prototype.buildTemplates=function(){var t=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&&(t+='<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(t)},e.prototype.enableZoom=function(t){var n=this,r=this.settings.enableZoomAfter+t.detail.delay;this.$LG("body").first().hasClass("lg-from-hash")&&t.detail.delay?r=0:this.$LG("body").first().removeClass("lg-from-hash"),this.zoomableTimeout=setTimeout(function(){n.isImageSlide(n.core.index)&&(n.core.getSlideItem(t.detail.index).addClass("lg-zoomable"),t.detail.index===n.core.index&&n.setZoomEssentials())},r+30)},e.prototype.enableZoomOnSlideItemLoad=function(){this.core.LGel.on(cn.slideItemLoad+".zoom",this.enableZoom.bind(this))},e.prototype.getDragCords=function(t){return{x:t.pageX,y:t.pageY}},e.prototype.getSwipeCords=function(t){var n=t.touches[0].pageX,r=t.touches[0].pageY;return{x:n,y:r}},e.prototype.getDragAllowedAxises=function(t,n){if(!this.containerRect)return{allowX:!1,allowY:!1};var r=this.core.getSlideItem(this.core.index).find(".lg-image").first().get(),s=0,o=0,a=r.getBoundingClientRect();t?(s=r.offsetHeight*t,o=r.offsetWidth*t):n?(s=a.height+n*a.height,o=a.width+n*a.width):(s=a.height,o=a.width);var l=s>this.containerRect.height,c=o>this.containerRect.width;return{allowX:c,allowY:l}},e.prototype.setZoomEssentials=function(){this.containerRect=this.core.$content.get().getBoundingClientRect()},e.prototype.zoomImage=function(t,n,r,s){if(!(Math.abs(n)<=0)){var o=this.containerRect.width/2+this.containerRect.left,a=this.containerRect.height/2+this.containerRect.top+this.scrollTop,l,c;t===1&&(this.positionChanged=!1);var d=this.getDragAllowedAxises(0,n),h=d.allowY,u=d.allowX;this.positionChanged&&(l=this.left/(this.scale-n),c=this.top/(this.scale-n),this.pageX=o-l,this.pageY=a-c,this.positionChanged=!1);var f=this.getPossibleSwipeDragCords(n),p,g,m=o-this.pageX,_=a-this.pageY;if(t-n>1){var y=(t-n)/Math.abs(n);m=(n<0?-m:m)+this.left*(y+(n<0?-1:1)),_=(n<0?-_:_)+this.top*(y+(n<0?-1:1)),p=m/y,g=_/y}else{var y=(t-n)*n;p=m*y,g=_*y}r&&(u?this.isBeyondPossibleLeft(p,f.minX)?p=f.minX:this.isBeyondPossibleRight(p,f.maxX)&&(p=f.maxX):t>1&&(p<f.minX?p=f.minX:p>f.maxX&&(p=f.maxX)),h?this.isBeyondPossibleTop(g,f.minY)?g=f.minY:this.isBeyondPossibleBottom(g,f.maxY)&&(g=f.maxY):t>1&&(g<f.minY?g=f.minY:g>f.maxY&&(g=f.maxY))),this.setZoomStyles({x:p,y:g,scale:t}),this.left=p,this.top=g,s&&this.setZoomImageSize()}},e.prototype.resetImageTranslate=function(t){if(this.isImageSlide(t)){var n=this.core.getSlideItem(t).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)}},e.prototype.setZoomImageSize=function(){var t=this,n=this.core.getSlideItem(this.core.index).find(".lg-image").first();setTimeout(function(){var r=t.getCurrentImageActualSizeScale();t.scale>=r&&(n.addClass("no-transition"),t.imageReset=!0)},Ss),setTimeout(function(){var r=t.getCurrentImageActualSizeScale();if(t.scale>=r){var s=t.getDragAllowedAxises(t.scale);n.css("width",n.get().naturalWidth+"px").css("height",n.get().naturalHeight+"px"),t.core.outer.addClass("lg-actual-size"),s.allowX&&s.allowY?n.addClass("reset-transition"):s.allowX&&!s.allowY?n.addClass("reset-transition-x"):!s.allowX&&s.allowY&&n.addClass("reset-transition-y")}},Ss+50)},e.prototype.setZoomStyles=function(t){var n=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),r=this.core.getSlideItem(this.core.index).find(".lg-image").first(),s=this.core.outer.find(".lg-current .lg-dummy-img").first();this.scale=t.scale,r.css("transform","scale3d("+t.scale+", "+t.scale+", 1)"),s.css("transform","scale3d("+t.scale+", "+t.scale+", 1)");var o="translate3d("+t.x+"px, "+t.y+"px, 0)";n.css("transform",o)},e.prototype.setActualSize=function(t,n){var r=this;if(!this.zoomInProgress){this.zoomInProgress=!0;var s=this.core.galleryItems[this.core.index];this.resetImageTranslate(t),setTimeout(function(){if(!(!s.src||r.core.outer.hasClass("lg-first-slide-loading"))){var o=r.getCurrentImageActualSizeScale(),a=r.scale;r.core.outer.hasClass("lg-zoomed")?r.scale=1:r.scale=r.getScale(o),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},Ss+110)}},e.prototype.getNaturalWidth=function(t){var n=this.core.getSlideItem(t).find(".lg-image").first(),r=this.core.galleryItems[t].width;return r?parseFloat(r):n.get().naturalWidth},e.prototype.getActualSizeScale=function(t,n){var r,s;return t>=n?(r=t/n,s=r||2):s=1,s},e.prototype.getCurrentImageActualSizeScale=function(){var t=this.core.getSlideItem(this.core.index).find(".lg-image").first(),n=t.get().offsetWidth,r=this.getNaturalWidth(this.core.index)||n;return this.getActualSizeScale(r,n)},e.prototype.getPageCords=function(t){var n={};if(t)n.x=t.pageX||t.touches[0].pageX,n.y=t.pageY||t.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},e.prototype.setPageCords=function(t){var n=this.getPageCords(t);this.pageX=n.x,this.pageY=n.y},e.prototype.manageActualPixelClassNames=function(){var t=this.core.getElementById("lg-actual-size");t.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut)},e.prototype.beginZoom=function(t){return this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),t>1?(this.core.outer.addClass("lg-zoomed"),this.manageActualPixelClassNames()):this.resetZoom(),t>1},e.prototype.getScale=function(t){var n=this.getCurrentImageActualSizeScale();return t<1?t=1:t>n&&(t=n),t},e.prototype.init=function(){var t=this;if(this.settings.zoom){this.buildTemplates(),this.enableZoomOnSlideItemLoad();var n=null;this.core.outer.on("dblclick.lg",function(r){t.$LG(r.target).hasClass("lg-image")&&t.setActualSize(t.core.index,r)}),this.core.outer.on("touchstart.lg",function(r){var s=t.$LG(r.target);r.touches.length===1&&s.hasClass("lg-image")&&(n?(clearTimeout(n),n=null,r.preventDefault(),t.setActualSize(t.core.index,r)):n=setTimeout(function(){n=null},300))}),this.core.LGel.on(cn.containerResize+".zoom "+cn.rotateRight+".zoom "+cn.rotateLeft+".zoom "+cn.flipHorizontal+".zoom "+cn.flipVertical+".zoom",function(){if(!(!t.core.lgOpened||!t.isImageSlide(t.core.index)||t.core.touchAction)){var r=t.core.getSlideItem(t.core.index).find(".lg-img-wrap").first();t.top=0,t.left=0,t.setZoomEssentials(),t.setZoomSwipeStyles(r,{x:0,y:0}),t.positionChanged=!0}}),this.$LG(window).on("scroll.lg.zoom.global"+this.core.lgId,function(){t.core.lgOpened&&(t.scrollTop=t.$LG(window).scrollTop())}),this.core.getElementById("lg-zoom-out").on("click.lg",function(){if(t.isImageSlide(t.core.index)){var r=0;t.imageReset&&(t.resetImageTranslate(t.core.index),r=50),setTimeout(function(){var s=t.scale-t.settings.scale;s<1&&(s=1),t.beginZoom(s),t.zoomImage(s,-t.settings.scale,!0,!t.settings.infiniteZoom)},r)}}),this.core.getElementById("lg-zoom-in").on("click.lg",function(){t.zoomIn()}),this.core.getElementById("lg-actual-size").on("click.lg",function(){t.setActualSize(t.core.index)}),this.core.LGel.on(cn.beforeOpen+".zoom",function(){t.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(cn.afterOpen+".zoom",function(){t.scrollTop=t.$LG(window).scrollTop(),t.pageX=t.core.outer.width()/2,t.pageY=t.core.outer.height()/2+t.scrollTop,t.scale=1}),this.core.LGel.on(cn.afterSlide+".zoom",function(r){var s=r.detail.prevIndex;t.scale=1,t.positionChanged=!1,t.zoomInProgress=!1,t.resetZoom(s),t.resetImageTranslate(s),t.isImageSlide(t.core.index)&&t.setZoomEssentials()}),this.zoomDrag(),this.pinchZoom(),this.zoomSwipe(),this.zoomableTimeout=!1,this.positionChanged=!1,this.zoomInProgress=!1}},e.prototype.zoomIn=function(){if(this.isImageSlide(this.core.index)){var t=this.scale+this.settings.scale;this.settings.infiniteZoom||(t=this.getScale(t)),this.beginZoom(t),this.zoomImage(t,Math.min(this.settings.scale,t-this.scale),!0,!this.settings.infiniteZoom)}},e.prototype.resetZoom=function(t){this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");var n=this.core.getElementById("lg-actual-size"),r=this.core.getSlideItem(t!==void 0?t: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()},e.prototype.getTouchDistance=function(t){return Math.sqrt((t.touches[0].pageX-t.touches[1].pageX)*(t.touches[0].pageX-t.touches[1].pageX)+(t.touches[0].pageY-t.touches[1].pageY)*(t.touches[0].pageY-t.touches[1].pageY))},e.prototype.pinchZoom=function(){var t=this,n=0,r=!1,s=1,o=0,a=this.core.getSlideItem(this.core.index);this.core.outer.on("touchstart.lg",function(l){if(a=t.core.getSlideItem(t.core.index),!!t.isImageSlide(t.core.index)&&l.touches.length===2){if(l.preventDefault(),t.core.outer.hasClass("lg-first-slide-loading"))return;s=t.scale||1,t.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),t.setPageCords(l),t.resetImageTranslate(t.core.index),t.core.touchAction="pinch",n=t.getTouchDistance(l)}}),this.core.$inner.on("touchmove.lg",function(l){if(l.touches.length===2&&t.core.touchAction==="pinch"&&(t.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){l.preventDefault();var c=t.getTouchDistance(l),d=n-c;if(!r&&Math.abs(d)>5&&(r=!0),r){o=t.scale;var h=Math.max(1,s+-d*.02);t.scale=Math.round((h+Number.EPSILON)*100)/100;var u=t.scale-o;t.zoomImage(t.scale,Math.round((u+Number.EPSILON)*100)/100,!1,!1)}}}),this.core.$inner.on("touchend.lg",function(l){if(t.core.touchAction==="pinch"&&(t.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){if(r=!1,n=0,t.scale<=1)t.resetZoom();else{var c=t.getCurrentImageActualSizeScale();if(t.scale>=c){var d=c-t.scale;d===0&&(d=.01),t.zoomImage(c,d,!1,!0)}t.manageActualPixelClassNames(),t.core.outer.addClass("lg-zoomed")}t.core.touchAction=void 0}})},e.prototype.touchendZoom=function(t,n,r,s,o){var a=n.x-t.x,l=n.y-t.y,c=Math.abs(a)/o+1,d=Math.abs(l)/o+1;c>2&&(c+=1),d>2&&(d+=1),a=a*c,l=l*d;var h=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),u={};u.x=this.left+a,u.y=this.top+l;var f=this.getPossibleSwipeDragCords();(Math.abs(a)>15||Math.abs(l)>15)&&(s&&(this.isBeyondPossibleTop(u.y,f.minY)?u.y=f.minY:this.isBeyondPossibleBottom(u.y,f.maxY)&&(u.y=f.maxY)),r&&(this.isBeyondPossibleLeft(u.x,f.minX)?u.x=f.minX:this.isBeyondPossibleRight(u.x,f.maxX)&&(u.x=f.maxX)),s?this.top=u.y:u.y=this.top,r?this.left=u.x:u.x=this.left,this.setZoomSwipeStyles(h,u),this.positionChanged=!0)},e.prototype.getZoomSwipeCords=function(t,n,r,s,o){var a={};if(s){if(a.y=this.top+(n.y-t.y),this.isBeyondPossibleTop(a.y,o.minY)){var l=o.minY-a.y;a.y=o.minY-l/6}else if(this.isBeyondPossibleBottom(a.y,o.maxY)){var c=a.y-o.maxY;a.y=o.maxY+c/6}}else a.y=this.top;if(r){if(a.x=this.left+(n.x-t.x),this.isBeyondPossibleLeft(a.x,o.minX)){var d=o.minX-a.x;a.x=o.minX-d/6}else if(this.isBeyondPossibleRight(a.x,o.maxX)){var h=a.x-o.maxX;a.x=o.maxX+h/6}}else a.x=this.left;return a},e.prototype.isBeyondPossibleLeft=function(t,n){return t>=n},e.prototype.isBeyondPossibleRight=function(t,n){return t<=n},e.prototype.isBeyondPossibleTop=function(t,n){return t>=n},e.prototype.isBeyondPossibleBottom=function(t,n){return t<=n},e.prototype.isImageSlide=function(t){var n=this.core.galleryItems[t];return this.core.getSlideType(n)==="image"},e.prototype.getPossibleSwipeDragCords=function(t){var n=this.core.getSlideItem(this.core.index).find(".lg-image").first(),r=this.core.mediaContainerPosition.bottom,s=n.get().getBoundingClientRect(),o=s.height,a=s.width;t&&(o=o+t*o,a=a+t*a);var l=(o-this.containerRect.height)/2,c=(this.containerRect.height-o)/2+r,d=(a-this.containerRect.width)/2,h=(this.containerRect.width-a)/2,u={minY:l,maxY:c,minX:d,maxX:h};return u},e.prototype.setZoomSwipeStyles=function(t,n){t.css("transform","translate3d("+n.x+"px, "+n.y+"px, 0)")},e.prototype.zoomSwipe=function(){var t=this,n={},r={},s=!1,o=!1,a=!1,l=new Date,c=new Date,d,h,u=this.core.getSlideItem(this.core.index);this.core.$inner.on("touchstart.lg",function(f){if(t.isImageSlide(t.core.index)&&(u=t.core.getSlideItem(t.core.index),(t.$LG(f.target).hasClass("lg-item")||u.get().contains(f.target))&&f.touches.length===1&&t.core.outer.hasClass("lg-zoomed"))){f.preventDefault(),l=new Date,t.core.touchAction="zoomSwipe",h=t.core.getSlideItem(t.core.index).find(".lg-img-wrap").first();var p=t.getDragAllowedAxises(0);a=p.allowY,o=p.allowX,(o||a)&&(n=t.getSwipeCords(f)),d=t.getPossibleSwipeDragCords(),t.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(f){if(f.touches.length===1&&t.core.touchAction==="zoomSwipe"&&(t.$LG(f.target).hasClass("lg-item")||u.get().contains(f.target))){f.preventDefault(),t.core.touchAction="zoomSwipe",r=t.getSwipeCords(f);var p=t.getZoomSwipeCords(n,r,o,a,d);(Math.abs(r.x-n.x)>15||Math.abs(r.y-n.y)>15)&&(s=!0,t.setZoomSwipeStyles(h,p))}}),this.core.$inner.on("touchend.lg",function(f){if(t.core.touchAction==="zoomSwipe"&&(t.$LG(f.target).hasClass("lg-item")||u.get().contains(f.target))){if(f.preventDefault(),t.core.touchAction=void 0,t.core.outer.removeClass("lg-zoom-dragging"),!s)return;s=!1,c=new Date;var p=c.valueOf()-l.valueOf();t.touchendZoom(n,r,o,a,p)}})},e.prototype.zoomDrag=function(){var t=this,n={},r={},s=!1,o=!1,a=!1,l=!1,c,d,h,u;this.core.outer.on("mousedown.lg.zoom",function(f){if(t.isImageSlide(t.core.index)){var p=t.core.getSlideItem(t.core.index);if(t.$LG(f.target).hasClass("lg-item")||p.get().contains(f.target)){c=new Date,u=t.core.getSlideItem(t.core.index).find(".lg-img-wrap").first();var g=t.getDragAllowedAxises(0);l=g.allowY,a=g.allowX,t.core.outer.hasClass("lg-zoomed")&&t.$LG(f.target).hasClass("lg-object")&&(a||l)&&(f.preventDefault(),n=t.getDragCords(f),h=t.getPossibleSwipeDragCords(),s=!0,t.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(s){o=!0,r=t.getDragCords(f);var p=t.getZoomSwipeCords(n,r,a,l,h);t.setZoomSwipeStyles(u,p)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(f){if(s){if(d=new Date,s=!1,t.core.outer.removeClass("lg-zoom-dragging"),o&&(n.x!==r.x||n.y!==r.y)){r=t.getDragCords(f);var p=d.valueOf()-c.valueOf();t.touchendZoom(n,r,a,l,p)}o=!1}t.core.outer.removeClass("lg-grabbing").addClass("lg-grab")})},e.prototype.closeGallery=function(){this.resetZoom(),this.zoomInProgress=!1},e.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},e}();const De=class De{static init(t){if(De.uiConfig)throw new Error("UI provider already initialized.");De.uiConfig=t,De.windowResizeHandler(),window.addEventListener("resize",De.windowResizeHandler)}static destroy(){window.removeEventListener("resize",De.windowResizeHandler)}static getMessagesService(){return De.getUiConfig().messagesService}static getNotificationsService(){return De.getUiConfig().notificationsService}static getDeviceTypeByResolution(){const{deviceTypeResolutionsConfig:t}=De.getUiConfig();return window.innerWidth<t.tablet?G.WindowResolutionEnum.phone:window.innerWidth<t.laptop?G.WindowResolutionEnum.tablet:G.WindowResolutionEnum.laptop}static initRefDependingOnDeviceResolution(t,n,r){const s=i.ref(r);return De.setRefValueDependingOnDeviceResolution(s,t,n,r),De.refsDependingOnDeviceResolution.push({r:s,phoneValue:t,tabletValue:n,defaultValue:r}),s}static isPhoneDevice(){return De.getDeviceTypeByResolution()===G.WindowResolutionEnum.phone}static isTabletDevice(){return De.getDeviceTypeByResolution()===G.WindowResolutionEnum.tablet}static isLaptopDevice(){return De.getDeviceTypeByResolution()===G.WindowResolutionEnum.laptop}static showNotificationsForErrorResponseData(t,n={}){var r,s;if(W.isEmpty(t.errors)){const o=(s=(r=t.rawError)==null?void 0:r.config)==null?void 0:s.url,a=o?` [ ${o} ]`:"";De.getNotificationsService().error({title:"Ошибка выполнения/обработки запроса",content:t.message,meta:`#${t.status}${a}: ${t.statusText}`,duration:3e3})}else for(const o in t.errors)Object.prototype.hasOwnProperty.call(n,o)?n[o]=new G.FieldValidationResultData(t.errors[o].toString(),"error"):De.getMessagesService().error(t.errors[o].toString())}static getUiConfig(){if(!De.uiConfig)throw new Error("UI provider is not initialized.");return De.uiConfig}static setRefValueDependingOnDeviceResolution(t,n,r,s){switch(De.getDeviceTypeByResolution()){case G.WindowResolutionEnum.phone:t.value=n;break;case G.WindowResolutionEnum.tablet:t.value=r;break;default:t.value=s;break}}static windowResizeHandler(){W.forEach(De.refsDependingOnDeviceResolution,t=>{De.setRefValueDependingOnDeviceResolution(t.r,t.phoneValue,t.tabletValue,t.defaultValue)})}};k(De,"uiConfig"),k(De,"refsDependingOnDeviceResolution",[]);let pt=De;const zu={ref:"gallery-container",class:"lightgallery-wrapper"},Iu={},ya=i.defineComponent({...Iu,__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(e){const t=e,n={lgAfterAppendSlide:t.onAfterAppendSlide,lgInit:t.onInit,lgHasVideo:t.onHasVideo,lgContainerResize:t.onContainerResize,lgAfterAppendSubHtml:t.onAfterAppendSubHtml,lgBeforeOpen:t.onBeforeOpen,lgAfterOpen:t.onAfterOpen,lgSlideItemLoad:t.onSlideItemLoad,lgBeforeSlide:t.onBeforeSlide,lgAfterSlide:t.onAfterSlide,lgPosterClick:t.onPosterClick,lgDragStart:t.onDragStart,lgDragMove:t.onDragMove,lgDragEnd:t.onDragEnd,lgBeforeNextSlide:t.onBeforeNextSlide,lgBeforePrevSlide:t.onBeforePrevSlide,lgBeforeClose:t.onBeforeClose,lgAfterClose:t.onAfterClose,lgRotateLeft:t.onRotateLeft,lgRotateRight:t.onRotateRight,lgFlipHorizontal:t.onFlipHorizontal,lgFlipVertical:t.onFlipVertical},r=i.useTemplateRef("gallery-container"),s=i.ref(null);return i.onMounted(async()=>{if(!r.value)return;const o=await import("lightgallery");s.value=o.default(r.value,{...t.settings}),W.forOwn(n,(a,l)=>{var c;a&&((c=r.value)==null||c.addEventListener(l,a))})}),i.onBeforeUnmount(()=>{var o;s.value&&((o=s.value)==null||o.destroy(),s.value=null)}),(o,a)=>(i.openBlock(),i.createElementBlock("div",zu,[i.renderSlot(o.$slots,"default")],512))}}),Lu=["href"],Du=["src","alt"],Hu={},ba=i.defineComponent({...Hu,__name:"image-gallery",props:{images:{}},setup(e,{expose:t}){const n=i.ref(!1),r=i.ref(!1),s=i.ref({plugins:[Au,Vu],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),o=()=>window.innerWidth*(pt.getDeviceTypeByResolution()===G.WindowResolutionEnum.phone?.7:.8),a=i.ref(o()),l=()=>{a.value=o()},c=()=>{n.value=!0};return i.onUnmounted(()=>{window.removeEventListener("resize",l)}),t({show:c}),window.addEventListener("resize",l),(d,h)=>{const u=_a,f=V.NPopover;return i.openBlock(),i.createBlock(f,{trigger:"manual",show:n.value,class:"sc-image",placement:"top-start",onClickoutside:h[3]||(h[3]=()=>{r.value||(n.value=!1)})},{trigger:i.withCtx(()=>[i.createElementVNode("div",{class:"inline-flex",onClick:h[0]||(h[0]=p=>n.value=!n.value)},[i.renderSlot(d.$slots,"default",{},()=>[i.createVNode(u)])])]),default:i.withCtx(()=>[i.createVNode(ya,{settings:s.value,style:i.normalizeStyle(`max-width: ${a.value}px`),class:"flex flex-row overflow-x-scroll",onAfterOpen:h[1]||(h[1]=()=>{r.value=!0}),onAfterClose:h[2]||(h[2]=()=>{r.value=!1,n.value=!1})},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.images,(p,g)=>(i.openBlock(),i.createElementBlock("a",{key:g,href:p.image},[i.createElementVNode("img",{src:p.preview,alt:`Изображение #${g+1}`},null,8,Du)],8,Lu))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),Wu={class:"flex flex-col text-sm"},ju={},Xu=i.defineComponent({...ju,__name:"product-stock-count",props:{product:{}},setup(e){return(t,n)=>{const r=Cs,s=V.NPopover;return i.openBlock(),i.createBlock(s,{trigger:"click",placement:"top-start",class:"sc-stock-count"},{trigger:i.withCtx(()=>[i.renderSlot(t.$slots,"default",{},()=>[i.createVNode(r)])]),default:i.withCtx(()=>[i.createElementVNode("div",Wu,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.product.stockCount,(o,a)=>(i.openBlock(),i.createElementBlock("span",{key:a},i.toDisplayString(o.warehouse.name)+": "+i.toDisplayString(o.count)+" "+i.toDisplayString(t.product.quantityUnit),1))),128))])]),_:3})}}}),qu={class:"flex flex-row justify-between"},Yu={key:0},Uu={class:"ml-2 align-sub"},Gu={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},Ku={class:"@container"},Zu={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},Ju={key:0,class:"sc-supplier-sku col-span-2 whitespace-nowrap text-wrap sm:col-span-3"},Qu={class:"text-sc-dark-grey"},ef={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},tf={class:"text-gray-600"},nf={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},rf={key:3,class:"underline decoration-dashed"},sf={key:4,class:"sc-product-pack whitespace-nowrap"},of={class:"text-gray-600"},af={key:5,class:"sc-product-planning-incoming-date col-span-2 col-start-1 mt-1.5 text-wrap"},lf={class:"text-gray-600"},cf={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},df={key:0},hf={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},uf={},Xi=i.defineComponent({...uf,__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},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showProductAddToCartButton:{type:[Boolean,Function],default:!1},showProductEditButton:{type:[Boolean,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(e,{expose:t}){const n=e,r=i.computed(()=>W.isFunction(n.showProductCosts)?n.showProductCosts(n.product):n.showProductCosts),s=i.computed(()=>W.sortBy(n.product.priceCoefficients,["coefficient.slug"])),o=i.computed(()=>{var h,u;return(u=(h=n.product)==null?void 0:h.properties)==null?void 0:u.planingIncomingDate}),a=i.useTemplateRef("image-gallery"),l=()=>{var h;(h=a.value)==null||h.show()},c=i.computed(()=>W.isFunction(n.allowNameClick)?n.allowNameClick(n.product):n.allowNameClick),d=()=>{var h;c.value&&((h=n.eventEmitter)==null||h.emit("product:name-click",{product:n.product,exposedMethods:{showProductImagesPreview:l}}))};return t({showProductImagesPreview:l}),(h,u)=>{var y,b,S,x,C;const f=_a,p=V.NText,g=ma,m=Cs,_=V.NScrollbar;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",qu,[i.createVNode(p,{type:"info",class:"sc-product-name text-balance text-base font-medium"},{default:i.withCtx(()=>[i.createElementVNode("span",{class:i.normalizeClass({"cursor-pointer":c.value&&h.eventEmitter}),onClick:d},i.toDisplayString(h.product.name),3),h.product.onOrder?(i.openBlock(),i.createElementBlock("span",Yu," [Под заказ] ")):i.createCommentVNode("",!0),i.createElementVNode("span",Uu,[h.product.images&&h.product.images.length>0?(i.openBlock(),i.createBlock(ba,{key:0,ref:"image-gallery",images:h.product.images},{default:i.withCtx(()=>[i.createElementVNode("div",Gu,[i.createVNode(f)])]),_:1},8,["images"])):i.createCommentVNode("",!0)])]),_:1}),h.showProductAddToCartButton||h.showProductEditButton||((y=h.productContextButtonsConfig)==null?void 0:y.length)>0?(i.openBlock(),i.createBlock(g,{key:0,product:h.product,"event-emitter":h.eventEmitter,"show-product-add-to-cart-button":h.showProductAddToCartButton,"show-product-edit-button":h.showProductEditButton,"product-context-buttons-config":h.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","product-context-buttons-config"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",Ku,[i.createElementVNode("div",Zu,[h.product.supplierSku?(i.openBlock(),i.createElementBlock("div",Ju,[u[0]||(u[0]=i.createTextVNode(" Артикул производителя/поставщика: ")),i.createElementVNode("span",Qu,i.toDisplayString(h.product.supplierSku),1)])):i.createCommentVNode("",!0),h.showCode?(i.openBlock(),i.createElementBlock("span",ef,[u[1]||(u[1]=i.createTextVNode(" Артикул: ")),i.createElementVNode("span",tf,i.toDisplayString(h.product.code),1)])):i.createCommentVNode("",!0),h.product.stockCount&&h.product.stockCount.length>0?(i.openBlock(),i.createBlock(Xu,{key:2,product:h.product},{default:i.withCtx(()=>[i.createElementVNode("span",nf,[u[2]||(u[2]=i.createElementVNode("span",{class:"underline decoration-dashed"},"В наличии",-1)),i.createVNode(m,{class:"mt-0.5"})])]),_:1},8,["product"])):(i.openBlock(),i.createElementBlock("span",rf," Нет в наличии ")),(S=(b=h.product)==null?void 0:b.properties)!=null&&S.pack?(i.openBlock(),i.createElementBlock("span",sf,[u[3]||(u[3]=i.createTextVNode(" Норма упаковки: ")),i.createElementVNode("span",of,i.toDisplayString((C=(x=h.product)==null?void 0:x.properties)==null?void 0:C.pack),1)])):i.createCommentVNode("",!0),h.showPlanningDates&&o.value?(i.openBlock(),i.createElementBlock("span",af,[u[4]||(u[4]=i.createTextVNode(" Планируемая дата поступления на основной склад: ")),i.createElementVNode("span",lf,i.toDisplayString(o.value),1)])):i.createCommentVNode("",!0)])]),i.createVNode(_,{"x-scrollable":""},{default:i.withCtx(()=>[r.value?(i.openBlock(),i.createElementBlock("div",cf,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,B=>(i.openBlock(),i.createBlock(kr,{key:B.coefficient.slug,product:h.product,"cost-field-name":B.coefficient.slug??"","event-emitter":h.eventEmitter,"allow-price-click":h.allowPriceClick,"show-tag":!0,"show-price-history":h.showPriceHistory},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history"]))),128)),i.createVNode(kr,{product:h.product,"event-emitter":h.eventEmitter,"allow-price-click":h.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":!0,"show-price-history":h.showPriceHistory,"cost-field-name":"cost",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-price-history"])])):i.createCommentVNode("",!0)]),_:1}),h.showSlugs||h.showProperties?(i.openBlock(),i.createElementBlock("div",df,[i.createElementVNode("ul",hf,[h.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:h.product.id,slug:h.product.slug},(B,v)=>(i.openBlock(),i.createElementBlock("li",{key:v}," ("+i.toDisplayString(v)+"): "+i.toDisplayString(B),1))),128)):i.createCommentVNode("",!0),h.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(h.product.properties,(B,v)=>(i.openBlock(),i.createElementBlock("li",{key:v}," ("+i.toDisplayString(v)+"): "+i.toDisplayString(B),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)])}}}),ff=(e,t,n)=>({key:e,title:t,className:"align-top",resizable:!0,render:r=>i.h(kr,{product:r,costFieldName:e,eventEmitter:n.eventEmitter,allowPriceClick:n.allowPriceClick})}),pf=(e,t)=>{if(e.length===0)return[];const n=[],r={};switch(pt.getDeviceTypeByResolution()){case G.WindowResolutionEnum.phone:case G.WindowResolutionEnum.tablet:n.push({key:"name",title:"Наименование",className:"align-top",render:s=>i.h(Xi,{product:s,eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,showProductCosts:t.showProductCosts,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,productContextButtonsConfig:t.productContextButtonsConfig})});break;default:n.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:s=>i.h(Xi,{product:s,eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory})}),t.showProductCosts&&(W.forEach(e,s=>{W.forEach(s.priceCoefficients,o=>{r[o.coefficient.slug??""]||(r[o.coefficient.slug??""]=o.coefficient)})}),W.forEach(W.sortBy(r,["slug"]),s=>{n.push(ff(s.slug??"",s.name,t))}),n.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:s=>i.h(kr,{product:s,costFieldName:"cost",eventEmitter:t.eventEmitter,allowPriceClick:t.allowPriceClick,showQuantityUnit:!0,showCostDate:!0,showPriceHistory:t.showPriceHistory})})),(t.showProductEditButton||!W.isNil(t.productContextButtonsConfig))&&n.push({key:"actions",title:"",className:"align-top",width:"50",render:s=>i.h(ma,{product:s,eventEmitter:t.eventEmitter,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,productContextButtonsConfig:t.productContextButtonsConfig})});break}return n},gf={key:0,class:"pt-0.5"},mf={class:"flex flex-row gap-1"},_f={key:0},yf={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},bf={class:"flex flex-col-reverse gap-2.5 sm:flex-row"},wf={},vf=i.defineComponent({...wf,__name:"category-collapse-item",props:{categoryItem:{},filteredItems:{},selectedCategoriesItems:{default:void 0},selectedProductsItems:{default:void 0},showHideForClientButton:{type:[Boolean,Function],default:!1},showPinButton:{type:[Boolean,Function],default:!1},showCategoryEditButton:{type:[Boolean,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showProductAddToCartButton:{type:[Boolean,Function],default:!1},showProductEditButton:{type:[Boolean,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(e){const t=e,n=i.inject(vr,"medium"),r=i.computed(()=>{var M;return(M=t==null?void 0:t.filteredItems)==null?void 0:M[t.categoryItem.id]}),s=i.computed(()=>{var M,N;return W.isArray((M=t.categoryItem)==null?void 0:M.categories)&&((N=t.categoryItem.categories)==null?void 0:N.length)>0}),o=i.computed(()=>{var M;return W.isArray((M=t.categoryItem)==null?void 0:M.products)?t.categoryItem.products:[]}),a=i.computed(()=>W.isUndefined(t.filteredItems)||r.value==="*"?o.value:o.value.filter(M=>{var N,A;return(A=(N=r.value)==null?void 0:N.products)==null?void 0:A.includes(M.id)})),l=i.computed(()=>a.value.length>0),c=i.computed(()=>W.isFunction(t.showHideForClientButton)?t.showHideForClientButton(t.categoryItem):t.showHideForClientButton),d=i.computed(()=>W.isFunction(t.showPinButton)?t.showPinButton(t.categoryItem):t.showPinButton),h=i.computed(()=>W.isFunction(t.showCategoryEditButton)?t.showCategoryEditButton(t.categoryItem):t.showCategoryEditButton),u=i.computed(()=>W.isNil(t.categoryContextButtonsConfig)?[]:W.isFunction(t.categoryContextButtonsConfig)?t.categoryContextButtonsConfig(t.categoryItem):t.categoryContextButtonsConfig),f=i.computed(()=>new G.ClientCategory(t.categoryItem)),p=i.ref(!1),g=i.ref(!1),m=i.computed(()=>!W.isUndefined(t.selectedCategoriesItems)),_=i.computed(()=>(t.selectedCategoriesItems??[]).some(M=>M.id===t.categoryItem.id)),y=i.computed(()=>F.value&&pt.getDeviceTypeByResolution()===G.WindowResolutionEnum.laptop?"auto":"fixed"),b=M=>{t.eventEmitter.emit("category:checked",{category:t.categoryItem,checked:M})},S=(M,N)=>{t.eventEmitter.emit("category:header-click",{categoryItem:t.categoryItem,expanded:N,isLoadingState:p})},x=()=>{t.eventEmitter.emit("category:hide",{category:t.categoryItem})},C=()=>{t.eventEmitter.emit("category:attach",{category:t.categoryItem})},B=()=>{t.eventEmitter.emit("category:detach",{category:t.categoryItem})},v=()=>{t.eventEmitter.emit("category:edit",{category:t.categoryItem})},$=M=>{t.eventEmitter.emit("category:context-select",{category:t.categoryItem,key:M})},F=i.ref(0),R=i.computed(()=>F.value&&o.value.length>0?pf(o.value,{eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,showProductCosts:t.showProductCosts,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,productContextButtonsConfig:t.productContextButtonsConfig}):[]),X=W.debounce(()=>{F.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",X)}),window.addEventListener("resize",X),X(),(M,N)=>{const A=V.NCheckbox,L=ou,Y=V.NTooltip,P=iu,E=pa,H=V.NTag,I=Jh,U=Gh,O=V.NButton,z=qh,J=fa,pe=ua,re=V.NDropdown,ge=V.NDataTable,ie=V.NAlert,Me=V.NSpin;return i.openBlock(),i.createBlock(ga,{name:M.categoryItem.id,"data-id":M.categoryItem.id,"onHeader:click":S},{"pre-arrow":i.withCtx(()=>{var xe,Ce,Fe;return[m.value?(i.openBlock(),i.createElementBlock("div",gf,[i.createVNode(A,{checked:_.value,"onUpdate:checked":b},null,8,["checked"])])):i.createCommentVNode("",!0),!c.value&&((xe=f.value)!=null&&xe.isDisabled)?(i.openBlock(),i.createBlock(Y,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(L,{class:"pt-1.5"})]),default:i.withCtx(()=>[N[1]||(N[1]=i.createTextVNode(" Категория скрыта для клиента "))]),_:1,__:[1]})):i.createCommentVNode("",!0),((Ce=f.value)==null?void 0:Ce.isFavorite)??!1?(i.openBlock(),i.createBlock(Y,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(P,{class:"pt-1.5"})]),default:i.withCtx(()=>[N[2]||(N[2]=i.createTextVNode(" Избранная категория "))]),_:1,__:[2]})):i.createCommentVNode("",!0),((Fe=f.value)==null?void 0:Fe.isRequired)??!1?(i.openBlock(),i.createBlock(Y,{key:3,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(E,{class:"pt-1.5"})]),default:i.withCtx(()=>[N[3]||(N[3]=i.createTextVNode(" Доп. продажа "))]),_:1,__:[3]})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var xe,Ce,Fe;return[i.createElementVNode("div",{class:i.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":M.categoryItem.isHidden,"text-gray-400":(xe=f.value)==null?void 0:xe.isDisabled})},[i.createVNode(Y,{disabled:!M.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(M.categoryItem.name),1)]),default:i.withCtx(()=>[N[4]||(N[4]=i.createTextVNode(" Категория скрыта "))]),_:1,__:[4]},8,["disabled"])],2),i.createElementVNode("div",{onClick:N[0]||(N[0]=i.withModifiers((...Ie)=>i.unref(W.noop)&&i.unref(W.noop)(...Ie),["prevent","stop"]))},[(Ce=M.categoryItem.properties)!=null&&Ce.m2Price?(i.openBlock(),i.createBlock(H,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createTextVNode(" Средняя стоимость: "+i.toDisplayString(M.categoryItem.properties.m2Price)+" руб./м2 ",1)]),_:1},8,["size"])):i.createCommentVNode("",!0),d.value&&((Fe=f.value)!=null&&Fe.manager)?(i.openBlock(),i.createBlock(H,{key:1,size:i.unref(n),closable:!0,round:"",onClose:B},{default:i.withCtx(()=>[i.createVNode(Y,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var Ie,vt;return[i.createElementVNode("span",mf,[i.createVNode(I),i.createTextVNode(" "+i.toDisplayString((vt=(Ie=f.value)==null?void 0:Ie.manager)==null?void 0:vt.name),1)])]}),default:i.withCtx(()=>{var Ie,vt;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((vt=(Ie=f.value)==null?void 0:Ie.manager)==null?void 0:vt.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[M.showSlugs||M.showProperties?(i.openBlock(),i.createElementBlock("div",_f,[i.createElementVNode("ul",yf,[M.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:M.categoryItem.id,slug:M.categoryItem.slug},(xe,Ce)=>(i.openBlock(),i.createElementBlock("li",{key:Ce}," ("+i.toDisplayString(Ce)+"): "+i.toDisplayString(xe),1))),128)):i.createCommentVNode("",!0),M.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(M.categoryItem.properties,(xe,Ce)=>(i.openBlock(),i.createElementBlock("li",{key:Ce}," ("+i.toDisplayString(Ce)+"): "+i.toDisplayString(xe),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var xe;return[i.createElementVNode("div",bf,[c.value?(i.openBlock(),i.createBlock(Y,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(O,{size:i.unref(n),onClick:x},{default:i.withCtx(()=>{var Ce;return[(Ce=f.value)!=null&&Ce.isDisabled?(i.openBlock(),i.createBlock(L,{key:1})):(i.openBlock(),i.createBlock(U,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var Ce;return[(Ce=f.value)!=null&&Ce.isDisabled?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" Скрыто для клиента"+i.toDisplayString(f.value.hidingComment?`. Причина: '${f.value.hidingComment}'`:""),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Видимо клиенту")],64))]}),_:1})):i.createCommentVNode("",!0),d.value&&!((xe=f.value)!=null&&xe.manager)?(i.openBlock(),i.createBlock(Y,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(O,{size:i.unref(n),onClick:C},{default:i.withCtx(()=>[i.createVNode(z)]),_:1},8,["size"])]),default:i.withCtx(()=>{var Ce,Fe,Ie;return[(Ce=f.value)!=null&&Ce.manager?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode('Категория закреплена за "'+i.toDisplayString(((Ie=(Fe=f.value)==null?void 0:Fe.manager)==null?void 0:Ie.name)??"-")+'"',1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode("Закрепить")],64))]}),_:1})):i.createCommentVNode("",!0),h.value?(i.openBlock(),i.createBlock(Y,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(O,{ghost:!0,size:i.unref(n),type:"primary",onClick:v},{default:i.withCtx(()=>[i.createVNode(J)]),_:1},8,["size"])]),default:i.withCtx(()=>[N[5]||(N[5]=i.createTextVNode(" Редактировать "))]),_:1,__:[5]})):i.createCommentVNode("",!0),u.value.length>0?(i.openBlock(),i.createBlock(re,{key:3,options:u.value,size:i.unref(n),trigger:"click",onSelect:$},{default:i.withCtx(()=>[i.createVNode(O,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(pe)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(M.$slots,"default",{},()=>{var xe;return[s.value?(i.openBlock(),i.createBlock(va,{key:0,"categories-items":M.categoryItem.categories??[],"event-emitter":M.eventEmitter,"filtered-items":(xe=r.value)==null?void 0:xe.categories,"selected-categories-items":M.selectedCategoriesItems,"selected-products-items":M.selectedProductsItems,"show-slugs":M.showSlugs,"show-properties":M.showProperties,"show-product-costs":M.showProductCosts,"allow-name-click":M.allowNameClick,"allow-price-click":M.allowPriceClick,"show-price-history":M.showPriceHistory,"show-product-add-to-cart-button":M.showProductAddToCartButton,"show-product-edit-button":M.showProductEditButton,"product-context-buttons-config":M.productContextButtonsConfig,"show-hide-for-client-button":M.showHideForClientButton,"show-pin-button":M.showPinButton,"show-category-edit-button":M.showCategoryEditButton,"category-context-buttons-config":M.categoryContextButtonsConfig},null,8,["categories-items","event-emitter","filtered-items","selected-categories-items","selected-products-items","show-slugs","show-properties","show-product-costs","allow-name-click","allow-price-click","show-price-history","show-product-add-to-cart-button","show-product-edit-button","product-context-buttons-config","show-hide-for-client-button","show-pin-button","show-category-edit-button","category-context-buttons-config"])):i.createCommentVNode("",!0),l.value?(i.openBlock(),i.createBlock(ge,{key:1,columns:R.value,data:a.value,bordered:!0,loading:p.value,remote:!0,"row-key":Ce=>Ce.id,"table-layout":y.value,class:"mt-1"},null,8,["columns","data","loading","row-key","table-layout"])):i.createCommentVNode("",!0),!p.value&&!g.value&&!s.value&&!l.value?(i.openBlock(),i.createBlock(ie,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),g.value?(i.openBlock(),i.createBlock(ie,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),p.value?(i.openBlock(),i.createBlock(Me,{key:4,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>N[6]||(N[6]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),kf=Ln(vf,[["__scopeId","data-v-0c971738"]]),xf={class:"sc-collapse flex w-full flex-col"},Cf={},wa=i.defineComponent({...Cf,__name:"collapse",props:{defaultExpandedNames:{default:()=>[]},expandedNames:{default:()=>[]}},emits:["on-item-header-click"],setup(e,{emit:t}){const n=e,r=t,s=(o,a)=>{r("on-item-header-click",o,a)};return i.provide("itemHeaderClickHandler",s),i.provide("defaultExpandedNames",n.defaultExpandedNames),i.provide("expandedNames",n.expandedNames),(o,a)=>(i.openBlock(),i.createElementBlock("div",xf,[i.renderSlot(o.$slots,"default")]))}}),Sf={},va=i.defineComponent({...Sf,__name:"category-collapse",props:{categoriesItems:{},loading:{type:Boolean,default:!1},filteredItems:{default:void 0},selectedCategoriesItems:{default:void 0},selectedProductsItems:{default:void 0},showHideForClientButton:{type:[Boolean,Function],default:!1},showPinButton:{type:[Boolean,Function],default:!1},showCategoryEditButton:{type:[Boolean,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showProductAddToCartButton:{type:[Boolean,Function],default:!1},showProductEditButton:{type:[Boolean,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(e){const t=e,n=i.inject(vr,"medium"),r=i.computed(()=>W.isUndefined(t.filteredItems)?t.categoriesItems:t.categoriesItems.filter(o=>{var a;return!!((a=t.filteredItems)!=null&&a[o.id])})),s=(o,a)=>{if(W.isUndefined(a))return;const l=a[o.id];if(l==="*")return;const c={};return c[o.id]=structuredClone(i.toRaw(l)),c};return(o,a)=>{const l=V.NSpin,c=V.NAlert;return i.openBlock(),i.createElementBlock(i.Fragment,null,[r.value.length>0?(i.openBlock(),i.createBlock(wa,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(kf,{key:d.id,"category-item":d,"event-emitter":o.eventEmitter,"filtered-items":s(d,o.filteredItems),"selected-categories-items":o.selectedCategoriesItems,"selected-products-items":o.selectedProductsItems,"show-slugs":o.showSlugs,"show-properties":o.showProperties,"show-product-costs":o.showProductCosts,"allow-name-click":o.allowNameClick,"allow-price-click":o.allowPriceClick,"show-price-history":o.showPriceHistory,"show-product-add-to-cart-button":o.showProductAddToCartButton,"show-product-edit-button":o.showProductEditButton,"product-context-buttons-config":o.productContextButtonsConfig,"show-hide-for-client-button":o.showHideForClientButton,"show-pin-button":o.showPinButton,"show-category-edit-button":o.showCategoryEditButton,"category-context-buttons-config":o.categoryContextButtonsConfig},null,8,["category-item","event-emitter","filtered-items","selected-categories-items","selected-products-items","show-slugs","show-properties","show-product-costs","allow-name-click","allow-price-click","show-price-history","show-product-add-to-cart-button","show-product-edit-button","product-context-buttons-config","show-hide-for-client-button","show-pin-button","show-category-edit-button","category-context-buttons-config"]))),128))]),_:1})):o.loading?(i.openBlock(),i.createBlock(l,{key:1,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>a[0]||(a[0]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])),_:1},8,["size"])):i.createCommentVNode("",!0),!o.loading&&o.categoriesItems.length>0&&r.value.length===0?(i.openBlock(),i.createBlock(c,{key:2,"show-icon":!0,type:"warning",title:"Товары не найдены",class:"mx-10"})):i.createCommentVNode("",!0)],64)}}}),Bf={class:"text-sm"},Tf={class:"text-sm"},Ef={},$f=i.defineComponent({...Ef,__name:"add-product-to-cart-form",props:{product:{},cartItem:{default:void 0},validation:{default:()=>({length:{},quantity:{},marker:{}})},isSubmitProcessing:{type:Boolean}},emits:["submit"],setup(e,{emit:t}){var l,c,d,h,u,f,p,g;const n=e,r=i.ref(new G.CartItemBase(n.cartItem??new G.CartItemBase({product:n.product,quantity:((c=(l=n.product)==null?void 0:l.properties)==null?void 0:c.minCount)??1,length:((h=(d=n.product)==null?void 0:d.properties)==null?void 0:h.minLength)||((f=(u=n.product)==null?void 0:u.properties)!=null&&f.ignoreMinCountCheck?0:(g=(p=n.product)==null?void 0:p.properties)==null?void 0:g.minCount)||0}))),s=t,o=i.computed(()=>{var y,b,S,x,C,B,v,$,F;const m=((b=(y=n.product)==null?void 0:y.properties)==null?void 0:b.minLength)??((x=(S=n.product)==null?void 0:S.properties)!=null&&x.ignoreMinCountCheck?0:(B=(C=n.product)==null?void 0:C.properties)==null?void 0:B.minCount),_=($=(v=n.product)==null?void 0:v.properties)==null?void 0:$.maxLength;return m||_?`(${m?`от ${m}`:""}${m&&_?" ":""}${_?`до ${_}`:""} ${(F=n.product)==null?void 0:F.unit})`:""}),a=()=>{G.UnitsHelper.productIsMeasurable(n.product)||delete r.value.length,s("submit",r.value)};return(m,_)=>(i.openBlock(),i.createBlock(i.unref(V.NForm),{class:"flex flex-col gap-2"},{default:i.withCtx(()=>[i.unref(G.UnitsHelper).productIsMeasurable(m.product)?(i.openBlock(),i.createBlock(i.unref(V.NFormItem),{key:0,required:!0,feedback:m.validation.length.feedback||"","show-feedback":m.validation.length.showFeedback||i.unref(G.UnitsHelper).getProductLengthMultiplicity(m.product)!==.01||!1,"validation-status":m.validation.length.validationStatus||void 0,label:"Метраж, "+m.product.unit+o.value+"м."},i.createSlots({default:i.withCtx(()=>{var y,b;return[i.createVNode(i.unref(V.NInputNumber),{value:r.value.length,"onUpdate:value":_[0]||(_[0]=S=>r.value.length=S),max:((y=m.product.properties)==null?void 0:y.maxLength)||void 0,min:((b=m.product.properties)==null?void 0:b.minLength)||i.unref(G.UnitsHelper).getProductLengthMultiplicity(m.product),step:i.unref(G.UnitsHelper).getProductMultiplicity(m.product),validator:S=>S%i.unref(G.UnitsHelper).getProductLengthMultiplicity(m.product)===0,placeholder:"Введите метраж",class:"w-full"},null,8,["value","max","min","step","validator"])]}),_:2},[!m.validation.length.feedback&&i.unref(G.UnitsHelper).getProductLengthMultiplicity(m.product)!==.01?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Bf,"Метраж должен быть кратен "+i.toDisplayString(i.unref(G.UnitsHelper).getProductLengthMultiplicity(m.product)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status","label"])):i.createCommentVNode("",!0),i.createVNode(i.unref(V.NFormItem),{required:!0,feedback:m.validation.quantity.feedback||"","show-feedback":m.validation.quantity.showFeedback||i.unref(G.UnitsHelper).getProductMultiplicity(m.product)!==1||!1,"validation-status":m.validation.quantity.validationStatus||void 0,label:"Количество"},i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(V.NInputNumber),{value:r.value.quantity,"onUpdate:value":_[1]||(_[1]=y=>r.value.quantity=y),min:i.unref(G.UnitsHelper).getProductMultiplicity(m.product),step:i.unref(G.UnitsHelper).getProductMultiplicity(m.product),validator:y=>y%i.unref(G.UnitsHelper).getProductMultiplicity(m.product)===0,placeholder:"Введите количество",class:"w-full"},null,8,["value","min","step","validator"])]),_:2},[!m.validation.quantity.feedback&&i.unref(G.UnitsHelper).getProductMultiplicity(m.product)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Tf,"Количество должно быть кратно "+i.toDisplayString(i.unref(G.UnitsHelper).getProductMultiplicity(m.product)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(V.NFormItem),{feedback:m.validation.marker.feedback||"","show-feedback":m.validation.marker.showFeedback||!1,"validation-status":m.validation.marker.validationStatus||void 0,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NInput),{value:r.value.marker,"onUpdate:value":_[2]||(_[2]=y=>r.value.marker=y),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(V.NButton),{loading:m.isSubmitProcessing,disabled:r.value.length===0||r.value.quantity===0,type:"primary",class:"self-start",onClick:_[3]||(_[3]=y=>a())},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(m.cartItem?"Изменить":"В корзину"),1)]),_:1},8,["loading","disabled"])]),_:1}))}}),Nf={class:"flex flex-row gap-1"},Pf={class:"flex flex-col gap-1 text-base"},Rf=["href"],Ff={key:1,class:"text-sc-grey"},Mf={key:0,class:"text-sc-dark-grey truncate text-sm"},Af={key:0},Of={key:1,class:"text-sm"},Vf={},Sr=i.defineComponent({...Vf,__name:"client-name-with-short-info",props:{client:{},nameLink:{default:void 0},popoverPosition:{default:void 0},showCityAndRegion:{type:Boolean,default:!0},showSalesDirection:{type:Boolean,default:!1},showClientInfoIcon:{type:Boolean,default:!1}},emits:["click:client-name","click:client-info"],setup(e,{emit:t}){const n=e,r=t,s=i.computed(()=>n.client.lastLoginAt?Sn.format(n.client.lastLoginAt,G.AppConfigProvider.getConfig().dateFormats.uiDateWithTime):""),o=a=>{W.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=Cs,d=V.NButton,h=V.NPopover;return i.openBlock(),i.createElementBlock("div",Nf,[a.showClientInfoIcon?(i.openBlock(),i.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=u=>a.$emit("click:client-info",a.client))},{default:i.withCtx(()=>[i.createVNode(c)]),_:1})):i.createCommentVNode("",!0),i.createVNode(h,{disabled:i.unref(W.isNil)(a.popoverPosition),placement:a.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",Pf,[i.createElementVNode("a",{href:a.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=u=>o(u))},[i.createElementVNode("span",{class:i.normalizeClass({"line-through":!a.client.isActive})},i.toDisplayString(a.client.name),3),a.showSalesDirection&&a.client.salesDirection?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass({"line-through":!a.client.isActive})}," ("+i.toDisplayString(a.client.salesDirection.name)+") ",3)):i.createCommentVNode("",!0),a.client.isActive?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",Ff," [ Деактивирован ] "))],8,Rf),a.showCityAndRegion&&a.client.city?(i.openBlock(),i.createElementBlock("span",Mf," г. "+i.toDisplayString(a.client.city.name)+", "+i.toDisplayString(a.client.city.region.name),1)):i.createCommentVNode("",!0)])]),default:i.withCtx(()=>[a.client.alternativeName?(i.openBlock(),i.createElementBlock("div",Af,i.toDisplayString(a.client.alternativeName),1)):i.createCommentVNode("",!0),s.value?(i.openBlock(),i.createElementBlock("span",Of," Последний вход: "+i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),zf={class:"text-base"},If={},ka=i.defineComponent({...If,__name:"contragent-with-short-info",props:{contragent:{}},setup(e){return(t,n)=>(i.openBlock(),i.createElementBlock("span",zf,i.toDisplayString(t.contragent.name),1))}}),Lf={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Df(e,t){return i.openBlock(),i.createElementBlock("svg",Lf,t[0]||(t[0]=[i.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[i.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),i.createElementVNode("path",{d:"m3 7l9 6l9-6"})],-1)]))}const Hf=i.markRaw({name:"tabler-mail",render:Df}),Wf=["href"],jf={},Xf=i.defineComponent({...jf,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(e){return(t,n)=>{const r=Hf;return i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-row items-center gap-1":t.showEmailIcon})},[t.showEmailIcon?(i.openBlock(),i.createBlock(r,{key:0})):i.createCommentVNode("",!0),i.createElementVNode("a",{href:`mailto:${t.email}`,class:"no-underline"},i.toDisplayString(t.email),9,Wf)],2)}}}),qf={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Yf(e,t){return i.openBlock(),i.createElementBlock("svg",qf,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M444 49.9C431.3 38.2 379.9.9 265.3.4c0 0-135.1-8.1-200.9 52.3C27.8 89.3 14.9 143 13.5 209.5s-3.1 191.1 117 224.9h.1l-.1 51.6s-.8 20.9 13 25.1c16.6 5.2 26.4-10.7 42.3-27.8c8.7-9.4 20.7-23.2 29.8-33.7c82.2 6.9 145.3-8.9 152.5-11.2c16.6-5.4 110.5-17.4 125.7-142c15.8-128.6-7.6-209.8-49.8-246.5M457.9 287c-12.9 104-89 110.6-103 115.1c-6 1.9-61.5 15.7-131.2 11.2c0 0-52 62.7-68.2 79c-5.3 5.3-11.1 4.8-11-5.7c0-6.9.4-85.7.4-85.7q-.15 0 0 0C43.1 372.7 49.1 266.6 50.2 211.1s11.6-101 42.6-131.6c55.7-50.5 170.4-43 170.4-43c96.9.4 143.3 29.6 154.1 39.4c35.7 30.6 53.9 103.8 40.6 211.1m-139-80.8c.4 8.6-12.5 9.2-12.9.6c-1.1-22-11.4-32.7-32.6-33.9c-8.6-.5-7.8-13.4.7-12.9c27.9 1.5 43.4 17.5 44.8 46.2m20.3 11.3c1-42.4-25.5-75.6-75.8-79.3c-8.5-.6-7.6-13.5.9-12.9c58 4.2 88.9 44.1 87.8 92.5c-.1 8.6-13.1 8.2-12.9-.3m47 13.4c.1 8.6-12.9 8.7-12.9.1c-.6-81.5-54.9-125.9-120.8-126.4c-8.5-.1-8.5-12.9 0-12.9c73.7.5 133 51.4 133.7 139.2M374.9 329v.2c-10.8 19-31 40-51.8 33.3l-.2-.3c-21.1-5.9-70.8-31.5-102.2-56.5c-16.2-12.8-31-27.9-42.4-42.4c-10.3-12.9-20.7-28.2-30.8-46.6c-21.3-38.5-26-55.7-26-55.7c-6.7-20.8 14.2-41 33.3-51.8h.2c9.2-4.8 18-3.2 23.9 3.9c0 0 12.4 14.8 17.7 22.1c5 6.8 11.7 17.7 15.2 23.8c6.1 10.9 2.3 22-3.7 26.6l-12 9.6c-6.1 4.9-5.3 14-5.3 14s17.8 67.3 84.3 84.3c0 0 9.1.8 14-5.3l9.6-12c4.6-6 15.7-9.8 26.6-3.7c14.7 8.3 33.4 21.2 45.8 32.9c7 5.7 8.6 14.4 3.8 23.6"},null,-1)]))}const xa=i.markRaw({name:"fa6-brands-viber",render:Yf}),Uf={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},Gf=["id"],Kf=["id"],Zf=["fill"],Jf=["fill"];function Qf(e,t){return i.openBlock(),i.createElementBlock("svg",Uf,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:e.idMap.logosWhatsappIcon0,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},t[0]||(t[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#1FAF38"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#60D669"},null,-1)]),8,Gf),i.createElementVNode("linearGradient",{id:e.idMap.logosWhatsappIcon1,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},t[1]||(t[1]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#F9F9F9"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#FFF"},null,-1)]),8,Kf)]),i.createElementVNode("path",{fill:"url(#"+e.idMap.logosWhatsappIcon0+")",d:"M5.463 127.456c-.006 21.677 5.658 42.843 16.428 61.499L4.433 252.697l65.232-17.104a123 123 0 0 0 58.8 14.97h.054c67.815 0 123.018-55.183 123.047-123.01c.013-32.867-12.775-63.773-36.009-87.025c-23.23-23.25-54.125-36.061-87.043-36.076c-67.823 0-123.022 55.18-123.05 123.004"},null,8,Zf),i.createElementVNode("path",{fill:"url(#"+e.idMap.logosWhatsappIcon1+")",d:"M1.07 127.416c-.007 22.457 5.86 44.38 17.014 63.704L0 257.147l67.571-17.717c18.618 10.151 39.58 15.503 60.91 15.511h.055c70.248 0 127.434-57.168 127.464-127.423c.012-34.048-13.236-66.065-37.3-90.15C194.633 13.286 162.633.014 128.536 0C58.276 0 1.099 57.16 1.071 127.416m40.24 60.376l-2.523-4.005c-10.606-16.864-16.204-36.352-16.196-56.363C22.614 69.029 70.138 21.52 128.576 21.52c28.3.012 54.896 11.044 74.9 31.06c20.003 20.018 31.01 46.628 31.003 74.93c-.026 58.395-47.551 105.91-105.943 105.91h-.042c-19.013-.01-37.66-5.116-53.922-14.765l-3.87-2.295l-40.098 10.513z"},null,8,Jf),t[2]||(t[2]=i.createElementVNode("path",{fill:"#FFF",d:"M96.678 74.148c-2.386-5.303-4.897-5.41-7.166-5.503c-1.858-.08-3.982-.074-6.104-.074c-2.124 0-5.575.799-8.492 3.984c-2.92 3.188-11.148 10.892-11.148 26.561s11.413 30.813 13.004 32.94c1.593 2.123 22.033 35.307 54.405 48.073c26.904 10.609 32.379 8.499 38.218 7.967c5.84-.53 18.844-7.702 21.497-15.139c2.655-7.436 2.655-13.81 1.859-15.142c-.796-1.327-2.92-2.124-6.105-3.716s-18.844-9.298-21.763-10.361c-2.92-1.062-5.043-1.592-7.167 1.597c-2.124 3.184-8.223 10.356-10.082 12.48c-1.857 2.129-3.716 2.394-6.9.801c-3.187-1.598-13.444-4.957-25.613-15.806c-9.468-8.442-15.86-18.867-17.718-22.056c-1.858-3.184-.199-4.91 1.398-6.497c1.431-1.427 3.186-3.719 4.78-5.578c1.588-1.86 2.118-3.187 3.18-5.311c1.063-2.126.531-3.986-.264-5.579c-.798-1.593-6.987-17.343-9.819-23.64"},null,-1))])}const Ca=i.markRaw({name:"logos-whatsapp-icon",render:Qf,setup(){const e=()=>Math.random().toString(36).substr(2,10);return{idMap:{logosWhatsappIcon0:"uicons-"+e(),logosWhatsappIcon1:"uicons-"+e()}}}}),ep={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},tp=["id"],np=["fill"];function ip(e,t){return i.openBlock(),i.createElementBlock("svg",ep,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:e.idMap.logosTelegram0,x1:"50%",x2:"50%",y1:"0%",y2:"100%"},t[0]||(t[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#2AABEE"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#229ED9"},null,-1)]),8,tp)]),i.createElementVNode("path",{fill:"url(#"+e.idMap.logosTelegram0+")",d:"M128 0C94.06 0 61.48 13.494 37.5 37.49A128.04 128.04 0 0 0 0 128c0 33.934 13.5 66.514 37.5 90.51C61.48 242.506 94.06 256 128 256s66.52-13.494 90.5-37.49c24-23.996 37.5-56.576 37.5-90.51s-13.5-66.514-37.5-90.51C194.52 13.494 161.94 0 128 0"},null,8,np),t[1]||(t[1]=i.createElementVNode("path",{fill:"#FFF",d:"M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072"},null,-1))])}const Sa=i.markRaw({name:"logos-telegram",render:ip,setup(){return{idMap:{logosTelegram0:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),rp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function sp(e,t){return i.openBlock(),i.createElementBlock("svg",rp,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M391 480c-19.52 0-46.94-7.06-88-30c-49.93-28-88.55-53.85-138.21-103.38C116.91 298.77 93.61 267.79 61 208.45c-36.84-67-30.56-102.12-23.54-117.13C45.82 73.38 58.16 62.65 74.11 52a176.3 176.3 0 0 1 28.64-15.2c1-.43 1.93-.84 2.76-1.21c4.95-2.23 12.45-5.6 21.95-2c6.34 2.38 12 7.25 20.86 16c18.17 17.92 43 57.83 52.16 77.43c6.15 13.21 10.22 21.93 10.23 31.71c0 11.45-5.76 20.28-12.75 29.81c-1.31 1.79-2.61 3.5-3.87 5.16c-7.61 10-9.28 12.89-8.18 18.05c2.23 10.37 18.86 41.24 46.19 68.51s57.31 42.85 67.72 45.07c5.38 1.15 8.33-.59 18.65-8.47c1.48-1.13 3-2.3 4.59-3.47c10.66-7.93 19.08-13.54 30.26-13.54h.06c9.73 0 18.06 4.22 31.86 11.18c18 9.08 59.11 33.59 77.14 51.78c8.77 8.84 13.66 14.48 16.05 20.81c3.6 9.53.21 17-2 22c-.37.83-.78 1.74-1.21 2.75a176.5 176.5 0 0 1-15.29 28.58c-10.63 15.9-21.4 28.21-39.38 36.58A67.4 67.4 0 0 1 391 480"},null,-1)]))}const Ba=i.markRaw({name:"ion-call",render:sp}),op={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ap(e,t){return i.openBlock(),i.createElementBlock("svg",op,t[0]||(t[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l2 5l-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2m10 3a2 2 0 0 1 2 2m-2-6a6 6 0 0 1 6 6"},null,-1)]))}const lp=i.markRaw({name:"tabler-phone-call",render:ap}),cp={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},dp=["href"],hp=["href"],up=["href"],fp=["href"],pp={},gp=i.defineComponent({...pp,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(e){const t=e,n=i.computed(()=>{try{return t.phone?Wi.parsePhoneNumberWithError(t.phone,t.defaultCountry):void 0}catch{}return t.phone}),r=i.computed(()=>{var l;return W.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),s=i.computed(()=>{var l;return W.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var l;return W.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=lp,h=Ba,u=Sa,f=Ca,p=xa;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",{class:i.normalizeClass({"border-xl relative inline-flex items-center rounded px-2":r.value&&a.value,"min-w-10":!0}),onClick:c[0]||(c[0]=g=>a.value=!a.value),onFocusout:c[1]||(c[1]=g=>a.value=!1),onMouseleave:c[2]||(c[2]=g=>a.value=!1)},[i.createElementVNode("div",{class:i.normalizeClass({"flex flex-row items-center gap-1":l.showPhoneIcon})},[l.showPhoneIcon?(i.openBlock(),i.createBlock(d,{key:0})):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(s.value),1)],2),r.value&&a.value?(i.openBlock(),i.createElementBlock("div",cp,[r.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:`tel:${o.value}`,class:"text-blue-600 hover:animate-pulse hover:text-blue-600"},[i.createVNode(h)],8,dp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:1,href:`https://t.me/${o.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(u)],8,hp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${o.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(f)],8,up)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${o.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[i.createVNode(p)],8,fp)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),mp={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function _p(e,t){return i.openBlock(),i.createElementBlock("svg",mp,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"m20 8l-8 5l-8-5V6l8 5l8-5m0-2H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2"},null,-1)]))}const yp=i.markRaw({name:"mdi-envelope",render:_p}),bp={class:"flex flex-col gap-1"},wp={key:0,class:"mb-2 flex flex-col text-base"},vp={key:0,class:"text-sc-dark-grey text-sm"},kp={key:1,class:"whitespace-nowrap text-sm"},xp={key:2,class:"whitespace-nowrap text-sm"},Cp={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},Sp=["href"],Bp=["href"],Tp=["href"],Ep=["href"],$p=["href"],Np={key:0,class:"flex flex-col text-base"},Pp={key:0,class:"text-sc-dark-grey text-sm"},Rp={key:1,class:"mt-2 text-sm"},Fp={key:0,class:"-mt-1"},Mp={},Ap=i.defineComponent({...Mp,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(e){const t=e,n=i.computed(()=>{try{return t.contact.phone?Wi.parsePhoneNumberWithError(t.contact.phone,t.defaultCountry):void 0}catch{}return t.contact.phone}),r=i.computed(()=>{var c;return W.isString(n.value)?!1:((c=n.value)==null?void 0:c.isValid())??!1}),s=i.computed(()=>{var c;return W.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var c;return W.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("E.164"))??""}),a=i.computed(()=>r.value||t.contact.email),l=i.ref(!1);return(c,d)=>{var _,y;const h=Ba,u=Sa,f=Ca,p=xa,g=yp,m=V.NPopover;return i.openBlock(),i.createElementBlock("div",bp,[i.createVNode(m,{disabled:c.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var b,S,x,C;return[i.createElementVNode("div",{class:i.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(b=c.contact)!=null&&b.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${c.classes}`),style:i.normalizeStyle(c.styles),onMouseenter:d[0]||(d[0]=B=>l.value=!0),onFocusin:d[1]||(d[1]=B=>l.value=!0),onMouseleave:d[2]||(d[2]=B=>l.value=!1),onFocusout:d[3]||(d[3]=B=>l.value=!1)},[i.createElementVNode("div",null,[c.fullView&&(c.contact.name||(S=c.contact)!=null&&S.position)?(i.openBlock(),i.createElementBlock("div",wp,[i.createTextVNode(i.toDisplayString(c.contact.name)+" ",1),(x=c.contact)!=null&&x.position?(i.openBlock(),i.createElementBlock("span",vp,i.toDisplayString((C=c.contact)==null?void 0:C.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),c.contact.phone?(i.openBlock(),i.createElementBlock("div",kp,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),c.contact.email?(i.openBlock(),i.createElementBlock("div",xp,i.toDisplayString(c.contact.email),1)):i.createCommentVNode("",!0),a.value&&l.value?(i.openBlock(),i.createElementBlock("div",Cp,[r.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:`tel:${o.value}`,class:"text-blue-600 hover:text-3xl hover:text-blue-600"},[i.createVNode(h)],8,Sp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:1,href:`https://t.me/${o.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(u)],8,Bp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${o.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(f)],8,Tp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${o.value}`,class:"text-purple-600 hover:text-3xl hover:text-purple-600"},[i.createVNode(p)],8,Ep)):i.createCommentVNode("",!0),c.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${c.contact.email}`,class:"hover:text-3xl"},[i.createVNode(g)],8,$p)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var b,S,x,C;return[c.contact.name?(i.openBlock(),i.createElementBlock("div",Np,[i.createTextVNode(i.toDisplayString(c.contact.name)+" ",1),(b=c.contact)!=null&&b.position?(i.openBlock(),i.createElementBlock("span",Pp,i.toDisplayString((S=c.contact)==null?void 0:S.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),(x=c.contact)!=null&&x.comment?(i.openBlock(),i.createElementBlock("div",Rp,[d[4]||(d[4]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((C=c.contact)==null?void 0:C.comment),1)])):i.createCommentVNode("",!0)]}),_:1},8,["disabled"]),c.fullView&&((_=c.contact)!=null&&_.comment)?(i.openBlock(),i.createElementBlock("div",Fp,[d[5]||(d[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((y=c.contact)==null?void 0:y.comment),1)])):i.createCommentVNode("",!0)])}}}),Op={key:0,class:"flex w-fit items-center gap-2"},Vp={key:1,class:"flex flex-wrap gap-1"},zp={key:0},Ip={},qi=i.defineComponent({...Ip,__name:"configurators-product-info",props:{isProductSearching:{type:Boolean,default:!1},product:{default:void 0}},setup(e){const t=e,n=i.computed(()=>{var r,s;return(s=(r=t.product)==null?void 0:r.properties)==null?void 0:s.planingProductionDate});return(r,s)=>{const o=V.NSpin;return r.isProductSearching?(i.openBlock(),i.createElementBlock("div",Op,[i.createVNode(o,{size:17,class:"w-fit"}),s[0]||(s[0]=i.createElementVNode("div",null,"Выполняется поиск товара ...",-1))])):r.product.isNewRec()?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Vp,[i.createElementVNode("div",null,i.toDisplayString(r.product.code)+" - "+i.toDisplayString(r.product.name)+" - "+i.toDisplayString(r.product.costRub.toLocaleString())+" ₽ / "+i.toDisplayString(r.product.unit),1),n.value?(i.openBlock(),i.createElementBlock("div",zp,"(Планируемая дата производства: "+i.toDisplayString(n.value)+")",1)):i.createCommentVNode("",!0)]))}}}),Lp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Dp(e,t){return i.openBlock(),i.createElementBlock("svg",Lp,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"m289.94 256l95-95A24 24 0 0 0 351 127l-95 95l-95-95a24 24 0 0 0-34 34l95 95l-95 95a24 24 0 1 0 34 34l95-95l95 95a24 24 0 0 0 34-34Z"},null,-1)]))}const Br=i.markRaw({name:"ion-close",render:Dp}),Hp={class:"mr-3 flex flex-col gap-2"},Wp=["onClick"],jp={class:"h-full p-2"},Xp={},qp=i.defineComponent({...Xp,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(e,{emit:t}){const n=e,r=i.useTemplateRef("drawing-template-containers"),s=t;return i.onMounted(()=>{n.settings.allTemplates.forEach((o,a)=>{var c;const l=(c=r.value)==null?void 0:c.at(a);l&&s("init-draw-template",l,o)})}),i.watch(()=>n.settings.allTemplates,(o,a)=>{i.nextTick(()=>{o.forEach((l,c)=>{var d;if(!a.includes(l)){const h=(d=r.value)==null?void 0:d.at(c);h&&s("init-draw-template",h,l)}})})},{deep:!0}),(o,a)=>{const l=Br;return i.openBlock(),i.createBlock(i.unref(V.NScrollbar),{style:{"max-height":"12.5rem",width:"auto"},trigger:"none"},{default:i.withCtx(()=>[i.createElementVNode("div",Hp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.settings.allTemplates,(c,d)=>(i.openBlock(),i.createElementBlock("div",{key:d,class:"group relative"},[i.createVNode(i.unref(V.NPopover),{trigger:"hover",placement:"right"},{trigger:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["relative h-10 w-24 shrink-0 rounded-md border-2 border-solid border-slate-200",{"!border-green-700":d===o.selectTemplateIndex}]),onClick:h=>s("template:select",d)},[i.createElementVNode("div",jp,[i.createElementVNode("div",{ref_for:!0,ref:"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,Wp)]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(c.label),1)]),_:2},1024),c.isCustom&&!c.isNewRec()?(i.openBlock(),i.createBlock(i.unref(V.NButton),{key:0,size:"tiny",quaternary:"",circle:"",class:"!absolute right-0.5 top-0.5 !hidden group-hover:!flex",onClick:h=>s("remove-custom-template",d)},{default:i.withCtx(()=>[i.createVNode(l)]),_:2},1032,["onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),Ta=Ln(qp,[["__scopeId","data-v-828c3059"]]),Yp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Up(e,t){return i.openBlock(),i.createElementBlock("svg",Yp,t[0]||(t[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 Ea=i.markRaw({name:"ion-trash",render:Up}),Gp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Kp(e,t){return i.openBlock(),i.createElementBlock("svg",Gp,t[0]||(t[0]=[i.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)]))}const $a=i.markRaw({name:"ion-plus",render:Kp}),Zp={class:"flex flex-col gap-4"},Jp={class:"flex flex-col gap-2"},Qp={class:"mt-8 font-bold"},eg={class:"grid grow grid-cols-2 items-start gap-2"},tg={class:"flex flex-col gap-4"},ng={class:"flex gap-3"},ig={},Na=i.defineComponent({...ig,__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","click:view-switch","submit","click:add-line","click:remove-line","click:save-template"],setup(e,{emit:t}){const n=e,r=t,s=i.ref(structuredClone(i.toRaw(n.value.configuratorParams))),o=i.ref(!1),a=()=>{s.value.length>0&&(r("update:params",s.value),l("configuratorParams",s.value))},l=(c,d)=>{const h=new G.CartItemBase(n.value);h[c]=d,r("update:value",h)};return i.watch(()=>n.value.configuratorParams,c=>{s.value=W.cloneDeep(i.toRaw(c))},{deep:!0}),i.watch(()=>n.previewParams,c=>{s.value.linesWidths=c.linesWidths,s.value.linesAngles=c.linesAngles},{deep:!0}),(c,d)=>{const h=$a,u=Ea,f=V.NInput;return i.openBlock(),i.createBlock(i.unref(V.NForm),{class:"grid gap-2 md:grid-cols-2 md:gap-6"},{default:i.withCtx(()=>{var p,g,m,_,y,b,S,x,C;return[i.createElementVNode("div",Zp,[d[10]||(d[10]=i.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),c.settings.startTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(V.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NSelect),{value:s.value.startTailType,"onUpdate:value":[d[0]||(d[0]=B=>s.value.startTailType=B),a],options:c.settings.startTailConfigs.map(({label:B},v)=>({label:B,value:v})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",Jp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value.linesAngles,(B,v)=>{var $,F,R,X,M,N;return i.openBlock(),i.createElementBlock("div",{key:v,class:"flex items-start gap-2"},[i.createElementVNode("div",Qp,i.toDisplayString(v+1),1),i.createElementVNode("div",eg,[i.createVNode(i.unref(V.NFormItem),{label:"Ширина, мм",required:!0,feedback:(($=c.validation[`lines_widths[${v+1}]`])==null?void 0:$.feedback)||"","show-feedback":((F=c.validation[`lines_widths[${v+1}]`])==null?void 0:F.showFeedback)||!1,"validation-status":(R=c.validation[`lines_widths[${v+1}]`])==null?void 0:R.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NInputNumber),{value:s.value.linesWidths[v],"onUpdate:value":[A=>s.value.linesWidths[v]=A,a],min:s.value.linesWidths.length>1?c.settings.minLineWidth:c.settings.stripMinWidth,max:c.settings.maxLineWidth,step:c.settings.lineWidthStep,validator:A=>A%c.settings.lineWidthStep===0,class:"w-full"},null,8,["value","onUpdate:value","min","max","step","validator"])]),_:2},1032,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(V.NFormItem),{label:"Угол сгиба, °",required:!0,feedback:((X=c.validation[`lines_angles[${v+1}]`])==null?void 0:X.feedback)||"","show-feedback":((M=c.validation[`lines_angles[${v+1}]`])==null?void 0:M.showFeedback)||!1,"validation-status":(N=c.validation[`lines_angles[${v+1}]`])==null?void 0:N.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NInputNumber),{value:s.value.linesAngles[v],"onUpdate:value":[A=>s.value.linesAngles[v]=A,a],min:c.settings.minLineAngle,max:c.settings.maxLineAngle,step:c.settings.lineAngleStep,validator:A=>A%c.settings.lineAngleStep===0,class:"w-full"},null,8,["value","onUpdate:value","min","max","step","validator"])]),_:2},1032,["feedback","show-feedback","validation-status"])]),i.createVNode(i.unref(V.NFormItem),{label:void 0,"show-feedback":!1,required:!0,class:"shrink-0"},{default:i.withCtx(()=>[c.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(V.NButton),{key:0,size:"medium",onClick:A=>r("click:add-line",v)},{default:i.withCtx(()=>[i.createVNode(h)]),_:2},1032,["onClick"])),c.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(V.NButton),{key:1,disabled:s.value.linesWidths.length===1,size:"medium",class:"ml-2",onClick:A=>r("click:remove-line",v)},{default:i.withCtx(()=>[i.createVNode(u)]),_:2},1032,["disabled","onClick"]))]),_:2},1024)])}),128))]),c.settings.endTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(V.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NSelect),{value:s.value.endTailType,"onUpdate:value":[d[1]||(d[1]=B=>s.value.endTailType=B),a],options:c.settings.endTailConfigs.map(({label:B},v)=>({label:B,value:v})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(qi,{"is-product-searching":c.isProductSearching,product:c.value.product},null,8,["is-product-searching","product"]),c.settings.allowSaveTemplates&&c.selectTemplateIndex===c.settings.allTemplates.length-1?(i.openBlock(),i.createBlock(i.unref(V.NButton),{key:2,type:"tertiary",class:"self-start",loading:o.value,onClick:d[2]||(d[2]=B=>r("click:save-template"))},{default:i.withCtx(()=>d[9]||(d[9]=[i.createTextVNode(" Сохранить шаблон ")])),_:1,__:[9]},8,["loading"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",tg,[i.createVNode(i.unref(V.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NSelect),{value:s.value.colorSide,"onUpdate:value":[d[3]||(d[3]=B=>s.value.colorSide=B),a],options:[{label:"Цвет сверху",value:"top"},{label:" Цвет снизу",value:"bottom"}],placeholder:"С какой стороны изделие будет иметь цвет"},null,8,["value"])]),_:1}),i.createVNode(i.unref(V.NFormItem),{required:!0,"show-feedback":((p=c.validation.length)==null?void 0:p.showFeedback)||!1,feedback:((g=c.validation.length)==null?void 0:g.feedback)||"","validation-status":(m=c.validation.length)==null?void 0:m.validationStatus,label:`Метраж${c.settings.stripMinLength?" от "+c.settings.stripMinLength:""}${c.settings.stripMaxLength?" до "+c.settings.stripMaxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NInputNumber),{value:s.value.length,"onUpdate:value":[d[4]||(d[4]=B=>s.value.length=B),a],required:!0,max:c.settings.stripMaxLength||void 0,min:c.settings.stripMinLength,step:c.settings.lengthStep,validator:B=>B%c.settings.lengthStep===0,placeholder:"Введите метраж",class:"w-full"},null,8,["value","max","min","step","validator"])]),_:1},8,["show-feedback","feedback","validation-status","label"]),i.createVNode(i.unref(V.NFormItem),{required:!0,"show-feedback":((_=c.validation.quantity)==null?void 0:_.showFeedback)||!1,feedback:((y=c.validation.quantity)==null?void 0:y.feedback)||"","validation-status":(b=c.validation.quantity)==null?void 0:b.validationStatus,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NInputNumber),{value:c.value.quantity,"onUpdate:value":d[5]||(d[5]=B=>c.value.quantity=B),min:1,validator:B=>Number.isInteger(B),placeholder:"Введите количество",class:"w-full"},null,8,["value","validator"])]),_:1},8,["show-feedback","feedback","validation-status"]),i.createVNode(i.unref(V.NFormItem),{required:!0,"show-feedback":((S=c.validation.marker)==null?void 0:S.showFeedback)||!1,feedback:((x=c.validation.marker)==null?void 0:x.feedback)||"","validation-status":(C=c.validation.marker)==null?void 0:C.validationStatus,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(f,{value:c.value.marker,"onUpdate:value":d[6]||(d[6]=B=>c.value.marker=B),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["show-feedback","feedback","validation-status"]),i.createElementVNode("div",ng,[i.createVNode(i.unref(V.NButton),{loading:c.isSubmitProcessing,type:"primary",class:"self-start",onClick:d[7]||(d[7]=B=>r("submit",c.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(c.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading"]),c.settings.allowShowTable?(i.openBlock(),i.createBlock(i.unref(V.NButton),{key:0,type:"tertiary",class:"self-start",onClick:d[8]||(d[8]=B=>r("click:view-switch"))},{default:i.withCtx(()=>d[11]||(d[11]=[i.createTextVNode(" Показать в виде списка ")])),_:1,__:[11]})):i.createCommentVNode("",!0)])])]}),_:1})}}});var Pa=Object.defineProperty,rg=Object.defineProperties,sg=Object.getOwnPropertyDescriptors,Ra=Object.getOwnPropertySymbols,og=Object.prototype.hasOwnProperty,ag=Object.prototype.propertyIsEnumerable,Bs=(e,t,n)=>t in e?Pa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ts=(e,t)=>{for(var n in t||(t={}))og.call(t,n)&&Bs(e,n,t[n]);if(Ra)for(var n of Ra(t))ag.call(t,n)&&Bs(e,n,t[n]);return e},Es=(e,t)=>rg(e,sg(t)),Fa=(e,t)=>{for(var n in t)Pa(e,n,{get:t[n],enumerable:!0})},w=(e,t,n)=>(Bs(e,typeof t!="symbol"?t+"":t,n),n),Ma=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},xt=(e,t,n)=>(Ma(e,t,"read from private field"),n?n.call(e):t.get(e)),Aa=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},lg=(e,t,n,r)=>(Ma(e,t,"write to private field"),t.set(e,n),n),gt={Image:null,isHeadless:!1,shim:function(e,t){return e.tagName=e.nodeName=t||"canvas",e.nodeType=1,e.getAttribute=function(n){return this[n]},e.setAttribute=function(n,r){return this[n]=r,this},e},polyfill:function(e,t){return gt.shim(e),typeof t<"u"&&(gt.Image=t),gt.isHeadless=!0,e}},Oa={};Fa(Oa,{Curve:()=>vi,getAnchorsFromArcData:()=>hg,getComponentOnCubicBezier:()=>Yi,getControlPoints:()=>Ua,getCurveBoundingBox:()=>Xa,getCurveFromPoints:()=>Ya,getCurveLength:()=>ja,getReflection:()=>Ps,integrate:()=>qa,subdivide:()=>Ns});var Va={};Fa(Va,{HALF_PI:()=>Ke,NumArray:()=>Yt,TWO_PI:()=>ot,decomposeMatrix:()=>wi,getComputedMatrix:()=>La,getPoT:()=>Da,lerp:()=>Et,mod:()=>$t,setMatrix:()=>Ia,toFixed:()=>Pe});var He;typeof window<"u"?He=window:typeof global<"u"?He=global:typeof self<"u"&&(He=self);var za,ot=Math.PI*2,Ke=Math.PI*.5;function wi(e,t,n,r,s,o){let a;return arguments.length<=1?(a=e.a,t=e.b,n=e.c,r=e.d,s=e.e,o=e.f):a=e,{translateX:s,translateY:o,scaleX:Math.sqrt(a*a+t*t),scaleY:Math.sqrt(n*n+r*r),rotation:180*Math.atan2(t,a)/Math.PI}}function Ia(e){za=e}function La(e,t){t=t&&t.identity()||new za;let n=e;const r=[];for(;n&&n._matrix;)r.push(n._matrix),n=n.parent;r.reverse();for(let s=0;s<r.length;s++){const a=r[s].elements;t.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9])}return t}function Et(e,t,n){return n*(t-e)+e}var $s=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function Da(e){let t=0;for(;$s[t]&&$s[t]<e;)t++;return $s[t]}function $t(e,t){for(;e<0;)e+=t;return e%t}var Yt=He.Float32Array||Array,cg=Math.floor;function Pe(e){return cg(e*1e6)/1e6}var ee={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},j=class{constructor(){w(this,"_events",{}),w(this,"_bound",!1)}addEventListener(t,n){return(this._events[t]||(this._events[t]=[])).push(n),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(t,n){if(!this._events)return this;if(!t&&!n)return this._events={},this._bound=!1,this;const r=t?[t]:Object.keys(this._events);for(let s=0,o=r.length;s<o;s++){t=r[s];let a=this._events[t];if(a){let l=[];if(n)for(let c=0,d=a.length;c<d;c++){let h=a[c];h=h.handler?h.handler:h,n!==h&&l.push(h)}this._events[t]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(t){if(!this._events)return this;const n=Array.prototype.slice.call(arguments,1),r=this._events[t];if(r)for(let s=0;s<r.length;s++)r[s].call(this,...n);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(t,n,r){const s=this;t&&(o.obj=t,o.name=n,o.handler=r,t.on(n,o));function o(){r.apply(s,arguments)}return s}ignore(t,n,r){return t.off(n,r),this}};w(j,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),w(j,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);var Ha={x:{enumerable:!0,get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this._bound&&this.dispatchEvent(j.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this._bound&&this.dispatchEvent(j.Types.change))}}},Lt=class extends j{constructor(e=0,t=0){super(),w(this,"_x",0),w(this,"_y",0);for(let n in Ha)Object.defineProperty(this,n,Ha[n]);this.x=e,this.y=t}static add(e,t){return new Lt(e.x+t.x,e.y+t.y)}static sub(e,t){return new Lt(e.x-t.x,e.y-t.y)}static subtract(e,t){return Lt.sub(e,t)}static ratioBetween(e,t){return(e.x*t.x+e.y*t.y)/(e.length()*t.length())}static angleBetween(e,t){if(arguments.length>=4){const s=arguments[0]-arguments[2],o=arguments[1]-arguments[3];return Math.atan2(o,s)}const n=e.x-t.x,r=e.y-t.y;return Math.atan2(r,n)}static distanceBetween(e,t){return Math.sqrt(Lt.distanceBetweenSquared(e,t))}static distanceBetweenSquared(e,t){const n=e.x-t.x,r=e.y-t.y;return n*n+r*r}set(e,t){return this.x=e,this.y=t,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 Lt(this.x,this.y)}add(e,t){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+=t),this)}addSelf(e){return this.add.apply(this,arguments)}sub(e,t){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-=t),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,t){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*=t),this)}multiplySelf(e){return this.multiply.apply(this,arguments)}multiplyScalar(e){return this.multiply(e)}divide(e,t){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/=t),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 t=this.x-e.x,n=this.y-e.y;return t*t+n*n}setLength(e){return this.normalize().multiplyScalar(e)}equals(e,t){return t=typeof t>"u"?1e-4:t,this.distanceTo(e)<t}lerp(e,t){const n=(e.x-this.x)*t+this.x,r=(e.y-this.y)*t+this.y;return this.set(n,r)}isZero(e){return e=typeof e>"u"?1e-4:e,this.length()<e}toString(){return this.x+", "+this.y}toObject(){return{x:Pe(this.x),y:Pe(this.y)}}rotate(e){const t=this.x,n=this.y,r=Math.cos(e),s=Math.sin(e);return this.x=t*r-n*s,this.y=t*s+n*r,this}},Z=Lt;w(Z,"zero",new Lt),w(Z,"left",new Lt(-1,0)),w(Z,"right",new Lt(1,0)),w(Z,"up",new Lt(0,-1)),w(Z,"down",new Lt(0,1));var ve=class extends Z{constructor(t=0,n=0,r=0,s=0,o=0,a=0,l=ee.move){super(t,n),w(this,"controls",{left:new Z,right:new Z}),w(this,"_command",ee.move),w(this,"_relative",!0),w(this,"_rx",0),w(this,"_ry",0),w(this,"_xAxisRotation",0),w(this,"_largeArcFlag",0),w(this,"_sweepFlag",1);for(let d in Wa)Object.defineProperty(this,d,Wa[d]);this.command=l,this.relative=!0;const c=ve.makeBroadcast(this);this.controls.left.set(r,s).addEventListener(j.Types.change,c),this.controls.right.set(o,a).addEventListener(j.Types.change,c)}static makeBroadcast(t){return n;function n(){t._bound&&t.dispatchEvent(j.Types.change)}}static fromObject(t){return new ve().copy(t)}copy(t){return this.x=t.x,this.y=t.y,typeof t.command=="string"&&(this.command=t.command),t.controls&&(t.controls.left&&this.controls.left.copy(t.controls.left),t.controls.right&&this.controls.right.copy(t.controls.right)),typeof t.relative=="boolean"&&(this.relative=t.relative),typeof t.rx=="number"&&(this.rx=t.rx),typeof t.ry=="number"&&(this.ry=t.ry),typeof t.xAxisRotation=="number"&&(this.xAxisRotation=t.xAxisRotation),typeof t.largeArcFlag=="number"&&(this.largeArcFlag=t.largeArcFlag),typeof t.sweepFlag=="number"&&(this.sweepFlag=t.sweepFlag),this}clone(){return new ve().copy(this)}toObject(){return{x:Pe(this.x),y:Pe(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Pe(this.rx),ry:Pe(this.ry),xAxisRotation:Pe(this.xAxisRotation),largeArcFlag:Pe(this.largeArcFlag),sweepFlag:Pe(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},Wa={command:{enumerable:!0,get:function(){return this._command},set:function(e){this._command!==e&&(this._command=e,this._bound&&this.dispatchEvent(j.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(e){this._relative!==!!e&&(this._relative=!!e,this._bound&&this.dispatchEvent(j.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(e){this._rx!==e&&(this._rx=e,this._bound&&this.dispatchEvent(j.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(e){this._ry!==e&&(this._ry=e,this._bound&&this.dispatchEvent(j.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(e){this._xAxisRotation!==e&&(this._xAxisRotation=e,this._bound&&this.dispatchEvent(j.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag!==e&&(this._largeArcFlag=e,this._bound&&this.dispatchEvent(j.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag!==e&&(this._sweepFlag=e,this._bound&&this.dispatchEvent(j.Types.change))}}},dg=0,mt={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.18",PublishDate:"2025-04-07T22:33:48.746Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return dg++}},vi={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896257],[0,.7745966692414834],[.33998104358485626,.8611363115940526],[0,.5384693101056831,.906179845938664],[.2386191860831969,.6612093864662645,.932469514203152],[0,.4058451513773972,.7415311855993945,.9491079123427585],[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]],weights:[[1],[.8888888888888888,.5555555555555556],[.6521451548625461,.34785484513745385],[.5688888888888889,.47862867049936647,.23692688505618908],[.46791393457269104,.3607615730481386,.17132449237917036],[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096]]};function Yi(e,t,n,r,s){const o=1-e;return o*o*o*t+3*o*o*e*n+3*o*e*e*r+e*e*e*s}function Ns(e,t,n,r,s,o,a,l,c){c=c||vi.RecursionLimit;const d=c+1;if(Math.abs(e-a)<.001&&Math.abs(t-l)<.001)return[new ve(a,l)];const h=[];for(let u=0;u<d;u++){const f=u/d,p=Yi(f,e,n,s,a),g=Yi(f,t,r,o,l);h.push(new ve(p,g))}return h}function ja(e,t,n,r,s,o,a,l,c){if(e===n&&t===r&&s===a&&o===l){const _=a-e,y=l-t;return Math.sqrt(_*_+y*y)}const d=9*(n-s)+3*(a-e),h=6*(e+s)-12*n,u=3*(n-e),f=9*(r-o)+3*(l-t),p=6*(t+o)-12*r,g=3*(r-t);function m(_){const y=(d*_+h)*_+u,b=(f*_+p)*_+g;return Math.sqrt(y*y+b*b)}return qa(m,0,1,c||vi.RecursionLimit)}function Xa(e,t,n,r,s,o,a,l){const c=[],d=[[],[]];let h,u,f,p,g,m,_,y;for(let C=0;C<2;++C){if(C==0?(u=6*e-12*n+6*s,h=-3*e+9*n-9*s+3*a,f=3*n-3*e):(u=6*t-12*r+6*o,h=-3*t+9*r-9*o+3*l,f=3*r-3*t),Math.abs(h)<1e-12){if(Math.abs(u)<1e-12)continue;p=-f/u,0<p&&p<1&&c.push(p);continue}_=u*u-4*f*h,y=Math.sqrt(_),!(_<0)&&(g=(-u+y)/(2*h),0<g&&g<1&&c.push(g),m=(-u-y)/(2*h),0<m&&m<1&&c.push(m))}let b=c.length,S=b,x;for(;b--;)p=c[b],x=1-p,d[0][b]=x*x*x*e+3*x*x*p*n+3*x*p*p*s+p*p*p*a,d[1][b]=x*x*x*t+3*x*x*p*r+3*x*p*p*o+p*p*p*l;return d[0][S]=e,d[1][S]=t,d[0][S+1]=a,d[1][S+1]=l,d[0].length=d[1].length=S+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 qa(e,t,n,r){let s=vi.abscissas[r-2],o=vi.weights[r-2],a=.5*(n-t),l=a+t,c=0,d=r+1>>1,h=r&1?o[c++]*e(l):0;for(;c<d;){const u=a*s[c];h+=o[c++]*(e(l+u)+e(l-u))}return a*h}function Ya(e,t){const n=e.length,r=n-1;for(let s=0;s<n;s++){const o=e[s],a=t?$t(s-1,n):Math.max(s-1,0),l=t?$t(s+1,n):Math.min(s+1,r),c=e[a],d=o,h=e[l];Ua(c,d,h),d.command=s===0?ee.move:ee.curve}}function Ua(e,t,n){const r=Z.angleBetween(e,t),s=Z.angleBetween(n,t);let o=Z.distanceBetween(e,t),a=Z.distanceBetween(n,t),l=(r+s)/2;return o<1e-4||a<1e-4?(typeof t.relative=="boolean"&&!t.relative&&(t.controls.left.copy(t),t.controls.right.copy(t)),t):(o*=.33,a*=.33,s<r?l+=Ke:l-=Ke,t.controls.left.x=Math.cos(l)*o,t.controls.left.y=Math.sin(l)*o,l-=Math.PI,t.controls.right.x=Math.cos(l)*a,t.controls.right.y=Math.sin(l)*a,typeof t.relative=="boolean"&&!t.relative&&(t.controls.left.x+=t.x,t.controls.left.y+=t.y,t.controls.right.x+=t.x,t.controls.right.y+=t.y),t)}function Ps(e,t,n){return new Z(2*e.x-(t.x+e.x)-(n?e.x:0),2*e.y-(t.y+e.y)-(n?e.y:0))}function hg(e,t,n,r,s,o,a){const l=mt.Resolution;for(let c=0;c<l;c++){let d=(c+1)/l;a&&(d=1-d);const h=d*o+s,u=n*Math.cos(h),f=r*Math.sin(h),p=new ve(u,f);p.command=ee.line}}var Ga=Array.prototype.slice;function ug(e){if(e==null)return!1;const t=e.length;return typeof t=="number"&&t>=0&&t<4294967296}var ae={isNaN:function(e){return typeof e=="number"&&e!==+e},isElement:function(e){return!!(e&&e.nodeType===1)},isObject:function(e){const t=typeof e;return t==="function"||t==="object"&&!!e},extend:function(e){const t=Ga.call(arguments,1);for(let n=0;n<t.length;n++){const r=t[n];for(let s in r)e[s]=r[s]}return e},defaults:function(e){const t=Ga.call(arguments,1);for(let n=0;n<t.length;n++){const r=t[n];for(let s in r)e[s]===void 0&&(e[s]=r[s])}return e},each:function(e,t,n){const r=n||this,s=!ug(e)&&Object.keys(e),o=(s||e).length;for(let a=0;a<o;a++){const l=s?s[a]:a;t.call(r,e[l],l,e)}return e},performance:He.performance&&He.performance.now?He.performance:Date},Nt={hasEventListeners:typeof He.addEventListener=="function",bind:function(e,t,n,r){return this.hasEventListeners?e.addEventListener(t,n,!!r):e.attachEvent("on"+t,n),Nt},unbind:function(e,t,n,r){return Nt.hasEventListeners?e.removeEventListeners(t,n,!!r):e.detachEvent("on"+t,n),Nt},getRequestAnimationFrame:function(){const e=["ms","moz","webkit","o"];let t=0,n=He.requestAnimationFrame;if(!n){for(let s=0;s<e.length;s++)n=He[e[s]+"RequestAnimationFrame"]||n;n=n||r}function r(s,o){const a=new Date().getTime(),l=Math.max(0,16-(a-t)),c=He.setTimeout(d,l);t=a+l;function d(){s(a+l)}return c}return n}},ki=He.document?He.document.createElement("div"):{};ki.id="help-two-load",Object.defineProperty(Nt,"temp",{enumerable:!0,get:function(){return ae.isElement(ki)&&!He.document.head.contains(ki)&&(ki.style.display="none",He.document.head.appendChild(ki)),ki}});var Ct=class extends Error{constructor(t){super(),w(this,"name","Two.js"),w(this,"message"),this.message=t}},fg=He.devicePixelRatio||1;function pg(e){return e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1}function Rs(e){return fg/pg(e)}var Tr=class{constructor(){w(this,"map",{})}add(t,n){return this.map[t]=n,this}remove(t){return delete this.map[t],this}get(t){return this.map[t]}contains(t){return t in this.map}},at,Bn=class extends Array{constructor(){super(),Aa(this,at,new j),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 xt(this,at)}set _events(t){lg(this,at,t)}get _bound(){return xt(this,at)._bound}set _bound(t){xt(this,at)._bound=t}addEventListener(){return xt(this,at).addEventListener.apply(this,arguments)}on(){return xt(this,at).on.apply(this,arguments)}bind(){return xt(this,at).bind.apply(this,arguments)}removeEventListener(){return xt(this,at).removeEventListener.apply(this,arguments)}off(){return xt(this,at).off.apply(this,arguments)}unbind(){return xt(this,at).unbind.apply(this,arguments)}dispatchEvent(){return xt(this,at).dispatchEvent.apply(this,arguments)}trigger(){return xt(this,at).trigger.apply(this,arguments)}listen(){return xt(this,at).listen.apply(this,arguments)}ignore(){return xt(this,at).ignore.apply(this,arguments)}pop(){const t=super.pop.apply(this,arguments);return this.trigger(j.Types.remove,[t]),t}shift(){const t=super.shift.apply(this,arguments);return this.trigger(j.Types.remove,[t]),t}push(){const t=super.push.apply(this,arguments);return this.trigger(j.Types.insert,arguments),t}unshift(){const t=super.unshift.apply(this,arguments);return this.trigger(j.Types.insert,arguments),t}splice(){const t=super.splice.apply(this,arguments);if(this.trigger(j.Types.remove,t),arguments.length>2){const n=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(j.Types.insert,n),this.trigger(j.Types.order)}return t}sort(){return super.sort.apply(this,arguments),this.trigger(j.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(j.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(t,n){const r=[];for(let s=0;s<this.length;s++){const o=this[s];let a;n?a=t.call(n,o,s):a=t(o,s),r.push(a)}return r}};at=new WeakMap;var Ka=class extends j{constructor(){super(),w(this,"_flagId",!1),w(this,"_flagClassName",!1),w(this,"_renderer",{}),w(this,"_id",mt.Identifier+mt.uniqueId()),w(this,"_className",""),w(this,"classList",[]);for(let e in Za)Object.defineProperty(this,e,Za[e])}static fromObject(e){const t=new Ka().copy(e);return"id"in e&&(t.id=e.id),t}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(e){return this.renderer.type=e.renderer.type,this.className=e.className,this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}},Dn=Ka;w(Dn,"Properties",["renderer","id","className"]);var Za={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(e){const t=this._id;e!==this._id&&(this._id=e,this._flagId=!0,this.parent&&(delete this.parent.children.ids[t],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(e){this._className!==e&&(this._flagClassName=!0,this.classList=e.split(/\s+?/),this._className=e)}}},Er,Ja={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};He.document&&(Er=document.createElement("a"));var Ze=class extends Dn{constructor(e,t){super(),w(this,"_flagSrc",!1),w(this,"_flagImage",!1),w(this,"_flagVideo",!1),w(this,"_flagLoaded",!1),w(this,"_flagRepeat",!1),w(this,"_flagOffset",!1),w(this,"_flagScale",!1),w(this,"_src",""),w(this,"_image",null),w(this,"_loaded",!1),w(this,"_repeat","no-repeat"),w(this,"_scale",1),w(this,"_offset",null);for(let n in Qa)Object.defineProperty(this,n,Qa[n]);if(this._renderer.type="texture",this._renderer.flagOffset=gg.bind(this),this._renderer.flagScale=mg.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new Z,typeof t=="function"){const n=(function(){this.unbind(j.Types.load,n),typeof t=="function"&&t()}).bind(this);this.bind(j.Types.load,n)}if(typeof e=="string")this.src=e;else if(typeof e=="object"){const n=Object.prototype.toString.call(e);(n==="[object HTMLImageElement]"||n==="[object HTMLCanvasElement]"||n==="[object HTMLVideoElement]"||n==="[object Image]")&&(this.image=e)}this._update()}fromObject(e){const t=new Ze().copy(e);return"id"in e&&(t.id=e.id),t}static getAbsoluteURL(e){return Er?(Er.href=e,Er.href):e}static loadHeadlessBuffer(e,t){e.image.onload=t,e.image.src=e.src}static getTag(e){return e&&e.nodeName&&e.nodeName.toLowerCase()||"img"}static getImage(e){const t=Ze.getAbsoluteURL(e);if(Ze.ImageRegistry.contains(t))return Ze.ImageRegistry.get(t);let n;return gt.Image?(n=new gt.Image,gt.shim(n,"img")):He.document?Ja.video.test(t)?n=document.createElement("video"):n=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),n.crossOrigin="anonymous",n.referrerPolicy="no-referrer",n}static load(e,t){let n=e.image,r=Ze.getTag(n);e._flagImage&&(/canvas/i.test(r)?Ze.Register.canvas(e,t):(e._src=!gt.isHeadless&&n.getAttribute("two-src")||n.src,Ze.Register[r](e,t))),e._flagSrc&&(n||(n=Ze.getImage(e.src),e.image=n),r=Ze.getTag(n),Ze.Register[r](e,t))}clone(){const e=new Ze(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 Z?e.offset:new Z().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof Z?e.scale:new Z().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(j.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Ze.load(this,(function(){this.loaded=!0,this.trigger(j.Types.change).trigger(j.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("elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}},Ee=Ze;w(Ee,"Properties",["src","loaded","repeat","scale","offset","image"]),w(Ee,"RegularExpressions",Ja),w(Ee,"ImageRegistry",new Tr),w(Ee,"Register",{canvas:function(e,t){e._src="#"+e.id,Ze.ImageRegistry.add(e.src,e.image),typeof t=="function"&&t()},img:function(e,t){const n=e.image,r=function(o){!gt.isHeadless&&n.removeEventListener&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1)),typeof t=="function"&&t()},s=function(o){throw!gt.isHeadless&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1)),new Ct("unable to load "+e.src)};typeof n.width=="number"&&n.width>0&&typeof n.height=="number"&&n.height>0?r():!gt.isHeadless&&typeof n.addEventListener=="function"&&(n.addEventListener("load",r,!1),n.addEventListener("error",s,!1)),e._src=Ze.getAbsoluteURL(e._src),!(!gt.isHeadless&&n&&n.getAttribute("two-src"))&&(gt.isHeadless||n.setAttribute("two-src",e.src),Ze.ImageRegistry.add(e.src,n),gt.isHeadless?Ze.loadHeadlessBuffer(e,r):e.image.src=e.src)},video:function(e,t){if(gt.isHeadless)throw new Ct("video textures are not implemented in headless environments.");const n=function(s){e.image.removeEventListener("canplaythrough",n,!1),e.image.removeEventListener("error",r,!1),e.image.width=e.image.videoWidth,e.image.height=e.image.videoHeight,typeof t=="function"&&t()},r=function(s){throw e.image.removeEventListener("canplaythrough",n,!1),e.image.removeEventListener("error",r,!1),new Ct("unable to load "+e.src)};e._src=Ze.getAbsoluteURL(e._src),e.image.getAttribute("two-src")||(e.image.setAttribute("two-src",e.src),Ze.ImageRegistry.add(e.src,e.image)),e.image.readyState>=4?n():(e.image.addEventListener("canplaythrough",n,!1),e.image.addEventListener("error",r,!1),e.image.src=e.src,e.image.load())}});var Qa={src:{enumerable:!0,get:function(){return this._src},set:function(e){this._src=e,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(e){this._loaded=e,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(e){this._repeat=e,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(e){const t=Ee.getTag(e);let n;switch(t){case"canvas":n="#"+e.id;break;default:n=e.src}Ee.ImageRegistry.contains(n)?this._image=Ee.ImageRegistry.get(e.src):this._image=e,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset&&this._offset.unbind(j.Types.change,this._renderer.flagOffset),this._offset=e,this._offset.bind(j.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof Z&&this._scale.unbind(j.Types.change,this._renderer.flagScale),this._scale=e,this._scale instanceof Z&&this._scale.bind(j.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function gg(){this._flagOffset=!0}function mg(){this._flagScale=!0}var Dt=class extends Dn{constructor(e,t,n){super(),w(this,"_flagOffset",!0),w(this,"_flagOpacity",!0),w(this,"_flagColor",!0),w(this,"_offset",0),w(this,"_opacity",1),w(this,"_color","#fff");for(let r in el)Object.defineProperty(this,r,el[r]);this._renderer.type="stop",this.offset=typeof e=="number"?e:Dt.Index<=0?0:1,this.opacity=typeof n=="number"?n:1,this.color=typeof t=="string"?t:Dt.Index<=0?"#fff":"#000",Dt.Index=(Dt.Index+1)%2}static fromObject(e){const t=new Dt().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Dt.Properties.length;t++){const n=Dt.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Dt;return ae.each(Dt.Properties,function(n){t[n]=this[n]},this),e&&e.stops&&e.stops.push(t),t}toObject(){const e=super.toObject.call(this);return e.renderer.type="stop",ae.each(Dt.Properties,t=>{e[t]=this[t]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}},Ut=Dt;w(Ut,"Index",0),w(Ut,"Properties",["offset","opacity","color"]);var el={offset:{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset=e,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(e){this._color=e,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Hn=class extends Dn{constructor(e){super(),w(this,"_flagStops",!1),w(this,"_flagSpread",!1),w(this,"_flagUnits",!1),w(this,"_spread",""),w(this,"_units","");for(let t in tl)Object.defineProperty(this,t,tl[t]);this._renderer.type="gradient",this._renderer.flagStops=_g.bind(this),this._renderer.bindStops=yg.bind(this),this._renderer.unbindStops=bg.bind(this),this.spread="pad",this.units="objectBoundingBox",e&&(this.stops=e)}static fromObject(e){let t=e.stops;t&&t.length>0&&(t=t.map(r=>r instanceof Ut?r:new Ut().copy(r)));const n=new Hn().copy(e);return"id"in e&&(n.id=e.id),n}clone(e){const t=this.stops.map(r=>r.clone()),n=new Hn(t);return ae.each(Hn.Properties,r=>{n[r]=this[r]},this),e&&e.add(n),n}copy(e){super.copy.call(this,e);for(let t=0;t<Hn.Properties.length;t++){const n=Hn.Properties[t];n in e&&(this[n]=e[n])}return this}toObject(){const e={stops:this.stops.map(t=>t.toObject())};return ae.each(Hn.Properties,t=>{e[t]=this[t]},this),e}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(j.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}},Ye=Hn;w(Ye,"Stop",Ut),w(Ye,"Properties",["spread","stops","units"]);var tl={spread:{enumerable:!0,get:function(){return this._spread},set:function(e){this._spread=e,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(e){this._units=e,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(e){const t=this._renderer.bindStops,n=this._renderer.unbindStops;this._stops&&this._stops.unbind(j.Types.insert,t).unbind(j.Types.remove,n),this._stops=new Bn((e||[]).slice(0)),this._stops.bind(j.Types.insert,t).bind(j.Types.remove,n),t(this._stops)}}};function _g(){this._flagStops=!0}function yg(e){let t=e.length;for(;t--;)e[t].bind(j.Types.change,this._renderer.flagStops),e[t].parent=this;this._renderer.flagStops()}function bg(e){let t=e.length;for(;t--;)e[t].unbind(j.Types.change,this._renderer.flagStops),delete e[t].parent;this._renderer.flagStops()}var Ui=class extends Ye{constructor(e,t,n,r,s){super(s),w(this,"_flagEndPoints",!1),w(this,"_left",null),w(this,"_right",null);for(let o in nl)Object.defineProperty(this,o,nl[o]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=wg.bind(this),this.left=new Z,this.right=new Z,typeof e=="number"&&(this.left.x=e),typeof t=="number"&&(this.left.y=t),typeof n=="number"&&(this.right.x=n),typeof r=="number"&&(this.right.y=r)}static fromObject(e){const t=new Ui().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Ui.Properties.length;t++){const n=Ui.Properties[t];n in e&&(this[n]=e[n]instanceof Z?e[n]:new Z().copy(e[n]))}return this}clone(e){const t=this.stops.map(function(r){return r.clone()}),n=new Ui(this.left._x,this.left._y,this.right._x,this.right._y,t);return ae.each(Ye.Properties,function(r){n[r]=this[r]},this),e&&e.add(n),n}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(j.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}},Oe=Ui;w(Oe,"Stop",Ut),w(Oe,"Properties",["left","right"]);var nl={left:{enumerable:!0,get:function(){return this._left},set:function(e){this._left instanceof Z&&this._left.unbind(j.Types.change,this._renderer.flagEndPoints),this._left=e,this._left.bind(j.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(e){this._right instanceof Z&&this._right.unbind(j.Types.change,this._renderer.flagEndPoints),this._right=e,this._right.bind(j.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function wg(){this._flagEndPoints=!0}var Wn=class extends Ye{constructor(e,t,n,r,s,o){super(r),w(this,"_flagRadius",!1),w(this,"_flagCenter",!1),w(this,"_flagFocal",!1),w(this,"_radius",0),w(this,"_center",null),w(this,"_focal",null);for(let a in il)Object.defineProperty(this,a,il[a]);this._renderer.type="radial-gradient",this._renderer.flagCenter=vg.bind(this),this._renderer.flagFocal=kg.bind(this),this.center=new Z,this.radius=typeof n=="number"?n:1,this.focal=new Z,typeof e=="number"&&(this.center.x=e),typeof t=="number"&&(this.center.y=t),this.focal.copy(this.center),typeof s=="number"&&(this.focal.x=s),typeof o=="number"&&(this.focal.y=o)}static fromObject(e){const t=new Wn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Wn.Properties.length;t++){const n=Wn.Properties[t];n in e&&(/(center|focal)i/.test(n)?this[n]=e[n]instanceof Z?e[n]:new Z().copy(e[n]):typeof e[n]=="number"&&(this[n]=e[MediaKeySystemAccess]))}return this}clone(e){const t=this.stops.map(function(r){return r.clone()}),n=new Wn(this.center._x,this.center._y,this._radius,t,this.focal._x,this.focal._y);return ae.each(Ye.Properties.concat(Wn.Properties),function(r){n[r]=this[r]},this),e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return ae.each(Wn.Properties,function(t){e[t]=this[t]},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(j.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}},Ve=Wn;w(Ve,"Stop",Ut),w(Ve,"Properties",["center","radius","focal"]);var il={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(e){this._center&&this._center.unbind(j.Types.change,this._renderer.flagCenter),this._center=e,this._center.bind(j.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(e){this._focal&&this._focal.unbind(j.Types.change,this._renderer.flagFocal),this._focal=e,this._focal.bind(j.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function vg(){this._flagCenter=!0}function kg(){this._flagFocal=!0}function rl(e,t){if(t===0||t===1)return!0;const r=e._length*t;let s=0;for(let o=0;o<e._lengths.length;o++){const a=e._lengths[o];if(s>=r)return r-s>=0;s+=a}return!1}function $r(e,t){const n=e._length;if(t<=0)return 0;if(t>=n)return e._lengths.length-1;for(let r=0,s=0;r<e._lengths.length;r++){if(s+e._lengths[r]>=t)return t-=s,Math.max(r-1,0)+t/e._lengths[r];s+=e._lengths[r]}return-1}function sl(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,f=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(f||e).x,d=(f||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),f&&e._relative&&(o+=e.x,d+=e.y),ja(r,l,s,c,o,d,a,h,n)}function ol(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,f=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(f||e).x,d=(f||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),f&&e._relative&&(o+=e.x,d+=e.y),Ns(r,l,s,c,o,d,a,h,n)}function jn(e){switch(e.renderer.type){case"texture":return Ee.fromObject(e);case"gradient":return Ye.fromObject(e);case"linear-gradient":return Oe.fromObject(e);case"radial-gradient":return Ve.fromObject(e)}return e}var xg=Math.cos,Cg=Math.sin,al=Math.tan,Fs=[],Pt=class extends j{constructor(e,t,n,r,s,o){super(),w(this,"elements",new Yt(9)),w(this,"manual",!1);let a=e;Array.isArray(a)||(a=Array.prototype.slice.call(arguments)),this.identity(),a.length>0&&this.set(a)}static Multiply(e,t,n){if(t.length<=3){const C=e;let B,v,$;const F=t[0]||0,R=t[1]||0,X=t[2]||0;return B=C[0]*F+C[1]*R+C[2]*X,v=C[3]*F+C[4]*R+C[5]*X,$=C[6]*F+C[7]*R+C[8]*X,[B,v,$]}const r=e[0],s=e[1],o=e[2],a=e[3],l=e[4],c=e[5],d=e[6],h=e[7],u=e[8],f=t[0],p=t[1],g=t[2],m=t[3],_=t[4],y=t[5],b=t[6],S=t[7],x=t[8];return n=n||new Yt(9),n[0]=r*f+s*m+o*b,n[1]=r*p+s*_+o*S,n[2]=r*g+s*y+o*x,n[3]=a*f+l*m+c*b,n[4]=a*p+l*_+c*S,n[5]=a*g+l*y+c*x,n[6]=d*f+h*m+u*b,n[7]=d*p+h*_+u*S,n[8]=d*g+h*y+u*x,n}static fromObject(e){return new Pt().copy(e)}set(e,t,n,r,s,o,a,l,c){if(typeof t>"u"){const d=e;e=d[0],t=d[1],n=d[2],r=d[3],s=d[4],o=d[5],a=d[6],l=d[7],c=d[8]}return this.elements[0]=e,this.elements[1]=t,this.elements[2]=n,this.elements[3]=r,this.elements[4]=s,this.elements[5]=o,this.elements[6]=a,this.elements[7]=l,this.elements[8]=c,this.trigger(j.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(j.Types.change)}identity(){return this.elements[0]=Pt.Identity[0],this.elements[1]=Pt.Identity[1],this.elements[2]=Pt.Identity[2],this.elements[3]=Pt.Identity[3],this.elements[4]=Pt.Identity[4],this.elements[5]=Pt.Identity[5],this.elements[6]=Pt.Identity[6],this.elements[7]=Pt.Identity[7],this.elements[8]=Pt.Identity[8],this.trigger(j.Types.change)}multiply(e,t,n,r,s,o,a,l,c){if(typeof t>"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(j.Types.change);if(typeof n>"u"&&(n=1),typeof r>"u"){e=e||0,t=t||0,n=n||0,s=this.elements;const N=s[0]*e+s[1]*t+s[2]*n,A=s[3]*e+s[4]*t+s[5]*n,L=s[6]*e+s[7]*t+s[8]*n;return[N,A,L]}const d=this.elements,h=[e,t,n,r,s,o,a,l,c],u=d[0],f=d[1],p=d[2],g=d[3],m=d[4],_=d[5],y=d[6],b=d[7],S=d[8],x=h[0],C=h[1],B=h[2],v=h[3],$=h[4],F=h[5],R=h[6],X=h[7],M=h[8];return this.elements[0]=u*x+f*v+p*R,this.elements[1]=u*C+f*$+p*X,this.elements[2]=u*B+f*F+p*M,this.elements[3]=g*x+m*v+_*R,this.elements[4]=g*C+m*$+_*X,this.elements[5]=g*B+m*F+_*M,this.elements[6]=y*x+b*v+S*R,this.elements[7]=y*C+b*$+S*X,this.elements[8]=y*B+b*F+S*M,this.trigger(j.Types.change)}inverse(e){const t=this.elements;e=e||new Pt;const n=t[0],r=t[1],s=t[2],o=t[3],a=t[4],l=t[5],c=t[6],d=t[7],h=t[8],u=h*a-l*d,f=-h*o+l*c,p=d*o-a*c;let g=n*u+r*f+s*p;return g?(g=1/g,e.elements[0]=u*g,e.elements[1]=(-h*r+s*d)*g,e.elements[2]=(l*r-s*a)*g,e.elements[3]=f*g,e.elements[4]=(h*n-s*c)*g,e.elements[5]=(-l*n+s*o)*g,e.elements[6]=p*g,e.elements[7]=(-d*n+r*c)*g,e.elements[8]=(a*n-r*o)*g,e):null}scale(e,t){return arguments.length<=1&&(t=e),this.multiply(e,0,0,0,t,0,0,0,1)}rotate(e){const t=xg(e),n=Cg(e);return this.multiply(t,-n,0,n,t,0,0,0,1)}translate(e,t){return this.multiply(1,0,e,0,1,t,0,0,1)}skewX(e){const t=al(e);return this.multiply(1,t,0,0,1,0,0,0,1)}skewY(e){const t=al(e);return this.multiply(1,0,0,t,1,0,0,0,1)}toString(e){return Fs.length=0,this.toTransformArray(e,Fs),Fs.map(Pe).join(" ")}toTransformArray(e,t){const n=this.elements,r=!!t,s=n[0],o=n[1],a=n[2],l=n[3],c=n[4],d=n[5];if(e){const h=n[6],u=n[7],f=n[8];if(r){t[0]=s,t[1]=l,t[2]=h,t[3]=o,t[4]=c,t[5]=u,t[6]=a,t[7]=d,t[8]=f;return}return[s,l,h,o,c,u,a,d,f]}if(r){t[0]=s,t[1]=l,t[2]=o,t[3]=c,t[4]=a,t[5]=d;return}return[s,l,o,c,a,d]}toArray(e,t){const n=this.elements,r=!!t,s=n[0],o=n[1],a=n[2],l=n[3],c=n[4],d=n[5];if(e){const h=n[6],u=n[7],f=n[8];if(r){t[0]=s,t[1]=o,t[2]=a,t[3]=l,t[4]=c,t[5]=d,t[6]=h,t[7]=u,t[8]=f;return}return[s,o,a,l,c,d,h,u,f]}if(r){t[0]=s,t[1]=o,t[2]=a,t[3]=l,t[4]=c,t[5]=d;return}return[s,o,a,l,c,d]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Pt().copy(this)}},Xn=Pt;w(Xn,"Identity",[1,0,0,0,1,0,0,0,1]),Ia(Xn);var Ms=class extends Dn{constructor(){super(),w(this,"_flagMatrix",!0),w(this,"_flagScale",!1),w(this,"_matrix",null),w(this,"_worldMatrix",null),w(this,"_position",null),w(this,"_rotation",0),w(this,"_scale",1),w(this,"_skewX",0),w(this,"_skewY",0);for(let e in Nr)Object.defineProperty(this,e,Nr[e]);this._renderer.flagMatrix=ll.bind(this),this.isShape=!0,this.matrix=new Xn,this.worldMatrix=new Xn,this.position=new Z,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const t=new Ms().copy(e);return"id"in e&&(t.id=e.id),t}get renderer(){return this._renderer}set renderer(e){this._renderer=e}get translation(){return Nr.position.get.apply(this,arguments)}set translation(e){Nr.position.set.apply(this,arguments)}addTo(e){return e.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}copy(e){return super.copy.call(this,e),"position"in e&&(e.position instanceof Z?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 Z?e.scale:new Z(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 t=new Ms;return t.position.copy(this.position),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._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 Z?this.scale.toObject():this.scale,e.skewX=this.skewX,e.skewY=this.skewY,e.matrix=this.matrix.toObject(),e}_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 Z?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}},dn=Ms;w(dn,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var Nr={position:{enumerable:!0,get:function(){return this._position},set:function(e){this._position&&this._position.unbind(j.Types.change,this._renderer.flagMatrix),this._position=e,this._position.bind(j.Types.change,this._renderer.flagMatrix),ll.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(e){this._rotation=e,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof Z&&this._scale.unbind(j.Types.change,this._renderer.flagMatrix),this._scale=e,this._scale instanceof Z&&this._scale.bind(j.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(e){this._skewX=e,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(e){this._skewY=e,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(e){this._matrix=e,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return La(this,this._worldMatrix),this._worldMatrix},set:function(e){this._worldMatrix=e}}};function ll(){this._flagMatrix=!0}var xi=Math.min,Ci=Math.max,Sg=Math.ceil,Bg=Math.floor,Tg=new Z,Tn=class extends dn{constructor(e,t,n,r){super(),w(this,"_flagVertices",!0),w(this,"_flagLength",!0),w(this,"_flagFill",!0),w(this,"_flagStroke",!0),w(this,"_flagLinewidth",!0),w(this,"_flagOpacity",!0),w(this,"_flagVisible",!0),w(this,"_flagCap",!0),w(this,"_flagJoin",!0),w(this,"_flagMiter",!0),w(this,"_flagMask",!1),w(this,"_flagClip",!1),w(this,"_length",0),w(this,"_fill","#fff"),w(this,"_stroke","#000"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_cap","round"),w(this,"_join","round"),w(this,"_miter",4),w(this,"_closed",!0),w(this,"_curved",!1),w(this,"_automatic",!0),w(this,"_beginning",0),w(this,"_ending",1),w(this,"_mask",null),w(this,"_clip",!1),w(this,"_dashes",null);for(let s in cl)Object.defineProperty(this,s,cl[s]);this._renderer.type="path",this._renderer.flagVertices=dl.bind(this),this._renderer.bindVertices=hl.bind(this),this._renderer.unbindVertices=ul.bind(this),this._renderer.flagFill=fl.bind(this),this._renderer.flagStroke=pl.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!t,this.curved=!!n,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=!r,this.dashes=[],this.dashes.offset=0}static fromObject(e){const t=typeof e.fill=="string"?e.fill:jn(e.fill),n=typeof e.stroke=="string"?e.stroke:jn(e.stroke),r=new Tn().copy(Es(Ts({},e),{fill:t,stroke:n}));return"id"in e&&(r.id=e.id),r}copy(e){super.copy.call(this,e),this.vertices=[];for(let t=0;t<e.vertices.length;t++){const n=e.vertices[t];n instanceof ve?this.vertices.push(e.vertices[t].clone()):this.vertices.push(new ve().copy(n))}for(let t=0;t<Tn.Properties.length;t++){const n=Tn.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Tn;for(let n=0;n<this.vertices.length;n++)t.vertices.push(this.vertices[n].clone());for(let n=0;n<Tn.Properties.length;n++){const r=Tn.Properties[n];t[r]=this[r]}return t.className=this.className,t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="path",e.vertices=this.vertices.map(t=>t.toObject()),ae.each(Tn.Properties,t=>{typeof this[t]<"u"&&(this[t].toObject?e[t]=this[t].toObject():e[t]=this[t])},this),e}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const e=this.getBoundingClientRect(!0),t=e.width/2,n=e.height/2,r=e.left+e.width/2,s=e.top+e.height/2;for(let o=0;o<this.vertices.length;o++){const a=this.vertices[o];a.x-=r,a.y-=s,a.x+=t,a.y+=n}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.x+=t,this.mask.translation.y-=s,this.mask.translation.y+=n),this}center(){const e=this.getBoundingClientRect(!0),t=e.left+e.width/2-this.translation.x,n=e.top+e.height/2-this.translation.y;for(let r=0;r<this.vertices.length;r++){const s=this.vertices[r];s.x-=t,s.y-=n}return this.mask&&(this.mask.translation.x-=t,this.mask.translation.y-=n),this}getBoundingClientRect(e){let t,n,r,s,o,a,l=1/0,c=-1/0,d=1/0,h=-1/0;if(this._update(!0),t=e?this.matrix:this.worldMatrix,n=(this.linewidth||0)/2,r=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:u,scaleY:f}=wi(t.elements[0],t.elements[3],t.elements[1],t.elements[4],t.elements[2],t.elements[5]);typeof u=="number"&&typeof f=="number"&&(n=Math.max(u,f)*(this.linewidth||0)/2)}else n*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(r<=0)return{width:0,height:0};for(s=0;s<r;s++){a=this._renderer.vertices[s],o=this._renderer.vertices[(s+r-1)%r];const[u,f]=t.multiply(o.x,o.y),[p,g]=t.multiply(a.x,a.y);if(o.controls&&a.controls){let m=o.controls.right.x,_=o.controls.right.y;o.relative&&(m+=o.x,_+=o.y);let[y,b]=t.multiply(m,_),S=a.controls.left.x,x=a.controls.left.y;a.relative&&(S+=a.x,x+=a.y);let[C,B]=t.multiply(S,x);const v=Xa(u,f,y,b,C,B,p,g);d=xi(v.min.y-n,d),l=xi(v.min.x-n,l),c=Ci(v.max.x+n,c),h=Ci(v.max.y+n,h)}else s<=1&&(d=xi(f-n,d),l=xi(u-n,l),c=Ci(u+n,c),h=Ci(f+n,h)),d=xi(g-n,d),l=xi(p-n,l),c=Ci(p+n,c),h=Ci(g+n,h)}return{top:d,left:l,right:c,bottom:h,width:c-l,height:h-d}}getPointAt(e,t){let n,r,s,o,a,l,c,d,h,u,f,p,g,m,_,y=this.length*Math.min(Math.max(e,0),1);const b=this.vertices.length,S=b-1;let x=null,C=null;for(let Y=0,P=this._lengths.length,E=0;Y<P;Y++){if(E+this._lengths[Y]>=y){this._closed?(n=$t(Y,b),r=$t(Y-1,b),Y===0&&(n=r,r=Y)):(n=Y,r=Math.min(Math.max(Y-1,0),S)),x=this.vertices[n],C=this.vertices[r],y-=E,this._lengths[Y]!==0?e=y/this._lengths[Y]:e=0;break}E+=this._lengths[Y]}if(x===null||C===null)return null;if(x){if(!C)return x}else return C;_=C.controls&&C.controls.right,m=x.controls&&x.controls.left,a=C.x,u=C.y,l=(_||C).x,f=(_||C).y,c=(m||x).x,p=(m||x).y,d=x.x,g=x.y,_&&C.relative&&(l+=C.x,f+=C.y),m&&x.relative&&(c+=x.x,p+=x.y),o=Yi(e,a,l,c,d),h=Yi(e,u,f,p,g);const B=Et(a,l,e),v=Et(u,f,e),$=Et(l,c,e),F=Et(f,p,e),R=Et(c,d,e),X=Et(p,g,e),M=Et(B,$,e),N=Et(v,F,e),A=Et($,R,e),L=Et(F,X,e);return ae.isObject(t)?(t.x=o,t.y=h,t instanceof ve&&(t.controls.left.x=M,t.controls.left.y=N,t.controls.right.x=A,t.controls.right.y=L,(typeof t.relative!="boolean"||t.relative)&&(t.controls.left.x-=o,t.controls.left.y-=h,t.controls.right.x-=o,t.controls.right.y-=h)),t.t=e,t):(s=new ve(o,h,M-o,N-h,A-o,L-h,this._curved?ee.curve:ee.line),s.t=e,s)}plot(){if(this.curved)return Ya(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?ee.move:ee.line;return this}subdivide(e){this._update();const t=this.vertices.length-1,n=this._closed||this.vertices[t]._command===ee.close;let r=this.vertices[t],s=[],o;return ae.each(this.vertices,function(a,l){if(l<=0&&!n){r=a;return}if(a.command===ee.move){s.push(new ve(r.x,r.y)),l>0&&(s[s.length-1].command=ee.line),r=a;return}o=ol(a,r,e),s=s.concat(o),ae.each(o,function(c,d){d<=0&&r.command===ee.move?c.command=ee.move:c.command=ee.line}),l>=t&&(this._closed&&this._automatic&&(r=a,o=ol(a,r,e),s=s.concat(o),ae.each(o,function(c,d){d<=0&&r.command===ee.move?c.command=ee.move:c.command=ee.line})),s.push(new ve(a.x,a.y)),s[s.length-1].command=n?ee.close:ee.line),r=a},this),this._automatic=!1,this._curved=!1,this.vertices=s,this}_updateLength(e,t){t||this._update();const r=this.vertices.length-1;let s=this.vertices[r],o=0;return typeof this._lengths>"u"&&(this._lengths=[]),ae.each(this.vertices,function(a,l){if(l<=0||a.command===ee.move){s=a,this._lengths[l]=0;return}this._lengths[l]=sl(a,s,e),o+=this._lengths[l],s=a},this),this._length=o,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const e=this._collection.length,t=this._closed,n=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),s=$r(this,n*this._length),o=$r(this,r*this._length),a=Sg(s),l=Bg(o);let c,d,h,u,f,p;for(this._renderer.vertices.length=0,p=0;p<e;p++)this._renderer.collection.length<=p&&this._renderer.collection.push(new ve),p>l&&!d?(f=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(r,f),f.command=this._renderer.collection[p].command,this._renderer.vertices.push(f),d=f,h=this._collection[p-1],h&&h.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f),h.relative?this._renderer.collection[p-1].controls.right.copy(h.controls.right).lerp(Z.zero,1-f.t):this._renderer.collection[p-1].controls.right.copy(h.controls.right).lerp(h,1-f.t))):p>=a&&p<=l&&(f=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(f),p===l&&rl(this,r)?(d=f,!t&&d.controls&&(d.relative?d.controls.right.clear():d.controls.right.copy(d))):p===a&&rl(this,n)&&(c=f,c.command=ee.move,!t&&c.controls&&(c.relative?c.controls.left.clear():c.controls.left.copy(c))));a>0&&!c&&(p=a-1,f=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(n,f),f.command=ee.move,this._renderer.vertices.unshift(f),u=this._collection[p+1],u&&u.controls&&(f.controls.left.clear(),u.relative?this._renderer.collection[p+1].controls.left.copy(u.controls.left).lerp(Z.zero,f.t):(Tg.copy(u),this._renderer.collection[p+1].controls.left.copy(u.controls.left).lerp(u,f.t))))}return dn.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=!1,dn.prototype.flagReset.call(this),this}},Se=Tn;w(Se,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes"]),w(Se,"Utils",{getCurveLength:sl});var cl={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(e){this._cap=e,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(e){this._join=e,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(e){this._miter=e,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof Ye||this._fill instanceof Oe||this._fill instanceof Ve||this._fill instanceof Ee)&&this._fill.unbind(j.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Ye||this._fill instanceof Oe||this._fill instanceof Ve||this._fill instanceof Ee)&&this._fill.bind(j.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Ye||this._stroke instanceof Oe||this._stroke instanceof Ve||this._stroke instanceof Ee)&&this._stroke.unbind(j.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Ye||this._stroke instanceof Oe||this._stroke instanceof Ve||this._stroke instanceof Ee)&&this._stroke.bind(j.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(e){this._closed=!!e,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(e){this._curved=!!e,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(e){if(e===this._automatic)return;this._automatic=!!e;const t=this._automatic?"ignore":"listen";ae.each(this.vertices,function(n){n[t]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(e){this._beginning=e,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(e){const t=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(j.Types.insert,t).unbind(j.Types.remove,n),e instanceof Bn?this._collection=e:this._collection=new Bn(e||[]),this._collection.bind(j.Types.insert,t).bind(j.Types.remove,n),t(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,ae.isObject(e)&&!e.clip&&(e.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}};function dl(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function hl(e){let t=e.length;for(;t--;)e[t].bind(j.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function ul(e){let t=e.length;for(;t--;)e[t].unbind(j.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function fl(){this._flagFill=!0}function pl(){this._flagStroke=!0}var Gi=class extends Se{constructor(e,t,n,r){const s=[new ve,new ve,new ve,new ve];super(s,!0,!1,!0),w(this,"_flagWidth",0),w(this,"_flagHeight",0),w(this,"_width",0),w(this,"_height",0),w(this,"_origin",null),this._renderer.type="rectangle";for(let o in gl)Object.defineProperty(this,o,gl[o]);this.width=typeof n=="number"?n:1,this.height=typeof r=="number"?r:1,this.origin=new Z,typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t),this._update()}static fromObject(e){const t=new Gi().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Gi.Properties.length;t++){const n=Gi.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const e=this._width/2,t=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new ve),this.vertices[0].set(-e,-t).sub(this._origin).command=ee.move,this.vertices[1].set(e,-t).sub(this._origin).command=ee.line,this.vertices[2].set(e,t).sub(this._origin).command=ee.line,this.vertices[3].set(-e,t).sub(this._origin).command=ee.line,this.vertices[4]&&(this.vertices[4].set(-e,-t).sub(this._origin).command=ee.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const t=new Gi(0,0,this.width,this.height);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix);for(let n=0;n<Se.Properties.length;n++){const r=Se.Properties[n];t[r]=this[r]}return e&&e.add(t),t}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}},En=Gi;w(En,"Properties",["width","height"]);var gl={width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(e){this._origin&&this._origin.unbind(j.Types.change,this._renderer.flagVertices),this._origin=e,this._origin.bind(j.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Ki=class extends En{constructor(e,t,n,r,s,o){super(t,n,0,0),w(this,"_flagTexture",!1),w(this,"_flagColumns",!1),w(this,"_flagRows",!1),w(this,"_flagFrameRate",!1),w(this,"_flagIndex",!1),w(this,"_amount",1),w(this,"_duration",0),w(this,"_startTime",0),w(this,"_playing",!1),w(this,"_firstFrame",0),w(this,"_lastFrame",0),w(this,"_loop",!0),w(this,"_texture",null),w(this,"_columns",1),w(this,"_rows",1),w(this,"_frameRate",0),w(this,"_index",0),w(this,"_origin",null);for(let a in ml)Object.defineProperty(this,a,ml[a]);this.noStroke(),this.noFill(),e instanceof Ee?this.texture=e:typeof e=="string"&&(this.texture=new Ee(e)),this.origin=new Z,this._update(),typeof r=="number"&&(this.columns=r),typeof s=="number"&&(this.rows=s),typeof o=="number"&&(this.frameRate=o),this.index=0}static fromObject(e){const t=new Ki().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Ki.Properties.length;t++){const n=Ki.Properties[t];n in e&&(this[n]=e[n])}return this}play(e,t,n){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=ae.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof t=="number"&&(this._lastFrame=t),typeof n=="function"?this._onLastFrame=n: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 t=new Ki(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&t.play(this._firstFrame,this._lastFrame),t.loop=this.loop,t.firstFrame=this.firstFrame,t.lastFrame=this.lastFrame,e&&e.add(t),t}toObject(){const e=super.toObject.call(this);return 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}_update(){const e=this._texture,t=this._columns,n=this._rows;let r,s,o,a,l,c,d,h,u;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)){d=e.image.width,h=e.image.height,r=d/t,s=h/n,a=this._amount,this.width!==r&&(this.width=r),this.height!==s&&(this.height=s),this._playing&&this._frameRate>0&&(ae.isNaN(this._lastFrame)&&(this._lastFrame=a-1),o=ae.performance.now()-this._startTime,u=this._lastFrame+1,l=1e3*(u-this._firstFrame)/this._frameRate,this._loop?o=o%l:o=Math.min(o,l),c=Et(this._firstFrame,u,o/l),c=Math.floor(c),c!==this._index&&(this._index=c,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const f=this._index%t,p=Math.floor(this._index/t),g=-r*f+(d-r)/2,m=-s*p+(h-s)/2;g!==e.offset.x&&(e.offset.x=g),m!==e.offset.y&&(e.offset.y=m)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}},Pr=Ki;w(Pr,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var ml={texture:{enumerable:!0,get:function(){return this._texture},set:function(e){this._texture=e,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(e){this._columns=e,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(e){this._rows=e,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(e){this._frameRate=e,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(e){this._index=e,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(e){this._firstFrame=e}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(e){this._lastFrame=e}},loop:{enumerable:!0,get:function(){return this._loop},set:function(e){this._loop=!!e}}},As,_l=class extends Bn{constructor(t){t=Array.isArray(t)?t:Array.prototype.slice.call(arguments),super(t),Aa(this,As,{}),this.attach(t),this.on(j.Types.insert,this.attach),this.on(j.Types.remove,this.detach)}get ids(){return xt(this,As)}attach(t){for(let n=0;n<t.length;n++){const r=t[n];r&&r.id&&(this.ids[r.id]=r)}return this}detach(t){for(let n=0;n<t.length;n++)delete this.ids[t[n].id];return this}};As=new WeakMap;var qn=class extends Se{constructor(e,t,n,r,s,o,a){const l=a||mt.Resolution*3,c=[];for(let d=0;d<l;d++)c.push(new ve);super(c,!0,!1,!0),w(this,"_flagStartAngle",!1),w(this,"_flagEndAngle",!1),w(this,"_flagInnerRadius",!1),w(this,"_flagOuterRadius",!1),w(this,"_startAngle",0),w(this,"_endAngle",ot),w(this,"_innerRadius",0),w(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let d in yl)Object.defineProperty(this,d,yl[d]);typeof n=="number"&&(this.innerRadius=n),typeof r=="number"&&(this.outerRadius=r),typeof s=="number"&&(this.startAngle=s),typeof o=="number"&&(this.endAngle=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new qn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<qn.Properties.length;t++){const n=qn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const e=this._startAngle,t=this._endAngle,n=this._innerRadius,r=this._outerRadius,s=$t(e,ot)===$t(t,ot),o=n>0,a=this.vertices;let l=o?a.length/2:a.length,c,d=0,h,u,f,p,g,m,_,y,b;for(s?l--:o||(l-=2),h=0,u=l-1;h<l;h++){switch(f=h/u,p=a[d],g=f*(t-e)+e,m=(t-e)/l,_=r*Math.cos(g),y=r*Math.sin(g),h){case 0:c=ee.move;break;default:c=ee.curve}p.command=c,p.x=_,p.y=y,p.controls.left.clear(),p.controls.right.clear(),p.command===ee.curve&&(b=r*m/Math.PI,p.controls.left.x=b*Math.cos(g-Ke),p.controls.left.y=b*Math.sin(g-Ke),p.controls.right.x=b*Math.cos(g+Ke),p.controls.right.y=b*Math.sin(g+Ke),h===1&&p.controls.left.multiplyScalar(2),h===u&&p.controls.right.multiplyScalar(2)),d++}if(o){for(s?(a[d].command=ee.close,d++):(l--,u=l-1),h=0;h<l;h++)f=h/u,p=a[d],g=(1-f)*(t-e)+e,m=(t-e)/l,_=n*Math.cos(g),y=n*Math.sin(g),c=ee.curve,h<=0&&(c=s?ee.move:ee.line),p.command=c,p.x=_,p.y=y,p.controls.left.clear(),p.controls.right.clear(),p.command===ee.curve&&(b=n*m/Math.PI,p.controls.left.x=b*Math.cos(g+Ke),p.controls.left.y=b*Math.sin(g+Ke),p.controls.right.x=b*Math.cos(g-Ke),p.controls.right.y=b*Math.sin(g-Ke),h===1&&p.controls.left.multiplyScalar(2),h===u&&p.controls.right.multiplyScalar(2)),d++;a[d].copy(a[0]),a[d].command=ee.line}else s||(a[d].command=ee.line,a[d].x=0,a[d].y=0,d++,a[d].copy(a[0]),a[d].command=ee.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 t=this.innerRadius,n=this.outerRadius,r=this.startAngle,s=this.endAngle,o=this.vertices.length,a=new qn(0,0,t,n,r,s,o);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Se.Properties.length;l++){const c=Se.Properties[l];a[c]=this[c]}return e&&e.add(a),a}toObject(){const e=super.toObject.call(this);e.renderer.type="arc-segment";for(let t=0;t<qn.Properties.length;t++){const n=qn.Properties[t];e[n]=this[n]}return e}},Rr=qn;w(Rr,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var yl={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(e){this._startAngle=e,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(e){this._endAngle=e,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(e){this._innerRadius=e,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(e){this._outerRadius=e,this._flagOuterRadius=!0}}},Os=Math.cos,Vs=Math.sin,Yn=class extends Se{constructor(e,t,n,r){const s=r?Math.max(r,2):4,o=[];for(let a=0;a<s;a++)o.push(new ve(0,0,0,0,0,0));super(o,!0,!0,!0),w(this,"_flagRadius",!1),w(this,"_radius",0),this._renderer.type="circle";for(let a in bl)Object.defineProperty(this,a,bl[a]);typeof n=="number"&&(this.radius=n),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Yn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Yn.Properties.length;t++){const n=Yn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagRadius){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const t=4/3*Math.tan(Math.PI/(e*2)),n=this._radius,r=n*t;for(let s=0;s<this.vertices.length;s++){const a=s/e*ot,l=n*Os(a),c=n*Vs(a),d=r*Os(a-Ke),h=r*Vs(a-Ke),u=r*Os(a+Ke),f=r*Vs(a+Ke),p=this.vertices[s];p.command=s===0?ee.move:ee.curve,p.set(l,c),p.controls.left.set(d,h),p.controls.right.set(u,f)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const t=new Yn(0,0,this.radius,this.vertices.length);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix);for(let n=0;n<Se.Properties.length;n++){const r=Se.Properties[n];t[r]=this[r]}return e&&e.add(t),t}toObject(){const e=super.toObject.call(this);e.renderer.type="circle";for(let t=0;t<Yn.Properties.length;t++){const n=Yn.Properties[t];e[n]=this[n]}return e}},Zi=Yn;w(Zi,"Properties",["radius"]);var bl={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this._flagRadius=!0}}},zs=Math.cos,Is=Math.sin,Un=class extends Se{constructor(e,t,n,r,s){typeof r!="number"&&typeof n=="number"&&(r=n);const o=s?Math.max(s,2):4,a=[];for(let l=0;l<o;l++)a.push(new ve);super(a,!0,!0,!0),w(this,"_flagWidth",!1),w(this,"_flagHeight",!1),w(this,"_width",0),w(this,"_height",0),this._renderer.type="ellipse";for(let l in wl)Object.defineProperty(this,l,wl[l]);typeof n=="number"&&(this.width=n*2),typeof r=="number"&&(this.height=r*2),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Un().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Un.Properties.length;t++){const n=Un.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const t=4/3*Math.tan(Math.PI/(this.vertices.length*2)),n=this._width/2,r=this._height/2;for(let s=0;s<this.vertices.length;s++){const a=s/e*ot,l=n*zs(a),c=r*Is(a),d=n*t*zs(a-Ke),h=r*t*Is(a-Ke),u=n*t*zs(a+Ke),f=r*t*Is(a+Ke),p=this.vertices[s];p.command=s===0?ee.move:ee.curve,p.set(l,c),p.controls.left.set(d,h),p.controls.right.set(u,f)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const t=this.width/2,n=this.height/2,r=this.vertices.length,s=new Un(0,0,t,n,r);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 o=0;o<Se.Properties.length;o++){const a=Se.Properties[o];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="ellipse";for(let t=0;t<Un.Properties.length;t++){const n=Un.Properties[t];e[n]=this[n]}return e}},Ji=Un;w(Ji,"Properties",["width","height"]);var wl={width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0}}},Eg=Math.ceil,$g=Math.floor,$n=class extends dn{constructor(e){super(),w(this,"_flagVertices",!0),w(this,"_flagLength",!0),w(this,"_flagFill",!0),w(this,"_flagStroke",!0),w(this,"_flagLinewidth",!0),w(this,"_flagOpacity",!0),w(this,"_flagVisible",!0),w(this,"_flagSize",!0),w(this,"_flagSizeAttenuation",!0),w(this,"_length",0),w(this,"_fill","#fff"),w(this,"_stroke","#000"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_size",1),w(this,"_sizeAttenuation",!1),w(this,"_beginning",0),w(this,"_ending",1),w(this,"_dashes",null),w(this,"noFill",Se.prototype.noFill),w(this,"noStroke",Se.prototype.noStroke),w(this,"corner",Se.prototype.corner),w(this,"center",Se.prototype.center),w(this,"getBoundingClientRect",Se.prototype.getBoundingClientRect),w(this,"_updateLength",Se.prototype._updateLength);for(let t in vl)Object.defineProperty(this,t,vl[t]);this._renderer.type="points",this._renderer.flagVertices=dl.bind(this),this._renderer.bindVertices=hl.bind(this),this._renderer.unbindVertices=ul.bind(this),this._renderer.flagFill=fl.bind(this),this._renderer.flagStroke=pl.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 t=typeof e.fill=="string"?e.fill:jn(e.fill),n=typeof e.stroke=="string"?e.stroke:jn(e.stroke),r=new $n().copy(Es(Ts({},e),{fill:t,stroke:n}));return"id"in e&&(r.id=e.id),r}copy(e){super.copy.call(this,e);for(let t=0;t<e.vertices.length;t++){const n=e.vertices[t];n instanceof ve?this.vertices.push(e.vertices[t].clone()):this.vertices.push(new ve().copy(n))}for(let t=0;t<$n.Properties.length;t++){const n=$n.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new $n;for(let n=0;n<this.vertices.length;n++)t.vertices.push(this.vertices[n].clone());for(let n=0;n<$n.Properties.length;n++){const r=$n.Properties[n];t[r]=this[r]}return t.className=this.className,t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="points",e.vertices=this.vertices.map(t=>t.toObject()),ae.each($n.Properties,function(t){typeof this[t]<"u"&&(this[t].toObject?e[t]=this[t].toObject():e[t]=this[t])},this),e}subdivide(e){this._update();let t=[];for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n],s=this.vertices[n-1];if(!s)continue;const o=r.x,a=r.y,l=s.x,c=s.y,d=Ns(o,a,o,a,l,c,l,c,e);t=t.concat(d)}return this.vertices=t,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const e=Math.min(this._beginning,this._ending),t=Math.max(this._beginning,this._ending),n=$r(this,e*this._length),r=$r(this,t*this._length),s=Eg(n),o=$g(r);let a=0,l;this._renderer.vertices=[],this._renderer.collection=[];for(let c=0;c<this._collection.length;c++)c>=s&&c<=o&&(l=this._collection[c],this._renderer.collection.push(l),this._renderer.vertices[a*2+0]=l.x,this._renderer.vertices[a*2+1]=l.y,a++)}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}},Fr=$n;w(Fr,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes"]);var vl={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(e){this._size=e,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(e){this._sizeAttenuation=e,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof Ye||this._fill instanceof Oe||this._fill instanceof Ve||this._fill instanceof Ee)&&this._fill.unbind(j.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Ye||this._fill instanceof Oe||this._fill instanceof Ve||this._fill instanceof Ee)&&this._fill.bind(j.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Ye||this._stroke instanceof Oe||this._stroke instanceof Ve||this._stroke instanceof Ee)&&this._stroke.unbind(j.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Ye||this._stroke instanceof Oe||this._stroke instanceof Ve||this._stroke instanceof Ee)&&this._stroke.bind(j.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(e){this._beginning=e,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(e){const t=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(j.Types.insert,t).unbind(j.Types.remove,n),e instanceof Bn?this._collection=e:this._collection=new Bn(e||[]),this._collection.bind(j.Types.insert,t).bind(j.Types.remove,n),t(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}},Ng=Math.cos,Pg=Math.sin,Gn=class extends Se{constructor(e,t,n,r){r=Math.max(r||0,3),super(),w(this,"_flagWidth",!1),w(this,"_flagHeight",!1),w(this,"_flagSides",!1),w(this,"_radius",0),w(this,"_width",0),w(this,"_height",0),w(this,"_sides",0),this._renderer.type="polygon";for(let s in kl)Object.defineProperty(this,s,kl[s]);this.closed=!0,this.automatic=!1,typeof n=="number"&&(this.radius=n),typeof r=="number"&&(this.sides=r),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Gn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Gn.Properties.length;t++){const n=Gn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const e=this._sides,t=e+1;let n=this.vertices.length;n>e&&(this.vertices.splice(e-1,n-e),n=e);for(let r=0;r<t;r++){const s=(r+.5)/e,o=ot*s+Math.PI/2,a=this._width*Ng(o)/2,l=this._height*Pg(o)/2;r>=n?this.vertices.push(new ve(a,l)):this.vertices[r].set(a,l),this.vertices[r].command=r===0?ee.move:ee.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const t=new Gn(0,0,0,this.sides);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,t.width=this.width,t.height=this.height,this.matrix.manual&&t.matrix.copy(this.matrix);for(let n=0;n<Se.Properties.length;n++){const r=Se.Properties[n];t[r]=this[r]}return e&&e.add(t),t}toObject(){const e=super.toObject.call(this);e.renderer.type="polygon";for(let t=0;t<Gn.Properties.length;t++){const n=Gn.Properties[t];e[n]=this[n]}return e}},Mr=Gn;w(Mr,"Properties",["width","height","sides"]);var kl={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this.width=e*2,this.height=e*2}},width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(e){this._sides=e,this._flagSides=!0}}},Kn=class extends Se{constructor(e,t,n,r,s){typeof s>"u"&&typeof n=="number"&&typeof r=="number"&&(s=Math.floor(Math.min(n,r)/12));const o=[];for(let a=0;a<10;a++)o.push(new ve(0,0,0,0,0,0,a===0?ee.move:ee.curve));super(o),w(this,"_flagWidth",!1),w(this,"_flagHeight",!1),w(this,"_flagRadius",!1),w(this,"_width",0),w(this,"_height",0),w(this,"_radius",12),this._renderer.type="rounded-rectangle";for(let a in xl)Object.defineProperty(this,a,xl[a]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=Rg.bind(this),typeof n=="number"&&(this.width=n),typeof r=="number"&&(this.height=r),typeof s=="number"&&(this.radius=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Kn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Kn.Properties.length;t++){const n=Kn.Properties[t];if(n in e){const r=e[n];/radius/i.test(n)?this[n]=typeof r=="number"||r instanceof Z?r:new Z().copy(r):typeof r=="number"&&(this[n]=r)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const e=this._width,t=this._height;let n,r;this._radius instanceof Z?(n=this._radius.x,r=this._radius.y):(n=this._radius,r=this._radius);let s,o=e/2,a=t/2;s=this.vertices[0],s.x=-(o-n),s.y=-a,s=this.vertices[1],s.x=o-n,s.y=-a,s.controls.left.clear(),s.controls.right.x=n,s.controls.right.y=0,s=this.vertices[2],s.x=o,s.y=-(a-r),s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[3],s.x=o,s.y=a-r,s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=r,s=this.vertices[4],s.x=o-n,s.y=a,s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[5],s.x=-(o-n),s.y=a,s.controls.left.clear(),s.controls.right.x=-n,s.controls.right.y=0,s=this.vertices[6],s.x=-o,s.y=a-r,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[7],s.x=-o,s.y=-(a-r),s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=-r,s=this.vertices[8],s.x=-(o-n),s.y=-a,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 t=this.width,n=this.height,r=this.radius,s=new Kn(0,0,t,n,r);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 o=0;o<Se.Properties.length;o++){const a=Se.Properties[o];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="rounded-rectangle";for(let t=0;t<Kn.Properties.length;t++){const n=Kn.Properties[t];e[n]=this[n]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}},Qi=Kn;w(Qi,"Properties",["width","height","radius"]);var xl={width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius instanceof Z&&this._radius.unbind(j.Types.change,this._renderer.flagRadius),this._radius=e,this._radius instanceof Z&&this._radius.bind(j.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function Rg(){this._flagRadius=!0}var Fg=Math.cos,Mg=Math.sin,Zn=class extends Se{constructor(e,t,n,r,s){arguments.length<=3&&(r=n,n=r/2),(typeof s!="number"||s<=0)&&(s=5),super(),w(this,"_flagInnerRadius",!1),w(this,"_flagOuterRadius",!1),w(this,"_flagSides",!1),w(this,"_innerRadius",0),w(this,"_outerRadius",0),w(this,"_sides",0),this._renderer.type="star";for(let o in Cl)Object.defineProperty(this,o,Cl[o]);this.closed=!0,this.automatic=!1,typeof n=="number"&&(this.innerRadius=n),typeof r=="number"&&(this.outerRadius=r),typeof s=="number"&&(this.sides=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Zn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Zn.Properties.length;t++){const n=Zn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const e=this._sides*2,t=e+1;let n=this.vertices.length;n>e&&(this.vertices.splice(e-1,n-e),n=e);for(let r=0;r<t;r++){const s=(r+.5)/e,o=ot*s,a=(r%2?this._outerRadius:this._innerRadius)/2,l=a*Fg(o),c=a*Mg(o);r>=n?this.vertices.push(new ve(l,c)):this.vertices[r].set(l,c),this.vertices[r].command=r===0?ee.move:ee.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const t=this.innerRadius,n=this.outerRadius,r=this.sides,s=new Zn(0,0,t,n,r);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 o=0;o<Se.Properties.length;o++){const a=Se.Properties[o];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="star";for(let t=0;t<Zn.Properties.length;t++){const n=Zn.Properties[t];e[n]=this[n]}return e}},Ar=Zn;w(Ar,"Properties",["innerRadius","outerRadius","sides"]);var Cl={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(e){this._innerRadius=e,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(e){this._outerRadius=e,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(e){this._sides=e,this._flagSides=!0}}},Ls,Sl=Math.min,Bl=Math.max;He.document&&(Ls=document.createElement("canvas"));var Rt=class extends dn{constructor(e,t,n,r){super(),w(this,"_flagValue",!0),w(this,"_flagFamily",!0),w(this,"_flagSize",!0),w(this,"_flagLeading",!0),w(this,"_flagAlignment",!0),w(this,"_flagBaseline",!0),w(this,"_flagStyle",!0),w(this,"_flagWeight",!0),w(this,"_flagDecoration",!0),w(this,"_flagFill",!0),w(this,"_flagStroke",!0),w(this,"_flagLinewidth",!0),w(this,"_flagOpacity",!0),w(this,"_flagVisible",!0),w(this,"_flagMask",!1),w(this,"_flagClip",!1),w(this,"_flagDirection",!0),w(this,"_value",""),w(this,"_family","sans-serif"),w(this,"_size",13),w(this,"_leading",17),w(this,"_alignment","center"),w(this,"_baseline","middle"),w(this,"_style","normal"),w(this,"_weight",500),w(this,"_decoration","none"),w(this,"_direction","ltr"),w(this,"_fill","#000"),w(this,"_stroke","none"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_mask",null),w(this,"_clip",!1),w(this,"_dashes",null);for(let s in Tl)Object.defineProperty(this,s,Tl[s]);if(this._renderer.type="text",this._renderer.flagFill=Ag.bind(this),this._renderer.flagStroke=Og.bind(this),this.value=e,typeof t=="number"&&(this.translation.x=t),typeof n=="number"&&(this.translation.y=n),this.dashes=[],this.dashes.offset=0,!ae.isObject(r))return this;for(let s=0;s<Rt.Properties.length;s++){const o=Rt.Properties[s];o in r&&(this[o]=r[o])}}static Measure(e){if(Ls){const t=Ls.getContext("2d");t.font=[e._style,e._weight,`${e._size}px/${e._leading}px`,e._family].join(" ");const n=t.measureText(e.value,0,0),r=n.actualBoundingBoxDescent+n.actualBoundingBoxAscent;return{width:n.width,height:r}}else{const t=this.value.length*this.size*Rt.Ratio,n=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:t,height:n}}}static fromObject(e){const t=typeof e.fill=="string"?e.fill:jn(e.fill),n=typeof e.stroke=="string"?e.stroke:jn(e.stroke),r=new Rt().copy(Es(Ts({},e),{fill:t,stroke:n}));return"id"in e&&(r.id=e.id),r}copy(e){super.copy.call(this,e);for(let t=0;t<Rt.Properties.length;t++){const n=Rt.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Rt(this.value);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale;for(let n=0;n<Rt.Properties.length;n++){const r=Rt.Properties[n];t[r]=this[r]}return this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()}toObject(){const e=super.toObject.call(this);e.renderer.type="text";for(let t=0;t<Rt.Properties.length;t++){const n=Rt.Properties[t];e[n]=this[n]}return e}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(e){let t,n,r,s,o;this._update(!0),t=e?this.matrix:this.worldMatrix;const{width:a,height:l}=Rt.Measure(this),c=(this._linewidth||0)/2;switch(this.alignment){case"left":n=-c,r=a+c;break;case"right":n=-(a+c),r=c;break;default:n=-(a/2+c),r=a/2+c}switch(this.baseline){case"middle":s=-(l/2+c),o=l/2+c;break;default:s=-(l+c),o=c}const[d,h]=t.multiply(n,s),[u,f]=t.multiply(n,o),[p,g]=t.multiply(r,s),[m,_]=t.multiply(r,o);return s=Sl(h,f,g,_),n=Sl(d,u,p,m),r=Bl(d,u,p,m),o=Bl(h,f,g,_),{top:s,left:n,right:r,bottom:o,width:r-n,height:o-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}},At=Rt;w(At,"Ratio",.6),w(At,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes"]);var Tl={value:{enumerable:!0,get:function(){return this._value},set:function(e){this._value=e,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(e){this._family=e,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(e){this._size=e,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(e){this._leading=e,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(e){this._alignment=e,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(e){this._style=e,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(e){this._weight=e,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(e){this._decoration=e,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(e){this._direction=e,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(e){this._baseline=e,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof Ye||this._fill instanceof Oe||this._fill instanceof Ve||this._fill instanceof Ee)&&this._fill.unbind(j.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Ye||this._fill instanceof Oe||this._fill instanceof Ve||this._fill instanceof Ee)&&this._fill.bind(j.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Ye||this._stroke instanceof Oe||this._stroke instanceof Ve||this._stroke instanceof Ee)&&this._stroke.unbind(j.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Ye||this._stroke instanceof Oe||this._stroke instanceof Ve||this._stroke instanceof Ee)&&this._stroke.bind(j.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,ae.isObject(e)&&!e.clip&&(e.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}};function Ag(){this._flagFill=!0}function Og(){this._flagStroke=!0}var Or=Math.min,Vr=Math.max,Si=class extends dn{constructor(e){super(),w(this,"_flagAdditions",!1),w(this,"_flagSubtractions",!1),w(this,"_flagOrder",!1),w(this,"_flagOpacity",!0),w(this,"_flagBeginning",!1),w(this,"_flagEnding",!1),w(this,"_flagLength",!1),w(this,"_flagMask",!1),w(this,"_fill","#fff"),w(this,"_stroke","#000"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_cap","round"),w(this,"_join","round"),w(this,"_miter",4),w(this,"_closed",!0),w(this,"_curved",!1),w(this,"_automatic",!0),w(this,"_beginning",0),w(this,"_ending",1),w(this,"_length",0),w(this,"_mask",null);for(let t in El)Object.defineProperty(this,t,El[t]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}static InsertChildren(e){for(let t=0;t<e.length;t++)$l.call(this,e[t],this)}static RemoveChildren(e){for(let t=0;t<e.length;t++)$l.call(this,e[t])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const t=new Si;for(let r=0;r<Si.Properties.length;r++){const s=Si.Properties[r];s in e&&(/(fill|stroke)/i.test(s)?t[s]=typeof e[s]=="string"?e[s]:jn(e[s]):t[s]=e[s])}return"mask"in e&&(t.mask=n(e.mask)),"id"in e&&(t.id=e.id),t.children=e.children.map(n),t;function n(r){if(r&&r.renderer)switch(r.renderer.type){case"arc-segment":return Rr.fromObject(r);case"circle":return Zi.fromObject(r);case"ellipse":return Ji.fromObject(r);case"points":return Fr.fromObject(r);case"polygon":return Mr.fromObject(r);case"rectangle":return En.fromObject(r);case"rounded-rectangle":return Qi.fromObject(r);case"star":return Ar.fromObject(r);case"path":return Se.fromObject(r);case"text":return At.fromObject(r);case"group":return Si.fromObject(r);case"shape":return dn.fromObject(r);case"element":return Dn.fromObject(r)}return r}}copy(e){return super.copy.call(this,e),console.warn("Two.Group.copy is not supported yet."),this}clone(e){const t=new Si,n=this.children.map(function(r){return r.clone()});return t.add(n),t.opacity=this.opacity,this.mask&&(t.mask=this.mask),t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.className=this.className,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._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,ae.each(this.children,(t,n)=>{e.children[n]=t.toObject()},this),e}corner(){const e=this.getBoundingClientRect(!0);for(let t=0;t<this.children.length;t++){const n=this.children[t];n.translation.x-=e.left,n.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),t=e.left+e.width/2-this.translation.x,n=e.top+e.height/2-this.translation.y;for(let r=0;r<this.children.length;r++){const s=this.children[r];s.isShape&&(s.translation.x-=t,s.translation.y-=n)}return this.mask&&(this.mask.translation.x-=t,this.mask.translation.y-=n),this}getById(e){let t=null;function n(r){if(r.id===e)return r;if(r.children){if(r.children.ids[e])return r.children.ids[e];for(let s=0;s<r.children.length;s++)if(t=n(r.children[s]),t)return t}return null}return n(this)}getByClassName(e){const t=[];function n(r){if(Array.prototype.indexOf.call(r.classList,e)>=0&&t.push(r),r.children)for(let s=0;s<r.children.length;s++){const o=r.children[s];n(o)}return t}return n(this)}getByType(e){const t=[];function n(r){if(r instanceof e&&t.push(r),r.children)for(let s=0;s<r.children.length;s++){const o=r.children[s];n(o)}return t}return n(this)}add(e){e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let t=0;t<e.length;t++){const n=e[t];if(!(n&&n.id))continue;const r=Array.prototype.indexOf.call(this.children,n);r>=0&&this.children.splice(r,1),this.children.push(n)}return this}remove(e){const t=arguments.length,n=this.parent;if(t<=0&&n)return n.remove(this),this;e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let r=0;r<e.length;r++){const s=e[r];if(!s||!this.children.ids[s.id])continue;const o=this.children.indexOf(s);o>=0&&this.children.splice(o,1)}return this}getBoundingClientRect(e){let t,n,r,s,o,a;this._update(!0);let l=1/0,c=-1/0,d=1/0,h=-1/0;const u=/texture|gradient/i;n=e?this.matrix:this.worldMatrix;for(let f=0;f<this.children.length;f++){const p=this.children[f];if(!(!p.visible||u.test(p._renderer.type))&&(t=p.getBoundingClientRect(e),r=typeof t.top!="number"||ae.isNaN(t.top)||!isFinite(t.top),s=typeof t.left!="number"||ae.isNaN(t.left)||!isFinite(t.left),o=typeof t.right!="number"||ae.isNaN(t.right)||!isFinite(t.right),a=typeof t.bottom!="number"||ae.isNaN(t.bottom)||!isFinite(t.bottom),!(r||s||o||a)))if(e){const[g,m]=n.multiply(t.left,t.top),[_,y]=n.multiply(t.right,t.top),[b,S]=n.multiply(t.left,t.bottom),[x,C]=n.multiply(t.right,t.bottom);d=Or(m,y,S,C,d),l=Or(g,_,b,x,l),c=Vr(g,_,b,x,c),h=Vr(m,y,S,C,h)}else d=Or(t.top,d),l=Or(t.left,l),c=Vr(t.right,c),h=Vr(t.bottom,h)}return{top:d,left:l,right:c,bottom:h,width:c-l,height:h-d}}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(t){t.subdivide.apply(t,e)}),this}_update(){let e,t,n;if(this._flagBeginning||this._flagEnding){const r=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),o=this.length;let a=0;const l=r*o,c=s*o;for(e=0;e<this.children.length;e++)n=this.children[e],t=n.length,l>a+t?(n.beginning=1,n.ending=1):c<a?(n.beginning=0,n.ending=0):l>a&&l<a+t?(n.beginning=(l-a)/t,n.ending=1):c>a&&c<a+t?(n.beginning=0,n.ending=(c-a)/t):(n.beginning=0,n.ending=1),a+=t}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}},Ge=Si;w(Ge,"Children",_l),w(Ge,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var El={visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._flagVisible=this._visible!==e||this._flagVisible,this._visible=e}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._flagOpacity=this._opacity!==e||this._flagOpacity,this._opacity=e}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(e){this._flagBeginning=this._beginning!==e||this._flagBeginning,this._beginning=e}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._flagEnding=this._ending!==e||this._flagEnding,this._ending=e}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let e=0;e<this.children.length;e++){const t=this.children[e];this._length+=t.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){this._fill=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.fill=e}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){this._stroke=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.stroke=e}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.linewidth=e}}},join:{enumerable:!0,get:function(){return this._join},set:function(e){this._join=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.join=e}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(e){this._miter=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.miter=e}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(e){this._cap=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.cap=e}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(e){this._closed=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.closed=e}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(e){this._curved=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.curved=e}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(e){this._automatic=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.automatic=e}}},children:{enumerable:!0,get:function(){return this._children},set:function(e){const t=Ge.InsertChildren.bind(this),n=Ge.RemoveChildren.bind(this),r=Ge.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new _l(e),this._children.bind(j.Types.insert,t),this._children.bind(j.Types.remove,n),this._children.bind(j.Types.order,r),e.length>0&&t(e)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,ae.isObject(e)&&!e.clip&&(e.clip=!0)}}};function $l(e,t){const n=e.parent;let r;if(n===t){s();return}if(n&&n.children.ids[e.id]&&(r=Array.prototype.indexOf.call(n.children,e),n.children.splice(r,1),o()),t){s();return}o(),n._flagAdditions&&n.additions.length===0&&(n._flagAdditions=!1),n._flagSubtractions&&n.subtractions.length===0&&(n._flagSubtractions=!1),delete e.parent;function s(){t.subtractions.length>0&&(r=Array.prototype.indexOf.call(t.subtractions,e),r>=0&&t.subtractions.splice(r,1)),t.additions.length>0&&(r=Array.prototype.indexOf.call(t.additions,e),r>=0&&t.additions.splice(r,1)),e.parent=t,t.additions.push(e),t._flagAdditions=!0}function o(){r=Array.prototype.indexOf.call(n.additions,e),r>=0&&n.additions.splice(r,1),r=Array.prototype.indexOf.call(n.subtractions,e),r<0&&(n.subtractions.push(e),n._flagSubtractions=!0)}}var Ds=class extends Se{constructor(t,n,r,s){const o=[new ve(t,n),new ve(r,s)];super(o);for(let a in Nl)Object.defineProperty(this,a,Nl[a]);this.vertices[0].command=ee.move,this.vertices[1].command=ee.line,this.automatic=!1}},Nl={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(e){if(ae.isObject(e))this.vertices.splice(0,1,e);else{const t=new Ct("Two.Line.x argument is not an object.");console.warn(t.name,t.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(e){if(ae.isObject(e))this.vertices.splice(1,1,e);else{const t=new Ct("Two.Line.y argument is not an object.");console.warn(t.name,t.message)}}}},Gt={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},Vg={start:"left",middle:"center",end:"right"},Pl=["id","class","transform","xmlns","viewBox"],zg=["x","y","width","height","href","xlink:href"];function Ig(e){return Vg[e]}function Lg(e){const t=e.getAttribute("dominant-baseline"),n=e.getAttribute("alignment-baseline");return t||n}function er(e){return e.replace(/svg:/gi,"").toLowerCase()}function Rl(e,t){if(t.x+=e.translateX,t.y+=e.translateY,t.x*=e.scaleX,t.y*=e.scaleY,e.rotation!==0){const n=t.length();t.x=n*Math.cos(e.rotation),t.y=n*Math.sin(e.rotation)}}function Dg(e,t){t||(t={});const n=e.split(";");for(let r=0;r<n.length;r++){const s=n[r].split(":"),o=s[0],a=s[1];if(typeof o>"u"||typeof a>"u")continue;const l=o.replace(/\s/g,""),c=a.replace(/\s/g,"");t[l]=c}return t}function Hg(e){const t={},n=Wg(e),r=Math.max(n.length,e.style.length);for(let s=0;s<r;s++){const o=e.style[s],a=n[s];o&&(t[o]=e.style[o]),a&&(t[a]=e.getAttribute(a))}return t}function Wg(e){const t=e.getAttributeNames();for(let n=0;n<Pl.length;n++){const r=Pl[n],s=Array.prototype.indexOf.call(t,r);s>=0&&t.splice(s,1)}return t}function jg(e,t){const n=t.split(/[\s,]/),r=-parseFloat(n[0]),s=-parseFloat(n[1]),o=parseFloat(n[2]),a=parseFloat(n[3]);if(r&&s)for(let u=0;u<e.children.length;u++){const f=e.children[u];"translation"in f?f.translation.add(r,s):"x"in f?f.x=r:"y"in f&&(f.y=s)}const l=typeof e.x=="number",c=typeof e.y=="number",d=typeof e.width=="number",h=typeof e.height=="number";return l&&(e.translation.x+=e.x),c&&(e.translation.y+=e.y),(d||h)&&(e.scale=new Z(1,1)),d&&(e.scale.x=e.width/o),h&&(e.scale.y=e.height/a),e.mask=new En(0,0,o,a),e.mask.origin.set(-o/2,-a/2),e}function Ot(e,t,n){const r={},s={},o={};let a,l,c,d,h,u,f,p,g,m,_,y,b,S,x,C,B;if(e===null)return r;if(He.getComputedStyle){const v=He.getComputedStyle(e);for(a=v.length;a--;)c=v[a],d=v[c],typeof d<"u"&&(r[c]=d)}for(a=0;a<e.attributes.length;a++)u=e.attributes[a],/style/i.test(u.nodeName)?Dg(u.value,o):s[u.nodeName]=u.value;typeof r.opacity<"u"&&(r["stroke-opacity"]=r.opacity,r["fill-opacity"]=r.opacity,delete r.opacity),n&&ae.defaults(r,n),ae.extend(r,o,s),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=e.gradientTransform&&e.gradientTransform.baseVal&&e.gradientTransform.baseVal.length>0?e.gradientTransform.baseVal[0].matrix:e.getCTM?e.getCTM():null,l===null))break;switch(f=wi(l),t._renderer.type){case"linear-gradient":Rl(f,t.left),Rl(f,t.right);break;case"radial-gradient":t.center.x+=f.translateX,t.center.y+=f.translateY,t.focal.x+=f.translateX,t.focal.y+=f.translateY,t.radius*=Math.max(f.scaleX,f.scaleY);break}break;case"transform":if(/none/i.test(d)||(l=e.transform&&e.transform.baseVal&&e.transform.baseVal.length>0?e.transform.baseVal[0].matrix:e.getCTM?e.getCTM():null,l===null))break;f=wi(l),t.translation.set(f.translateX,f.translateY),t.rotation=Math.PI*(f.rotation/180),t.scale=new Z(f.scaleX,f.scaleY),p=parseFloat((r.x+"").replace("px")),g=parseFloat((r.y+"").replace("px")),p&&(t.translation.x=p),g&&(t.translation.y=g);break;case"visible":if(t instanceof Ge){t._visible=d;break}t.visible=d;break;case"stroke-linecap":if(t instanceof Ge){t._cap=d;break}t.cap=d;break;case"stroke-linejoin":if(t instanceof Ge){t._join=d;break}t.join=d;break;case"stroke-miterlimit":if(t instanceof Ge){t._miter=d;break}t.miter=d;break;case"stroke-width":if(t instanceof Ge){t._linewidth=parseFloat(d);break}t.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(t instanceof Ge){t._opacity=parseFloat(d);break}t.opacity=parseFloat(d);break;case"clip-path":if(Gt.cssBackgroundImage.test(d)&&(m=d.replace(Gt.cssBackgroundImage,"$1"),Le.defs.current&&Le.defs.current.contains(m)&&(y=Le.defs.current.get(m),y&&y.childNodes.length>0)))switch(y=y.childNodes[0],b=er(y.nodeName),t.mask=Le[b].call(this,y,{}),t._renderer.type){case"text":case"path":t.position.add(t.mask.position),t.mask.position.clear();break}break;case"fill":case"stroke":h=(t instanceof Ge?"_":"")+c,Gt.cssBackgroundImage.test(d)?(m=d.replace(Gt.cssBackgroundImage,"$1"),Le.defs.current&&Le.defs.current.contains(m)?(y=Le.defs.current.get(m),y.object||(b=er(y.nodeName),y.object=Le[b].call(this,y,{})),y=y.object):(_=qg(this),y=_.getById(m)),t[h]=y):t[h]=d;break;case"id":t.id=d;break;case"class":case"className":t.classList=d.split(" "),t._flagClassName=!0;break;case"x":case"y":if(S=t instanceof Ye,x=t instanceof Oe,C=t instanceof Ve,S||x||C)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Ct("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),t.translation[c]=parseFloat(d);break;case"font-family":t instanceof At&&(t.family=d);break;case"font-size":t instanceof At&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Ct("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),t.size=parseFloat(d));break;case"font-weight":t instanceof At&&(t.weight=d);break;case"font-style":t instanceof At&&(t.style=d);break;case"text-decoration":t instanceof At&&(t.decoration=d);break;case"line-height":t instanceof At&&(t.leading=d);break}return Object.keys(e.dataset).length&&(t.dataset=e.dataset),r}function Xg(e,t){for(let n=0,r=e.childNodes.length;n<r;n++){const s=e.childNodes[n];!s.id||er(e.nodeName)==="#text"||t.add(s.id,s)}}function qg(e){for(;e.parent;)e=e.parent;return e.scene}var Le={svg:function(e){const t=Le.defs.current=new Tr,n=e.getElementsByTagName("defs");for(let g=0;g<n.length;g++)Xg(n[g],t);const r=Le.g.call(this,e),s=e.getAttribute("viewBox"),o=e.getAttribute("x"),a=e.getAttribute("y"),l=e.getAttribute("width"),c=e.getAttribute("height");r.defs=t;const d=s!==null,h=o!==null,u=a!==null,f=l!==null,p=c!==null;return h&&(r.x=parseFloat(o.replace(Gt.unitSuffix,""))),u&&(r.y=parseFloat(a.replace(Gt.unitSuffix,""))),f&&(r.width=parseFloat(l.replace(Gt.unitSuffix,""))),p&&(r.height=parseFloat(c.replace(Gt.unitSuffix,""))),d&&jg(r,s),delete Le.defs.current,r},defs:function(e){return null},use:function(e,t){let n;const r=e.getAttribute("href")||e.getAttribute("xlink:href");if(!r)return n=new Ct("encountered <use /> with no href."),console.warn(n.name,n.message),null;const s=r.slice(1);if(!Le.defs.current.contains(s))return n=new Ct("unable to find element for reference "+r+"."),console.warn(n.name,n.message),null;const a=Le.defs.current.get(s).cloneNode(!0);for(let c=0;c<e.attributes.length;c++){const d=e.attributes[c],h=zg.includes(d.nodeName),u=!a.hasAttribute(d.nodeName);(h||u)&&a.setAttribute(d.nodeName,d.value)}const l=er(a.nodeName);return Le[l].call(this,a,t)},g:function(e,t){const n=new Ge;Ot.call(this,e,n,t),this.add(n);const r=Hg.call(this,e);for(let s=0,o=e.childNodes.length;s<o;s++){const a=e.childNodes[s],l=a.nodeName;if(!l)return;const c=er(l);if(c in Le){const d=Le[c].call(n,a,r);d&&!d.parent&&n.add(d)}}return n},polygon:function(e,t){let n;typeof e=="string"?n=e:n=e.getAttribute("points");const r=[];n.replace(/(-?[\d.eE-]+)[,|\s](-?[\d.eE-]+)/g,function(o,a,l){r.push(new ve(parseFloat(a),parseFloat(l)))});const s=new Se(r,!0);return s.stroke="none",s.fill="black",Ot.call(this,e,s,t),s},polyline:function(e,t){const n=Le.polygon.call(this,e,t);return n.closed=!1,n},path:function(e,t){let n;typeof e=="string"?(n=e,e=null):n=e.getAttribute("d");let r=[],s=!1,o=!1;if(n){let l=new ve,c,d,h=n.match(/[a-df-z][^a-df-z]*/gi);const u=h.length-1;ae.each(h.slice(0),function(f,p){const g=f.slice(1).trim().match(Gt.path),m=f[0],_=m.toLowerCase();let y,b,S,x,C;const B=[];switch(p===0&&(h=[]),_){case"h":case"v":g.length>1&&(y=1);break;case"m":case"l":case"t":g.length>2&&(y=2);break;case"s":case"q":g.length>4&&(y=4);break;case"c":g.length>6&&(y=6);break;case"a":g.length>7&&(y=7);break}if(y){for(b=0,S=g.length,C=0;b<S;b+=y){if(x=m,C>0)switch(m){case"m":x="l";break;case"M":x="L";break}B.push(x+g.slice(b,b+y).join(" ")),C++}h=Array.prototype.concat.apply(h,B)}else h.push(f)}),ae.each(h,function(f,p){let g,m,_;const y=f[0],b=y.toLowerCase();d=f.slice(1).trim().match(Gt.path),o=y===b;let S,x,C,B,v,$,F,R,X,M,N,A,L,Y,P,E,H;switch(b){case"z":if(p>=u)s=!0;else{m=l.x,_=l.y,g=new ve(m,_,void 0,void 0,void 0,void 0,ee.close);for(let I=r.length-1;I>=0;I--){const U=r[I];if(/m/i.test(U.command)){l=U;break}}}break;case"m":case"l":c=void 0,m=parseFloat(d[0]),_=parseFloat(d[1]),g=new ve(m,_,void 0,void 0,void 0,void 0,/m/i.test(b)?ee.move:ee.line),o&&g.addSelf(l),l=g;break;case"h":case"v":M=/h/i.test(b)?"x":"y",N=/x/i.test(M)?"y":"x",g=new ve(void 0,void 0,void 0,void 0,void 0,void 0,ee.line),g[M]=parseFloat(d[0]),g[N]=l[N],o&&(g[M]+=l[M]),l=g;break;case"c":case"s":S=l.x,x=l.y,c||(c=new Z),/c/i.test(b)?(C=parseFloat(d[0]),B=parseFloat(d[1]),v=parseFloat(d[2]),$=parseFloat(d[3]),F=parseFloat(d[4]),R=parseFloat(d[5])):(X=Ps(l,c,o),C=X.x,B=X.y,v=parseFloat(d[0]),$=parseFloat(d[1]),F=parseFloat(d[2]),R=parseFloat(d[3])),o&&(C+=S,B+=x,v+=S,$+=x,F+=S,R+=x),l.controls.right.set(C-l.x,B-l.y),g=new ve(F,R,v-F,$-R,void 0,void 0,ee.curve),l=g,c=g.controls.left;break;case"t":case"q":S=l.x,x=l.y,c||(c=new Z),/q/i.test(b)?(C=parseFloat(d[0]),B=parseFloat(d[1]),v=parseFloat(d[0]),$=parseFloat(d[1]),F=parseFloat(d[2]),R=parseFloat(d[3])):(X=Ps(l,c,o),C=X.x,B=X.y,v=X.x,$=X.y,F=parseFloat(d[0]),R=parseFloat(d[1])),o&&(C+=S,B+=x,v+=S,$+=x,F+=S,R+=x),l.controls.right.set((C-l.x)*.33,(B-l.y)*.33),g=new ve(F,R,v-F,$-R,void 0,void 0,ee.curve),l=g,c=g.controls.left;break;case"a":S=l.x,x=l.y,L=parseFloat(d[0]),Y=parseFloat(d[1]),P=parseFloat(d[2]),E=parseFloat(d[3]),H=parseFloat(d[4]),F=parseFloat(d[5]),R=parseFloat(d[6]),o&&(F+=S,R+=x),A=new ve(F,R),A.command=ee.arc,A.rx=L,A.ry=Y,A.xAxisRotation=P,A.largeArcFlag=E,A.sweepFlag=H,g=A,l=A,c=void 0;break}g&&(Array.isArray(g)?r=r.concat(g):r.push(g))})}n=new Se(r,s,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},ae.each(n.vertices,function(l){l.subSelf(a.centroid)}),Ot.call(this,e,n,t),n.translation.addSelf(a.centroid),n},circle:function(e,t){const n=parseFloat(e.getAttribute("cx")),r=parseFloat(e.getAttribute("cy")),s=parseFloat(e.getAttribute("r")),o=new Zi(0,0,s);return o.stroke="none",o.fill="black",Ot.call(this,e,o,t),o.translation.x=n,o.translation.y=r,o},ellipse:function(e,t){const n=parseFloat(e.getAttribute("cx")),r=parseFloat(e.getAttribute("cy")),s=parseFloat(e.getAttribute("rx")),o=parseFloat(e.getAttribute("ry")),a=new Ji(0,0,s,o);return a.stroke="none",a.fill="black",Ot.call(this,e,a,t),a.translation.x=n,a.translation.y=r,a},rect:function(e,t){const n=parseFloat(e.getAttribute("rx")),r=parseFloat(e.getAttribute("ry"));if(!ae.isNaN(n)||!ae.isNaN(r))return Le["rounded-rect"](e);const s=parseFloat(e.getAttribute("width")),o=parseFloat(e.getAttribute("height")),a=s/2,l=o/2,c=new En(0,0,s,o);return c.stroke="none",c.fill="black",Ot.call(this,e,c,t),c.translation.x+=a,c.translation.y+=l,c},"rounded-rect":function(e,t){const n=parseFloat(e.getAttribute("rx"))||0,r=parseFloat(e.getAttribute("ry"))||0,s=parseFloat(e.getAttribute("width")),o=parseFloat(e.getAttribute("height")),a=s/2,l=o/2,c=new Z(n,r),d=new Qi(0,0,s,o,c);return d.stroke="none",d.fill="black",Ot.call(this,e,d,t),d.translation.x+=a,d.translation.y+=l,d},line:function(e,t){const n=parseFloat(e.getAttribute("x1")),r=parseFloat(e.getAttribute("y1")),s=parseFloat(e.getAttribute("x2")),o=parseFloat(e.getAttribute("y2")),a=new Ds(n,r,s,o).noFill();return Ot.call(this,e,a,t),a},lineargradient:function(e,t){let n=e.getAttribute("gradientUnits"),r=e.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let s=parseFloat(e.getAttribute("x1")||0),o=parseFloat(e.getAttribute("y1")||0),a=parseFloat(e.getAttribute("x2")||0),l=parseFloat(e.getAttribute("y2")||0);const c=(a+s)/2,d=(l+o)/2;/userSpaceOnUse/i.test(n)&&(s-=c,o-=d,a-=c,l-=d);const h=[];for(let f=0;f<e.children.length;f++){const p=e.children[f];let g=p.getAttribute("offset");/%/gi.test(g)&&(g=parseFloat(g.replace(/%/gi,""))/100),g=parseFloat(g);let m=p.getAttribute("stop-color"),_=p.getAttribute("stop-opacity"),y=p.getAttribute("style"),b;m===null&&(b=y?y.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,m=b&&b.length>1?b[1]:void 0),_===null?(b=y?y.match(/stop-opacity:\s?([0-9.-]*)/):!1,_=b&&b.length>1?parseFloat(b[1]):1):_=parseFloat(_),h.push(new Ut(g,m,_))}const u=new Oe(s,o,a,l,h);return u.spread=r,u.units=n,Ot.call(this,e,u,t),u},radialgradient:function(e,t){let n=e.getAttribute("gradientUnits"),r=e.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let s=parseFloat(e.getAttribute("cx"))||0,o=parseFloat(e.getAttribute("cy"))||0,a=parseFloat(e.getAttribute("r")),l=parseFloat(e.getAttribute("fx")),c=parseFloat(e.getAttribute("fy"));ae.isNaN(l)&&(l=s),ae.isNaN(c)&&(c=o);const d=Math.abs(s+l)/2,h=Math.abs(o+c)/2;/userSpaceOnUse/i.test(n)&&(s-=d,o-=h,l-=d,c-=h);const u=[];for(let p=0;p<e.children.length;p++){const g=e.children[p];let m=g.getAttribute("offset");/%/gi.test(m)&&(m=parseFloat(m.replace(/%/gi,""))/100),m=parseFloat(m);let _=g.getAttribute("stop-color"),y=g.getAttribute("stop-opacity"),b=g.getAttribute("style"),S;_===null&&(S=b?b.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,_=S&&S.length>1?S[1]:void 0),y===null?(S=b?b.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=S&&S.length>1?parseFloat(S[1]):1):y=parseFloat(y),u.push(new Ut(m,_,y))}const f=new Ve(s,o,a,u,l,c);return f.spread=r,f.units=n,Ot.call(this,e,f,t),f},text:function(e,t){const n=Ig(e.getAttribute("text-anchor"))||"left",r=Lg(e)||"baseline";let s="";e.childNodes.length>0&&e.childNodes[0].tagName==="TSPAN"?s=e.childNodes[0].textContent:s=e.textContent;const o=new At(s);return Ot.call(this,e,o,t),o.alignment=n,o.baseline=r,o},clippath:function(e,t){return Le.defs.current&&!Le.defs.current.contains(e.id)&&Le.defs.current.add(e.id,e),null},image:function(e,t){let n;const r=e.getAttribute("href")||e.getAttribute("xlink:href");if(!r)return n=new Ct("encountered <image /> with no href."),console.warn(n.name,n.message),null;const s=parseFloat(e.getAttribute("x"))||0,o=parseFloat(e.getAttribute("y"))||0,a=parseFloat(e.getAttribute("width")),l=parseFloat(e.getAttribute("height")),c=new Pr(r,s,o);return ae.isNaN(a)||(c.width=a),ae.isNaN(l)||(c.height=l),Ot.call(this,e,c,t),c}};function Fl(e,t){const n=new XMLHttpRequest;return n.open("GET",e),n.onreadystatechange=function(){n.readyState===4&&n.status===200&&t(n.responseText)},n.send(),n}var Bi=class extends En{constructor(e,t,n,r){super(t,n,0,0),w(this,"_flagTextures",!1),w(this,"_flagFrameRate",!1),w(this,"_flagIndex",!1),w(this,"_amount",1),w(this,"_duration",0),w(this,"_index",0),w(this,"_startTime",0),w(this,"_playing",!1),w(this,"_firstFrame",0),w(this,"_lastFrame",0),w(this,"_loop",!0),w(this,"_textures",null),w(this,"_frameRate",0),w(this,"_origin",null);for(let s in Ml)Object.defineProperty(this,s,Ml[s]);this._renderer.flagTextures=Yg.bind(this),this._renderer.bindTextures=Ug.bind(this),this._renderer.unbindTextures=Gg.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(Al.bind(this)):this.textures=[Al(e)],this.origin=new Z,this._update(),typeof r=="number"?this.frameRate=r:this.frameRate=Bi.DefaultFrameRate,this.index=0}static fromObject(e){const t=new Bi().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Bi.Properties.length;t++){const n=Bi.Properties[t];n in e&&(this[n]=e[n])}return this}play(e,t,n){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=ae.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof t=="number"&&(this._lastFrame=t),typeof n=="function"?this._onLastFrame=n: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 t=new Bi(this.textures,this.translation.x,this.translation.y,this.frameRate);return t._loop=this._loop,this._playing&&t.play(),e&&e.add(t),t}toObject(){const e=super.toObject.call(this);return e.textures=this.textures.map(function(t){return t.toObject()}),e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}_update(){const e=this._textures;let t,n,r,s,o,a,l,c;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,ae.isNaN(this._lastFrame)&&(this._lastFrame=s-1),r=ae.performance.now()-this._startTime,c=this._lastFrame+1,o=1e3*(c-this._firstFrame)/this._frameRate,this._loop?r=r%o:r=Math.min(r,o),l=Et(this._firstFrame,c,r/o),l=Math.floor(l),l!==this._index&&(this._index=l,a=e[this._index],a.loaded&&(t=a.image.width,n=a.image.height,this.width!==t&&(this.width=t),this.height!==n&&(this.height=n),this.fill=a,l>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof Ee))&&(a=e[this._index],a.loaded&&(t=a.image.width,n=a.image.height,this.width!==t&&(this.width=t),this.height!==n&&(this.height=n)),this.fill=a)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}},zr=Bi;w(zr,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),w(zr,"DefaultFrameRate",30);var Ml={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(e){this._frameRate=e,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(e){this._index=e,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(e){const t=this._renderer.bindTextures,n=this._renderer.unbindTextures;this._textures&&this._textures.unbind(j.Types.insert,t).unbind(j.Types.remove,n),this._textures=new Bn((e||[]).slice(0)),this._textures.bind(j.Types.insert,t).bind(j.Types.remove,n),t(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(e){this._firstFrame=e}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(e){this._lastFrame=e}},loop:{enumerable:!0,get:function(){return this._loop},set:function(e){this._loop=!!e}}};function Yg(){this._flagTextures=!0}function Ug(e){let t=e.length;for(;t--;)e[t].bind(j.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Gg(e){let t=e.length;for(;t--;)e[t].unbind(j.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Al(e){if(e instanceof Ee)return e;if(typeof e=="string")return new Ee(e)}var Hs=[],Ws=Math.max,Kg=Math.min,Ol=Math.abs,Ir=Math.sin,Lr=Math.cos,Zg=Math.acos,Dr=Math.sqrt,Te={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},baselines:{top:"top",middle:"middle",bottom:"bottom",baseline:"alphabetic"},getRendererType:function(e){return e in Te?e:"path"},group:{renderChild:function(e){const t=Te.getRendererType(e._renderer.type);Te[t].render.call(e,this.ctx,!0,this.clip)},render:function(e){if(!this._visible)return this;this._update();const t=this._matrix.elements,n=this.parent;this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);const r=this._mask,s=Hr(t),o=!s||!!r;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=e,o&&(e.save(),s||e.transform(t[0],t[3],t[1],t[4],t[2],t[5])),r){const a=Te.getRendererType(r._renderer.type);Te[a].render.call(r,e,!0)}if(this._opacity>0&&this._scale!==0)for(let a=0;a<this.children.length;a++){const l=this.children[a],c=Te.getRendererType(l._renderer.type);Te[c].render.call(l,e)}return o&&e.restore(),this.flagReset()}},path:{render:function(e,t,n){let r,s,o,a,l,c,d,h,u,f,p,g,m,_,y,b,S,x,C,B,v,$,F,R,X,M,N,A,L,Y,P,E,H,I;if(I=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,L=this._mask,Y=this._clip,l=this._opacity*(I||1),c=this._visible,!t&&(!c||Y||l===0))return this;if(this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,d=this._cap,h=this._join,u=this._miter,f=this._closed,p=this._renderer.vertices,g=p.length,m=g-1,P=Hr(r),H=this.dashes,P||(e.save(),e.transform(r[0],r[3],r[1],r[4],r[2],r[5])),L){const ie=Te.getRendererType(L._renderer.type);Te[ie].render.call(L,e,!0)}if(a)if(typeof a=="string")e.fillStyle=a;else{const ie=Te.getRendererType(a._renderer.type);Te[ie].render.call(a,e,this),e.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")e.strokeStyle=s;else{const ie=Te.getRendererType(s._renderer.type);Te[ie].render.call(s,e,this),e.strokeStyle=s._renderer.effect}o&&(e.lineWidth=o),u&&(e.miterLimit=u),h&&(e.lineJoin=h),!f&&d&&(e.lineCap=d)}typeof l=="number"&&(e.globalAlpha=l),H&&H.length>0&&(e.lineDashOffset=H.offset||0,e.setLineDash(H)),e.beginPath();let U,O,z,J,pe,re,ge;for(let ie=0;ie<g;ie++)switch(b=p[ie],N=b.x,A=b.y,b.command){case ee.close:e.closePath();break;case ee.arc:U=b.rx,O=b.ry,z=b.xAxisRotation,J=b.largeArcFlag,pe=b.sweepFlag,_=f?$t(ie-1,g):Ws(ie-1,0),y=p[_],re=y.x,ge=y.y,Te.renderSvgArcCommand(e,re,ge,U,O,J,pe,z,N,A);break;case ee.curve:_=f?$t(ie-1,g):Math.max(ie-1,0),y=p[_],F=y.controls&&y.controls.right||Z.zero,R=b.controls&&b.controls.left||Z.zero,y._relative?(v=F.x+y.x,$=F.y+y.y):(v=F.x,$=F.y),b._relative?(C=R.x+b.x,B=R.y+b.y):(C=R.x,B=R.y),e.bezierCurveTo(v,$,C,B,N,A),ie>=m&&f&&(S=x,X=b.controls&&b.controls.right||Z.zero,M=S.controls&&S.controls.left||Z.zero,b._relative?(v=X.x+b.x,$=X.y+b.y):(v=X.x,$=X.y),S._relative?(C=M.x+S.x,B=M.y+S.y):(C=M.x,B=M.y),N=S.x,A=S.y,e.bezierCurveTo(v,$,C,B,N,A));break;case ee.line:e.lineTo(N,A);break;case ee.move:x=b,e.moveTo(N,A);break}return f&&e.closePath(),!Y&&!n&&(Te.isHidden.test(a)||(E=a._renderer&&a._renderer.offset,E&&(e.save(),e.translate(-a._renderer.offset.x,-a._renderer.offset.y),e.scale(a._renderer.scale.x,a._renderer.scale.y)),e.fill(),E&&e.restore()),Te.isHidden.test(s)||(E=s._renderer&&s._renderer.offset,E&&(e.save(),e.translate(-s._renderer.offset.x,-s._renderer.offset.y),e.scale(s._renderer.scale.x,s._renderer.scale.y),e.lineWidth=o/s._renderer.scale.x),e.stroke(),E&&e.restore())),P||e.restore(),Y&&!n&&e.clip(),H&&H.length>0&&e.setLineDash(Hs),this.flagReset()}},points:{render:function(e,t,n){let r,s,o,a,l,c,d,h,u,f,p,g,m,_,y,b;if(b=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,l=this._opacity*(b||1),c=this._visible,!t&&(!c||l===0))return this;if(this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,h=this._renderer.collection,u=h.length,m=Hr(r),y=this.dashes,d=this._size,m||(e.save(),e.transform(r[0],r[3],r[1],r[4],r[2],r[5])),a)if(typeof a=="string")e.fillStyle=a;else{const C=Te.getRendererType(a._renderer.type);Te[C].render.call(a,e,this),e.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")e.strokeStyle=s;else{const C=Te.getRendererType(s._renderer.type);Te[C].render.call(s,e,this),e.strokeStyle=s._renderer.effect}o&&(e.lineWidth=o)}typeof l=="number"&&(e.globalAlpha=l),y&&y.length>0&&(e.lineDashOffset=y.offset||0,e.setLineDash(y)),e.beginPath();let S=d*.5,x;this._sizeAttenuation||(x=this.worldMatrix.elements,x=wi(x[0],x[3],x[1],x[4],x[2],x[5]),S/=Math.max(x.scaleX,x.scaleY));for(let C=0;C<u;C++)f=h[C],p=f.x,g=f.y,e.moveTo(p+S,g),e.arc(p,g,S,0,ot);return n||(Te.isHidden.test(a)||(_=a._renderer&&a._renderer.offset,_&&(e.save(),e.translate(-a._renderer.offset.x,-a._renderer.offset.y),e.scale(a._renderer.scale.x,a._renderer.scale.y)),e.fill(),_&&e.restore()),Te.isHidden.test(s)||(_=s._renderer&&s._renderer.offset,_&&(e.save(),e.translate(-s._renderer.offset.x,-s._renderer.offset.y),e.scale(s._renderer.scale.x,s._renderer.scale.y),e.lineWidth=o/s._renderer.scale.x),e.stroke(),_&&e.restore())),m||e.restore(),y&&y.length>0&&e.setLineDash(Hs),this.flagReset()}},text:{render:function(e,t,n){const r=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,s=this._opacity*r,o=this._visible,a=this._mask,l=this._clip;if(!t&&(!o||l||s===0))return this;this._update();const c=this._matrix.elements,d=this._stroke,h=this._linewidth,u=this._fill,f=this._decoration,p=this._direction,g=Hr(c),m=u._renderer&&u._renderer.offset&&d._renderer&&d._renderer.offset,_=this.dashes,y=Te.alignments[this._alignment]||this._alignment,b=Te.baselines[this._baseline]||this._baseline;let S,x,C,B,v,$,F,R,X,M,N;if(g||(e.save(),e.transform(c[0],c[3],c[1],c[4],c[2],c[5])),a){const A=Te.getRendererType(a._renderer.type);Te[A].render.call(a,e,!0)}if(m||(e.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),e.textAlign=y,e.textBaseline=b,e.direction=p,u)if(typeof u=="string")e.fillStyle=u;else{const A=Te.getRendererType(u._renderer.type);Te[A].render.call(u,e,this),e.fillStyle=u._renderer.effect}if(d){if(typeof d=="string")e.strokeStyle=d;else{const A=Te.getRendererType(d._renderer.type);Te[A].render.call(d,e,this),e.strokeStyle=d._renderer.effect}h&&(e.lineWidth=h)}if(typeof s=="number"&&(e.globalAlpha=s),_&&_.length>0&&(e.lineDashOffset=_.offset||0,e.setLineDash(_)),!l&&!n&&(Te.isHidden.test(u)||(u._renderer&&u._renderer.offset?($=u._renderer.scale.x,F=u._renderer.scale.y,e.save(),e.translate(-u._renderer.offset.x,-u._renderer.offset.y),e.scale($,F),S=this._size/u._renderer.scale.y,x=this._leading/u._renderer.scale.y,e.font=[this._style,this._weight,S+"px/",x+"px",this._family].join(" "),C=u._renderer.offset.x/u._renderer.scale.x,B=u._renderer.offset.y/u._renderer.scale.y,e.fillText(this.value,C,B),e.restore()):e.fillText(this.value,0,0)),Te.isHidden.test(d)||(d._renderer&&d._renderer.offset?($=d._renderer.scale.x,F=d._renderer.scale.y,e.save(),e.translate(-d._renderer.offset.x,-d._renderer.offset.y),e.scale($,F),S=this._size/d._renderer.scale.y,x=this._leading/d._renderer.scale.y,e.font=[this._style,this._weight,S+"px/",x+"px",this._family].join(" "),C=d._renderer.offset.x/d._renderer.scale.x,B=d._renderer.offset.y/d._renderer.scale.y,v=h/d._renderer.scale.x,e.lineWidth=v,e.strokeText(this.value,C,B),e.restore()):e.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(f)){const A=e.measureText(this.value);let L=1;switch(f){case"underline":X=A.actualBoundingBoxDescent,N=A.actualBoundingBoxDescent;break;case"strikethrough":X=0,N=0,L=.5;break}switch(b){case"top":X+=this._size*L,N+=this._size*L;break;case"baseline":case"bottom":X-=this._size*L,N-=this._size*L;break}switch(y){case"left":case"start":R=0,M=A.width;break;case"right":case"end":R=-A.width,M=0;break;default:R=-A.width/2,M=A.width/2}e.lineWidth=Math.max(Math.floor(this._size/15),1),e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(R,X),e.lineTo(M,N),e.stroke()}return g||e.restore(),l&&!n&&e.clip(),_&&_.length>0&&e.setLineDash(Hs),this.flagReset()}},"linear-gradient":{render:function(e,t){if(t){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let n,r=this.left._x,s=this.left._y,o=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(n=t.getBoundingClientRect(!0),r=(r-.5)*n.width,s=(s-.5)*n.height,o=(o-.5)*n.width,a=(a-.5)*n.height),this._renderer.effect=e.createLinearGradient(r,s,o,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return this.flagReset()}}},"radial-gradient":{render:function(e,t){if(t){if(this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let n,r=this.center._x,s=this.center._y,o=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(n=t.getBoundingClientRect(!0),r=(r-.5)*n.width*.5,s=(s-.5)*n.height*.5,o=(o-.5)*n.width*.5,a=(a-.5)*n.height*.5,l*=Math.min(n.width,n.height)),this._renderer.effect=e.createRadialGradient(r,s,0,o,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 this.flagReset()}}},texture:{render:function(e){this._update();const t=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=e.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof Z||(this._renderer.offset=new Z),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,t&&(this._renderer.offset.x+=t.width/2,this._renderer.offset.y+=t.height/2,this._scale instanceof Z?(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 Z||(this._renderer.scale=new Z),this._scale instanceof Z?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),this.flagReset()}},renderSvgArcCommand:function(e,t,n,r,s,o,a,l,c,d){l=l*Math.PI/180,r=Ol(r),s=Ol(s);const h=(t-c)/2,u=(n-d)/2,f=Lr(l)*h+Ir(l)*u,p=-Ir(l)*h+Lr(l)*u,g=f*f,m=p*p;let _=r*r,y=s*s;const b=g/_+m/y;if(b>1){const A=Dr(b);r=A*r,s=A*s,_=r*r,y=s*s}const S=_*m+y*g,x=(_*y-S)/S;let C=Dr(Ws(0,x));o===a&&(C=-C);const B=C*r*p/s,v=-C*s*f/r,$=Lr(l)*B-Ir(l)*v+(t+c)/2,F=Ir(l)*B+Lr(l)*v+(n+d)/2,R=Vl(1,0,(f-B)/r,(p-v)/s),X=Vl((f-B)/r,(p-v)/s,(-f-B)/r,(-p-v)/s)%ot,M=R+X;Jg(e,$,F,r,s,R,M,a===0,l)}},lt=class extends j{constructor(e){super();const t=e.smoothing!==!1;this.domElement=e.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=e.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=t),this.scene=new Ge,this.scene.parent=this}setSize(e,t,n){return this.width=e,this.height=t,this.ratio=typeof n>"u"?Rs(this.ctx):n,this.domElement.width=e*this.ratio,this.domElement.height=t*this.ratio,this.domElement.style&&ae.extend(this.domElement.style,{width:e+"px",height:t+"px"}),this.trigger(j.Types.resize,e,t,n)}render(){const e=this.ratio===1;return e||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),Te.group.render.call(this.scene,this.ctx),e||this.ctx.restore(),this}};w(lt,"Utils",Te);function Jg(e,t,n,r,s,o,a,l,c){const d=a-o,h=vi.Tolerance.epsilon,u=Math.abs(d)<h;let f=$t(d,ot);f<h&&(u?f=0:f=ot),l===!0&&!u&&(f===ot?f=-ot:f=f-ot);for(let p=0;p<mt.Resolution;p++){const g=p/(mt.Resolution-1),m=o+g*f;let _=t+r*Math.cos(m),y=n+s*Math.sin(m);if(c!==0){const b=Math.cos(c),S=Math.sin(c),x=_-t,C=y-n;_=x*b-C*S+t,y=x*S+C*b+n}e.lineTo(_,y)}}function Vl(e,t,n,r){const s=e*n+t*r,o=Dr(e*e+t*t)*Dr(n*n+r*r);let a=Zg(Ws(-1,Kg(1,s/o)));return e*r-t*n<0&&(a=-a),a}function Hr(e){return e[0]==1&&e[3]==0&&e[1]==0&&e[4]==1&&e[2]==0&&e[5]==0}var se={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(e,t){const n=e,r=document.createElementNS(se.ns,n);return n==="svg"&&(t=ae.defaults(t||{},{version:se.version})),t&&Object.keys(t).length>0&&se.setAttributes(r,t),r},setAttributes:function(e,t){const n=Object.keys(t);for(let r=0;r<n.length;r++)/href/.test(n[r])?e.setAttributeNS(se.xlink,n[r],t[n[r]]):e.setAttribute(n[r],t[n[r]]);return this},removeAttributes:function(e,t){for(let n in t)e.removeAttribute(n);return this},toString:function(e,t){let n=e.length,r=n-1,s,o="";for(let a=0;a<n;a++){const l=e[a],c=t?$t(a-1,n):Math.max(a-1,0),d=e[c];let h,u,f,p,g,m,_,y,b,S,x,C,B,v,$,F=Pe(l.x),R=Pe(l.y);switch(l.command){case ee.close:h=ee.close;break;case ee.arc:x=l.rx,C=l.ry,B=l.xAxisRotation,v=l.largeArcFlag,$=l.sweepFlag,h=ee.arc+" "+x+" "+C+" "+B+" "+v+" "+$+" "+F+" "+R;break;case ee.curve:_=d.controls&&d.controls.right||Z.zero,y=l.controls&&l.controls.left||Z.zero,d.relative?(f=Pe(_.x+d.x),p=Pe(_.y+d.y)):(f=Pe(_.x),p=Pe(_.y)),l.relative?(g=Pe(y.x+l.x),m=Pe(y.y+l.y)):(g=Pe(y.x),m=Pe(y.y)),h=(a===0?ee.move:ee.curve)+" "+f+" "+p+" "+g+" "+m+" "+F+" "+R;break;case ee.move:s=l,h=ee.move+" "+F+" "+R;break;default:h=l.command+" "+F+" "+R}a>=r&&t&&(l.command===ee.curve&&(u=s,b=l.controls&&l.controls.right||l,S=u.controls&&u.controls.left||u,l.relative?(f=Pe(b.x+l.x),p=Pe(b.y+l.y)):(f=Pe(b.x),p=Pe(b.y)),u.relative?(g=Pe(S.x+u.x),m=Pe(S.y+u.y)):(g=Pe(S.x),m=Pe(S.y)),F=Pe(u.x),R=Pe(u.y),h+=" C "+f+" "+p+" "+g+" "+m+" "+F+" "+R),l.command!==ee.close&&(h+=" Z")),o+=h+" "}return o},pointsToString:function(e,t){let n="";const r=t*.5;for(let s=0;s<e.length;s++){const o=e[s].x,a=e[s].y-r;n+=ee.move+" "+o+" "+a+" ",n+="a "+r+" "+r+" 0 1 0 0.001 0 Z"}return n},getClip:function(e,t){let n=e._renderer.clip;return n||(n=e._renderer.clip=se.createElement("clipPath",{"clip-rule":"nonzero"})),n.parentNode===null&&t.defs.appendChild(n),n},getRendererType:function(e){return e in se?e:"path"},defs:{update:function(e){const{defs:t}=e;if(t._flagUpdate){const n=Array.prototype.slice.call(t.children,0);for(let r=0;r<n.length;r++){const s=n[r],o=s.id,a=`[fill="url(#${o})"],[stroke="url(#${o})"],[clip-path="url(#${o})"]`;e.querySelector(a)||t.removeChild(s)}t._flagUpdate=!1}}},group:{appendChild:function(e){const t=e._renderer.elem;if(!t)return;const n=t.nodeName;!n||/(radial|linear)gradient/i.test(n)||e._clip||this.elem.appendChild(t)},removeChild:function(e){const t=e._renderer.elem;!t||t.parentNode!=this.elem||!t.nodeName||e._clip||this.elem.removeChild(t)},orderChild:function(e){this.elem.appendChild(e._renderer.elem)},renderChild:function(e){const t=se.getRendererType(e._renderer.type);se[t].render.call(e,this)},render:function(e){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;this._update(),this._renderer.elem||(this._renderer.elem=se.createElement("g",{id:this.id}),e.appendChild(this._renderer.elem));const t=this._matrix.manual||this._flagMatrix,n={domElement:e,elem:this._renderer.elem};t&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(let r=0;r<this.children.length;r++){const s=this.children[r],o=se.getRendererType(s._renderer.type);se[o].render.call(s,e)}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(se.group.appendChild,n),this._flagSubtractions&&this.subtractions.forEach(se.group.removeChild,n),this._flagOrder&&this.children.forEach(se.group.orderChild,n),this._flagMask)if(this._mask){const r=se.getRendererType(this._mask._renderer.type);se[r].render.call(this._mask,e),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),this.flagReset()}},path:{render:function(e){if(this._opacity===0&&!this._flagOpacity)return this;this._update();const t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagVertices){const r=se.toString(this._renderer.vertices,this._closed);t.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=se.getRendererType(this._fill._renderer.type);se[r].render.call(this._fill,e,!0)}if(this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=se.getRendererType(this._stroke._renderer.type);se[r].render.call(this._stroke,e,!0)}if(this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this._flagCap&&(t["stroke-linecap"]=this._cap),this._flagJoin&&(t["stroke-linejoin"]=this._join),this._flagMiter&&(t["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?se.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=se.createElement("path",t),e.appendChild(this._renderer.elem)),this._flagClip){const r=se.getClip(this,e),s=this._renderer.elem;this._clip?(s.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(s)):(r.removeAttribute("id"),s.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(s))}if(this._flagMask)if(this._mask){const r=se.getRendererType(this._mask._renderer.type);se[r].render.call(this._mask,e),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this.flagReset()}},points:{render:function(e){if(this._opacity===0&&!this._flagOpacity)return this;this._update();const t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let r=this._size;if(!this._sizeAttenuation){const o=this.worldMatrix.elements,a=wi(o[0],o[3],o[1],o[4],o[2],o[5]);r/=Math.max(a.scaleX,a.scaleY)}const s=se.pointsToString(this._renderer.collection,r);t.d=s}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=se.getRendererType(this._fill._renderer.type);se[r].render.call(this._fill,e,!0)}if(this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=se.getRendererType(this._stroke._renderer.type);se[r].render.call(this._stroke,e,!0)}return this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?se.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=se.createElement("path",t),e.appendChild(this._renderer.elem)),this.flagReset()}},text:{render:function(e){this._update();const t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagFamily&&(t["font-family"]=this._family),this._flagSize&&(t["font-size"]=this._size),this._flagLeading&&(t["line-height"]=this._leading),this._flagAlignment&&(t["text-anchor"]=se.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["dominant-baseline"]=se.baselines[this._baseline]||this._baseline),this._flagStyle&&(t["font-style"]=this._style),this._flagWeight&&(t["font-weight"]=this._weight),this._flagDecoration&&(t["text-decoration"]=this._decoration),this._flagDirection&&(t.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=se.getRendererType(this._fill._renderer.type);se[r].render.call(this._fill,e,!0)}if(this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=se.getRendererType(this._stroke._renderer.type);se[r].render.call(this._stroke,e,!0)}if(this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t.opacity=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?se.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=se.createElement("text",t),e.appendChild(this._renderer.elem)),this._flagClip){const r=se.getClip(this,e),s=this._renderer.elem;this._clip?(s.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(s)):(r.removeAttribute("id"),s.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(s))}if(this._flagMask)if(this._mask){const r=se.getRendererType(this._mask._renderer.type);se[r].render.call(this._mask,e),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(e,t){t||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?se.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=se.createElement("linearGradient",n)),this._renderer.elem.parentNode===null&&e.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 s=0;s<this.stops.length;s++){const o=this.stops[s],a={};o._flagOffset&&(a.offset=100*o._offset+"%"),o._flagColor&&(a["stop-color"]=o._color),o._flagOpacity&&(a["stop-opacity"]=o._opacity),o._renderer.elem?se.setAttributes(o._renderer.elem,a):o._renderer.elem=se.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return this.flagReset()}},"radial-gradient":{render:function(e,t){t||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?se.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=se.createElement("radialGradient",n)),this._renderer.elem.parentNode===null&&e.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 s=0;s<this.stops.length;s++){const o=this.stops[s],a={};o._flagOffset&&(a.offset=100*o._offset+"%"),o._flagColor&&(a["stop-color"]=o._color),o._flagOpacity&&(a["stop-opacity"]=o._opacity),o._renderer.elem?se.setAttributes(o._renderer.elem,a):o._renderer.elem=se.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return this.flagReset()}},texture:{render:function(e,t){t||this._update();const n={},r={x:0,y:0},s=this.image;if(this._flagId&&(n.id=this._id),this._flagLoaded&&this.loaded)switch(s.nodeName.toLowerCase()){case"canvas":r.href=r["xlink:href"]=s.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,s&&(n.x-=s.width/2,n.y-=s.height/2,this._scale instanceof Z?(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,s)){switch(n.width=s.width,n.height=s.height,this._repeat){case"no-repeat":n.width+=1,n.height+=1;break}this._scale instanceof Z?(n.width*=this._scale.x,n.height*=this._scale.y):(n.width*=this._scale,n.height*=this._scale),r.width=n.width,r.height=n.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?se.setAttributes(this._renderer.image,r):this._renderer.image=se.createElement("image",r)),this._renderer.elem?Object.keys(n).length!==0&&se.setAttributes(this._renderer.elem,n):(n.id=this._id,n.patternUnits="userSpaceOnUse",this._renderer.elem=se.createElement("pattern",n)),this._renderer.elem.parentNode===null&&e.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),this.flagReset()}}},zl=class extends j{constructor(e){super(),this.domElement=e.domElement||se.createElement("svg"),this.scene=new Ge,this.scene.parent=this,this.defs=se.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(e,t){return this.width=e,this.height=t,se.setAttributes(this.domElement,{width:e,height:t}),this.trigger(j.Types.resize,e,t)}render(){return se.group.render.call(this.scene,this.domElement),se.defs.update(this.domElement),this}};w(zl,"Utils",se);var Vt={create:function(e,t,n){const r=e.createShader(e[n]);if(e.shaderSource(r,t),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS)){const o=e.getShaderInfoLog(r);throw e.deleteShader(r),new Ct("unable to compile shader "+r+": "+o)}return r},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:`
40
+ ***************************************************************************** */var Cr=function(){return Cr=Object.assign||function(t){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Cr.apply(this,arguments)},Ou={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"}},cn={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},Ss=500,Vu=function(){function e(t,n){return this.core=t,this.$LG=n,this.settings=Cr(Cr({},Ou),this.core.settings),this}return e.prototype.buildTemplates=function(){var t=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&&(t+='<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(t)},e.prototype.enableZoom=function(t){var n=this,r=this.settings.enableZoomAfter+t.detail.delay;this.$LG("body").first().hasClass("lg-from-hash")&&t.detail.delay?r=0:this.$LG("body").first().removeClass("lg-from-hash"),this.zoomableTimeout=setTimeout(function(){n.isImageSlide(n.core.index)&&(n.core.getSlideItem(t.detail.index).addClass("lg-zoomable"),t.detail.index===n.core.index&&n.setZoomEssentials())},r+30)},e.prototype.enableZoomOnSlideItemLoad=function(){this.core.LGel.on(cn.slideItemLoad+".zoom",this.enableZoom.bind(this))},e.prototype.getDragCords=function(t){return{x:t.pageX,y:t.pageY}},e.prototype.getSwipeCords=function(t){var n=t.touches[0].pageX,r=t.touches[0].pageY;return{x:n,y:r}},e.prototype.getDragAllowedAxises=function(t,n){if(!this.containerRect)return{allowX:!1,allowY:!1};var r=this.core.getSlideItem(this.core.index).find(".lg-image").first().get(),s=0,o=0,a=r.getBoundingClientRect();t?(s=r.offsetHeight*t,o=r.offsetWidth*t):n?(s=a.height+n*a.height,o=a.width+n*a.width):(s=a.height,o=a.width);var l=s>this.containerRect.height,c=o>this.containerRect.width;return{allowX:c,allowY:l}},e.prototype.setZoomEssentials=function(){this.containerRect=this.core.$content.get().getBoundingClientRect()},e.prototype.zoomImage=function(t,n,r,s){if(!(Math.abs(n)<=0)){var o=this.containerRect.width/2+this.containerRect.left,a=this.containerRect.height/2+this.containerRect.top+this.scrollTop,l,c;t===1&&(this.positionChanged=!1);var d=this.getDragAllowedAxises(0,n),h=d.allowY,u=d.allowX;this.positionChanged&&(l=this.left/(this.scale-n),c=this.top/(this.scale-n),this.pageX=o-l,this.pageY=a-c,this.positionChanged=!1);var f=this.getPossibleSwipeDragCords(n),p,g,m=o-this.pageX,_=a-this.pageY;if(t-n>1){var y=(t-n)/Math.abs(n);m=(n<0?-m:m)+this.left*(y+(n<0?-1:1)),_=(n<0?-_:_)+this.top*(y+(n<0?-1:1)),p=m/y,g=_/y}else{var y=(t-n)*n;p=m*y,g=_*y}r&&(u?this.isBeyondPossibleLeft(p,f.minX)?p=f.minX:this.isBeyondPossibleRight(p,f.maxX)&&(p=f.maxX):t>1&&(p<f.minX?p=f.minX:p>f.maxX&&(p=f.maxX)),h?this.isBeyondPossibleTop(g,f.minY)?g=f.minY:this.isBeyondPossibleBottom(g,f.maxY)&&(g=f.maxY):t>1&&(g<f.minY?g=f.minY:g>f.maxY&&(g=f.maxY))),this.setZoomStyles({x:p,y:g,scale:t}),this.left=p,this.top=g,s&&this.setZoomImageSize()}},e.prototype.resetImageTranslate=function(t){if(this.isImageSlide(t)){var n=this.core.getSlideItem(t).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)}},e.prototype.setZoomImageSize=function(){var t=this,n=this.core.getSlideItem(this.core.index).find(".lg-image").first();setTimeout(function(){var r=t.getCurrentImageActualSizeScale();t.scale>=r&&(n.addClass("no-transition"),t.imageReset=!0)},Ss),setTimeout(function(){var r=t.getCurrentImageActualSizeScale();if(t.scale>=r){var s=t.getDragAllowedAxises(t.scale);n.css("width",n.get().naturalWidth+"px").css("height",n.get().naturalHeight+"px"),t.core.outer.addClass("lg-actual-size"),s.allowX&&s.allowY?n.addClass("reset-transition"):s.allowX&&!s.allowY?n.addClass("reset-transition-x"):!s.allowX&&s.allowY&&n.addClass("reset-transition-y")}},Ss+50)},e.prototype.setZoomStyles=function(t){var n=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),r=this.core.getSlideItem(this.core.index).find(".lg-image").first(),s=this.core.outer.find(".lg-current .lg-dummy-img").first();this.scale=t.scale,r.css("transform","scale3d("+t.scale+", "+t.scale+", 1)"),s.css("transform","scale3d("+t.scale+", "+t.scale+", 1)");var o="translate3d("+t.x+"px, "+t.y+"px, 0)";n.css("transform",o)},e.prototype.setActualSize=function(t,n){var r=this;if(!this.zoomInProgress){this.zoomInProgress=!0;var s=this.core.galleryItems[this.core.index];this.resetImageTranslate(t),setTimeout(function(){if(!(!s.src||r.core.outer.hasClass("lg-first-slide-loading"))){var o=r.getCurrentImageActualSizeScale(),a=r.scale;r.core.outer.hasClass("lg-zoomed")?r.scale=1:r.scale=r.getScale(o),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},Ss+110)}},e.prototype.getNaturalWidth=function(t){var n=this.core.getSlideItem(t).find(".lg-image").first(),r=this.core.galleryItems[t].width;return r?parseFloat(r):n.get().naturalWidth},e.prototype.getActualSizeScale=function(t,n){var r,s;return t>=n?(r=t/n,s=r||2):s=1,s},e.prototype.getCurrentImageActualSizeScale=function(){var t=this.core.getSlideItem(this.core.index).find(".lg-image").first(),n=t.get().offsetWidth,r=this.getNaturalWidth(this.core.index)||n;return this.getActualSizeScale(r,n)},e.prototype.getPageCords=function(t){var n={};if(t)n.x=t.pageX||t.touches[0].pageX,n.y=t.pageY||t.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},e.prototype.setPageCords=function(t){var n=this.getPageCords(t);this.pageX=n.x,this.pageY=n.y},e.prototype.manageActualPixelClassNames=function(){var t=this.core.getElementById("lg-actual-size");t.removeClass(this.settings.actualSizeIcons.zoomIn).addClass(this.settings.actualSizeIcons.zoomOut)},e.prototype.beginZoom=function(t){return this.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),t>1?(this.core.outer.addClass("lg-zoomed"),this.manageActualPixelClassNames()):this.resetZoom(),t>1},e.prototype.getScale=function(t){var n=this.getCurrentImageActualSizeScale();return t<1?t=1:t>n&&(t=n),t},e.prototype.init=function(){var t=this;if(this.settings.zoom){this.buildTemplates(),this.enableZoomOnSlideItemLoad();var n=null;this.core.outer.on("dblclick.lg",function(r){t.$LG(r.target).hasClass("lg-image")&&t.setActualSize(t.core.index,r)}),this.core.outer.on("touchstart.lg",function(r){var s=t.$LG(r.target);r.touches.length===1&&s.hasClass("lg-image")&&(n?(clearTimeout(n),n=null,r.preventDefault(),t.setActualSize(t.core.index,r)):n=setTimeout(function(){n=null},300))}),this.core.LGel.on(cn.containerResize+".zoom "+cn.rotateRight+".zoom "+cn.rotateLeft+".zoom "+cn.flipHorizontal+".zoom "+cn.flipVertical+".zoom",function(){if(!(!t.core.lgOpened||!t.isImageSlide(t.core.index)||t.core.touchAction)){var r=t.core.getSlideItem(t.core.index).find(".lg-img-wrap").first();t.top=0,t.left=0,t.setZoomEssentials(),t.setZoomSwipeStyles(r,{x:0,y:0}),t.positionChanged=!0}}),this.$LG(window).on("scroll.lg.zoom.global"+this.core.lgId,function(){t.core.lgOpened&&(t.scrollTop=t.$LG(window).scrollTop())}),this.core.getElementById("lg-zoom-out").on("click.lg",function(){if(t.isImageSlide(t.core.index)){var r=0;t.imageReset&&(t.resetImageTranslate(t.core.index),r=50),setTimeout(function(){var s=t.scale-t.settings.scale;s<1&&(s=1),t.beginZoom(s),t.zoomImage(s,-t.settings.scale,!0,!t.settings.infiniteZoom)},r)}}),this.core.getElementById("lg-zoom-in").on("click.lg",function(){t.zoomIn()}),this.core.getElementById("lg-actual-size").on("click.lg",function(){t.setActualSize(t.core.index)}),this.core.LGel.on(cn.beforeOpen+".zoom",function(){t.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(cn.afterOpen+".zoom",function(){t.scrollTop=t.$LG(window).scrollTop(),t.pageX=t.core.outer.width()/2,t.pageY=t.core.outer.height()/2+t.scrollTop,t.scale=1}),this.core.LGel.on(cn.afterSlide+".zoom",function(r){var s=r.detail.prevIndex;t.scale=1,t.positionChanged=!1,t.zoomInProgress=!1,t.resetZoom(s),t.resetImageTranslate(s),t.isImageSlide(t.core.index)&&t.setZoomEssentials()}),this.zoomDrag(),this.pinchZoom(),this.zoomSwipe(),this.zoomableTimeout=!1,this.positionChanged=!1,this.zoomInProgress=!1}},e.prototype.zoomIn=function(){if(this.isImageSlide(this.core.index)){var t=this.scale+this.settings.scale;this.settings.infiniteZoom||(t=this.getScale(t)),this.beginZoom(t),this.zoomImage(t,Math.min(this.settings.scale,t-this.scale),!0,!this.settings.infiniteZoom)}},e.prototype.resetZoom=function(t){this.core.outer.removeClass("lg-zoomed lg-zoom-drag-transition");var n=this.core.getElementById("lg-actual-size"),r=this.core.getSlideItem(t!==void 0?t: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()},e.prototype.getTouchDistance=function(t){return Math.sqrt((t.touches[0].pageX-t.touches[1].pageX)*(t.touches[0].pageX-t.touches[1].pageX)+(t.touches[0].pageY-t.touches[1].pageY)*(t.touches[0].pageY-t.touches[1].pageY))},e.prototype.pinchZoom=function(){var t=this,n=0,r=!1,s=1,o=0,a=this.core.getSlideItem(this.core.index);this.core.outer.on("touchstart.lg",function(l){if(a=t.core.getSlideItem(t.core.index),!!t.isImageSlide(t.core.index)&&l.touches.length===2){if(l.preventDefault(),t.core.outer.hasClass("lg-first-slide-loading"))return;s=t.scale||1,t.core.outer.removeClass("lg-zoom-drag-transition lg-zoom-dragging"),t.setPageCords(l),t.resetImageTranslate(t.core.index),t.core.touchAction="pinch",n=t.getTouchDistance(l)}}),this.core.$inner.on("touchmove.lg",function(l){if(l.touches.length===2&&t.core.touchAction==="pinch"&&(t.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){l.preventDefault();var c=t.getTouchDistance(l),d=n-c;if(!r&&Math.abs(d)>5&&(r=!0),r){o=t.scale;var h=Math.max(1,s+-d*.02);t.scale=Math.round((h+Number.EPSILON)*100)/100;var u=t.scale-o;t.zoomImage(t.scale,Math.round((u+Number.EPSILON)*100)/100,!1,!1)}}}),this.core.$inner.on("touchend.lg",function(l){if(t.core.touchAction==="pinch"&&(t.$LG(l.target).hasClass("lg-item")||a.get().contains(l.target))){if(r=!1,n=0,t.scale<=1)t.resetZoom();else{var c=t.getCurrentImageActualSizeScale();if(t.scale>=c){var d=c-t.scale;d===0&&(d=.01),t.zoomImage(c,d,!1,!0)}t.manageActualPixelClassNames(),t.core.outer.addClass("lg-zoomed")}t.core.touchAction=void 0}})},e.prototype.touchendZoom=function(t,n,r,s,o){var a=n.x-t.x,l=n.y-t.y,c=Math.abs(a)/o+1,d=Math.abs(l)/o+1;c>2&&(c+=1),d>2&&(d+=1),a=a*c,l=l*d;var h=this.core.getSlideItem(this.core.index).find(".lg-img-wrap").first(),u={};u.x=this.left+a,u.y=this.top+l;var f=this.getPossibleSwipeDragCords();(Math.abs(a)>15||Math.abs(l)>15)&&(s&&(this.isBeyondPossibleTop(u.y,f.minY)?u.y=f.minY:this.isBeyondPossibleBottom(u.y,f.maxY)&&(u.y=f.maxY)),r&&(this.isBeyondPossibleLeft(u.x,f.minX)?u.x=f.minX:this.isBeyondPossibleRight(u.x,f.maxX)&&(u.x=f.maxX)),s?this.top=u.y:u.y=this.top,r?this.left=u.x:u.x=this.left,this.setZoomSwipeStyles(h,u),this.positionChanged=!0)},e.prototype.getZoomSwipeCords=function(t,n,r,s,o){var a={};if(s){if(a.y=this.top+(n.y-t.y),this.isBeyondPossibleTop(a.y,o.minY)){var l=o.minY-a.y;a.y=o.minY-l/6}else if(this.isBeyondPossibleBottom(a.y,o.maxY)){var c=a.y-o.maxY;a.y=o.maxY+c/6}}else a.y=this.top;if(r){if(a.x=this.left+(n.x-t.x),this.isBeyondPossibleLeft(a.x,o.minX)){var d=o.minX-a.x;a.x=o.minX-d/6}else if(this.isBeyondPossibleRight(a.x,o.maxX)){var h=a.x-o.maxX;a.x=o.maxX+h/6}}else a.x=this.left;return a},e.prototype.isBeyondPossibleLeft=function(t,n){return t>=n},e.prototype.isBeyondPossibleRight=function(t,n){return t<=n},e.prototype.isBeyondPossibleTop=function(t,n){return t>=n},e.prototype.isBeyondPossibleBottom=function(t,n){return t<=n},e.prototype.isImageSlide=function(t){var n=this.core.galleryItems[t];return this.core.getSlideType(n)==="image"},e.prototype.getPossibleSwipeDragCords=function(t){var n=this.core.getSlideItem(this.core.index).find(".lg-image").first(),r=this.core.mediaContainerPosition.bottom,s=n.get().getBoundingClientRect(),o=s.height,a=s.width;t&&(o=o+t*o,a=a+t*a);var l=(o-this.containerRect.height)/2,c=(this.containerRect.height-o)/2+r,d=(a-this.containerRect.width)/2,h=(this.containerRect.width-a)/2,u={minY:l,maxY:c,minX:d,maxX:h};return u},e.prototype.setZoomSwipeStyles=function(t,n){t.css("transform","translate3d("+n.x+"px, "+n.y+"px, 0)")},e.prototype.zoomSwipe=function(){var t=this,n={},r={},s=!1,o=!1,a=!1,l=new Date,c=new Date,d,h,u=this.core.getSlideItem(this.core.index);this.core.$inner.on("touchstart.lg",function(f){if(t.isImageSlide(t.core.index)&&(u=t.core.getSlideItem(t.core.index),(t.$LG(f.target).hasClass("lg-item")||u.get().contains(f.target))&&f.touches.length===1&&t.core.outer.hasClass("lg-zoomed"))){f.preventDefault(),l=new Date,t.core.touchAction="zoomSwipe",h=t.core.getSlideItem(t.core.index).find(".lg-img-wrap").first();var p=t.getDragAllowedAxises(0);a=p.allowY,o=p.allowX,(o||a)&&(n=t.getSwipeCords(f)),d=t.getPossibleSwipeDragCords(),t.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(f){if(f.touches.length===1&&t.core.touchAction==="zoomSwipe"&&(t.$LG(f.target).hasClass("lg-item")||u.get().contains(f.target))){f.preventDefault(),t.core.touchAction="zoomSwipe",r=t.getSwipeCords(f);var p=t.getZoomSwipeCords(n,r,o,a,d);(Math.abs(r.x-n.x)>15||Math.abs(r.y-n.y)>15)&&(s=!0,t.setZoomSwipeStyles(h,p))}}),this.core.$inner.on("touchend.lg",function(f){if(t.core.touchAction==="zoomSwipe"&&(t.$LG(f.target).hasClass("lg-item")||u.get().contains(f.target))){if(f.preventDefault(),t.core.touchAction=void 0,t.core.outer.removeClass("lg-zoom-dragging"),!s)return;s=!1,c=new Date;var p=c.valueOf()-l.valueOf();t.touchendZoom(n,r,o,a,p)}})},e.prototype.zoomDrag=function(){var t=this,n={},r={},s=!1,o=!1,a=!1,l=!1,c,d,h,u;this.core.outer.on("mousedown.lg.zoom",function(f){if(t.isImageSlide(t.core.index)){var p=t.core.getSlideItem(t.core.index);if(t.$LG(f.target).hasClass("lg-item")||p.get().contains(f.target)){c=new Date,u=t.core.getSlideItem(t.core.index).find(".lg-img-wrap").first();var g=t.getDragAllowedAxises(0);l=g.allowY,a=g.allowX,t.core.outer.hasClass("lg-zoomed")&&t.$LG(f.target).hasClass("lg-object")&&(a||l)&&(f.preventDefault(),n=t.getDragCords(f),h=t.getPossibleSwipeDragCords(),s=!0,t.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(s){o=!0,r=t.getDragCords(f);var p=t.getZoomSwipeCords(n,r,a,l,h);t.setZoomSwipeStyles(u,p)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(f){if(s){if(d=new Date,s=!1,t.core.outer.removeClass("lg-zoom-dragging"),o&&(n.x!==r.x||n.y!==r.y)){r=t.getDragCords(f);var p=d.valueOf()-c.valueOf();t.touchendZoom(n,r,a,l,p)}o=!1}t.core.outer.removeClass("lg-grabbing").addClass("lg-grab")})},e.prototype.closeGallery=function(){this.resetZoom(),this.zoomInProgress=!1},e.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},e}();const De=class De{static init(t){if(De.uiConfig)throw new Error("UI provider already initialized.");De.uiConfig=t,De.windowResizeHandler(),window.addEventListener("resize",De.windowResizeHandler)}static destroy(){window.removeEventListener("resize",De.windowResizeHandler)}static getMessagesService(){return De.getUiConfig().messagesService}static getNotificationsService(){return De.getUiConfig().notificationsService}static getDeviceTypeByResolution(){const{deviceTypeResolutionsConfig:t}=De.getUiConfig();return window.innerWidth<t.tablet?G.WindowResolutionEnum.phone:window.innerWidth<t.laptop?G.WindowResolutionEnum.tablet:G.WindowResolutionEnum.laptop}static initRefDependingOnDeviceResolution(t,n,r){const s=i.ref(r);return De.setRefValueDependingOnDeviceResolution(s,t,n,r),De.refsDependingOnDeviceResolution.push({r:s,phoneValue:t,tabletValue:n,defaultValue:r}),s}static isPhoneDevice(){return De.getDeviceTypeByResolution()===G.WindowResolutionEnum.phone}static isTabletDevice(){return De.getDeviceTypeByResolution()===G.WindowResolutionEnum.tablet}static isLaptopDevice(){return De.getDeviceTypeByResolution()===G.WindowResolutionEnum.laptop}static showNotificationsForErrorResponseData(t,n={}){var r,s;if(W.isEmpty(t.errors)){const o=(s=(r=t.rawError)==null?void 0:r.config)==null?void 0:s.url,a=o?` [ ${o} ]`:"";De.getNotificationsService().error({title:"Ошибка выполнения/обработки запроса",content:t.message,meta:`#${t.status}${a}: ${t.statusText}`,duration:3e3})}else for(const o in t.errors)Object.prototype.hasOwnProperty.call(n,o)?n[o]=new G.FieldValidationResultData(t.errors[o].toString(),"error"):De.getMessagesService().error(t.errors[o].toString())}static getUiConfig(){if(!De.uiConfig)throw new Error("UI provider is not initialized.");return De.uiConfig}static setRefValueDependingOnDeviceResolution(t,n,r,s){switch(De.getDeviceTypeByResolution()){case G.WindowResolutionEnum.phone:t.value=n;break;case G.WindowResolutionEnum.tablet:t.value=r;break;default:t.value=s;break}}static windowResizeHandler(){W.forEach(De.refsDependingOnDeviceResolution,t=>{De.setRefValueDependingOnDeviceResolution(t.r,t.phoneValue,t.tabletValue,t.defaultValue)})}};k(De,"uiConfig"),k(De,"refsDependingOnDeviceResolution",[]);let pt=De;const zu={ref:"gallery-container",class:"lightgallery-wrapper"},Iu={},ya=i.defineComponent({...Iu,__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(e){const t=e,n={lgAfterAppendSlide:t.onAfterAppendSlide,lgInit:t.onInit,lgHasVideo:t.onHasVideo,lgContainerResize:t.onContainerResize,lgAfterAppendSubHtml:t.onAfterAppendSubHtml,lgBeforeOpen:t.onBeforeOpen,lgAfterOpen:t.onAfterOpen,lgSlideItemLoad:t.onSlideItemLoad,lgBeforeSlide:t.onBeforeSlide,lgAfterSlide:t.onAfterSlide,lgPosterClick:t.onPosterClick,lgDragStart:t.onDragStart,lgDragMove:t.onDragMove,lgDragEnd:t.onDragEnd,lgBeforeNextSlide:t.onBeforeNextSlide,lgBeforePrevSlide:t.onBeforePrevSlide,lgBeforeClose:t.onBeforeClose,lgAfterClose:t.onAfterClose,lgRotateLeft:t.onRotateLeft,lgRotateRight:t.onRotateRight,lgFlipHorizontal:t.onFlipHorizontal,lgFlipVertical:t.onFlipVertical},r=i.useTemplateRef("gallery-container"),s=i.ref(null);return i.onMounted(async()=>{if(!r.value)return;const o=await import("lightgallery");s.value=o.default(r.value,{...t.settings}),W.forOwn(n,(a,l)=>{var c;a&&((c=r.value)==null||c.addEventListener(l,a))})}),i.onBeforeUnmount(()=>{var o;s.value&&((o=s.value)==null||o.destroy(),s.value=null)}),(o,a)=>(i.openBlock(),i.createElementBlock("div",zu,[i.renderSlot(o.$slots,"default")],512))}}),Lu=["href"],Du=["src","alt"],Hu={},ba=i.defineComponent({...Hu,__name:"image-gallery",props:{images:{}},setup(e,{expose:t}){const n=i.ref(!1),r=i.ref(!1),s=i.ref({plugins:[Au,Vu],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),o=()=>window.innerWidth*(pt.getDeviceTypeByResolution()===G.WindowResolutionEnum.phone?.7:.8),a=i.ref(o()),l=()=>{a.value=o()},c=()=>{n.value=!0};return i.onUnmounted(()=>{window.removeEventListener("resize",l)}),t({show:c}),window.addEventListener("resize",l),(d,h)=>{const u=_a,f=V.NPopover;return i.openBlock(),i.createBlock(f,{trigger:"manual",show:n.value,class:"sc-image",placement:"top-start",onClickoutside:h[3]||(h[3]=()=>{r.value||(n.value=!1)})},{trigger:i.withCtx(()=>[i.createElementVNode("div",{class:"inline-flex",onClick:h[0]||(h[0]=p=>n.value=!n.value)},[i.renderSlot(d.$slots,"default",{},()=>[i.createVNode(u)])])]),default:i.withCtx(()=>[i.createVNode(ya,{settings:s.value,style:i.normalizeStyle(`max-width: ${a.value}px`),class:"flex flex-row overflow-x-scroll",onAfterOpen:h[1]||(h[1]=()=>{r.value=!0}),onAfterClose:h[2]||(h[2]=()=>{r.value=!1,n.value=!1})},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.images,(p,g)=>(i.openBlock(),i.createElementBlock("a",{key:g,href:p.image},[i.createElementVNode("img",{src:p.preview,alt:`Изображение #${g+1}`},null,8,Du)],8,Lu))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),Wu={class:"flex flex-col text-sm"},ju={},Xu=i.defineComponent({...ju,__name:"product-stock-count",props:{product:{}},setup(e){return(t,n)=>{const r=Cs,s=V.NPopover;return i.openBlock(),i.createBlock(s,{trigger:"click",placement:"top-start",class:"sc-stock-count"},{trigger:i.withCtx(()=>[i.renderSlot(t.$slots,"default",{},()=>[i.createVNode(r)])]),default:i.withCtx(()=>[i.createElementVNode("div",Wu,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.product.stockCount,(o,a)=>(i.openBlock(),i.createElementBlock("span",{key:a},i.toDisplayString(o.warehouse.name)+": "+i.toDisplayString(o.count)+" "+i.toDisplayString(t.product.quantityUnit),1))),128))])]),_:3})}}}),qu={class:"flex flex-row justify-between"},Yu={key:0},Uu={class:"ml-2 align-sub"},Gu={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},Ku={class:"@container"},Zu={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},Ju={key:0,class:"sc-supplier-sku col-span-2 whitespace-nowrap text-wrap sm:col-span-3"},Qu={class:"text-sc-dark-grey"},ef={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},tf={class:"text-gray-600"},nf={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},rf={key:3,class:"underline decoration-dashed"},sf={key:4,class:"sc-product-pack whitespace-nowrap"},of={class:"text-gray-600"},af={key:5,class:"sc-product-planning-incoming-date col-span-2 col-start-1 mt-1.5 text-wrap"},lf={class:"text-gray-600"},cf={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},df={key:0},hf={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},uf={},Xi=i.defineComponent({...uf,__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},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showProductAddToCartButton:{type:[Boolean,Function],default:!1},showProductEditButton:{type:[Boolean,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(e,{expose:t}){const n=e,r=i.computed(()=>W.isFunction(n.showProductCosts)?n.showProductCosts(n.product):n.showProductCosts),s=i.computed(()=>W.sortBy(n.product.priceCoefficients,["coefficient.slug"])),o=i.computed(()=>{var h,u;return(u=(h=n.product)==null?void 0:h.properties)==null?void 0:u.planingIncomingDate}),a=i.useTemplateRef("image-gallery"),l=()=>{var h;(h=a.value)==null||h.show()},c=i.computed(()=>W.isFunction(n.allowNameClick)?n.allowNameClick(n.product):n.allowNameClick),d=()=>{var h;c.value&&((h=n.eventEmitter)==null||h.emit("product:name-click",{product:n.product,exposedMethods:{showProductImagesPreview:l}}))};return t({showProductImagesPreview:l}),(h,u)=>{var y,b,S,x,C;const f=_a,p=V.NText,g=ma,m=Cs,_=V.NScrollbar;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",qu,[i.createVNode(p,{type:"info",class:"sc-product-name text-balance text-base font-medium"},{default:i.withCtx(()=>[i.createElementVNode("span",{class:i.normalizeClass({"cursor-pointer":c.value&&h.eventEmitter}),onClick:d},i.toDisplayString(h.product.name),3),h.product.onOrder?(i.openBlock(),i.createElementBlock("span",Yu," [Под заказ] ")):i.createCommentVNode("",!0),i.createElementVNode("span",Uu,[h.product.images&&h.product.images.length>0?(i.openBlock(),i.createBlock(ba,{key:0,ref:"image-gallery",images:h.product.images},{default:i.withCtx(()=>[i.createElementVNode("div",Gu,[i.createVNode(f)])]),_:1},8,["images"])):i.createCommentVNode("",!0)])]),_:1}),h.showProductAddToCartButton||h.showProductEditButton||((y=h.productContextButtonsConfig)==null?void 0:y.length)>0?(i.openBlock(),i.createBlock(g,{key:0,product:h.product,"event-emitter":h.eventEmitter,"show-product-add-to-cart-button":h.showProductAddToCartButton,"show-product-edit-button":h.showProductEditButton,"product-context-buttons-config":h.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","product-context-buttons-config"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",Ku,[i.createElementVNode("div",Zu,[h.product.supplierSku?(i.openBlock(),i.createElementBlock("div",Ju,[u[0]||(u[0]=i.createTextVNode(" Артикул производителя/поставщика: ")),i.createElementVNode("span",Qu,i.toDisplayString(h.product.supplierSku),1)])):i.createCommentVNode("",!0),h.showCode?(i.openBlock(),i.createElementBlock("span",ef,[u[1]||(u[1]=i.createTextVNode(" Артикул: ")),i.createElementVNode("span",tf,i.toDisplayString(h.product.code),1)])):i.createCommentVNode("",!0),h.product.stockCount&&h.product.stockCount.length>0?(i.openBlock(),i.createBlock(Xu,{key:2,product:h.product},{default:i.withCtx(()=>[i.createElementVNode("span",nf,[u[2]||(u[2]=i.createElementVNode("span",{class:"underline decoration-dashed"},"В наличии",-1)),i.createVNode(m,{class:"mt-0.5"})])]),_:1},8,["product"])):(i.openBlock(),i.createElementBlock("span",rf," Нет в наличии ")),(S=(b=h.product)==null?void 0:b.properties)!=null&&S.pack?(i.openBlock(),i.createElementBlock("span",sf,[u[3]||(u[3]=i.createTextVNode(" Норма упаковки: ")),i.createElementVNode("span",of,i.toDisplayString((C=(x=h.product)==null?void 0:x.properties)==null?void 0:C.pack),1)])):i.createCommentVNode("",!0),h.showPlanningDates&&o.value?(i.openBlock(),i.createElementBlock("span",af,[u[4]||(u[4]=i.createTextVNode(" Планируемая дата поступления на основной склад: ")),i.createElementVNode("span",lf,i.toDisplayString(o.value),1)])):i.createCommentVNode("",!0)])]),i.createVNode(_,{"x-scrollable":""},{default:i.withCtx(()=>[r.value?(i.openBlock(),i.createElementBlock("div",cf,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,B=>(i.openBlock(),i.createBlock(kr,{key:B.coefficient.slug,product:h.product,"cost-field-name":B.coefficient.slug??"","event-emitter":h.eventEmitter,"allow-price-click":h.allowPriceClick,"show-tag":!0,"show-price-history":h.showPriceHistory},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history"]))),128)),i.createVNode(kr,{product:h.product,"event-emitter":h.eventEmitter,"allow-price-click":h.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":!0,"show-price-history":h.showPriceHistory,"cost-field-name":"cost",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-price-history"])])):i.createCommentVNode("",!0)]),_:1}),h.showSlugs||h.showProperties?(i.openBlock(),i.createElementBlock("div",df,[i.createElementVNode("ul",hf,[h.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:h.product.id,slug:h.product.slug},(B,v)=>(i.openBlock(),i.createElementBlock("li",{key:v}," ("+i.toDisplayString(v)+"): "+i.toDisplayString(B),1))),128)):i.createCommentVNode("",!0),h.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(h.product.properties,(B,v)=>(i.openBlock(),i.createElementBlock("li",{key:v}," ("+i.toDisplayString(v)+"): "+i.toDisplayString(B),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)])}}}),ff=(e,t,n)=>({key:e,title:t,className:"align-top",resizable:!0,render:r=>i.h(kr,{product:r,costFieldName:e,eventEmitter:n.eventEmitter,allowPriceClick:n.allowPriceClick})}),pf=(e,t)=>{if(e.length===0)return[];const n=[],r={};switch(pt.getDeviceTypeByResolution()){case G.WindowResolutionEnum.phone:case G.WindowResolutionEnum.tablet:n.push({key:"name",title:"Наименование",className:"align-top",render:s=>i.h(Xi,{product:s,eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,showProductCosts:t.showProductCosts,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,productContextButtonsConfig:t.productContextButtonsConfig})});break;default:n.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:s=>i.h(Xi,{product:s,eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory})}),t.showProductCosts&&(W.forEach(e,s=>{W.forEach(s.priceCoefficients,o=>{r[o.coefficient.slug??""]||(r[o.coefficient.slug??""]=o.coefficient)})}),W.forEach(W.sortBy(r,["slug"]),s=>{n.push(ff(s.slug??"",s.name,t))}),n.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:s=>i.h(kr,{product:s,costFieldName:"cost",eventEmitter:t.eventEmitter,allowPriceClick:t.allowPriceClick,showQuantityUnit:!0,showCostDate:!0,showPriceHistory:t.showPriceHistory})})),(t.showProductEditButton||!W.isNil(t.productContextButtonsConfig))&&n.push({key:"actions",title:"",className:"align-top",width:"50",render:s=>i.h(ma,{product:s,eventEmitter:t.eventEmitter,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,productContextButtonsConfig:t.productContextButtonsConfig})});break}return n},gf={key:0,class:"pt-0.5"},mf={class:"flex flex-row gap-1"},_f={key:0},yf={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},bf={class:"flex flex-col-reverse gap-2.5 sm:flex-row"},wf={},vf=i.defineComponent({...wf,__name:"category-collapse-item",props:{categoryItem:{},filteredItems:{},selectedCategoriesItems:{default:void 0},selectedProductsItems:{default:void 0},showHideForClientButton:{type:[Boolean,Function],default:!1},showPinButton:{type:[Boolean,Function],default:!1},showCategoryEditButton:{type:[Boolean,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showProductAddToCartButton:{type:[Boolean,Function],default:!1},showProductEditButton:{type:[Boolean,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(e){const t=e,n=i.inject(vr,"medium"),r=i.computed(()=>{var M;return(M=t==null?void 0:t.filteredItems)==null?void 0:M[t.categoryItem.id]}),s=i.computed(()=>{var M,N;return W.isArray((M=t.categoryItem)==null?void 0:M.categories)&&((N=t.categoryItem.categories)==null?void 0:N.length)>0}),o=i.computed(()=>{var M;return W.isArray((M=t.categoryItem)==null?void 0:M.products)?t.categoryItem.products:[]}),a=i.computed(()=>W.isUndefined(t.filteredItems)||r.value==="*"?o.value:o.value.filter(M=>{var N,A;return(A=(N=r.value)==null?void 0:N.products)==null?void 0:A.includes(M.id)})),l=i.computed(()=>a.value.length>0),c=i.computed(()=>W.isFunction(t.showHideForClientButton)?t.showHideForClientButton(t.categoryItem):t.showHideForClientButton),d=i.computed(()=>W.isFunction(t.showPinButton)?t.showPinButton(t.categoryItem):t.showPinButton),h=i.computed(()=>W.isFunction(t.showCategoryEditButton)?t.showCategoryEditButton(t.categoryItem):t.showCategoryEditButton),u=i.computed(()=>W.isNil(t.categoryContextButtonsConfig)?[]:W.isFunction(t.categoryContextButtonsConfig)?t.categoryContextButtonsConfig(t.categoryItem):t.categoryContextButtonsConfig),f=i.computed(()=>new G.ClientCategory(t.categoryItem)),p=i.ref(!1),g=i.ref(!1),m=i.computed(()=>!W.isUndefined(t.selectedCategoriesItems)),_=i.computed(()=>(t.selectedCategoriesItems??[]).some(M=>M.id===t.categoryItem.id)),y=i.computed(()=>F.value&&pt.getDeviceTypeByResolution()===G.WindowResolutionEnum.laptop?"auto":"fixed"),b=M=>{t.eventEmitter.emit("category:checked",{category:t.categoryItem,checked:M})},S=(M,N)=>{t.eventEmitter.emit("category:header-click",{categoryItem:t.categoryItem,expanded:N,isLoadingState:p})},x=()=>{t.eventEmitter.emit("category:hide",{category:t.categoryItem})},C=()=>{t.eventEmitter.emit("category:attach",{category:t.categoryItem})},B=()=>{t.eventEmitter.emit("category:detach",{category:t.categoryItem})},v=()=>{t.eventEmitter.emit("category:edit",{category:t.categoryItem})},$=M=>{t.eventEmitter.emit("category:context-select",{category:t.categoryItem,key:M})},F=i.ref(0),R=i.computed(()=>F.value&&o.value.length>0?pf(o.value,{eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,showProductCosts:t.showProductCosts,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,productContextButtonsConfig:t.productContextButtonsConfig}):[]),X=W.debounce(()=>{F.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",X)}),window.addEventListener("resize",X),X(),(M,N)=>{const A=V.NCheckbox,L=ou,Y=V.NTooltip,P=iu,E=pa,H=V.NTag,I=Jh,U=Gh,O=V.NButton,z=qh,J=fa,pe=ua,re=V.NDropdown,ge=V.NDataTable,ie=V.NAlert,Me=V.NSpin;return i.openBlock(),i.createBlock(ga,{name:M.categoryItem.id,"data-id":M.categoryItem.id,"onHeader:click":S},{"pre-arrow":i.withCtx(()=>{var xe,Ce,Fe;return[m.value?(i.openBlock(),i.createElementBlock("div",gf,[i.createVNode(A,{checked:_.value,"onUpdate:checked":b},null,8,["checked"])])):i.createCommentVNode("",!0),!c.value&&((xe=f.value)!=null&&xe.isDisabled)?(i.openBlock(),i.createBlock(Y,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(L,{class:"pt-1.5"})]),default:i.withCtx(()=>[N[1]||(N[1]=i.createTextVNode(" Категория скрыта для клиента "))]),_:1,__:[1]})):i.createCommentVNode("",!0),((Ce=f.value)==null?void 0:Ce.isFavorite)??!1?(i.openBlock(),i.createBlock(Y,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(P,{class:"pt-1.5"})]),default:i.withCtx(()=>[N[2]||(N[2]=i.createTextVNode(" Избранная категория "))]),_:1,__:[2]})):i.createCommentVNode("",!0),((Fe=f.value)==null?void 0:Fe.isRequired)??!1?(i.openBlock(),i.createBlock(Y,{key:3,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(E,{class:"pt-1.5"})]),default:i.withCtx(()=>[N[3]||(N[3]=i.createTextVNode(" Доп. продажа "))]),_:1,__:[3]})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var xe,Ce,Fe;return[i.createElementVNode("div",{class:i.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":M.categoryItem.isHidden,"text-gray-400":(xe=f.value)==null?void 0:xe.isDisabled})},[i.createVNode(Y,{disabled:!M.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(M.categoryItem.name),1)]),default:i.withCtx(()=>[N[4]||(N[4]=i.createTextVNode(" Категория скрыта "))]),_:1,__:[4]},8,["disabled"])],2),i.createElementVNode("div",{onClick:N[0]||(N[0]=i.withModifiers((...Ie)=>i.unref(W.noop)&&i.unref(W.noop)(...Ie),["prevent","stop"]))},[(Ce=M.categoryItem.properties)!=null&&Ce.m2Price?(i.openBlock(),i.createBlock(H,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createTextVNode(" Средняя стоимость: "+i.toDisplayString(M.categoryItem.properties.m2Price)+" руб./м2 ",1)]),_:1},8,["size"])):i.createCommentVNode("",!0),d.value&&((Fe=f.value)!=null&&Fe.manager)?(i.openBlock(),i.createBlock(H,{key:1,size:i.unref(n),closable:!0,round:"",onClose:B},{default:i.withCtx(()=>[i.createVNode(Y,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var Ie,vt;return[i.createElementVNode("span",mf,[i.createVNode(I),i.createTextVNode(" "+i.toDisplayString((vt=(Ie=f.value)==null?void 0:Ie.manager)==null?void 0:vt.name),1)])]}),default:i.withCtx(()=>{var Ie,vt;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((vt=(Ie=f.value)==null?void 0:Ie.manager)==null?void 0:vt.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[M.showSlugs||M.showProperties?(i.openBlock(),i.createElementBlock("div",_f,[i.createElementVNode("ul",yf,[M.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:M.categoryItem.id,slug:M.categoryItem.slug},(xe,Ce)=>(i.openBlock(),i.createElementBlock("li",{key:Ce}," ("+i.toDisplayString(Ce)+"): "+i.toDisplayString(xe),1))),128)):i.createCommentVNode("",!0),M.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(M.categoryItem.properties,(xe,Ce)=>(i.openBlock(),i.createElementBlock("li",{key:Ce}," ("+i.toDisplayString(Ce)+"): "+i.toDisplayString(xe),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var xe;return[i.createElementVNode("div",bf,[c.value?(i.openBlock(),i.createBlock(Y,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(O,{size:i.unref(n),onClick:x},{default:i.withCtx(()=>{var Ce;return[(Ce=f.value)!=null&&Ce.isDisabled?(i.openBlock(),i.createBlock(L,{key:1})):(i.openBlock(),i.createBlock(U,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var Ce;return[(Ce=f.value)!=null&&Ce.isDisabled?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" Скрыто для клиента"+i.toDisplayString(f.value.hidingComment?`. Причина: '${f.value.hidingComment}'`:""),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Видимо клиенту")],64))]}),_:1})):i.createCommentVNode("",!0),d.value&&!((xe=f.value)!=null&&xe.manager)?(i.openBlock(),i.createBlock(Y,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(O,{size:i.unref(n),onClick:C},{default:i.withCtx(()=>[i.createVNode(z)]),_:1},8,["size"])]),default:i.withCtx(()=>{var Ce,Fe,Ie;return[(Ce=f.value)!=null&&Ce.manager?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode('Категория закреплена за "'+i.toDisplayString(((Ie=(Fe=f.value)==null?void 0:Fe.manager)==null?void 0:Ie.name)??"-")+'"',1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode("Закрепить")],64))]}),_:1})):i.createCommentVNode("",!0),h.value?(i.openBlock(),i.createBlock(Y,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(O,{ghost:!0,size:i.unref(n),type:"primary",onClick:v},{default:i.withCtx(()=>[i.createVNode(J)]),_:1},8,["size"])]),default:i.withCtx(()=>[N[5]||(N[5]=i.createTextVNode(" Редактировать "))]),_:1,__:[5]})):i.createCommentVNode("",!0),u.value.length>0?(i.openBlock(),i.createBlock(re,{key:3,options:u.value,size:i.unref(n),trigger:"click",onSelect:$},{default:i.withCtx(()=>[i.createVNode(O,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(pe)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(M.$slots,"default",{},()=>{var xe;return[s.value?(i.openBlock(),i.createBlock(va,{key:0,"categories-items":M.categoryItem.categories??[],"event-emitter":M.eventEmitter,"filtered-items":(xe=r.value)==null?void 0:xe.categories,"selected-categories-items":M.selectedCategoriesItems,"selected-products-items":M.selectedProductsItems,"show-slugs":M.showSlugs,"show-properties":M.showProperties,"show-product-costs":M.showProductCosts,"allow-name-click":M.allowNameClick,"allow-price-click":M.allowPriceClick,"show-price-history":M.showPriceHistory,"show-product-add-to-cart-button":M.showProductAddToCartButton,"show-product-edit-button":M.showProductEditButton,"product-context-buttons-config":M.productContextButtonsConfig,"show-hide-for-client-button":M.showHideForClientButton,"show-pin-button":M.showPinButton,"show-category-edit-button":M.showCategoryEditButton,"category-context-buttons-config":M.categoryContextButtonsConfig},null,8,["categories-items","event-emitter","filtered-items","selected-categories-items","selected-products-items","show-slugs","show-properties","show-product-costs","allow-name-click","allow-price-click","show-price-history","show-product-add-to-cart-button","show-product-edit-button","product-context-buttons-config","show-hide-for-client-button","show-pin-button","show-category-edit-button","category-context-buttons-config"])):i.createCommentVNode("",!0),l.value?(i.openBlock(),i.createBlock(ge,{key:1,columns:R.value,data:a.value,bordered:!0,loading:p.value,remote:!0,"row-key":Ce=>Ce.id,"table-layout":y.value,class:"mt-1"},null,8,["columns","data","loading","row-key","table-layout"])):i.createCommentVNode("",!0),!p.value&&!g.value&&!s.value&&!l.value?(i.openBlock(),i.createBlock(ie,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),g.value?(i.openBlock(),i.createBlock(ie,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),p.value?(i.openBlock(),i.createBlock(Me,{key:4,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>N[6]||(N[6]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),kf=Ln(vf,[["__scopeId","data-v-0c971738"]]),xf={class:"sc-collapse flex w-full flex-col"},Cf={},wa=i.defineComponent({...Cf,__name:"collapse",props:{defaultExpandedNames:{default:()=>[]},expandedNames:{default:()=>[]}},emits:["on-item-header-click"],setup(e,{emit:t}){const n=e,r=t,s=(o,a)=>{r("on-item-header-click",o,a)};return i.provide("itemHeaderClickHandler",s),i.provide("defaultExpandedNames",n.defaultExpandedNames),i.provide("expandedNames",n.expandedNames),(o,a)=>(i.openBlock(),i.createElementBlock("div",xf,[i.renderSlot(o.$slots,"default")]))}}),Sf={},va=i.defineComponent({...Sf,__name:"category-collapse",props:{categoriesItems:{},loading:{type:Boolean,default:!1},filteredItems:{default:void 0},selectedCategoriesItems:{default:void 0},selectedProductsItems:{default:void 0},showHideForClientButton:{type:[Boolean,Function],default:!1},showPinButton:{type:[Boolean,Function],default:!1},showCategoryEditButton:{type:[Boolean,Function],default:!1},categoryContextButtonsConfig:{type:Function,default:void 0},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showProductCosts:{type:[Boolean,Function],default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},showPriceHistory:{type:[Boolean,Function],default:!1},showProductAddToCartButton:{type:[Boolean,Function],default:!1},showProductEditButton:{type:[Boolean,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(e){const t=e,n=i.inject(vr,"medium"),r=i.computed(()=>W.isUndefined(t.filteredItems)?t.categoriesItems:t.categoriesItems.filter(o=>{var a;return!!((a=t.filteredItems)!=null&&a[o.id])})),s=(o,a)=>{if(W.isUndefined(a))return;const l=a[o.id];if(l==="*")return;const c={};return c[o.id]=structuredClone(i.toRaw(l)),c};return(o,a)=>{const l=V.NSpin,c=V.NAlert;return i.openBlock(),i.createElementBlock(i.Fragment,null,[r.value.length>0?(i.openBlock(),i.createBlock(wa,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(kf,{key:d.id,"category-item":d,"event-emitter":o.eventEmitter,"filtered-items":s(d,o.filteredItems),"selected-categories-items":o.selectedCategoriesItems,"selected-products-items":o.selectedProductsItems,"show-slugs":o.showSlugs,"show-properties":o.showProperties,"show-product-costs":o.showProductCosts,"allow-name-click":o.allowNameClick,"allow-price-click":o.allowPriceClick,"show-price-history":o.showPriceHistory,"show-product-add-to-cart-button":o.showProductAddToCartButton,"show-product-edit-button":o.showProductEditButton,"product-context-buttons-config":o.productContextButtonsConfig,"show-hide-for-client-button":o.showHideForClientButton,"show-pin-button":o.showPinButton,"show-category-edit-button":o.showCategoryEditButton,"category-context-buttons-config":o.categoryContextButtonsConfig},null,8,["category-item","event-emitter","filtered-items","selected-categories-items","selected-products-items","show-slugs","show-properties","show-product-costs","allow-name-click","allow-price-click","show-price-history","show-product-add-to-cart-button","show-product-edit-button","product-context-buttons-config","show-hide-for-client-button","show-pin-button","show-category-edit-button","category-context-buttons-config"]))),128))]),_:1})):o.loading?(i.openBlock(),i.createBlock(l,{key:1,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>a[0]||(a[0]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])),_:1},8,["size"])):i.createCommentVNode("",!0),!o.loading&&o.categoriesItems.length>0&&r.value.length===0?(i.openBlock(),i.createBlock(c,{key:2,"show-icon":!0,type:"warning",title:"Товары не найдены",class:"mx-10"})):i.createCommentVNode("",!0)],64)}}}),Bf={class:"text-sm"},Tf={class:"text-sm"},Ef={},$f=i.defineComponent({...Ef,__name:"add-product-to-cart-form",props:{product:{},cartItem:{default:void 0},validation:{default:()=>({length:{},quantity:{},marker:{}})},isSubmitProcessing:{type:Boolean}},emits:["submit"],setup(e,{emit:t}){var l,c,d,h,u,f,p,g;const n=e,r=i.ref(new G.CartItemBase(n.cartItem??new G.CartItemBase({product:n.product,quantity:((c=(l=n.product)==null?void 0:l.properties)==null?void 0:c.minCount)??1,length:((h=(d=n.product)==null?void 0:d.properties)==null?void 0:h.minLength)||((f=(u=n.product)==null?void 0:u.properties)!=null&&f.ignoreMinCountCheck?0:(g=(p=n.product)==null?void 0:p.properties)==null?void 0:g.minCount)||0}))),s=t,o=i.computed(()=>{var y,b,S,x,C,B,v,$,F;const m=((b=(y=n.product)==null?void 0:y.properties)==null?void 0:b.minLength)??((x=(S=n.product)==null?void 0:S.properties)!=null&&x.ignoreMinCountCheck?0:(B=(C=n.product)==null?void 0:C.properties)==null?void 0:B.minCount),_=($=(v=n.product)==null?void 0:v.properties)==null?void 0:$.maxLength;return m||_?`(${m?`от ${m}`:""}${m&&_?" ":""}${_?`до ${_}`:""} ${(F=n.product)==null?void 0:F.unit})`:""}),a=()=>{G.UnitsHelper.productIsMeasurable(n.product)||delete r.value.length,s("submit",r.value)};return(m,_)=>(i.openBlock(),i.createBlock(i.unref(V.NForm),{class:"flex flex-col gap-2"},{default:i.withCtx(()=>[i.unref(G.UnitsHelper).productIsMeasurable(m.product)?(i.openBlock(),i.createBlock(i.unref(V.NFormItem),{key:0,required:!0,feedback:m.validation.length.feedback||"","show-feedback":m.validation.length.showFeedback||i.unref(G.UnitsHelper).getProductLengthMultiplicity(m.product)!==.01||!1,"validation-status":m.validation.length.validationStatus||void 0,label:"Метраж, "+m.product.unit+o.value+"м."},i.createSlots({default:i.withCtx(()=>{var y,b;return[i.createVNode(i.unref(V.NInputNumber),{value:r.value.length,"onUpdate:value":_[0]||(_[0]=S=>r.value.length=S),max:((y=m.product.properties)==null?void 0:y.maxLength)||void 0,min:((b=m.product.properties)==null?void 0:b.minLength)||i.unref(G.UnitsHelper).getProductLengthMultiplicity(m.product),step:i.unref(G.UnitsHelper).getProductMultiplicity(m.product),validator:S=>S%i.unref(G.UnitsHelper).getProductLengthMultiplicity(m.product)===0,placeholder:"Введите метраж",class:"w-full"},null,8,["value","max","min","step","validator"])]}),_:2},[!m.validation.length.feedback&&i.unref(G.UnitsHelper).getProductLengthMultiplicity(m.product)!==.01?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Bf,"Метраж должен быть кратен "+i.toDisplayString(i.unref(G.UnitsHelper).getProductLengthMultiplicity(m.product)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status","label"])):i.createCommentVNode("",!0),i.createVNode(i.unref(V.NFormItem),{required:!0,feedback:m.validation.quantity.feedback||"","show-feedback":m.validation.quantity.showFeedback||i.unref(G.UnitsHelper).getProductMultiplicity(m.product)!==1||!1,"validation-status":m.validation.quantity.validationStatus||void 0,label:"Количество"},i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(V.NInputNumber),{value:r.value.quantity,"onUpdate:value":_[1]||(_[1]=y=>r.value.quantity=y),min:i.unref(G.UnitsHelper).getProductMultiplicity(m.product),step:i.unref(G.UnitsHelper).getProductMultiplicity(m.product),validator:y=>y%i.unref(G.UnitsHelper).getProductMultiplicity(m.product)===0,placeholder:"Введите количество",class:"w-full"},null,8,["value","min","step","validator"])]),_:2},[!m.validation.quantity.feedback&&i.unref(G.UnitsHelper).getProductMultiplicity(m.product)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Tf,"Количество должно быть кратно "+i.toDisplayString(i.unref(G.UnitsHelper).getProductMultiplicity(m.product)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(V.NFormItem),{feedback:m.validation.marker.feedback||"","show-feedback":m.validation.marker.showFeedback||!1,"validation-status":m.validation.marker.validationStatus||void 0,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NInput),{value:r.value.marker,"onUpdate:value":_[2]||(_[2]=y=>r.value.marker=y),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(V.NButton),{loading:m.isSubmitProcessing,disabled:r.value.length===0||r.value.quantity===0,type:"primary",class:"self-start",onClick:_[3]||(_[3]=y=>a())},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(m.cartItem?"Изменить":"В корзину"),1)]),_:1},8,["loading","disabled"])]),_:1}))}}),Nf={class:"flex flex-row gap-1"},Pf={class:"sc-client-name flex flex-col gap-1 text-base"},Rf=["href"],Ff={key:1,class:"text-sc-grey"},Mf={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Af={key:0},Of={key:1,class:"text-sm"},Vf={},Sr=i.defineComponent({...Vf,__name:"client-name-with-short-info",props:{client:{},nameLink:{default:void 0},popoverPosition:{default:void 0},showCityAndRegion:{type:Boolean,default:!0},showSalesDirection:{type:Boolean,default:!1},showClientInfoIcon:{type:Boolean,default:!1}},emits:["click:client-name","click:client-info"],setup(e,{emit:t}){const n=e,r=t,s=i.computed(()=>n.client.lastLoginAt?Sn.format(n.client.lastLoginAt,G.AppConfigProvider.getConfig().dateFormats.uiDateWithTime):""),o=a=>{W.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=Cs,d=V.NButton,h=V.NPopover;return i.openBlock(),i.createElementBlock("div",Nf,[a.showClientInfoIcon?(i.openBlock(),i.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=u=>a.$emit("click:client-info",a.client))},{default:i.withCtx(()=>[i.createVNode(c)]),_:1})):i.createCommentVNode("",!0),i.createVNode(h,{disabled:i.unref(W.isNil)(a.popoverPosition),placement:a.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",Pf,[i.createElementVNode("a",{href:a.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=u=>o(u))},[i.createElementVNode("span",{class:i.normalizeClass({"line-through":!a.client.isActive})},i.toDisplayString(a.client.name),3),a.showSalesDirection&&a.client.salesDirection?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass({"line-through":!a.client.isActive})}," ("+i.toDisplayString(a.client.salesDirection.name)+") ",3)):i.createCommentVNode("",!0),a.client.isActive?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",Ff," [ Деактивирован ] "))],8,Rf),a.showCityAndRegion&&a.client.city?(i.openBlock(),i.createElementBlock("span",Mf," г. "+i.toDisplayString(a.client.city.name)+", "+i.toDisplayString(a.client.city.region.name),1)):i.createCommentVNode("",!0)])]),default:i.withCtx(()=>[a.client.alternativeName?(i.openBlock(),i.createElementBlock("div",Af,i.toDisplayString(a.client.alternativeName),1)):i.createCommentVNode("",!0),s.value?(i.openBlock(),i.createElementBlock("span",Of," Последний вход: "+i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),zf={class:"text-base"},If={},ka=i.defineComponent({...If,__name:"contragent-with-short-info",props:{contragent:{}},setup(e){return(t,n)=>(i.openBlock(),i.createElementBlock("span",zf,i.toDisplayString(t.contragent.name),1))}}),Lf={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Df(e,t){return i.openBlock(),i.createElementBlock("svg",Lf,t[0]||(t[0]=[i.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[i.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),i.createElementVNode("path",{d:"m3 7l9 6l9-6"})],-1)]))}const Hf=i.markRaw({name:"tabler-mail",render:Df}),Wf=["href"],jf={},Xf=i.defineComponent({...jf,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(e){return(t,n)=>{const r=Hf;return i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-row items-center gap-1":t.showEmailIcon})},[t.showEmailIcon?(i.openBlock(),i.createBlock(r,{key:0})):i.createCommentVNode("",!0),i.createElementVNode("a",{href:`mailto:${t.email}`,class:"no-underline"},i.toDisplayString(t.email),9,Wf)],2)}}}),qf={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Yf(e,t){return i.openBlock(),i.createElementBlock("svg",qf,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M444 49.9C431.3 38.2 379.9.9 265.3.4c0 0-135.1-8.1-200.9 52.3C27.8 89.3 14.9 143 13.5 209.5s-3.1 191.1 117 224.9h.1l-.1 51.6s-.8 20.9 13 25.1c16.6 5.2 26.4-10.7 42.3-27.8c8.7-9.4 20.7-23.2 29.8-33.7c82.2 6.9 145.3-8.9 152.5-11.2c16.6-5.4 110.5-17.4 125.7-142c15.8-128.6-7.6-209.8-49.8-246.5M457.9 287c-12.9 104-89 110.6-103 115.1c-6 1.9-61.5 15.7-131.2 11.2c0 0-52 62.7-68.2 79c-5.3 5.3-11.1 4.8-11-5.7c0-6.9.4-85.7.4-85.7q-.15 0 0 0C43.1 372.7 49.1 266.6 50.2 211.1s11.6-101 42.6-131.6c55.7-50.5 170.4-43 170.4-43c96.9.4 143.3 29.6 154.1 39.4c35.7 30.6 53.9 103.8 40.6 211.1m-139-80.8c.4 8.6-12.5 9.2-12.9.6c-1.1-22-11.4-32.7-32.6-33.9c-8.6-.5-7.8-13.4.7-12.9c27.9 1.5 43.4 17.5 44.8 46.2m20.3 11.3c1-42.4-25.5-75.6-75.8-79.3c-8.5-.6-7.6-13.5.9-12.9c58 4.2 88.9 44.1 87.8 92.5c-.1 8.6-13.1 8.2-12.9-.3m47 13.4c.1 8.6-12.9 8.7-12.9.1c-.6-81.5-54.9-125.9-120.8-126.4c-8.5-.1-8.5-12.9 0-12.9c73.7.5 133 51.4 133.7 139.2M374.9 329v.2c-10.8 19-31 40-51.8 33.3l-.2-.3c-21.1-5.9-70.8-31.5-102.2-56.5c-16.2-12.8-31-27.9-42.4-42.4c-10.3-12.9-20.7-28.2-30.8-46.6c-21.3-38.5-26-55.7-26-55.7c-6.7-20.8 14.2-41 33.3-51.8h.2c9.2-4.8 18-3.2 23.9 3.9c0 0 12.4 14.8 17.7 22.1c5 6.8 11.7 17.7 15.2 23.8c6.1 10.9 2.3 22-3.7 26.6l-12 9.6c-6.1 4.9-5.3 14-5.3 14s17.8 67.3 84.3 84.3c0 0 9.1.8 14-5.3l9.6-12c4.6-6 15.7-9.8 26.6-3.7c14.7 8.3 33.4 21.2 45.8 32.9c7 5.7 8.6 14.4 3.8 23.6"},null,-1)]))}const xa=i.markRaw({name:"fa6-brands-viber",render:Yf}),Uf={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},Gf=["id"],Kf=["id"],Zf=["fill"],Jf=["fill"];function Qf(e,t){return i.openBlock(),i.createElementBlock("svg",Uf,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:e.idMap.logosWhatsappIcon0,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},t[0]||(t[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#1FAF38"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#60D669"},null,-1)]),8,Gf),i.createElementVNode("linearGradient",{id:e.idMap.logosWhatsappIcon1,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},t[1]||(t[1]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#F9F9F9"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#FFF"},null,-1)]),8,Kf)]),i.createElementVNode("path",{fill:"url(#"+e.idMap.logosWhatsappIcon0+")",d:"M5.463 127.456c-.006 21.677 5.658 42.843 16.428 61.499L4.433 252.697l65.232-17.104a123 123 0 0 0 58.8 14.97h.054c67.815 0 123.018-55.183 123.047-123.01c.013-32.867-12.775-63.773-36.009-87.025c-23.23-23.25-54.125-36.061-87.043-36.076c-67.823 0-123.022 55.18-123.05 123.004"},null,8,Zf),i.createElementVNode("path",{fill:"url(#"+e.idMap.logosWhatsappIcon1+")",d:"M1.07 127.416c-.007 22.457 5.86 44.38 17.014 63.704L0 257.147l67.571-17.717c18.618 10.151 39.58 15.503 60.91 15.511h.055c70.248 0 127.434-57.168 127.464-127.423c.012-34.048-13.236-66.065-37.3-90.15C194.633 13.286 162.633.014 128.536 0C58.276 0 1.099 57.16 1.071 127.416m40.24 60.376l-2.523-4.005c-10.606-16.864-16.204-36.352-16.196-56.363C22.614 69.029 70.138 21.52 128.576 21.52c28.3.012 54.896 11.044 74.9 31.06c20.003 20.018 31.01 46.628 31.003 74.93c-.026 58.395-47.551 105.91-105.943 105.91h-.042c-19.013-.01-37.66-5.116-53.922-14.765l-3.87-2.295l-40.098 10.513z"},null,8,Jf),t[2]||(t[2]=i.createElementVNode("path",{fill:"#FFF",d:"M96.678 74.148c-2.386-5.303-4.897-5.41-7.166-5.503c-1.858-.08-3.982-.074-6.104-.074c-2.124 0-5.575.799-8.492 3.984c-2.92 3.188-11.148 10.892-11.148 26.561s11.413 30.813 13.004 32.94c1.593 2.123 22.033 35.307 54.405 48.073c26.904 10.609 32.379 8.499 38.218 7.967c5.84-.53 18.844-7.702 21.497-15.139c2.655-7.436 2.655-13.81 1.859-15.142c-.796-1.327-2.92-2.124-6.105-3.716s-18.844-9.298-21.763-10.361c-2.92-1.062-5.043-1.592-7.167 1.597c-2.124 3.184-8.223 10.356-10.082 12.48c-1.857 2.129-3.716 2.394-6.9.801c-3.187-1.598-13.444-4.957-25.613-15.806c-9.468-8.442-15.86-18.867-17.718-22.056c-1.858-3.184-.199-4.91 1.398-6.497c1.431-1.427 3.186-3.719 4.78-5.578c1.588-1.86 2.118-3.187 3.18-5.311c1.063-2.126.531-3.986-.264-5.579c-.798-1.593-6.987-17.343-9.819-23.64"},null,-1))])}const Ca=i.markRaw({name:"logos-whatsapp-icon",render:Qf,setup(){const e=()=>Math.random().toString(36).substr(2,10);return{idMap:{logosWhatsappIcon0:"uicons-"+e(),logosWhatsappIcon1:"uicons-"+e()}}}}),ep={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},tp=["id"],np=["fill"];function ip(e,t){return i.openBlock(),i.createElementBlock("svg",ep,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:e.idMap.logosTelegram0,x1:"50%",x2:"50%",y1:"0%",y2:"100%"},t[0]||(t[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#2AABEE"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#229ED9"},null,-1)]),8,tp)]),i.createElementVNode("path",{fill:"url(#"+e.idMap.logosTelegram0+")",d:"M128 0C94.06 0 61.48 13.494 37.5 37.49A128.04 128.04 0 0 0 0 128c0 33.934 13.5 66.514 37.5 90.51C61.48 242.506 94.06 256 128 256s66.52-13.494 90.5-37.49c24-23.996 37.5-56.576 37.5-90.51s-13.5-66.514-37.5-90.51C194.52 13.494 161.94 0 128 0"},null,8,np),t[1]||(t[1]=i.createElementVNode("path",{fill:"#FFF",d:"M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072"},null,-1))])}const Sa=i.markRaw({name:"logos-telegram",render:ip,setup(){return{idMap:{logosTelegram0:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),rp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function sp(e,t){return i.openBlock(),i.createElementBlock("svg",rp,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M391 480c-19.52 0-46.94-7.06-88-30c-49.93-28-88.55-53.85-138.21-103.38C116.91 298.77 93.61 267.79 61 208.45c-36.84-67-30.56-102.12-23.54-117.13C45.82 73.38 58.16 62.65 74.11 52a176.3 176.3 0 0 1 28.64-15.2c1-.43 1.93-.84 2.76-1.21c4.95-2.23 12.45-5.6 21.95-2c6.34 2.38 12 7.25 20.86 16c18.17 17.92 43 57.83 52.16 77.43c6.15 13.21 10.22 21.93 10.23 31.71c0 11.45-5.76 20.28-12.75 29.81c-1.31 1.79-2.61 3.5-3.87 5.16c-7.61 10-9.28 12.89-8.18 18.05c2.23 10.37 18.86 41.24 46.19 68.51s57.31 42.85 67.72 45.07c5.38 1.15 8.33-.59 18.65-8.47c1.48-1.13 3-2.3 4.59-3.47c10.66-7.93 19.08-13.54 30.26-13.54h.06c9.73 0 18.06 4.22 31.86 11.18c18 9.08 59.11 33.59 77.14 51.78c8.77 8.84 13.66 14.48 16.05 20.81c3.6 9.53.21 17-2 22c-.37.83-.78 1.74-1.21 2.75a176.5 176.5 0 0 1-15.29 28.58c-10.63 15.9-21.4 28.21-39.38 36.58A67.4 67.4 0 0 1 391 480"},null,-1)]))}const Ba=i.markRaw({name:"ion-call",render:sp}),op={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ap(e,t){return i.openBlock(),i.createElementBlock("svg",op,t[0]||(t[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l2 5l-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2m10 3a2 2 0 0 1 2 2m-2-6a6 6 0 0 1 6 6"},null,-1)]))}const lp=i.markRaw({name:"tabler-phone-call",render:ap}),cp={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},dp=["href"],hp=["href"],up=["href"],fp=["href"],pp={},gp=i.defineComponent({...pp,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(e){const t=e,n=i.computed(()=>{try{return t.phone?Wi.parsePhoneNumberWithError(t.phone,t.defaultCountry):void 0}catch{}return t.phone}),r=i.computed(()=>{var l;return W.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),s=i.computed(()=>{var l;return W.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var l;return W.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=lp,h=Ba,u=Sa,f=Ca,p=xa;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",{class:i.normalizeClass({"border-xl relative inline-flex items-center rounded px-2":r.value&&a.value,"min-w-10":!0}),onClick:c[0]||(c[0]=g=>a.value=!a.value),onFocusout:c[1]||(c[1]=g=>a.value=!1),onMouseleave:c[2]||(c[2]=g=>a.value=!1)},[i.createElementVNode("div",{class:i.normalizeClass({"flex flex-row items-center gap-1":l.showPhoneIcon})},[l.showPhoneIcon?(i.openBlock(),i.createBlock(d,{key:0})):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(s.value),1)],2),r.value&&a.value?(i.openBlock(),i.createElementBlock("div",cp,[r.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:`tel:${o.value}`,class:"text-blue-600 hover:animate-pulse hover:text-blue-600"},[i.createVNode(h)],8,dp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:1,href:`https://t.me/${o.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(u)],8,hp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${o.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(f)],8,up)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${o.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[i.createVNode(p)],8,fp)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),mp={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function _p(e,t){return i.openBlock(),i.createElementBlock("svg",mp,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"m20 8l-8 5l-8-5V6l8 5l8-5m0-2H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2"},null,-1)]))}const yp=i.markRaw({name:"mdi-envelope",render:_p}),bp={class:"flex flex-col gap-1"},wp={key:0,class:"mb-2 flex flex-col text-base"},vp={key:0,class:"text-sc-dark-grey text-sm"},kp={key:1,class:"whitespace-nowrap text-sm"},xp={key:2,class:"whitespace-nowrap text-sm"},Cp={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},Sp=["href"],Bp=["href"],Tp=["href"],Ep=["href"],$p=["href"],Np={key:0,class:"flex flex-col text-base"},Pp={key:0,class:"text-sc-dark-grey text-sm"},Rp={key:1,class:"mt-2 text-sm"},Fp={key:0,class:"-mt-1"},Mp={},Ap=i.defineComponent({...Mp,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(e){const t=e,n=i.computed(()=>{try{return t.contact.phone?Wi.parsePhoneNumberWithError(t.contact.phone,t.defaultCountry):void 0}catch{}return t.contact.phone}),r=i.computed(()=>{var c;return W.isString(n.value)?!1:((c=n.value)==null?void 0:c.isValid())??!1}),s=i.computed(()=>{var c;return W.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var c;return W.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("E.164"))??""}),a=i.computed(()=>r.value||t.contact.email),l=i.ref(!1);return(c,d)=>{var _,y;const h=Ba,u=Sa,f=Ca,p=xa,g=yp,m=V.NPopover;return i.openBlock(),i.createElementBlock("div",bp,[i.createVNode(m,{disabled:c.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var b,S,x,C;return[i.createElementVNode("div",{class:i.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(b=c.contact)!=null&&b.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${c.classes}`),style:i.normalizeStyle(c.styles),onMouseenter:d[0]||(d[0]=B=>l.value=!0),onFocusin:d[1]||(d[1]=B=>l.value=!0),onMouseleave:d[2]||(d[2]=B=>l.value=!1),onFocusout:d[3]||(d[3]=B=>l.value=!1)},[i.createElementVNode("div",null,[c.fullView&&(c.contact.name||(S=c.contact)!=null&&S.position)?(i.openBlock(),i.createElementBlock("div",wp,[i.createTextVNode(i.toDisplayString(c.contact.name)+" ",1),(x=c.contact)!=null&&x.position?(i.openBlock(),i.createElementBlock("span",vp,i.toDisplayString((C=c.contact)==null?void 0:C.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),c.contact.phone?(i.openBlock(),i.createElementBlock("div",kp,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),c.contact.email?(i.openBlock(),i.createElementBlock("div",xp,i.toDisplayString(c.contact.email),1)):i.createCommentVNode("",!0),a.value&&l.value?(i.openBlock(),i.createElementBlock("div",Cp,[r.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:`tel:${o.value}`,class:"text-blue-600 hover:text-3xl hover:text-blue-600"},[i.createVNode(h)],8,Sp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:1,href:`https://t.me/${o.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(u)],8,Bp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${o.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(f)],8,Tp)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${o.value}`,class:"text-purple-600 hover:text-3xl hover:text-purple-600"},[i.createVNode(p)],8,Ep)):i.createCommentVNode("",!0),c.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${c.contact.email}`,class:"hover:text-3xl"},[i.createVNode(g)],8,$p)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var b,S,x,C;return[c.contact.name?(i.openBlock(),i.createElementBlock("div",Np,[i.createTextVNode(i.toDisplayString(c.contact.name)+" ",1),(b=c.contact)!=null&&b.position?(i.openBlock(),i.createElementBlock("span",Pp,i.toDisplayString((S=c.contact)==null?void 0:S.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),(x=c.contact)!=null&&x.comment?(i.openBlock(),i.createElementBlock("div",Rp,[d[4]||(d[4]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((C=c.contact)==null?void 0:C.comment),1)])):i.createCommentVNode("",!0)]}),_:1},8,["disabled"]),c.fullView&&((_=c.contact)!=null&&_.comment)?(i.openBlock(),i.createElementBlock("div",Fp,[d[5]||(d[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((y=c.contact)==null?void 0:y.comment),1)])):i.createCommentVNode("",!0)])}}}),Op={key:0,class:"flex w-fit items-center gap-2"},Vp={key:1,class:"flex flex-wrap gap-1"},zp={key:0},Ip={},qi=i.defineComponent({...Ip,__name:"configurators-product-info",props:{isProductSearching:{type:Boolean,default:!1},product:{default:void 0}},setup(e){const t=e,n=i.computed(()=>{var r,s;return(s=(r=t.product)==null?void 0:r.properties)==null?void 0:s.planingProductionDate});return(r,s)=>{const o=V.NSpin;return r.isProductSearching?(i.openBlock(),i.createElementBlock("div",Op,[i.createVNode(o,{size:17,class:"w-fit"}),s[0]||(s[0]=i.createElementVNode("div",null,"Выполняется поиск товара ...",-1))])):r.product.isNewRec()?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Vp,[i.createElementVNode("div",null,i.toDisplayString(r.product.code)+" - "+i.toDisplayString(r.product.name)+" - "+i.toDisplayString(r.product.costRub.toLocaleString())+" ₽ / "+i.toDisplayString(r.product.unit),1),n.value?(i.openBlock(),i.createElementBlock("div",zp,"(Планируемая дата производства: "+i.toDisplayString(n.value)+")",1)):i.createCommentVNode("",!0)]))}}}),Lp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Dp(e,t){return i.openBlock(),i.createElementBlock("svg",Lp,t[0]||(t[0]=[i.createElementVNode("path",{fill:"currentColor",d:"m289.94 256l95-95A24 24 0 0 0 351 127l-95 95l-95-95a24 24 0 0 0-34 34l95 95l-95 95a24 24 0 1 0 34 34l95-95l95 95a24 24 0 0 0 34-34Z"},null,-1)]))}const Br=i.markRaw({name:"ion-close",render:Dp}),Hp={class:"mr-3 flex flex-col gap-2"},Wp=["onClick"],jp={class:"h-full p-2"},Xp={},qp=i.defineComponent({...Xp,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(e,{emit:t}){const n=e,r=i.useTemplateRef("drawing-template-containers"),s=t;return i.onMounted(()=>{n.settings.allTemplates.forEach((o,a)=>{var c;const l=(c=r.value)==null?void 0:c.at(a);l&&s("init-draw-template",l,o)})}),i.watch(()=>n.settings.allTemplates,(o,a)=>{i.nextTick(()=>{o.forEach((l,c)=>{var d;if(!a.includes(l)){const h=(d=r.value)==null?void 0:d.at(c);h&&s("init-draw-template",h,l)}})})},{deep:!0}),(o,a)=>{const l=Br;return i.openBlock(),i.createBlock(i.unref(V.NScrollbar),{style:{"max-height":"12.5rem",width:"auto"},trigger:"none"},{default:i.withCtx(()=>[i.createElementVNode("div",Hp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.settings.allTemplates,(c,d)=>(i.openBlock(),i.createElementBlock("div",{key:d,class:"group relative"},[i.createVNode(i.unref(V.NPopover),{trigger:"hover",placement:"right"},{trigger:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["relative h-10 w-24 shrink-0 rounded-md border-2 border-solid border-slate-200",{"!border-green-700":d===o.selectTemplateIndex}]),onClick:h=>s("template:select",d)},[i.createElementVNode("div",jp,[i.createElementVNode("div",{ref_for:!0,ref:"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,Wp)]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(c.label),1)]),_:2},1024),c.isCustom&&!c.isNewRec()?(i.openBlock(),i.createBlock(i.unref(V.NButton),{key:0,size:"tiny",quaternary:"",circle:"",class:"!absolute right-0.5 top-0.5 !hidden group-hover:!flex",onClick:h=>s("remove-custom-template",d)},{default:i.withCtx(()=>[i.createVNode(l)]),_:2},1032,["onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),Ta=Ln(qp,[["__scopeId","data-v-828c3059"]]),Yp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Up(e,t){return i.openBlock(),i.createElementBlock("svg",Yp,t[0]||(t[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 Ea=i.markRaw({name:"ion-trash",render:Up}),Gp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Kp(e,t){return i.openBlock(),i.createElementBlock("svg",Gp,t[0]||(t[0]=[i.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)]))}const $a=i.markRaw({name:"ion-plus",render:Kp}),Zp={class:"flex flex-col gap-4"},Jp={class:"flex flex-col gap-2"},Qp={class:"mt-8 font-bold"},eg={class:"grid grow grid-cols-2 items-start gap-2"},tg={class:"flex flex-col gap-4"},ng={class:"flex gap-3"},ig={},Na=i.defineComponent({...ig,__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","click:view-switch","submit","click:add-line","click:remove-line","click:save-template"],setup(e,{emit:t}){const n=e,r=t,s=i.ref(structuredClone(i.toRaw(n.value.configuratorParams))),o=i.ref(!1),a=()=>{s.value.length>0&&(r("update:params",s.value),l("configuratorParams",s.value))},l=(c,d)=>{const h=new G.CartItemBase(n.value);h[c]=d,r("update:value",h)};return i.watch(()=>n.value.configuratorParams,c=>{s.value=W.cloneDeep(i.toRaw(c))},{deep:!0}),i.watch(()=>n.previewParams,c=>{s.value.linesWidths=c.linesWidths,s.value.linesAngles=c.linesAngles},{deep:!0}),(c,d)=>{const h=$a,u=Ea,f=V.NInput;return i.openBlock(),i.createBlock(i.unref(V.NForm),{class:"grid gap-2 md:grid-cols-2 md:gap-6"},{default:i.withCtx(()=>{var p,g,m,_,y,b,S,x,C;return[i.createElementVNode("div",Zp,[d[10]||(d[10]=i.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),c.settings.startTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(V.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NSelect),{value:s.value.startTailType,"onUpdate:value":[d[0]||(d[0]=B=>s.value.startTailType=B),a],options:c.settings.startTailConfigs.map(({label:B},v)=>({label:B,value:v})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",Jp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value.linesAngles,(B,v)=>{var $,F,R,X,M,N;return i.openBlock(),i.createElementBlock("div",{key:v,class:"flex items-start gap-2"},[i.createElementVNode("div",Qp,i.toDisplayString(v+1),1),i.createElementVNode("div",eg,[i.createVNode(i.unref(V.NFormItem),{label:"Ширина, мм",required:!0,feedback:(($=c.validation[`lines_widths[${v+1}]`])==null?void 0:$.feedback)||"","show-feedback":((F=c.validation[`lines_widths[${v+1}]`])==null?void 0:F.showFeedback)||!1,"validation-status":(R=c.validation[`lines_widths[${v+1}]`])==null?void 0:R.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NInputNumber),{value:s.value.linesWidths[v],"onUpdate:value":[A=>s.value.linesWidths[v]=A,a],min:s.value.linesWidths.length>1?c.settings.minLineWidth:c.settings.stripMinWidth,max:c.settings.maxLineWidth,step:c.settings.lineWidthStep,validator:A=>A%c.settings.lineWidthStep===0,class:"w-full"},null,8,["value","onUpdate:value","min","max","step","validator"])]),_:2},1032,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(V.NFormItem),{label:"Угол сгиба, °",required:!0,feedback:((X=c.validation[`lines_angles[${v+1}]`])==null?void 0:X.feedback)||"","show-feedback":((M=c.validation[`lines_angles[${v+1}]`])==null?void 0:M.showFeedback)||!1,"validation-status":(N=c.validation[`lines_angles[${v+1}]`])==null?void 0:N.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NInputNumber),{value:s.value.linesAngles[v],"onUpdate:value":[A=>s.value.linesAngles[v]=A,a],min:c.settings.minLineAngle,max:c.settings.maxLineAngle,step:c.settings.lineAngleStep,validator:A=>A%c.settings.lineAngleStep===0,class:"w-full"},null,8,["value","onUpdate:value","min","max","step","validator"])]),_:2},1032,["feedback","show-feedback","validation-status"])]),i.createVNode(i.unref(V.NFormItem),{label:void 0,"show-feedback":!1,required:!0,class:"shrink-0"},{default:i.withCtx(()=>[c.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(V.NButton),{key:0,size:"medium",onClick:A=>r("click:add-line",v)},{default:i.withCtx(()=>[i.createVNode(h)]),_:2},1032,["onClick"])),c.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(V.NButton),{key:1,disabled:s.value.linesWidths.length===1,size:"medium",class:"ml-2",onClick:A=>r("click:remove-line",v)},{default:i.withCtx(()=>[i.createVNode(u)]),_:2},1032,["disabled","onClick"]))]),_:2},1024)])}),128))]),c.settings.endTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(V.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NSelect),{value:s.value.endTailType,"onUpdate:value":[d[1]||(d[1]=B=>s.value.endTailType=B),a],options:c.settings.endTailConfigs.map(({label:B},v)=>({label:B,value:v})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(qi,{"is-product-searching":c.isProductSearching,product:c.value.product},null,8,["is-product-searching","product"]),c.settings.allowSaveTemplates&&c.selectTemplateIndex===c.settings.allTemplates.length-1?(i.openBlock(),i.createBlock(i.unref(V.NButton),{key:2,type:"tertiary",class:"self-start",loading:o.value,onClick:d[2]||(d[2]=B=>r("click:save-template"))},{default:i.withCtx(()=>d[9]||(d[9]=[i.createTextVNode(" Сохранить шаблон ")])),_:1,__:[9]},8,["loading"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",tg,[i.createVNode(i.unref(V.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NSelect),{value:s.value.colorSide,"onUpdate:value":[d[3]||(d[3]=B=>s.value.colorSide=B),a],options:[{label:"Цвет сверху",value:"top"},{label:" Цвет снизу",value:"bottom"}],placeholder:"С какой стороны изделие будет иметь цвет"},null,8,["value"])]),_:1}),i.createVNode(i.unref(V.NFormItem),{required:!0,"show-feedback":((p=c.validation.length)==null?void 0:p.showFeedback)||!1,feedback:((g=c.validation.length)==null?void 0:g.feedback)||"","validation-status":(m=c.validation.length)==null?void 0:m.validationStatus,label:`Метраж${c.settings.stripMinLength?" от "+c.settings.stripMinLength:""}${c.settings.stripMaxLength?" до "+c.settings.stripMaxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NInputNumber),{value:s.value.length,"onUpdate:value":[d[4]||(d[4]=B=>s.value.length=B),a],required:!0,max:c.settings.stripMaxLength||void 0,min:c.settings.stripMinLength,step:c.settings.lengthStep,validator:B=>B%c.settings.lengthStep===0,placeholder:"Введите метраж",class:"w-full"},null,8,["value","max","min","step","validator"])]),_:1},8,["show-feedback","feedback","validation-status","label"]),i.createVNode(i.unref(V.NFormItem),{required:!0,"show-feedback":((_=c.validation.quantity)==null?void 0:_.showFeedback)||!1,feedback:((y=c.validation.quantity)==null?void 0:y.feedback)||"","validation-status":(b=c.validation.quantity)==null?void 0:b.validationStatus,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(V.NInputNumber),{value:c.value.quantity,"onUpdate:value":d[5]||(d[5]=B=>c.value.quantity=B),min:1,validator:B=>Number.isInteger(B),placeholder:"Введите количество",class:"w-full"},null,8,["value","validator"])]),_:1},8,["show-feedback","feedback","validation-status"]),i.createVNode(i.unref(V.NFormItem),{required:!0,"show-feedback":((S=c.validation.marker)==null?void 0:S.showFeedback)||!1,feedback:((x=c.validation.marker)==null?void 0:x.feedback)||"","validation-status":(C=c.validation.marker)==null?void 0:C.validationStatus,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(f,{value:c.value.marker,"onUpdate:value":d[6]||(d[6]=B=>c.value.marker=B),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["show-feedback","feedback","validation-status"]),i.createElementVNode("div",ng,[i.createVNode(i.unref(V.NButton),{loading:c.isSubmitProcessing,type:"primary",class:"self-start",onClick:d[7]||(d[7]=B=>r("submit",c.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(c.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading"]),c.settings.allowShowTable?(i.openBlock(),i.createBlock(i.unref(V.NButton),{key:0,type:"tertiary",class:"self-start",onClick:d[8]||(d[8]=B=>r("click:view-switch"))},{default:i.withCtx(()=>d[11]||(d[11]=[i.createTextVNode(" Показать в виде списка ")])),_:1,__:[11]})):i.createCommentVNode("",!0)])])]}),_:1})}}});var Pa=Object.defineProperty,rg=Object.defineProperties,sg=Object.getOwnPropertyDescriptors,Ra=Object.getOwnPropertySymbols,og=Object.prototype.hasOwnProperty,ag=Object.prototype.propertyIsEnumerable,Bs=(e,t,n)=>t in e?Pa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ts=(e,t)=>{for(var n in t||(t={}))og.call(t,n)&&Bs(e,n,t[n]);if(Ra)for(var n of Ra(t))ag.call(t,n)&&Bs(e,n,t[n]);return e},Es=(e,t)=>rg(e,sg(t)),Fa=(e,t)=>{for(var n in t)Pa(e,n,{get:t[n],enumerable:!0})},w=(e,t,n)=>(Bs(e,typeof t!="symbol"?t+"":t,n),n),Ma=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},xt=(e,t,n)=>(Ma(e,t,"read from private field"),n?n.call(e):t.get(e)),Aa=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},lg=(e,t,n,r)=>(Ma(e,t,"write to private field"),t.set(e,n),n),gt={Image:null,isHeadless:!1,shim:function(e,t){return e.tagName=e.nodeName=t||"canvas",e.nodeType=1,e.getAttribute=function(n){return this[n]},e.setAttribute=function(n,r){return this[n]=r,this},e},polyfill:function(e,t){return gt.shim(e),typeof t<"u"&&(gt.Image=t),gt.isHeadless=!0,e}},Oa={};Fa(Oa,{Curve:()=>vi,getAnchorsFromArcData:()=>hg,getComponentOnCubicBezier:()=>Yi,getControlPoints:()=>Ua,getCurveBoundingBox:()=>Xa,getCurveFromPoints:()=>Ya,getCurveLength:()=>ja,getReflection:()=>Ps,integrate:()=>qa,subdivide:()=>Ns});var Va={};Fa(Va,{HALF_PI:()=>Ke,NumArray:()=>Yt,TWO_PI:()=>ot,decomposeMatrix:()=>wi,getComputedMatrix:()=>La,getPoT:()=>Da,lerp:()=>Et,mod:()=>$t,setMatrix:()=>Ia,toFixed:()=>Pe});var He;typeof window<"u"?He=window:typeof global<"u"?He=global:typeof self<"u"&&(He=self);var za,ot=Math.PI*2,Ke=Math.PI*.5;function wi(e,t,n,r,s,o){let a;return arguments.length<=1?(a=e.a,t=e.b,n=e.c,r=e.d,s=e.e,o=e.f):a=e,{translateX:s,translateY:o,scaleX:Math.sqrt(a*a+t*t),scaleY:Math.sqrt(n*n+r*r),rotation:180*Math.atan2(t,a)/Math.PI}}function Ia(e){za=e}function La(e,t){t=t&&t.identity()||new za;let n=e;const r=[];for(;n&&n._matrix;)r.push(n._matrix),n=n.parent;r.reverse();for(let s=0;s<r.length;s++){const a=r[s].elements;t.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9])}return t}function Et(e,t,n){return n*(t-e)+e}var $s=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function Da(e){let t=0;for(;$s[t]&&$s[t]<e;)t++;return $s[t]}function $t(e,t){for(;e<0;)e+=t;return e%t}var Yt=He.Float32Array||Array,cg=Math.floor;function Pe(e){return cg(e*1e6)/1e6}var ee={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},j=class{constructor(){w(this,"_events",{}),w(this,"_bound",!1)}addEventListener(t,n){return(this._events[t]||(this._events[t]=[])).push(n),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(t,n){if(!this._events)return this;if(!t&&!n)return this._events={},this._bound=!1,this;const r=t?[t]:Object.keys(this._events);for(let s=0,o=r.length;s<o;s++){t=r[s];let a=this._events[t];if(a){let l=[];if(n)for(let c=0,d=a.length;c<d;c++){let h=a[c];h=h.handler?h.handler:h,n!==h&&l.push(h)}this._events[t]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(t){if(!this._events)return this;const n=Array.prototype.slice.call(arguments,1),r=this._events[t];if(r)for(let s=0;s<r.length;s++)r[s].call(this,...n);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(t,n,r){const s=this;t&&(o.obj=t,o.name=n,o.handler=r,t.on(n,o));function o(){r.apply(s,arguments)}return s}ignore(t,n,r){return t.off(n,r),this}};w(j,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),w(j,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);var Ha={x:{enumerable:!0,get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this._bound&&this.dispatchEvent(j.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this._bound&&this.dispatchEvent(j.Types.change))}}},Lt=class extends j{constructor(e=0,t=0){super(),w(this,"_x",0),w(this,"_y",0);for(let n in Ha)Object.defineProperty(this,n,Ha[n]);this.x=e,this.y=t}static add(e,t){return new Lt(e.x+t.x,e.y+t.y)}static sub(e,t){return new Lt(e.x-t.x,e.y-t.y)}static subtract(e,t){return Lt.sub(e,t)}static ratioBetween(e,t){return(e.x*t.x+e.y*t.y)/(e.length()*t.length())}static angleBetween(e,t){if(arguments.length>=4){const s=arguments[0]-arguments[2],o=arguments[1]-arguments[3];return Math.atan2(o,s)}const n=e.x-t.x,r=e.y-t.y;return Math.atan2(r,n)}static distanceBetween(e,t){return Math.sqrt(Lt.distanceBetweenSquared(e,t))}static distanceBetweenSquared(e,t){const n=e.x-t.x,r=e.y-t.y;return n*n+r*r}set(e,t){return this.x=e,this.y=t,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 Lt(this.x,this.y)}add(e,t){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+=t),this)}addSelf(e){return this.add.apply(this,arguments)}sub(e,t){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-=t),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,t){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*=t),this)}multiplySelf(e){return this.multiply.apply(this,arguments)}multiplyScalar(e){return this.multiply(e)}divide(e,t){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/=t),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 t=this.x-e.x,n=this.y-e.y;return t*t+n*n}setLength(e){return this.normalize().multiplyScalar(e)}equals(e,t){return t=typeof t>"u"?1e-4:t,this.distanceTo(e)<t}lerp(e,t){const n=(e.x-this.x)*t+this.x,r=(e.y-this.y)*t+this.y;return this.set(n,r)}isZero(e){return e=typeof e>"u"?1e-4:e,this.length()<e}toString(){return this.x+", "+this.y}toObject(){return{x:Pe(this.x),y:Pe(this.y)}}rotate(e){const t=this.x,n=this.y,r=Math.cos(e),s=Math.sin(e);return this.x=t*r-n*s,this.y=t*s+n*r,this}},Z=Lt;w(Z,"zero",new Lt),w(Z,"left",new Lt(-1,0)),w(Z,"right",new Lt(1,0)),w(Z,"up",new Lt(0,-1)),w(Z,"down",new Lt(0,1));var ve=class extends Z{constructor(t=0,n=0,r=0,s=0,o=0,a=0,l=ee.move){super(t,n),w(this,"controls",{left:new Z,right:new Z}),w(this,"_command",ee.move),w(this,"_relative",!0),w(this,"_rx",0),w(this,"_ry",0),w(this,"_xAxisRotation",0),w(this,"_largeArcFlag",0),w(this,"_sweepFlag",1);for(let d in Wa)Object.defineProperty(this,d,Wa[d]);this.command=l,this.relative=!0;const c=ve.makeBroadcast(this);this.controls.left.set(r,s).addEventListener(j.Types.change,c),this.controls.right.set(o,a).addEventListener(j.Types.change,c)}static makeBroadcast(t){return n;function n(){t._bound&&t.dispatchEvent(j.Types.change)}}static fromObject(t){return new ve().copy(t)}copy(t){return this.x=t.x,this.y=t.y,typeof t.command=="string"&&(this.command=t.command),t.controls&&(t.controls.left&&this.controls.left.copy(t.controls.left),t.controls.right&&this.controls.right.copy(t.controls.right)),typeof t.relative=="boolean"&&(this.relative=t.relative),typeof t.rx=="number"&&(this.rx=t.rx),typeof t.ry=="number"&&(this.ry=t.ry),typeof t.xAxisRotation=="number"&&(this.xAxisRotation=t.xAxisRotation),typeof t.largeArcFlag=="number"&&(this.largeArcFlag=t.largeArcFlag),typeof t.sweepFlag=="number"&&(this.sweepFlag=t.sweepFlag),this}clone(){return new ve().copy(this)}toObject(){return{x:Pe(this.x),y:Pe(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Pe(this.rx),ry:Pe(this.ry),xAxisRotation:Pe(this.xAxisRotation),largeArcFlag:Pe(this.largeArcFlag),sweepFlag:Pe(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},Wa={command:{enumerable:!0,get:function(){return this._command},set:function(e){this._command!==e&&(this._command=e,this._bound&&this.dispatchEvent(j.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(e){this._relative!==!!e&&(this._relative=!!e,this._bound&&this.dispatchEvent(j.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(e){this._rx!==e&&(this._rx=e,this._bound&&this.dispatchEvent(j.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(e){this._ry!==e&&(this._ry=e,this._bound&&this.dispatchEvent(j.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(e){this._xAxisRotation!==e&&(this._xAxisRotation=e,this._bound&&this.dispatchEvent(j.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag!==e&&(this._largeArcFlag=e,this._bound&&this.dispatchEvent(j.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag!==e&&(this._sweepFlag=e,this._bound&&this.dispatchEvent(j.Types.change))}}},dg=0,mt={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.18",PublishDate:"2025-04-07T22:33:48.746Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return dg++}},vi={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896257],[0,.7745966692414834],[.33998104358485626,.8611363115940526],[0,.5384693101056831,.906179845938664],[.2386191860831969,.6612093864662645,.932469514203152],[0,.4058451513773972,.7415311855993945,.9491079123427585],[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]],weights:[[1],[.8888888888888888,.5555555555555556],[.6521451548625461,.34785484513745385],[.5688888888888889,.47862867049936647,.23692688505618908],[.46791393457269104,.3607615730481386,.17132449237917036],[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096]]};function Yi(e,t,n,r,s){const o=1-e;return o*o*o*t+3*o*o*e*n+3*o*e*e*r+e*e*e*s}function Ns(e,t,n,r,s,o,a,l,c){c=c||vi.RecursionLimit;const d=c+1;if(Math.abs(e-a)<.001&&Math.abs(t-l)<.001)return[new ve(a,l)];const h=[];for(let u=0;u<d;u++){const f=u/d,p=Yi(f,e,n,s,a),g=Yi(f,t,r,o,l);h.push(new ve(p,g))}return h}function ja(e,t,n,r,s,o,a,l,c){if(e===n&&t===r&&s===a&&o===l){const _=a-e,y=l-t;return Math.sqrt(_*_+y*y)}const d=9*(n-s)+3*(a-e),h=6*(e+s)-12*n,u=3*(n-e),f=9*(r-o)+3*(l-t),p=6*(t+o)-12*r,g=3*(r-t);function m(_){const y=(d*_+h)*_+u,b=(f*_+p)*_+g;return Math.sqrt(y*y+b*b)}return qa(m,0,1,c||vi.RecursionLimit)}function Xa(e,t,n,r,s,o,a,l){const c=[],d=[[],[]];let h,u,f,p,g,m,_,y;for(let C=0;C<2;++C){if(C==0?(u=6*e-12*n+6*s,h=-3*e+9*n-9*s+3*a,f=3*n-3*e):(u=6*t-12*r+6*o,h=-3*t+9*r-9*o+3*l,f=3*r-3*t),Math.abs(h)<1e-12){if(Math.abs(u)<1e-12)continue;p=-f/u,0<p&&p<1&&c.push(p);continue}_=u*u-4*f*h,y=Math.sqrt(_),!(_<0)&&(g=(-u+y)/(2*h),0<g&&g<1&&c.push(g),m=(-u-y)/(2*h),0<m&&m<1&&c.push(m))}let b=c.length,S=b,x;for(;b--;)p=c[b],x=1-p,d[0][b]=x*x*x*e+3*x*x*p*n+3*x*p*p*s+p*p*p*a,d[1][b]=x*x*x*t+3*x*x*p*r+3*x*p*p*o+p*p*p*l;return d[0][S]=e,d[1][S]=t,d[0][S+1]=a,d[1][S+1]=l,d[0].length=d[1].length=S+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 qa(e,t,n,r){let s=vi.abscissas[r-2],o=vi.weights[r-2],a=.5*(n-t),l=a+t,c=0,d=r+1>>1,h=r&1?o[c++]*e(l):0;for(;c<d;){const u=a*s[c];h+=o[c++]*(e(l+u)+e(l-u))}return a*h}function Ya(e,t){const n=e.length,r=n-1;for(let s=0;s<n;s++){const o=e[s],a=t?$t(s-1,n):Math.max(s-1,0),l=t?$t(s+1,n):Math.min(s+1,r),c=e[a],d=o,h=e[l];Ua(c,d,h),d.command=s===0?ee.move:ee.curve}}function Ua(e,t,n){const r=Z.angleBetween(e,t),s=Z.angleBetween(n,t);let o=Z.distanceBetween(e,t),a=Z.distanceBetween(n,t),l=(r+s)/2;return o<1e-4||a<1e-4?(typeof t.relative=="boolean"&&!t.relative&&(t.controls.left.copy(t),t.controls.right.copy(t)),t):(o*=.33,a*=.33,s<r?l+=Ke:l-=Ke,t.controls.left.x=Math.cos(l)*o,t.controls.left.y=Math.sin(l)*o,l-=Math.PI,t.controls.right.x=Math.cos(l)*a,t.controls.right.y=Math.sin(l)*a,typeof t.relative=="boolean"&&!t.relative&&(t.controls.left.x+=t.x,t.controls.left.y+=t.y,t.controls.right.x+=t.x,t.controls.right.y+=t.y),t)}function Ps(e,t,n){return new Z(2*e.x-(t.x+e.x)-(n?e.x:0),2*e.y-(t.y+e.y)-(n?e.y:0))}function hg(e,t,n,r,s,o,a){const l=mt.Resolution;for(let c=0;c<l;c++){let d=(c+1)/l;a&&(d=1-d);const h=d*o+s,u=n*Math.cos(h),f=r*Math.sin(h),p=new ve(u,f);p.command=ee.line}}var Ga=Array.prototype.slice;function ug(e){if(e==null)return!1;const t=e.length;return typeof t=="number"&&t>=0&&t<4294967296}var ae={isNaN:function(e){return typeof e=="number"&&e!==+e},isElement:function(e){return!!(e&&e.nodeType===1)},isObject:function(e){const t=typeof e;return t==="function"||t==="object"&&!!e},extend:function(e){const t=Ga.call(arguments,1);for(let n=0;n<t.length;n++){const r=t[n];for(let s in r)e[s]=r[s]}return e},defaults:function(e){const t=Ga.call(arguments,1);for(let n=0;n<t.length;n++){const r=t[n];for(let s in r)e[s]===void 0&&(e[s]=r[s])}return e},each:function(e,t,n){const r=n||this,s=!ug(e)&&Object.keys(e),o=(s||e).length;for(let a=0;a<o;a++){const l=s?s[a]:a;t.call(r,e[l],l,e)}return e},performance:He.performance&&He.performance.now?He.performance:Date},Nt={hasEventListeners:typeof He.addEventListener=="function",bind:function(e,t,n,r){return this.hasEventListeners?e.addEventListener(t,n,!!r):e.attachEvent("on"+t,n),Nt},unbind:function(e,t,n,r){return Nt.hasEventListeners?e.removeEventListeners(t,n,!!r):e.detachEvent("on"+t,n),Nt},getRequestAnimationFrame:function(){const e=["ms","moz","webkit","o"];let t=0,n=He.requestAnimationFrame;if(!n){for(let s=0;s<e.length;s++)n=He[e[s]+"RequestAnimationFrame"]||n;n=n||r}function r(s,o){const a=new Date().getTime(),l=Math.max(0,16-(a-t)),c=He.setTimeout(d,l);t=a+l;function d(){s(a+l)}return c}return n}},ki=He.document?He.document.createElement("div"):{};ki.id="help-two-load",Object.defineProperty(Nt,"temp",{enumerable:!0,get:function(){return ae.isElement(ki)&&!He.document.head.contains(ki)&&(ki.style.display="none",He.document.head.appendChild(ki)),ki}});var Ct=class extends Error{constructor(t){super(),w(this,"name","Two.js"),w(this,"message"),this.message=t}},fg=He.devicePixelRatio||1;function pg(e){return e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1}function Rs(e){return fg/pg(e)}var Tr=class{constructor(){w(this,"map",{})}add(t,n){return this.map[t]=n,this}remove(t){return delete this.map[t],this}get(t){return this.map[t]}contains(t){return t in this.map}},at,Bn=class extends Array{constructor(){super(),Aa(this,at,new j),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 xt(this,at)}set _events(t){lg(this,at,t)}get _bound(){return xt(this,at)._bound}set _bound(t){xt(this,at)._bound=t}addEventListener(){return xt(this,at).addEventListener.apply(this,arguments)}on(){return xt(this,at).on.apply(this,arguments)}bind(){return xt(this,at).bind.apply(this,arguments)}removeEventListener(){return xt(this,at).removeEventListener.apply(this,arguments)}off(){return xt(this,at).off.apply(this,arguments)}unbind(){return xt(this,at).unbind.apply(this,arguments)}dispatchEvent(){return xt(this,at).dispatchEvent.apply(this,arguments)}trigger(){return xt(this,at).trigger.apply(this,arguments)}listen(){return xt(this,at).listen.apply(this,arguments)}ignore(){return xt(this,at).ignore.apply(this,arguments)}pop(){const t=super.pop.apply(this,arguments);return this.trigger(j.Types.remove,[t]),t}shift(){const t=super.shift.apply(this,arguments);return this.trigger(j.Types.remove,[t]),t}push(){const t=super.push.apply(this,arguments);return this.trigger(j.Types.insert,arguments),t}unshift(){const t=super.unshift.apply(this,arguments);return this.trigger(j.Types.insert,arguments),t}splice(){const t=super.splice.apply(this,arguments);if(this.trigger(j.Types.remove,t),arguments.length>2){const n=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(j.Types.insert,n),this.trigger(j.Types.order)}return t}sort(){return super.sort.apply(this,arguments),this.trigger(j.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(j.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(t,n){const r=[];for(let s=0;s<this.length;s++){const o=this[s];let a;n?a=t.call(n,o,s):a=t(o,s),r.push(a)}return r}};at=new WeakMap;var Ka=class extends j{constructor(){super(),w(this,"_flagId",!1),w(this,"_flagClassName",!1),w(this,"_renderer",{}),w(this,"_id",mt.Identifier+mt.uniqueId()),w(this,"_className",""),w(this,"classList",[]);for(let e in Za)Object.defineProperty(this,e,Za[e])}static fromObject(e){const t=new Ka().copy(e);return"id"in e&&(t.id=e.id),t}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(e){return this.renderer.type=e.renderer.type,this.className=e.className,this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}},Dn=Ka;w(Dn,"Properties",["renderer","id","className"]);var Za={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(e){const t=this._id;e!==this._id&&(this._id=e,this._flagId=!0,this.parent&&(delete this.parent.children.ids[t],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(e){this._className!==e&&(this._flagClassName=!0,this.classList=e.split(/\s+?/),this._className=e)}}},Er,Ja={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};He.document&&(Er=document.createElement("a"));var Ze=class extends Dn{constructor(e,t){super(),w(this,"_flagSrc",!1),w(this,"_flagImage",!1),w(this,"_flagVideo",!1),w(this,"_flagLoaded",!1),w(this,"_flagRepeat",!1),w(this,"_flagOffset",!1),w(this,"_flagScale",!1),w(this,"_src",""),w(this,"_image",null),w(this,"_loaded",!1),w(this,"_repeat","no-repeat"),w(this,"_scale",1),w(this,"_offset",null);for(let n in Qa)Object.defineProperty(this,n,Qa[n]);if(this._renderer.type="texture",this._renderer.flagOffset=gg.bind(this),this._renderer.flagScale=mg.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new Z,typeof t=="function"){const n=(function(){this.unbind(j.Types.load,n),typeof t=="function"&&t()}).bind(this);this.bind(j.Types.load,n)}if(typeof e=="string")this.src=e;else if(typeof e=="object"){const n=Object.prototype.toString.call(e);(n==="[object HTMLImageElement]"||n==="[object HTMLCanvasElement]"||n==="[object HTMLVideoElement]"||n==="[object Image]")&&(this.image=e)}this._update()}fromObject(e){const t=new Ze().copy(e);return"id"in e&&(t.id=e.id),t}static getAbsoluteURL(e){return Er?(Er.href=e,Er.href):e}static loadHeadlessBuffer(e,t){e.image.onload=t,e.image.src=e.src}static getTag(e){return e&&e.nodeName&&e.nodeName.toLowerCase()||"img"}static getImage(e){const t=Ze.getAbsoluteURL(e);if(Ze.ImageRegistry.contains(t))return Ze.ImageRegistry.get(t);let n;return gt.Image?(n=new gt.Image,gt.shim(n,"img")):He.document?Ja.video.test(t)?n=document.createElement("video"):n=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),n.crossOrigin="anonymous",n.referrerPolicy="no-referrer",n}static load(e,t){let n=e.image,r=Ze.getTag(n);e._flagImage&&(/canvas/i.test(r)?Ze.Register.canvas(e,t):(e._src=!gt.isHeadless&&n.getAttribute("two-src")||n.src,Ze.Register[r](e,t))),e._flagSrc&&(n||(n=Ze.getImage(e.src),e.image=n),r=Ze.getTag(n),Ze.Register[r](e,t))}clone(){const e=new Ze(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 Z?e.offset:new Z().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof Z?e.scale:new Z().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(j.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Ze.load(this,(function(){this.loaded=!0,this.trigger(j.Types.change).trigger(j.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("elem"in this._renderer){const e=this._renderer.elem;e.parentNode.removeChild(e)}return"effect"in this._renderer&&(this._renderer.effect=null),this}},Ee=Ze;w(Ee,"Properties",["src","loaded","repeat","scale","offset","image"]),w(Ee,"RegularExpressions",Ja),w(Ee,"ImageRegistry",new Tr),w(Ee,"Register",{canvas:function(e,t){e._src="#"+e.id,Ze.ImageRegistry.add(e.src,e.image),typeof t=="function"&&t()},img:function(e,t){const n=e.image,r=function(o){!gt.isHeadless&&n.removeEventListener&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1)),typeof t=="function"&&t()},s=function(o){throw!gt.isHeadless&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1)),new Ct("unable to load "+e.src)};typeof n.width=="number"&&n.width>0&&typeof n.height=="number"&&n.height>0?r():!gt.isHeadless&&typeof n.addEventListener=="function"&&(n.addEventListener("load",r,!1),n.addEventListener("error",s,!1)),e._src=Ze.getAbsoluteURL(e._src),!(!gt.isHeadless&&n&&n.getAttribute("two-src"))&&(gt.isHeadless||n.setAttribute("two-src",e.src),Ze.ImageRegistry.add(e.src,n),gt.isHeadless?Ze.loadHeadlessBuffer(e,r):e.image.src=e.src)},video:function(e,t){if(gt.isHeadless)throw new Ct("video textures are not implemented in headless environments.");const n=function(s){e.image.removeEventListener("canplaythrough",n,!1),e.image.removeEventListener("error",r,!1),e.image.width=e.image.videoWidth,e.image.height=e.image.videoHeight,typeof t=="function"&&t()},r=function(s){throw e.image.removeEventListener("canplaythrough",n,!1),e.image.removeEventListener("error",r,!1),new Ct("unable to load "+e.src)};e._src=Ze.getAbsoluteURL(e._src),e.image.getAttribute("two-src")||(e.image.setAttribute("two-src",e.src),Ze.ImageRegistry.add(e.src,e.image)),e.image.readyState>=4?n():(e.image.addEventListener("canplaythrough",n,!1),e.image.addEventListener("error",r,!1),e.image.src=e.src,e.image.load())}});var Qa={src:{enumerable:!0,get:function(){return this._src},set:function(e){this._src=e,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(e){this._loaded=e,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(e){this._repeat=e,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(e){const t=Ee.getTag(e);let n;switch(t){case"canvas":n="#"+e.id;break;default:n=e.src}Ee.ImageRegistry.contains(n)?this._image=Ee.ImageRegistry.get(e.src):this._image=e,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset&&this._offset.unbind(j.Types.change,this._renderer.flagOffset),this._offset=e,this._offset.bind(j.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof Z&&this._scale.unbind(j.Types.change,this._renderer.flagScale),this._scale=e,this._scale instanceof Z&&this._scale.bind(j.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function gg(){this._flagOffset=!0}function mg(){this._flagScale=!0}var Dt=class extends Dn{constructor(e,t,n){super(),w(this,"_flagOffset",!0),w(this,"_flagOpacity",!0),w(this,"_flagColor",!0),w(this,"_offset",0),w(this,"_opacity",1),w(this,"_color","#fff");for(let r in el)Object.defineProperty(this,r,el[r]);this._renderer.type="stop",this.offset=typeof e=="number"?e:Dt.Index<=0?0:1,this.opacity=typeof n=="number"?n:1,this.color=typeof t=="string"?t:Dt.Index<=0?"#fff":"#000",Dt.Index=(Dt.Index+1)%2}static fromObject(e){const t=new Dt().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Dt.Properties.length;t++){const n=Dt.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Dt;return ae.each(Dt.Properties,function(n){t[n]=this[n]},this),e&&e.stops&&e.stops.push(t),t}toObject(){const e=super.toObject.call(this);return e.renderer.type="stop",ae.each(Dt.Properties,t=>{e[t]=this[t]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}},Ut=Dt;w(Ut,"Index",0),w(Ut,"Properties",["offset","opacity","color"]);var el={offset:{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset=e,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(e){this._color=e,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Hn=class extends Dn{constructor(e){super(),w(this,"_flagStops",!1),w(this,"_flagSpread",!1),w(this,"_flagUnits",!1),w(this,"_spread",""),w(this,"_units","");for(let t in tl)Object.defineProperty(this,t,tl[t]);this._renderer.type="gradient",this._renderer.flagStops=_g.bind(this),this._renderer.bindStops=yg.bind(this),this._renderer.unbindStops=bg.bind(this),this.spread="pad",this.units="objectBoundingBox",e&&(this.stops=e)}static fromObject(e){let t=e.stops;t&&t.length>0&&(t=t.map(r=>r instanceof Ut?r:new Ut().copy(r)));const n=new Hn().copy(e);return"id"in e&&(n.id=e.id),n}clone(e){const t=this.stops.map(r=>r.clone()),n=new Hn(t);return ae.each(Hn.Properties,r=>{n[r]=this[r]},this),e&&e.add(n),n}copy(e){super.copy.call(this,e);for(let t=0;t<Hn.Properties.length;t++){const n=Hn.Properties[t];n in e&&(this[n]=e[n])}return this}toObject(){const e={stops:this.stops.map(t=>t.toObject())};return ae.each(Hn.Properties,t=>{e[t]=this[t]},this),e}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(j.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}},Ye=Hn;w(Ye,"Stop",Ut),w(Ye,"Properties",["spread","stops","units"]);var tl={spread:{enumerable:!0,get:function(){return this._spread},set:function(e){this._spread=e,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(e){this._units=e,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(e){const t=this._renderer.bindStops,n=this._renderer.unbindStops;this._stops&&this._stops.unbind(j.Types.insert,t).unbind(j.Types.remove,n),this._stops=new Bn((e||[]).slice(0)),this._stops.bind(j.Types.insert,t).bind(j.Types.remove,n),t(this._stops)}}};function _g(){this._flagStops=!0}function yg(e){let t=e.length;for(;t--;)e[t].bind(j.Types.change,this._renderer.flagStops),e[t].parent=this;this._renderer.flagStops()}function bg(e){let t=e.length;for(;t--;)e[t].unbind(j.Types.change,this._renderer.flagStops),delete e[t].parent;this._renderer.flagStops()}var Ui=class extends Ye{constructor(e,t,n,r,s){super(s),w(this,"_flagEndPoints",!1),w(this,"_left",null),w(this,"_right",null);for(let o in nl)Object.defineProperty(this,o,nl[o]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=wg.bind(this),this.left=new Z,this.right=new Z,typeof e=="number"&&(this.left.x=e),typeof t=="number"&&(this.left.y=t),typeof n=="number"&&(this.right.x=n),typeof r=="number"&&(this.right.y=r)}static fromObject(e){const t=new Ui().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Ui.Properties.length;t++){const n=Ui.Properties[t];n in e&&(this[n]=e[n]instanceof Z?e[n]:new Z().copy(e[n]))}return this}clone(e){const t=this.stops.map(function(r){return r.clone()}),n=new Ui(this.left._x,this.left._y,this.right._x,this.right._y,t);return ae.each(Ye.Properties,function(r){n[r]=this[r]},this),e&&e.add(n),n}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(j.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}},Oe=Ui;w(Oe,"Stop",Ut),w(Oe,"Properties",["left","right"]);var nl={left:{enumerable:!0,get:function(){return this._left},set:function(e){this._left instanceof Z&&this._left.unbind(j.Types.change,this._renderer.flagEndPoints),this._left=e,this._left.bind(j.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(e){this._right instanceof Z&&this._right.unbind(j.Types.change,this._renderer.flagEndPoints),this._right=e,this._right.bind(j.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function wg(){this._flagEndPoints=!0}var Wn=class extends Ye{constructor(e,t,n,r,s,o){super(r),w(this,"_flagRadius",!1),w(this,"_flagCenter",!1),w(this,"_flagFocal",!1),w(this,"_radius",0),w(this,"_center",null),w(this,"_focal",null);for(let a in il)Object.defineProperty(this,a,il[a]);this._renderer.type="radial-gradient",this._renderer.flagCenter=vg.bind(this),this._renderer.flagFocal=kg.bind(this),this.center=new Z,this.radius=typeof n=="number"?n:1,this.focal=new Z,typeof e=="number"&&(this.center.x=e),typeof t=="number"&&(this.center.y=t),this.focal.copy(this.center),typeof s=="number"&&(this.focal.x=s),typeof o=="number"&&(this.focal.y=o)}static fromObject(e){const t=new Wn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Wn.Properties.length;t++){const n=Wn.Properties[t];n in e&&(/(center|focal)i/.test(n)?this[n]=e[n]instanceof Z?e[n]:new Z().copy(e[n]):typeof e[n]=="number"&&(this[n]=e[MediaKeySystemAccess]))}return this}clone(e){const t=this.stops.map(function(r){return r.clone()}),n=new Wn(this.center._x,this.center._y,this._radius,t,this.focal._x,this.focal._y);return ae.each(Ye.Properties.concat(Wn.Properties),function(r){n[r]=this[r]},this),e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return ae.each(Wn.Properties,function(t){e[t]=this[t]},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(j.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}},Ve=Wn;w(Ve,"Stop",Ut),w(Ve,"Properties",["center","radius","focal"]);var il={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(e){this._center&&this._center.unbind(j.Types.change,this._renderer.flagCenter),this._center=e,this._center.bind(j.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(e){this._focal&&this._focal.unbind(j.Types.change,this._renderer.flagFocal),this._focal=e,this._focal.bind(j.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function vg(){this._flagCenter=!0}function kg(){this._flagFocal=!0}function rl(e,t){if(t===0||t===1)return!0;const r=e._length*t;let s=0;for(let o=0;o<e._lengths.length;o++){const a=e._lengths[o];if(s>=r)return r-s>=0;s+=a}return!1}function $r(e,t){const n=e._length;if(t<=0)return 0;if(t>=n)return e._lengths.length-1;for(let r=0,s=0;r<e._lengths.length;r++){if(s+e._lengths[r]>=t)return t-=s,Math.max(r-1,0)+t/e._lengths[r];s+=e._lengths[r]}return-1}function sl(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,f=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(f||e).x,d=(f||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),f&&e._relative&&(o+=e.x,d+=e.y),ja(r,l,s,c,o,d,a,h,n)}function ol(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,f=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(f||e).x,d=(f||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),f&&e._relative&&(o+=e.x,d+=e.y),Ns(r,l,s,c,o,d,a,h,n)}function jn(e){switch(e.renderer.type){case"texture":return Ee.fromObject(e);case"gradient":return Ye.fromObject(e);case"linear-gradient":return Oe.fromObject(e);case"radial-gradient":return Ve.fromObject(e)}return e}var xg=Math.cos,Cg=Math.sin,al=Math.tan,Fs=[],Pt=class extends j{constructor(e,t,n,r,s,o){super(),w(this,"elements",new Yt(9)),w(this,"manual",!1);let a=e;Array.isArray(a)||(a=Array.prototype.slice.call(arguments)),this.identity(),a.length>0&&this.set(a)}static Multiply(e,t,n){if(t.length<=3){const C=e;let B,v,$;const F=t[0]||0,R=t[1]||0,X=t[2]||0;return B=C[0]*F+C[1]*R+C[2]*X,v=C[3]*F+C[4]*R+C[5]*X,$=C[6]*F+C[7]*R+C[8]*X,[B,v,$]}const r=e[0],s=e[1],o=e[2],a=e[3],l=e[4],c=e[5],d=e[6],h=e[7],u=e[8],f=t[0],p=t[1],g=t[2],m=t[3],_=t[4],y=t[5],b=t[6],S=t[7],x=t[8];return n=n||new Yt(9),n[0]=r*f+s*m+o*b,n[1]=r*p+s*_+o*S,n[2]=r*g+s*y+o*x,n[3]=a*f+l*m+c*b,n[4]=a*p+l*_+c*S,n[5]=a*g+l*y+c*x,n[6]=d*f+h*m+u*b,n[7]=d*p+h*_+u*S,n[8]=d*g+h*y+u*x,n}static fromObject(e){return new Pt().copy(e)}set(e,t,n,r,s,o,a,l,c){if(typeof t>"u"){const d=e;e=d[0],t=d[1],n=d[2],r=d[3],s=d[4],o=d[5],a=d[6],l=d[7],c=d[8]}return this.elements[0]=e,this.elements[1]=t,this.elements[2]=n,this.elements[3]=r,this.elements[4]=s,this.elements[5]=o,this.elements[6]=a,this.elements[7]=l,this.elements[8]=c,this.trigger(j.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(j.Types.change)}identity(){return this.elements[0]=Pt.Identity[0],this.elements[1]=Pt.Identity[1],this.elements[2]=Pt.Identity[2],this.elements[3]=Pt.Identity[3],this.elements[4]=Pt.Identity[4],this.elements[5]=Pt.Identity[5],this.elements[6]=Pt.Identity[6],this.elements[7]=Pt.Identity[7],this.elements[8]=Pt.Identity[8],this.trigger(j.Types.change)}multiply(e,t,n,r,s,o,a,l,c){if(typeof t>"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(j.Types.change);if(typeof n>"u"&&(n=1),typeof r>"u"){e=e||0,t=t||0,n=n||0,s=this.elements;const N=s[0]*e+s[1]*t+s[2]*n,A=s[3]*e+s[4]*t+s[5]*n,L=s[6]*e+s[7]*t+s[8]*n;return[N,A,L]}const d=this.elements,h=[e,t,n,r,s,o,a,l,c],u=d[0],f=d[1],p=d[2],g=d[3],m=d[4],_=d[5],y=d[6],b=d[7],S=d[8],x=h[0],C=h[1],B=h[2],v=h[3],$=h[4],F=h[5],R=h[6],X=h[7],M=h[8];return this.elements[0]=u*x+f*v+p*R,this.elements[1]=u*C+f*$+p*X,this.elements[2]=u*B+f*F+p*M,this.elements[3]=g*x+m*v+_*R,this.elements[4]=g*C+m*$+_*X,this.elements[5]=g*B+m*F+_*M,this.elements[6]=y*x+b*v+S*R,this.elements[7]=y*C+b*$+S*X,this.elements[8]=y*B+b*F+S*M,this.trigger(j.Types.change)}inverse(e){const t=this.elements;e=e||new Pt;const n=t[0],r=t[1],s=t[2],o=t[3],a=t[4],l=t[5],c=t[6],d=t[7],h=t[8],u=h*a-l*d,f=-h*o+l*c,p=d*o-a*c;let g=n*u+r*f+s*p;return g?(g=1/g,e.elements[0]=u*g,e.elements[1]=(-h*r+s*d)*g,e.elements[2]=(l*r-s*a)*g,e.elements[3]=f*g,e.elements[4]=(h*n-s*c)*g,e.elements[5]=(-l*n+s*o)*g,e.elements[6]=p*g,e.elements[7]=(-d*n+r*c)*g,e.elements[8]=(a*n-r*o)*g,e):null}scale(e,t){return arguments.length<=1&&(t=e),this.multiply(e,0,0,0,t,0,0,0,1)}rotate(e){const t=xg(e),n=Cg(e);return this.multiply(t,-n,0,n,t,0,0,0,1)}translate(e,t){return this.multiply(1,0,e,0,1,t,0,0,1)}skewX(e){const t=al(e);return this.multiply(1,t,0,0,1,0,0,0,1)}skewY(e){const t=al(e);return this.multiply(1,0,0,t,1,0,0,0,1)}toString(e){return Fs.length=0,this.toTransformArray(e,Fs),Fs.map(Pe).join(" ")}toTransformArray(e,t){const n=this.elements,r=!!t,s=n[0],o=n[1],a=n[2],l=n[3],c=n[4],d=n[5];if(e){const h=n[6],u=n[7],f=n[8];if(r){t[0]=s,t[1]=l,t[2]=h,t[3]=o,t[4]=c,t[5]=u,t[6]=a,t[7]=d,t[8]=f;return}return[s,l,h,o,c,u,a,d,f]}if(r){t[0]=s,t[1]=l,t[2]=o,t[3]=c,t[4]=a,t[5]=d;return}return[s,l,o,c,a,d]}toArray(e,t){const n=this.elements,r=!!t,s=n[0],o=n[1],a=n[2],l=n[3],c=n[4],d=n[5];if(e){const h=n[6],u=n[7],f=n[8];if(r){t[0]=s,t[1]=o,t[2]=a,t[3]=l,t[4]=c,t[5]=d,t[6]=h,t[7]=u,t[8]=f;return}return[s,o,a,l,c,d,h,u,f]}if(r){t[0]=s,t[1]=o,t[2]=a,t[3]=l,t[4]=c,t[5]=d;return}return[s,o,a,l,c,d]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Pt().copy(this)}},Xn=Pt;w(Xn,"Identity",[1,0,0,0,1,0,0,0,1]),Ia(Xn);var Ms=class extends Dn{constructor(){super(),w(this,"_flagMatrix",!0),w(this,"_flagScale",!1),w(this,"_matrix",null),w(this,"_worldMatrix",null),w(this,"_position",null),w(this,"_rotation",0),w(this,"_scale",1),w(this,"_skewX",0),w(this,"_skewY",0);for(let e in Nr)Object.defineProperty(this,e,Nr[e]);this._renderer.flagMatrix=ll.bind(this),this.isShape=!0,this.matrix=new Xn,this.worldMatrix=new Xn,this.position=new Z,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const t=new Ms().copy(e);return"id"in e&&(t.id=e.id),t}get renderer(){return this._renderer}set renderer(e){this._renderer=e}get translation(){return Nr.position.get.apply(this,arguments)}set translation(e){Nr.position.set.apply(this,arguments)}addTo(e){return e.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}copy(e){return super.copy.call(this,e),"position"in e&&(e.position instanceof Z?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 Z?e.scale:new Z(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 t=new Ms;return t.position.copy(this.position),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._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 Z?this.scale.toObject():this.scale,e.skewX=this.skewX,e.skewY=this.skewY,e.matrix=this.matrix.toObject(),e}_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 Z?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}},dn=Ms;w(dn,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var Nr={position:{enumerable:!0,get:function(){return this._position},set:function(e){this._position&&this._position.unbind(j.Types.change,this._renderer.flagMatrix),this._position=e,this._position.bind(j.Types.change,this._renderer.flagMatrix),ll.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(e){this._rotation=e,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof Z&&this._scale.unbind(j.Types.change,this._renderer.flagMatrix),this._scale=e,this._scale instanceof Z&&this._scale.bind(j.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(e){this._skewX=e,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(e){this._skewY=e,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(e){this._matrix=e,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return La(this,this._worldMatrix),this._worldMatrix},set:function(e){this._worldMatrix=e}}};function ll(){this._flagMatrix=!0}var xi=Math.min,Ci=Math.max,Sg=Math.ceil,Bg=Math.floor,Tg=new Z,Tn=class extends dn{constructor(e,t,n,r){super(),w(this,"_flagVertices",!0),w(this,"_flagLength",!0),w(this,"_flagFill",!0),w(this,"_flagStroke",!0),w(this,"_flagLinewidth",!0),w(this,"_flagOpacity",!0),w(this,"_flagVisible",!0),w(this,"_flagCap",!0),w(this,"_flagJoin",!0),w(this,"_flagMiter",!0),w(this,"_flagMask",!1),w(this,"_flagClip",!1),w(this,"_length",0),w(this,"_fill","#fff"),w(this,"_stroke","#000"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_cap","round"),w(this,"_join","round"),w(this,"_miter",4),w(this,"_closed",!0),w(this,"_curved",!1),w(this,"_automatic",!0),w(this,"_beginning",0),w(this,"_ending",1),w(this,"_mask",null),w(this,"_clip",!1),w(this,"_dashes",null);for(let s in cl)Object.defineProperty(this,s,cl[s]);this._renderer.type="path",this._renderer.flagVertices=dl.bind(this),this._renderer.bindVertices=hl.bind(this),this._renderer.unbindVertices=ul.bind(this),this._renderer.flagFill=fl.bind(this),this._renderer.flagStroke=pl.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!t,this.curved=!!n,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=!r,this.dashes=[],this.dashes.offset=0}static fromObject(e){const t=typeof e.fill=="string"?e.fill:jn(e.fill),n=typeof e.stroke=="string"?e.stroke:jn(e.stroke),r=new Tn().copy(Es(Ts({},e),{fill:t,stroke:n}));return"id"in e&&(r.id=e.id),r}copy(e){super.copy.call(this,e),this.vertices=[];for(let t=0;t<e.vertices.length;t++){const n=e.vertices[t];n instanceof ve?this.vertices.push(e.vertices[t].clone()):this.vertices.push(new ve().copy(n))}for(let t=0;t<Tn.Properties.length;t++){const n=Tn.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Tn;for(let n=0;n<this.vertices.length;n++)t.vertices.push(this.vertices[n].clone());for(let n=0;n<Tn.Properties.length;n++){const r=Tn.Properties[n];t[r]=this[r]}return t.className=this.className,t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="path",e.vertices=this.vertices.map(t=>t.toObject()),ae.each(Tn.Properties,t=>{typeof this[t]<"u"&&(this[t].toObject?e[t]=this[t].toObject():e[t]=this[t])},this),e}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const e=this.getBoundingClientRect(!0),t=e.width/2,n=e.height/2,r=e.left+e.width/2,s=e.top+e.height/2;for(let o=0;o<this.vertices.length;o++){const a=this.vertices[o];a.x-=r,a.y-=s,a.x+=t,a.y+=n}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.x+=t,this.mask.translation.y-=s,this.mask.translation.y+=n),this}center(){const e=this.getBoundingClientRect(!0),t=e.left+e.width/2-this.translation.x,n=e.top+e.height/2-this.translation.y;for(let r=0;r<this.vertices.length;r++){const s=this.vertices[r];s.x-=t,s.y-=n}return this.mask&&(this.mask.translation.x-=t,this.mask.translation.y-=n),this}getBoundingClientRect(e){let t,n,r,s,o,a,l=1/0,c=-1/0,d=1/0,h=-1/0;if(this._update(!0),t=e?this.matrix:this.worldMatrix,n=(this.linewidth||0)/2,r=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:u,scaleY:f}=wi(t.elements[0],t.elements[3],t.elements[1],t.elements[4],t.elements[2],t.elements[5]);typeof u=="number"&&typeof f=="number"&&(n=Math.max(u,f)*(this.linewidth||0)/2)}else n*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(r<=0)return{width:0,height:0};for(s=0;s<r;s++){a=this._renderer.vertices[s],o=this._renderer.vertices[(s+r-1)%r];const[u,f]=t.multiply(o.x,o.y),[p,g]=t.multiply(a.x,a.y);if(o.controls&&a.controls){let m=o.controls.right.x,_=o.controls.right.y;o.relative&&(m+=o.x,_+=o.y);let[y,b]=t.multiply(m,_),S=a.controls.left.x,x=a.controls.left.y;a.relative&&(S+=a.x,x+=a.y);let[C,B]=t.multiply(S,x);const v=Xa(u,f,y,b,C,B,p,g);d=xi(v.min.y-n,d),l=xi(v.min.x-n,l),c=Ci(v.max.x+n,c),h=Ci(v.max.y+n,h)}else s<=1&&(d=xi(f-n,d),l=xi(u-n,l),c=Ci(u+n,c),h=Ci(f+n,h)),d=xi(g-n,d),l=xi(p-n,l),c=Ci(p+n,c),h=Ci(g+n,h)}return{top:d,left:l,right:c,bottom:h,width:c-l,height:h-d}}getPointAt(e,t){let n,r,s,o,a,l,c,d,h,u,f,p,g,m,_,y=this.length*Math.min(Math.max(e,0),1);const b=this.vertices.length,S=b-1;let x=null,C=null;for(let Y=0,P=this._lengths.length,E=0;Y<P;Y++){if(E+this._lengths[Y]>=y){this._closed?(n=$t(Y,b),r=$t(Y-1,b),Y===0&&(n=r,r=Y)):(n=Y,r=Math.min(Math.max(Y-1,0),S)),x=this.vertices[n],C=this.vertices[r],y-=E,this._lengths[Y]!==0?e=y/this._lengths[Y]:e=0;break}E+=this._lengths[Y]}if(x===null||C===null)return null;if(x){if(!C)return x}else return C;_=C.controls&&C.controls.right,m=x.controls&&x.controls.left,a=C.x,u=C.y,l=(_||C).x,f=(_||C).y,c=(m||x).x,p=(m||x).y,d=x.x,g=x.y,_&&C.relative&&(l+=C.x,f+=C.y),m&&x.relative&&(c+=x.x,p+=x.y),o=Yi(e,a,l,c,d),h=Yi(e,u,f,p,g);const B=Et(a,l,e),v=Et(u,f,e),$=Et(l,c,e),F=Et(f,p,e),R=Et(c,d,e),X=Et(p,g,e),M=Et(B,$,e),N=Et(v,F,e),A=Et($,R,e),L=Et(F,X,e);return ae.isObject(t)?(t.x=o,t.y=h,t instanceof ve&&(t.controls.left.x=M,t.controls.left.y=N,t.controls.right.x=A,t.controls.right.y=L,(typeof t.relative!="boolean"||t.relative)&&(t.controls.left.x-=o,t.controls.left.y-=h,t.controls.right.x-=o,t.controls.right.y-=h)),t.t=e,t):(s=new ve(o,h,M-o,N-h,A-o,L-h,this._curved?ee.curve:ee.line),s.t=e,s)}plot(){if(this.curved)return Ya(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?ee.move:ee.line;return this}subdivide(e){this._update();const t=this.vertices.length-1,n=this._closed||this.vertices[t]._command===ee.close;let r=this.vertices[t],s=[],o;return ae.each(this.vertices,function(a,l){if(l<=0&&!n){r=a;return}if(a.command===ee.move){s.push(new ve(r.x,r.y)),l>0&&(s[s.length-1].command=ee.line),r=a;return}o=ol(a,r,e),s=s.concat(o),ae.each(o,function(c,d){d<=0&&r.command===ee.move?c.command=ee.move:c.command=ee.line}),l>=t&&(this._closed&&this._automatic&&(r=a,o=ol(a,r,e),s=s.concat(o),ae.each(o,function(c,d){d<=0&&r.command===ee.move?c.command=ee.move:c.command=ee.line})),s.push(new ve(a.x,a.y)),s[s.length-1].command=n?ee.close:ee.line),r=a},this),this._automatic=!1,this._curved=!1,this.vertices=s,this}_updateLength(e,t){t||this._update();const r=this.vertices.length-1;let s=this.vertices[r],o=0;return typeof this._lengths>"u"&&(this._lengths=[]),ae.each(this.vertices,function(a,l){if(l<=0||a.command===ee.move){s=a,this._lengths[l]=0;return}this._lengths[l]=sl(a,s,e),o+=this._lengths[l],s=a},this),this._length=o,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const e=this._collection.length,t=this._closed,n=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),s=$r(this,n*this._length),o=$r(this,r*this._length),a=Sg(s),l=Bg(o);let c,d,h,u,f,p;for(this._renderer.vertices.length=0,p=0;p<e;p++)this._renderer.collection.length<=p&&this._renderer.collection.push(new ve),p>l&&!d?(f=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(r,f),f.command=this._renderer.collection[p].command,this._renderer.vertices.push(f),d=f,h=this._collection[p-1],h&&h.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f),h.relative?this._renderer.collection[p-1].controls.right.copy(h.controls.right).lerp(Z.zero,1-f.t):this._renderer.collection[p-1].controls.right.copy(h.controls.right).lerp(h,1-f.t))):p>=a&&p<=l&&(f=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(f),p===l&&rl(this,r)?(d=f,!t&&d.controls&&(d.relative?d.controls.right.clear():d.controls.right.copy(d))):p===a&&rl(this,n)&&(c=f,c.command=ee.move,!t&&c.controls&&(c.relative?c.controls.left.clear():c.controls.left.copy(c))));a>0&&!c&&(p=a-1,f=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(n,f),f.command=ee.move,this._renderer.vertices.unshift(f),u=this._collection[p+1],u&&u.controls&&(f.controls.left.clear(),u.relative?this._renderer.collection[p+1].controls.left.copy(u.controls.left).lerp(Z.zero,f.t):(Tg.copy(u),this._renderer.collection[p+1].controls.left.copy(u.controls.left).lerp(u,f.t))))}return dn.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=!1,dn.prototype.flagReset.call(this),this}},Se=Tn;w(Se,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes"]),w(Se,"Utils",{getCurveLength:sl});var cl={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(e){this._cap=e,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(e){this._join=e,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(e){this._miter=e,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof Ye||this._fill instanceof Oe||this._fill instanceof Ve||this._fill instanceof Ee)&&this._fill.unbind(j.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Ye||this._fill instanceof Oe||this._fill instanceof Ve||this._fill instanceof Ee)&&this._fill.bind(j.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Ye||this._stroke instanceof Oe||this._stroke instanceof Ve||this._stroke instanceof Ee)&&this._stroke.unbind(j.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Ye||this._stroke instanceof Oe||this._stroke instanceof Ve||this._stroke instanceof Ee)&&this._stroke.bind(j.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(e){this._closed=!!e,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(e){this._curved=!!e,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(e){if(e===this._automatic)return;this._automatic=!!e;const t=this._automatic?"ignore":"listen";ae.each(this.vertices,function(n){n[t]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(e){this._beginning=e,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(e){const t=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(j.Types.insert,t).unbind(j.Types.remove,n),e instanceof Bn?this._collection=e:this._collection=new Bn(e||[]),this._collection.bind(j.Types.insert,t).bind(j.Types.remove,n),t(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,ae.isObject(e)&&!e.clip&&(e.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}};function dl(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function hl(e){let t=e.length;for(;t--;)e[t].bind(j.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function ul(e){let t=e.length;for(;t--;)e[t].unbind(j.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function fl(){this._flagFill=!0}function pl(){this._flagStroke=!0}var Gi=class extends Se{constructor(e,t,n,r){const s=[new ve,new ve,new ve,new ve];super(s,!0,!1,!0),w(this,"_flagWidth",0),w(this,"_flagHeight",0),w(this,"_width",0),w(this,"_height",0),w(this,"_origin",null),this._renderer.type="rectangle";for(let o in gl)Object.defineProperty(this,o,gl[o]);this.width=typeof n=="number"?n:1,this.height=typeof r=="number"?r:1,this.origin=new Z,typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t),this._update()}static fromObject(e){const t=new Gi().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Gi.Properties.length;t++){const n=Gi.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const e=this._width/2,t=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new ve),this.vertices[0].set(-e,-t).sub(this._origin).command=ee.move,this.vertices[1].set(e,-t).sub(this._origin).command=ee.line,this.vertices[2].set(e,t).sub(this._origin).command=ee.line,this.vertices[3].set(-e,t).sub(this._origin).command=ee.line,this.vertices[4]&&(this.vertices[4].set(-e,-t).sub(this._origin).command=ee.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const t=new Gi(0,0,this.width,this.height);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix);for(let n=0;n<Se.Properties.length;n++){const r=Se.Properties[n];t[r]=this[r]}return e&&e.add(t),t}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}},En=Gi;w(En,"Properties",["width","height"]);var gl={width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(e){this._origin&&this._origin.unbind(j.Types.change,this._renderer.flagVertices),this._origin=e,this._origin.bind(j.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Ki=class extends En{constructor(e,t,n,r,s,o){super(t,n,0,0),w(this,"_flagTexture",!1),w(this,"_flagColumns",!1),w(this,"_flagRows",!1),w(this,"_flagFrameRate",!1),w(this,"_flagIndex",!1),w(this,"_amount",1),w(this,"_duration",0),w(this,"_startTime",0),w(this,"_playing",!1),w(this,"_firstFrame",0),w(this,"_lastFrame",0),w(this,"_loop",!0),w(this,"_texture",null),w(this,"_columns",1),w(this,"_rows",1),w(this,"_frameRate",0),w(this,"_index",0),w(this,"_origin",null);for(let a in ml)Object.defineProperty(this,a,ml[a]);this.noStroke(),this.noFill(),e instanceof Ee?this.texture=e:typeof e=="string"&&(this.texture=new Ee(e)),this.origin=new Z,this._update(),typeof r=="number"&&(this.columns=r),typeof s=="number"&&(this.rows=s),typeof o=="number"&&(this.frameRate=o),this.index=0}static fromObject(e){const t=new Ki().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Ki.Properties.length;t++){const n=Ki.Properties[t];n in e&&(this[n]=e[n])}return this}play(e,t,n){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=ae.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof t=="number"&&(this._lastFrame=t),typeof n=="function"?this._onLastFrame=n: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 t=new Ki(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&t.play(this._firstFrame,this._lastFrame),t.loop=this.loop,t.firstFrame=this.firstFrame,t.lastFrame=this.lastFrame,e&&e.add(t),t}toObject(){const e=super.toObject.call(this);return 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}_update(){const e=this._texture,t=this._columns,n=this._rows;let r,s,o,a,l,c,d,h,u;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)){d=e.image.width,h=e.image.height,r=d/t,s=h/n,a=this._amount,this.width!==r&&(this.width=r),this.height!==s&&(this.height=s),this._playing&&this._frameRate>0&&(ae.isNaN(this._lastFrame)&&(this._lastFrame=a-1),o=ae.performance.now()-this._startTime,u=this._lastFrame+1,l=1e3*(u-this._firstFrame)/this._frameRate,this._loop?o=o%l:o=Math.min(o,l),c=Et(this._firstFrame,u,o/l),c=Math.floor(c),c!==this._index&&(this._index=c,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const f=this._index%t,p=Math.floor(this._index/t),g=-r*f+(d-r)/2,m=-s*p+(h-s)/2;g!==e.offset.x&&(e.offset.x=g),m!==e.offset.y&&(e.offset.y=m)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}},Pr=Ki;w(Pr,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var ml={texture:{enumerable:!0,get:function(){return this._texture},set:function(e){this._texture=e,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(e){this._columns=e,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(e){this._rows=e,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(e){this._frameRate=e,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(e){this._index=e,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(e){this._firstFrame=e}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(e){this._lastFrame=e}},loop:{enumerable:!0,get:function(){return this._loop},set:function(e){this._loop=!!e}}},As,_l=class extends Bn{constructor(t){t=Array.isArray(t)?t:Array.prototype.slice.call(arguments),super(t),Aa(this,As,{}),this.attach(t),this.on(j.Types.insert,this.attach),this.on(j.Types.remove,this.detach)}get ids(){return xt(this,As)}attach(t){for(let n=0;n<t.length;n++){const r=t[n];r&&r.id&&(this.ids[r.id]=r)}return this}detach(t){for(let n=0;n<t.length;n++)delete this.ids[t[n].id];return this}};As=new WeakMap;var qn=class extends Se{constructor(e,t,n,r,s,o,a){const l=a||mt.Resolution*3,c=[];for(let d=0;d<l;d++)c.push(new ve);super(c,!0,!1,!0),w(this,"_flagStartAngle",!1),w(this,"_flagEndAngle",!1),w(this,"_flagInnerRadius",!1),w(this,"_flagOuterRadius",!1),w(this,"_startAngle",0),w(this,"_endAngle",ot),w(this,"_innerRadius",0),w(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let d in yl)Object.defineProperty(this,d,yl[d]);typeof n=="number"&&(this.innerRadius=n),typeof r=="number"&&(this.outerRadius=r),typeof s=="number"&&(this.startAngle=s),typeof o=="number"&&(this.endAngle=o),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new qn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<qn.Properties.length;t++){const n=qn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const e=this._startAngle,t=this._endAngle,n=this._innerRadius,r=this._outerRadius,s=$t(e,ot)===$t(t,ot),o=n>0,a=this.vertices;let l=o?a.length/2:a.length,c,d=0,h,u,f,p,g,m,_,y,b;for(s?l--:o||(l-=2),h=0,u=l-1;h<l;h++){switch(f=h/u,p=a[d],g=f*(t-e)+e,m=(t-e)/l,_=r*Math.cos(g),y=r*Math.sin(g),h){case 0:c=ee.move;break;default:c=ee.curve}p.command=c,p.x=_,p.y=y,p.controls.left.clear(),p.controls.right.clear(),p.command===ee.curve&&(b=r*m/Math.PI,p.controls.left.x=b*Math.cos(g-Ke),p.controls.left.y=b*Math.sin(g-Ke),p.controls.right.x=b*Math.cos(g+Ke),p.controls.right.y=b*Math.sin(g+Ke),h===1&&p.controls.left.multiplyScalar(2),h===u&&p.controls.right.multiplyScalar(2)),d++}if(o){for(s?(a[d].command=ee.close,d++):(l--,u=l-1),h=0;h<l;h++)f=h/u,p=a[d],g=(1-f)*(t-e)+e,m=(t-e)/l,_=n*Math.cos(g),y=n*Math.sin(g),c=ee.curve,h<=0&&(c=s?ee.move:ee.line),p.command=c,p.x=_,p.y=y,p.controls.left.clear(),p.controls.right.clear(),p.command===ee.curve&&(b=n*m/Math.PI,p.controls.left.x=b*Math.cos(g+Ke),p.controls.left.y=b*Math.sin(g+Ke),p.controls.right.x=b*Math.cos(g-Ke),p.controls.right.y=b*Math.sin(g-Ke),h===1&&p.controls.left.multiplyScalar(2),h===u&&p.controls.right.multiplyScalar(2)),d++;a[d].copy(a[0]),a[d].command=ee.line}else s||(a[d].command=ee.line,a[d].x=0,a[d].y=0,d++,a[d].copy(a[0]),a[d].command=ee.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 t=this.innerRadius,n=this.outerRadius,r=this.startAngle,s=this.endAngle,o=this.vertices.length,a=new qn(0,0,t,n,r,s,o);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Se.Properties.length;l++){const c=Se.Properties[l];a[c]=this[c]}return e&&e.add(a),a}toObject(){const e=super.toObject.call(this);e.renderer.type="arc-segment";for(let t=0;t<qn.Properties.length;t++){const n=qn.Properties[t];e[n]=this[n]}return e}},Rr=qn;w(Rr,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var yl={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(e){this._startAngle=e,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(e){this._endAngle=e,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(e){this._innerRadius=e,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(e){this._outerRadius=e,this._flagOuterRadius=!0}}},Os=Math.cos,Vs=Math.sin,Yn=class extends Se{constructor(e,t,n,r){const s=r?Math.max(r,2):4,o=[];for(let a=0;a<s;a++)o.push(new ve(0,0,0,0,0,0));super(o,!0,!0,!0),w(this,"_flagRadius",!1),w(this,"_radius",0),this._renderer.type="circle";for(let a in bl)Object.defineProperty(this,a,bl[a]);typeof n=="number"&&(this.radius=n),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Yn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Yn.Properties.length;t++){const n=Yn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagRadius){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const t=4/3*Math.tan(Math.PI/(e*2)),n=this._radius,r=n*t;for(let s=0;s<this.vertices.length;s++){const a=s/e*ot,l=n*Os(a),c=n*Vs(a),d=r*Os(a-Ke),h=r*Vs(a-Ke),u=r*Os(a+Ke),f=r*Vs(a+Ke),p=this.vertices[s];p.command=s===0?ee.move:ee.curve,p.set(l,c),p.controls.left.set(d,h),p.controls.right.set(u,f)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const t=new Yn(0,0,this.radius,this.vertices.length);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix);for(let n=0;n<Se.Properties.length;n++){const r=Se.Properties[n];t[r]=this[r]}return e&&e.add(t),t}toObject(){const e=super.toObject.call(this);e.renderer.type="circle";for(let t=0;t<Yn.Properties.length;t++){const n=Yn.Properties[t];e[n]=this[n]}return e}},Zi=Yn;w(Zi,"Properties",["radius"]);var bl={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this._flagRadius=!0}}},zs=Math.cos,Is=Math.sin,Un=class extends Se{constructor(e,t,n,r,s){typeof r!="number"&&typeof n=="number"&&(r=n);const o=s?Math.max(s,2):4,a=[];for(let l=0;l<o;l++)a.push(new ve);super(a,!0,!0,!0),w(this,"_flagWidth",!1),w(this,"_flagHeight",!1),w(this,"_width",0),w(this,"_height",0),this._renderer.type="ellipse";for(let l in wl)Object.defineProperty(this,l,wl[l]);typeof n=="number"&&(this.width=n*2),typeof r=="number"&&(this.height=r*2),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Un().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Un.Properties.length;t++){const n=Un.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let e=this.vertices.length;!this._closed&&e>2&&(e-=1);const t=4/3*Math.tan(Math.PI/(this.vertices.length*2)),n=this._width/2,r=this._height/2;for(let s=0;s<this.vertices.length;s++){const a=s/e*ot,l=n*zs(a),c=r*Is(a),d=n*t*zs(a-Ke),h=r*t*Is(a-Ke),u=n*t*zs(a+Ke),f=r*t*Is(a+Ke),p=this.vertices[s];p.command=s===0?ee.move:ee.curve,p.set(l,c),p.controls.left.set(d,h),p.controls.right.set(u,f)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const t=this.width/2,n=this.height/2,r=this.vertices.length,s=new Un(0,0,t,n,r);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 o=0;o<Se.Properties.length;o++){const a=Se.Properties[o];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="ellipse";for(let t=0;t<Un.Properties.length;t++){const n=Un.Properties[t];e[n]=this[n]}return e}},Ji=Un;w(Ji,"Properties",["width","height"]);var wl={width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0}}},Eg=Math.ceil,$g=Math.floor,$n=class extends dn{constructor(e){super(),w(this,"_flagVertices",!0),w(this,"_flagLength",!0),w(this,"_flagFill",!0),w(this,"_flagStroke",!0),w(this,"_flagLinewidth",!0),w(this,"_flagOpacity",!0),w(this,"_flagVisible",!0),w(this,"_flagSize",!0),w(this,"_flagSizeAttenuation",!0),w(this,"_length",0),w(this,"_fill","#fff"),w(this,"_stroke","#000"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_size",1),w(this,"_sizeAttenuation",!1),w(this,"_beginning",0),w(this,"_ending",1),w(this,"_dashes",null),w(this,"noFill",Se.prototype.noFill),w(this,"noStroke",Se.prototype.noStroke),w(this,"corner",Se.prototype.corner),w(this,"center",Se.prototype.center),w(this,"getBoundingClientRect",Se.prototype.getBoundingClientRect),w(this,"_updateLength",Se.prototype._updateLength);for(let t in vl)Object.defineProperty(this,t,vl[t]);this._renderer.type="points",this._renderer.flagVertices=dl.bind(this),this._renderer.bindVertices=hl.bind(this),this._renderer.unbindVertices=ul.bind(this),this._renderer.flagFill=fl.bind(this),this._renderer.flagStroke=pl.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 t=typeof e.fill=="string"?e.fill:jn(e.fill),n=typeof e.stroke=="string"?e.stroke:jn(e.stroke),r=new $n().copy(Es(Ts({},e),{fill:t,stroke:n}));return"id"in e&&(r.id=e.id),r}copy(e){super.copy.call(this,e);for(let t=0;t<e.vertices.length;t++){const n=e.vertices[t];n instanceof ve?this.vertices.push(e.vertices[t].clone()):this.vertices.push(new ve().copy(n))}for(let t=0;t<$n.Properties.length;t++){const n=$n.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new $n;for(let n=0;n<this.vertices.length;n++)t.vertices.push(this.vertices[n].clone());for(let n=0;n<$n.Properties.length;n++){const r=$n.Properties[n];t[r]=this[r]}return t.className=this.className,t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()}toObject(){const e=super.toObject.call(this);return e.renderer.type="points",e.vertices=this.vertices.map(t=>t.toObject()),ae.each($n.Properties,function(t){typeof this[t]<"u"&&(this[t].toObject?e[t]=this[t].toObject():e[t]=this[t])},this),e}subdivide(e){this._update();let t=[];for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n],s=this.vertices[n-1];if(!s)continue;const o=r.x,a=r.y,l=s.x,c=s.y,d=Ns(o,a,o,a,l,c,l,c,e);t=t.concat(d)}return this.vertices=t,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const e=Math.min(this._beginning,this._ending),t=Math.max(this._beginning,this._ending),n=$r(this,e*this._length),r=$r(this,t*this._length),s=Eg(n),o=$g(r);let a=0,l;this._renderer.vertices=[],this._renderer.collection=[];for(let c=0;c<this._collection.length;c++)c>=s&&c<=o&&(l=this._collection[c],this._renderer.collection.push(l),this._renderer.vertices[a*2+0]=l.x,this._renderer.vertices[a*2+1]=l.y,a++)}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}},Fr=$n;w(Fr,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes"]);var vl={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(e){this._size=e,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(e){this._sizeAttenuation=e,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof Ye||this._fill instanceof Oe||this._fill instanceof Ve||this._fill instanceof Ee)&&this._fill.unbind(j.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Ye||this._fill instanceof Oe||this._fill instanceof Ve||this._fill instanceof Ee)&&this._fill.bind(j.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Ye||this._stroke instanceof Oe||this._stroke instanceof Ve||this._stroke instanceof Ee)&&this._stroke.unbind(j.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Ye||this._stroke instanceof Oe||this._stroke instanceof Ve||this._stroke instanceof Ee)&&this._stroke.bind(j.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(e){this._beginning=e,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(e){const t=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(j.Types.insert,t).unbind(j.Types.remove,n),e instanceof Bn?this._collection=e:this._collection=new Bn(e||[]),this._collection.bind(j.Types.insert,t).bind(j.Types.remove,n),t(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}},Ng=Math.cos,Pg=Math.sin,Gn=class extends Se{constructor(e,t,n,r){r=Math.max(r||0,3),super(),w(this,"_flagWidth",!1),w(this,"_flagHeight",!1),w(this,"_flagSides",!1),w(this,"_radius",0),w(this,"_width",0),w(this,"_height",0),w(this,"_sides",0),this._renderer.type="polygon";for(let s in kl)Object.defineProperty(this,s,kl[s]);this.closed=!0,this.automatic=!1,typeof n=="number"&&(this.radius=n),typeof r=="number"&&(this.sides=r),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Gn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Gn.Properties.length;t++){const n=Gn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const e=this._sides,t=e+1;let n=this.vertices.length;n>e&&(this.vertices.splice(e-1,n-e),n=e);for(let r=0;r<t;r++){const s=(r+.5)/e,o=ot*s+Math.PI/2,a=this._width*Ng(o)/2,l=this._height*Pg(o)/2;r>=n?this.vertices.push(new ve(a,l)):this.vertices[r].set(a,l),this.vertices[r].command=r===0?ee.move:ee.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const t=new Gn(0,0,0,this.sides);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,t.width=this.width,t.height=this.height,this.matrix.manual&&t.matrix.copy(this.matrix);for(let n=0;n<Se.Properties.length;n++){const r=Se.Properties[n];t[r]=this[r]}return e&&e.add(t),t}toObject(){const e=super.toObject.call(this);e.renderer.type="polygon";for(let t=0;t<Gn.Properties.length;t++){const n=Gn.Properties[t];e[n]=this[n]}return e}},Mr=Gn;w(Mr,"Properties",["width","height","sides"]);var kl={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this.width=e*2,this.height=e*2}},width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(e){this._sides=e,this._flagSides=!0}}},Kn=class extends Se{constructor(e,t,n,r,s){typeof s>"u"&&typeof n=="number"&&typeof r=="number"&&(s=Math.floor(Math.min(n,r)/12));const o=[];for(let a=0;a<10;a++)o.push(new ve(0,0,0,0,0,0,a===0?ee.move:ee.curve));super(o),w(this,"_flagWidth",!1),w(this,"_flagHeight",!1),w(this,"_flagRadius",!1),w(this,"_width",0),w(this,"_height",0),w(this,"_radius",12),this._renderer.type="rounded-rectangle";for(let a in xl)Object.defineProperty(this,a,xl[a]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=Rg.bind(this),typeof n=="number"&&(this.width=n),typeof r=="number"&&(this.height=r),typeof s=="number"&&(this.radius=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Kn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Kn.Properties.length;t++){const n=Kn.Properties[t];if(n in e){const r=e[n];/radius/i.test(n)?this[n]=typeof r=="number"||r instanceof Z?r:new Z().copy(r):typeof r=="number"&&(this[n]=r)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const e=this._width,t=this._height;let n,r;this._radius instanceof Z?(n=this._radius.x,r=this._radius.y):(n=this._radius,r=this._radius);let s,o=e/2,a=t/2;s=this.vertices[0],s.x=-(o-n),s.y=-a,s=this.vertices[1],s.x=o-n,s.y=-a,s.controls.left.clear(),s.controls.right.x=n,s.controls.right.y=0,s=this.vertices[2],s.x=o,s.y=-(a-r),s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[3],s.x=o,s.y=a-r,s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=r,s=this.vertices[4],s.x=o-n,s.y=a,s.controls.right.clear(),s.controls.left.clear(),s=this.vertices[5],s.x=-(o-n),s.y=a,s.controls.left.clear(),s.controls.right.x=-n,s.controls.right.y=0,s=this.vertices[6],s.x=-o,s.y=a-r,s.controls.left.clear(),s.controls.right.clear(),s=this.vertices[7],s.x=-o,s.y=-(a-r),s.controls.left.clear(),s.controls.right.x=0,s.controls.right.y=-r,s=this.vertices[8],s.x=-(o-n),s.y=-a,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 t=this.width,n=this.height,r=this.radius,s=new Kn(0,0,t,n,r);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 o=0;o<Se.Properties.length;o++){const a=Se.Properties[o];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="rounded-rectangle";for(let t=0;t<Kn.Properties.length;t++){const n=Kn.Properties[t];e[n]=this[n]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}},Qi=Kn;w(Qi,"Properties",["width","height","radius"]);var xl={width:{enumerable:!0,get:function(){return this._width},set:function(e){this._width=e,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(e){this._height=e,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius instanceof Z&&this._radius.unbind(j.Types.change,this._renderer.flagRadius),this._radius=e,this._radius instanceof Z&&this._radius.bind(j.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function Rg(){this._flagRadius=!0}var Fg=Math.cos,Mg=Math.sin,Zn=class extends Se{constructor(e,t,n,r,s){arguments.length<=3&&(r=n,n=r/2),(typeof s!="number"||s<=0)&&(s=5),super(),w(this,"_flagInnerRadius",!1),w(this,"_flagOuterRadius",!1),w(this,"_flagSides",!1),w(this,"_innerRadius",0),w(this,"_outerRadius",0),w(this,"_sides",0),this._renderer.type="star";for(let o in Cl)Object.defineProperty(this,o,Cl[o]);this.closed=!0,this.automatic=!1,typeof n=="number"&&(this.innerRadius=n),typeof r=="number"&&(this.outerRadius=r),typeof s=="number"&&(this.sides=s),this._update(),typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t)}static fromObject(e){const t=new Zn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Zn.Properties.length;t++){const n=Zn.Properties[t];n in e&&typeof e[n]=="number"&&(this[n]=e[n])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const e=this._sides*2,t=e+1;let n=this.vertices.length;n>e&&(this.vertices.splice(e-1,n-e),n=e);for(let r=0;r<t;r++){const s=(r+.5)/e,o=ot*s,a=(r%2?this._outerRadius:this._innerRadius)/2,l=a*Fg(o),c=a*Mg(o);r>=n?this.vertices.push(new ve(l,c)):this.vertices[r].set(l,c),this.vertices[r].command=r===0?ee.move:ee.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(e){const t=this.innerRadius,n=this.outerRadius,r=this.sides,s=new Zn(0,0,t,n,r);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 o=0;o<Se.Properties.length;o++){const a=Se.Properties[o];s[a]=this[a]}return e&&e.add(s),s}toObject(){const e=super.toObject.call(this);e.renderer.type="star";for(let t=0;t<Zn.Properties.length;t++){const n=Zn.Properties[t];e[n]=this[n]}return e}},Ar=Zn;w(Ar,"Properties",["innerRadius","outerRadius","sides"]);var Cl={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(e){this._innerRadius=e,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(e){this._outerRadius=e,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(e){this._sides=e,this._flagSides=!0}}},Ls,Sl=Math.min,Bl=Math.max;He.document&&(Ls=document.createElement("canvas"));var Rt=class extends dn{constructor(e,t,n,r){super(),w(this,"_flagValue",!0),w(this,"_flagFamily",!0),w(this,"_flagSize",!0),w(this,"_flagLeading",!0),w(this,"_flagAlignment",!0),w(this,"_flagBaseline",!0),w(this,"_flagStyle",!0),w(this,"_flagWeight",!0),w(this,"_flagDecoration",!0),w(this,"_flagFill",!0),w(this,"_flagStroke",!0),w(this,"_flagLinewidth",!0),w(this,"_flagOpacity",!0),w(this,"_flagVisible",!0),w(this,"_flagMask",!1),w(this,"_flagClip",!1),w(this,"_flagDirection",!0),w(this,"_value",""),w(this,"_family","sans-serif"),w(this,"_size",13),w(this,"_leading",17),w(this,"_alignment","center"),w(this,"_baseline","middle"),w(this,"_style","normal"),w(this,"_weight",500),w(this,"_decoration","none"),w(this,"_direction","ltr"),w(this,"_fill","#000"),w(this,"_stroke","none"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_mask",null),w(this,"_clip",!1),w(this,"_dashes",null);for(let s in Tl)Object.defineProperty(this,s,Tl[s]);if(this._renderer.type="text",this._renderer.flagFill=Ag.bind(this),this._renderer.flagStroke=Og.bind(this),this.value=e,typeof t=="number"&&(this.translation.x=t),typeof n=="number"&&(this.translation.y=n),this.dashes=[],this.dashes.offset=0,!ae.isObject(r))return this;for(let s=0;s<Rt.Properties.length;s++){const o=Rt.Properties[s];o in r&&(this[o]=r[o])}}static Measure(e){if(Ls){const t=Ls.getContext("2d");t.font=[e._style,e._weight,`${e._size}px/${e._leading}px`,e._family].join(" ");const n=t.measureText(e.value,0,0),r=n.actualBoundingBoxDescent+n.actualBoundingBoxAscent;return{width:n.width,height:r}}else{const t=this.value.length*this.size*Rt.Ratio,n=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:t,height:n}}}static fromObject(e){const t=typeof e.fill=="string"?e.fill:jn(e.fill),n=typeof e.stroke=="string"?e.stroke:jn(e.stroke),r=new Rt().copy(Es(Ts({},e),{fill:t,stroke:n}));return"id"in e&&(r.id=e.id),r}copy(e){super.copy.call(this,e);for(let t=0;t<Rt.Properties.length;t++){const n=Rt.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Rt(this.value);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale;for(let n=0;n<Rt.Properties.length;n++){const r=Rt.Properties[n];t[r]=this[r]}return this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()}toObject(){const e=super.toObject.call(this);e.renderer.type="text";for(let t=0;t<Rt.Properties.length;t++){const n=Rt.Properties[t];e[n]=this[n]}return e}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(e){let t,n,r,s,o;this._update(!0),t=e?this.matrix:this.worldMatrix;const{width:a,height:l}=Rt.Measure(this),c=(this._linewidth||0)/2;switch(this.alignment){case"left":n=-c,r=a+c;break;case"right":n=-(a+c),r=c;break;default:n=-(a/2+c),r=a/2+c}switch(this.baseline){case"middle":s=-(l/2+c),o=l/2+c;break;default:s=-(l+c),o=c}const[d,h]=t.multiply(n,s),[u,f]=t.multiply(n,o),[p,g]=t.multiply(r,s),[m,_]=t.multiply(r,o);return s=Sl(h,f,g,_),n=Sl(d,u,p,m),r=Bl(d,u,p,m),o=Bl(h,f,g,_),{top:s,left:n,right:r,bottom:o,width:r-n,height:o-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}},At=Rt;w(At,"Ratio",.6),w(At,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes"]);var Tl={value:{enumerable:!0,get:function(){return this._value},set:function(e){this._value=e,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(e){this._family=e,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(e){this._size=e,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(e){this._leading=e,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(e){this._alignment=e,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(e){this._style=e,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(e){this._weight=e,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(e){this._decoration=e,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(e){this._direction=e,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(e){this._baseline=e,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._opacity=e,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._visible=e,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof Ye||this._fill instanceof Oe||this._fill instanceof Ve||this._fill instanceof Ee)&&this._fill.unbind(j.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Ye||this._fill instanceof Oe||this._fill instanceof Ve||this._fill instanceof Ee)&&this._fill.bind(j.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Ye||this._stroke instanceof Oe||this._stroke instanceof Ve||this._stroke instanceof Ee)&&this._stroke.unbind(j.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Ye||this._stroke instanceof Oe||this._stroke instanceof Ve||this._stroke instanceof Ee)&&this._stroke.bind(j.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,ae.isObject(e)&&!e.clip&&(e.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(e){typeof e.offset!="number"&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}}};function Ag(){this._flagFill=!0}function Og(){this._flagStroke=!0}var Or=Math.min,Vr=Math.max,Si=class extends dn{constructor(e){super(),w(this,"_flagAdditions",!1),w(this,"_flagSubtractions",!1),w(this,"_flagOrder",!1),w(this,"_flagOpacity",!0),w(this,"_flagBeginning",!1),w(this,"_flagEnding",!1),w(this,"_flagLength",!1),w(this,"_flagMask",!1),w(this,"_fill","#fff"),w(this,"_stroke","#000"),w(this,"_linewidth",1),w(this,"_opacity",1),w(this,"_visible",!0),w(this,"_cap","round"),w(this,"_join","round"),w(this,"_miter",4),w(this,"_closed",!0),w(this,"_curved",!1),w(this,"_automatic",!0),w(this,"_beginning",0),w(this,"_ending",1),w(this,"_length",0),w(this,"_mask",null);for(let t in El)Object.defineProperty(this,t,El[t]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}static InsertChildren(e){for(let t=0;t<e.length;t++)$l.call(this,e[t],this)}static RemoveChildren(e){for(let t=0;t<e.length;t++)$l.call(this,e[t])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const t=new Si;for(let r=0;r<Si.Properties.length;r++){const s=Si.Properties[r];s in e&&(/(fill|stroke)/i.test(s)?t[s]=typeof e[s]=="string"?e[s]:jn(e[s]):t[s]=e[s])}return"mask"in e&&(t.mask=n(e.mask)),"id"in e&&(t.id=e.id),t.children=e.children.map(n),t;function n(r){if(r&&r.renderer)switch(r.renderer.type){case"arc-segment":return Rr.fromObject(r);case"circle":return Zi.fromObject(r);case"ellipse":return Ji.fromObject(r);case"points":return Fr.fromObject(r);case"polygon":return Mr.fromObject(r);case"rectangle":return En.fromObject(r);case"rounded-rectangle":return Qi.fromObject(r);case"star":return Ar.fromObject(r);case"path":return Se.fromObject(r);case"text":return At.fromObject(r);case"group":return Si.fromObject(r);case"shape":return dn.fromObject(r);case"element":return Dn.fromObject(r)}return r}}copy(e){return super.copy.call(this,e),console.warn("Two.Group.copy is not supported yet."),this}clone(e){const t=new Si,n=this.children.map(function(r){return r.clone()});return t.add(n),t.opacity=this.opacity,this.mask&&(t.mask=this.mask),t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.className=this.className,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._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,ae.each(this.children,(t,n)=>{e.children[n]=t.toObject()},this),e}corner(){const e=this.getBoundingClientRect(!0);for(let t=0;t<this.children.length;t++){const n=this.children[t];n.translation.x-=e.left,n.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),t=e.left+e.width/2-this.translation.x,n=e.top+e.height/2-this.translation.y;for(let r=0;r<this.children.length;r++){const s=this.children[r];s.isShape&&(s.translation.x-=t,s.translation.y-=n)}return this.mask&&(this.mask.translation.x-=t,this.mask.translation.y-=n),this}getById(e){let t=null;function n(r){if(r.id===e)return r;if(r.children){if(r.children.ids[e])return r.children.ids[e];for(let s=0;s<r.children.length;s++)if(t=n(r.children[s]),t)return t}return null}return n(this)}getByClassName(e){const t=[];function n(r){if(Array.prototype.indexOf.call(r.classList,e)>=0&&t.push(r),r.children)for(let s=0;s<r.children.length;s++){const o=r.children[s];n(o)}return t}return n(this)}getByType(e){const t=[];function n(r){if(r instanceof e&&t.push(r),r.children)for(let s=0;s<r.children.length;s++){const o=r.children[s];n(o)}return t}return n(this)}add(e){e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let t=0;t<e.length;t++){const n=e[t];if(!(n&&n.id))continue;const r=Array.prototype.indexOf.call(this.children,n);r>=0&&this.children.splice(r,1),this.children.push(n)}return this}remove(e){const t=arguments.length,n=this.parent;if(t<=0&&n)return n.remove(this),this;e instanceof Array?e=e.slice():e=Array.prototype.slice.call(arguments);for(let r=0;r<e.length;r++){const s=e[r];if(!s||!this.children.ids[s.id])continue;const o=this.children.indexOf(s);o>=0&&this.children.splice(o,1)}return this}getBoundingClientRect(e){let t,n,r,s,o,a;this._update(!0);let l=1/0,c=-1/0,d=1/0,h=-1/0;const u=/texture|gradient/i;n=e?this.matrix:this.worldMatrix;for(let f=0;f<this.children.length;f++){const p=this.children[f];if(!(!p.visible||u.test(p._renderer.type))&&(t=p.getBoundingClientRect(e),r=typeof t.top!="number"||ae.isNaN(t.top)||!isFinite(t.top),s=typeof t.left!="number"||ae.isNaN(t.left)||!isFinite(t.left),o=typeof t.right!="number"||ae.isNaN(t.right)||!isFinite(t.right),a=typeof t.bottom!="number"||ae.isNaN(t.bottom)||!isFinite(t.bottom),!(r||s||o||a)))if(e){const[g,m]=n.multiply(t.left,t.top),[_,y]=n.multiply(t.right,t.top),[b,S]=n.multiply(t.left,t.bottom),[x,C]=n.multiply(t.right,t.bottom);d=Or(m,y,S,C,d),l=Or(g,_,b,x,l),c=Vr(g,_,b,x,c),h=Vr(m,y,S,C,h)}else d=Or(t.top,d),l=Or(t.left,l),c=Vr(t.right,c),h=Vr(t.bottom,h)}return{top:d,left:l,right:c,bottom:h,width:c-l,height:h-d}}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(t){t.subdivide.apply(t,e)}),this}_update(){let e,t,n;if(this._flagBeginning||this._flagEnding){const r=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),o=this.length;let a=0;const l=r*o,c=s*o;for(e=0;e<this.children.length;e++)n=this.children[e],t=n.length,l>a+t?(n.beginning=1,n.ending=1):c<a?(n.beginning=0,n.ending=0):l>a&&l<a+t?(n.beginning=(l-a)/t,n.ending=1):c>a&&c<a+t?(n.beginning=0,n.ending=(c-a)/t):(n.beginning=0,n.ending=1),a+=t}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}},Ge=Si;w(Ge,"Children",_l),w(Ge,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var El={visible:{enumerable:!0,get:function(){return this._visible},set:function(e){this._flagVisible=this._visible!==e||this._flagVisible,this._visible=e}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(e){this._flagOpacity=this._opacity!==e||this._flagOpacity,this._opacity=e}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(e){this._flagBeginning=this._beginning!==e||this._flagBeginning,this._beginning=e}},ending:{enumerable:!0,get:function(){return this._ending},set:function(e){this._flagEnding=this._ending!==e||this._flagEnding,this._ending=e}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let e=0;e<this.children.length;e++){const t=this.children[e];this._length+=t.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(e){this._fill=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.fill=e}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){this._stroke=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.stroke=e}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(e){this._linewidth=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.linewidth=e}}},join:{enumerable:!0,get:function(){return this._join},set:function(e){this._join=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.join=e}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(e){this._miter=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.miter=e}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(e){this._cap=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.cap=e}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(e){this._closed=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.closed=e}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(e){this._curved=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.curved=e}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(e){this._automatic=e;for(let t=0;t<this.children.length;t++){const n=this.children[t];n.automatic=e}}},children:{enumerable:!0,get:function(){return this._children},set:function(e){const t=Ge.InsertChildren.bind(this),n=Ge.RemoveChildren.bind(this),r=Ge.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new _l(e),this._children.bind(j.Types.insert,t),this._children.bind(j.Types.remove,n),this._children.bind(j.Types.order,r),e.length>0&&t(e)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,ae.isObject(e)&&!e.clip&&(e.clip=!0)}}};function $l(e,t){const n=e.parent;let r;if(n===t){s();return}if(n&&n.children.ids[e.id]&&(r=Array.prototype.indexOf.call(n.children,e),n.children.splice(r,1),o()),t){s();return}o(),n._flagAdditions&&n.additions.length===0&&(n._flagAdditions=!1),n._flagSubtractions&&n.subtractions.length===0&&(n._flagSubtractions=!1),delete e.parent;function s(){t.subtractions.length>0&&(r=Array.prototype.indexOf.call(t.subtractions,e),r>=0&&t.subtractions.splice(r,1)),t.additions.length>0&&(r=Array.prototype.indexOf.call(t.additions,e),r>=0&&t.additions.splice(r,1)),e.parent=t,t.additions.push(e),t._flagAdditions=!0}function o(){r=Array.prototype.indexOf.call(n.additions,e),r>=0&&n.additions.splice(r,1),r=Array.prototype.indexOf.call(n.subtractions,e),r<0&&(n.subtractions.push(e),n._flagSubtractions=!0)}}var Ds=class extends Se{constructor(t,n,r,s){const o=[new ve(t,n),new ve(r,s)];super(o);for(let a in Nl)Object.defineProperty(this,a,Nl[a]);this.vertices[0].command=ee.move,this.vertices[1].command=ee.line,this.automatic=!1}},Nl={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(e){if(ae.isObject(e))this.vertices.splice(0,1,e);else{const t=new Ct("Two.Line.x argument is not an object.");console.warn(t.name,t.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(e){if(ae.isObject(e))this.vertices.splice(1,1,e);else{const t=new Ct("Two.Line.y argument is not an object.");console.warn(t.name,t.message)}}}},Gt={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},Vg={start:"left",middle:"center",end:"right"},Pl=["id","class","transform","xmlns","viewBox"],zg=["x","y","width","height","href","xlink:href"];function Ig(e){return Vg[e]}function Lg(e){const t=e.getAttribute("dominant-baseline"),n=e.getAttribute("alignment-baseline");return t||n}function er(e){return e.replace(/svg:/gi,"").toLowerCase()}function Rl(e,t){if(t.x+=e.translateX,t.y+=e.translateY,t.x*=e.scaleX,t.y*=e.scaleY,e.rotation!==0){const n=t.length();t.x=n*Math.cos(e.rotation),t.y=n*Math.sin(e.rotation)}}function Dg(e,t){t||(t={});const n=e.split(";");for(let r=0;r<n.length;r++){const s=n[r].split(":"),o=s[0],a=s[1];if(typeof o>"u"||typeof a>"u")continue;const l=o.replace(/\s/g,""),c=a.replace(/\s/g,"");t[l]=c}return t}function Hg(e){const t={},n=Wg(e),r=Math.max(n.length,e.style.length);for(let s=0;s<r;s++){const o=e.style[s],a=n[s];o&&(t[o]=e.style[o]),a&&(t[a]=e.getAttribute(a))}return t}function Wg(e){const t=e.getAttributeNames();for(let n=0;n<Pl.length;n++){const r=Pl[n],s=Array.prototype.indexOf.call(t,r);s>=0&&t.splice(s,1)}return t}function jg(e,t){const n=t.split(/[\s,]/),r=-parseFloat(n[0]),s=-parseFloat(n[1]),o=parseFloat(n[2]),a=parseFloat(n[3]);if(r&&s)for(let u=0;u<e.children.length;u++){const f=e.children[u];"translation"in f?f.translation.add(r,s):"x"in f?f.x=r:"y"in f&&(f.y=s)}const l=typeof e.x=="number",c=typeof e.y=="number",d=typeof e.width=="number",h=typeof e.height=="number";return l&&(e.translation.x+=e.x),c&&(e.translation.y+=e.y),(d||h)&&(e.scale=new Z(1,1)),d&&(e.scale.x=e.width/o),h&&(e.scale.y=e.height/a),e.mask=new En(0,0,o,a),e.mask.origin.set(-o/2,-a/2),e}function Ot(e,t,n){const r={},s={},o={};let a,l,c,d,h,u,f,p,g,m,_,y,b,S,x,C,B;if(e===null)return r;if(He.getComputedStyle){const v=He.getComputedStyle(e);for(a=v.length;a--;)c=v[a],d=v[c],typeof d<"u"&&(r[c]=d)}for(a=0;a<e.attributes.length;a++)u=e.attributes[a],/style/i.test(u.nodeName)?Dg(u.value,o):s[u.nodeName]=u.value;typeof r.opacity<"u"&&(r["stroke-opacity"]=r.opacity,r["fill-opacity"]=r.opacity,delete r.opacity),n&&ae.defaults(r,n),ae.extend(r,o,s),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=e.gradientTransform&&e.gradientTransform.baseVal&&e.gradientTransform.baseVal.length>0?e.gradientTransform.baseVal[0].matrix:e.getCTM?e.getCTM():null,l===null))break;switch(f=wi(l),t._renderer.type){case"linear-gradient":Rl(f,t.left),Rl(f,t.right);break;case"radial-gradient":t.center.x+=f.translateX,t.center.y+=f.translateY,t.focal.x+=f.translateX,t.focal.y+=f.translateY,t.radius*=Math.max(f.scaleX,f.scaleY);break}break;case"transform":if(/none/i.test(d)||(l=e.transform&&e.transform.baseVal&&e.transform.baseVal.length>0?e.transform.baseVal[0].matrix:e.getCTM?e.getCTM():null,l===null))break;f=wi(l),t.translation.set(f.translateX,f.translateY),t.rotation=Math.PI*(f.rotation/180),t.scale=new Z(f.scaleX,f.scaleY),p=parseFloat((r.x+"").replace("px")),g=parseFloat((r.y+"").replace("px")),p&&(t.translation.x=p),g&&(t.translation.y=g);break;case"visible":if(t instanceof Ge){t._visible=d;break}t.visible=d;break;case"stroke-linecap":if(t instanceof Ge){t._cap=d;break}t.cap=d;break;case"stroke-linejoin":if(t instanceof Ge){t._join=d;break}t.join=d;break;case"stroke-miterlimit":if(t instanceof Ge){t._miter=d;break}t.miter=d;break;case"stroke-width":if(t instanceof Ge){t._linewidth=parseFloat(d);break}t.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(t instanceof Ge){t._opacity=parseFloat(d);break}t.opacity=parseFloat(d);break;case"clip-path":if(Gt.cssBackgroundImage.test(d)&&(m=d.replace(Gt.cssBackgroundImage,"$1"),Le.defs.current&&Le.defs.current.contains(m)&&(y=Le.defs.current.get(m),y&&y.childNodes.length>0)))switch(y=y.childNodes[0],b=er(y.nodeName),t.mask=Le[b].call(this,y,{}),t._renderer.type){case"text":case"path":t.position.add(t.mask.position),t.mask.position.clear();break}break;case"fill":case"stroke":h=(t instanceof Ge?"_":"")+c,Gt.cssBackgroundImage.test(d)?(m=d.replace(Gt.cssBackgroundImage,"$1"),Le.defs.current&&Le.defs.current.contains(m)?(y=Le.defs.current.get(m),y.object||(b=er(y.nodeName),y.object=Le[b].call(this,y,{})),y=y.object):(_=qg(this),y=_.getById(m)),t[h]=y):t[h]=d;break;case"id":t.id=d;break;case"class":case"className":t.classList=d.split(" "),t._flagClassName=!0;break;case"x":case"y":if(S=t instanceof Ye,x=t instanceof Oe,C=t instanceof Ve,S||x||C)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Ct("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),t.translation[c]=parseFloat(d);break;case"font-family":t instanceof At&&(t.family=d);break;case"font-size":t instanceof At&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Ct("only pixel values are supported with the "+c+" attribute."),console.warn(B.name,B.message)),t.size=parseFloat(d));break;case"font-weight":t instanceof At&&(t.weight=d);break;case"font-style":t instanceof At&&(t.style=d);break;case"text-decoration":t instanceof At&&(t.decoration=d);break;case"line-height":t instanceof At&&(t.leading=d);break}return Object.keys(e.dataset).length&&(t.dataset=e.dataset),r}function Xg(e,t){for(let n=0,r=e.childNodes.length;n<r;n++){const s=e.childNodes[n];!s.id||er(e.nodeName)==="#text"||t.add(s.id,s)}}function qg(e){for(;e.parent;)e=e.parent;return e.scene}var Le={svg:function(e){const t=Le.defs.current=new Tr,n=e.getElementsByTagName("defs");for(let g=0;g<n.length;g++)Xg(n[g],t);const r=Le.g.call(this,e),s=e.getAttribute("viewBox"),o=e.getAttribute("x"),a=e.getAttribute("y"),l=e.getAttribute("width"),c=e.getAttribute("height");r.defs=t;const d=s!==null,h=o!==null,u=a!==null,f=l!==null,p=c!==null;return h&&(r.x=parseFloat(o.replace(Gt.unitSuffix,""))),u&&(r.y=parseFloat(a.replace(Gt.unitSuffix,""))),f&&(r.width=parseFloat(l.replace(Gt.unitSuffix,""))),p&&(r.height=parseFloat(c.replace(Gt.unitSuffix,""))),d&&jg(r,s),delete Le.defs.current,r},defs:function(e){return null},use:function(e,t){let n;const r=e.getAttribute("href")||e.getAttribute("xlink:href");if(!r)return n=new Ct("encountered <use /> with no href."),console.warn(n.name,n.message),null;const s=r.slice(1);if(!Le.defs.current.contains(s))return n=new Ct("unable to find element for reference "+r+"."),console.warn(n.name,n.message),null;const a=Le.defs.current.get(s).cloneNode(!0);for(let c=0;c<e.attributes.length;c++){const d=e.attributes[c],h=zg.includes(d.nodeName),u=!a.hasAttribute(d.nodeName);(h||u)&&a.setAttribute(d.nodeName,d.value)}const l=er(a.nodeName);return Le[l].call(this,a,t)},g:function(e,t){const n=new Ge;Ot.call(this,e,n,t),this.add(n);const r=Hg.call(this,e);for(let s=0,o=e.childNodes.length;s<o;s++){const a=e.childNodes[s],l=a.nodeName;if(!l)return;const c=er(l);if(c in Le){const d=Le[c].call(n,a,r);d&&!d.parent&&n.add(d)}}return n},polygon:function(e,t){let n;typeof e=="string"?n=e:n=e.getAttribute("points");const r=[];n.replace(/(-?[\d.eE-]+)[,|\s](-?[\d.eE-]+)/g,function(o,a,l){r.push(new ve(parseFloat(a),parseFloat(l)))});const s=new Se(r,!0);return s.stroke="none",s.fill="black",Ot.call(this,e,s,t),s},polyline:function(e,t){const n=Le.polygon.call(this,e,t);return n.closed=!1,n},path:function(e,t){let n;typeof e=="string"?(n=e,e=null):n=e.getAttribute("d");let r=[],s=!1,o=!1;if(n){let l=new ve,c,d,h=n.match(/[a-df-z][^a-df-z]*/gi);const u=h.length-1;ae.each(h.slice(0),function(f,p){const g=f.slice(1).trim().match(Gt.path),m=f[0],_=m.toLowerCase();let y,b,S,x,C;const B=[];switch(p===0&&(h=[]),_){case"h":case"v":g.length>1&&(y=1);break;case"m":case"l":case"t":g.length>2&&(y=2);break;case"s":case"q":g.length>4&&(y=4);break;case"c":g.length>6&&(y=6);break;case"a":g.length>7&&(y=7);break}if(y){for(b=0,S=g.length,C=0;b<S;b+=y){if(x=m,C>0)switch(m){case"m":x="l";break;case"M":x="L";break}B.push(x+g.slice(b,b+y).join(" ")),C++}h=Array.prototype.concat.apply(h,B)}else h.push(f)}),ae.each(h,function(f,p){let g,m,_;const y=f[0],b=y.toLowerCase();d=f.slice(1).trim().match(Gt.path),o=y===b;let S,x,C,B,v,$,F,R,X,M,N,A,L,Y,P,E,H;switch(b){case"z":if(p>=u)s=!0;else{m=l.x,_=l.y,g=new ve(m,_,void 0,void 0,void 0,void 0,ee.close);for(let I=r.length-1;I>=0;I--){const U=r[I];if(/m/i.test(U.command)){l=U;break}}}break;case"m":case"l":c=void 0,m=parseFloat(d[0]),_=parseFloat(d[1]),g=new ve(m,_,void 0,void 0,void 0,void 0,/m/i.test(b)?ee.move:ee.line),o&&g.addSelf(l),l=g;break;case"h":case"v":M=/h/i.test(b)?"x":"y",N=/x/i.test(M)?"y":"x",g=new ve(void 0,void 0,void 0,void 0,void 0,void 0,ee.line),g[M]=parseFloat(d[0]),g[N]=l[N],o&&(g[M]+=l[M]),l=g;break;case"c":case"s":S=l.x,x=l.y,c||(c=new Z),/c/i.test(b)?(C=parseFloat(d[0]),B=parseFloat(d[1]),v=parseFloat(d[2]),$=parseFloat(d[3]),F=parseFloat(d[4]),R=parseFloat(d[5])):(X=Ps(l,c,o),C=X.x,B=X.y,v=parseFloat(d[0]),$=parseFloat(d[1]),F=parseFloat(d[2]),R=parseFloat(d[3])),o&&(C+=S,B+=x,v+=S,$+=x,F+=S,R+=x),l.controls.right.set(C-l.x,B-l.y),g=new ve(F,R,v-F,$-R,void 0,void 0,ee.curve),l=g,c=g.controls.left;break;case"t":case"q":S=l.x,x=l.y,c||(c=new Z),/q/i.test(b)?(C=parseFloat(d[0]),B=parseFloat(d[1]),v=parseFloat(d[0]),$=parseFloat(d[1]),F=parseFloat(d[2]),R=parseFloat(d[3])):(X=Ps(l,c,o),C=X.x,B=X.y,v=X.x,$=X.y,F=parseFloat(d[0]),R=parseFloat(d[1])),o&&(C+=S,B+=x,v+=S,$+=x,F+=S,R+=x),l.controls.right.set((C-l.x)*.33,(B-l.y)*.33),g=new ve(F,R,v-F,$-R,void 0,void 0,ee.curve),l=g,c=g.controls.left;break;case"a":S=l.x,x=l.y,L=parseFloat(d[0]),Y=parseFloat(d[1]),P=parseFloat(d[2]),E=parseFloat(d[3]),H=parseFloat(d[4]),F=parseFloat(d[5]),R=parseFloat(d[6]),o&&(F+=S,R+=x),A=new ve(F,R),A.command=ee.arc,A.rx=L,A.ry=Y,A.xAxisRotation=P,A.largeArcFlag=E,A.sweepFlag=H,g=A,l=A,c=void 0;break}g&&(Array.isArray(g)?r=r.concat(g):r.push(g))})}n=new Se(r,s,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},ae.each(n.vertices,function(l){l.subSelf(a.centroid)}),Ot.call(this,e,n,t),n.translation.addSelf(a.centroid),n},circle:function(e,t){const n=parseFloat(e.getAttribute("cx")),r=parseFloat(e.getAttribute("cy")),s=parseFloat(e.getAttribute("r")),o=new Zi(0,0,s);return o.stroke="none",o.fill="black",Ot.call(this,e,o,t),o.translation.x=n,o.translation.y=r,o},ellipse:function(e,t){const n=parseFloat(e.getAttribute("cx")),r=parseFloat(e.getAttribute("cy")),s=parseFloat(e.getAttribute("rx")),o=parseFloat(e.getAttribute("ry")),a=new Ji(0,0,s,o);return a.stroke="none",a.fill="black",Ot.call(this,e,a,t),a.translation.x=n,a.translation.y=r,a},rect:function(e,t){const n=parseFloat(e.getAttribute("rx")),r=parseFloat(e.getAttribute("ry"));if(!ae.isNaN(n)||!ae.isNaN(r))return Le["rounded-rect"](e);const s=parseFloat(e.getAttribute("width")),o=parseFloat(e.getAttribute("height")),a=s/2,l=o/2,c=new En(0,0,s,o);return c.stroke="none",c.fill="black",Ot.call(this,e,c,t),c.translation.x+=a,c.translation.y+=l,c},"rounded-rect":function(e,t){const n=parseFloat(e.getAttribute("rx"))||0,r=parseFloat(e.getAttribute("ry"))||0,s=parseFloat(e.getAttribute("width")),o=parseFloat(e.getAttribute("height")),a=s/2,l=o/2,c=new Z(n,r),d=new Qi(0,0,s,o,c);return d.stroke="none",d.fill="black",Ot.call(this,e,d,t),d.translation.x+=a,d.translation.y+=l,d},line:function(e,t){const n=parseFloat(e.getAttribute("x1")),r=parseFloat(e.getAttribute("y1")),s=parseFloat(e.getAttribute("x2")),o=parseFloat(e.getAttribute("y2")),a=new Ds(n,r,s,o).noFill();return Ot.call(this,e,a,t),a},lineargradient:function(e,t){let n=e.getAttribute("gradientUnits"),r=e.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let s=parseFloat(e.getAttribute("x1")||0),o=parseFloat(e.getAttribute("y1")||0),a=parseFloat(e.getAttribute("x2")||0),l=parseFloat(e.getAttribute("y2")||0);const c=(a+s)/2,d=(l+o)/2;/userSpaceOnUse/i.test(n)&&(s-=c,o-=d,a-=c,l-=d);const h=[];for(let f=0;f<e.children.length;f++){const p=e.children[f];let g=p.getAttribute("offset");/%/gi.test(g)&&(g=parseFloat(g.replace(/%/gi,""))/100),g=parseFloat(g);let m=p.getAttribute("stop-color"),_=p.getAttribute("stop-opacity"),y=p.getAttribute("style"),b;m===null&&(b=y?y.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,m=b&&b.length>1?b[1]:void 0),_===null?(b=y?y.match(/stop-opacity:\s?([0-9.-]*)/):!1,_=b&&b.length>1?parseFloat(b[1]):1):_=parseFloat(_),h.push(new Ut(g,m,_))}const u=new Oe(s,o,a,l,h);return u.spread=r,u.units=n,Ot.call(this,e,u,t),u},radialgradient:function(e,t){let n=e.getAttribute("gradientUnits"),r=e.getAttribute("spreadMethod");n||(n="objectBoundingBox"),r||(r="pad");let s=parseFloat(e.getAttribute("cx"))||0,o=parseFloat(e.getAttribute("cy"))||0,a=parseFloat(e.getAttribute("r")),l=parseFloat(e.getAttribute("fx")),c=parseFloat(e.getAttribute("fy"));ae.isNaN(l)&&(l=s),ae.isNaN(c)&&(c=o);const d=Math.abs(s+l)/2,h=Math.abs(o+c)/2;/userSpaceOnUse/i.test(n)&&(s-=d,o-=h,l-=d,c-=h);const u=[];for(let p=0;p<e.children.length;p++){const g=e.children[p];let m=g.getAttribute("offset");/%/gi.test(m)&&(m=parseFloat(m.replace(/%/gi,""))/100),m=parseFloat(m);let _=g.getAttribute("stop-color"),y=g.getAttribute("stop-opacity"),b=g.getAttribute("style"),S;_===null&&(S=b?b.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,_=S&&S.length>1?S[1]:void 0),y===null?(S=b?b.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=S&&S.length>1?parseFloat(S[1]):1):y=parseFloat(y),u.push(new Ut(m,_,y))}const f=new Ve(s,o,a,u,l,c);return f.spread=r,f.units=n,Ot.call(this,e,f,t),f},text:function(e,t){const n=Ig(e.getAttribute("text-anchor"))||"left",r=Lg(e)||"baseline";let s="";e.childNodes.length>0&&e.childNodes[0].tagName==="TSPAN"?s=e.childNodes[0].textContent:s=e.textContent;const o=new At(s);return Ot.call(this,e,o,t),o.alignment=n,o.baseline=r,o},clippath:function(e,t){return Le.defs.current&&!Le.defs.current.contains(e.id)&&Le.defs.current.add(e.id,e),null},image:function(e,t){let n;const r=e.getAttribute("href")||e.getAttribute("xlink:href");if(!r)return n=new Ct("encountered <image /> with no href."),console.warn(n.name,n.message),null;const s=parseFloat(e.getAttribute("x"))||0,o=parseFloat(e.getAttribute("y"))||0,a=parseFloat(e.getAttribute("width")),l=parseFloat(e.getAttribute("height")),c=new Pr(r,s,o);return ae.isNaN(a)||(c.width=a),ae.isNaN(l)||(c.height=l),Ot.call(this,e,c,t),c}};function Fl(e,t){const n=new XMLHttpRequest;return n.open("GET",e),n.onreadystatechange=function(){n.readyState===4&&n.status===200&&t(n.responseText)},n.send(),n}var Bi=class extends En{constructor(e,t,n,r){super(t,n,0,0),w(this,"_flagTextures",!1),w(this,"_flagFrameRate",!1),w(this,"_flagIndex",!1),w(this,"_amount",1),w(this,"_duration",0),w(this,"_index",0),w(this,"_startTime",0),w(this,"_playing",!1),w(this,"_firstFrame",0),w(this,"_lastFrame",0),w(this,"_loop",!0),w(this,"_textures",null),w(this,"_frameRate",0),w(this,"_origin",null);for(let s in Ml)Object.defineProperty(this,s,Ml[s]);this._renderer.flagTextures=Yg.bind(this),this._renderer.bindTextures=Ug.bind(this),this._renderer.unbindTextures=Gg.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(Al.bind(this)):this.textures=[Al(e)],this.origin=new Z,this._update(),typeof r=="number"?this.frameRate=r:this.frameRate=Bi.DefaultFrameRate,this.index=0}static fromObject(e){const t=new Bi().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Bi.Properties.length;t++){const n=Bi.Properties[t];n in e&&(this[n]=e[n])}return this}play(e,t,n){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=ae.performance.now(),typeof e=="number"&&(this._firstFrame=e),typeof t=="number"&&(this._lastFrame=t),typeof n=="function"?this._onLastFrame=n: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 t=new Bi(this.textures,this.translation.x,this.translation.y,this.frameRate);return t._loop=this._loop,this._playing&&t.play(),e&&e.add(t),t}toObject(){const e=super.toObject.call(this);return e.textures=this.textures.map(function(t){return t.toObject()}),e.frameRate=this.frameRate,e.index=this.index,e.firstFrame=this.firstFrame,e.lastFrame=this.lastFrame,e.loop=this.loop,e}_update(){const e=this._textures;let t,n,r,s,o,a,l,c;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,ae.isNaN(this._lastFrame)&&(this._lastFrame=s-1),r=ae.performance.now()-this._startTime,c=this._lastFrame+1,o=1e3*(c-this._firstFrame)/this._frameRate,this._loop?r=r%o:r=Math.min(r,o),l=Et(this._firstFrame,c,r/o),l=Math.floor(l),l!==this._index&&(this._index=l,a=e[this._index],a.loaded&&(t=a.image.width,n=a.image.height,this.width!==t&&(this.width=t),this.height!==n&&(this.height=n),this.fill=a,l>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof Ee))&&(a=e[this._index],a.loaded&&(t=a.image.width,n=a.image.height,this.width!==t&&(this.width=t),this.height!==n&&(this.height=n)),this.fill=a)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}},zr=Bi;w(zr,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),w(zr,"DefaultFrameRate",30);var Ml={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(e){this._frameRate=e,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(e){this._index=e,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(e){const t=this._renderer.bindTextures,n=this._renderer.unbindTextures;this._textures&&this._textures.unbind(j.Types.insert,t).unbind(j.Types.remove,n),this._textures=new Bn((e||[]).slice(0)),this._textures.bind(j.Types.insert,t).bind(j.Types.remove,n),t(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(e){this._firstFrame=e}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(e){this._lastFrame=e}},loop:{enumerable:!0,get:function(){return this._loop},set:function(e){this._loop=!!e}}};function Yg(){this._flagTextures=!0}function Ug(e){let t=e.length;for(;t--;)e[t].bind(j.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Gg(e){let t=e.length;for(;t--;)e[t].unbind(j.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Al(e){if(e instanceof Ee)return e;if(typeof e=="string")return new Ee(e)}var Hs=[],Ws=Math.max,Kg=Math.min,Ol=Math.abs,Ir=Math.sin,Lr=Math.cos,Zg=Math.acos,Dr=Math.sqrt,Te={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},baselines:{top:"top",middle:"middle",bottom:"bottom",baseline:"alphabetic"},getRendererType:function(e){return e in Te?e:"path"},group:{renderChild:function(e){const t=Te.getRendererType(e._renderer.type);Te[t].render.call(e,this.ctx,!0,this.clip)},render:function(e){if(!this._visible)return this;this._update();const t=this._matrix.elements,n=this.parent;this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);const r=this._mask,s=Hr(t),o=!s||!!r;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=e,o&&(e.save(),s||e.transform(t[0],t[3],t[1],t[4],t[2],t[5])),r){const a=Te.getRendererType(r._renderer.type);Te[a].render.call(r,e,!0)}if(this._opacity>0&&this._scale!==0)for(let a=0;a<this.children.length;a++){const l=this.children[a],c=Te.getRendererType(l._renderer.type);Te[c].render.call(l,e)}return o&&e.restore(),this.flagReset()}},path:{render:function(e,t,n){let r,s,o,a,l,c,d,h,u,f,p,g,m,_,y,b,S,x,C,B,v,$,F,R,X,M,N,A,L,Y,P,E,H,I;if(I=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,L=this._mask,Y=this._clip,l=this._opacity*(I||1),c=this._visible,!t&&(!c||Y||l===0))return this;if(this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,d=this._cap,h=this._join,u=this._miter,f=this._closed,p=this._renderer.vertices,g=p.length,m=g-1,P=Hr(r),H=this.dashes,P||(e.save(),e.transform(r[0],r[3],r[1],r[4],r[2],r[5])),L){const ie=Te.getRendererType(L._renderer.type);Te[ie].render.call(L,e,!0)}if(a)if(typeof a=="string")e.fillStyle=a;else{const ie=Te.getRendererType(a._renderer.type);Te[ie].render.call(a,e,this),e.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")e.strokeStyle=s;else{const ie=Te.getRendererType(s._renderer.type);Te[ie].render.call(s,e,this),e.strokeStyle=s._renderer.effect}o&&(e.lineWidth=o),u&&(e.miterLimit=u),h&&(e.lineJoin=h),!f&&d&&(e.lineCap=d)}typeof l=="number"&&(e.globalAlpha=l),H&&H.length>0&&(e.lineDashOffset=H.offset||0,e.setLineDash(H)),e.beginPath();let U,O,z,J,pe,re,ge;for(let ie=0;ie<g;ie++)switch(b=p[ie],N=b.x,A=b.y,b.command){case ee.close:e.closePath();break;case ee.arc:U=b.rx,O=b.ry,z=b.xAxisRotation,J=b.largeArcFlag,pe=b.sweepFlag,_=f?$t(ie-1,g):Ws(ie-1,0),y=p[_],re=y.x,ge=y.y,Te.renderSvgArcCommand(e,re,ge,U,O,J,pe,z,N,A);break;case ee.curve:_=f?$t(ie-1,g):Math.max(ie-1,0),y=p[_],F=y.controls&&y.controls.right||Z.zero,R=b.controls&&b.controls.left||Z.zero,y._relative?(v=F.x+y.x,$=F.y+y.y):(v=F.x,$=F.y),b._relative?(C=R.x+b.x,B=R.y+b.y):(C=R.x,B=R.y),e.bezierCurveTo(v,$,C,B,N,A),ie>=m&&f&&(S=x,X=b.controls&&b.controls.right||Z.zero,M=S.controls&&S.controls.left||Z.zero,b._relative?(v=X.x+b.x,$=X.y+b.y):(v=X.x,$=X.y),S._relative?(C=M.x+S.x,B=M.y+S.y):(C=M.x,B=M.y),N=S.x,A=S.y,e.bezierCurveTo(v,$,C,B,N,A));break;case ee.line:e.lineTo(N,A);break;case ee.move:x=b,e.moveTo(N,A);break}return f&&e.closePath(),!Y&&!n&&(Te.isHidden.test(a)||(E=a._renderer&&a._renderer.offset,E&&(e.save(),e.translate(-a._renderer.offset.x,-a._renderer.offset.y),e.scale(a._renderer.scale.x,a._renderer.scale.y)),e.fill(),E&&e.restore()),Te.isHidden.test(s)||(E=s._renderer&&s._renderer.offset,E&&(e.save(),e.translate(-s._renderer.offset.x,-s._renderer.offset.y),e.scale(s._renderer.scale.x,s._renderer.scale.y),e.lineWidth=o/s._renderer.scale.x),e.stroke(),E&&e.restore())),P||e.restore(),Y&&!n&&e.clip(),H&&H.length>0&&e.setLineDash(Hs),this.flagReset()}},points:{render:function(e,t,n){let r,s,o,a,l,c,d,h,u,f,p,g,m,_,y,b;if(b=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,l=this._opacity*(b||1),c=this._visible,!t&&(!c||l===0))return this;if(this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,h=this._renderer.collection,u=h.length,m=Hr(r),y=this.dashes,d=this._size,m||(e.save(),e.transform(r[0],r[3],r[1],r[4],r[2],r[5])),a)if(typeof a=="string")e.fillStyle=a;else{const C=Te.getRendererType(a._renderer.type);Te[C].render.call(a,e,this),e.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")e.strokeStyle=s;else{const C=Te.getRendererType(s._renderer.type);Te[C].render.call(s,e,this),e.strokeStyle=s._renderer.effect}o&&(e.lineWidth=o)}typeof l=="number"&&(e.globalAlpha=l),y&&y.length>0&&(e.lineDashOffset=y.offset||0,e.setLineDash(y)),e.beginPath();let S=d*.5,x;this._sizeAttenuation||(x=this.worldMatrix.elements,x=wi(x[0],x[3],x[1],x[4],x[2],x[5]),S/=Math.max(x.scaleX,x.scaleY));for(let C=0;C<u;C++)f=h[C],p=f.x,g=f.y,e.moveTo(p+S,g),e.arc(p,g,S,0,ot);return n||(Te.isHidden.test(a)||(_=a._renderer&&a._renderer.offset,_&&(e.save(),e.translate(-a._renderer.offset.x,-a._renderer.offset.y),e.scale(a._renderer.scale.x,a._renderer.scale.y)),e.fill(),_&&e.restore()),Te.isHidden.test(s)||(_=s._renderer&&s._renderer.offset,_&&(e.save(),e.translate(-s._renderer.offset.x,-s._renderer.offset.y),e.scale(s._renderer.scale.x,s._renderer.scale.y),e.lineWidth=o/s._renderer.scale.x),e.stroke(),_&&e.restore())),m||e.restore(),y&&y.length>0&&e.setLineDash(Hs),this.flagReset()}},text:{render:function(e,t,n){const r=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,s=this._opacity*r,o=this._visible,a=this._mask,l=this._clip;if(!t&&(!o||l||s===0))return this;this._update();const c=this._matrix.elements,d=this._stroke,h=this._linewidth,u=this._fill,f=this._decoration,p=this._direction,g=Hr(c),m=u._renderer&&u._renderer.offset&&d._renderer&&d._renderer.offset,_=this.dashes,y=Te.alignments[this._alignment]||this._alignment,b=Te.baselines[this._baseline]||this._baseline;let S,x,C,B,v,$,F,R,X,M,N;if(g||(e.save(),e.transform(c[0],c[3],c[1],c[4],c[2],c[5])),a){const A=Te.getRendererType(a._renderer.type);Te[A].render.call(a,e,!0)}if(m||(e.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),e.textAlign=y,e.textBaseline=b,e.direction=p,u)if(typeof u=="string")e.fillStyle=u;else{const A=Te.getRendererType(u._renderer.type);Te[A].render.call(u,e,this),e.fillStyle=u._renderer.effect}if(d){if(typeof d=="string")e.strokeStyle=d;else{const A=Te.getRendererType(d._renderer.type);Te[A].render.call(d,e,this),e.strokeStyle=d._renderer.effect}h&&(e.lineWidth=h)}if(typeof s=="number"&&(e.globalAlpha=s),_&&_.length>0&&(e.lineDashOffset=_.offset||0,e.setLineDash(_)),!l&&!n&&(Te.isHidden.test(u)||(u._renderer&&u._renderer.offset?($=u._renderer.scale.x,F=u._renderer.scale.y,e.save(),e.translate(-u._renderer.offset.x,-u._renderer.offset.y),e.scale($,F),S=this._size/u._renderer.scale.y,x=this._leading/u._renderer.scale.y,e.font=[this._style,this._weight,S+"px/",x+"px",this._family].join(" "),C=u._renderer.offset.x/u._renderer.scale.x,B=u._renderer.offset.y/u._renderer.scale.y,e.fillText(this.value,C,B),e.restore()):e.fillText(this.value,0,0)),Te.isHidden.test(d)||(d._renderer&&d._renderer.offset?($=d._renderer.scale.x,F=d._renderer.scale.y,e.save(),e.translate(-d._renderer.offset.x,-d._renderer.offset.y),e.scale($,F),S=this._size/d._renderer.scale.y,x=this._leading/d._renderer.scale.y,e.font=[this._style,this._weight,S+"px/",x+"px",this._family].join(" "),C=d._renderer.offset.x/d._renderer.scale.x,B=d._renderer.offset.y/d._renderer.scale.y,v=h/d._renderer.scale.x,e.lineWidth=v,e.strokeText(this.value,C,B),e.restore()):e.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(f)){const A=e.measureText(this.value);let L=1;switch(f){case"underline":X=A.actualBoundingBoxDescent,N=A.actualBoundingBoxDescent;break;case"strikethrough":X=0,N=0,L=.5;break}switch(b){case"top":X+=this._size*L,N+=this._size*L;break;case"baseline":case"bottom":X-=this._size*L,N-=this._size*L;break}switch(y){case"left":case"start":R=0,M=A.width;break;case"right":case"end":R=-A.width,M=0;break;default:R=-A.width/2,M=A.width/2}e.lineWidth=Math.max(Math.floor(this._size/15),1),e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(R,X),e.lineTo(M,N),e.stroke()}return g||e.restore(),l&&!n&&e.clip(),_&&_.length>0&&e.setLineDash(Hs),this.flagReset()}},"linear-gradient":{render:function(e,t){if(t){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let n,r=this.left._x,s=this.left._y,o=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(n=t.getBoundingClientRect(!0),r=(r-.5)*n.width,s=(s-.5)*n.height,o=(o-.5)*n.width,a=(a-.5)*n.height),this._renderer.effect=e.createLinearGradient(r,s,o,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return this.flagReset()}}},"radial-gradient":{render:function(e,t){if(t){if(this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let n,r=this.center._x,s=this.center._y,o=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(n=t.getBoundingClientRect(!0),r=(r-.5)*n.width*.5,s=(s-.5)*n.height*.5,o=(o-.5)*n.width*.5,a=(a-.5)*n.height*.5,l*=Math.min(n.width,n.height)),this._renderer.effect=e.createRadialGradient(r,s,0,o,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 this.flagReset()}}},texture:{render:function(e){this._update();const t=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=e.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof Z||(this._renderer.offset=new Z),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,t&&(this._renderer.offset.x+=t.width/2,this._renderer.offset.y+=t.height/2,this._scale instanceof Z?(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 Z||(this._renderer.scale=new Z),this._scale instanceof Z?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),this.flagReset()}},renderSvgArcCommand:function(e,t,n,r,s,o,a,l,c,d){l=l*Math.PI/180,r=Ol(r),s=Ol(s);const h=(t-c)/2,u=(n-d)/2,f=Lr(l)*h+Ir(l)*u,p=-Ir(l)*h+Lr(l)*u,g=f*f,m=p*p;let _=r*r,y=s*s;const b=g/_+m/y;if(b>1){const A=Dr(b);r=A*r,s=A*s,_=r*r,y=s*s}const S=_*m+y*g,x=(_*y-S)/S;let C=Dr(Ws(0,x));o===a&&(C=-C);const B=C*r*p/s,v=-C*s*f/r,$=Lr(l)*B-Ir(l)*v+(t+c)/2,F=Ir(l)*B+Lr(l)*v+(n+d)/2,R=Vl(1,0,(f-B)/r,(p-v)/s),X=Vl((f-B)/r,(p-v)/s,(-f-B)/r,(-p-v)/s)%ot,M=R+X;Jg(e,$,F,r,s,R,M,a===0,l)}},lt=class extends j{constructor(e){super();const t=e.smoothing!==!1;this.domElement=e.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=e.overdraw||!1,typeof this.ctx.imageSmoothingEnabled<"u"&&(this.ctx.imageSmoothingEnabled=t),this.scene=new Ge,this.scene.parent=this}setSize(e,t,n){return this.width=e,this.height=t,this.ratio=typeof n>"u"?Rs(this.ctx):n,this.domElement.width=e*this.ratio,this.domElement.height=t*this.ratio,this.domElement.style&&ae.extend(this.domElement.style,{width:e+"px",height:t+"px"}),this.trigger(j.Types.resize,e,t,n)}render(){const e=this.ratio===1;return e||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),Te.group.render.call(this.scene,this.ctx),e||this.ctx.restore(),this}};w(lt,"Utils",Te);function Jg(e,t,n,r,s,o,a,l,c){const d=a-o,h=vi.Tolerance.epsilon,u=Math.abs(d)<h;let f=$t(d,ot);f<h&&(u?f=0:f=ot),l===!0&&!u&&(f===ot?f=-ot:f=f-ot);for(let p=0;p<mt.Resolution;p++){const g=p/(mt.Resolution-1),m=o+g*f;let _=t+r*Math.cos(m),y=n+s*Math.sin(m);if(c!==0){const b=Math.cos(c),S=Math.sin(c),x=_-t,C=y-n;_=x*b-C*S+t,y=x*S+C*b+n}e.lineTo(_,y)}}function Vl(e,t,n,r){const s=e*n+t*r,o=Dr(e*e+t*t)*Dr(n*n+r*r);let a=Zg(Ws(-1,Kg(1,s/o)));return e*r-t*n<0&&(a=-a),a}function Hr(e){return e[0]==1&&e[3]==0&&e[1]==0&&e[4]==1&&e[2]==0&&e[5]==0}var se={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(e,t){const n=e,r=document.createElementNS(se.ns,n);return n==="svg"&&(t=ae.defaults(t||{},{version:se.version})),t&&Object.keys(t).length>0&&se.setAttributes(r,t),r},setAttributes:function(e,t){const n=Object.keys(t);for(let r=0;r<n.length;r++)/href/.test(n[r])?e.setAttributeNS(se.xlink,n[r],t[n[r]]):e.setAttribute(n[r],t[n[r]]);return this},removeAttributes:function(e,t){for(let n in t)e.removeAttribute(n);return this},toString:function(e,t){let n=e.length,r=n-1,s,o="";for(let a=0;a<n;a++){const l=e[a],c=t?$t(a-1,n):Math.max(a-1,0),d=e[c];let h,u,f,p,g,m,_,y,b,S,x,C,B,v,$,F=Pe(l.x),R=Pe(l.y);switch(l.command){case ee.close:h=ee.close;break;case ee.arc:x=l.rx,C=l.ry,B=l.xAxisRotation,v=l.largeArcFlag,$=l.sweepFlag,h=ee.arc+" "+x+" "+C+" "+B+" "+v+" "+$+" "+F+" "+R;break;case ee.curve:_=d.controls&&d.controls.right||Z.zero,y=l.controls&&l.controls.left||Z.zero,d.relative?(f=Pe(_.x+d.x),p=Pe(_.y+d.y)):(f=Pe(_.x),p=Pe(_.y)),l.relative?(g=Pe(y.x+l.x),m=Pe(y.y+l.y)):(g=Pe(y.x),m=Pe(y.y)),h=(a===0?ee.move:ee.curve)+" "+f+" "+p+" "+g+" "+m+" "+F+" "+R;break;case ee.move:s=l,h=ee.move+" "+F+" "+R;break;default:h=l.command+" "+F+" "+R}a>=r&&t&&(l.command===ee.curve&&(u=s,b=l.controls&&l.controls.right||l,S=u.controls&&u.controls.left||u,l.relative?(f=Pe(b.x+l.x),p=Pe(b.y+l.y)):(f=Pe(b.x),p=Pe(b.y)),u.relative?(g=Pe(S.x+u.x),m=Pe(S.y+u.y)):(g=Pe(S.x),m=Pe(S.y)),F=Pe(u.x),R=Pe(u.y),h+=" C "+f+" "+p+" "+g+" "+m+" "+F+" "+R),l.command!==ee.close&&(h+=" Z")),o+=h+" "}return o},pointsToString:function(e,t){let n="";const r=t*.5;for(let s=0;s<e.length;s++){const o=e[s].x,a=e[s].y-r;n+=ee.move+" "+o+" "+a+" ",n+="a "+r+" "+r+" 0 1 0 0.001 0 Z"}return n},getClip:function(e,t){let n=e._renderer.clip;return n||(n=e._renderer.clip=se.createElement("clipPath",{"clip-rule":"nonzero"})),n.parentNode===null&&t.defs.appendChild(n),n},getRendererType:function(e){return e in se?e:"path"},defs:{update:function(e){const{defs:t}=e;if(t._flagUpdate){const n=Array.prototype.slice.call(t.children,0);for(let r=0;r<n.length;r++){const s=n[r],o=s.id,a=`[fill="url(#${o})"],[stroke="url(#${o})"],[clip-path="url(#${o})"]`;e.querySelector(a)||t.removeChild(s)}t._flagUpdate=!1}}},group:{appendChild:function(e){const t=e._renderer.elem;if(!t)return;const n=t.nodeName;!n||/(radial|linear)gradient/i.test(n)||e._clip||this.elem.appendChild(t)},removeChild:function(e){const t=e._renderer.elem;!t||t.parentNode!=this.elem||!t.nodeName||e._clip||this.elem.removeChild(t)},orderChild:function(e){this.elem.appendChild(e._renderer.elem)},renderChild:function(e){const t=se.getRendererType(e._renderer.type);se[t].render.call(e,this)},render:function(e){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;this._update(),this._renderer.elem||(this._renderer.elem=se.createElement("g",{id:this.id}),e.appendChild(this._renderer.elem));const t=this._matrix.manual||this._flagMatrix,n={domElement:e,elem:this._renderer.elem};t&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(let r=0;r<this.children.length;r++){const s=this.children[r],o=se.getRendererType(s._renderer.type);se[o].render.call(s,e)}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(se.group.appendChild,n),this._flagSubtractions&&this.subtractions.forEach(se.group.removeChild,n),this._flagOrder&&this.children.forEach(se.group.orderChild,n),this._flagMask)if(this._mask){const r=se.getRendererType(this._mask._renderer.type);se[r].render.call(this._mask,e),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),this.flagReset()}},path:{render:function(e){if(this._opacity===0&&!this._flagOpacity)return this;this._update();const t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagVertices){const r=se.toString(this._renderer.vertices,this._closed);t.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=se.getRendererType(this._fill._renderer.type);se[r].render.call(this._fill,e,!0)}if(this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=se.getRendererType(this._stroke._renderer.type);se[r].render.call(this._stroke,e,!0)}if(this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this._flagCap&&(t["stroke-linecap"]=this._cap),this._flagJoin&&(t["stroke-linejoin"]=this._join),this._flagMiter&&(t["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?se.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=se.createElement("path",t),e.appendChild(this._renderer.elem)),this._flagClip){const r=se.getClip(this,e),s=this._renderer.elem;this._clip?(s.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(s)):(r.removeAttribute("id"),s.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(s))}if(this._flagMask)if(this._mask){const r=se.getRendererType(this._mask._renderer.type);se[r].render.call(this._mask,e),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return this.flagReset()}},points:{render:function(e){if(this._opacity===0&&!this._flagOpacity)return this;this._update();const t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){let r=this._size;if(!this._sizeAttenuation){const o=this.worldMatrix.elements,a=wi(o[0],o[3],o[1],o[4],o[2],o[5]);r/=Math.max(a.scaleX,a.scaleY)}const s=se.pointsToString(this._renderer.collection,r);t.d=s}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=se.getRendererType(this._fill._renderer.type);se[r].render.call(this._fill,e,!0)}if(this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=se.getRendererType(this._stroke._renderer.type);se[r].render.call(this._stroke,e,!0)}return this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?se.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=se.createElement("path",t),e.appendChild(this._renderer.elem)),this.flagReset()}},text:{render:function(e){this._update();const t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagFamily&&(t["font-family"]=this._family),this._flagSize&&(t["font-size"]=this._size),this._flagLeading&&(t["line-height"]=this._leading),this._flagAlignment&&(t["text-anchor"]=se.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["dominant-baseline"]=se.baselines[this._baseline]||this._baseline),this._flagStyle&&(t["font-style"]=this._style),this._flagWeight&&(t["font-weight"]=this._weight),this._flagDecoration&&(t["text-decoration"]=this._decoration),this._flagDirection&&(t.direction=this._direction),this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=se.getRendererType(this._fill._renderer.type);se[r].render.call(this._fill,e,!0)}if(this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill,this._renderer.hasFillEffect&&typeof this._fill.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasFillEffect)),this._stroke&&this._stroke._renderer){this._renderer.hasStrokeEffect=!0,this._stroke._update();const r=se.getRendererType(this._stroke._renderer.type);se[r].render.call(this._stroke,e,!0)}if(this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke,this._renderer.hasStrokeEffect&&typeof this._stroke.id>"u"&&(e.defs._flagUpdate=!0,delete this._renderer.hasStrokeEffect)),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t.opacity=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?se.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=se.createElement("text",t),e.appendChild(this._renderer.elem)),this._flagClip){const r=se.getClip(this,e),s=this._renderer.elem;this._clip?(s.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(s)):(r.removeAttribute("id"),s.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(s))}if(this._flagMask)if(this._mask){const r=se.getRendererType(this._mask._renderer.type);se[r].render.call(this._mask,e),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(e,t){t||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?se.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=se.createElement("linearGradient",n)),this._renderer.elem.parentNode===null&&e.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 s=0;s<this.stops.length;s++){const o=this.stops[s],a={};o._flagOffset&&(a.offset=100*o._offset+"%"),o._flagColor&&(a["stop-color"]=o._color),o._flagOpacity&&(a["stop-opacity"]=o._opacity),o._renderer.elem?se.setAttributes(o._renderer.elem,a):o._renderer.elem=se.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return this.flagReset()}},"radial-gradient":{render:function(e,t){t||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?se.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=se.createElement("radialGradient",n)),this._renderer.elem.parentNode===null&&e.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 s=0;s<this.stops.length;s++){const o=this.stops[s],a={};o._flagOffset&&(a.offset=100*o._offset+"%"),o._flagColor&&(a["stop-color"]=o._color),o._flagOpacity&&(a["stop-opacity"]=o._opacity),o._renderer.elem?se.setAttributes(o._renderer.elem,a):o._renderer.elem=se.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return this.flagReset()}},texture:{render:function(e,t){t||this._update();const n={},r={x:0,y:0},s=this.image;if(this._flagId&&(n.id=this._id),this._flagLoaded&&this.loaded)switch(s.nodeName.toLowerCase()){case"canvas":r.href=r["xlink:href"]=s.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,s&&(n.x-=s.width/2,n.y-=s.height/2,this._scale instanceof Z?(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,s)){switch(n.width=s.width,n.height=s.height,this._repeat){case"no-repeat":n.width+=1,n.height+=1;break}this._scale instanceof Z?(n.width*=this._scale.x,n.height*=this._scale.y):(n.width*=this._scale,n.height*=this._scale),r.width=n.width,r.height=n.height}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?se.setAttributes(this._renderer.image,r):this._renderer.image=se.createElement("image",r)),this._renderer.elem?Object.keys(n).length!==0&&se.setAttributes(this._renderer.elem,n):(n.id=this._id,n.patternUnits="userSpaceOnUse",this._renderer.elem=se.createElement("pattern",n)),this._renderer.elem.parentNode===null&&e.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),this.flagReset()}}},zl=class extends j{constructor(e){super(),this.domElement=e.domElement||se.createElement("svg"),this.scene=new Ge,this.scene.parent=this,this.defs=se.createElement("defs"),this.defs._flagUpdate=!1,this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}setSize(e,t){return this.width=e,this.height=t,se.setAttributes(this.domElement,{width:e,height:t}),this.trigger(j.Types.resize,e,t)}render(){return se.group.render.call(this.scene,this.domElement),se.defs.update(this.domElement),this}};w(zl,"Utils",se);var Vt={create:function(e,t,n){const r=e.createShader(e[n]);if(e.shaderSource(r,t),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS)){const o=e.getShaderInfoLog(r);throw e.deleteShader(r),new Ct("unable to compile shader "+r+": "+o)}return r},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:`
41
41
  precision mediump float;
42
42
  attribute vec2 a_position;
43
43