@snabcentr/vue-ui-lib 2.29.2 → 2.29.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/manifest.json +1 -1
- package/dist/release_notes.tmp +3 -3
- package/dist/sc-vue-ui-lib.js +308 -300
- package/dist/sc-vue-ui-lib.js.map +1 -1
- package/dist/sc-vue-ui-lib.umd.cjs +2 -2
- package/dist/sc-vue-ui-lib.umd.cjs.map +1 -1
- package/dist/src/components/files/single-file-upload-selector.vue.d.ts +10 -2
- package/dist/src/components/inline/inline-view.vue.d.ts +1 -1
- package/package.json +1 -1
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
38
38
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
39
39
|
PERFORMANCE OF THIS SOFTWARE.
|
|
40
|
-
***************************************************************************** */var Br=function(){return Br=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},Br.apply(this,arguments)},Uu={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"}},gn={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},Rs=500,Gu=function(){function e(t,n){return this.core=t,this.$LG=n,this.settings=Br(Br({},Uu),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(gn.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 p=this.getPossibleSwipeDragCords(n),f,g,m=o-this.pageX,y=a-this.pageY;if(t-n>1){var _=(t-n)/Math.abs(n);m=(n<0?-m:m)+this.left*(_+(n<0?-1:1)),y=(n<0?-y:y)+this.top*(_+(n<0?-1:1)),f=m/_,g=y/_}else{var _=(t-n)*n;f=m*_,g=y*_}r&&(u?this.isBeyondPossibleLeft(f,p.minX)?f=p.minX:this.isBeyondPossibleRight(f,p.maxX)&&(f=p.maxX):t>1&&(f<p.minX?f=p.minX:f>p.maxX&&(f=p.maxX)),h?this.isBeyondPossibleTop(g,p.minY)?g=p.minY:this.isBeyondPossibleBottom(g,p.maxY)&&(g=p.maxY):t>1&&(g<p.minY?g=p.minY:g>p.maxY&&(g=p.maxY))),this.setZoomStyles({x:f,y:g,scale:t}),this.left=f,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)},Rs),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")}},Rs+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},Rs+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(gn.containerResize+".zoom "+gn.rotateRight+".zoom "+gn.rotateLeft+".zoom "+gn.flipHorizontal+".zoom "+gn.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(gn.beforeOpen+".zoom",function(){t.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(gn.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(gn.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 p=this.getPossibleSwipeDragCords();(Math.abs(a)>15||Math.abs(l)>15)&&(s&&(this.isBeyondPossibleTop(u.y,p.minY)?u.y=p.minY:this.isBeyondPossibleBottom(u.y,p.maxY)&&(u.y=p.maxY)),r&&(this.isBeyondPossibleLeft(u.x,p.minX)?u.x=p.minX:this.isBeyondPossibleRight(u.x,p.maxX)&&(u.x=p.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(p){if(t.isImageSlide(t.core.index)&&(u=t.core.getSlideItem(t.core.index),(t.$LG(p.target).hasClass("lg-item")||u.get().contains(p.target))&&p.touches.length===1&&t.core.outer.hasClass("lg-zoomed"))){p.preventDefault(),l=new Date,t.core.touchAction="zoomSwipe",h=t.core.getSlideItem(t.core.index).find(".lg-img-wrap").first();var f=t.getDragAllowedAxises(0);a=f.allowY,o=f.allowX,(o||a)&&(n=t.getSwipeCords(p)),d=t.getPossibleSwipeDragCords(),t.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(p){if(p.touches.length===1&&t.core.touchAction==="zoomSwipe"&&(t.$LG(p.target).hasClass("lg-item")||u.get().contains(p.target))){p.preventDefault(),t.core.touchAction="zoomSwipe",r=t.getSwipeCords(p);var f=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,f))}}),this.core.$inner.on("touchend.lg",function(p){if(t.core.touchAction==="zoomSwipe"&&(t.$LG(p.target).hasClass("lg-item")||u.get().contains(p.target))){if(p.preventDefault(),t.core.touchAction=void 0,t.core.outer.removeClass("lg-zoom-dragging"),!s)return;s=!1,c=new Date;var f=c.valueOf()-l.valueOf();t.touchendZoom(n,r,o,a,f)}})},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(p){if(t.isImageSlide(t.core.index)){var f=t.core.getSlideItem(t.core.index);if(t.$LG(p.target).hasClass("lg-item")||f.get().contains(p.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(p.target).hasClass("lg-object")&&(a||l)&&(p.preventDefault(),n=t.getDragCords(p),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(p){if(s){o=!0,r=t.getDragCords(p);var f=t.getZoomSwipeCords(n,r,a,l,h);t.setZoomSwipeStyles(u,f)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(p){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(p);var f=d.valueOf()-c.valueOf();t.touchendZoom(n,r,a,l,f)}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 Ku={ref:"gallery-container",class:"lightgallery-wrapper"},Zu={},ka=i.defineComponent({...Zu,__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}),D.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",Ku,[i.renderSlot(o.$slots,"default")],512))}}),st=class st{static init(){st.isInitialized||(st.isInitialized=!0,st.windowResizeHandler(),window.addEventListener("resize",st.windowResizeHandler))}static destroy(){window.removeEventListener("resize",st.windowResizeHandler),st.isInitialized=!1}static getDeviceTypeByResolution(){const t=Y.AppConfigProvider.getConfig().deviceTypeByResolution;return window.innerWidth<t.tablet?Xe.phone:window.innerWidth<t.laptop?Xe.tablet:Xe.laptop}static initRefDependingOnDeviceResolution(t,n,r){const s=i.ref(r);return st.setRefValueDependingOnDeviceResolution(s,t,n,r),st.refsDependingOnDeviceResolution.push({r:s,phoneValue:t,tabletValue:n,defaultValue:r}),s}static isPhoneDevice(){return st.getDeviceTypeByResolution()===Xe.phone}static isTabletDevice(){return st.getDeviceTypeByResolution()===Xe.tablet}static isLaptopDevice(){return st.getDeviceTypeByResolution()===Xe.laptop}static setRefValueDependingOnDeviceResolution(t,n,r,s){switch(st.getDeviceTypeByResolution()){case Xe.phone:t.value=n;break;case Xe.tablet:t.value=r;break;default:t.value=s;break}}static windowResizeHandler(){D.forEach(st.refsDependingOnDeviceResolution,t=>{st.setRefValueDependingOnDeviceResolution(t.r,t.phoneValue,t.tabletValue,t.defaultValue)})}};C(st,"isInitialized",!1),C(st,"refsDependingOnDeviceResolution",[]);let bt=st;const Ju=["href"],Qu=["src","alt"],ef={},xa=i.defineComponent({...ef,__name:"image-gallery",props:{images:{}},setup(e,{expose:t}){const n=i.ref(!1),r=i.ref(!1),s=i.ref({plugins:[Yu,Gu],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),o=()=>window.innerWidth*(bt.getDeviceTypeByResolution()===Xe.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=va,p=I.NPopover;return i.openBlock(),i.createBlock(p,{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]=f=>n.value=!n.value)},[i.renderSlot(d.$slots,"default",{},()=>[i.createVNode(u)])])]),default:i.withCtx(()=>[i.createVNode(ka,{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,(f,g)=>(i.openBlock(),i.createElementBlock("a",{key:g,href:f.image},[i.createElementVNode("img",{src:f.preview,alt:`Изображение #${g+1}`},null,8,Qu)],8,Ju))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),tf={class:"flex flex-col text-sm"},nf={},rf=i.defineComponent({...nf,__name:"product-stock-count",props:{product:{}},setup(e){return(t,n)=>{const r=Es,s=I.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",tf,[(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})}}}),sf={class:"flex flex-row justify-between"},of={key:0},af={class:"ml-2 align-sub"},lf={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},cf={class:"@container"},df={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},hf={key:0,class:"sc-supplier-sku col-span-2 whitespace-nowrap text-wrap sm:col-span-3"},uf={class:"text-sc-dark-grey"},ff={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},pf={class:"text-gray-600"},gf={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},mf={key:3,class:"underline decoration-dashed"},yf={key:4,class:"sc-product-pack whitespace-nowrap"},_f={class:"text-gray-600"},bf={key:5,class:"sc-product-planning-incoming-date col-span-2 col-start-1 mt-1.5 text-wrap"},wf={class:"text-gray-600"},vf={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},kf={key:0},xf={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},Cf={},Yi=i.defineComponent({...Cf,__name:"product-name",props:{product:{},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showCode:{type:Boolean,default:!0},showProductCosts:{type:[Boolean,Function],default:!1},showPlanningDates:{type:Boolean,default:!0},showPriceHistory:{type:Boolean,default:!1},showCostDate:{type:Boolean,default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},currencyRates:{default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(e,{expose:t}){const n=e,r=i.computed(()=>D.isFunction(n.showProductCosts)?n.showProductCosts(n.product):n.showProductCosts),s=i.computed(()=>D.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(()=>D.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 _,b,S,x,v;const p=va,f=I.NText,g=wa,m=Es,y=I.NScrollbar;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",sf,[i.createVNode(f,{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",of," [Под заказ] ")):i.createCommentVNode("",!0),i.createElementVNode("span",af,[h.product.images&&h.product.images.length>0?(i.openBlock(),i.createBlock(xa,{key:0,ref:"image-gallery",images:h.product.images},{default:i.withCtx(()=>[i.createElementVNode("div",lf,[i.createVNode(p)])]),_:1},8,["images"])):i.createCommentVNode("",!0)])]),_:1}),h.showProductAddToCartButton||h.showProductEditButton||h.showProductRequiredButton||((_=h.productContextButtonsConfig)==null?void 0:_.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,"show-product-required-button":h.showProductRequiredButton,"product-context-buttons-config":h.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","show-product-required-button","product-context-buttons-config"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",cf,[i.createElementVNode("div",df,[h.product.supplierSku?(i.openBlock(),i.createElementBlock("div",hf,[u[0]||(u[0]=i.createTextVNode(" Артикул производителя/поставщика: ",-1)),i.createElementVNode("span",uf,i.toDisplayString(h.product.supplierSku),1)])):i.createCommentVNode("",!0),h.showCode?(i.openBlock(),i.createElementBlock("span",ff,[u[1]||(u[1]=i.createTextVNode(" Артикул: ",-1)),i.createElementVNode("span",pf,i.toDisplayString(h.product.code),1)])):i.createCommentVNode("",!0),h.product.stockCount&&h.product.stockCount.length>0?(i.openBlock(),i.createBlock(rf,{key:2,product:h.product},{default:i.withCtx(()=>[i.createElementVNode("span",gf,[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",mf," Нет в наличии ")),(S=(b=h.product)==null?void 0:b.properties)!=null&&S.pack?(i.openBlock(),i.createElementBlock("span",yf,[u[3]||(u[3]=i.createTextVNode(" Норма упаковки: ",-1)),i.createElementVNode("span",_f,i.toDisplayString((v=(x=h.product)==null?void 0:x.properties)==null?void 0:v.pack),1)])):i.createCommentVNode("",!0),h.showPlanningDates&&o.value?(i.openBlock(),i.createElementBlock("span",bf,[u[4]||(u[4]=i.createTextVNode(" Планируемая дата поступления на основной склад: ",-1)),i.createElementVNode("span",wf,i.toDisplayString(o.value),1)])):i.createCommentVNode("",!0)])]),i.createVNode(y,{"x-scrollable":""},{default:i.withCtx(()=>[r.value?(i.openBlock(),i.createElementBlock("div",vf,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,B=>(i.openBlock(),i.createBlock(Cr,{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,"show-cost-date":h.showCostDate,"currency-rates":h.currencyRates},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history","show-cost-date","currency-rates"]))),128)),i.createVNode(Cr,{product:h.product,"event-emitter":h.eventEmitter,"allow-price-click":h.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":h.showCostDate,"show-price-history":h.showPriceHistory,"currency-rates":h.currencyRates,"cost-field-name":"cost","additional-through-field-name":"retailCost",style:{"background-color":"var(--n-merged-td-color)"},class:"sticky right-0 border-0 border-l-2 border-solid border-gray-300 pl-2"},null,8,["product","event-emitter","allow-price-click","show-cost-date","show-price-history","currency-rates"])])):i.createCommentVNode("",!0)]),_:1}),h.showSlugs||h.showProperties?(i.openBlock(),i.createElementBlock("div",kf,[i.createElementVNode("ul",xf,[h.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:h.product.id,slug:h.product.slug},(B,k)=>(i.openBlock(),i.createElementBlock("li",{key:k}," ("+i.toDisplayString(k)+"): "+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,k)=>(i.openBlock(),i.createElementBlock("li",{key:k}," ("+i.toDisplayString(k)+"): "+i.toDisplayString(B),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)])}}}),Sf=(e,t,n)=>({key:e,title:t,className:"align-top",resizable:!0,render:r=>i.h(Cr,{product:r,costFieldName:e,eventEmitter:n.eventEmitter,allowPriceClick:n.allowPriceClick,currencyRates:n.currencyRates})}),Bf=(e,t)=>{if(e.length===0)return[];const n=[],r={};switch(D.isNil(t.isProductItemSelected)||n.push({key:"checkbox",title:"",className:"align-top",width:"32",render:s=>{var o,a;return i.h(I.NCheckbox,{checked:!!((o=t.isProductItemSelected)!=null&&o.call(t,s)),disabled:((a=t.isProductItemSelected)==null?void 0:a.call(t,s))==="disabled",onUpdateChecked:l=>{t.eventEmitter.emit("product:checked",{product:s,checked:l})}})}}),bt.getDeviceTypeByResolution()){case Xe.phone:case Xe.tablet:n.push({key:"name",title:"Наименование",className:"align-top",render:s=>i.h(Yi,{product:s,eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,showProductCosts:t.showProductCosts,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,showCostDate:t.showCostDate,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,showProductRequiredButton:t.showProductRequiredButton,currencyRates:t.currencyRates,productContextButtonsConfig:t.productContextButtonsConfig})});break;default:n.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:s=>i.h(Yi,{product:s,eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,showCostDate:t.showCostDate,currencyRates:t.currencyRates})}),t.showProductCosts&&(D.forEach(e,s=>{D.forEach(s.priceCoefficients,o=>{r[o.coefficient.slug??""]||(r[o.coefficient.slug??""]=o.coefficient)})}),D.forEach(D.sortBy(r,["slug"]),s=>{n.push(Sf(s.slug??"",s.name,t))}),n.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:s=>i.h(Cr,{product:s,costFieldName:"cost",additionalThroughFieldName:"retailCost",eventEmitter:t.eventEmitter,allowPriceClick:t.allowPriceClick,showQuantityUnit:!0,showPriceHistory:t.showPriceHistory,showCostDate:t.showCostDate,currencyRates:t.currencyRates})})),(t.showProductEditButton||t.showProductRequiredButton||t.showProductAddToCartButton||!D.isNil(t.productContextButtonsConfig))&&n.push({key:"actions",title:"",className:"align-top",width:"50",render:s=>i.h(wa,{product:s,eventEmitter:t.eventEmitter,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,showProductRequiredButton:t.showProductRequiredButton,productContextButtonsConfig:t.productContextButtonsConfig})});break}return n},Tf={key:0,class:"pt-0.5"},Ef={key:0},Rf={class:"line-through"},$f={key:0},Nf={key:1},Pf={class:"flex flex-row gap-1"},Ff={key:0},Mf={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},Af={class:"flex flex-col-reverse gap-2.5 sm:flex-row"},Vf={},If=i.defineComponent({...Vf,__name:"category-collapse-item",props:{categoryItem:{},filteredItems:{},isCategoryItemSelected:{type:Function,default:void 0},showCategoryHideForClientButton:{type:[Boolean,String,Function],default:!1},showCategoryRequiredButton:{type:[Boolean,String,Function],default:!1},showCategoryPinButton:{type:[Boolean,String,Function],default:!1},showCategoryEditButton:{type:[Boolean,String,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},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{type:Function,default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(e){const t=e,n=i.inject(xr,"medium"),r=i.computed(()=>{var $;return($=t==null?void 0:t.filteredItems)==null?void 0:$[t.categoryItem.id]}),s=i.computed(()=>{var $,M;return D.isArray(($=t.categoryItem)==null?void 0:$.categories)&&((M=t.categoryItem.categories)==null?void 0:M.length)>0}),o=i.computed(()=>{var $;return D.isArray(($=t.categoryItem)==null?void 0:$.products)?t.categoryItem.products:[]}),a=i.computed(()=>Object.entries(t.categoryItem.currencyRates??{}).map(([$,M])=>`${M} руб./${k($)}`).join(", ")),l=i.computed(()=>D.isUndefined(t.filteredItems)||r.value==="*"?o.value:o.value.filter($=>{var U;const M=(U=r.value)==null?void 0:U.products;return D.isArray(M)&&M.includes($.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>D.isFunction(t.showCategoryHideForClientButton)?t.showCategoryHideForClientButton(t.categoryItem):t.showCategoryHideForClientButton),h=i.computed(()=>D.isFunction(t.showCategoryPinButton)?t.showCategoryPinButton(t.categoryItem):t.showCategoryPinButton),u=i.computed(()=>D.isFunction(t.showCategoryRequiredButton)?t.showCategoryRequiredButton(t.categoryItem):t.showCategoryRequiredButton),p=i.computed(()=>D.isFunction(t.showCategoryEditButton)?t.showCategoryEditButton(t.categoryItem):t.showCategoryEditButton),f=i.computed(()=>D.isNil(t.categoryContextButtonsConfig)?[]:D.isFunction(t.categoryContextButtonsConfig)?t.categoryContextButtonsConfig(t.categoryItem):t.categoryContextButtonsConfig),g=i.computed(()=>new Y.ClientCategory(t.categoryItem)),m=i.ref(!1),y=i.ref(!1),_=i.computed(()=>!D.isUndefined(t.isCategoryItemSelected)),b=i.computed(()=>D.isFunction(t.isCategoryItemSelected)?t.isCategoryItemSelected(t.categoryItem):t.isCategoryItemSelected),S=i.computed(()=>Z.value&&bt.getDeviceTypeByResolution()===Xe.laptop?"auto":"fixed"),x=i.useTemplateRef("collapse-item-reference"),v=i.computed(()=>{var $,M;return(M=($=t.categoryItem.properties)==null?void 0:$.templateCost)==null?void 0:M.priceCoefficient}),B=i.computed(()=>{var $,M;return(M=($=t.categoryItem.properties)==null?void 0:$.templateCost)==null?void 0:M.increasePercent}),k=($,M="ru-RU")=>0 .toLocaleString(M,{style:"currency",currency:$,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),E=$=>{t.eventEmitter.emit("category:checked",{category:t.categoryItem,checked:$,target:x.value})},P=($,M)=>{t.eventEmitter.emit("category:header-click",{categoryItem:t.categoryItem,expanded:M,isLoadingState:m,target:x.value})},N=()=>{t.eventEmitter.emit("category:hide",{category:t.categoryItem,target:x.value})},j=()=>{t.eventEmitter.emit("category:required",{category:t.categoryItem,target:x.value})},X=()=>{t.eventEmitter.emit("category:attach",{category:t.categoryItem,target:x.value})},A=()=>{t.eventEmitter.emit("category:detach",{category:t.categoryItem,target:x.value})},V=()=>{t.eventEmitter.emit("category:edit",{category:t.categoryItem,target:x.value})},L=$=>{t.eventEmitter.emit("category:context-select",{category:t.categoryItem,key:$,target:x.value})},Z=i.ref(0),F=i.computed(()=>Z.value&&o.value.length>0?Bf(o.value,{eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,showProductCosts:t.showProductCosts,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,showCostDate:t.showCostDate,showProductAddToCartButton:t.showProductAddToCartButton,isProductItemSelected:t.isProductItemSelected,showProductEditButton:t.showProductEditButton,showProductRequiredButton:t.showProductRequiredButton,currencyRates:t.categoryItem.currencyRates,productContextButtonsConfig:t.productContextButtonsConfig}):[]),R=D.debounce(()=>{Z.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",R)}),window.addEventListener("resize",R),R(),($,M)=>{const U=I.NCheckbox,z=fu,O=I.NTooltip,ee=du,ce=I.NTag,se=au,ge=ru,ie=I.NButton,Me=tu,Ae=_a,Ze=ya,De=ma,yt=ga,Jt=I.NDropdown,Qt=I.NDataTable,_t=I.NAlert,Ot=I.NSpin;return i.openBlock(),i.createBlock(ba,{ref:"collapse-item-reference",name:$.categoryItem.id,"data-id":$.categoryItem.id,"onHeader:click":P},{"pre-arrow":i.withCtx(()=>{var Fe,Ce;return[_.value?(i.openBlock(),i.createElementBlock("div",Tf,[i.createVNode(U,{checked:b.value,disabled:b.value==="disabled","onUpdate:checked":E},null,8,["checked","disabled"])])):i.createCommentVNode("",!0),!d.value&&((Fe=g.value)!=null&&Fe.isDisabled)?(i.openBlock(),i.createBlock(O,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(z,{class:"pt-1.5"})]),default:i.withCtx(()=>[M[1]||(M[1]=i.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):i.createCommentVNode("",!0),((Ce=g.value)==null?void 0:Ce.isFavorite)??!1?(i.openBlock(),i.createBlock(O,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ee,{class:"pt-1.5"})]),default:i.withCtx(()=>[M[2]||(M[2]=i.createTextVNode(" Избранная категория ",-1))]),_:1})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var Fe,Ce,zt,Nt,Lt;return[i.createElementVNode("div",{class:i.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":$.categoryItem.isHidden,"text-gray-400":(Fe=g.value)==null?void 0:Fe.isDisabled})},[i.createVNode(O,{disabled:!$.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createElementVNode("span",null,i.toDisplayString($.categoryItem.name),1)]),default:i.withCtx(()=>[M[3]||(M[3]=i.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:M[0]||(M[0]=i.withModifiers((...Pe)=>i.unref(D.noop)&&i.unref(D.noop)(...Pe),["prevent","stop"]))},[(Ce=$.categoryItem.properties)!=null&&Ce.m2Price?(i.openBlock(),i.createBlock(ce,{key:0,size:i.unref(n),class:i.normalizeClass({"!pr-0":((zt=$.categoryItem.properties)==null?void 0:zt.templateCost)&&$.categoryItem.properties.m2PriceRetail&&B.value}),round:""},{default:i.withCtx(()=>{var Pe;return[i.createTextVNode(" Средняя стоимость: "+i.toDisplayString($.categoryItem.properties.m2Price)+" руб./м2 ",1),(Pe=$.categoryItem.properties)!=null&&Pe.templateCost&&$.categoryItem.properties.m2PriceRetail&&B.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[B.value?(i.openBlock(),i.createBlock(ce,{key:0,type:"success",bordered:!1,size:i.unref(n),class:"ml-2 !pr-0",round:""},{default:i.withCtx(()=>[B.value?(i.openBlock(),i.createElementBlock("span",Ef,i.toDisplayString(B.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0),i.createVNode(ce,{size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createElementVNode("span",Rf,i.toDisplayString($.categoryItem.properties.m2PriceRetail)+" руб./м2",1)]),_:1},8,["size"])]),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0)]}),_:1},8,["size","class"])):(Nt=$.categoryItem.properties)!=null&&Nt.templateCost?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[v.value||B.value?(i.openBlock(),i.createBlock(ce,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>{var Pe;return[v.value?(i.openBlock(),i.createElementBlock("span",$f,i.toDisplayString((Pe=v.value)==null?void 0:Pe.name),1)):i.createCommentVNode("",!0),B.value?(i.openBlock(),i.createElementBlock("span",Nf,i.toDisplayString(B.value>0?"+":"")+i.toDisplayString(B.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0)]}),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(ce,{key:2,size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createTextVNode(" Фиксированный курс: "+i.toDisplayString(a.value),1)]),_:1},8,["size"])):i.createCommentVNode("",!0),h.value&&((Lt=g.value)!=null&&Lt.manager)?(i.openBlock(),i.createBlock(ce,{key:3,size:i.unref(n),closable:!0,round:"",class:"align-bottom",onClose:A},{default:i.withCtx(()=>[i.createVNode(O,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var Pe,Q;return[i.createElementVNode("span",Pf,[i.createVNode(se),i.createTextVNode(" "+i.toDisplayString((Q=(Pe=g.value)==null?void 0:Pe.manager)==null?void 0:Q.name),1)])]}),default:i.withCtx(()=>{var Pe,Q;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((Q=(Pe=g.value)==null?void 0:Pe.manager)==null?void 0:Q.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[$.showSlugs||$.showProperties?(i.openBlock(),i.createElementBlock("div",Ff,[i.createElementVNode("ul",Mf,[$.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:$.categoryItem.id,slug:$.categoryItem.slug},(Fe,Ce)=>(i.openBlock(),i.createElementBlock("li",{key:Ce}," ("+i.toDisplayString(Ce)+"): "+i.toDisplayString(Fe),1))),128)):i.createCommentVNode("",!0),$.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList($.categoryItem.properties,(Fe,Ce)=>(i.openBlock(),i.createElementBlock("li",{key:Ce}," ("+i.toDisplayString(Ce)+"): "+i.toDisplayString(Fe),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var Fe;return[i.createElementVNode("div",Af,[d.value?(i.openBlock(),i.createBlock(O,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ie,{ghost:!0,size:i.unref(n),onClick:N},{default:i.withCtx(()=>{var Ce;return[(Ce=g.value)!=null&&Ce.isDisabled?(i.openBlock(),i.createBlock(z,{key:1})):(i.openBlock(),i.createBlock(ge,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var Ce;return[(Ce=g.value)!=null&&Ce.isDisabled?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" Скрыто для клиента"+i.toDisplayString(g.value.hidingComment?`. Причина: '${g.value.hidingComment}'`:""),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Видимо клиенту")],64))]}),_:1})):i.createCommentVNode("",!0),h.value&&!((Fe=g.value)!=null&&Fe.manager)?(i.openBlock(),i.createBlock(O,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ie,{ghost:!0,size:i.unref(n),onClick:X},{default:i.withCtx(()=>[i.createVNode(Me)]),_:1},8,["size"])]),default:i.withCtx(()=>{var Ce,zt,Nt;return[(Ce=g.value)!=null&&Ce.manager?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode('Категория закреплена за "'+i.toDisplayString(((Nt=(zt=g.value)==null?void 0:zt.manager)==null?void 0:Nt.name)??"-")+'"',1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode("Закрепить")],64))]}),_:1})):i.createCommentVNode("",!0),u.value?(i.openBlock(),i.createBlock(O,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ie,{ghost:!0,disabled:u.value==="disabled",size:i.unref(n),onClick:j},{default:i.withCtx(()=>{var Ce;return[(Ce=g.value)!=null&&Ce.isRequired?(i.openBlock(),i.createBlock(Ze,{key:1})):(i.openBlock(),i.createBlock(Ae,{key:0}))]}),_:1},8,["disabled","size"])]),default:i.withCtx(()=>{var Ce;return[(Ce=g.value)!=null&&Ce.isRequired?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Категория, которую нужно предлагать клиенту")],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode("Категория, которую клиент должен брать.")],64))]}),_:1})):i.createCommentVNode("",!0),p.value?(i.openBlock(),i.createBlock(O,{key:3,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ie,{ghost:!0,size:i.unref(n),type:"primary",onClick:V},{default:i.withCtx(()=>[i.createVNode(De)]),_:1},8,["size"])]),default:i.withCtx(()=>[M[4]||(M[4]=i.createTextVNode(" Редактировать ",-1))]),_:1})):i.createCommentVNode("",!0),f.value.length>0?(i.openBlock(),i.createBlock(Jt,{key:4,options:f.value,size:i.unref(n),trigger:"click",onSelect:L},{default:i.withCtx(()=>[i.createVNode(ie,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(yt)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot($.$slots,"default",{},()=>{var Fe;return[s.value?(i.openBlock(),i.createBlock(Sa,{key:0,"categories-items":$.categoryItem.categories??[],"has-products":c.value||m.value,"event-emitter":$.eventEmitter,"filtered-items":r.value?((Fe=r.value)==null?void 0:Fe.categories)??{}:void 0,"is-category-item-selected":$.isCategoryItemSelected,"show-slugs":$.showSlugs,"show-properties":$.showProperties,"allow-name-click":$.allowNameClick,"allow-price-click":$.allowPriceClick,"show-price-history":$.showPriceHistory,"show-cost-date":$.showCostDate,"show-category-required-button":$.showCategoryRequiredButton,"show-category-hide-for-client-button":$.showCategoryHideForClientButton,"show-category-pin-button":$.showCategoryPinButton,"show-category-edit-button":$.showCategoryEditButton,"category-context-buttons-config":$.categoryContextButtonsConfig,"is-product-item-selected":$.isProductItemSelected,"show-product-add-to-cart-button":$.showProductAddToCartButton,"show-product-costs":$.showProductCosts,"show-product-required-button":$.showProductRequiredButton,"show-product-edit-button":$.showProductEditButton,"product-context-buttons-config":$.productContextButtonsConfig},null,8,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config"])):i.createCommentVNode("",!0),c.value?(i.openBlock(),i.createBlock(Qt,{key:1,columns:F.value,data:l.value,bordered:!0,loading:m.value,remote:!0,"row-key":Ce=>Ce.id,"table-layout":S.value,class:"mt-1"},null,8,["columns","data","loading","row-key","table-layout"])):i.createCommentVNode("",!0),!m.value&&!y.value&&!s.value&&!c.value?(i.openBlock(),i.createBlock(_t,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),y.value?(i.openBlock(),i.createBlock(_t,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),m.value?(i.openBlock(),i.createBlock(Ot,{key:4,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>[...M[5]||(M[5]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),Of=jn(If,[["__scopeId","data-v-4ae8bdef"]]),zf={class:"sc-collapse flex w-full flex-col"},Lf={},Ca=i.defineComponent({...Lf,__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",zf,[i.renderSlot(o.$slots,"default")]))}}),Df={},Sa=i.defineComponent({...Df,__name:"category-collapse",props:{categoriesItems:{},hasProducts:{type:Boolean},loading:{type:Boolean,default:!1},filteredItems:{default:void 0},isCategoryItemSelected:{},showCategoryHideForClientButton:{type:[Boolean,String,Function]},showCategoryRequiredButton:{type:[Boolean,String,Function]},showCategoryPinButton:{type:[Boolean,String,Function]},showCategoryEditButton:{type:[Boolean,String,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},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(e){const t=e,n=i.inject(xr,"medium"),r=i.computed(()=>D.isUndefined(t.filteredItems)?t.categoriesItems:t.categoriesItems.filter(o=>{var a;return!!((a=t.filteredItems)!=null&&a[o.id])})),s=(o,a)=>{if(D.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=I.NSpin,c=I.NAlert;return i.openBlock(),i.createElementBlock(i.Fragment,null,[r.value.length>0?(i.openBlock(),i.createBlock(Ca,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(Of,{key:d.id,"category-item":d,"event-emitter":o.eventEmitter,"filtered-items":s(d,o.filteredItems),"is-category-item-selected":o.isCategoryItemSelected,"show-slugs":o.showSlugs,"show-properties":o.showProperties,"allow-name-click":o.allowNameClick,"allow-price-click":o.allowPriceClick,"show-price-history":o.showPriceHistory,"show-cost-date":o.showCostDate,"show-category-required-button":o.showCategoryRequiredButton,"show-category-hide-for-client-button":o.showCategoryHideForClientButton,"show-category-pin-button":o.showCategoryPinButton,"show-category-edit-button":o.showCategoryEditButton,"category-context-buttons-config":o.categoryContextButtonsConfig,"is-product-item-selected":o.isProductItemSelected,"show-product-add-to-cart-button":o.showProductAddToCartButton,"show-product-costs":o.showProductCosts,"show-product-required-button":o.showProductRequiredButton,"show-product-edit-button":o.showProductEditButton,"product-context-buttons-config":o.productContextButtonsConfig},null,8,["category-item","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-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.hasProducts&&!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)}}}),Hf={class:"text-sm"},Wf={class:"text-sm"},jf={},qf=i.defineComponent({...jf,__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,p,f,g;const n=e,r=i.ref(new Y.CartItemBase(n.cartItem??new Y.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)||((p=(u=n.product)==null?void 0:u.properties)!=null&&p.ignoreMinCountCheck?0:(g=(f=n.product)==null?void 0:f.properties)==null?void 0:g.minCount)||0}))),s=t,o=i.computed(()=>{var _,b,S,x,v,B,k,E,P;const m=((b=(_=n.product)==null?void 0:_.properties)==null?void 0:b.minLength)??((x=(S=n.product)==null?void 0:S.properties)!=null&&x.ignoreMinCountCheck?0:(B=(v=n.product)==null?void 0:v.properties)==null?void 0:B.minCount),y=(E=(k=n.product)==null?void 0:k.properties)==null?void 0:E.maxLength;return m||y?`(${m?`от ${m}`:""}${m&&y?" ":""}${y?`до ${y}`:""} ${(P=n.product)==null?void 0:P.unit})`:""}),a=()=>{Y.UnitsHelper.productIsMeasurable(n.product)||delete r.value.length,s("submit",r.value)};return(m,y)=>(i.openBlock(),i.createBlock(i.unref(I.NForm),{class:"flex flex-col gap-2"},{default:i.withCtx(()=>[i.unref(Y.UnitsHelper).productIsMeasurable(m.product)?(i.openBlock(),i.createBlock(i.unref(I.NFormItem),{key:0,required:!0,feedback:m.validation.length.feedback||"","show-feedback":m.validation.length.showFeedback||i.unref(Y.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 _,b;return[i.createVNode(i.unref(I.NInputNumber),{value:r.value.length,"onUpdate:value":y[0]||(y[0]=S=>r.value.length=S),max:((_=m.product.properties)==null?void 0:_.maxLength)||void 0,min:((b=m.product.properties)==null?void 0:b.minLength)||i.unref(Y.UnitsHelper).getProductLengthMultiplicity(m.product),step:i.unref(Y.UnitsHelper).getProductMultiplicity(m.product),validator:S=>S%i.unref(Y.UnitsHelper).getProductLengthMultiplicity(m.product)===0,placeholder:"Введите метраж",class:"w-full"},null,8,["value","max","min","step","validator"])]}),_:2},[!m.validation.length.feedback&&i.unref(Y.UnitsHelper).getProductLengthMultiplicity(m.product)!==.01?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Hf,"Метраж должен быть кратен "+i.toDisplayString(i.unref(Y.UnitsHelper).getProductLengthMultiplicity(m.product)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status","label"])):i.createCommentVNode("",!0),i.createVNode(i.unref(I.NFormItem),{required:!0,feedback:m.validation.quantity.feedback||"","show-feedback":m.validation.quantity.showFeedback||i.unref(Y.UnitsHelper).getProductMultiplicity(m.product)!==1||!1,"validation-status":m.validation.quantity.validationStatus||void 0,label:"Количество"},i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(I.NInputNumber),{value:r.value.quantity,"onUpdate:value":y[1]||(y[1]=_=>r.value.quantity=_),min:i.unref(Y.UnitsHelper).getProductMultiplicity(m.product),step:i.unref(Y.UnitsHelper).getProductMultiplicity(m.product),validator:_=>_%i.unref(Y.UnitsHelper).getProductMultiplicity(m.product)===0,placeholder:"Введите количество",class:"w-full"},null,8,["value","min","step","validator"])]),_:2},[!m.validation.quantity.feedback&&i.unref(Y.UnitsHelper).getProductMultiplicity(m.product)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Wf,"Количество должно быть кратно "+i.toDisplayString(i.unref(Y.UnitsHelper).getProductMultiplicity(m.product)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(I.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(I.NInput),{value:r.value.marker,"onUpdate:value":y[2]||(y[2]=_=>r.value.marker=_),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(I.NButton),{loading:m.isSubmitProcessing,disabled:r.value.length===0||r.value.quantity===0,type:"primary",class:"self-start",onClick:y[3]||(y[3]=_=>a())},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(m.cartItem?"Изменить":"В корзину"),1)]),_:1},8,["loading","disabled"])]),_:1}))}}),Xf={},Ba=i.defineComponent({...Xf,__name:"reference-select",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean},referenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1},sortOptionsByLabel:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},maxTagCount:{default:void 0}},emits:["update:value"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=i.computed(()=>D.isArray(r.value)),a=new Y.Reference,l=i.computed(()=>{const f=o.value?[]:a,g=D.isUndefined(r.value)?f:r.value;return D.isArray(g)?g.map(m=>m.id):g==null?void 0:g.id}),c=i.computed(()=>Dt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,r.showEmptyValue)),d=f=>{var g;if(D.isArray(f)){const m=f.length>0?f.map(y=>{var _;return(_=c.value.find(b=>b.value===y))==null?void 0:_.item}):[];s("update:value",m)}else{const m=f===a.id||(g=c.value.find(y=>y.value===f))==null?void 0:g.item;s("update:value",m)}},h=i.useTemplateRef("select-component");return t({focus:()=>{var f;return(f=h.value)==null?void 0:f.focus()},blur:()=>{var f;return(f=h.value)==null?void 0:f.blur()}}),(f,g)=>(i.openBlock(),i.createBlock(i.unref(I.NSelect),{ref:"select-component",value:l.value,clearable:r.clearable,"consistent-menu-width":f.consistentMenuWidth,disabled:f.disabled||c.value.length===0,filterable:f.filterable,"max-tag-count":f.maxTagCount,multiple:o.value,options:c.value,placeholder:"",class:"w-full","onUpdate:value":d},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),Yf={},Uf=i.defineComponent({...Yf,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{}},emits:["update:value"],setup(e,{emit:t}){var S,x;const n=e,r=t,s=()=>{const v=Y.PriceCoefficient.getRetailPriceCoefficient();return D.unset(v,"isNewRec"),v},o=v=>!v||v.id===s().id,a=i.computed(()=>{var v;return((v=n.catalogItem)==null?void 0:v.type)==="product"}),l=i.computed(()=>a.value?n.catalogItem:void 0),c=v=>{var B,k,E,P;return v.id===s().id?(B=l.value)==null?void 0:B.getRetailCost():(P=(E=(k=l.value)==null?void 0:k.priceCoefficients)==null?void 0:E.find(N=>N.coefficient.id===v.id))==null?void 0:P.cost},d=i.computed(()=>{var B;const v=[...((B=Y.useReferencesStore().priceCoefficientsReference)==null?void 0:B.map(k=>structuredClone(i.toRaw(k))))??[],s()];return a.value&&v.forEach(k=>{var P;const E=c(k);E?k.name+=` (${E} ${(P=l.value)==null?void 0:P.currency})`:k.name=""}),v.filter(k=>k.name!=="")}),h=i.ref(n.value.coefficient),u=i.ref(((x=(S=n.value)==null?void 0:S.value)==null?void 0:x.toString())??null),p=i.ref(null),f=i.computed(()=>{var v,B;return(B=(v=l.value)==null?void 0:v.priceCoefficients)==null?void 0:B.find(k=>k.coefficient.slug===Y.PriceCoefficientEnum.K0)}),g=i.ref(void 0),m=()=>{var B,k,E;g.value=void 0;let v=Number.parseFloat(((B=u.value)==null?void 0:B.replace(",","."))??"");if(v=Number.isNaN(v)?void 0:v,a.value)if(h.value||u.value){const P=s(),N=c(h.value??P)??0,j=N+N*((v??0)/100);p.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(j),j>(((k=l.value)==null?void 0:k.getRetailCost())??j)&&(g.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),f.value&&j<(((E=f.value)==null?void 0:E.cost)??0)&&(g.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else p.value=null;r("update:value",{value:Number.isNaN(v)?void 0:v,coefficient:o(h.value)?void 0:structuredClone(i.toRaw(h.value))})},y=v=>{D.isArray(v)||(h.value=v,!h.value&&u.value&&(h.value=s()),m())},_=()=>{h.value||(h.value=s()),m()},b=v=>{var k,E,P,N,j,X;const B=Number.parseFloat((v==null?void 0:v.replace(",","."))??"");if(a.value){let A=0;if(B<=0)h.value=void 0,u.value=null;else if(f.value&&B<(((k=f.value)==null?void 0:k.cost)??0))h.value=(E=f.value)==null?void 0:E.coefficient,A=(B-f.value.cost)*100/f.value.cost,g.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(B>(((P=l.value)==null?void 0:P.getRetailCost())??B)){h.value=s();const V=((N=l.value)==null?void 0:N.getRetailCost())??0;A=(B-V)*100/V,g.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const V=(X=(j=l.value)==null?void 0:j.priceCoefficients)==null?void 0:X.filter(L=>L.cost<B);if(V&&V.length>0){const L=V.at(-1);h.value=L==null?void 0:L.coefficient,A=(B-((L==null?void 0:L.cost)??0))*100/((L==null?void 0:L.cost)??1)}g.value={validationStatus:void 0,feedback:void 0}}u.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:5}).format(A),r("update:value",{value:Number.isNaN(A)?void 0:A,coefficient:o(h.value)?void 0:structuredClone(i.toRaw(h.value))})}else r("update:value",{value:Number.isNaN(B)?void 0:B,coefficient:void 0})};return i.onMounted(()=>{var v,B,k,E;n.calculationType===Y.CalculationTypeEnum.m2Cost?p.value=((B=(v=n.value)==null?void 0:v.value)==null?void 0:B.toString())??null:!((k=n.value)!=null&&k.coefficient)&&((E=n.value)!=null&&E.value)&&(h.value=s()),m()}),(v,B)=>{var P,N,j;const k=I.NInput,E=I.NInputGroup;return i.openBlock(),i.createBlock(i.unref(I.NFormItem),{"show-label":!i.unref(D.isNil)(v.label),label:v.label,"show-feedback":!i.unref(D.isNil)(((P=g.value)==null?void 0:P.feedback)??v.feedback),feedback:((N=g.value)==null?void 0:N.feedback)??v.feedback,"validation-status":((j=g.value)==null?void 0:j.validationStatus)??v.validationStatus},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([{"sm:grid-cols-3":a.value&&v.calculationType!==i.unref(Y.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[v.calculationType!==i.unref(Y.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(E,{key:0,class:i.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:i.withCtx(()=>[i.createVNode(Ba,{class:"w-full min-w-0 flex-1",value:h.value,"reference-list":d.value,clearable:v.clearable,disabled:v.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"onUpdate:value":y},null,8,["value","reference-list","clearable","disabled"]),i.createVNode(k,{value:u.value,"onUpdate:value":[B[0]||(B[0]=X=>u.value=X),_],clearable:v.clearable,disabled:v.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},i.createSlots({suffix:i.withCtx(()=>[B[3]||(B[3]=i.createTextVNode("%",-1))]),_:2},[u.value&&!u.value.startsWith("-")?{name:"prefix",fn:i.withCtx(()=>[B[2]||(B[2]=i.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):i.createCommentVNode("",!0),a.value||v.calculationType===i.unref(Y.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(k,{key:1,value:p.value,"onUpdate:value":[B[1]||(B[1]=X=>p.value=X),b],clearable:v.clearable,disabled:v.disabled,placeholder:"Стоимость",class:"w-full"},i.createSlots({_:2},[a.value?{name:"suffix",fn:i.withCtx(()=>{var X;return[i.createTextVNode(i.toDisplayString((X=l.value)==null?void 0:X.currency),1)]}),key:"0"}:void 0]),1032,["value","clearable","disabled"])):i.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),Gf={class:"flex flex-row gap-1"},Kf={class:"sc-client-name flex flex-col gap-1 text-base"},Zf=["href"],Jf={key:1,class:"text-sc-grey"},Qf={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},ep={key:0},tp={key:1,class:"text-sm"},np={},Tr=i.defineComponent({...np,__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?$n.format(n.client.lastLoginAt,Y.AppConfigProvider.getConfig().dateFormats.uiDateWithTime):""),o=a=>{D.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=Es,d=I.NButton,h=I.NPopover;return i.openBlock(),i.createElementBlock("div",Gf,[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(D.isNil)(a.popoverPosition),placement:a.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",Kf,[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",Jf," [ Деактивирован ] "))],8,Zf),a.showCityAndRegion&&a.client.city?(i.openBlock(),i.createElementBlock("span",Qf," г. "+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",ep,i.toDisplayString(a.client.alternativeName),1)):i.createCommentVNode("",!0),s.value?(i.openBlock(),i.createElementBlock("span",tp," Последний вход: "+i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),ip={class:"text-base"},rp={},Ta=i.defineComponent({...rp,__name:"contragent-with-short-info",props:{contragent:{}},setup(e){return(t,n)=>(i.openBlock(),i.createElementBlock("span",ip,i.toDisplayString(t.contragent.name),1))}}),sp={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function op(e,t){return i.openBlock(),i.createElementBlock("svg",sp,[...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 ap=i.markRaw({name:"tabler-mail",render:op}),lp=["href"],cp={},dp=i.defineComponent({...cp,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(e){return(t,n)=>{const r=ap;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,lp)],2)}}}),hp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function up(e,t){return i.openBlock(),i.createElementBlock("svg",hp,[...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 Ea=i.markRaw({name:"fa6-brands-viber",render:up}),fp={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},pp=["id"],gp=["id"],mp=["fill"],yp=["fill"];function _p(e,t){return i.openBlock(),i.createElementBlock("svg",fp,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:e.idMap.SVGBRLHCcSy,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,pp),i.createElementVNode("linearGradient",{id:e.idMap.SVGHW6lecxh,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,gp)]),i.createElementVNode("path",{fill:"url(#"+e.idMap.SVGBRLHCcSy+")",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,mp),i.createElementVNode("path",{fill:"url(#"+e.idMap.SVGHW6lecxh+")",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,yp),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 Ra=i.markRaw({name:"logos-whatsapp-icon",render:_p,setup(){const e=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+e(),SVGHW6lecxh:"uicons-"+e()}}}}),bp={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},wp=["id"],vp=["fill"];function kp(e,t){return i.openBlock(),i.createElementBlock("svg",bp,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:e.idMap.SVGuySfwdaH,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,wp)]),i.createElementVNode("path",{fill:"url(#"+e.idMap.SVGuySfwdaH+")",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,vp),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 $a=i.markRaw({name:"logos-telegram",render:kp,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),xp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Cp(e,t){return i.openBlock(),i.createElementBlock("svg",xp,[...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 Na=i.markRaw({name:"ion-call",render:Cp}),Sp={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Bp(e,t){return i.openBlock(),i.createElementBlock("svg",Sp,[...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 Tp=i.markRaw({name:"tabler-phone-call",render:Bp}),Ep={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},Rp=["href"],$p=["href"],Np=["href"],Pp=["href"],Fp={},Mp=i.defineComponent({...Fp,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(e){const t=e,n=i.computed(()=>{try{return t.phone?qi.parsePhoneNumberWithError(t.phone,t.defaultCountry):void 0}catch{}return t.phone}),r=i.computed(()=>{var l;return D.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),s=i.computed(()=>{var l;return D.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var l;return D.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=Tp,h=Na,u=$a,p=Ra,f=Ea;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",Ep,[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,Rp)):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,$p)):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(p)],8,Np)):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(f)],8,Pp)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),Ap={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Vp(e,t){return i.openBlock(),i.createElementBlock("svg",Ap,[...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 Ip=i.markRaw({name:"mdi-envelope",render:Vp}),Op={class:"flex flex-col gap-1"},zp={key:0,class:"mb-2 flex flex-col text-base"},Lp={key:0,class:"text-sc-dark-grey text-sm"},Dp={key:1,class:"whitespace-nowrap text-sm"},Hp={key:2,class:"whitespace-nowrap text-sm"},Wp={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},jp=["href"],qp=["href"],Xp=["href"],Yp=["href"],Up=["href"],Gp={key:0,class:"flex flex-col text-base"},Kp={key:0,class:"text-sc-dark-grey text-sm"},Zp={key:1,class:"mt-2 text-sm"},Jp={key:0,class:"-mt-1"},Qp={},eg=i.defineComponent({...Qp,__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?qi.parsePhoneNumberWithError(t.contact.phone,t.defaultCountry):void 0}catch{}return t.contact.phone}),r=i.computed(()=>{var c;return D.isString(n.value)?!1:((c=n.value)==null?void 0:c.isValid())??!1}),s=i.computed(()=>{var c;return D.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var c;return D.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=Na,u=$a,p=Ra,f=Ea,g=Ip,m=I.NPopover;return i.openBlock(),i.createElementBlock("div",Op,[i.createVNode(m,{disabled:c.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var b,S,x,v;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",zp,[i.createTextVNode(i.toDisplayString(c.contact.name)+" ",1),(x=c.contact)!=null&&x.position?(i.openBlock(),i.createElementBlock("span",Lp,i.toDisplayString((v=c.contact)==null?void 0:v.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),c.contact.phone?(i.openBlock(),i.createElementBlock("div",Dp,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),c.contact.email?(i.openBlock(),i.createElementBlock("div",Hp,i.toDisplayString(c.contact.email),1)):i.createCommentVNode("",!0),a.value&&l.value?(i.openBlock(),i.createElementBlock("div",Wp,[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,jp)):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,qp)):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(p)],8,Xp)):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(f)],8,Yp)):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,Up)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var b,S,x,v;return[c.contact.name?(i.openBlock(),i.createElementBlock("div",Gp,[i.createTextVNode(i.toDisplayString(c.contact.name)+" ",1),(b=c.contact)!=null&&b.position?(i.openBlock(),i.createElementBlock("span",Kp,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",Zp,[d[4]||(d[4]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((v=c.contact)==null?void 0:v.comment),1)])):i.createCommentVNode("",!0)]}),_:1},8,["disabled"]),c.fullView&&((y=c.contact)!=null&&y.comment)?(i.openBlock(),i.createElementBlock("div",Jp,[d[5]||(d[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((_=c.contact)==null?void 0:_.comment),1)])):i.createCommentVNode("",!0)])}}}),tg={key:0,class:"flex w-fit items-center gap-2"},ng={key:1,class:"flex flex-wrap gap-1"},ig={key:0},rg={},Ui=i.defineComponent({...rg,__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=I.NSpin;return r.isProductSearching?(i.openBlock(),i.createElementBlock("div",tg,[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",ng,[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",ig,"(Планируемая дата производства: "+i.toDisplayString(n.value)+")",1)):i.createCommentVNode("",!0)]))}}}),sg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function og(e,t){return i.openBlock(),i.createElementBlock("svg",sg,[...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 Er=i.markRaw({name:"ion-close",render:og}),ag={class:"mr-3 flex flex-col gap-2"},lg=["onClick"],cg={class:"h-full p-2"},dg={},hg=i.defineComponent({...dg,__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=Er;return i.openBlock(),i.createBlock(i.unref(I.NScrollbar),{style:{"max-height":"12.5rem",width:"auto"},trigger:"none"},{default:i.withCtx(()=>[i.createElementVNode("div",ag,[(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(I.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",cg,[i.createElementVNode("div",{ref_for:!0,ref:"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,lg)]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(c.label),1)]),_:2},1024),c.isCustom&&!c.isNewRec()?(i.openBlock(),i.createBlock(i.unref(I.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})}}}),Pa=jn(hg,[["__scopeId","data-v-828c3059"]]),ug={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function fg(e,t){return i.openBlock(),i.createElementBlock("svg",ug,[...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 Fa=i.markRaw({name:"ion-trash",render:fg}),pg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function gg(e,t){return i.openBlock(),i.createElementBlock("svg",pg,[...t[0]||(t[0]=[i.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)])])}const Ma=i.markRaw({name:"ion-plus",render:gg}),mg={class:"flex flex-col gap-4"},yg={class:"flex flex-col gap-2"},_g={class:"mt-8 font-bold"},bg={class:"grid grow grid-cols-2 items-start gap-2"},wg={class:"flex flex-col gap-4"},vg={class:"flex gap-3"},kg={},Aa=i.defineComponent({...kg,__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 Y.CartItemBase(n.value);h[c]=d,r("update:value",h)};return i.watch(()=>n.value.configuratorParams,c=>{s.value=D.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=Ma,u=Fa,p=I.NInput;return i.openBlock(),i.createBlock(i.unref(I.NForm),{class:"grid gap-2 md:grid-cols-2 md:gap-6"},{default:i.withCtx(()=>{var f,g,m,y,_,b,S,x,v;return[i.createElementVNode("div",mg,[d[10]||(d[10]=i.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),c.settings.startTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(I.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NSelect),{value:s.value.startTailType,"onUpdate:value":[d[0]||(d[0]=B=>s.value.startTailType=B),a],options:c.settings.startTailConfigs.map(({label:B},k)=>({label:B,value:k})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",yg,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value.linesAngles,(B,k)=>{var E,P,N,j,X,A;return i.openBlock(),i.createElementBlock("div",{key:k,class:"flex items-start gap-2"},[i.createElementVNode("div",_g,i.toDisplayString(k+1),1),i.createElementVNode("div",bg,[i.createVNode(i.unref(I.NFormItem),{label:"Ширина, мм",required:!0,feedback:((E=c.validation[`lines_widths[${k+1}]`])==null?void 0:E.feedback)||"","show-feedback":((P=c.validation[`lines_widths[${k+1}]`])==null?void 0:P.showFeedback)||!1,"validation-status":(N=c.validation[`lines_widths[${k+1}]`])==null?void 0:N.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NInputNumber),{value:s.value.linesWidths[k],"onUpdate:value":[V=>s.value.linesWidths[k]=V,a],min:s.value.linesWidths.length>1?c.settings.minLineWidth:c.settings.stripMinWidth,max:c.settings.maxLineWidth,step:c.settings.lineWidthStep,validator:V=>V%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(I.NFormItem),{label:"Угол сгиба, °",required:!0,feedback:((j=c.validation[`lines_angles[${k+1}]`])==null?void 0:j.feedback)||"","show-feedback":((X=c.validation[`lines_angles[${k+1}]`])==null?void 0:X.showFeedback)||!1,"validation-status":(A=c.validation[`lines_angles[${k+1}]`])==null?void 0:A.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NInputNumber),{value:s.value.linesAngles[k],"onUpdate:value":[V=>s.value.linesAngles[k]=V,a],min:c.settings.minLineAngle,max:c.settings.maxLineAngle,step:c.settings.lineAngleStep,validator:V=>V%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(I.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(I.NButton),{key:0,size:"medium",onClick:V=>r("click:add-line",k)},{default:i.withCtx(()=>[i.createVNode(h)]),_:2},1032,["onClick"])),c.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(I.NButton),{key:1,disabled:s.value.linesWidths.length===1,size:"medium",class:"ml-2",onClick:V=>r("click:remove-line",k)},{default:i.withCtx(()=>[i.createVNode(u)]),_:2},1032,["disabled","onClick"]))]),_:2},1024)])}),128))]),c.settings.endTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(I.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NSelect),{value:s.value.endTailType,"onUpdate:value":[d[1]||(d[1]=B=>s.value.endTailType=B),a],options:c.settings.endTailConfigs.map(({label:B},k)=>({label:B,value:k})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Ui,{"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(I.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)])]),_:1},8,["loading"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",wg,[i.createVNode(i.unref(I.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:i.withCtx(()=>[i.createVNode(i.unref(I.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(I.NFormItem),{required:!0,"show-feedback":((f=c.validation.length)==null?void 0:f.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(I.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(I.NFormItem),{required:!0,"show-feedback":((y=c.validation.quantity)==null?void 0:y.showFeedback)||!1,feedback:((_=c.validation.quantity)==null?void 0:_.feedback)||"","validation-status":(b=c.validation.quantity)==null?void 0:b.validationStatus,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.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(I.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":(v=c.validation.marker)==null?void 0:v.validationStatus,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(p,{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",vg,[i.createVNode(i.unref(I.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(I.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)])]),_:1})):i.createCommentVNode("",!0)])])]}),_:1})}}});var Va=Object.defineProperty,xg=Object.defineProperties,Cg=Object.getOwnPropertyDescriptors,Ia=Object.getOwnPropertySymbols,Sg=Object.prototype.hasOwnProperty,Bg=Object.prototype.propertyIsEnumerable,$s=(e,t,n)=>t in e?Va(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ns=(e,t)=>{for(var n in t||(t={}))Sg.call(t,n)&&$s(e,n,t[n]);if(Ia)for(var n of Ia(t))Bg.call(t,n)&&$s(e,n,t[n]);return e},Ps=(e,t)=>xg(e,Cg(t)),Oa=(e,t)=>{for(var n in t)Va(e,n,{get:t[n],enumerable:!0})},w=(e,t,n)=>($s(e,typeof t!="symbol"?t+"":t,n),n),za=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Tt=(e,t,n)=>(za(e,t,"read from private field"),n?n.call(e):t.get(e)),La=(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)},Tg=(e,t,n,r)=>(za(e,t,"write to private field"),t.set(e,n),n),wt={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 wt.shim(e),typeof t<"u"&&(wt.Image=t),wt.isHeadless=!0,e}},Da={};Oa(Da,{Curve:()=>xi,getAnchorsFromArcData:()=>$g,getComponentOnCubicBezier:()=>Gi,getControlPoints:()=>Qa,getCurveBoundingBox:()=>Ka,getCurveFromPoints:()=>Ja,getCurveLength:()=>Ga,getReflection:()=>As,integrate:()=>Za,subdivide:()=>Ms});var Ha={};Oa(Ha,{HALF_PI:()=>Je,NumArray:()=>tn,TWO_PI:()=>lt,decomposeMatrix:()=>ki,getComputedMatrix:()=>qa,getPoT:()=>Xa,lerp:()=>Pt,mod:()=>Ft,setMatrix:()=>ja,toFixed:()=>$e});var He;typeof window<"u"?He=window:typeof global<"u"?He=global:typeof self<"u"&&(He=self);var Wa,lt=Math.PI*2,Je=Math.PI*.5;function ki(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 ja(e){Wa=e}function qa(e,t){t=t&&t.identity()||new Wa;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 Pt(e,t,n){return n*(t-e)+e}var Fs=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function Xa(e){let t=0;for(;Fs[t]&&Fs[t]<e;)t++;return Fs[t]}function Ft(e,t){for(;e<0;)e+=t;return e%t}var tn=He.Float32Array||Array,Eg=Math.floor;function $e(e){return Eg(e*1e6)/1e6}var ne={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},q=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(q,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),w(q,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);var Ya={x:{enumerable:!0,get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this._bound&&this.dispatchEvent(q.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this._bound&&this.dispatchEvent(q.Types.change))}}},Yt=class extends q{constructor(e=0,t=0){super(),w(this,"_x",0),w(this,"_y",0);for(let n in Ya)Object.defineProperty(this,n,Ya[n]);this.x=e,this.y=t}static add(e,t){return new Yt(e.x+t.x,e.y+t.y)}static sub(e,t){return new Yt(e.x-t.x,e.y-t.y)}static subtract(e,t){return Yt.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(Yt.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 Yt(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:$e(this.x),y:$e(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}},J=Yt;w(J,"zero",new Yt),w(J,"left",new Yt(-1,0)),w(J,"right",new Yt(1,0)),w(J,"up",new Yt(0,-1)),w(J,"down",new Yt(0,1));var ve=class extends J{constructor(t=0,n=0,r=0,s=0,o=0,a=0,l=ne.move){super(t,n),w(this,"controls",{left:new J,right:new J}),w(this,"_command",ne.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 Ua)Object.defineProperty(this,d,Ua[d]);this.command=l,this.relative=!0;const c=ve.makeBroadcast(this);this.controls.left.set(r,s).addEventListener(q.Types.change,c),this.controls.right.set(o,a).addEventListener(q.Types.change,c)}static makeBroadcast(t){return n;function n(){t._bound&&t.dispatchEvent(q.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:$e(this.x),y:$e(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:$e(this.rx),ry:$e(this.ry),xAxisRotation:$e(this.xAxisRotation),largeArcFlag:$e(this.largeArcFlag),sweepFlag:$e(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},Ua={command:{enumerable:!0,get:function(){return this._command},set:function(e){this._command!==e&&(this._command=e,this._bound&&this.dispatchEvent(q.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(e){this._relative!==!!e&&(this._relative=!!e,this._bound&&this.dispatchEvent(q.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(e){this._rx!==e&&(this._rx=e,this._bound&&this.dispatchEvent(q.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(e){this._ry!==e&&(this._ry=e,this._bound&&this.dispatchEvent(q.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(e){this._xAxisRotation!==e&&(this._xAxisRotation=e,this._bound&&this.dispatchEvent(q.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag!==e&&(this._largeArcFlag=e,this._bound&&this.dispatchEvent(q.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag!==e&&(this._sweepFlag=e,this._bound&&this.dispatchEvent(q.Types.change))}}},Rg=0,vt={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.19",PublishDate:"2025-06-27T18:00:39.187Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return Rg++}},xi={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 Gi(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 Ms(e,t,n,r,s,o,a,l,c){c=c||xi.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 p=u/d,f=Gi(p,e,n,s,a),g=Gi(p,t,r,o,l);h.push(new ve(f,g))}return h}function Ga(e,t,n,r,s,o,a,l,c){if(e===n&&t===r&&s===a&&o===l){const y=a-e,_=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),p=9*(r-o)+3*(l-t),f=6*(t+o)-12*r,g=3*(r-t);function m(y){const _=(d*y+h)*y+u,b=(p*y+f)*y+g;return Math.sqrt(_*_+b*b)}return Za(m,0,1,c||xi.RecursionLimit)}function Ka(e,t,n,r,s,o,a,l){const c=[],d=[[],[]];let h,u,p,f,g,m,y,_;for(let v=0;v<2;++v){if(v==0?(u=6*e-12*n+6*s,h=-3*e+9*n-9*s+3*a,p=3*n-3*e):(u=6*t-12*r+6*o,h=-3*t+9*r-9*o+3*l,p=3*r-3*t),Math.abs(h)<1e-12){if(Math.abs(u)<1e-12)continue;f=-p/u,0<f&&f<1&&c.push(f);continue}y=u*u-4*p*h,_=Math.sqrt(y),!(y<0)&&(g=(-u+_)/(2*h),0<g&&g<1&&c.push(g),m=(-u-_)/(2*h),0<m&&m<1&&c.push(m))}let b=c.length,S=b,x;for(;b--;)f=c[b],x=1-f,d[0][b]=x*x*x*e+3*x*x*f*n+3*x*f*f*s+f*f*f*a,d[1][b]=x*x*x*t+3*x*x*f*r+3*x*f*f*o+f*f*f*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 Za(e,t,n,r){let s=xi.abscissas[r-2],o=xi.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 Ja(e,t){const n=e.length,r=n-1;for(let s=0;s<n;s++){const o=e[s],a=t?Ft(s-1,n):Math.max(s-1,0),l=t?Ft(s+1,n):Math.min(s+1,r),c=e[a],d=o,h=e[l];Qa(c,d,h),d.command=s===0?ne.move:ne.curve}}function Qa(e,t,n){const r=J.angleBetween(e,t),s=J.angleBetween(n,t);let o=J.distanceBetween(e,t),a=J.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+=Je:l-=Je,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 As(e,t,n){return new J(2*e.x-(t.x+e.x)-(n?e.x:0),2*e.y-(t.y+e.y)-(n?e.y:0))}function $g(e,t,n,r,s,o,a){const l=vt.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),p=r*Math.sin(h),f=new ve(u,p);f.command=ne.line}}var el=Array.prototype.slice;function Ng(e){if(e==null)return!1;const t=e.length;return typeof t=="number"&&t>=0&&t<4294967296}var G={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},isFunction:function(e){return typeof e=="function"},extend:function(e){const t=el.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=el.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=!Ng(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},Mt={hasEventListeners:typeof He.addEventListener=="function",bind:function(e,t,n,r){return this.hasEventListeners?e.addEventListener(t,n,!!r):e.attachEvent("on"+t,n),Mt},unbind:function(e,t,n,r){return Mt.hasEventListeners?e.removeEventListeners(t,n,!!r):e.detachEvent("on"+t,n),Mt},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}},Ci=He.document?He.document.createElement("div"):{};Ci.id="help-two-load",Object.defineProperty(Mt,"temp",{enumerable:!0,get:function(){return G.isElement(Ci)&&!He.document.head.contains(Ci)&&(Ci.style.display="none",He.document.head.appendChild(Ci)),Ci}});var Et=class extends Error{constructor(t){super(),w(this,"name","Two.js"),w(this,"message"),this.message=t}},Pg=He.devicePixelRatio||1;function Fg(e){return e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1}function Vs(e){return Pg/Fg(e)}var Rr=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}},ct,Nn=class extends Array{constructor(){super(),La(this,ct,new q),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 Tt(this,ct)}set _events(t){Tg(this,ct,t)}get _bound(){return Tt(this,ct)._bound}set _bound(t){Tt(this,ct)._bound=t}addEventListener(){return Tt(this,ct).addEventListener.apply(this,arguments)}on(){return Tt(this,ct).on.apply(this,arguments)}bind(){return Tt(this,ct).bind.apply(this,arguments)}removeEventListener(){return Tt(this,ct).removeEventListener.apply(this,arguments)}off(){return Tt(this,ct).off.apply(this,arguments)}unbind(){return Tt(this,ct).unbind.apply(this,arguments)}dispatchEvent(){return Tt(this,ct).dispatchEvent.apply(this,arguments)}trigger(){return Tt(this,ct).trigger.apply(this,arguments)}listen(){return Tt(this,ct).listen.apply(this,arguments)}ignore(){return Tt(this,ct).ignore.apply(this,arguments)}pop(){const t=super.pop.apply(this,arguments);return this.trigger(q.Types.remove,[t]),t}shift(){const t=super.shift.apply(this,arguments);return this.trigger(q.Types.remove,[t]),t}push(){const t=super.push.apply(this,arguments);return this.trigger(q.Types.insert,arguments),t}unshift(){const t=super.unshift.apply(this,arguments);return this.trigger(q.Types.insert,arguments),t}splice(){const t=super.splice.apply(this,arguments);if(this.trigger(q.Types.remove,t),arguments.length>2){const n=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(q.Types.insert,n),this.trigger(q.Types.order)}return t}sort(){return super.sort.apply(this,arguments),this.trigger(q.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(q.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}};ct=new WeakMap;var tl=class extends q{constructor(){super(),w(this,"_flagId",!1),w(this,"_flagClassName",!1),w(this,"_renderer",{}),w(this,"_id",vt.Identifier+vt.uniqueId()),w(this,"_className",""),w(this,"classList",[]);for(let e in nl)Object.defineProperty(this,e,nl[e])}static fromObject(e){const t=new tl().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}}},qn=tl;w(qn,"Properties",["renderer","id","className"]);var nl={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)}}},$r,il={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};He.document&&($r=document.createElement("a"));var Qe=class extends qn{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 rl)Object.defineProperty(this,n,rl[n]);if(this._renderer.type="texture",this._renderer.flagOffset=Mg.bind(this),this._renderer.flagScale=Ag.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new J,typeof t=="function"){const n=(function(){this.unbind(q.Types.load,n),typeof t=="function"&&t()}).bind(this);this.bind(q.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 Qe().copy(e);return"id"in e&&(t.id=e.id),t}static getAbsoluteURL(e){return $r?($r.href=e,$r.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=Qe.getAbsoluteURL(e);if(Qe.ImageRegistry.contains(t))return Qe.ImageRegistry.get(t);let n;return wt.Image?(n=new wt.Image,wt.shim(n,"img")):He.document?il.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=Qe.getTag(n);e._flagImage&&(/canvas/i.test(r)?Qe.Register.canvas(e,t):(e._src=!wt.isHeadless&&n.getAttribute("two-src")||n.src,Qe.Register[r](e,t))),e._flagSrc&&(n||(n=Qe.getImage(e.src),e.image=n),r=Qe.getTag(n),Qe.Register[r](e,t))}clone(){const e=new Qe(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 J?e.offset:new J().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof J?e.scale:new J().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(q.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Qe.load(this,(function(){this.loaded=!0,this.trigger(q.Types.change).trigger(q.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}},Te=Qe;w(Te,"Properties",["src","loaded","repeat","scale","offset","image"]),w(Te,"RegularExpressions",il),w(Te,"ImageRegistry",new Rr),w(Te,"Register",{canvas:function(e,t){e._src="#"+e.id,Qe.ImageRegistry.add(e.src,e.image),typeof t=="function"&&t()},img:function(e,t){const n=e.image,r=function(o){!wt.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!wt.isHeadless&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1)),new Et("unable to load "+e.src)};typeof n.width=="number"&&n.width>0&&typeof n.height=="number"&&n.height>0?r():!wt.isHeadless&&typeof n.addEventListener=="function"&&(n.addEventListener("load",r,!1),n.addEventListener("error",s,!1)),e._src=Qe.getAbsoluteURL(e._src),!(!wt.isHeadless&&n&&n.getAttribute("two-src"))&&(wt.isHeadless||n.setAttribute("two-src",e.src),Qe.ImageRegistry.add(e.src,n),wt.isHeadless?Qe.loadHeadlessBuffer(e,r):e.image.src=e.src)},video:function(e,t){if(wt.isHeadless)throw new Et("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 Et("unable to load "+e.src)};e._src=Qe.getAbsoluteURL(e._src),e.image.getAttribute("two-src")||(e.image.setAttribute("two-src",e.src),Qe.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 rl={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=Te.getTag(e);let n;switch(t){case"canvas":n="#"+e.id;break;default:n=e.src}Te.ImageRegistry.contains(n)?this._image=Te.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(q.Types.change,this._renderer.flagOffset),this._offset=e,this._offset.bind(q.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof J&&this._scale.unbind(q.Types.change,this._renderer.flagScale),this._scale=e,this._scale instanceof J&&this._scale.bind(q.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Mg(){this._flagOffset=!0}function Ag(){this._flagScale=!0}var Ut=class extends qn{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 sl)Object.defineProperty(this,r,sl[r]);this._renderer.type="stop",this.offset=typeof e=="number"?e:Ut.Index<=0?0:1,this.opacity=typeof n=="number"?n:1,this.color=typeof t=="string"?t:Ut.Index<=0?"#fff":"#000",Ut.Index=(Ut.Index+1)%2}static fromObject(e){const t=new Ut().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Ut.Properties.length;t++){const n=Ut.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Ut;return G.each(Ut.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",G.each(Ut.Properties,t=>{e[t]=this[t]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}},nn=Ut;w(nn,"Index",0),w(nn,"Properties",["offset","opacity","color"]);var sl={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)}}},Xn=class extends qn{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 ol)Object.defineProperty(this,t,ol[t]);this._renderer.type="gradient",this._renderer.flagStops=Vg.bind(this),this._renderer.bindStops=Ig.bind(this),this._renderer.unbindStops=Og.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 nn?r:new nn().copy(r)));const n=new Xn().copy(e);return"id"in e&&(n.id=e.id),n}clone(e){const t=this.stops.map(r=>r.clone()),n=new Xn(t);return G.each(Xn.Properties,r=>{n[r]=this[r]},this),e&&e.add(n),n}copy(e){super.copy.call(this,e);for(let t=0;t<Xn.Properties.length;t++){const n=Xn.Properties[t];n in e&&(this[n]=e[n])}return this}toObject(){const e={stops:this.stops.map(t=>t.toObject())};return G.each(Xn.Properties,t=>{e[t]=this[t]},this),e}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(q.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}},Ue=Xn;w(Ue,"Stop",nn),w(Ue,"Properties",["spread","stops","units"]);var ol={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(q.Types.insert,t).unbind(q.Types.remove,n),this._stops=new Nn((e||[]).slice(0)),this._stops.bind(q.Types.insert,t).bind(q.Types.remove,n),t(this._stops)}}};function Vg(){this._flagStops=!0}function Ig(e){let t=e.length;for(;t--;)e[t].bind(q.Types.change,this._renderer.flagStops),e[t].parent=this;this._renderer.flagStops()}function Og(e){let t=e.length;for(;t--;)e[t].unbind(q.Types.change,this._renderer.flagStops),delete e[t].parent;this._renderer.flagStops()}var Ki=class extends Ue{constructor(e,t,n,r,s){super(s),w(this,"_flagEndPoints",!1),w(this,"_left",null),w(this,"_right",null);for(let o in al)Object.defineProperty(this,o,al[o]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=zg.bind(this),this.left=new J,this.right=new J,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 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]instanceof J?e[n]:new J().copy(e[n]))}return this}clone(e){const t=this.stops.map(function(r){return r.clone()}),n=new Ki(this.left._x,this.left._y,this.right._x,this.right._y,t);return G.each(Ue.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(q.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}},Ie=Ki;w(Ie,"Stop",nn),w(Ie,"Properties",["left","right"]);var al={left:{enumerable:!0,get:function(){return this._left},set:function(e){this._left instanceof J&&this._left.unbind(q.Types.change,this._renderer.flagEndPoints),this._left=e,this._left.bind(q.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(e){this._right instanceof J&&this._right.unbind(q.Types.change,this._renderer.flagEndPoints),this._right=e,this._right.bind(q.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function zg(){this._flagEndPoints=!0}var Yn=class extends Ue{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 ll)Object.defineProperty(this,a,ll[a]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Lg.bind(this),this._renderer.flagFocal=Dg.bind(this),this.center=new J,this.radius=typeof n=="number"?n:1,this.focal=new J,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 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&&(/(center|focal)i/.test(n)?this[n]=e[n]instanceof J?e[n]:new J().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 Yn(this.center._x,this.center._y,this._radius,t,this.focal._x,this.focal._y);return G.each(Ue.Properties.concat(Yn.Properties),function(r){n[r]=this[r]},this),e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return G.each(Yn.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(q.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}},Oe=Yn;w(Oe,"Stop",nn),w(Oe,"Properties",["center","radius","focal"]);var ll={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(q.Types.change,this._renderer.flagCenter),this._center=e,this._center.bind(q.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(e){this._focal&&this._focal.unbind(q.Types.change,this._renderer.flagFocal),this._focal=e,this._focal.bind(q.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function Lg(){this._flagCenter=!0}function Dg(){this._flagFocal=!0}function cl(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 Nr(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 dl(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,p=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(p||e).x,d=(p||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),p&&e._relative&&(o+=e.x,d+=e.y),Ga(r,l,s,c,o,d,a,h,n)}function hl(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,p=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(p||e).x,d=(p||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),p&&e._relative&&(o+=e.x,d+=e.y),Ms(r,l,s,c,o,d,a,h,n)}function Un(e){switch(e.renderer.type){case"texture":return Te.fromObject(e);case"gradient":return Ue.fromObject(e);case"linear-gradient":return Ie.fromObject(e);case"radial-gradient":return Oe.fromObject(e)}return e}var Hg=Math.cos,Wg=Math.sin,ul=Math.tan,Is=[],At=class extends q{constructor(e,t,n,r,s,o){super(),w(this,"elements",new tn(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 v=e;let B,k,E;const P=t[0]||0,N=t[1]||0,j=t[2]||0;return B=v[0]*P+v[1]*N+v[2]*j,k=v[3]*P+v[4]*N+v[5]*j,E=v[6]*P+v[7]*N+v[8]*j,[B,k,E]}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],p=t[0],f=t[1],g=t[2],m=t[3],y=t[4],_=t[5],b=t[6],S=t[7],x=t[8];return n=n||new tn(9),n[0]=r*p+s*m+o*b,n[1]=r*f+s*y+o*S,n[2]=r*g+s*_+o*x,n[3]=a*p+l*m+c*b,n[4]=a*f+l*y+c*S,n[5]=a*g+l*_+c*x,n[6]=d*p+h*m+u*b,n[7]=d*f+h*y+u*S,n[8]=d*g+h*_+u*x,n}static fromObject(e){return new At().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(q.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(q.Types.change)}identity(){return this.elements[0]=At.Identity[0],this.elements[1]=At.Identity[1],this.elements[2]=At.Identity[2],this.elements[3]=At.Identity[3],this.elements[4]=At.Identity[4],this.elements[5]=At.Identity[5],this.elements[6]=At.Identity[6],this.elements[7]=At.Identity[7],this.elements[8]=At.Identity[8],this.trigger(q.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(q.Types.change);if(typeof n>"u"&&(n=1),typeof r>"u"){e=e||0,t=t||0,n=n||0,s=this.elements;const A=s[0]*e+s[1]*t+s[2]*n,V=s[3]*e+s[4]*t+s[5]*n,L=s[6]*e+s[7]*t+s[8]*n;return[A,V,L]}const d=this.elements,h=[e,t,n,r,s,o,a,l,c],u=d[0],p=d[1],f=d[2],g=d[3],m=d[4],y=d[5],_=d[6],b=d[7],S=d[8],x=h[0],v=h[1],B=h[2],k=h[3],E=h[4],P=h[5],N=h[6],j=h[7],X=h[8];return this.elements[0]=u*x+p*k+f*N,this.elements[1]=u*v+p*E+f*j,this.elements[2]=u*B+p*P+f*X,this.elements[3]=g*x+m*k+y*N,this.elements[4]=g*v+m*E+y*j,this.elements[5]=g*B+m*P+y*X,this.elements[6]=_*x+b*k+S*N,this.elements[7]=_*v+b*E+S*j,this.elements[8]=_*B+b*P+S*X,this.trigger(q.Types.change)}inverse(e){const t=this.elements;e=e||new At;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,p=-h*o+l*c,f=d*o-a*c;let g=n*u+r*p+s*f;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]=p*g,e.elements[4]=(h*n-s*c)*g,e.elements[5]=(-l*n+s*o)*g,e.elements[6]=f*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=Hg(e),n=Wg(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=ul(e);return this.multiply(1,t,0,0,1,0,0,0,1)}skewY(e){const t=ul(e);return this.multiply(1,0,0,t,1,0,0,0,1)}toString(e){return Is.length=0,this.toTransformArray(e,Is),Is.map($e).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],p=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]=p;return}return[s,l,h,o,c,u,a,d,p]}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],p=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]=p;return}return[s,o,a,l,c,d,h,u,p]}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 At().copy(this)}},Gn=At;w(Gn,"Identity",[1,0,0,0,1,0,0,0,1]),ja(Gn);var Os=class extends qn{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 Pr)Object.defineProperty(this,e,Pr[e]);this._renderer.flagMatrix=fl.bind(this),this.isShape=!0,this.matrix=new Gn,this.worldMatrix=new Gn,this.position=new J,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const t=new Os().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 Pr.position.get.apply(this,arguments)}set translation(e){Pr.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 J?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 J?e.scale:new J(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 Os;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 J?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 J?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}},mn=Os;w(mn,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var Pr={position:{enumerable:!0,get:function(){return this._position},set:function(e){this._position&&this._position.unbind(q.Types.change,this._renderer.flagMatrix),this._position=e,this._position.bind(q.Types.change,this._renderer.flagMatrix),fl.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 J&&this._scale.unbind(q.Types.change,this._renderer.flagMatrix),this._scale=e,this._scale instanceof J&&this._scale.bind(q.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 qa(this,this._worldMatrix),this._worldMatrix},set:function(e){this._worldMatrix=e}}};function fl(){this._flagMatrix=!0}var Si=Math.min,Bi=Math.max,jg=Math.ceil,qg=Math.floor,Xg=new J,Pn=class extends mn{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 pl)Object.defineProperty(this,s,pl[s]);this._renderer.type="path",this._renderer.flagVertices=gl.bind(this),this._renderer.bindVertices=ml.bind(this),this._renderer.unbindVertices=yl.bind(this),this._renderer.flagFill=_l.bind(this),this._renderer.flagStroke=bl.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:Un(e.fill),n=typeof e.stroke=="string"?e.stroke:Un(e.stroke),r=new Pn().copy(Ps(Ns({},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<Pn.Properties.length;t++){const n=Pn.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Pn;for(let n=0;n<this.vertices.length;n++)t.vertices.push(this.vertices[n].clone());for(let n=0;n<Pn.Properties.length;n++){const r=Pn.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()),G.each(Pn.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:p}=ki(t.elements[0],t.elements[3],t.elements[1],t.elements[4],t.elements[2],t.elements[5]);typeof u=="number"&&typeof p=="number"&&(n=Math.max(u,p)*(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,p]=t.multiply(o.x,o.y),[f,g]=t.multiply(a.x,a.y);if(o.controls&&a.controls){let m=o.controls.right.x,y=o.controls.right.y;o.relative&&(m+=o.x,y+=o.y);let[_,b]=t.multiply(m,y),S=a.controls.left.x,x=a.controls.left.y;a.relative&&(S+=a.x,x+=a.y);let[v,B]=t.multiply(S,x);const k=Ka(u,p,_,b,v,B,f,g);d=Si(k.min.y-n,d),l=Si(k.min.x-n,l),c=Bi(k.max.x+n,c),h=Bi(k.max.y+n,h)}else s<=1&&(d=Si(p-n,d),l=Si(u-n,l),c=Bi(u+n,c),h=Bi(p+n,h)),d=Si(g-n,d),l=Si(f-n,l),c=Bi(f+n,c),h=Bi(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,p,f,g,m,y,_=this.length*Math.min(Math.max(e,0),1);const b=this.vertices.length,S=b-1;let x=null,v=null;for(let Z=0,F=this._lengths.length,R=0;Z<F;Z++){if(R+this._lengths[Z]>=_){this._closed?(n=Ft(Z,b),r=Ft(Z-1,b),Z===0&&(n=r,r=Z)):(n=Z,r=Math.min(Math.max(Z-1,0),S)),x=this.vertices[n],v=this.vertices[r],_-=R,this._lengths[Z]!==0?e=_/this._lengths[Z]:e=0;break}R+=this._lengths[Z]}if(x===null||v===null)return null;if(x){if(!v)return x}else return v;y=v.controls&&v.controls.right,m=x.controls&&x.controls.left,a=v.x,u=v.y,l=(y||v).x,p=(y||v).y,c=(m||x).x,f=(m||x).y,d=x.x,g=x.y,y&&v.relative&&(l+=v.x,p+=v.y),m&&x.relative&&(c+=x.x,f+=x.y),o=Gi(e,a,l,c,d),h=Gi(e,u,p,f,g);const B=Pt(a,l,e),k=Pt(u,p,e),E=Pt(l,c,e),P=Pt(p,f,e),N=Pt(c,d,e),j=Pt(f,g,e),X=Pt(B,E,e),A=Pt(k,P,e),V=Pt(E,N,e),L=Pt(P,j,e);return G.isObject(t)?(t.x=o,t.y=h,t instanceof ve&&(t.controls.left.x=X,t.controls.left.y=A,t.controls.right.x=V,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,X-o,A-h,V-o,L-h,this._curved?ne.curve:ne.line),s.t=e,s)}plot(){if(this.curved)return Ja(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?ne.move:ne.line;return this}subdivide(e){this._update();const t=this.vertices.length-1,n=this._closed||this.vertices[t]._command===ne.close;let r=this.vertices[t],s=[],o;return G.each(this.vertices,function(a,l){if(l<=0&&!n){r=a;return}if(a.command===ne.move){s.push(new ve(r.x,r.y)),l>0&&(s[s.length-1].command=ne.line),r=a;return}o=hl(a,r,e),s=s.concat(o),G.each(o,function(c,d){d<=0&&r.command===ne.move?c.command=ne.move:c.command=ne.line}),l>=t&&(this._closed&&this._automatic&&(r=a,o=hl(a,r,e),s=s.concat(o),G.each(o,function(c,d){d<=0&&r.command===ne.move?c.command=ne.move:c.command=ne.line})),s.push(new ve(a.x,a.y)),s[s.length-1].command=n?ne.close:ne.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=[]),G.each(this.vertices,function(a,l){if(l<=0||a.command===ne.move){s=a,this._lengths[l]=0;return}this._lengths[l]=dl(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=Nr(this,n*this._length),o=Nr(this,r*this._length),a=jg(s),l=qg(o);let c,d,h,u,p,f;for(this._renderer.vertices.length=0,f=0;f<e;f++)this._renderer.collection.length<=f&&this._renderer.collection.push(new ve),f>l&&!d?(p=this._renderer.collection[f].copy(this._collection[f]),this.getPointAt(r,p),p.command=this._renderer.collection[f].command,this._renderer.vertices.push(p),d=p,h=this._collection[f-1],h&&h.controls&&(p.relative?p.controls.right.clear():p.controls.right.copy(p),h.relative?this._renderer.collection[f-1].controls.right.copy(h.controls.right).lerp(J.zero,1-p.t):this._renderer.collection[f-1].controls.right.copy(h.controls.right).lerp(h,1-p.t))):f>=a&&f<=l&&(p=this._renderer.collection[f].copy(this._collection[f]),this._renderer.vertices.push(p),f===l&&cl(this,r)?(d=p,!t&&d.controls&&(d.relative?d.controls.right.clear():d.controls.right.copy(d))):f===a&&cl(this,n)&&(c=p,c.command=ne.move,!t&&c.controls&&(c.relative?c.controls.left.clear():c.controls.left.copy(c))));a>0&&!c&&(f=a-1,p=this._renderer.collection[f].copy(this._collection[f]),this.getPointAt(n,p),p.command=ne.move,this._renderer.vertices.unshift(p),u=this._collection[f+1],u&&u.controls&&(p.controls.left.clear(),u.relative?this._renderer.collection[f+1].controls.left.copy(u.controls.left).lerp(J.zero,p.t):(Xg.copy(u),this._renderer.collection[f+1].controls.left.copy(u.controls.left).lerp(u,p.t))))}return mn.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,mn.prototype.flagReset.call(this),this}},xe=Pn;w(xe,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes"]),w(xe,"Utils",{getCurveLength:dl});var pl={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 Ue||this._fill instanceof Ie||this._fill instanceof Oe||this._fill instanceof Te)&&this._fill.unbind(q.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Ue||this._fill instanceof Ie||this._fill instanceof Oe||this._fill instanceof Te)&&this._fill.bind(q.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Ue||this._stroke instanceof Ie||this._stroke instanceof Oe||this._stroke instanceof Te)&&this._stroke.unbind(q.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Ue||this._stroke instanceof Ie||this._stroke instanceof Oe||this._stroke instanceof Te)&&this._stroke.bind(q.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";G.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(q.Types.insert,t).unbind(q.Types.remove,n),e instanceof Nn?this._collection=e:this._collection=new Nn(e||[]),this._collection.bind(q.Types.insert,t).bind(q.Types.remove,n),t(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,G.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 gl(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function ml(e){let t=e.length;for(;t--;)e[t].bind(q.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function yl(e){let t=e.length;for(;t--;)e[t].unbind(q.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function _l(){this._flagFill=!0}function bl(){this._flagStroke=!0}var Zi=class extends xe{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 wl)Object.defineProperty(this,o,wl[o]);this.width=typeof n=="number"?n:1,this.height=typeof r=="number"?r:1,this.origin=new J,typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t),this._update()}static fromObject(e){const t=new Zi().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Zi.Properties.length;t++){const n=Zi.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=ne.move,this.vertices[1].set(e,-t).sub(this._origin).command=ne.line,this.vertices[2].set(e,t).sub(this._origin).command=ne.line,this.vertices[3].set(-e,t).sub(this._origin).command=ne.line,this.vertices[4]&&(this.vertices[4].set(-e,-t).sub(this._origin).command=ne.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const t=new Zi(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<xe.Properties.length;n++){const r=xe.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}},Fn=Zi;w(Fn,"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}},origin:{enumerable:!0,get:function(){return this._origin},set:function(e){this._origin&&this._origin.unbind(q.Types.change,this._renderer.flagVertices),this._origin=e,this._origin.bind(q.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Ji=class extends Fn{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 vl)Object.defineProperty(this,a,vl[a]);this.noStroke(),this.noFill(),e instanceof Te?this.texture=e:typeof e=="string"&&(this.texture=new Te(e)),this.origin=new J,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 Ji().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Ji.Properties.length;t++){const n=Ji.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=G.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 Ji(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&&(G.isNaN(this._lastFrame)&&(this._lastFrame=a-1),o=G.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=Pt(this._firstFrame,u,o/l),c=Math.floor(c),c!==this._index&&(this._index=c,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const p=this._index%t,f=Math.floor(this._index/t),g=-r*p+(d-r)/2,m=-s*f+(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}},Fr=Ji;w(Fr,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var vl={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}}},zs,kl=class extends Nn{constructor(t){t=Array.isArray(t)?t:Array.prototype.slice.call(arguments),super(t),La(this,zs,{}),this.attach(t),this.on(q.Types.insert,this.attach),this.on(q.Types.remove,this.detach)}get ids(){return Tt(this,zs)}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}};zs=new WeakMap;var Kn=class extends xe{constructor(e,t,n,r,s,o,a){const l=a||vt.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",lt),w(this,"_innerRadius",0),w(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let d in xl)Object.defineProperty(this,d,xl[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 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];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=Ft(e,lt)===Ft(t,lt),o=n>0,a=this.vertices;let l=o?a.length/2:a.length,c,d=0,h,u,p,f,g,m,y,_,b;for(s?l--:o||(l-=2),h=0,u=l-1;h<l;h++){switch(p=h/u,f=a[d],g=p*(t-e)+e,m=(t-e)/l,y=r*Math.cos(g),_=r*Math.sin(g),h){case 0:c=ne.move;break;default:c=ne.curve}f.command=c,f.x=y,f.y=_,f.controls.left.clear(),f.controls.right.clear(),f.command===ne.curve&&(b=r*m/Math.PI,f.controls.left.x=b*Math.cos(g-Je),f.controls.left.y=b*Math.sin(g-Je),f.controls.right.x=b*Math.cos(g+Je),f.controls.right.y=b*Math.sin(g+Je),h===1&&f.controls.left.multiplyScalar(2),h===u&&f.controls.right.multiplyScalar(2)),d++}if(o){for(s?(a[d].command=ne.close,d++):(l--,u=l-1),h=0;h<l;h++)p=h/u,f=a[d],g=(1-p)*(t-e)+e,m=(t-e)/l,y=n*Math.cos(g),_=n*Math.sin(g),c=ne.curve,h<=0&&(c=s?ne.move:ne.line),f.command=c,f.x=y,f.y=_,f.controls.left.clear(),f.controls.right.clear(),f.command===ne.curve&&(b=n*m/Math.PI,f.controls.left.x=b*Math.cos(g+Je),f.controls.left.y=b*Math.sin(g+Je),f.controls.right.x=b*Math.cos(g-Je),f.controls.right.y=b*Math.sin(g-Je),h===1&&f.controls.left.multiplyScalar(2),h===u&&f.controls.right.multiplyScalar(2)),d++;a[d].copy(a[0]),a[d].command=ne.line}else s||(a[d].command=ne.line,a[d].x=0,a[d].y=0,d++,a[d].copy(a[0]),a[d].command=ne.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 Kn(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<xe.Properties.length;l++){const c=xe.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<Kn.Properties.length;t++){const n=Kn.Properties[t];e[n]=this[n]}return e}},Mr=Kn;w(Mr,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var xl={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}}},Ls=Math.cos,Ds=Math.sin,Zn=class extends xe{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 Cl)Object.defineProperty(this,a,Cl[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 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._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*lt,l=n*Ls(a),c=n*Ds(a),d=r*Ls(a-Je),h=r*Ds(a-Je),u=r*Ls(a+Je),p=r*Ds(a+Je),f=this.vertices[s];f.command=s===0?ne.move:ne.curve,f.set(l,c),f.controls.left.set(d,h),f.controls.right.set(u,p)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const t=new Zn(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<xe.Properties.length;n++){const r=xe.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<Zn.Properties.length;t++){const n=Zn.Properties[t];e[n]=this[n]}return e}},Qi=Zn;w(Qi,"Properties",["radius"]);var Cl={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this._flagRadius=!0}}},Hs=Math.cos,Ws=Math.sin,Jn=class extends xe{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 Sl)Object.defineProperty(this,l,Sl[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 Jn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Jn.Properties.length;t++){const n=Jn.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*lt,l=n*Hs(a),c=r*Ws(a),d=n*t*Hs(a-Je),h=r*t*Ws(a-Je),u=n*t*Hs(a+Je),p=r*t*Ws(a+Je),f=this.vertices[s];f.command=s===0?ne.move:ne.curve,f.set(l,c),f.controls.left.set(d,h),f.controls.right.set(u,p)}}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 Jn(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<xe.Properties.length;o++){const a=xe.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<Jn.Properties.length;t++){const n=Jn.Properties[t];e[n]=this[n]}return e}},er=Jn;w(er,"Properties",["width","height"]);var Sl={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}}},Yg=Math.ceil,Ug=Math.floor,Mn=class extends mn{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",xe.prototype.noFill),w(this,"noStroke",xe.prototype.noStroke),w(this,"corner",xe.prototype.corner),w(this,"center",xe.prototype.center),w(this,"getBoundingClientRect",xe.prototype.getBoundingClientRect),w(this,"_updateLength",xe.prototype._updateLength);for(let t in Bl)Object.defineProperty(this,t,Bl[t]);this._renderer.type="points",this._renderer.flagVertices=gl.bind(this),this._renderer.bindVertices=ml.bind(this),this._renderer.unbindVertices=yl.bind(this),this._renderer.flagFill=_l.bind(this),this._renderer.flagStroke=bl.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:Un(e.fill),n=typeof e.stroke=="string"?e.stroke:Un(e.stroke),r=new Mn().copy(Ps(Ns({},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<Mn.Properties.length;t++){const n=Mn.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Mn;for(let n=0;n<this.vertices.length;n++)t.vertices.push(this.vertices[n].clone());for(let n=0;n<Mn.Properties.length;n++){const r=Mn.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()),G.each(Mn.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=Ms(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=Nr(this,e*this._length),r=Nr(this,t*this._length),s=Yg(n),o=Ug(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}},Ar=Mn;w(Ar,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes"]);var Bl={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 Ue||this._fill instanceof Ie||this._fill instanceof Oe||this._fill instanceof Te)&&this._fill.unbind(q.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Ue||this._fill instanceof Ie||this._fill instanceof Oe||this._fill instanceof Te)&&this._fill.bind(q.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Ue||this._stroke instanceof Ie||this._stroke instanceof Oe||this._stroke instanceof Te)&&this._stroke.unbind(q.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Ue||this._stroke instanceof Ie||this._stroke instanceof Oe||this._stroke instanceof Te)&&this._stroke.bind(q.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(q.Types.insert,t).unbind(q.Types.remove,n),e instanceof Nn?this._collection=e:this._collection=new Nn(e||[]),this._collection.bind(q.Types.insert,t).bind(q.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}}},Gg=Math.cos,Kg=Math.sin,Qn=class extends xe{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 Tl)Object.defineProperty(this,s,Tl[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 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._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=lt*s+Math.PI/2,a=this._width*Gg(o)/2,l=this._height*Kg(o)/2;r>=n?this.vertices.push(new ve(a,l)):this.vertices[r].set(a,l),this.vertices[r].command=r===0?ne.move:ne.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 Qn(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<xe.Properties.length;n++){const r=xe.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<Qn.Properties.length;t++){const n=Qn.Properties[t];e[n]=this[n]}return e}},Vr=Qn;w(Vr,"Properties",["width","height","sides"]);var Tl={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}}},ei=class extends xe{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?ne.move:ne.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 El)Object.defineProperty(this,a,El[a]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=Zg.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 ei().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<ei.Properties.length;t++){const n=ei.Properties[t];if(n in e){const r=e[n];/radius/i.test(n)?this[n]=typeof r=="number"||r instanceof J?r:new J().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 J?(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 ei(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<xe.Properties.length;o++){const a=xe.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<ei.Properties.length;t++){const n=ei.Properties[t];e[n]=this[n]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}},tr=ei;w(tr,"Properties",["width","height","radius"]);var El={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 J&&this._radius.unbind(q.Types.change,this._renderer.flagRadius),this._radius=e,this._radius instanceof J&&this._radius.bind(q.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function Zg(){this._flagRadius=!0}var Jg=Math.cos,Qg=Math.sin,ti=class extends xe{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 Rl)Object.defineProperty(this,o,Rl[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 ti().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<ti.Properties.length;t++){const n=ti.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=lt*s,a=(r%2?this._outerRadius:this._innerRadius)/2,l=a*Jg(o),c=a*Qg(o);r>=n?this.vertices.push(new ve(l,c)):this.vertices[r].set(l,c),this.vertices[r].command=r===0?ne.move:ne.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 ti(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<xe.Properties.length;o++){const a=xe.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<ti.Properties.length;t++){const n=ti.Properties[t];e[n]=this[n]}return e}},Ir=ti;w(Ir,"Properties",["innerRadius","outerRadius","sides"]);var Rl={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}}},js,$l=Math.min,Nl=Math.max;He.document&&(js=document.createElement("canvas"));var Vt=class extends mn{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 Pl)Object.defineProperty(this,s,Pl[s]);if(this._renderer.type="text",this._renderer.flagFill=em.bind(this),this._renderer.flagStroke=tm.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,!G.isObject(r))return this;for(let s=0;s<Vt.Properties.length;s++){const o=Vt.Properties[s];o in r&&(this[o]=r[o])}}static Measure(e){if(js){const t=js.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*Vt.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:Un(e.fill),n=typeof e.stroke=="string"?e.stroke:Un(e.stroke),r=new Vt().copy(Ps(Ns({},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<Vt.Properties.length;t++){const n=Vt.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Vt(this.value);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale;for(let n=0;n<Vt.Properties.length;n++){const r=Vt.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<Vt.Properties.length;t++){const n=Vt.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}=Vt.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,p]=t.multiply(n,o),[f,g]=t.multiply(r,s),[m,y]=t.multiply(r,o);return s=$l(h,p,g,y),n=$l(d,u,f,m),r=Nl(d,u,f,m),o=Nl(h,p,g,y),{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}},Ht=Vt;w(Ht,"Ratio",.6),w(Ht,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes"]);var Pl={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 Ue||this._fill instanceof Ie||this._fill instanceof Oe||this._fill instanceof Te)&&this._fill.unbind(q.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Ue||this._fill instanceof Ie||this._fill instanceof Oe||this._fill instanceof Te)&&this._fill.bind(q.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Ue||this._stroke instanceof Ie||this._stroke instanceof Oe||this._stroke instanceof Te)&&this._stroke.unbind(q.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Ue||this._stroke instanceof Ie||this._stroke instanceof Oe||this._stroke instanceof Te)&&this._stroke.bind(q.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,G.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 em(){this._flagFill=!0}function tm(){this._flagStroke=!0}var Or=Math.min,zr=Math.max,Ti=class extends mn{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 Fl)Object.defineProperty(this,t,Fl[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++)Ml.call(this,e[t],this)}static RemoveChildren(e){for(let t=0;t<e.length;t++)Ml.call(this,e[t])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const t=new Ti;for(let r=0;r<Ti.Properties.length;r++){const s=Ti.Properties[r];s in e&&(/(fill|stroke)/i.test(s)?t[s]=typeof e[s]=="string"?e[s]:Un(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 Mr.fromObject(r);case"circle":return Qi.fromObject(r);case"ellipse":return er.fromObject(r);case"points":return Ar.fromObject(r);case"polygon":return Vr.fromObject(r);case"rectangle":return Fn.fromObject(r);case"rounded-rectangle":return tr.fromObject(r);case"star":return Ir.fromObject(r);case"path":return xe.fromObject(r);case"text":return Ht.fromObject(r);case"group":return Ti.fromObject(r);case"shape":return mn.fromObject(r);case"element":return qn.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 Ti,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,G.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 p=0;p<this.children.length;p++){const f=this.children[p];if(!(!f.visible||u.test(f._renderer.type))&&(t=f.getBoundingClientRect(e),r=typeof t.top!="number"||G.isNaN(t.top)||!isFinite(t.top),s=typeof t.left!="number"||G.isNaN(t.left)||!isFinite(t.left),o=typeof t.right!="number"||G.isNaN(t.right)||!isFinite(t.right),a=typeof t.bottom!="number"||G.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,v]=n.multiply(t.right,t.bottom);d=Or(m,_,S,v,d),l=Or(g,y,b,x,l),c=zr(g,y,b,x,c),h=zr(m,_,S,v,h)}else d=Or(t.top,d),l=Or(t.left,l),c=zr(t.right,c),h=zr(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}},Ke=Ti;w(Ke,"Children",kl),w(Ke,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var Fl={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=Ke.InsertChildren.bind(this),n=Ke.RemoveChildren.bind(this),r=Ke.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new kl(e),this._children.bind(q.Types.insert,t),this._children.bind(q.Types.remove,n),this._children.bind(q.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,G.isObject(e)&&!e.clip&&(e.clip=!0)}}};function Ml(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 Lr=class extends xe{constructor(t,n,r,s){const o=[new ve(t,n),new ve(r,s)];super(o);for(let a in Al)Object.defineProperty(this,a,Al[a]);this.vertices[0].command=ne.move,this.vertices[1].command=ne.line,this.automatic=!1}};w(Lr,"Properties",["left","right"]);var Al={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(e){if(G.isObject(e))this.vertices.splice(0,1,e);else{const t=new Et("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(G.isObject(e))this.vertices.splice(1,1,e);else{const t=new Et("Two.Line.y argument is not an object.");console.warn(t.name,t.message)}}}},rn={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},nm={start:"left",middle:"center",end:"right"},Vl=["id","class","transform","xmlns","viewBox"],im=["x","y","width","height","href","xlink:href"];function rm(e){return nm[e]}function sm(e){const t=e.getAttribute("dominant-baseline"),n=e.getAttribute("alignment-baseline");return t||n}function nr(e){return e.replace(/svg:/gi,"").toLowerCase()}function Il(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 om(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 am(e){const t={},n=lm(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 lm(e){const t=e.getAttributeNames();for(let n=0;n<Vl.length;n++){const r=Vl[n],s=Array.prototype.indexOf.call(t,r);s>=0&&t.splice(s,1)}return t}function cm(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 p=e.children[u];"translation"in p?p.translation.add(r,s):"x"in p?p.x=r:"y"in p&&(p.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 J(1,1)),d&&(e.scale.x=e.width/o),h&&(e.scale.y=e.height/a),e.mask=new Fn(0,0,o,a),e.mask.origin.set(-o/2,-a/2),e}function Wt(e,t,n){const r={},s={},o={};let a,l,c,d,h,u,p,f,g,m,y,_,b,S,x,v,B;if(e===null)return r;if(He.getComputedStyle){const k=He.getComputedStyle(e);for(a=k.length;a--;)c=k[a],d=k[c],typeof d<"u"&&(r[c]=d)}for(a=0;a<e.attributes.length;a++)u=e.attributes[a],/style/i.test(u.nodeName)?om(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&&G.defaults(r,n),G.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(p=ki(l),t._renderer.type){case"linear-gradient":Il(p,t.left),Il(p,t.right);break;case"radial-gradient":t.center.x+=p.translateX,t.center.y+=p.translateY,t.focal.x+=p.translateX,t.focal.y+=p.translateY,t.radius*=Math.max(p.scaleX,p.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;p=ki(l),t.translation.set(p.translateX,p.translateY),t.rotation=Math.PI*(p.rotation/180),t.scale=new J(p.scaleX,p.scaleY),f=parseFloat((r.x+"").replace("px")),g=parseFloat((r.y+"").replace("px")),f&&(t.translation.x=f),g&&(t.translation.y=g);break;case"visible":if(t instanceof Ke){t._visible=d;break}t.visible=d;break;case"stroke-linecap":if(t instanceof Ke){t._cap=d;break}t.cap=d;break;case"stroke-linejoin":if(t instanceof Ke){t._join=d;break}t.join=d;break;case"stroke-miterlimit":if(t instanceof Ke){t._miter=d;break}t.miter=d;break;case"stroke-width":if(t instanceof Ke){t._linewidth=parseFloat(d);break}t.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(t instanceof Ke){t._opacity=parseFloat(d);break}t.opacity=parseFloat(d);break;case"clip-path":if(rn.cssBackgroundImage.test(d)&&(m=d.replace(rn.cssBackgroundImage,"$1"),Le.defs.current&&Le.defs.current.contains(m)&&(_=Le.defs.current.get(m),_&&_.childNodes.length>0)))switch(_=_.childNodes[0],b=nr(_.nodeName),t.mask=Le[b].call(this,_,{}),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 Ke?"_":"")+c,rn.cssBackgroundImage.test(d)?(m=d.replace(rn.cssBackgroundImage,"$1"),Le.defs.current&&Le.defs.current.contains(m)?(_=Le.defs.current.get(m),_.object||(b=nr(_.nodeName),_.object=Le[b].call(this,_,{})),_=_.object):(y=hm(this),_=y.getById(m)),t[h]=_):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 Ue,x=t instanceof Ie,v=t instanceof Oe,S||x||v)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Et("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 Ht&&(t.family=d);break;case"font-size":t instanceof Ht&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Et("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 Ht&&(t.weight=d);break;case"font-style":t instanceof Ht&&(t.style=d);break;case"text-decoration":t instanceof Ht&&(t.decoration=d);break;case"line-height":t instanceof Ht&&(t.leading=d);break}return Object.keys(e.dataset).length&&(t.dataset=e.dataset),r}function dm(e,t){for(let n=0,r=e.childNodes.length;n<r;n++){const s=e.childNodes[n];!s.id||nr(e.nodeName)==="#text"||t.add(s.id,s)}}function hm(e){for(;e.parent;)e=e.parent;return e.scene}var Le={svg:function(e){const t=Le.defs.current=new Rr,n=e.getElementsByTagName("defs");for(let g=0;g<n.length;g++)dm(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,p=l!==null,f=c!==null;return h&&(r.x=parseFloat(o.replace(rn.unitSuffix,""))),u&&(r.y=parseFloat(a.replace(rn.unitSuffix,""))),p&&(r.width=parseFloat(l.replace(rn.unitSuffix,""))),f&&(r.height=parseFloat(c.replace(rn.unitSuffix,""))),d&&cm(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 Et("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 Et("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=im.includes(d.nodeName),u=!a.hasAttribute(d.nodeName);(h||u)&&a.setAttribute(d.nodeName,d.value)}const l=nr(a.nodeName);return Le[l].call(this,a,t)},g:function(e,t){const n=new Ke;Wt.call(this,e,n,t),this.add(n);const r=am.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=nr(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 xe(r,!0);return s.stroke="none",s.fill="black",Wt.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;G.each(h.slice(0),function(p,f){const g=p.slice(1).trim().match(rn.path),m=p[0],y=m.toLowerCase();let _,b,S,x,v;const B=[];switch(f===0&&(h=[]),y){case"h":case"v":g.length>1&&(_=1);break;case"m":case"l":case"t":g.length>2&&(_=2);break;case"s":case"q":g.length>4&&(_=4);break;case"c":g.length>6&&(_=6);break;case"a":g.length>7&&(_=7);break}if(_){for(b=0,S=g.length,v=0;b<S;b+=_){if(x=m,v>0)switch(m){case"m":x="l";break;case"M":x="L";break}B.push(x+g.slice(b,b+_).join(" ")),v++}h=Array.prototype.concat.apply(h,B)}else h.push(p)}),G.each(h,function(p,f){let g,m,y;const _=p[0],b=_.toLowerCase();d=p.slice(1).trim().match(rn.path),o=_===b;let S,x,v,B,k,E,P,N,j,X,A,V,L,Z,F,R,$;switch(b){case"z":if(f>=u)s=!0;else{m=l.x,y=l.y,g=new ve(m,y,void 0,void 0,void 0,void 0,ne.close);for(let M=r.length-1;M>=0;M--){const U=r[M];if(/m/i.test(U.command)){l=U;break}}}break;case"m":case"l":c=void 0,m=parseFloat(d[0]),y=parseFloat(d[1]),g=new ve(m,y,void 0,void 0,void 0,void 0,/m/i.test(b)?ne.move:ne.line),o&&g.addSelf(l),l=g;break;case"h":case"v":X=/h/i.test(b)?"x":"y",A=/x/i.test(X)?"y":"x",g=new ve(void 0,void 0,void 0,void 0,void 0,void 0,ne.line),g[X]=parseFloat(d[0]),g[A]=l[A],o&&(g[X]+=l[X]),l=g;break;case"c":case"s":S=l.x,x=l.y,c||(c=new J),/c/i.test(b)?(v=parseFloat(d[0]),B=parseFloat(d[1]),k=parseFloat(d[2]),E=parseFloat(d[3]),P=parseFloat(d[4]),N=parseFloat(d[5])):(j=As(l,c,o),v=j.x,B=j.y,k=parseFloat(d[0]),E=parseFloat(d[1]),P=parseFloat(d[2]),N=parseFloat(d[3])),o&&(v+=S,B+=x,k+=S,E+=x,P+=S,N+=x),l.controls.right.set(v-l.x,B-l.y),g=new ve(P,N,k-P,E-N,void 0,void 0,ne.curve),l=g,c=g.controls.left;break;case"t":case"q":S=l.x,x=l.y,c||(c=new J),/q/i.test(b)?(v=parseFloat(d[0]),B=parseFloat(d[1]),k=parseFloat(d[0]),E=parseFloat(d[1]),P=parseFloat(d[2]),N=parseFloat(d[3])):(j=As(l,c,o),v=j.x,B=j.y,k=j.x,E=j.y,P=parseFloat(d[0]),N=parseFloat(d[1])),o&&(v+=S,B+=x,k+=S,E+=x,P+=S,N+=x),l.controls.right.set((v-l.x)*.33,(B-l.y)*.33),g=new ve(P,N,k-P,E-N,void 0,void 0,ne.curve),l=g,c=g.controls.left;break;case"a":S=l.x,x=l.y,L=parseFloat(d[0]),Z=parseFloat(d[1]),F=parseFloat(d[2]),R=parseFloat(d[3]),$=parseFloat(d[4]),P=parseFloat(d[5]),N=parseFloat(d[6]),o&&(P+=S,N+=x),V=new ve(P,N),V.command=ne.arc,V.rx=L,V.ry=Z,V.xAxisRotation=F,V.largeArcFlag=R,V.sweepFlag=$,g=V,l=V,c=void 0;break}g&&(Array.isArray(g)?r=r.concat(g):r.push(g))})}n=new xe(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},G.each(n.vertices,function(l){l.subSelf(a.centroid)}),Wt.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 Qi(0,0,s);return o.stroke="none",o.fill="black",Wt.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 er(0,0,s,o);return a.stroke="none",a.fill="black",Wt.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(!G.isNaN(n)||!G.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 Fn(0,0,s,o);return c.stroke="none",c.fill="black",Wt.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 J(n,r),d=new tr(0,0,s,o,c);return d.stroke="none",d.fill="black",Wt.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 Lr(n,r,s,o).noFill();return Wt.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 p=0;p<e.children.length;p++){const f=e.children[p];let g=f.getAttribute("offset");/%/gi.test(g)&&(g=parseFloat(g.replace(/%/gi,""))/100),g=parseFloat(g);let m=f.getAttribute("stop-color"),y=f.getAttribute("stop-opacity"),_=f.getAttribute("style"),b;m===null&&(b=_?_.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,m=b&&b.length>1?b[1]:void 0),y===null?(b=_?_.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=b&&b.length>1?parseFloat(b[1]):1):y=parseFloat(y),h.push(new nn(g,m,y))}const u=new Ie(s,o,a,l,h);return u.spread=r,u.units=n,Wt.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"));G.isNaN(l)&&(l=s),G.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 f=0;f<e.children.length;f++){const g=e.children[f];let m=g.getAttribute("offset");/%/gi.test(m)&&(m=parseFloat(m.replace(/%/gi,""))/100),m=parseFloat(m);let y=g.getAttribute("stop-color"),_=g.getAttribute("stop-opacity"),b=g.getAttribute("style"),S;y===null&&(S=b?b.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,y=S&&S.length>1?S[1]:void 0),_===null?(S=b?b.match(/stop-opacity:\s?([0-9.-]*)/):!1,_=S&&S.length>1?parseFloat(S[1]):1):_=parseFloat(_),u.push(new nn(m,y,_))}const p=new Oe(s,o,a,u,l,c);return p.spread=r,p.units=n,Wt.call(this,e,p,t),p},text:function(e,t){const n=rm(e.getAttribute("text-anchor"))||"left",r=sm(e)||"baseline";let s="";e.childNodes.length>0&&e.childNodes[0].tagName==="TSPAN"?s=e.childNodes[0].textContent:s=e.textContent;const o=new Ht(s);return Wt.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 Et("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 Fr(r,s,o);return G.isNaN(a)||(c.width=a),G.isNaN(l)||(c.height=l),Wt.call(this,e,c,t),c}};function Ol(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 Ei=class extends Fn{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 zl)Object.defineProperty(this,s,zl[s]);this._renderer.flagTextures=um.bind(this),this._renderer.bindTextures=fm.bind(this),this._renderer.unbindTextures=pm.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(Ll.bind(this)):this.textures=[Ll(e)],this.origin=new J,this._update(),typeof r=="number"?this.frameRate=r:this.frameRate=Ei.DefaultFrameRate,this.index=0}static fromObject(e){const t=new Ei().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Ei.Properties.length;t++){const n=Ei.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=G.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 Ei(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,G.isNaN(this._lastFrame)&&(this._lastFrame=s-1),r=G.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=Pt(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 Te))&&(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}},Dr=Ei;w(Dr,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),w(Dr,"DefaultFrameRate",30);var zl={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(q.Types.insert,t).unbind(q.Types.remove,n),this._textures=new Nn((e||[]).slice(0)),this._textures.bind(q.Types.insert,t).bind(q.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 um(){this._flagTextures=!0}function fm(e){let t=e.length;for(;t--;)e[t].bind(q.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function pm(e){let t=e.length;for(;t--;)e[t].unbind(q.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Ll(e){if(e instanceof Te)return e;if(typeof e=="string")return new Te(e)}var qs=[],Xs=Math.max,gm=Math.min,Dl=Math.abs,Hr=Math.sin,Wr=Math.cos,mm=Math.acos,jr=Math.sqrt,Be={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 Be?e:"path"},group:{renderChild:function(e){const t=Be.getRendererType(e._renderer.type);Be[t].render.call(e,this.ctx,!0,this.clip)},render:function(e){if(!this._visible)return this;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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=qr(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=Be.getRendererType(r._renderer.type);Be[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=Be.getRendererType(l._renderer.type);Be[c].render.call(l,e)}return o&&e.restore(),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(e,t,n){let r,s,o,a,l,c,d,h,u,p,f,g,m,y,_,b,S,x,v,B,k,E,P,N,j,X,A,V,L,Z,F,R,$,M;if(M=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,L=this._mask,Z=this._clip,l=this._opacity*(M||1),c=this._visible,!t&&(!c||Z||l===0))return this;if(G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,d=this._cap,h=this._join,u=this._miter,p=this._closed,f=this._renderer.vertices,g=f.length,m=g-1,F=qr(r),$=this.dashes,F||(e.save(),e.transform(r[0],r[3],r[1],r[4],r[2],r[5])),L){const ie=Be.getRendererType(L._renderer.type);Be[ie].render.call(L,e,!0)}if(a)if(typeof a=="string")e.fillStyle=a;else{const ie=Be.getRendererType(a._renderer.type);Be[ie].render.call(a,e,this),e.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")e.strokeStyle=s;else{const ie=Be.getRendererType(s._renderer.type);Be[ie].render.call(s,e,this),e.strokeStyle=s._renderer.effect}o&&(e.lineWidth=o),u&&(e.miterLimit=u),h&&(e.lineJoin=h),!p&&d&&(e.lineCap=d)}typeof l=="number"&&(e.globalAlpha=l),$&&$.length>0&&(e.lineDashOffset=$.offset||0,e.setLineDash($)),e.beginPath();let U,z,O,ee,ce,se,ge;for(let ie=0;ie<g;ie++)switch(b=f[ie],A=b.x,V=b.y,b.command){case ne.close:e.closePath();break;case ne.arc:U=b.rx,z=b.ry,O=b.xAxisRotation,ee=b.largeArcFlag,ce=b.sweepFlag,y=p?Ft(ie-1,g):Xs(ie-1,0),_=f[y],se=_.x,ge=_.y,Be.renderSvgArcCommand(e,se,ge,U,z,ee,ce,O,A,V);break;case ne.curve:y=p?Ft(ie-1,g):Math.max(ie-1,0),_=f[y],P=_.controls&&_.controls.right||J.zero,N=b.controls&&b.controls.left||J.zero,_._relative?(k=P.x+_.x,E=P.y+_.y):(k=P.x,E=P.y),b._relative?(v=N.x+b.x,B=N.y+b.y):(v=N.x,B=N.y),e.bezierCurveTo(k,E,v,B,A,V),ie>=m&&p&&(S=x,j=b.controls&&b.controls.right||J.zero,X=S.controls&&S.controls.left||J.zero,b._relative?(k=j.x+b.x,E=j.y+b.y):(k=j.x,E=j.y),S._relative?(v=X.x+S.x,B=X.y+S.y):(v=X.x,B=X.y),A=S.x,V=S.y,e.bezierCurveTo(k,E,v,B,A,V));break;case ne.line:e.lineTo(A,V);break;case ne.move:x=b,e.moveTo(A,V);break}return p&&e.closePath(),!Z&&!n&&(Be.isHidden.test(a)||(R=a._renderer&&a._renderer.offset,R&&(e.save(),e.translate(-a._renderer.offset.x,-a._renderer.offset.y),e.scale(a._renderer.scale.x,a._renderer.scale.y)),e.fill(),R&&e.restore()),Be.isHidden.test(s)||(R=s._renderer&&s._renderer.offset,R&&(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(),R&&e.restore())),F||e.restore(),Z&&!n&&e.clip(),$&&$.length>0&&e.setLineDash(qs),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(e,t,n){let r,s,o,a,l,c,d,h,u,p,f,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(G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,h=this._renderer.collection,u=h.length,m=qr(r),_=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 v=Be.getRendererType(a._renderer.type);Be[v].render.call(a,e,this),e.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")e.strokeStyle=s;else{const v=Be.getRendererType(s._renderer.type);Be[v].render.call(s,e,this),e.strokeStyle=s._renderer.effect}o&&(e.lineWidth=o)}typeof l=="number"&&(e.globalAlpha=l),_&&_.length>0&&(e.lineDashOffset=_.offset||0,e.setLineDash(_)),e.beginPath();let S=d*.5,x;this._sizeAttenuation||(x=this.worldMatrix.elements,x=ki(x[0],x[3],x[1],x[4],x[2],x[5]),S/=Math.max(x.scaleX,x.scaleY));for(let v=0;v<u;v++)p=h[v],f=p.x,g=p.y,e.moveTo(f+S,g),e.arc(f,g,S,0,lt);return n||(Be.isHidden.test(a)||(y=a._renderer&&a._renderer.offset,y&&(e.save(),e.translate(-a._renderer.offset.x,-a._renderer.offset.y),e.scale(a._renderer.scale.x,a._renderer.scale.y)),e.fill(),y&&e.restore()),Be.isHidden.test(s)||(y=s._renderer&&s._renderer.offset,y&&(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(),y&&e.restore())),m||e.restore(),_&&_.length>0&&e.setLineDash(qs),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),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;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const c=this._matrix.elements,d=this._stroke,h=this._linewidth,u=this._fill,p=this._decoration,f=this._direction,g=qr(c),m=u._renderer&&u._renderer.offset&&d._renderer&&d._renderer.offset,y=this.dashes,_=Be.alignments[this._alignment]||this._alignment,b=Be.baselines[this._baseline]||this._baseline;let S,x,v,B,k,E,P,N,j,X,A;if(g||(e.save(),e.transform(c[0],c[3],c[1],c[4],c[2],c[5])),a){const V=Be.getRendererType(a._renderer.type);Be[V].render.call(a,e,!0)}if(m||(e.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),e.textAlign=_,e.textBaseline=b,e.direction=f,u)if(typeof u=="string")e.fillStyle=u;else{const V=Be.getRendererType(u._renderer.type);Be[V].render.call(u,e,this),e.fillStyle=u._renderer.effect}if(d){if(typeof d=="string")e.strokeStyle=d;else{const V=Be.getRendererType(d._renderer.type);Be[V].render.call(d,e,this),e.strokeStyle=d._renderer.effect}h&&(e.lineWidth=h)}if(typeof s=="number"&&(e.globalAlpha=s),y&&y.length>0&&(e.lineDashOffset=y.offset||0,e.setLineDash(y)),!l&&!n&&(Be.isHidden.test(u)||(u._renderer&&u._renderer.offset?(E=u._renderer.scale.x,P=u._renderer.scale.y,e.save(),e.translate(-u._renderer.offset.x,-u._renderer.offset.y),e.scale(E,P),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(" "),v=u._renderer.offset.x/u._renderer.scale.x,B=u._renderer.offset.y/u._renderer.scale.y,e.fillText(this.value,v,B),e.restore()):e.fillText(this.value,0,0)),Be.isHidden.test(d)||(d._renderer&&d._renderer.offset?(E=d._renderer.scale.x,P=d._renderer.scale.y,e.save(),e.translate(-d._renderer.offset.x,-d._renderer.offset.y),e.scale(E,P),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(" "),v=d._renderer.offset.x/d._renderer.scale.x,B=d._renderer.offset.y/d._renderer.scale.y,k=h/d._renderer.scale.x,e.lineWidth=k,e.strokeText(this.value,v,B),e.restore()):e.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(p)){const V=e.measureText(this.value);let L=1;switch(p){case"underline":j=V.actualBoundingBoxDescent,A=V.actualBoundingBoxDescent;break;case"strikethrough":j=0,A=0,L=.5;break}switch(b){case"top":j+=this._size*L,A+=this._size*L;break;case"baseline":case"bottom":j-=this._size*L,A-=this._size*L;break}switch(_){case"left":case"start":N=0,X=V.width;break;case"right":case"end":N=-V.width,X=0;break;default:N=-V.width/2,X=V.width/2}e.lineWidth=Math.max(Math.floor(this._size/15),1),e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(N,j),e.lineTo(X,A),e.stroke()}return g||e.restore(),l&&!n&&e.clip(),y&&y.length>0&&e.setLineDash(qs),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(e,t){if(t){if(G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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 G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(e,t){if(t){if(G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let n,r=this.center._x,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 G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(e){G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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 J||(this._renderer.offset=new J),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 J?(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 J||(this._renderer.scale=new J),this._scale instanceof J?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},renderSvgArcCommand:function(e,t,n,r,s,o,a,l,c,d){l=l*Math.PI/180,r=Dl(r),s=Dl(s);const h=(t-c)/2,u=(n-d)/2,p=Wr(l)*h+Hr(l)*u,f=-Hr(l)*h+Wr(l)*u,g=p*p,m=f*f;let y=r*r,_=s*s;const b=g/y+m/_;if(b>1){const V=jr(b);r=V*r,s=V*s,y=r*r,_=s*s}const S=y*m+_*g,x=(y*_-S)/S;let v=jr(Xs(0,x));o===a&&(v=-v);const B=v*r*f/s,k=-v*s*p/r,E=Wr(l)*B-Hr(l)*k+(t+c)/2,P=Hr(l)*B+Wr(l)*k+(n+d)/2,N=Hl(1,0,(p-B)/r,(f-k)/s),j=Hl((p-B)/r,(f-k)/s,(-p-B)/r,(-f-k)/s)%lt,X=N+j;ym(e,E,P,r,s,N,X,a===0,l)}},dt=class extends q{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 Ke,this.scene.parent=this}setSize(e,t,n){return this.width=e,this.height=t,this.ratio=typeof n>"u"?Vs(this.ctx):n,this.domElement.width=e*this.ratio,this.domElement.height=t*this.ratio,this.domElement.style&&G.extend(this.domElement.style,{width:e+"px",height:t+"px"}),this.trigger(q.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),Be.group.render.call(this.scene,this.ctx),e||this.ctx.restore(),this}};w(dt,"Utils",Be);function ym(e,t,n,r,s,o,a,l,c){const d=a-o,h=xi.Tolerance.epsilon,u=Math.abs(d)<h;let p=Ft(d,lt);p<h&&(u?p=0:p=lt),l===!0&&!u&&(p===lt?p=-lt:p=p-lt);for(let f=0;f<vt.Resolution;f++){const g=f/(vt.Resolution-1),m=o+g*p;let y=t+r*Math.cos(m),_=n+s*Math.sin(m);if(c!==0){const b=Math.cos(c),S=Math.sin(c),x=y-t,v=_-n;y=x*b-v*S+t,_=x*S+v*b+n}e.lineTo(y,_)}}function Hl(e,t,n,r){const s=e*n+t*r,o=jr(e*e+t*t)*jr(n*n+r*r);let a=mm(Xs(-1,gm(1,s/o)));return e*r-t*n<0&&(a=-a),a}function qr(e){return e[0]==1&&e[3]==0&&e[1]==0&&e[4]==1&&e[2]==0&&e[5]==0}var oe={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(oe.ns,n);return n==="svg"&&(t=G.defaults(t||{},{version:oe.version})),t&&Object.keys(t).length>0&&oe.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(oe.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?Ft(a-1,n):Math.max(a-1,0),d=e[c];let h,u,p,f,g,m,y,_,b,S,x,v,B,k,E,P=$e(l.x),N=$e(l.y);switch(l.command){case ne.close:h=ne.close;break;case ne.arc:x=l.rx,v=l.ry,B=l.xAxisRotation,k=l.largeArcFlag,E=l.sweepFlag,h=ne.arc+" "+x+" "+v+" "+B+" "+k+" "+E+" "+P+" "+N;break;case ne.curve:y=d.controls&&d.controls.right||J.zero,_=l.controls&&l.controls.left||J.zero,d.relative?(p=$e(y.x+d.x),f=$e(y.y+d.y)):(p=$e(y.x),f=$e(y.y)),l.relative?(g=$e(_.x+l.x),m=$e(_.y+l.y)):(g=$e(_.x),m=$e(_.y)),h=(a===0?ne.move:ne.curve)+" "+p+" "+f+" "+g+" "+m+" "+P+" "+N;break;case ne.move:s=l,h=ne.move+" "+P+" "+N;break;default:h=l.command+" "+P+" "+N}a>=r&&t&&(l.command===ne.curve&&(u=s,b=l.controls&&l.controls.right||l,S=u.controls&&u.controls.left||u,l.relative?(p=$e(b.x+l.x),f=$e(b.y+l.y)):(p=$e(b.x),f=$e(b.y)),u.relative?(g=$e(S.x+u.x),m=$e(S.y+u.y)):(g=$e(S.x),m=$e(S.y)),P=$e(u.x),N=$e(u.y),h+=" C "+p+" "+f+" "+g+" "+m+" "+P+" "+N),l.command!==ne.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+=ne.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=oe.createElement("clipPath",{"clip-rule":"nonzero"})),n.parentNode===null&&t.defs.appendChild(n),n},getRendererType:function(e){return e in oe?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=oe.getRendererType(e._renderer.type);oe[t].render.call(e,this)},render:function(e){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),this._renderer.elem||(this._renderer.elem=oe.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=oe.getRendererType(s._renderer.type);oe[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(oe.group.appendChild,n),this._flagSubtractions&&this.subtractions.forEach(oe.group.removeChild,n),this._flagOrder&&this.children.forEach(oe.group.orderChild,n),this._flagMask)if(this._mask){const r=oe.getRendererType(this._mask._renderer.type);oe[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),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(e){if(this._opacity===0&&!this._flagOpacity)return this;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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=oe.toString(this._renderer.vertices,this._closed);t.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=oe.getRendererType(this._fill._renderer.type);oe[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=oe.getRendererType(this._stroke._renderer.type);oe[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?oe.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=oe.createElement("path",t),e.appendChild(this._renderer.elem)),this._flagClip){const r=oe.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=oe.getRendererType(this._mask._renderer.type);oe[r].render.call(this._mask,e),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(e){if(this._opacity===0&&!this._flagOpacity)return this;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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=ki(o[0],o[3],o[1],o[4],o[2],o[5]);r/=Math.max(a.scaleX,a.scaleY)}const s=oe.pointsToString(this._renderer.collection,r);t.d=s}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=oe.getRendererType(this._fill._renderer.type);oe[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=oe.getRendererType(this._stroke._renderer.type);oe[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?oe.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=oe.createElement("path",t),e.appendChild(this._renderer.elem)),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),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"]=oe.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["dominant-baseline"]=oe.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=oe.getRendererType(this._fill._renderer.type);oe[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=oe.getRendererType(this._stroke._renderer.type);oe[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?oe.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=oe.createElement("text",t),e.appendChild(this._renderer.elem)),this._flagClip){const r=oe.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=oe.getRendererType(this._mask._renderer.type);oe[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){G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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?oe.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=oe.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?oe.setAttributes(o._renderer.elem,a):o._renderer.elem=oe.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"radial-gradient":{render:function(e,t){G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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?oe.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=oe.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?oe.setAttributes(o._renderer.elem,a):o._renderer.elem=oe.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},texture:{render:function(e,t){G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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 J?(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 J?(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?oe.setAttributes(this._renderer.image,r):this._renderer.image=oe.createElement("image",r)),this._renderer.elem?Object.keys(n).length!==0&&oe.setAttributes(this._renderer.elem,n):(n.id=this._id,n.patternUnits="userSpaceOnUse",this._renderer.elem=oe.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),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},Wl=class extends q{constructor(e){super(),this.domElement=e.domElement||oe.createElement("svg"),this.scene=new Ke,this.scene.parent=this,this.defs=oe.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,oe.setAttributes(this.domElement,{width:e,height:t}),this.trigger(q.Types.resize,e,t)}render(){return oe.group.render.call(this.scene,this.domElement),oe.defs.update(this.domElement),this}};w(Wl,"Utils",oe);var jt={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 Et("unable to compile shader "+r+": "+o)}return r},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:`
|
|
40
|
+
***************************************************************************** */var Br=function(){return Br=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},Br.apply(this,arguments)},Uu={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"}},gn={containerResize:"lgContainerResize",beforeOpen:"lgBeforeOpen",afterOpen:"lgAfterOpen",slideItemLoad:"lgSlideItemLoad",afterSlide:"lgAfterSlide",rotateLeft:"lgRotateLeft",rotateRight:"lgRotateRight",flipHorizontal:"lgFlipHorizontal",flipVertical:"lgFlipVertical"},Rs=500,Gu=function(){function e(t,n){return this.core=t,this.$LG=n,this.settings=Br(Br({},Uu),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(gn.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 p=this.getPossibleSwipeDragCords(n),f,g,m=o-this.pageX,y=a-this.pageY;if(t-n>1){var _=(t-n)/Math.abs(n);m=(n<0?-m:m)+this.left*(_+(n<0?-1:1)),y=(n<0?-y:y)+this.top*(_+(n<0?-1:1)),f=m/_,g=y/_}else{var _=(t-n)*n;f=m*_,g=y*_}r&&(u?this.isBeyondPossibleLeft(f,p.minX)?f=p.minX:this.isBeyondPossibleRight(f,p.maxX)&&(f=p.maxX):t>1&&(f<p.minX?f=p.minX:f>p.maxX&&(f=p.maxX)),h?this.isBeyondPossibleTop(g,p.minY)?g=p.minY:this.isBeyondPossibleBottom(g,p.maxY)&&(g=p.maxY):t>1&&(g<p.minY?g=p.minY:g>p.maxY&&(g=p.maxY))),this.setZoomStyles({x:f,y:g,scale:t}),this.left=f,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)},Rs),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")}},Rs+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},Rs+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(gn.containerResize+".zoom "+gn.rotateRight+".zoom "+gn.rotateLeft+".zoom "+gn.flipHorizontal+".zoom "+gn.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(gn.beforeOpen+".zoom",function(){t.core.outer.find(".lg-item").removeClass("lg-zoomable")}),this.core.LGel.on(gn.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(gn.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 p=this.getPossibleSwipeDragCords();(Math.abs(a)>15||Math.abs(l)>15)&&(s&&(this.isBeyondPossibleTop(u.y,p.minY)?u.y=p.minY:this.isBeyondPossibleBottom(u.y,p.maxY)&&(u.y=p.maxY)),r&&(this.isBeyondPossibleLeft(u.x,p.minX)?u.x=p.minX:this.isBeyondPossibleRight(u.x,p.maxX)&&(u.x=p.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(p){if(t.isImageSlide(t.core.index)&&(u=t.core.getSlideItem(t.core.index),(t.$LG(p.target).hasClass("lg-item")||u.get().contains(p.target))&&p.touches.length===1&&t.core.outer.hasClass("lg-zoomed"))){p.preventDefault(),l=new Date,t.core.touchAction="zoomSwipe",h=t.core.getSlideItem(t.core.index).find(".lg-img-wrap").first();var f=t.getDragAllowedAxises(0);a=f.allowY,o=f.allowX,(o||a)&&(n=t.getSwipeCords(p)),d=t.getPossibleSwipeDragCords(),t.core.outer.addClass("lg-zoom-dragging lg-zoom-drag-transition")}}),this.core.$inner.on("touchmove.lg",function(p){if(p.touches.length===1&&t.core.touchAction==="zoomSwipe"&&(t.$LG(p.target).hasClass("lg-item")||u.get().contains(p.target))){p.preventDefault(),t.core.touchAction="zoomSwipe",r=t.getSwipeCords(p);var f=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,f))}}),this.core.$inner.on("touchend.lg",function(p){if(t.core.touchAction==="zoomSwipe"&&(t.$LG(p.target).hasClass("lg-item")||u.get().contains(p.target))){if(p.preventDefault(),t.core.touchAction=void 0,t.core.outer.removeClass("lg-zoom-dragging"),!s)return;s=!1,c=new Date;var f=c.valueOf()-l.valueOf();t.touchendZoom(n,r,o,a,f)}})},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(p){if(t.isImageSlide(t.core.index)){var f=t.core.getSlideItem(t.core.index);if(t.$LG(p.target).hasClass("lg-item")||f.get().contains(p.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(p.target).hasClass("lg-object")&&(a||l)&&(p.preventDefault(),n=t.getDragCords(p),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(p){if(s){o=!0,r=t.getDragCords(p);var f=t.getZoomSwipeCords(n,r,a,l,h);t.setZoomSwipeStyles(u,f)}}),this.$LG(window).on("mouseup.lg.zoom.global"+this.core.lgId,function(p){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(p);var f=d.valueOf()-c.valueOf();t.touchendZoom(n,r,a,l,f)}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 Ku={ref:"gallery-container",class:"lightgallery-wrapper"},Zu={},ka=i.defineComponent({...Zu,__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}),D.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",Ku,[i.renderSlot(o.$slots,"default")],512))}}),st=class st{static init(){st.isInitialized||(st.isInitialized=!0,st.windowResizeHandler(),window.addEventListener("resize",st.windowResizeHandler))}static destroy(){window.removeEventListener("resize",st.windowResizeHandler),st.isInitialized=!1}static getDeviceTypeByResolution(){const t=Y.AppConfigProvider.getConfig().deviceTypeByResolution;return window.innerWidth<t.tablet?Xe.phone:window.innerWidth<t.laptop?Xe.tablet:Xe.laptop}static initRefDependingOnDeviceResolution(t,n,r){const s=i.ref(r);return st.setRefValueDependingOnDeviceResolution(s,t,n,r),st.refsDependingOnDeviceResolution.push({r:s,phoneValue:t,tabletValue:n,defaultValue:r}),s}static isPhoneDevice(){return st.getDeviceTypeByResolution()===Xe.phone}static isTabletDevice(){return st.getDeviceTypeByResolution()===Xe.tablet}static isLaptopDevice(){return st.getDeviceTypeByResolution()===Xe.laptop}static setRefValueDependingOnDeviceResolution(t,n,r,s){switch(st.getDeviceTypeByResolution()){case Xe.phone:t.value=n;break;case Xe.tablet:t.value=r;break;default:t.value=s;break}}static windowResizeHandler(){D.forEach(st.refsDependingOnDeviceResolution,t=>{st.setRefValueDependingOnDeviceResolution(t.r,t.phoneValue,t.tabletValue,t.defaultValue)})}};C(st,"isInitialized",!1),C(st,"refsDependingOnDeviceResolution",[]);let bt=st;const Ju=["href"],Qu=["src","alt"],ef={},xa=i.defineComponent({...ef,__name:"image-gallery",props:{images:{}},setup(e,{expose:t}){const n=i.ref(!1),r=i.ref(!1),s=i.ref({plugins:[Yu,Gu],addClass:"sc-lg-container",licenseKey:"0000-0000-000-0000",strings:{closeGallery:"Закрыть",download:"Скачать",mediaLoadingFailed:"Ошибка загрузки контента...",nextSlide:"Следующее изображение",playVideo:"Воспроизвести видео",previousSlide:"Предыдущее изображение",toggleMaximize:"Расширить"}}),o=()=>window.innerWidth*(bt.getDeviceTypeByResolution()===Xe.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=va,p=I.NPopover;return i.openBlock(),i.createBlock(p,{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]=f=>n.value=!n.value)},[i.renderSlot(d.$slots,"default",{},()=>[i.createVNode(u)])])]),default:i.withCtx(()=>[i.createVNode(ka,{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,(f,g)=>(i.openBlock(),i.createElementBlock("a",{key:g,href:f.image},[i.createElementVNode("img",{src:f.preview,alt:`Изображение #${g+1}`},null,8,Qu)],8,Ju))),128))]),_:1},8,["settings","style"])]),_:3},8,["show"])}}}),tf={class:"flex flex-col text-sm"},nf={},rf=i.defineComponent({...nf,__name:"product-stock-count",props:{product:{}},setup(e){return(t,n)=>{const r=Es,s=I.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",tf,[(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})}}}),sf={class:"flex flex-row justify-between"},of={key:0},af={class:"ml-2 align-sub"},lf={class:"flex cursor-pointer flex-row gap-2 whitespace-nowrap"},cf={class:"@container"},df={class:"text-sc-dark-grey @sm:grid-cols-2 @2xl:grid-cols-3 grid grid-cols-1 gap-1 text-sm"},hf={key:0,class:"sc-supplier-sku col-span-2 whitespace-nowrap text-wrap sm:col-span-3"},uf={class:"text-sc-dark-grey"},ff={key:1,class:"sc-product-code col-start-1 whitespace-nowrap"},pf={class:"text-gray-600"},gf={class:"flex cursor-pointer flex-row gap-1 whitespace-nowrap"},mf={key:3,class:"underline decoration-dashed"},yf={key:4,class:"sc-product-pack whitespace-nowrap"},_f={class:"text-gray-600"},bf={key:5,class:"sc-product-planning-incoming-date col-span-2 col-start-1 mt-1.5 text-wrap"},wf={class:"text-gray-600"},vf={key:0,class:"mt-3 flex flex-row gap-3 pb-2 text-base xl:text-lg"},kf={key:0},xf={class:"sc-product-properties m-0 mt-3 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},Cf={},Yi=i.defineComponent({...Cf,__name:"product-name",props:{product:{},eventEmitter:{},showSlugs:{type:Boolean,default:!1},showProperties:{type:Boolean,default:!1},showCode:{type:Boolean,default:!0},showProductCosts:{type:[Boolean,Function],default:!1},showPlanningDates:{type:Boolean,default:!0},showPriceHistory:{type:Boolean,default:!1},showCostDate:{type:Boolean,default:!1},allowNameClick:{type:[Boolean,Function],default:!1},allowPriceClick:{type:[Boolean,Function],default:!1},currencyRates:{default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductEditButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function],default:!1},productContextButtonsConfig:{type:Function,default:void 0}},setup(e,{expose:t}){const n=e,r=i.computed(()=>D.isFunction(n.showProductCosts)?n.showProductCosts(n.product):n.showProductCosts),s=i.computed(()=>D.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(()=>D.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 _,b,S,x,v;const p=va,f=I.NText,g=wa,m=Es,y=I.NScrollbar;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",sf,[i.createVNode(f,{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",of," [Под заказ] ")):i.createCommentVNode("",!0),i.createElementVNode("span",af,[h.product.images&&h.product.images.length>0?(i.openBlock(),i.createBlock(xa,{key:0,ref:"image-gallery",images:h.product.images},{default:i.withCtx(()=>[i.createElementVNode("div",lf,[i.createVNode(p)])]),_:1},8,["images"])):i.createCommentVNode("",!0)])]),_:1}),h.showProductAddToCartButton||h.showProductEditButton||h.showProductRequiredButton||((_=h.productContextButtonsConfig)==null?void 0:_.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,"show-product-required-button":h.showProductRequiredButton,"product-context-buttons-config":h.productContextButtonsConfig},null,8,["product","event-emitter","show-product-add-to-cart-button","show-product-edit-button","show-product-required-button","product-context-buttons-config"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",cf,[i.createElementVNode("div",df,[h.product.supplierSku?(i.openBlock(),i.createElementBlock("div",hf,[u[0]||(u[0]=i.createTextVNode(" Артикул производителя/поставщика: ",-1)),i.createElementVNode("span",uf,i.toDisplayString(h.product.supplierSku),1)])):i.createCommentVNode("",!0),h.showCode?(i.openBlock(),i.createElementBlock("span",ff,[u[1]||(u[1]=i.createTextVNode(" Артикул: ",-1)),i.createElementVNode("span",pf,i.toDisplayString(h.product.code),1)])):i.createCommentVNode("",!0),h.product.stockCount&&h.product.stockCount.length>0?(i.openBlock(),i.createBlock(rf,{key:2,product:h.product},{default:i.withCtx(()=>[i.createElementVNode("span",gf,[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",mf," Нет в наличии ")),(S=(b=h.product)==null?void 0:b.properties)!=null&&S.pack?(i.openBlock(),i.createElementBlock("span",yf,[u[3]||(u[3]=i.createTextVNode(" Норма упаковки: ",-1)),i.createElementVNode("span",_f,i.toDisplayString((v=(x=h.product)==null?void 0:x.properties)==null?void 0:v.pack),1)])):i.createCommentVNode("",!0),h.showPlanningDates&&o.value?(i.openBlock(),i.createElementBlock("span",bf,[u[4]||(u[4]=i.createTextVNode(" Планируемая дата поступления на основной склад: ",-1)),i.createElementVNode("span",wf,i.toDisplayString(o.value),1)])):i.createCommentVNode("",!0)])]),i.createVNode(y,{"x-scrollable":""},{default:i.withCtx(()=>[r.value?(i.openBlock(),i.createElementBlock("div",vf,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,B=>(i.openBlock(),i.createBlock(Cr,{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,"currency-rates":h.currencyRates},null,8,["product","cost-field-name","event-emitter","allow-price-click","show-price-history","currency-rates"]))),128)),i.createVNode(Cr,{product:h.product,"event-emitter":h.eventEmitter,"allow-price-click":h.allowPriceClick,"show-tag":!0,"show-quantity-unit":!0,"show-cost-date":h.showCostDate,"show-price-history":h.showPriceHistory,"currency-rates":h.currencyRates,"cost-field-name":"cost","additional-through-field-name":"retailCost",style:{"background-color":"var(--n-merged-td-color)"},class:"sticky right-0 border-0 border-l-2 border-solid border-gray-300 pl-2"},null,8,["product","event-emitter","allow-price-click","show-cost-date","show-price-history","currency-rates"])])):i.createCommentVNode("",!0)]),_:1}),h.showSlugs||h.showProperties?(i.openBlock(),i.createElementBlock("div",kf,[i.createElementVNode("ul",xf,[h.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:h.product.id,slug:h.product.slug},(B,k)=>(i.openBlock(),i.createElementBlock("li",{key:k}," ("+i.toDisplayString(k)+"): "+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,k)=>(i.openBlock(),i.createElementBlock("li",{key:k}," ("+i.toDisplayString(k)+"): "+i.toDisplayString(B),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)])}}}),Sf=(e,t,n)=>({key:e,title:t,className:"align-top",resizable:!0,render:r=>i.h(Cr,{product:r,costFieldName:e,eventEmitter:n.eventEmitter,allowPriceClick:n.allowPriceClick,currencyRates:n.currencyRates})}),Bf=(e,t)=>{if(e.length===0)return[];const n=[],r={};switch(D.isNil(t.isProductItemSelected)||n.push({key:"checkbox",title:"",className:"align-top",width:"32",render:s=>{var o,a;return i.h(I.NCheckbox,{checked:!!((o=t.isProductItemSelected)!=null&&o.call(t,s)),disabled:((a=t.isProductItemSelected)==null?void 0:a.call(t,s))==="disabled",onUpdateChecked:l=>{t.eventEmitter.emit("product:checked",{product:s,checked:l})}})}}),bt.getDeviceTypeByResolution()){case Xe.phone:case Xe.tablet:n.push({key:"name",title:"Наименование",className:"align-top",render:s=>i.h(Yi,{product:s,eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,showProductCosts:t.showProductCosts,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,showCostDate:t.showCostDate,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,showProductRequiredButton:t.showProductRequiredButton,currencyRates:t.currencyRates,productContextButtonsConfig:t.productContextButtonsConfig})});break;default:n.push({key:"name",title:"Наименование",className:"align-top",resizable:!0,render:s=>i.h(Yi,{product:s,eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,showCostDate:t.showCostDate,currencyRates:t.currencyRates})}),t.showProductCosts&&(D.forEach(e,s=>{D.forEach(s.priceCoefficients,o=>{r[o.coefficient.slug??""]||(r[o.coefficient.slug??""]=o.coefficient)})}),D.forEach(D.sortBy(r,["slug"]),s=>{n.push(Sf(s.slug??"",s.name,t))}),n.push({key:"cost",title:"Цена",className:"align-top",resizable:!0,render:s=>i.h(Cr,{product:s,costFieldName:"cost",additionalThroughFieldName:"retailCost",eventEmitter:t.eventEmitter,allowPriceClick:t.allowPriceClick,showQuantityUnit:!0,showPriceHistory:t.showPriceHistory,showCostDate:t.showCostDate,currencyRates:t.currencyRates})})),(t.showProductEditButton||t.showProductRequiredButton||t.showProductAddToCartButton||!D.isNil(t.productContextButtonsConfig))&&n.push({key:"actions",title:"",className:"align-top",width:"50",render:s=>i.h(wa,{product:s,eventEmitter:t.eventEmitter,showProductAddToCartButton:t.showProductAddToCartButton,showProductEditButton:t.showProductEditButton,showProductRequiredButton:t.showProductRequiredButton,productContextButtonsConfig:t.productContextButtonsConfig})});break}return n},Tf={key:0,class:"pt-0.5"},Ef={key:0},Rf={class:"line-through"},$f={key:0},Nf={key:1},Pf={class:"flex flex-row gap-1"},Ff={key:0},Mf={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},Af={class:"flex flex-col-reverse gap-2.5 sm:flex-row"},Vf={},If=i.defineComponent({...Vf,__name:"category-collapse-item",props:{categoryItem:{},filteredItems:{},isCategoryItemSelected:{type:Function,default:void 0},showCategoryHideForClientButton:{type:[Boolean,String,Function],default:!1},showCategoryRequiredButton:{type:[Boolean,String,Function],default:!1},showCategoryPinButton:{type:[Boolean,String,Function],default:!1},showCategoryEditButton:{type:[Boolean,String,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},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{type:Function,default:void 0},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(e){const t=e,n=i.inject(xr,"medium"),r=i.computed(()=>{var $;return($=t==null?void 0:t.filteredItems)==null?void 0:$[t.categoryItem.id]}),s=i.computed(()=>{var $,M;return D.isArray(($=t.categoryItem)==null?void 0:$.categories)&&((M=t.categoryItem.categories)==null?void 0:M.length)>0}),o=i.computed(()=>{var $;return D.isArray(($=t.categoryItem)==null?void 0:$.products)?t.categoryItem.products:[]}),a=i.computed(()=>Object.entries(t.categoryItem.currencyRates??{}).map(([$,M])=>`${M} руб./${k($)}`).join(", ")),l=i.computed(()=>D.isUndefined(t.filteredItems)||r.value==="*"?o.value:o.value.filter($=>{var U;const M=(U=r.value)==null?void 0:U.products;return D.isArray(M)&&M.includes($.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>D.isFunction(t.showCategoryHideForClientButton)?t.showCategoryHideForClientButton(t.categoryItem):t.showCategoryHideForClientButton),h=i.computed(()=>D.isFunction(t.showCategoryPinButton)?t.showCategoryPinButton(t.categoryItem):t.showCategoryPinButton),u=i.computed(()=>D.isFunction(t.showCategoryRequiredButton)?t.showCategoryRequiredButton(t.categoryItem):t.showCategoryRequiredButton),p=i.computed(()=>D.isFunction(t.showCategoryEditButton)?t.showCategoryEditButton(t.categoryItem):t.showCategoryEditButton),f=i.computed(()=>D.isNil(t.categoryContextButtonsConfig)?[]:D.isFunction(t.categoryContextButtonsConfig)?t.categoryContextButtonsConfig(t.categoryItem):t.categoryContextButtonsConfig),g=i.computed(()=>new Y.ClientCategory(t.categoryItem)),m=i.ref(!1),y=i.ref(!1),_=i.computed(()=>!D.isUndefined(t.isCategoryItemSelected)),b=i.computed(()=>D.isFunction(t.isCategoryItemSelected)?t.isCategoryItemSelected(t.categoryItem):t.isCategoryItemSelected),S=i.computed(()=>Z.value&&bt.getDeviceTypeByResolution()===Xe.laptop?"auto":"fixed"),x=i.useTemplateRef("collapse-item-reference"),v=i.computed(()=>{var $,M;return(M=($=t.categoryItem.properties)==null?void 0:$.templateCost)==null?void 0:M.priceCoefficient}),B=i.computed(()=>{var $,M;return(M=($=t.categoryItem.properties)==null?void 0:$.templateCost)==null?void 0:M.increasePercent}),k=($,M="ru-RU")=>0 .toLocaleString(M,{style:"currency",currency:$,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),E=$=>{t.eventEmitter.emit("category:checked",{category:t.categoryItem,checked:$,target:x.value})},P=($,M)=>{t.eventEmitter.emit("category:header-click",{categoryItem:t.categoryItem,expanded:M,isLoadingState:m,target:x.value})},N=()=>{t.eventEmitter.emit("category:hide",{category:t.categoryItem,target:x.value})},j=()=>{t.eventEmitter.emit("category:required",{category:t.categoryItem,target:x.value})},X=()=>{t.eventEmitter.emit("category:attach",{category:t.categoryItem,target:x.value})},A=()=>{t.eventEmitter.emit("category:detach",{category:t.categoryItem,target:x.value})},V=()=>{t.eventEmitter.emit("category:edit",{category:t.categoryItem,target:x.value})},L=$=>{t.eventEmitter.emit("category:context-select",{category:t.categoryItem,key:$,target:x.value})},Z=i.ref(0),F=i.computed(()=>Z.value&&o.value.length>0?Bf(o.value,{eventEmitter:t.eventEmitter,showSlugs:t.showSlugs,showProperties:t.showProperties,showProductCosts:t.showProductCosts,allowNameClick:t.allowNameClick,allowPriceClick:t.allowPriceClick,showPriceHistory:t.showPriceHistory,showCostDate:t.showCostDate,showProductAddToCartButton:t.showProductAddToCartButton,isProductItemSelected:t.isProductItemSelected,showProductEditButton:t.showProductEditButton,showProductRequiredButton:t.showProductRequiredButton,currencyRates:t.categoryItem.currencyRates,productContextButtonsConfig:t.productContextButtonsConfig}):[]),R=D.debounce(()=>{Z.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",R)}),window.addEventListener("resize",R),R(),($,M)=>{const U=I.NCheckbox,z=fu,O=I.NTooltip,ee=du,ce=I.NTag,se=au,ge=ru,ie=I.NButton,Me=tu,Ae=_a,Ze=ya,De=ma,yt=ga,Jt=I.NDropdown,Qt=I.NDataTable,_t=I.NAlert,Ot=I.NSpin;return i.openBlock(),i.createBlock(ba,{ref:"collapse-item-reference",name:$.categoryItem.id,"data-id":$.categoryItem.id,"onHeader:click":P},{"pre-arrow":i.withCtx(()=>{var Fe,Ce;return[_.value?(i.openBlock(),i.createElementBlock("div",Tf,[i.createVNode(U,{checked:b.value,disabled:b.value==="disabled","onUpdate:checked":E},null,8,["checked","disabled"])])):i.createCommentVNode("",!0),!d.value&&((Fe=g.value)!=null&&Fe.isDisabled)?(i.openBlock(),i.createBlock(O,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(z,{class:"pt-1.5"})]),default:i.withCtx(()=>[M[1]||(M[1]=i.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):i.createCommentVNode("",!0),((Ce=g.value)==null?void 0:Ce.isFavorite)??!1?(i.openBlock(),i.createBlock(O,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ee,{class:"pt-1.5"})]),default:i.withCtx(()=>[M[2]||(M[2]=i.createTextVNode(" Избранная категория ",-1))]),_:1})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var Fe,Ce,zt,Nt,Lt;return[i.createElementVNode("div",{class:i.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":$.categoryItem.isHidden,"text-gray-400":(Fe=g.value)==null?void 0:Fe.isDisabled})},[i.createVNode(O,{disabled:!$.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createElementVNode("span",null,i.toDisplayString($.categoryItem.name),1)]),default:i.withCtx(()=>[M[3]||(M[3]=i.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:M[0]||(M[0]=i.withModifiers((...Pe)=>i.unref(D.noop)&&i.unref(D.noop)(...Pe),["prevent","stop"]))},[(Ce=$.categoryItem.properties)!=null&&Ce.m2Price?(i.openBlock(),i.createBlock(ce,{key:0,size:i.unref(n),class:i.normalizeClass({"!pr-0":((zt=$.categoryItem.properties)==null?void 0:zt.templateCost)&&$.categoryItem.properties.m2PriceRetail&&B.value}),round:""},{default:i.withCtx(()=>{var Pe;return[i.createTextVNode(" Средняя стоимость: "+i.toDisplayString($.categoryItem.properties.m2Price)+" руб./м2 ",1),(Pe=$.categoryItem.properties)!=null&&Pe.templateCost&&$.categoryItem.properties.m2PriceRetail&&B.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[B.value?(i.openBlock(),i.createBlock(ce,{key:0,type:"success",bordered:!1,size:i.unref(n),class:"ml-2 !pr-0",round:""},{default:i.withCtx(()=>[B.value?(i.openBlock(),i.createElementBlock("span",Ef,i.toDisplayString(B.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0),i.createVNode(ce,{size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createElementVNode("span",Rf,i.toDisplayString($.categoryItem.properties.m2PriceRetail)+" руб./м2",1)]),_:1},8,["size"])]),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0)]}),_:1},8,["size","class"])):(Nt=$.categoryItem.properties)!=null&&Nt.templateCost?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[v.value||B.value?(i.openBlock(),i.createBlock(ce,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>{var Pe;return[v.value?(i.openBlock(),i.createElementBlock("span",$f,i.toDisplayString((Pe=v.value)==null?void 0:Pe.name),1)):i.createCommentVNode("",!0),B.value?(i.openBlock(),i.createElementBlock("span",Nf,i.toDisplayString(B.value>0?"+":"")+i.toDisplayString(B.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0)]}),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(ce,{key:2,size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createTextVNode(" Фиксированный курс: "+i.toDisplayString(a.value),1)]),_:1},8,["size"])):i.createCommentVNode("",!0),h.value&&((Lt=g.value)!=null&&Lt.manager)?(i.openBlock(),i.createBlock(ce,{key:3,size:i.unref(n),closable:!0,round:"",class:"align-bottom",onClose:A},{default:i.withCtx(()=>[i.createVNode(O,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var Pe,Q;return[i.createElementVNode("span",Pf,[i.createVNode(se),i.createTextVNode(" "+i.toDisplayString((Q=(Pe=g.value)==null?void 0:Pe.manager)==null?void 0:Q.name),1)])]}),default:i.withCtx(()=>{var Pe,Q;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((Q=(Pe=g.value)==null?void 0:Pe.manager)==null?void 0:Q.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[$.showSlugs||$.showProperties?(i.openBlock(),i.createElementBlock("div",Ff,[i.createElementVNode("ul",Mf,[$.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:$.categoryItem.id,slug:$.categoryItem.slug},(Fe,Ce)=>(i.openBlock(),i.createElementBlock("li",{key:Ce}," ("+i.toDisplayString(Ce)+"): "+i.toDisplayString(Fe),1))),128)):i.createCommentVNode("",!0),$.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList($.categoryItem.properties,(Fe,Ce)=>(i.openBlock(),i.createElementBlock("li",{key:Ce}," ("+i.toDisplayString(Ce)+"): "+i.toDisplayString(Fe),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var Fe;return[i.createElementVNode("div",Af,[d.value?(i.openBlock(),i.createBlock(O,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ie,{ghost:!0,size:i.unref(n),onClick:N},{default:i.withCtx(()=>{var Ce;return[(Ce=g.value)!=null&&Ce.isDisabled?(i.openBlock(),i.createBlock(z,{key:1})):(i.openBlock(),i.createBlock(ge,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var Ce;return[(Ce=g.value)!=null&&Ce.isDisabled?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" Скрыто для клиента"+i.toDisplayString(g.value.hidingComment?`. Причина: '${g.value.hidingComment}'`:""),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Видимо клиенту")],64))]}),_:1})):i.createCommentVNode("",!0),h.value&&!((Fe=g.value)!=null&&Fe.manager)?(i.openBlock(),i.createBlock(O,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ie,{ghost:!0,size:i.unref(n),onClick:X},{default:i.withCtx(()=>[i.createVNode(Me)]),_:1},8,["size"])]),default:i.withCtx(()=>{var Ce,zt,Nt;return[(Ce=g.value)!=null&&Ce.manager?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode('Категория закреплена за "'+i.toDisplayString(((Nt=(zt=g.value)==null?void 0:zt.manager)==null?void 0:Nt.name)??"-")+'"',1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode("Закрепить")],64))]}),_:1})):i.createCommentVNode("",!0),u.value?(i.openBlock(),i.createBlock(O,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ie,{ghost:!0,disabled:u.value==="disabled",size:i.unref(n),onClick:j},{default:i.withCtx(()=>{var Ce;return[(Ce=g.value)!=null&&Ce.isRequired?(i.openBlock(),i.createBlock(Ze,{key:1})):(i.openBlock(),i.createBlock(Ae,{key:0}))]}),_:1},8,["disabled","size"])]),default:i.withCtx(()=>{var Ce;return[(Ce=g.value)!=null&&Ce.isRequired?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Категория, которую нужно предлагать клиенту")],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode("Категория, которую клиент должен брать.")],64))]}),_:1})):i.createCommentVNode("",!0),p.value?(i.openBlock(),i.createBlock(O,{key:3,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ie,{ghost:!0,size:i.unref(n),type:"primary",onClick:V},{default:i.withCtx(()=>[i.createVNode(De)]),_:1},8,["size"])]),default:i.withCtx(()=>[M[4]||(M[4]=i.createTextVNode(" Редактировать ",-1))]),_:1})):i.createCommentVNode("",!0),f.value.length>0?(i.openBlock(),i.createBlock(Jt,{key:4,options:f.value,size:i.unref(n),trigger:"click",onSelect:L},{default:i.withCtx(()=>[i.createVNode(ie,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(yt)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot($.$slots,"default",{},()=>{var Fe;return[s.value?(i.openBlock(),i.createBlock(Sa,{key:0,"categories-items":$.categoryItem.categories??[],"has-products":c.value||m.value,"event-emitter":$.eventEmitter,"filtered-items":r.value?((Fe=r.value)==null?void 0:Fe.categories)??{}:void 0,"is-category-item-selected":$.isCategoryItemSelected,"show-slugs":$.showSlugs,"show-properties":$.showProperties,"allow-name-click":$.allowNameClick,"allow-price-click":$.allowPriceClick,"show-price-history":$.showPriceHistory,"show-cost-date":$.showCostDate,"show-category-required-button":$.showCategoryRequiredButton,"show-category-hide-for-client-button":$.showCategoryHideForClientButton,"show-category-pin-button":$.showCategoryPinButton,"show-category-edit-button":$.showCategoryEditButton,"category-context-buttons-config":$.categoryContextButtonsConfig,"is-product-item-selected":$.isProductItemSelected,"show-product-add-to-cart-button":$.showProductAddToCartButton,"show-product-costs":$.showProductCosts,"show-product-required-button":$.showProductRequiredButton,"show-product-edit-button":$.showProductEditButton,"product-context-buttons-config":$.productContextButtonsConfig},null,8,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config"])):i.createCommentVNode("",!0),c.value?(i.openBlock(),i.createBlock(Qt,{key:1,columns:F.value,data:l.value,bordered:!0,loading:m.value,remote:!0,"row-key":Ce=>Ce.id,"table-layout":S.value,class:"mt-1"},null,8,["columns","data","loading","row-key","table-layout"])):i.createCommentVNode("",!0),!m.value&&!y.value&&!s.value&&!c.value?(i.openBlock(),i.createBlock(_t,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),y.value?(i.openBlock(),i.createBlock(_t,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),m.value?(i.openBlock(),i.createBlock(Ot,{key:4,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>[...M[5]||(M[5]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),Of=jn(If,[["__scopeId","data-v-4ae8bdef"]]),zf={class:"sc-collapse flex w-full flex-col"},Lf={},Ca=i.defineComponent({...Lf,__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",zf,[i.renderSlot(o.$slots,"default")]))}}),Df={},Sa=i.defineComponent({...Df,__name:"category-collapse",props:{categoriesItems:{},hasProducts:{type:Boolean},loading:{type:Boolean,default:!1},filteredItems:{default:void 0},isCategoryItemSelected:{},showCategoryHideForClientButton:{type:[Boolean,String,Function]},showCategoryRequiredButton:{type:[Boolean,String,Function]},showCategoryPinButton:{type:[Boolean,String,Function]},showCategoryEditButton:{type:[Boolean,String,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},showCostDate:{type:[Boolean,Function],default:!1},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function],default:!1},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function],default:!1},currencyRates:{},productContextButtonsConfig:{type:Function,default:void 0}},setup(e){const t=e,n=i.inject(xr,"medium"),r=i.computed(()=>D.isUndefined(t.filteredItems)?t.categoriesItems:t.categoriesItems.filter(o=>{var a;return!!((a=t.filteredItems)!=null&&a[o.id])})),s=(o,a)=>{if(D.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=I.NSpin,c=I.NAlert;return i.openBlock(),i.createElementBlock(i.Fragment,null,[r.value.length>0?(i.openBlock(),i.createBlock(Ca,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(Of,{key:d.id,"category-item":d,"event-emitter":o.eventEmitter,"filtered-items":s(d,o.filteredItems),"is-category-item-selected":o.isCategoryItemSelected,"show-slugs":o.showSlugs,"show-properties":o.showProperties,"allow-name-click":o.allowNameClick,"allow-price-click":o.allowPriceClick,"show-price-history":o.showPriceHistory,"show-cost-date":o.showCostDate,"show-category-required-button":o.showCategoryRequiredButton,"show-category-hide-for-client-button":o.showCategoryHideForClientButton,"show-category-pin-button":o.showCategoryPinButton,"show-category-edit-button":o.showCategoryEditButton,"category-context-buttons-config":o.categoryContextButtonsConfig,"is-product-item-selected":o.isProductItemSelected,"show-product-add-to-cart-button":o.showProductAddToCartButton,"show-product-costs":o.showProductCosts,"show-product-required-button":o.showProductRequiredButton,"show-product-edit-button":o.showProductEditButton,"product-context-buttons-config":o.productContextButtonsConfig},null,8,["category-item","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-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.hasProducts&&!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)}}}),Hf={class:"text-sm"},Wf={class:"text-sm"},jf={},qf=i.defineComponent({...jf,__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,p,f,g;const n=e,r=i.ref(new Y.CartItemBase(n.cartItem??new Y.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)||((p=(u=n.product)==null?void 0:u.properties)!=null&&p.ignoreMinCountCheck?0:(g=(f=n.product)==null?void 0:f.properties)==null?void 0:g.minCount)||0}))),s=t,o=i.computed(()=>{var _,b,S,x,v,B,k,E,P;const m=((b=(_=n.product)==null?void 0:_.properties)==null?void 0:b.minLength)??((x=(S=n.product)==null?void 0:S.properties)!=null&&x.ignoreMinCountCheck?0:(B=(v=n.product)==null?void 0:v.properties)==null?void 0:B.minCount),y=(E=(k=n.product)==null?void 0:k.properties)==null?void 0:E.maxLength;return m||y?`(${m?`от ${m}`:""}${m&&y?" ":""}${y?`до ${y}`:""} ${(P=n.product)==null?void 0:P.unit})`:""}),a=()=>{Y.UnitsHelper.productIsMeasurable(n.product)||delete r.value.length,s("submit",r.value)};return(m,y)=>(i.openBlock(),i.createBlock(i.unref(I.NForm),{class:"flex flex-col gap-2"},{default:i.withCtx(()=>[i.unref(Y.UnitsHelper).productIsMeasurable(m.product)?(i.openBlock(),i.createBlock(i.unref(I.NFormItem),{key:0,required:!0,feedback:m.validation.length.feedback||"","show-feedback":m.validation.length.showFeedback||i.unref(Y.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 _,b;return[i.createVNode(i.unref(I.NInputNumber),{value:r.value.length,"onUpdate:value":y[0]||(y[0]=S=>r.value.length=S),max:((_=m.product.properties)==null?void 0:_.maxLength)||void 0,min:((b=m.product.properties)==null?void 0:b.minLength)||i.unref(Y.UnitsHelper).getProductLengthMultiplicity(m.product),step:i.unref(Y.UnitsHelper).getProductMultiplicity(m.product),validator:S=>S%i.unref(Y.UnitsHelper).getProductLengthMultiplicity(m.product)===0,placeholder:"Введите метраж",class:"w-full"},null,8,["value","max","min","step","validator"])]}),_:2},[!m.validation.length.feedback&&i.unref(Y.UnitsHelper).getProductLengthMultiplicity(m.product)!==.01?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Hf,"Метраж должен быть кратен "+i.toDisplayString(i.unref(Y.UnitsHelper).getProductLengthMultiplicity(m.product)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status","label"])):i.createCommentVNode("",!0),i.createVNode(i.unref(I.NFormItem),{required:!0,feedback:m.validation.quantity.feedback||"","show-feedback":m.validation.quantity.showFeedback||i.unref(Y.UnitsHelper).getProductMultiplicity(m.product)!==1||!1,"validation-status":m.validation.quantity.validationStatus||void 0,label:"Количество"},i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(I.NInputNumber),{value:r.value.quantity,"onUpdate:value":y[1]||(y[1]=_=>r.value.quantity=_),min:i.unref(Y.UnitsHelper).getProductMultiplicity(m.product),step:i.unref(Y.UnitsHelper).getProductMultiplicity(m.product),validator:_=>_%i.unref(Y.UnitsHelper).getProductMultiplicity(m.product)===0,placeholder:"Введите количество",class:"w-full"},null,8,["value","min","step","validator"])]),_:2},[!m.validation.quantity.feedback&&i.unref(Y.UnitsHelper).getProductMultiplicity(m.product)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Wf,"Количество должно быть кратно "+i.toDisplayString(i.unref(Y.UnitsHelper).getProductMultiplicity(m.product)),1)]),key:"0"}:void 0]),1032,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(I.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(I.NInput),{value:r.value.marker,"onUpdate:value":y[2]||(y[2]=_=>r.value.marker=_),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(I.NButton),{loading:m.isSubmitProcessing,disabled:r.value.length===0||r.value.quantity===0,type:"primary",class:"self-start",onClick:y[3]||(y[3]=_=>a())},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(m.cartItem?"Изменить":"В корзину"),1)]),_:1},8,["loading","disabled"])]),_:1}))}}),Xf={},Ba=i.defineComponent({...Xf,__name:"reference-select",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean},referenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1},sortOptionsByLabel:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},maxTagCount:{default:void 0}},emits:["update:value"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=i.computed(()=>D.isArray(r.value)),a=new Y.Reference,l=i.computed(()=>{const f=o.value?[]:a,g=D.isUndefined(r.value)?f:r.value;return D.isArray(g)?g.map(m=>m.id):g==null?void 0:g.id}),c=i.computed(()=>Dt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,r.showEmptyValue)),d=f=>{var g;if(D.isArray(f)){const m=f.length>0?f.map(y=>{var _;return(_=c.value.find(b=>b.value===y))==null?void 0:_.item}):[];s("update:value",m)}else{const m=f===a.id||(g=c.value.find(y=>y.value===f))==null?void 0:g.item;s("update:value",m)}},h=i.useTemplateRef("select-component");return t({focus:()=>{var f;return(f=h.value)==null?void 0:f.focus()},blur:()=>{var f;return(f=h.value)==null?void 0:f.blur()}}),(f,g)=>(i.openBlock(),i.createBlock(i.unref(I.NSelect),{ref:"select-component",value:l.value,clearable:r.clearable,"consistent-menu-width":f.consistentMenuWidth,disabled:f.disabled||c.value.length===0,filterable:f.filterable,"max-tag-count":f.maxTagCount,multiple:o.value,options:c.value,placeholder:"",class:"w-full","onUpdate:value":d},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),Yf={},Uf=i.defineComponent({...Yf,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{}},emits:["update:value"],setup(e,{emit:t}){var S,x;const n=e,r=t,s=()=>{const v=Y.PriceCoefficient.getRetailPriceCoefficient();return D.unset(v,"isNewRec"),v},o=v=>!v||v.id===s().id,a=i.computed(()=>{var v;return((v=n.catalogItem)==null?void 0:v.type)==="product"}),l=i.computed(()=>a.value?n.catalogItem:void 0),c=v=>{var B,k,E,P;return v.id===s().id?(B=l.value)==null?void 0:B.getRetailCost():(P=(E=(k=l.value)==null?void 0:k.priceCoefficients)==null?void 0:E.find(N=>N.coefficient.id===v.id))==null?void 0:P.cost},d=i.computed(()=>{var B;const v=[...((B=Y.useReferencesStore().priceCoefficientsReference)==null?void 0:B.map(k=>structuredClone(i.toRaw(k))))??[],s()];return a.value&&v.forEach(k=>{var P;const E=c(k);E?k.name+=` (${E} ${(P=l.value)==null?void 0:P.currency})`:k.name=""}),v.filter(k=>k.name!=="")}),h=i.ref(n.value.coefficient),u=i.ref(((x=(S=n.value)==null?void 0:S.value)==null?void 0:x.toString())??null),p=i.ref(null),f=i.computed(()=>{var v,B;return(B=(v=l.value)==null?void 0:v.priceCoefficients)==null?void 0:B.find(k=>k.coefficient.slug===Y.PriceCoefficientEnum.K0)}),g=i.ref(void 0),m=()=>{var B,k,E;g.value=void 0;let v=Number.parseFloat(((B=u.value)==null?void 0:B.replace(",","."))??"");if(v=Number.isNaN(v)?void 0:v,a.value)if(h.value||u.value){const P=s(),N=c(h.value??P)??0,j=N+N*((v??0)/100);p.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(j),j>(((k=l.value)==null?void 0:k.getRetailCost())??j)&&(g.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),f.value&&j<(((E=f.value)==null?void 0:E.cost)??0)&&(g.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else p.value=null;r("update:value",{value:Number.isNaN(v)?void 0:v,coefficient:o(h.value)?void 0:structuredClone(i.toRaw(h.value))})},y=v=>{D.isArray(v)||(h.value=v,!h.value&&u.value&&(h.value=s()),m())},_=()=>{h.value||(h.value=s()),m()},b=v=>{var k,E,P,N,j,X;const B=Number.parseFloat((v==null?void 0:v.replace(",","."))??"");if(a.value){let A=0;if(B<=0)h.value=void 0,u.value=null;else if(f.value&&B<(((k=f.value)==null?void 0:k.cost)??0))h.value=(E=f.value)==null?void 0:E.coefficient,A=(B-f.value.cost)*100/f.value.cost,g.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(B>(((P=l.value)==null?void 0:P.getRetailCost())??B)){h.value=s();const V=((N=l.value)==null?void 0:N.getRetailCost())??0;A=(B-V)*100/V,g.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const V=(X=(j=l.value)==null?void 0:j.priceCoefficients)==null?void 0:X.filter(L=>L.cost<B);if(V&&V.length>0){const L=V.at(-1);h.value=L==null?void 0:L.coefficient,A=(B-((L==null?void 0:L.cost)??0))*100/((L==null?void 0:L.cost)??1)}g.value={validationStatus:void 0,feedback:void 0}}u.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:5}).format(A),r("update:value",{value:Number.isNaN(A)?void 0:A,coefficient:o(h.value)?void 0:structuredClone(i.toRaw(h.value))})}else r("update:value",{value:Number.isNaN(B)?void 0:B,coefficient:void 0})};return i.onMounted(()=>{var v,B,k,E;n.calculationType===Y.CalculationTypeEnum.m2Cost?p.value=((B=(v=n.value)==null?void 0:v.value)==null?void 0:B.toString())??null:!((k=n.value)!=null&&k.coefficient)&&((E=n.value)!=null&&E.value)&&(h.value=s()),m()}),(v,B)=>{var P,N,j;const k=I.NInput,E=I.NInputGroup;return i.openBlock(),i.createBlock(i.unref(I.NFormItem),{"show-label":!i.unref(D.isNil)(v.label),label:v.label,"show-feedback":!i.unref(D.isNil)(((P=g.value)==null?void 0:P.feedback)??v.feedback),feedback:((N=g.value)==null?void 0:N.feedback)??v.feedback,"validation-status":((j=g.value)==null?void 0:j.validationStatus)??v.validationStatus},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([{"sm:grid-cols-3":a.value&&v.calculationType!==i.unref(Y.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[v.calculationType!==i.unref(Y.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(E,{key:0,class:i.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:i.withCtx(()=>[i.createVNode(Ba,{class:"w-full min-w-0 flex-1",value:h.value,"reference-list":d.value,clearable:v.clearable,disabled:v.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"onUpdate:value":y},null,8,["value","reference-list","clearable","disabled"]),i.createVNode(k,{value:u.value,"onUpdate:value":[B[0]||(B[0]=X=>u.value=X),_],clearable:v.clearable,disabled:v.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},i.createSlots({suffix:i.withCtx(()=>[B[3]||(B[3]=i.createTextVNode("%",-1))]),_:2},[u.value&&!u.value.startsWith("-")?{name:"prefix",fn:i.withCtx(()=>[B[2]||(B[2]=i.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):i.createCommentVNode("",!0),a.value||v.calculationType===i.unref(Y.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(k,{key:1,value:p.value,"onUpdate:value":[B[1]||(B[1]=X=>p.value=X),b],clearable:v.clearable,disabled:v.disabled,placeholder:"Стоимость",class:"w-full"},i.createSlots({_:2},[a.value?{name:"suffix",fn:i.withCtx(()=>{var X;return[i.createTextVNode(i.toDisplayString((X=l.value)==null?void 0:X.currency),1)]}),key:"0"}:void 0]),1032,["value","clearable","disabled"])):i.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),Gf={class:"flex flex-row gap-1"},Kf={class:"sc-client-name flex flex-col gap-1 text-base"},Zf=["href"],Jf={key:1,class:"text-sc-grey"},Qf={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},ep={key:0},tp={key:1,class:"text-sm"},np={},Tr=i.defineComponent({...np,__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?$n.format(n.client.lastLoginAt,Y.AppConfigProvider.getConfig().dateFormats.uiDateWithTime):""),o=a=>{D.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=Es,d=I.NButton,h=I.NPopover;return i.openBlock(),i.createElementBlock("div",Gf,[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(D.isNil)(a.popoverPosition),placement:a.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",Kf,[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",Jf," [ Деактивирован ] "))],8,Zf),a.showCityAndRegion&&a.client.city?(i.openBlock(),i.createElementBlock("span",Qf," г. "+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",ep,i.toDisplayString(a.client.alternativeName),1)):i.createCommentVNode("",!0),s.value?(i.openBlock(),i.createElementBlock("span",tp," Последний вход: "+i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),ip={class:"text-base"},rp={},Ta=i.defineComponent({...rp,__name:"contragent-with-short-info",props:{contragent:{}},setup(e){return(t,n)=>(i.openBlock(),i.createElementBlock("span",ip,i.toDisplayString(t.contragent.name),1))}}),sp={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function op(e,t){return i.openBlock(),i.createElementBlock("svg",sp,[...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 ap=i.markRaw({name:"tabler-mail",render:op}),lp=["href"],cp={},dp=i.defineComponent({...cp,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(e){return(t,n)=>{const r=ap;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,lp)],2)}}}),hp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function up(e,t){return i.openBlock(),i.createElementBlock("svg",hp,[...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 Ea=i.markRaw({name:"fa6-brands-viber",render:up}),fp={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},pp=["id"],gp=["id"],mp=["fill"],yp=["fill"];function _p(e,t){return i.openBlock(),i.createElementBlock("svg",fp,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:e.idMap.SVGBRLHCcSy,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,pp),i.createElementVNode("linearGradient",{id:e.idMap.SVGHW6lecxh,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,gp)]),i.createElementVNode("path",{fill:"url(#"+e.idMap.SVGBRLHCcSy+")",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,mp),i.createElementVNode("path",{fill:"url(#"+e.idMap.SVGHW6lecxh+")",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,yp),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 Ra=i.markRaw({name:"logos-whatsapp-icon",render:_p,setup(){const e=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+e(),SVGHW6lecxh:"uicons-"+e()}}}}),bp={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},wp=["id"],vp=["fill"];function kp(e,t){return i.openBlock(),i.createElementBlock("svg",bp,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:e.idMap.SVGuySfwdaH,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,wp)]),i.createElementVNode("path",{fill:"url(#"+e.idMap.SVGuySfwdaH+")",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,vp),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 $a=i.markRaw({name:"logos-telegram",render:kp,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),xp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Cp(e,t){return i.openBlock(),i.createElementBlock("svg",xp,[...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 Na=i.markRaw({name:"ion-call",render:Cp}),Sp={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Bp(e,t){return i.openBlock(),i.createElementBlock("svg",Sp,[...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 Tp=i.markRaw({name:"tabler-phone-call",render:Bp}),Ep={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},Rp=["href"],$p=["href"],Np=["href"],Pp=["href"],Fp={},Mp=i.defineComponent({...Fp,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(e){const t=e,n=i.computed(()=>{try{return t.phone?qi.parsePhoneNumberWithError(t.phone,t.defaultCountry):void 0}catch{}return t.phone}),r=i.computed(()=>{var l;return D.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),s=i.computed(()=>{var l;return D.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var l;return D.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=Tp,h=Na,u=$a,p=Ra,f=Ea;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",Ep,[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,Rp)):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,$p)):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(p)],8,Np)):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(f)],8,Pp)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),Ap={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Vp(e,t){return i.openBlock(),i.createElementBlock("svg",Ap,[...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 Ip=i.markRaw({name:"mdi-envelope",render:Vp}),Op={class:"flex flex-col gap-1"},zp={key:0,class:"mb-2 flex flex-col text-base"},Lp={key:0,class:"text-sc-dark-grey text-sm"},Dp={key:1,class:"whitespace-nowrap text-sm"},Hp={key:2,class:"whitespace-nowrap text-sm"},Wp={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},jp=["href"],qp=["href"],Xp=["href"],Yp=["href"],Up=["href"],Gp={key:0,class:"flex flex-col text-base"},Kp={key:0,class:"text-sc-dark-grey text-sm"},Zp={key:1,class:"mt-2 text-sm"},Jp={key:0,class:"-mt-1"},Qp={},eg=i.defineComponent({...Qp,__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?qi.parsePhoneNumberWithError(t.contact.phone,t.defaultCountry):void 0}catch{}return t.contact.phone}),r=i.computed(()=>{var c;return D.isString(n.value)?!1:((c=n.value)==null?void 0:c.isValid())??!1}),s=i.computed(()=>{var c;return D.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("INTERNATIONAL"))??""}),o=i.computed(()=>{var c;return D.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=Na,u=$a,p=Ra,f=Ea,g=Ip,m=I.NPopover;return i.openBlock(),i.createElementBlock("div",Op,[i.createVNode(m,{disabled:c.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var b,S,x,v;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",zp,[i.createTextVNode(i.toDisplayString(c.contact.name)+" ",1),(x=c.contact)!=null&&x.position?(i.openBlock(),i.createElementBlock("span",Lp,i.toDisplayString((v=c.contact)==null?void 0:v.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),c.contact.phone?(i.openBlock(),i.createElementBlock("div",Dp,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),c.contact.email?(i.openBlock(),i.createElementBlock("div",Hp,i.toDisplayString(c.contact.email),1)):i.createCommentVNode("",!0),a.value&&l.value?(i.openBlock(),i.createElementBlock("div",Wp,[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,jp)):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,qp)):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(p)],8,Xp)):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(f)],8,Yp)):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,Up)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var b,S,x,v;return[c.contact.name?(i.openBlock(),i.createElementBlock("div",Gp,[i.createTextVNode(i.toDisplayString(c.contact.name)+" ",1),(b=c.contact)!=null&&b.position?(i.openBlock(),i.createElementBlock("span",Kp,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",Zp,[d[4]||(d[4]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((v=c.contact)==null?void 0:v.comment),1)])):i.createCommentVNode("",!0)]}),_:1},8,["disabled"]),c.fullView&&((y=c.contact)!=null&&y.comment)?(i.openBlock(),i.createElementBlock("div",Jp,[d[5]||(d[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((_=c.contact)==null?void 0:_.comment),1)])):i.createCommentVNode("",!0)])}}}),tg={key:0,class:"flex w-fit items-center gap-2"},ng={key:1,class:"flex flex-wrap gap-1"},ig={key:0},rg={},Ui=i.defineComponent({...rg,__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=I.NSpin;return r.isProductSearching?(i.openBlock(),i.createElementBlock("div",tg,[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",ng,[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",ig,"(Планируемая дата производства: "+i.toDisplayString(n.value)+")",1)):i.createCommentVNode("",!0)]))}}}),sg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function og(e,t){return i.openBlock(),i.createElementBlock("svg",sg,[...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 Er=i.markRaw({name:"ion-close",render:og}),ag={class:"mr-3 flex flex-col gap-2"},lg=["onClick"],cg={class:"h-full p-2"},dg={},hg=i.defineComponent({...dg,__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=Er;return i.openBlock(),i.createBlock(i.unref(I.NScrollbar),{style:{"max-height":"12.5rem",width:"auto"},trigger:"none"},{default:i.withCtx(()=>[i.createElementVNode("div",ag,[(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(I.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",cg,[i.createElementVNode("div",{ref_for:!0,ref:"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,lg)]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(c.label),1)]),_:2},1024),c.isCustom&&!c.isNewRec()?(i.openBlock(),i.createBlock(i.unref(I.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})}}}),Pa=jn(hg,[["__scopeId","data-v-828c3059"]]),ug={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function fg(e,t){return i.openBlock(),i.createElementBlock("svg",ug,[...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 Fa=i.markRaw({name:"ion-trash",render:fg}),pg={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function gg(e,t){return i.openBlock(),i.createElementBlock("svg",pg,[...t[0]||(t[0]=[i.createElementVNode("path",{d:"M448 224H288V64h-64v160H64v64h160v160h64V288h160z",fill:"currentColor"},null,-1)])])}const Ma=i.markRaw({name:"ion-plus",render:gg}),mg={class:"flex flex-col gap-4"},yg={class:"flex flex-col gap-2"},_g={class:"mt-8 font-bold"},bg={class:"grid grow grid-cols-2 items-start gap-2"},wg={class:"flex flex-col gap-4"},vg={class:"flex gap-3"},kg={},Aa=i.defineComponent({...kg,__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 Y.CartItemBase(n.value);h[c]=d,r("update:value",h)};return i.watch(()=>n.value.configuratorParams,c=>{s.value=D.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=Ma,u=Fa,p=I.NInput;return i.openBlock(),i.createBlock(i.unref(I.NForm),{class:"grid gap-2 md:grid-cols-2 md:gap-6"},{default:i.withCtx(()=>{var f,g,m,y,_,b,S,x,v;return[i.createElementVNode("div",mg,[d[10]||(d[10]=i.createElementVNode("span",{class:"w-full font-bold"},"Ширина участка, мм / Угол сгиба, ° (А)",-1)),c.settings.startTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(I.NFormItem),{key:0,required:!0,"show-feedback":!1,label:"Тип стартового капельника"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NSelect),{value:s.value.startTailType,"onUpdate:value":[d[0]||(d[0]=B=>s.value.startTailType=B),a],options:c.settings.startTailConfigs.map(({label:B},k)=>({label:B,value:k})),placeholder:"Тип стартового капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",yg,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value.linesAngles,(B,k)=>{var E,P,N,j,X,A;return i.openBlock(),i.createElementBlock("div",{key:k,class:"flex items-start gap-2"},[i.createElementVNode("div",_g,i.toDisplayString(k+1),1),i.createElementVNode("div",bg,[i.createVNode(i.unref(I.NFormItem),{label:"Ширина, мм",required:!0,feedback:((E=c.validation[`lines_widths[${k+1}]`])==null?void 0:E.feedback)||"","show-feedback":((P=c.validation[`lines_widths[${k+1}]`])==null?void 0:P.showFeedback)||!1,"validation-status":(N=c.validation[`lines_widths[${k+1}]`])==null?void 0:N.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NInputNumber),{value:s.value.linesWidths[k],"onUpdate:value":[V=>s.value.linesWidths[k]=V,a],min:s.value.linesWidths.length>1?c.settings.minLineWidth:c.settings.stripMinWidth,max:c.settings.maxLineWidth,step:c.settings.lineWidthStep,validator:V=>V%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(I.NFormItem),{label:"Угол сгиба, °",required:!0,feedback:((j=c.validation[`lines_angles[${k+1}]`])==null?void 0:j.feedback)||"","show-feedback":((X=c.validation[`lines_angles[${k+1}]`])==null?void 0:X.showFeedback)||!1,"validation-status":(A=c.validation[`lines_angles[${k+1}]`])==null?void 0:A.validationStatus},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NInputNumber),{value:s.value.linesAngles[k],"onUpdate:value":[V=>s.value.linesAngles[k]=V,a],min:c.settings.minLineAngle,max:c.settings.maxLineAngle,step:c.settings.lineAngleStep,validator:V=>V%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(I.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(I.NButton),{key:0,size:"medium",onClick:V=>r("click:add-line",k)},{default:i.withCtx(()=>[i.createVNode(h)]),_:2},1032,["onClick"])),c.settings.showOnlyTemplates?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(I.NButton),{key:1,disabled:s.value.linesWidths.length===1,size:"medium",class:"ml-2",onClick:V=>r("click:remove-line",k)},{default:i.withCtx(()=>[i.createVNode(u)]),_:2},1032,["disabled","onClick"]))]),_:2},1024)])}),128))]),c.settings.endTailConfigs.length>0?(i.openBlock(),i.createBlock(i.unref(I.NFormItem),{key:1,label:"Тип конечного капельника","show-feedback":!1,required:!0},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NSelect),{value:s.value.endTailType,"onUpdate:value":[d[1]||(d[1]=B=>s.value.endTailType=B),a],options:c.settings.endTailConfigs.map(({label:B},k)=>({label:B,value:k})),placeholder:"Тип конечного капельника"},null,8,["value","options"])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Ui,{"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(I.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)])]),_:1},8,["loading"])):i.createCommentVNode("",!0)]),i.createElementVNode("div",wg,[i.createVNode(i.unref(I.NFormItem),{label:"С какой стороны изделие будет иметь цвет","show-feedback":!1},{default:i.withCtx(()=>[i.createVNode(i.unref(I.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(I.NFormItem),{required:!0,"show-feedback":((f=c.validation.length)==null?void 0:f.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(I.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(I.NFormItem),{required:!0,"show-feedback":((y=c.validation.quantity)==null?void 0:y.showFeedback)||!1,feedback:((_=c.validation.quantity)==null?void 0:_.feedback)||"","validation-status":(b=c.validation.quantity)==null?void 0:b.validationStatus,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.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(I.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":(v=c.validation.marker)==null?void 0:v.validationStatus,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(p,{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",vg,[i.createVNode(i.unref(I.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(I.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)])]),_:1})):i.createCommentVNode("",!0)])])]}),_:1})}}});var Va=Object.defineProperty,xg=Object.defineProperties,Cg=Object.getOwnPropertyDescriptors,Ia=Object.getOwnPropertySymbols,Sg=Object.prototype.hasOwnProperty,Bg=Object.prototype.propertyIsEnumerable,$s=(e,t,n)=>t in e?Va(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ns=(e,t)=>{for(var n in t||(t={}))Sg.call(t,n)&&$s(e,n,t[n]);if(Ia)for(var n of Ia(t))Bg.call(t,n)&&$s(e,n,t[n]);return e},Ps=(e,t)=>xg(e,Cg(t)),Oa=(e,t)=>{for(var n in t)Va(e,n,{get:t[n],enumerable:!0})},w=(e,t,n)=>($s(e,typeof t!="symbol"?t+"":t,n),n),za=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Tt=(e,t,n)=>(za(e,t,"read from private field"),n?n.call(e):t.get(e)),La=(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)},Tg=(e,t,n,r)=>(za(e,t,"write to private field"),t.set(e,n),n),wt={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 wt.shim(e),typeof t<"u"&&(wt.Image=t),wt.isHeadless=!0,e}},Da={};Oa(Da,{Curve:()=>xi,getAnchorsFromArcData:()=>$g,getComponentOnCubicBezier:()=>Gi,getControlPoints:()=>Qa,getCurveBoundingBox:()=>Ka,getCurveFromPoints:()=>Ja,getCurveLength:()=>Ga,getReflection:()=>As,integrate:()=>Za,subdivide:()=>Ms});var Ha={};Oa(Ha,{HALF_PI:()=>Je,NumArray:()=>tn,TWO_PI:()=>lt,decomposeMatrix:()=>ki,getComputedMatrix:()=>qa,getPoT:()=>Xa,lerp:()=>Pt,mod:()=>Ft,setMatrix:()=>ja,toFixed:()=>$e});var He;typeof window<"u"?He=window:typeof global<"u"?He=global:typeof self<"u"&&(He=self);var Wa,lt=Math.PI*2,Je=Math.PI*.5;function ki(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 ja(e){Wa=e}function qa(e,t){t=t&&t.identity()||new Wa;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 Pt(e,t,n){return n*(t-e)+e}var Fs=[2,4,8,16,32,64,128,256,512,1024,2048,4096];function Xa(e){let t=0;for(;Fs[t]&&Fs[t]<e;)t++;return Fs[t]}function Ft(e,t){for(;e<0;)e+=t;return e%t}var tn=He.Float32Array||Array,Eg=Math.floor;function $e(e){return Eg(e*1e6)/1e6}var ne={move:"M",line:"L",curve:"C",arc:"A",close:"Z"},q=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(q,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),w(q,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);var Ya={x:{enumerable:!0,get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this._bound&&this.dispatchEvent(q.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this._bound&&this.dispatchEvent(q.Types.change))}}},Yt=class extends q{constructor(e=0,t=0){super(),w(this,"_x",0),w(this,"_y",0);for(let n in Ya)Object.defineProperty(this,n,Ya[n]);this.x=e,this.y=t}static add(e,t){return new Yt(e.x+t.x,e.y+t.y)}static sub(e,t){return new Yt(e.x-t.x,e.y-t.y)}static subtract(e,t){return Yt.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(Yt.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 Yt(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:$e(this.x),y:$e(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}},J=Yt;w(J,"zero",new Yt),w(J,"left",new Yt(-1,0)),w(J,"right",new Yt(1,0)),w(J,"up",new Yt(0,-1)),w(J,"down",new Yt(0,1));var ve=class extends J{constructor(t=0,n=0,r=0,s=0,o=0,a=0,l=ne.move){super(t,n),w(this,"controls",{left:new J,right:new J}),w(this,"_command",ne.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 Ua)Object.defineProperty(this,d,Ua[d]);this.command=l,this.relative=!0;const c=ve.makeBroadcast(this);this.controls.left.set(r,s).addEventListener(q.Types.change,c),this.controls.right.set(o,a).addEventListener(q.Types.change,c)}static makeBroadcast(t){return n;function n(){t._bound&&t.dispatchEvent(q.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:$e(this.x),y:$e(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:$e(this.rx),ry:$e(this.ry),xAxisRotation:$e(this.xAxisRotation),largeArcFlag:$e(this.largeArcFlag),sweepFlag:$e(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}},Ua={command:{enumerable:!0,get:function(){return this._command},set:function(e){this._command!==e&&(this._command=e,this._bound&&this.dispatchEvent(q.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(e){this._relative!==!!e&&(this._relative=!!e,this._bound&&this.dispatchEvent(q.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(e){this._rx!==e&&(this._rx=e,this._bound&&this.dispatchEvent(q.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(e){this._ry!==e&&(this._ry=e,this._bound&&this.dispatchEvent(q.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(e){this._xAxisRotation!==e&&(this._xAxisRotation=e,this._bound&&this.dispatchEvent(q.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag!==e&&(this._largeArcFlag=e,this._bound&&this.dispatchEvent(q.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag!==e&&(this._sweepFlag=e,this._bound&&this.dispatchEvent(q.Types.change))}}},Rg=0,vt={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.8.19",PublishDate:"2025-06-27T18:00:39.187Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return Rg++}},xi={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 Gi(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 Ms(e,t,n,r,s,o,a,l,c){c=c||xi.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 p=u/d,f=Gi(p,e,n,s,a),g=Gi(p,t,r,o,l);h.push(new ve(f,g))}return h}function Ga(e,t,n,r,s,o,a,l,c){if(e===n&&t===r&&s===a&&o===l){const y=a-e,_=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),p=9*(r-o)+3*(l-t),f=6*(t+o)-12*r,g=3*(r-t);function m(y){const _=(d*y+h)*y+u,b=(p*y+f)*y+g;return Math.sqrt(_*_+b*b)}return Za(m,0,1,c||xi.RecursionLimit)}function Ka(e,t,n,r,s,o,a,l){const c=[],d=[[],[]];let h,u,p,f,g,m,y,_;for(let v=0;v<2;++v){if(v==0?(u=6*e-12*n+6*s,h=-3*e+9*n-9*s+3*a,p=3*n-3*e):(u=6*t-12*r+6*o,h=-3*t+9*r-9*o+3*l,p=3*r-3*t),Math.abs(h)<1e-12){if(Math.abs(u)<1e-12)continue;f=-p/u,0<f&&f<1&&c.push(f);continue}y=u*u-4*p*h,_=Math.sqrt(y),!(y<0)&&(g=(-u+_)/(2*h),0<g&&g<1&&c.push(g),m=(-u-_)/(2*h),0<m&&m<1&&c.push(m))}let b=c.length,S=b,x;for(;b--;)f=c[b],x=1-f,d[0][b]=x*x*x*e+3*x*x*f*n+3*x*f*f*s+f*f*f*a,d[1][b]=x*x*x*t+3*x*x*f*r+3*x*f*f*o+f*f*f*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 Za(e,t,n,r){let s=xi.abscissas[r-2],o=xi.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 Ja(e,t){const n=e.length,r=n-1;for(let s=0;s<n;s++){const o=e[s],a=t?Ft(s-1,n):Math.max(s-1,0),l=t?Ft(s+1,n):Math.min(s+1,r),c=e[a],d=o,h=e[l];Qa(c,d,h),d.command=s===0?ne.move:ne.curve}}function Qa(e,t,n){const r=J.angleBetween(e,t),s=J.angleBetween(n,t);let o=J.distanceBetween(e,t),a=J.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+=Je:l-=Je,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 As(e,t,n){return new J(2*e.x-(t.x+e.x)-(n?e.x:0),2*e.y-(t.y+e.y)-(n?e.y:0))}function $g(e,t,n,r,s,o,a){const l=vt.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),p=r*Math.sin(h),f=new ve(u,p);f.command=ne.line}}var el=Array.prototype.slice;function Ng(e){if(e==null)return!1;const t=e.length;return typeof t=="number"&&t>=0&&t<4294967296}var G={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},isFunction:function(e){return typeof e=="function"},extend:function(e){const t=el.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=el.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=!Ng(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},Mt={hasEventListeners:typeof He.addEventListener=="function",bind:function(e,t,n,r){return this.hasEventListeners?e.addEventListener(t,n,!!r):e.attachEvent("on"+t,n),Mt},unbind:function(e,t,n,r){return Mt.hasEventListeners?e.removeEventListeners(t,n,!!r):e.detachEvent("on"+t,n),Mt},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}},Ci=He.document?He.document.createElement("div"):{};Ci.id="help-two-load",Object.defineProperty(Mt,"temp",{enumerable:!0,get:function(){return G.isElement(Ci)&&!He.document.head.contains(Ci)&&(Ci.style.display="none",He.document.head.appendChild(Ci)),Ci}});var Et=class extends Error{constructor(t){super(),w(this,"name","Two.js"),w(this,"message"),this.message=t}},Pg=He.devicePixelRatio||1;function Fg(e){return e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1}function Vs(e){return Pg/Fg(e)}var Rr=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}},ct,Nn=class extends Array{constructor(){super(),La(this,ct,new q),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 Tt(this,ct)}set _events(t){Tg(this,ct,t)}get _bound(){return Tt(this,ct)._bound}set _bound(t){Tt(this,ct)._bound=t}addEventListener(){return Tt(this,ct).addEventListener.apply(this,arguments)}on(){return Tt(this,ct).on.apply(this,arguments)}bind(){return Tt(this,ct).bind.apply(this,arguments)}removeEventListener(){return Tt(this,ct).removeEventListener.apply(this,arguments)}off(){return Tt(this,ct).off.apply(this,arguments)}unbind(){return Tt(this,ct).unbind.apply(this,arguments)}dispatchEvent(){return Tt(this,ct).dispatchEvent.apply(this,arguments)}trigger(){return Tt(this,ct).trigger.apply(this,arguments)}listen(){return Tt(this,ct).listen.apply(this,arguments)}ignore(){return Tt(this,ct).ignore.apply(this,arguments)}pop(){const t=super.pop.apply(this,arguments);return this.trigger(q.Types.remove,[t]),t}shift(){const t=super.shift.apply(this,arguments);return this.trigger(q.Types.remove,[t]),t}push(){const t=super.push.apply(this,arguments);return this.trigger(q.Types.insert,arguments),t}unshift(){const t=super.unshift.apply(this,arguments);return this.trigger(q.Types.insert,arguments),t}splice(){const t=super.splice.apply(this,arguments);if(this.trigger(q.Types.remove,t),arguments.length>2){const n=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(q.Types.insert,n),this.trigger(q.Types.order)}return t}sort(){return super.sort.apply(this,arguments),this.trigger(q.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(q.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}};ct=new WeakMap;var tl=class extends q{constructor(){super(),w(this,"_flagId",!1),w(this,"_flagClassName",!1),w(this,"_renderer",{}),w(this,"_id",vt.Identifier+vt.uniqueId()),w(this,"_className",""),w(this,"classList",[]);for(let e in nl)Object.defineProperty(this,e,nl[e])}static fromObject(e){const t=new tl().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}}},qn=tl;w(qn,"Properties",["renderer","id","className"]);var nl={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)}}},$r,il={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};He.document&&($r=document.createElement("a"));var Qe=class extends qn{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 rl)Object.defineProperty(this,n,rl[n]);if(this._renderer.type="texture",this._renderer.flagOffset=Mg.bind(this),this._renderer.flagScale=Ag.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new J,typeof t=="function"){const n=(function(){this.unbind(q.Types.load,n),typeof t=="function"&&t()}).bind(this);this.bind(q.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 Qe().copy(e);return"id"in e&&(t.id=e.id),t}static getAbsoluteURL(e){return $r?($r.href=e,$r.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=Qe.getAbsoluteURL(e);if(Qe.ImageRegistry.contains(t))return Qe.ImageRegistry.get(t);let n;return wt.Image?(n=new wt.Image,wt.shim(n,"img")):He.document?il.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=Qe.getTag(n);e._flagImage&&(/canvas/i.test(r)?Qe.Register.canvas(e,t):(e._src=!wt.isHeadless&&n.getAttribute("two-src")||n.src,Qe.Register[r](e,t))),e._flagSrc&&(n||(n=Qe.getImage(e.src),e.image=n),r=Qe.getTag(n),Qe.Register[r](e,t))}clone(){const e=new Qe(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 J?e.offset:new J().copy(e.offset),this.scale=typeof e.scale=="number"||e.scale instanceof J?e.scale:new J().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(q.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Qe.load(this,(function(){this.loaded=!0,this.trigger(q.Types.change).trigger(q.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}},Te=Qe;w(Te,"Properties",["src","loaded","repeat","scale","offset","image"]),w(Te,"RegularExpressions",il),w(Te,"ImageRegistry",new Rr),w(Te,"Register",{canvas:function(e,t){e._src="#"+e.id,Qe.ImageRegistry.add(e.src,e.image),typeof t=="function"&&t()},img:function(e,t){const n=e.image,r=function(o){!wt.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!wt.isHeadless&&typeof n.removeEventListener=="function"&&(n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1)),new Et("unable to load "+e.src)};typeof n.width=="number"&&n.width>0&&typeof n.height=="number"&&n.height>0?r():!wt.isHeadless&&typeof n.addEventListener=="function"&&(n.addEventListener("load",r,!1),n.addEventListener("error",s,!1)),e._src=Qe.getAbsoluteURL(e._src),!(!wt.isHeadless&&n&&n.getAttribute("two-src"))&&(wt.isHeadless||n.setAttribute("two-src",e.src),Qe.ImageRegistry.add(e.src,n),wt.isHeadless?Qe.loadHeadlessBuffer(e,r):e.image.src=e.src)},video:function(e,t){if(wt.isHeadless)throw new Et("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 Et("unable to load "+e.src)};e._src=Qe.getAbsoluteURL(e._src),e.image.getAttribute("two-src")||(e.image.setAttribute("two-src",e.src),Qe.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 rl={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=Te.getTag(e);let n;switch(t){case"canvas":n="#"+e.id;break;default:n=e.src}Te.ImageRegistry.contains(n)?this._image=Te.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(q.Types.change,this._renderer.flagOffset),this._offset=e,this._offset.bind(q.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof J&&this._scale.unbind(q.Types.change,this._renderer.flagScale),this._scale=e,this._scale instanceof J&&this._scale.bind(q.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Mg(){this._flagOffset=!0}function Ag(){this._flagScale=!0}var Ut=class extends qn{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 sl)Object.defineProperty(this,r,sl[r]);this._renderer.type="stop",this.offset=typeof e=="number"?e:Ut.Index<=0?0:1,this.opacity=typeof n=="number"?n:1,this.color=typeof t=="string"?t:Ut.Index<=0?"#fff":"#000",Ut.Index=(Ut.Index+1)%2}static fromObject(e){const t=new Ut().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Ut.Properties.length;t++){const n=Ut.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Ut;return G.each(Ut.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",G.each(Ut.Properties,t=>{e[t]=this[t]},this),e}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}},nn=Ut;w(nn,"Index",0),w(nn,"Properties",["offset","opacity","color"]);var sl={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)}}},Xn=class extends qn{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 ol)Object.defineProperty(this,t,ol[t]);this._renderer.type="gradient",this._renderer.flagStops=Vg.bind(this),this._renderer.bindStops=Ig.bind(this),this._renderer.unbindStops=Og.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 nn?r:new nn().copy(r)));const n=new Xn().copy(e);return"id"in e&&(n.id=e.id),n}clone(e){const t=this.stops.map(r=>r.clone()),n=new Xn(t);return G.each(Xn.Properties,r=>{n[r]=this[r]},this),e&&e.add(n),n}copy(e){super.copy.call(this,e);for(let t=0;t<Xn.Properties.length;t++){const n=Xn.Properties[t];n in e&&(this[n]=e[n])}return this}toObject(){const e={stops:this.stops.map(t=>t.toObject())};return G.each(Xn.Properties,t=>{e[t]=this[t]},this),e}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(q.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}},Ue=Xn;w(Ue,"Stop",nn),w(Ue,"Properties",["spread","stops","units"]);var ol={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(q.Types.insert,t).unbind(q.Types.remove,n),this._stops=new Nn((e||[]).slice(0)),this._stops.bind(q.Types.insert,t).bind(q.Types.remove,n),t(this._stops)}}};function Vg(){this._flagStops=!0}function Ig(e){let t=e.length;for(;t--;)e[t].bind(q.Types.change,this._renderer.flagStops),e[t].parent=this;this._renderer.flagStops()}function Og(e){let t=e.length;for(;t--;)e[t].unbind(q.Types.change,this._renderer.flagStops),delete e[t].parent;this._renderer.flagStops()}var Ki=class extends Ue{constructor(e,t,n,r,s){super(s),w(this,"_flagEndPoints",!1),w(this,"_left",null),w(this,"_right",null);for(let o in al)Object.defineProperty(this,o,al[o]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=zg.bind(this),this.left=new J,this.right=new J,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 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]instanceof J?e[n]:new J().copy(e[n]))}return this}clone(e){const t=this.stops.map(function(r){return r.clone()}),n=new Ki(this.left._x,this.left._y,this.right._x,this.right._y,t);return G.each(Ue.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(q.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}},Ie=Ki;w(Ie,"Stop",nn),w(Ie,"Properties",["left","right"]);var al={left:{enumerable:!0,get:function(){return this._left},set:function(e){this._left instanceof J&&this._left.unbind(q.Types.change,this._renderer.flagEndPoints),this._left=e,this._left.bind(q.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(e){this._right instanceof J&&this._right.unbind(q.Types.change,this._renderer.flagEndPoints),this._right=e,this._right.bind(q.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function zg(){this._flagEndPoints=!0}var Yn=class extends Ue{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 ll)Object.defineProperty(this,a,ll[a]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Lg.bind(this),this._renderer.flagFocal=Dg.bind(this),this.center=new J,this.radius=typeof n=="number"?n:1,this.focal=new J,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 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&&(/(center|focal)i/.test(n)?this[n]=e[n]instanceof J?e[n]:new J().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 Yn(this.center._x,this.center._y,this._radius,t,this.focal._x,this.focal._y);return G.each(Ue.Properties.concat(Yn.Properties),function(r){n[r]=this[r]},this),e&&e.add(n),n}toObject(){const e=super.toObject.call(this);return G.each(Yn.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(q.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}},Oe=Yn;w(Oe,"Stop",nn),w(Oe,"Properties",["center","radius","focal"]);var ll={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(q.Types.change,this._renderer.flagCenter),this._center=e,this._center.bind(q.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(e){this._focal&&this._focal.unbind(q.Types.change,this._renderer.flagFocal),this._focal=e,this._focal.bind(q.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function Lg(){this._flagCenter=!0}function Dg(){this._flagFocal=!0}function cl(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 Nr(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 dl(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,p=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(p||e).x,d=(p||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),p&&e._relative&&(o+=e.x,d+=e.y),Ga(r,l,s,c,o,d,a,h,n)}function hl(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,p=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(p||e).x,d=(p||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),p&&e._relative&&(o+=e.x,d+=e.y),Ms(r,l,s,c,o,d,a,h,n)}function Un(e){switch(e.renderer.type){case"texture":return Te.fromObject(e);case"gradient":return Ue.fromObject(e);case"linear-gradient":return Ie.fromObject(e);case"radial-gradient":return Oe.fromObject(e)}return e}var Hg=Math.cos,Wg=Math.sin,ul=Math.tan,Is=[],At=class extends q{constructor(e,t,n,r,s,o){super(),w(this,"elements",new tn(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 v=e;let B,k,E;const P=t[0]||0,N=t[1]||0,j=t[2]||0;return B=v[0]*P+v[1]*N+v[2]*j,k=v[3]*P+v[4]*N+v[5]*j,E=v[6]*P+v[7]*N+v[8]*j,[B,k,E]}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],p=t[0],f=t[1],g=t[2],m=t[3],y=t[4],_=t[5],b=t[6],S=t[7],x=t[8];return n=n||new tn(9),n[0]=r*p+s*m+o*b,n[1]=r*f+s*y+o*S,n[2]=r*g+s*_+o*x,n[3]=a*p+l*m+c*b,n[4]=a*f+l*y+c*S,n[5]=a*g+l*_+c*x,n[6]=d*p+h*m+u*b,n[7]=d*f+h*y+u*S,n[8]=d*g+h*_+u*x,n}static fromObject(e){return new At().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(q.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(q.Types.change)}identity(){return this.elements[0]=At.Identity[0],this.elements[1]=At.Identity[1],this.elements[2]=At.Identity[2],this.elements[3]=At.Identity[3],this.elements[4]=At.Identity[4],this.elements[5]=At.Identity[5],this.elements[6]=At.Identity[6],this.elements[7]=At.Identity[7],this.elements[8]=At.Identity[8],this.trigger(q.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(q.Types.change);if(typeof n>"u"&&(n=1),typeof r>"u"){e=e||0,t=t||0,n=n||0,s=this.elements;const A=s[0]*e+s[1]*t+s[2]*n,V=s[3]*e+s[4]*t+s[5]*n,L=s[6]*e+s[7]*t+s[8]*n;return[A,V,L]}const d=this.elements,h=[e,t,n,r,s,o,a,l,c],u=d[0],p=d[1],f=d[2],g=d[3],m=d[4],y=d[5],_=d[6],b=d[7],S=d[8],x=h[0],v=h[1],B=h[2],k=h[3],E=h[4],P=h[5],N=h[6],j=h[7],X=h[8];return this.elements[0]=u*x+p*k+f*N,this.elements[1]=u*v+p*E+f*j,this.elements[2]=u*B+p*P+f*X,this.elements[3]=g*x+m*k+y*N,this.elements[4]=g*v+m*E+y*j,this.elements[5]=g*B+m*P+y*X,this.elements[6]=_*x+b*k+S*N,this.elements[7]=_*v+b*E+S*j,this.elements[8]=_*B+b*P+S*X,this.trigger(q.Types.change)}inverse(e){const t=this.elements;e=e||new At;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,p=-h*o+l*c,f=d*o-a*c;let g=n*u+r*p+s*f;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]=p*g,e.elements[4]=(h*n-s*c)*g,e.elements[5]=(-l*n+s*o)*g,e.elements[6]=f*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=Hg(e),n=Wg(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=ul(e);return this.multiply(1,t,0,0,1,0,0,0,1)}skewY(e){const t=ul(e);return this.multiply(1,0,0,t,1,0,0,0,1)}toString(e){return Is.length=0,this.toTransformArray(e,Is),Is.map($e).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],p=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]=p;return}return[s,l,h,o,c,u,a,d,p]}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],p=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]=p;return}return[s,o,a,l,c,d,h,u,p]}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 At().copy(this)}},Gn=At;w(Gn,"Identity",[1,0,0,0,1,0,0,0,1]),ja(Gn);var Os=class extends qn{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 Pr)Object.defineProperty(this,e,Pr[e]);this._renderer.flagMatrix=fl.bind(this),this.isShape=!0,this.matrix=new Gn,this.worldMatrix=new Gn,this.position=new J,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(e){const t=new Os().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 Pr.position.get.apply(this,arguments)}set translation(e){Pr.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 J?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 J?e.scale:new J(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 Os;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 J?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 J?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}},mn=Os;w(mn,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);var Pr={position:{enumerable:!0,get:function(){return this._position},set:function(e){this._position&&this._position.unbind(q.Types.change,this._renderer.flagMatrix),this._position=e,this._position.bind(q.Types.change,this._renderer.flagMatrix),fl.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 J&&this._scale.unbind(q.Types.change,this._renderer.flagMatrix),this._scale=e,this._scale instanceof J&&this._scale.bind(q.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 qa(this,this._worldMatrix),this._worldMatrix},set:function(e){this._worldMatrix=e}}};function fl(){this._flagMatrix=!0}var Si=Math.min,Bi=Math.max,jg=Math.ceil,qg=Math.floor,Xg=new J,Pn=class extends mn{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 pl)Object.defineProperty(this,s,pl[s]);this._renderer.type="path",this._renderer.flagVertices=gl.bind(this),this._renderer.bindVertices=ml.bind(this),this._renderer.unbindVertices=yl.bind(this),this._renderer.flagFill=_l.bind(this),this._renderer.flagStroke=bl.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:Un(e.fill),n=typeof e.stroke=="string"?e.stroke:Un(e.stroke),r=new Pn().copy(Ps(Ns({},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<Pn.Properties.length;t++){const n=Pn.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Pn;for(let n=0;n<this.vertices.length;n++)t.vertices.push(this.vertices[n].clone());for(let n=0;n<Pn.Properties.length;n++){const r=Pn.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()),G.each(Pn.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:p}=ki(t.elements[0],t.elements[3],t.elements[1],t.elements[4],t.elements[2],t.elements[5]);typeof u=="number"&&typeof p=="number"&&(n=Math.max(u,p)*(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,p]=t.multiply(o.x,o.y),[f,g]=t.multiply(a.x,a.y);if(o.controls&&a.controls){let m=o.controls.right.x,y=o.controls.right.y;o.relative&&(m+=o.x,y+=o.y);let[_,b]=t.multiply(m,y),S=a.controls.left.x,x=a.controls.left.y;a.relative&&(S+=a.x,x+=a.y);let[v,B]=t.multiply(S,x);const k=Ka(u,p,_,b,v,B,f,g);d=Si(k.min.y-n,d),l=Si(k.min.x-n,l),c=Bi(k.max.x+n,c),h=Bi(k.max.y+n,h)}else s<=1&&(d=Si(p-n,d),l=Si(u-n,l),c=Bi(u+n,c),h=Bi(p+n,h)),d=Si(g-n,d),l=Si(f-n,l),c=Bi(f+n,c),h=Bi(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,p,f,g,m,y,_=this.length*Math.min(Math.max(e,0),1);const b=this.vertices.length,S=b-1;let x=null,v=null;for(let Z=0,F=this._lengths.length,R=0;Z<F;Z++){if(R+this._lengths[Z]>=_){this._closed?(n=Ft(Z,b),r=Ft(Z-1,b),Z===0&&(n=r,r=Z)):(n=Z,r=Math.min(Math.max(Z-1,0),S)),x=this.vertices[n],v=this.vertices[r],_-=R,this._lengths[Z]!==0?e=_/this._lengths[Z]:e=0;break}R+=this._lengths[Z]}if(x===null||v===null)return null;if(x){if(!v)return x}else return v;y=v.controls&&v.controls.right,m=x.controls&&x.controls.left,a=v.x,u=v.y,l=(y||v).x,p=(y||v).y,c=(m||x).x,f=(m||x).y,d=x.x,g=x.y,y&&v.relative&&(l+=v.x,p+=v.y),m&&x.relative&&(c+=x.x,f+=x.y),o=Gi(e,a,l,c,d),h=Gi(e,u,p,f,g);const B=Pt(a,l,e),k=Pt(u,p,e),E=Pt(l,c,e),P=Pt(p,f,e),N=Pt(c,d,e),j=Pt(f,g,e),X=Pt(B,E,e),A=Pt(k,P,e),V=Pt(E,N,e),L=Pt(P,j,e);return G.isObject(t)?(t.x=o,t.y=h,t instanceof ve&&(t.controls.left.x=X,t.controls.left.y=A,t.controls.right.x=V,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,X-o,A-h,V-o,L-h,this._curved?ne.curve:ne.line),s.t=e,s)}plot(){if(this.curved)return Ja(this._collection,this.closed),this;for(let e=0;e<this._collection.length;e++)this._collection[e].command=e===0?ne.move:ne.line;return this}subdivide(e){this._update();const t=this.vertices.length-1,n=this._closed||this.vertices[t]._command===ne.close;let r=this.vertices[t],s=[],o;return G.each(this.vertices,function(a,l){if(l<=0&&!n){r=a;return}if(a.command===ne.move){s.push(new ve(r.x,r.y)),l>0&&(s[s.length-1].command=ne.line),r=a;return}o=hl(a,r,e),s=s.concat(o),G.each(o,function(c,d){d<=0&&r.command===ne.move?c.command=ne.move:c.command=ne.line}),l>=t&&(this._closed&&this._automatic&&(r=a,o=hl(a,r,e),s=s.concat(o),G.each(o,function(c,d){d<=0&&r.command===ne.move?c.command=ne.move:c.command=ne.line})),s.push(new ve(a.x,a.y)),s[s.length-1].command=n?ne.close:ne.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=[]),G.each(this.vertices,function(a,l){if(l<=0||a.command===ne.move){s=a,this._lengths[l]=0;return}this._lengths[l]=dl(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=Nr(this,n*this._length),o=Nr(this,r*this._length),a=jg(s),l=qg(o);let c,d,h,u,p,f;for(this._renderer.vertices.length=0,f=0;f<e;f++)this._renderer.collection.length<=f&&this._renderer.collection.push(new ve),f>l&&!d?(p=this._renderer.collection[f].copy(this._collection[f]),this.getPointAt(r,p),p.command=this._renderer.collection[f].command,this._renderer.vertices.push(p),d=p,h=this._collection[f-1],h&&h.controls&&(p.relative?p.controls.right.clear():p.controls.right.copy(p),h.relative?this._renderer.collection[f-1].controls.right.copy(h.controls.right).lerp(J.zero,1-p.t):this._renderer.collection[f-1].controls.right.copy(h.controls.right).lerp(h,1-p.t))):f>=a&&f<=l&&(p=this._renderer.collection[f].copy(this._collection[f]),this._renderer.vertices.push(p),f===l&&cl(this,r)?(d=p,!t&&d.controls&&(d.relative?d.controls.right.clear():d.controls.right.copy(d))):f===a&&cl(this,n)&&(c=p,c.command=ne.move,!t&&c.controls&&(c.relative?c.controls.left.clear():c.controls.left.copy(c))));a>0&&!c&&(f=a-1,p=this._renderer.collection[f].copy(this._collection[f]),this.getPointAt(n,p),p.command=ne.move,this._renderer.vertices.unshift(p),u=this._collection[f+1],u&&u.controls&&(p.controls.left.clear(),u.relative?this._renderer.collection[f+1].controls.left.copy(u.controls.left).lerp(J.zero,p.t):(Xg.copy(u),this._renderer.collection[f+1].controls.left.copy(u.controls.left).lerp(u,p.t))))}return mn.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,mn.prototype.flagReset.call(this),this}},xe=Pn;w(xe,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes"]),w(xe,"Utils",{getCurveLength:dl});var pl={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 Ue||this._fill instanceof Ie||this._fill instanceof Oe||this._fill instanceof Te)&&this._fill.unbind(q.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Ue||this._fill instanceof Ie||this._fill instanceof Oe||this._fill instanceof Te)&&this._fill.bind(q.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Ue||this._stroke instanceof Ie||this._stroke instanceof Oe||this._stroke instanceof Te)&&this._stroke.unbind(q.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Ue||this._stroke instanceof Ie||this._stroke instanceof Oe||this._stroke instanceof Te)&&this._stroke.bind(q.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";G.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(q.Types.insert,t).unbind(q.Types.remove,n),e instanceof Nn?this._collection=e:this._collection=new Nn(e||[]),this._collection.bind(q.Types.insert,t).bind(q.Types.remove,n),t(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,G.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 gl(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function ml(e){let t=e.length;for(;t--;)e[t].bind(q.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function yl(e){let t=e.length;for(;t--;)e[t].unbind(q.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function _l(){this._flagFill=!0}function bl(){this._flagStroke=!0}var Zi=class extends xe{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 wl)Object.defineProperty(this,o,wl[o]);this.width=typeof n=="number"?n:1,this.height=typeof r=="number"?r:1,this.origin=new J,typeof e=="number"&&(this.translation.x=e),typeof t=="number"&&(this.translation.y=t),this._update()}static fromObject(e){const t=new Zi().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Zi.Properties.length;t++){const n=Zi.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=ne.move,this.vertices[1].set(e,-t).sub(this._origin).command=ne.line,this.vertices[2].set(e,t).sub(this._origin).command=ne.line,this.vertices[3].set(-e,t).sub(this._origin).command=ne.line,this.vertices[4]&&(this.vertices[4].set(-e,-t).sub(this._origin).command=ne.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(e){const t=new Zi(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<xe.Properties.length;n++){const r=xe.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}},Fn=Zi;w(Fn,"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}},origin:{enumerable:!0,get:function(){return this._origin},set:function(e){this._origin&&this._origin.unbind(q.Types.change,this._renderer.flagVertices),this._origin=e,this._origin.bind(q.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Ji=class extends Fn{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 vl)Object.defineProperty(this,a,vl[a]);this.noStroke(),this.noFill(),e instanceof Te?this.texture=e:typeof e=="string"&&(this.texture=new Te(e)),this.origin=new J,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 Ji().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Ji.Properties.length;t++){const n=Ji.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=G.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 Ji(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&&(G.isNaN(this._lastFrame)&&(this._lastFrame=a-1),o=G.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=Pt(this._firstFrame,u,o/l),c=Math.floor(c),c!==this._index&&(this._index=c,c>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const p=this._index%t,f=Math.floor(this._index/t),g=-r*p+(d-r)/2,m=-s*f+(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}},Fr=Ji;w(Fr,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);var vl={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}}},zs,kl=class extends Nn{constructor(t){t=Array.isArray(t)?t:Array.prototype.slice.call(arguments),super(t),La(this,zs,{}),this.attach(t),this.on(q.Types.insert,this.attach),this.on(q.Types.remove,this.detach)}get ids(){return Tt(this,zs)}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}};zs=new WeakMap;var Kn=class extends xe{constructor(e,t,n,r,s,o,a){const l=a||vt.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",lt),w(this,"_innerRadius",0),w(this,"_outerRadius",0),this._renderer.type="arc-segment";for(let d in xl)Object.defineProperty(this,d,xl[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 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];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=Ft(e,lt)===Ft(t,lt),o=n>0,a=this.vertices;let l=o?a.length/2:a.length,c,d=0,h,u,p,f,g,m,y,_,b;for(s?l--:o||(l-=2),h=0,u=l-1;h<l;h++){switch(p=h/u,f=a[d],g=p*(t-e)+e,m=(t-e)/l,y=r*Math.cos(g),_=r*Math.sin(g),h){case 0:c=ne.move;break;default:c=ne.curve}f.command=c,f.x=y,f.y=_,f.controls.left.clear(),f.controls.right.clear(),f.command===ne.curve&&(b=r*m/Math.PI,f.controls.left.x=b*Math.cos(g-Je),f.controls.left.y=b*Math.sin(g-Je),f.controls.right.x=b*Math.cos(g+Je),f.controls.right.y=b*Math.sin(g+Je),h===1&&f.controls.left.multiplyScalar(2),h===u&&f.controls.right.multiplyScalar(2)),d++}if(o){for(s?(a[d].command=ne.close,d++):(l--,u=l-1),h=0;h<l;h++)p=h/u,f=a[d],g=(1-p)*(t-e)+e,m=(t-e)/l,y=n*Math.cos(g),_=n*Math.sin(g),c=ne.curve,h<=0&&(c=s?ne.move:ne.line),f.command=c,f.x=y,f.y=_,f.controls.left.clear(),f.controls.right.clear(),f.command===ne.curve&&(b=n*m/Math.PI,f.controls.left.x=b*Math.cos(g+Je),f.controls.left.y=b*Math.sin(g+Je),f.controls.right.x=b*Math.cos(g-Je),f.controls.right.y=b*Math.sin(g-Je),h===1&&f.controls.left.multiplyScalar(2),h===u&&f.controls.right.multiplyScalar(2)),d++;a[d].copy(a[0]),a[d].command=ne.line}else s||(a[d].command=ne.line,a[d].x=0,a[d].y=0,d++,a[d].copy(a[0]),a[d].command=ne.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 Kn(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<xe.Properties.length;l++){const c=xe.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<Kn.Properties.length;t++){const n=Kn.Properties[t];e[n]=this[n]}return e}},Mr=Kn;w(Mr,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);var xl={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}}},Ls=Math.cos,Ds=Math.sin,Zn=class extends xe{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 Cl)Object.defineProperty(this,a,Cl[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 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._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*lt,l=n*Ls(a),c=n*Ds(a),d=r*Ls(a-Je),h=r*Ds(a-Je),u=r*Ls(a+Je),p=r*Ds(a+Je),f=this.vertices[s];f.command=s===0?ne.move:ne.curve,f.set(l,c),f.controls.left.set(d,h),f.controls.right.set(u,p)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(e){const t=new Zn(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<xe.Properties.length;n++){const r=xe.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<Zn.Properties.length;t++){const n=Zn.Properties[t];e[n]=this[n]}return e}},Qi=Zn;w(Qi,"Properties",["radius"]);var Cl={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this._flagRadius=!0}}},Hs=Math.cos,Ws=Math.sin,Jn=class extends xe{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 Sl)Object.defineProperty(this,l,Sl[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 Jn().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Jn.Properties.length;t++){const n=Jn.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*lt,l=n*Hs(a),c=r*Ws(a),d=n*t*Hs(a-Je),h=r*t*Ws(a-Je),u=n*t*Hs(a+Je),p=r*t*Ws(a+Je),f=this.vertices[s];f.command=s===0?ne.move:ne.curve,f.set(l,c),f.controls.left.set(d,h),f.controls.right.set(u,p)}}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 Jn(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<xe.Properties.length;o++){const a=xe.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<Jn.Properties.length;t++){const n=Jn.Properties[t];e[n]=this[n]}return e}},er=Jn;w(er,"Properties",["width","height"]);var Sl={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}}},Yg=Math.ceil,Ug=Math.floor,Mn=class extends mn{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",xe.prototype.noFill),w(this,"noStroke",xe.prototype.noStroke),w(this,"corner",xe.prototype.corner),w(this,"center",xe.prototype.center),w(this,"getBoundingClientRect",xe.prototype.getBoundingClientRect),w(this,"_updateLength",xe.prototype._updateLength);for(let t in Bl)Object.defineProperty(this,t,Bl[t]);this._renderer.type="points",this._renderer.flagVertices=gl.bind(this),this._renderer.bindVertices=ml.bind(this),this._renderer.unbindVertices=yl.bind(this),this._renderer.flagFill=_l.bind(this),this._renderer.flagStroke=bl.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:Un(e.fill),n=typeof e.stroke=="string"?e.stroke:Un(e.stroke),r=new Mn().copy(Ps(Ns({},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<Mn.Properties.length;t++){const n=Mn.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Mn;for(let n=0;n<this.vertices.length;n++)t.vertices.push(this.vertices[n].clone());for(let n=0;n<Mn.Properties.length;n++){const r=Mn.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()),G.each(Mn.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=Ms(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=Nr(this,e*this._length),r=Nr(this,t*this._length),s=Yg(n),o=Ug(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}},Ar=Mn;w(Ar,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes"]);var Bl={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 Ue||this._fill instanceof Ie||this._fill instanceof Oe||this._fill instanceof Te)&&this._fill.unbind(q.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Ue||this._fill instanceof Ie||this._fill instanceof Oe||this._fill instanceof Te)&&this._fill.bind(q.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Ue||this._stroke instanceof Ie||this._stroke instanceof Oe||this._stroke instanceof Te)&&this._stroke.unbind(q.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Ue||this._stroke instanceof Ie||this._stroke instanceof Oe||this._stroke instanceof Te)&&this._stroke.bind(q.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(q.Types.insert,t).unbind(q.Types.remove,n),e instanceof Nn?this._collection=e:this._collection=new Nn(e||[]),this._collection.bind(q.Types.insert,t).bind(q.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}}},Gg=Math.cos,Kg=Math.sin,Qn=class extends xe{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 Tl)Object.defineProperty(this,s,Tl[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 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._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=lt*s+Math.PI/2,a=this._width*Gg(o)/2,l=this._height*Kg(o)/2;r>=n?this.vertices.push(new ve(a,l)):this.vertices[r].set(a,l),this.vertices[r].command=r===0?ne.move:ne.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 Qn(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<xe.Properties.length;n++){const r=xe.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<Qn.Properties.length;t++){const n=Qn.Properties[t];e[n]=this[n]}return e}},Vr=Qn;w(Vr,"Properties",["width","height","sides"]);var Tl={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}}},ei=class extends xe{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?ne.move:ne.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 El)Object.defineProperty(this,a,El[a]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=Zg.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 ei().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<ei.Properties.length;t++){const n=ei.Properties[t];if(n in e){const r=e[n];/radius/i.test(n)?this[n]=typeof r=="number"||r instanceof J?r:new J().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 J?(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 ei(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<xe.Properties.length;o++){const a=xe.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<ei.Properties.length;t++){const n=ei.Properties[t];e[n]=this[n]}return e.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),e}},tr=ei;w(tr,"Properties",["width","height","radius"]);var El={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 J&&this._radius.unbind(q.Types.change,this._renderer.flagRadius),this._radius=e,this._radius instanceof J&&this._radius.bind(q.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function Zg(){this._flagRadius=!0}var Jg=Math.cos,Qg=Math.sin,ti=class extends xe{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 Rl)Object.defineProperty(this,o,Rl[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 ti().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<ti.Properties.length;t++){const n=ti.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=lt*s,a=(r%2?this._outerRadius:this._innerRadius)/2,l=a*Jg(o),c=a*Qg(o);r>=n?this.vertices.push(new ve(l,c)):this.vertices[r].set(l,c),this.vertices[r].command=r===0?ne.move:ne.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 ti(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<xe.Properties.length;o++){const a=xe.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<ti.Properties.length;t++){const n=ti.Properties[t];e[n]=this[n]}return e}},Ir=ti;w(Ir,"Properties",["innerRadius","outerRadius","sides"]);var Rl={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}}},js,$l=Math.min,Nl=Math.max;He.document&&(js=document.createElement("canvas"));var Vt=class extends mn{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 Pl)Object.defineProperty(this,s,Pl[s]);if(this._renderer.type="text",this._renderer.flagFill=em.bind(this),this._renderer.flagStroke=tm.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,!G.isObject(r))return this;for(let s=0;s<Vt.Properties.length;s++){const o=Vt.Properties[s];o in r&&(this[o]=r[o])}}static Measure(e){if(js){const t=js.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*Vt.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:Un(e.fill),n=typeof e.stroke=="string"?e.stroke:Un(e.stroke),r=new Vt().copy(Ps(Ns({},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<Vt.Properties.length;t++){const n=Vt.Properties[t];n in e&&(this[n]=e[n])}return this}clone(e){const t=new Vt(this.value);t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale;for(let n=0;n<Vt.Properties.length;n++){const r=Vt.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<Vt.Properties.length;t++){const n=Vt.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}=Vt.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,p]=t.multiply(n,o),[f,g]=t.multiply(r,s),[m,y]=t.multiply(r,o);return s=$l(h,p,g,y),n=$l(d,u,f,m),r=Nl(d,u,f,m),o=Nl(h,p,g,y),{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}},Ht=Vt;w(Ht,"Ratio",.6),w(Ht,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes"]);var Pl={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 Ue||this._fill instanceof Ie||this._fill instanceof Oe||this._fill instanceof Te)&&this._fill.unbind(q.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof Ue||this._fill instanceof Ie||this._fill instanceof Oe||this._fill instanceof Te)&&this._fill.bind(q.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof Ue||this._stroke instanceof Ie||this._stroke instanceof Oe||this._stroke instanceof Te)&&this._stroke.unbind(q.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof Ue||this._stroke instanceof Ie||this._stroke instanceof Oe||this._stroke instanceof Te)&&this._stroke.bind(q.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,G.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 em(){this._flagFill=!0}function tm(){this._flagStroke=!0}var Or=Math.min,zr=Math.max,Ti=class extends mn{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 Fl)Object.defineProperty(this,t,Fl[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++)Ml.call(this,e[t],this)}static RemoveChildren(e){for(let t=0;t<e.length;t++)Ml.call(this,e[t])}static OrderChildren(e){this._flagOrder=!0}static fromObject(e){const t=new Ti;for(let r=0;r<Ti.Properties.length;r++){const s=Ti.Properties[r];s in e&&(/(fill|stroke)/i.test(s)?t[s]=typeof e[s]=="string"?e[s]:Un(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 Mr.fromObject(r);case"circle":return Qi.fromObject(r);case"ellipse":return er.fromObject(r);case"points":return Ar.fromObject(r);case"polygon":return Vr.fromObject(r);case"rectangle":return Fn.fromObject(r);case"rounded-rectangle":return tr.fromObject(r);case"star":return Ir.fromObject(r);case"path":return xe.fromObject(r);case"text":return Ht.fromObject(r);case"group":return Ti.fromObject(r);case"shape":return mn.fromObject(r);case"element":return qn.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 Ti,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,G.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 p=0;p<this.children.length;p++){const f=this.children[p];if(!(!f.visible||u.test(f._renderer.type))&&(t=f.getBoundingClientRect(e),r=typeof t.top!="number"||G.isNaN(t.top)||!isFinite(t.top),s=typeof t.left!="number"||G.isNaN(t.left)||!isFinite(t.left),o=typeof t.right!="number"||G.isNaN(t.right)||!isFinite(t.right),a=typeof t.bottom!="number"||G.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,v]=n.multiply(t.right,t.bottom);d=Or(m,_,S,v,d),l=Or(g,y,b,x,l),c=zr(g,y,b,x,c),h=zr(m,_,S,v,h)}else d=Or(t.top,d),l=Or(t.left,l),c=zr(t.right,c),h=zr(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}},Ke=Ti;w(Ke,"Children",kl),w(Ke,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);var Fl={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=Ke.InsertChildren.bind(this),n=Ke.RemoveChildren.bind(this),r=Ke.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new kl(e),this._children.bind(q.Types.insert,t),this._children.bind(q.Types.remove,n),this._children.bind(q.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,G.isObject(e)&&!e.clip&&(e.clip=!0)}}};function Ml(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 Lr=class extends xe{constructor(t,n,r,s){const o=[new ve(t,n),new ve(r,s)];super(o);for(let a in Al)Object.defineProperty(this,a,Al[a]);this.vertices[0].command=ne.move,this.vertices[1].command=ne.line,this.automatic=!1}};w(Lr,"Properties",["left","right"]);var Al={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(e){if(G.isObject(e))this.vertices.splice(0,1,e);else{const t=new Et("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(G.isObject(e))this.vertices.splice(1,1,e);else{const t=new Et("Two.Line.y argument is not an object.");console.warn(t.name,t.message)}}}},rn={path:/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,cssBackgroundImage:/url\(['"]?#([\w\d-_]*)['"]?\)/i,unitSuffix:/[a-zA-Z%]*/i},nm={start:"left",middle:"center",end:"right"},Vl=["id","class","transform","xmlns","viewBox"],im=["x","y","width","height","href","xlink:href"];function rm(e){return nm[e]}function sm(e){const t=e.getAttribute("dominant-baseline"),n=e.getAttribute("alignment-baseline");return t||n}function nr(e){return e.replace(/svg:/gi,"").toLowerCase()}function Il(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 om(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 am(e){const t={},n=lm(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 lm(e){const t=e.getAttributeNames();for(let n=0;n<Vl.length;n++){const r=Vl[n],s=Array.prototype.indexOf.call(t,r);s>=0&&t.splice(s,1)}return t}function cm(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 p=e.children[u];"translation"in p?p.translation.add(r,s):"x"in p?p.x=r:"y"in p&&(p.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 J(1,1)),d&&(e.scale.x=e.width/o),h&&(e.scale.y=e.height/a),e.mask=new Fn(0,0,o,a),e.mask.origin.set(-o/2,-a/2),e}function Wt(e,t,n){const r={},s={},o={};let a,l,c,d,h,u,p,f,g,m,y,_,b,S,x,v,B;if(e===null)return r;if(He.getComputedStyle){const k=He.getComputedStyle(e);for(a=k.length;a--;)c=k[a],d=k[c],typeof d<"u"&&(r[c]=d)}for(a=0;a<e.attributes.length;a++)u=e.attributes[a],/style/i.test(u.nodeName)?om(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&&G.defaults(r,n),G.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(p=ki(l),t._renderer.type){case"linear-gradient":Il(p,t.left),Il(p,t.right);break;case"radial-gradient":t.center.x+=p.translateX,t.center.y+=p.translateY,t.focal.x+=p.translateX,t.focal.y+=p.translateY,t.radius*=Math.max(p.scaleX,p.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;p=ki(l),t.translation.set(p.translateX,p.translateY),t.rotation=Math.PI*(p.rotation/180),t.scale=new J(p.scaleX,p.scaleY),f=parseFloat((r.x+"").replace("px")),g=parseFloat((r.y+"").replace("px")),f&&(t.translation.x=f),g&&(t.translation.y=g);break;case"visible":if(t instanceof Ke){t._visible=d;break}t.visible=d;break;case"stroke-linecap":if(t instanceof Ke){t._cap=d;break}t.cap=d;break;case"stroke-linejoin":if(t instanceof Ke){t._join=d;break}t.join=d;break;case"stroke-miterlimit":if(t instanceof Ke){t._miter=d;break}t.miter=d;break;case"stroke-width":if(t instanceof Ke){t._linewidth=parseFloat(d);break}t.linewidth=parseFloat(d);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(t instanceof Ke){t._opacity=parseFloat(d);break}t.opacity=parseFloat(d);break;case"clip-path":if(rn.cssBackgroundImage.test(d)&&(m=d.replace(rn.cssBackgroundImage,"$1"),Le.defs.current&&Le.defs.current.contains(m)&&(_=Le.defs.current.get(m),_&&_.childNodes.length>0)))switch(_=_.childNodes[0],b=nr(_.nodeName),t.mask=Le[b].call(this,_,{}),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 Ke?"_":"")+c,rn.cssBackgroundImage.test(d)?(m=d.replace(rn.cssBackgroundImage,"$1"),Le.defs.current&&Le.defs.current.contains(m)?(_=Le.defs.current.get(m),_.object||(b=nr(_.nodeName),_.object=Le[b].call(this,_,{})),_=_.object):(y=hm(this),_=y.getById(m)),t[h]=_):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 Ue,x=t instanceof Ie,v=t instanceof Oe,S||x||v)break;d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Et("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 Ht&&(t.family=d);break;case"font-size":t instanceof Ht&&(d.match("[a-z%]$")&&!d.endsWith("px")&&(B=new Et("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 Ht&&(t.weight=d);break;case"font-style":t instanceof Ht&&(t.style=d);break;case"text-decoration":t instanceof Ht&&(t.decoration=d);break;case"line-height":t instanceof Ht&&(t.leading=d);break}return Object.keys(e.dataset).length&&(t.dataset=e.dataset),r}function dm(e,t){for(let n=0,r=e.childNodes.length;n<r;n++){const s=e.childNodes[n];!s.id||nr(e.nodeName)==="#text"||t.add(s.id,s)}}function hm(e){for(;e.parent;)e=e.parent;return e.scene}var Le={svg:function(e){const t=Le.defs.current=new Rr,n=e.getElementsByTagName("defs");for(let g=0;g<n.length;g++)dm(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,p=l!==null,f=c!==null;return h&&(r.x=parseFloat(o.replace(rn.unitSuffix,""))),u&&(r.y=parseFloat(a.replace(rn.unitSuffix,""))),p&&(r.width=parseFloat(l.replace(rn.unitSuffix,""))),f&&(r.height=parseFloat(c.replace(rn.unitSuffix,""))),d&&cm(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 Et("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 Et("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=im.includes(d.nodeName),u=!a.hasAttribute(d.nodeName);(h||u)&&a.setAttribute(d.nodeName,d.value)}const l=nr(a.nodeName);return Le[l].call(this,a,t)},g:function(e,t){const n=new Ke;Wt.call(this,e,n,t),this.add(n);const r=am.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=nr(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 xe(r,!0);return s.stroke="none",s.fill="black",Wt.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;G.each(h.slice(0),function(p,f){const g=p.slice(1).trim().match(rn.path),m=p[0],y=m.toLowerCase();let _,b,S,x,v;const B=[];switch(f===0&&(h=[]),y){case"h":case"v":g.length>1&&(_=1);break;case"m":case"l":case"t":g.length>2&&(_=2);break;case"s":case"q":g.length>4&&(_=4);break;case"c":g.length>6&&(_=6);break;case"a":g.length>7&&(_=7);break}if(_){for(b=0,S=g.length,v=0;b<S;b+=_){if(x=m,v>0)switch(m){case"m":x="l";break;case"M":x="L";break}B.push(x+g.slice(b,b+_).join(" ")),v++}h=Array.prototype.concat.apply(h,B)}else h.push(p)}),G.each(h,function(p,f){let g,m,y;const _=p[0],b=_.toLowerCase();d=p.slice(1).trim().match(rn.path),o=_===b;let S,x,v,B,k,E,P,N,j,X,A,V,L,Z,F,R,$;switch(b){case"z":if(f>=u)s=!0;else{m=l.x,y=l.y,g=new ve(m,y,void 0,void 0,void 0,void 0,ne.close);for(let M=r.length-1;M>=0;M--){const U=r[M];if(/m/i.test(U.command)){l=U;break}}}break;case"m":case"l":c=void 0,m=parseFloat(d[0]),y=parseFloat(d[1]),g=new ve(m,y,void 0,void 0,void 0,void 0,/m/i.test(b)?ne.move:ne.line),o&&g.addSelf(l),l=g;break;case"h":case"v":X=/h/i.test(b)?"x":"y",A=/x/i.test(X)?"y":"x",g=new ve(void 0,void 0,void 0,void 0,void 0,void 0,ne.line),g[X]=parseFloat(d[0]),g[A]=l[A],o&&(g[X]+=l[X]),l=g;break;case"c":case"s":S=l.x,x=l.y,c||(c=new J),/c/i.test(b)?(v=parseFloat(d[0]),B=parseFloat(d[1]),k=parseFloat(d[2]),E=parseFloat(d[3]),P=parseFloat(d[4]),N=parseFloat(d[5])):(j=As(l,c,o),v=j.x,B=j.y,k=parseFloat(d[0]),E=parseFloat(d[1]),P=parseFloat(d[2]),N=parseFloat(d[3])),o&&(v+=S,B+=x,k+=S,E+=x,P+=S,N+=x),l.controls.right.set(v-l.x,B-l.y),g=new ve(P,N,k-P,E-N,void 0,void 0,ne.curve),l=g,c=g.controls.left;break;case"t":case"q":S=l.x,x=l.y,c||(c=new J),/q/i.test(b)?(v=parseFloat(d[0]),B=parseFloat(d[1]),k=parseFloat(d[0]),E=parseFloat(d[1]),P=parseFloat(d[2]),N=parseFloat(d[3])):(j=As(l,c,o),v=j.x,B=j.y,k=j.x,E=j.y,P=parseFloat(d[0]),N=parseFloat(d[1])),o&&(v+=S,B+=x,k+=S,E+=x,P+=S,N+=x),l.controls.right.set((v-l.x)*.33,(B-l.y)*.33),g=new ve(P,N,k-P,E-N,void 0,void 0,ne.curve),l=g,c=g.controls.left;break;case"a":S=l.x,x=l.y,L=parseFloat(d[0]),Z=parseFloat(d[1]),F=parseFloat(d[2]),R=parseFloat(d[3]),$=parseFloat(d[4]),P=parseFloat(d[5]),N=parseFloat(d[6]),o&&(P+=S,N+=x),V=new ve(P,N),V.command=ne.arc,V.rx=L,V.ry=Z,V.xAxisRotation=F,V.largeArcFlag=R,V.sweepFlag=$,g=V,l=V,c=void 0;break}g&&(Array.isArray(g)?r=r.concat(g):r.push(g))})}n=new xe(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},G.each(n.vertices,function(l){l.subSelf(a.centroid)}),Wt.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 Qi(0,0,s);return o.stroke="none",o.fill="black",Wt.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 er(0,0,s,o);return a.stroke="none",a.fill="black",Wt.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(!G.isNaN(n)||!G.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 Fn(0,0,s,o);return c.stroke="none",c.fill="black",Wt.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 J(n,r),d=new tr(0,0,s,o,c);return d.stroke="none",d.fill="black",Wt.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 Lr(n,r,s,o).noFill();return Wt.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 p=0;p<e.children.length;p++){const f=e.children[p];let g=f.getAttribute("offset");/%/gi.test(g)&&(g=parseFloat(g.replace(/%/gi,""))/100),g=parseFloat(g);let m=f.getAttribute("stop-color"),y=f.getAttribute("stop-opacity"),_=f.getAttribute("style"),b;m===null&&(b=_?_.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,m=b&&b.length>1?b[1]:void 0),y===null?(b=_?_.match(/stop-opacity:\s?([0-9.-]*)/):!1,y=b&&b.length>1?parseFloat(b[1]):1):y=parseFloat(y),h.push(new nn(g,m,y))}const u=new Ie(s,o,a,l,h);return u.spread=r,u.units=n,Wt.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"));G.isNaN(l)&&(l=s),G.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 f=0;f<e.children.length;f++){const g=e.children[f];let m=g.getAttribute("offset");/%/gi.test(m)&&(m=parseFloat(m.replace(/%/gi,""))/100),m=parseFloat(m);let y=g.getAttribute("stop-color"),_=g.getAttribute("stop-opacity"),b=g.getAttribute("style"),S;y===null&&(S=b?b.match(/stop-color:\s?([#a-fA-F0-9]*)/):!1,y=S&&S.length>1?S[1]:void 0),_===null?(S=b?b.match(/stop-opacity:\s?([0-9.-]*)/):!1,_=S&&S.length>1?parseFloat(S[1]):1):_=parseFloat(_),u.push(new nn(m,y,_))}const p=new Oe(s,o,a,u,l,c);return p.spread=r,p.units=n,Wt.call(this,e,p,t),p},text:function(e,t){const n=rm(e.getAttribute("text-anchor"))||"left",r=sm(e)||"baseline";let s="";e.childNodes.length>0&&e.childNodes[0].tagName==="TSPAN"?s=e.childNodes[0].textContent:s=e.textContent;const o=new Ht(s);return Wt.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 Et("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 Fr(r,s,o);return G.isNaN(a)||(c.width=a),G.isNaN(l)||(c.height=l),Wt.call(this,e,c,t),c}};function Ol(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 Ei=class extends Fn{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 zl)Object.defineProperty(this,s,zl[s]);this._renderer.flagTextures=um.bind(this),this._renderer.bindTextures=fm.bind(this),this._renderer.unbindTextures=pm.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(Ll.bind(this)):this.textures=[Ll(e)],this.origin=new J,this._update(),typeof r=="number"?this.frameRate=r:this.frameRate=Ei.DefaultFrameRate,this.index=0}static fromObject(e){const t=new Ei().copy(e);return"id"in e&&(t.id=e.id),t}copy(e){super.copy.call(this,e);for(let t=0;t<Ei.Properties.length;t++){const n=Ei.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=G.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 Ei(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,G.isNaN(this._lastFrame)&&(this._lastFrame=s-1),r=G.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=Pt(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 Te))&&(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}},Dr=Ei;w(Dr,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),w(Dr,"DefaultFrameRate",30);var zl={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(q.Types.insert,t).unbind(q.Types.remove,n),this._textures=new Nn((e||[]).slice(0)),this._textures.bind(q.Types.insert,t).bind(q.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 um(){this._flagTextures=!0}function fm(e){let t=e.length;for(;t--;)e[t].bind(q.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function pm(e){let t=e.length;for(;t--;)e[t].unbind(q.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Ll(e){if(e instanceof Te)return e;if(typeof e=="string")return new Te(e)}var qs=[],Xs=Math.max,gm=Math.min,Dl=Math.abs,Hr=Math.sin,Wr=Math.cos,mm=Math.acos,jr=Math.sqrt,Be={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 Be?e:"path"},group:{renderChild:function(e){const t=Be.getRendererType(e._renderer.type);Be[t].render.call(e,this.ctx,!0,this.clip)},render:function(e){if(!this._visible)return this;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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=qr(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=Be.getRendererType(r._renderer.type);Be[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=Be.getRendererType(l._renderer.type);Be[c].render.call(l,e)}return o&&e.restore(),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(e,t,n){let r,s,o,a,l,c,d,h,u,p,f,g,m,y,_,b,S,x,v,B,k,E,P,N,j,X,A,V,L,Z,F,R,$,M;if(M=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,L=this._mask,Z=this._clip,l=this._opacity*(M||1),c=this._visible,!t&&(!c||Z||l===0))return this;if(G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,d=this._cap,h=this._join,u=this._miter,p=this._closed,f=this._renderer.vertices,g=f.length,m=g-1,F=qr(r),$=this.dashes,F||(e.save(),e.transform(r[0],r[3],r[1],r[4],r[2],r[5])),L){const ie=Be.getRendererType(L._renderer.type);Be[ie].render.call(L,e,!0)}if(a)if(typeof a=="string")e.fillStyle=a;else{const ie=Be.getRendererType(a._renderer.type);Be[ie].render.call(a,e,this),e.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")e.strokeStyle=s;else{const ie=Be.getRendererType(s._renderer.type);Be[ie].render.call(s,e,this),e.strokeStyle=s._renderer.effect}o&&(e.lineWidth=o),u&&(e.miterLimit=u),h&&(e.lineJoin=h),!p&&d&&(e.lineCap=d)}typeof l=="number"&&(e.globalAlpha=l),$&&$.length>0&&(e.lineDashOffset=$.offset||0,e.setLineDash($)),e.beginPath();let U,z,O,ee,ce,se,ge;for(let ie=0;ie<g;ie++)switch(b=f[ie],A=b.x,V=b.y,b.command){case ne.close:e.closePath();break;case ne.arc:U=b.rx,z=b.ry,O=b.xAxisRotation,ee=b.largeArcFlag,ce=b.sweepFlag,y=p?Ft(ie-1,g):Xs(ie-1,0),_=f[y],se=_.x,ge=_.y,Be.renderSvgArcCommand(e,se,ge,U,z,ee,ce,O,A,V);break;case ne.curve:y=p?Ft(ie-1,g):Math.max(ie-1,0),_=f[y],P=_.controls&&_.controls.right||J.zero,N=b.controls&&b.controls.left||J.zero,_._relative?(k=P.x+_.x,E=P.y+_.y):(k=P.x,E=P.y),b._relative?(v=N.x+b.x,B=N.y+b.y):(v=N.x,B=N.y),e.bezierCurveTo(k,E,v,B,A,V),ie>=m&&p&&(S=x,j=b.controls&&b.controls.right||J.zero,X=S.controls&&S.controls.left||J.zero,b._relative?(k=j.x+b.x,E=j.y+b.y):(k=j.x,E=j.y),S._relative?(v=X.x+S.x,B=X.y+S.y):(v=X.x,B=X.y),A=S.x,V=S.y,e.bezierCurveTo(k,E,v,B,A,V));break;case ne.line:e.lineTo(A,V);break;case ne.move:x=b,e.moveTo(A,V);break}return p&&e.closePath(),!Z&&!n&&(Be.isHidden.test(a)||(R=a._renderer&&a._renderer.offset,R&&(e.save(),e.translate(-a._renderer.offset.x,-a._renderer.offset.y),e.scale(a._renderer.scale.x,a._renderer.scale.y)),e.fill(),R&&e.restore()),Be.isHidden.test(s)||(R=s._renderer&&s._renderer.offset,R&&(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(),R&&e.restore())),F||e.restore(),Z&&!n&&e.clip(),$&&$.length>0&&e.setLineDash(qs),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(e,t,n){let r,s,o,a,l,c,d,h,u,p,f,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(G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),r=this._matrix.elements,s=this._stroke,o=this._linewidth,a=this._fill,h=this._renderer.collection,u=h.length,m=qr(r),_=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 v=Be.getRendererType(a._renderer.type);Be[v].render.call(a,e,this),e.fillStyle=a._renderer.effect}if(s){if(typeof s=="string")e.strokeStyle=s;else{const v=Be.getRendererType(s._renderer.type);Be[v].render.call(s,e,this),e.strokeStyle=s._renderer.effect}o&&(e.lineWidth=o)}typeof l=="number"&&(e.globalAlpha=l),_&&_.length>0&&(e.lineDashOffset=_.offset||0,e.setLineDash(_)),e.beginPath();let S=d*.5,x;this._sizeAttenuation||(x=this.worldMatrix.elements,x=ki(x[0],x[3],x[1],x[4],x[2],x[5]),S/=Math.max(x.scaleX,x.scaleY));for(let v=0;v<u;v++)p=h[v],f=p.x,g=p.y,e.moveTo(f+S,g),e.arc(f,g,S,0,lt);return n||(Be.isHidden.test(a)||(y=a._renderer&&a._renderer.offset,y&&(e.save(),e.translate(-a._renderer.offset.x,-a._renderer.offset.y),e.scale(a._renderer.scale.x,a._renderer.scale.y)),e.fill(),y&&e.restore()),Be.isHidden.test(s)||(y=s._renderer&&s._renderer.offset,y&&(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(),y&&e.restore())),m||e.restore(),_&&_.length>0&&e.setLineDash(qs),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),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;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const c=this._matrix.elements,d=this._stroke,h=this._linewidth,u=this._fill,p=this._decoration,f=this._direction,g=qr(c),m=u._renderer&&u._renderer.offset&&d._renderer&&d._renderer.offset,y=this.dashes,_=Be.alignments[this._alignment]||this._alignment,b=Be.baselines[this._baseline]||this._baseline;let S,x,v,B,k,E,P,N,j,X,A;if(g||(e.save(),e.transform(c[0],c[3],c[1],c[4],c[2],c[5])),a){const V=Be.getRendererType(a._renderer.type);Be[V].render.call(a,e,!0)}if(m||(e.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),e.textAlign=_,e.textBaseline=b,e.direction=f,u)if(typeof u=="string")e.fillStyle=u;else{const V=Be.getRendererType(u._renderer.type);Be[V].render.call(u,e,this),e.fillStyle=u._renderer.effect}if(d){if(typeof d=="string")e.strokeStyle=d;else{const V=Be.getRendererType(d._renderer.type);Be[V].render.call(d,e,this),e.strokeStyle=d._renderer.effect}h&&(e.lineWidth=h)}if(typeof s=="number"&&(e.globalAlpha=s),y&&y.length>0&&(e.lineDashOffset=y.offset||0,e.setLineDash(y)),!l&&!n&&(Be.isHidden.test(u)||(u._renderer&&u._renderer.offset?(E=u._renderer.scale.x,P=u._renderer.scale.y,e.save(),e.translate(-u._renderer.offset.x,-u._renderer.offset.y),e.scale(E,P),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(" "),v=u._renderer.offset.x/u._renderer.scale.x,B=u._renderer.offset.y/u._renderer.scale.y,e.fillText(this.value,v,B),e.restore()):e.fillText(this.value,0,0)),Be.isHidden.test(d)||(d._renderer&&d._renderer.offset?(E=d._renderer.scale.x,P=d._renderer.scale.y,e.save(),e.translate(-d._renderer.offset.x,-d._renderer.offset.y),e.scale(E,P),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(" "),v=d._renderer.offset.x/d._renderer.scale.x,B=d._renderer.offset.y/d._renderer.scale.y,k=h/d._renderer.scale.x,e.lineWidth=k,e.strokeText(this.value,v,B),e.restore()):e.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(p)){const V=e.measureText(this.value);let L=1;switch(p){case"underline":j=V.actualBoundingBoxDescent,A=V.actualBoundingBoxDescent;break;case"strikethrough":j=0,A=0,L=.5;break}switch(b){case"top":j+=this._size*L,A+=this._size*L;break;case"baseline":case"bottom":j-=this._size*L,A-=this._size*L;break}switch(_){case"left":case"start":N=0,X=V.width;break;case"right":case"end":N=-V.width,X=0;break;default:N=-V.width/2,X=V.width/2}e.lineWidth=Math.max(Math.floor(this._size/15),1),e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(N,j),e.lineTo(X,A),e.stroke()}return g||e.restore(),l&&!n&&e.clip(),y&&y.length>0&&e.setLineDash(qs),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(e,t){if(t){if(G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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 G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(e,t){if(t){if(G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let n,r=this.center._x,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 G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(e){G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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 J||(this._renderer.offset=new J),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 J?(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 J||(this._renderer.scale=new J),this._scale instanceof J?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},renderSvgArcCommand:function(e,t,n,r,s,o,a,l,c,d){l=l*Math.PI/180,r=Dl(r),s=Dl(s);const h=(t-c)/2,u=(n-d)/2,p=Wr(l)*h+Hr(l)*u,f=-Hr(l)*h+Wr(l)*u,g=p*p,m=f*f;let y=r*r,_=s*s;const b=g/y+m/_;if(b>1){const V=jr(b);r=V*r,s=V*s,y=r*r,_=s*s}const S=y*m+_*g,x=(y*_-S)/S;let v=jr(Xs(0,x));o===a&&(v=-v);const B=v*r*f/s,k=-v*s*p/r,E=Wr(l)*B-Hr(l)*k+(t+c)/2,P=Hr(l)*B+Wr(l)*k+(n+d)/2,N=Hl(1,0,(p-B)/r,(f-k)/s),j=Hl((p-B)/r,(f-k)/s,(-p-B)/r,(-f-k)/s)%lt,X=N+j;ym(e,E,P,r,s,N,X,a===0,l)}},dt=class extends q{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 Ke,this.scene.parent=this}setSize(e,t,n){return this.width=e,this.height=t,this.ratio=typeof n>"u"?Vs(this.ctx):n,this.domElement.width=e*this.ratio,this.domElement.height=t*this.ratio,this.domElement.style&&G.extend(this.domElement.style,{width:e+"px",height:t+"px"}),this.trigger(q.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),Be.group.render.call(this.scene,this.ctx),e||this.ctx.restore(),this}};w(dt,"Utils",Be);function ym(e,t,n,r,s,o,a,l,c){const d=a-o,h=xi.Tolerance.epsilon,u=Math.abs(d)<h;let p=Ft(d,lt);p<h&&(u?p=0:p=lt),l===!0&&!u&&(p===lt?p=-lt:p=p-lt);for(let f=0;f<vt.Resolution;f++){const g=f/(vt.Resolution-1),m=o+g*p;let y=t+r*Math.cos(m),_=n+s*Math.sin(m);if(c!==0){const b=Math.cos(c),S=Math.sin(c),x=y-t,v=_-n;y=x*b-v*S+t,_=x*S+v*b+n}e.lineTo(y,_)}}function Hl(e,t,n,r){const s=e*n+t*r,o=jr(e*e+t*t)*jr(n*n+r*r);let a=mm(Xs(-1,gm(1,s/o)));return e*r-t*n<0&&(a=-a),a}function qr(e){return e[0]==1&&e[3]==0&&e[1]==0&&e[4]==1&&e[2]==0&&e[5]==0}var oe={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(oe.ns,n);return n==="svg"&&(t=G.defaults(t||{},{version:oe.version})),t&&Object.keys(t).length>0&&oe.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(oe.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?Ft(a-1,n):Math.max(a-1,0),d=e[c];let h,u,p,f,g,m,y,_,b,S,x,v,B,k,E,P=$e(l.x),N=$e(l.y);switch(l.command){case ne.close:h=ne.close;break;case ne.arc:x=l.rx,v=l.ry,B=l.xAxisRotation,k=l.largeArcFlag,E=l.sweepFlag,h=ne.arc+" "+x+" "+v+" "+B+" "+k+" "+E+" "+P+" "+N;break;case ne.curve:y=d.controls&&d.controls.right||J.zero,_=l.controls&&l.controls.left||J.zero,d.relative?(p=$e(y.x+d.x),f=$e(y.y+d.y)):(p=$e(y.x),f=$e(y.y)),l.relative?(g=$e(_.x+l.x),m=$e(_.y+l.y)):(g=$e(_.x),m=$e(_.y)),h=(a===0?ne.move:ne.curve)+" "+p+" "+f+" "+g+" "+m+" "+P+" "+N;break;case ne.move:s=l,h=ne.move+" "+P+" "+N;break;default:h=l.command+" "+P+" "+N}a>=r&&t&&(l.command===ne.curve&&(u=s,b=l.controls&&l.controls.right||l,S=u.controls&&u.controls.left||u,l.relative?(p=$e(b.x+l.x),f=$e(b.y+l.y)):(p=$e(b.x),f=$e(b.y)),u.relative?(g=$e(S.x+u.x),m=$e(S.y+u.y)):(g=$e(S.x),m=$e(S.y)),P=$e(u.x),N=$e(u.y),h+=" C "+p+" "+f+" "+g+" "+m+" "+P+" "+N),l.command!==ne.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+=ne.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=oe.createElement("clipPath",{"clip-rule":"nonzero"})),n.parentNode===null&&t.defs.appendChild(n),n},getRendererType:function(e){return e in oe?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=oe.getRendererType(e._renderer.type);oe[t].render.call(e,this)},render:function(e){if(!this._visible&&!this._flagVisible||this._opacity===0&&!this._flagOpacity)return this;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),this._renderer.elem||(this._renderer.elem=oe.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=oe.getRendererType(s._renderer.type);oe[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(oe.group.appendChild,n),this._flagSubtractions&&this.subtractions.forEach(oe.group.removeChild,n),this._flagOrder&&this.children.forEach(oe.group.orderChild,n),this._flagMask)if(this._mask){const r=oe.getRendererType(this._mask._renderer.type);oe[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),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{render:function(e){if(this._opacity===0&&!this._flagOpacity)return this;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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=oe.toString(this._renderer.vertices,this._closed);t.d=r}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=oe.getRendererType(this._fill._renderer.type);oe[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=oe.getRendererType(this._stroke._renderer.type);oe[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?oe.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=oe.createElement("path",t),e.appendChild(this._renderer.elem)),this._flagClip){const r=oe.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=oe.getRendererType(this._mask._renderer.type);oe[r].render.call(this._mask,e),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")}else this._renderer.elem.removeAttribute("clip-path");return G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{render:function(e){if(this._opacity===0&&!this._flagOpacity)return this;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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=ki(o[0],o[3],o[1],o[4],o[2],o[5]);r/=Math.max(a.scaleX,a.scaleY)}const s=oe.pointsToString(this._renderer.collection,r);t.d=s}if(this._fill&&this._fill._renderer){this._renderer.hasFillEffect=!0,this._fill._update();const r=oe.getRendererType(this._fill._renderer.type);oe[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=oe.getRendererType(this._stroke._renderer.type);oe[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?oe.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=oe.createElement("path",t),e.appendChild(this._renderer.elem)),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),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"]=oe.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["dominant-baseline"]=oe.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=oe.getRendererType(this._fill._renderer.type);oe[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=oe.getRendererType(this._stroke._renderer.type);oe[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?oe.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=oe.createElement("text",t),e.appendChild(this._renderer.elem)),this._flagClip){const r=oe.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=oe.getRendererType(this._mask._renderer.type);oe[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){G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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?oe.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=oe.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?oe.setAttributes(o._renderer.elem,a):o._renderer.elem=oe.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"radial-gradient":{render:function(e,t){G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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?oe.setAttributes(this._renderer.elem,n):(n.id=this._id,this._renderer.elem=oe.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?oe.setAttributes(o._renderer.elem,a):o._renderer.elem=oe.createElement("stop",a),r&&this._renderer.elem.appendChild(o._renderer.elem),o.flagReset()}}return G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},texture:{render:function(e,t){G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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 J?(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 J?(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?oe.setAttributes(this._renderer.image,r):this._renderer.image=oe.createElement("image",r)),this._renderer.elem?Object.keys(n).length!==0&&oe.setAttributes(this._renderer.elem,n):(n.id=this._id,n.patternUnits="userSpaceOnUse",this._renderer.elem=oe.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),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},Wl=class extends q{constructor(e){super(),this.domElement=e.domElement||oe.createElement("svg"),this.scene=new Ke,this.scene.parent=this,this.defs=oe.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,oe.setAttributes(this.domElement,{width:e,height:t}),this.trigger(q.Types.resize,e,t)}render(){return oe.group.render.call(this.scene,this.domElement),oe.defs.update(this.domElement),this}};w(Wl,"Utils",oe);var jt={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 Et("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
|
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
}
|
|
101
101
|
gl_FragColor = texel;
|
|
102
102
|
}
|
|
103
|
-
`}},Xr=Gn.Multiply,_m=[1,0,0,0,1,0,0,0,1],An=new tn(9),bm=dt.Utils,jl=new J,Ys=new tn([0,0,1,0,0,1,0,1,1,0,1,1]),_e={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:He.document?He.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new Gn,group:{removeChild:function(e,t){if(e.children)for(let n=0;n<e.children.length;n++)_e.group.removeChild(e.children[n],t);e._renderer.texture&&(t.deleteTexture(e._renderer.texture),delete e._renderer.texture),e._renderer.positionBuffer&&(t.deleteBuffer(e._renderer.positionBuffer),delete e._renderer.positionBuffer)},render:function(e,t){if(!this._visible)return;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.parent,r=n._matrix&&n._matrix.manual||n._flagMatrix,s=this._matrix.manual||this._flagMatrix;if((r||s)&&(this._renderer.matrix||(this._renderer.matrix=new tn(9)),this._matrix.toTransformArray(!0,An),Xr(An,n._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof J||(this._renderer.scale=new J),this._scale instanceof J?(this._renderer.scale.x=this._scale.x,this._renderer.scale.y=this._scale.y):(this._renderer.scale.x=this._scale,this._renderer.scale.y=this._scale),/renderer/i.test(n._renderer.type)||(this._renderer.scale.x*=n._renderer.scale.x,this._renderer.scale.y*=n._renderer.scale.y),r&&(this._flagMatrix=!0)),this._mask){e.clear(e.STENCIL_BUFFER_BIT),e.enable(e.STENCIL_TEST),e.stencilFunc(e.ALWAYS,1,0),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE),e.colorMask(!1,!1,!1,!1);const a=dt.Utils.getRendererType(this._mask._renderer.type);_e[a].render.call(this._mask,e,t,this),e.stencilFunc(e.EQUAL,1,255),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.colorMask(!0,!0,!0,!0)}this._flagOpacity=n._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);let o;if(this._flagSubtractions)for(o=0;o<this.subtractions.length;o++)_e.group.removeChild(this.subtractions[o],e);for(o=0;o<this.children.length;o++){const a=this.children[o],l=dt.Utils.getRendererType(a._renderer.type);_e[l].render.call(a,e,t)}return this._mask&&e.disable(e.STENCIL_TEST),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(e,t){let n,r,s,o,a,l,c,d,h,u,p,f,g,m;const y=t._renderer.vertices,_=this.canvas,b=this.ctx,S=e.renderer.ratio,x=jl.copy(t._renderer.scale).multiply(S),v=t._stroke,B=t._linewidth,k=t._fill,E=t._renderer.opacity||t._opacity,P=t._cap,N=t._join,j=t._miter,X=t._closed,A=t.dashes,V=y.length,L=V-1;_.width=Math.max(Math.ceil(t._renderer.rect.width*x.x),1),_.height=Math.max(Math.ceil(t._renderer.rect.height*x.y),1);const Z=t._renderer.rect.centroid,F=Z.x,R=Z.y;if(b.clearRect(0,0,_.width,_.height),k)if(typeof k=="string")b.fillStyle=k;else{const ge=dt.Utils.getRendererType(k._renderer.type);_e[ge].render.call(k,b,t),b.fillStyle=k._renderer.effect}if(v){if(typeof v=="string")b.strokeStyle=v;else{const ge=dt.Utils.getRendererType(v._renderer.type);_e[ge].render.call(v,b,t),b.strokeStyle=v._renderer.effect}B&&(b.lineWidth=B),j&&(b.miterLimit=j),N&&(b.lineJoin=N),!X&&P&&(b.lineCap=P)}typeof E=="number"&&(b.globalAlpha=E),A&&A.length>0&&(b.lineDashOffset=A.offset||0,b.setLineDash(A));let $,M,U,z,O,ee,ce,se;b.save(),b.scale(x.x,x.y),b.translate(F,R),b.beginPath();for(let ge=0;ge<y.length;ge++){const ie=y[ge];switch(f=ie.x,g=ie.y,ie.command){case ne.close:b.closePath();break;case ne.arc:M=ie.rx,U=ie.ry,z=ie.xAxisRotation,O=ie.largeArcFlag,ee=ie.sweepFlag,n=X?Ft(ge-1,V):Math.max(ge-1,0),r=y[n],ce=r.x,se=r.y,bm.renderSvgArcCommand(b,ce,se,M,U,O,ee,z,f,g);break;case ne.curve:n=X?Ft(ge-1,V):Math.max(ge-1,0),r=y[n],d=r.controls&&r.controls.right||J.zero,h=ie.controls&&ie.controls.left||J.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),ie._relative?(o=h.x+ie.x,a=h.y+ie.y):(o=h.x,a=h.y),b.bezierCurveTo(l,c,o,a,f,g),ge>=L&&X&&(s=$,u=ie.controls&&ie.controls.right||J.zero,p=s.controls&&s.controls.left||J.zero,ie._relative?(l=u.x+ie.x,c=u.y+ie.y):(l=u.x,c=u.y),s._relative?(o=p.x+s.x,a=p.y+s.y):(o=p.x,a=p.y),f=s.x,g=s.y,b.bezierCurveTo(l,c,o,a,f,g));break;case ne.line:b.lineTo(f,g);break;case ne.move:$=ie,b.moveTo(f,g);break}}X&&b.closePath(),_e.isHidden.test(k)||(m=k._renderer&&k._renderer.offset,m&&(b.save(),b.translate(-k._renderer.offset.x,-k._renderer.offset.y),b.scale(k._renderer.scale.x,k._renderer.scale.y)),b.fill(),m&&b.restore()),_e.isHidden.test(v)||(m=v._renderer&&v._renderer.offset,m&&(b.save(),b.translate(-v._renderer.offset.x,-v._renderer.offset.y),b.scale(v._renderer.scale.x,v._renderer.scale.y),b.lineWidth=B/v._renderer.scale.x),b.stroke(),m&&b.restore()),b.restore()},getBoundingClientRect:function(e,t,n){let r=1/0,s=-1/0,o=1/0,a=-1/0,l,c;e.forEach(function(d){const h=d.x,u=d.y,p=d.controls;let f,g,m,y,_,b;o=Math.min(u,o),r=Math.min(h,r),s=Math.max(h,s),a=Math.max(u,a),d.controls&&(_=p.left,b=p.right,!(!_||!b)&&(f=d._relative?_.x+h:_.x,g=d._relative?_.y+u:_.y,m=d._relative?b.x+h:b.x,y=d._relative?b.y+u:b.y,!(!f||!g||!m||!y)&&(o=Math.min(g,y,o),r=Math.min(f,m,r),s=Math.max(f,m,s),a=Math.max(g,y,a))))}),typeof t=="number"&&(o-=t,r-=t,s+=t,a+=t),l=s-r,c=a-o,n.top=o,n.left=r,n.right=s,n.bottom=a,n.width=l,n.height=c,n.centroid||(n.centroid={}),n.centroid.x=-r,n.centroid.y=-o},render:function(e,t,n){if(!this._visible||!this._opacity)return this;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,s=dt.Utils.getRendererType(this._renderer.type),o=t[s],a=r._matrix.manual||r._flagMatrix,l=this._matrix.manual||this._flagMatrix,c=this._renderer.parent!==r,d=this._flagVertices||this._flagFill||this._fill instanceof Ie&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Oe&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Te&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ie&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Oe&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Te&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(a||l||c){this._renderer.matrix||(this._renderer.matrix=new tn(9)),this._matrix.toTransformArray(!0,An),Xr(An,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof J||(this._renderer.scale=new J);let u,p;this._scale instanceof J?(u=this._scale.x*r._renderer.scale.x,p=this._scale.y*r._renderer.scale.y):(u=this._scale*r._renderer.scale.x,p=this._scale*r._renderer.scale.y),this._renderer.scale.x=u<0?-u:u,this._renderer.scale.y=p<0?-p:p,c&&(this._renderer.parent=r)}if(this._mask){e.clear(e.STENCIL_BUFFER_BIT),e.enable(e.STENCIL_TEST),e.stencilFunc(e.ALWAYS,1,0),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE),e.colorMask(!1,!1,!1,!1);const u=dt.Utils.getRendererType(this._mask._renderer.type);_e[u].render.call(this._mask,e,t,this),e.stencilFunc(e.EQUAL,1,255),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.colorMask(!0,!0,!0,!0)}if(d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,_e.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),_e.updateTexture.call(_e,e,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;t.current!==o&&(e.useProgram(o),e.bindBuffer(e.ARRAY_BUFFER,t.buffers.position),e.vertexAttribPointer(o.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(o.position),e.bufferData(e.ARRAY_BUFFER,Ys,e.STATIC_DRAW),t.resolution.flagged||e.uniform2f(e.getUniformLocation(o,"u_resolution"),t.resolution.width,t.resolution.height),t.current=o),t.resolution.flagged&&e.uniform2f(e.getUniformLocation(o,"u_resolution"),t.resolution.width,t.resolution.height),e.bindTexture(e.TEXTURE_2D,this._renderer.texture);const h=this._renderer.rect;return e.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),e.uniform4f(o.rect,h.left,h.top,h.right,h.bottom),e.drawArrays(e.TRIANGLES,0,6),this._mask&&e.disable(e.STENCIL_TEST),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(e,t){let n;const r=this.canvas,s=this.ctx,o=e.renderer.ratio,a=t._stroke,l=t._linewidth,c=t._fill,d=t._renderer.opacity||t._opacity,h=t.dashes,u=t._size*o;let p=u;_e.isHidden.test(a)||(p+=l),r.width=Xa(p),r.height=r.width;const f=p/r.width,g=r.width/2,m=r.height/2;if(s.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")s.fillStyle=c;else{const y=dt.Utils.getRendererType(c._renderer.type);_e[y].render.call(c,s,t),s.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")s.strokeStyle=a;else{const y=dt.Utils.getRendererType(a._renderer.type);_e[y].render.call(a,s,t),s.strokeStyle=a._renderer.effect}l&&(s.lineWidth=l/f)}typeof d=="number"&&(s.globalAlpha=d),h&&h.length>0&&(s.lineDashOffset=h.offset||0,s.setLineDash(h)),s.save(),s.translate(g,m),s.scale(_e.precision,_e.precision),s.beginPath(),s.arc(0,0,u/f*.5,0,lt),s.restore(),closed&&s.closePath(),_e.isHidden.test(c)||(n=c._renderer&&c._renderer.offset,n&&(s.save(),s.translate(-c._renderer.offset.x,-c._renderer.offset.y),s.scale(c._renderer.scale.x,c._renderer.scale.y)),s.fill(),n&&s.restore()),_e.isHidden.test(a)||(n=a._renderer&&a._renderer.offset,n&&(s.save(),s.translate(-a._renderer.offset.x,-a._renderer.offset.y),s.scale(a._renderer.scale.x,a._renderer.scale.y),s.lineWidth=l/a._renderer.scale.x),s.stroke(),n&&s.restore())},render:function(e,t,n){if(!this._visible||!this._opacity)return this;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const s=n||this.parent,o=t[this._renderer.type],a=this._sizeAttenuation,l=this._stroke,c=this._linewidth,d=s._matrix.manual||s._flagMatrix,h=this._matrix.manual||this._flagMatrix,u=this._renderer.parent!==s,p=this._renderer.vertices,f=this._renderer.collection.length,g=this._flagVertices,m=this._flagFill||this._fill instanceof Ie&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Oe&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Te&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ie&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Oe&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Te&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||s._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(d||h||u){this._renderer.matrix||(this._renderer.matrix=new tn(9)),this._matrix.toTransformArray(!0,An),Xr(An,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof J||(this._renderer.scale=new J);let y,_;this._scale instanceof J?(y=this._scale.x*s._renderer.scale.x,_=this._scale.y*s._renderer.scale.y):(y=this._scale*s._renderer.scale.x,_=this._scale*s._renderer.scale.y),this._renderer.scale.x=y<0?-y:y,this._renderer.scale.y=_<0?-_:_,u&&(this._renderer.parent=s)}if(g){const y=this._renderer.positionBuffer;y&&e.deleteBuffer(y),this._renderer.positionBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this._renderer.positionBuffer),e.vertexAttribPointer(o.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(o.position),e.bufferData(e.ARRAY_BUFFER,p,e.STATIC_DRAW)}return m?(this._renderer.opacity=this._opacity*s._renderer.opacity,_e.updateTexture.call(_e,e,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture?this:(_e.isHidden.test(l)||(r+=c),r/=_e.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),t.current!==o&&(e.useProgram(o),t.resolution.flagged||e.uniform2f(e.getUniformLocation(o,"u_resolution"),t.resolution.width,t.resolution.height),t.current=o),t.resolution.flagged&&e.uniform2f(e.getUniformLocation(o,"u_resolution"),t.resolution.width,t.resolution.height),e.bindTexture(e.TEXTURE_2D,this._renderer.texture),e.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),e.uniform1f(o.size,r*t.resolution.ratio),e.drawArrays(e.POINTS,0,f),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(e,t){const n=this.canvas,r=this.ctx,s=e.renderer.ratio,o=jl.copy(t._renderer.scale).multiply(s),a=t._stroke,l=t._linewidth,c=t._fill,d=t._renderer.opacity||t._opacity,h=t.dashes,u=t._decoration,p=t._direction;n.width=Math.max(Math.ceil(t._renderer.rect.width*o.x),1),n.height=Math.max(Math.ceil(t._renderer.rect.height*o.y),1);const f=t._renderer.rect.centroid,g=f.x,m=f.y;let y,_,b,S,x,v,B,k,E,P,N;const j=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,n.width,n.height),j||(r.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=p,c)if(typeof c=="string")r.fillStyle=c;else{const X=dt.Utils.getRendererType(c._renderer.type);_e[X].render.call(c,r,t),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const X=dt.Utils.getRendererType(a._renderer.type);_e[X].render.call(a,r,t),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=l)}if(typeof d=="number"&&(r.globalAlpha=d),h&&h.length>0&&(r.lineDashOffset=h.offset||0,r.setLineDash(h)),r.save(),r.scale(o.x,o.y),r.translate(g,m),_e.isHidden.test(c)||(c._renderer&&c._renderer.offset?(v=c._renderer.scale.x,B=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(v,B),y=t._size/c._renderer.scale.y,_=t._leading/c._renderer.scale.y,r.font=[t._style,t._weight,y+"px/",_+"px",t._family].join(" "),b=c._renderer.offset.x/c._renderer.scale.x,S=c._renderer.offset.y/c._renderer.scale.y,r.fillText(t.value,b,S),r.restore()):r.fillText(t.value,0,0)),_e.isHidden.test(a)||(a._renderer&&a._renderer.offset?(v=a._renderer.scale.x,B=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(v,B),y=t._size/a._renderer.scale.y,_=t._leading/a._renderer.scale.y,r.font=[t._style,t._weight,y+"px/",_+"px",t._family].join(" "),b=a._renderer.offset.x/a._renderer.scale.x,S=a._renderer.offset.y/a._renderer.scale.y,x=l/a._renderer.scale.x,r.lineWidth=x,r.strokeText(t.value,b,S),r.restore()):r.strokeText(t.value,0,0)),/(underline|strikethrough)/i.test(u)){const X=r.measureText(t.value);switch(u){case"underline":E=X.actualBoundingBoxDescent,N=X.actualBoundingBoxDescent;break;case"strikethrough":E=0,N=0;break}k=-X.width/2,P=X.width/2,r.lineWidth=Math.max(Math.floor(t._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(k,E),r.lineTo(P,N),r.stroke()}r.restore()},getBoundingClientRect:function(e,t){const n=_e.ctx;n.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" "),n.textAlign="center",n.textBaseline=dt.Utils.baselines[e._baseline]||e._baseline;const r=n.measureText(e._value);let s=r.width,o=1.15*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent);this._linewidth&&!_e.isHidden.test(this._stroke)&&(s+=this._linewidth*2,o+=this._linewidth*2);const a=s/2,l=o/2;switch(_e.alignments[e._alignment]||e._alignment){case _e.alignments.left:e.direction==="ltr"?(t.left=0,t.right=s):(t.left=-s,t.right=0);break;case _e.alignments.right:e.direction==="ltr"?(t.left=-s,t.right=0):(t.left=0,t.right=s);break;default:t.left=-a,t.right=a}switch(e._baseline){case"bottom":t.top=-o,t.bottom=0;break;case"top":t.top=0,t.bottom=o;break;case"baseline":t.top=-l*1.5,t.bottom=l*.5;break;default:t.top=-l,t.bottom=l}t.width=s,t.height=o,t.centroid||(t.centroid={}),t.centroid.x=a,t.centroid.y=l},render:function(e,t,n){if(!this._visible||!this._opacity)return this;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,s=t[this._renderer.type],o=r._matrix.manual||r._flagMatrix,a=this._matrix.manual||this._flagMatrix,l=this._renderer.parent!==r,c=this._flagVertices||this._flagFill||this._fill instanceof Ie&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Oe&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Te&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ie&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Oe&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Te&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(o||a||l){this._renderer.matrix||(this._renderer.matrix=new tn(9)),this._matrix.toTransformArray(!0,An),Xr(An,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof J||(this._renderer.scale=new J);let h,u;this._scale instanceof J?(h=this._scale.x*r._renderer.scale.x,u=this._scale.y*r._renderer.scale.y):(h=this._scale*r._renderer.scale.x,u=this._scale*r._renderer.scale.y),this._renderer.scale.x=h<0?-h:h,this._renderer.scale.y=u<0?-u:u,l&&(this._renderer.parent=r)}if(this._mask){e.clear(e.STENCIL_BUFFER_BIT),e.enable(e.STENCIL_TEST),e.stencilFunc(e.ALWAYS,1,0),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE),e.colorMask(!1,!1,!1,!1);const h=dt.Utils.getRendererType(this._mask._renderer.type);_e[h].render.call(this._mask,e,t,this),e.stencilFunc(e.EQUAL,1,255),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.colorMask(!0,!0,!0,!0)}if(c?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,_e.text.getBoundingClientRect(this,this._renderer.rect),_e.updateTexture.call(_e,e,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;t.current!==s&&(e.useProgram(s),e.bindBuffer(e.ARRAY_BUFFER,t.buffers.position),e.vertexAttribPointer(s.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(s.position),e.bufferData(e.ARRAY_BUFFER,Ys,e.STATIC_DRAW),t.resolution.flagged||e.uniform2f(e.getUniformLocation(s,"u_resolution"),t.resolution.width,t.resolution.height),t.current=s),t.resolution.flagged&&e.uniform2f(e.getUniformLocation(s,"u_resolution"),t.resolution.width,t.resolution.height),e.bindTexture(e.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return e.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),e.uniform4f(s.rect,d.left,d.top,d.right,d.bottom),e.drawArrays(e.TRIANGLES,0,6),this._mask&&e.disable(e.STENCIL_TEST),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(e,t){if(!(!e.canvas.getContext("2d")||!t)){if(G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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 G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(e,t){if(!(!e.canvas.getContext("2d")||!t)){if(G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let n,r=this.center._x,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 G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(e,t){if(!e.canvas.getContext("2d"))return;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=e.createPattern(n,this._repeat);else if(!this._renderer.effect)return this.flagReset();if((this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof J||(this._renderer.offset=new J),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,n&&(this._renderer.offset.x+=n.width/2,this._renderer.offset.y+=n.height/2,this._scale instanceof J?(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 J||(this._renderer.scale=new J);let r,s;this._scale instanceof J?(r=this._scale.x,s=this._scale.y):(r=this._scale,s=this._scale),this._renderer.scale.x=r<0?-r:r,this._renderer.scale.y=s<0?-s:s}return G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(e,t){const n=dt.Utils.getRendererType(t._renderer.type);if(this[n].updateCanvas.call(_e,e,t),this.canvas.width<=0||this.canvas.height<=0){t._renderer.texture&&e.deleteTexture(t._renderer.texture),delete t._renderer.texture;return}t._renderer.texture||(t._renderer.texture=e.createTexture()),e.bindTexture(e.TEXTURE_2D,t._renderer.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.canvas),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)},program:{create:function(e,t){let n,r,s;if(n=e.createProgram(),G.each(t,function(o){e.attachShader(n,o)}),e.linkProgram(n),r=e.getProgramParameter(n,e.LINK_STATUS),!r)throw s=e.getProgramInfoLog(n),e.deleteProgram(n),new Et("unable to link program: "+s);return n}},extensions:{init:function(e){const t={},n=["EXT_texture_filter_anisotropic","WEBGL_compressed_texture_s3tc","OES_texture_float_linear","WEBGL_multisampled_render_to_texture"];for(let r=0;r<n.length;r++){const s=n[r];t[s]=_e.extensions.get(e,s)}return t},get:function(e,t){return e.getExtension(t)||e.getExtension(`MOZ_${t}`)||e.getExtension(`WEBKIT_${t}`)}},TextureRegistry:new Rr};_e.ctx=_e.canvas.getContext("2d");var ql=class extends q{constructor(e){super();let t,n,r,s;if(this.domElement=e.domElement||document.createElement("canvas"),typeof e.offscreenElement<"u"&&(_e.canvas=e.offscreenElement,_e.ctx=_e.canvas.getContext("2d")),this.scene=new Ke,this.scene.parent=this,this._renderer={type:"renderer",matrix:new tn(_m),scale:1,opacity:1},this._flagMatrix=!0,e=G.defaults(e||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=e.overdraw,t=this.ctx=this.domElement.getContext("webgl",e)||this.domElement.getContext("experimental-webgl",e),!this.ctx)throw new Et("unable to create a webgl context. Try using another renderer.");r=jt.create(t,jt.path.vertex,jt.types.vertex),s=jt.create(t,jt.path.fragment,jt.types.fragment),this.programs={current:null,buffers:{position:t.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},n=this.programs.path=_e.program.create(t,[r,s]),this.programs.text=this.programs.path,t.extensions=_e.extensions.init(t),t.renderer=this,n.position=t.getAttribLocation(n,"a_position"),n.matrix=t.getUniformLocation(n,"u_matrix"),n.rect=t.getUniformLocation(n,"u_rect");const o=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,o),t.vertexAttribPointer(n.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(n.position),t.bufferData(t.ARRAY_BUFFER,Ys,t.STATIC_DRAW),r=jt.create(t,jt.points.vertex,jt.types.vertex),s=jt.create(t,jt.points.fragment,jt.types.fragment),n=this.programs.points=_e.program.create(t,[r,s]),n.position=t.getAttribLocation(n,"a_position"),n.matrix=t.getUniformLocation(n,"u_matrix"),n.size=t.getUniformLocation(n,"u_size"),t.enable(t.BLEND),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA)}setSize(e,t,n){let r,s;const o=this.ctx;return this.width=e,this.height=t,this.ratio=typeof n>"u"?Vs(o):n,this.domElement.width=e*this.ratio,this.domElement.height=t*this.ratio,G.isObject(this.domElement.style)&&G.extend(this.domElement.style,{width:e+"px",height:t+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=e*this.ratio,s=t*this.ratio,o.viewport(0,0,r,s),this.programs.resolution.width=r,this.programs.resolution.height=s,this.programs.resolution.ratio=this.ratio,this.programs.resolution.flagged=!0,this.trigger(q.Types.resize,e,t,n)}render(){const e=this.ctx;return this.overdraw||e.clear(e.COLOR_BUFFER_BIT),_e.group.render.call(this.scene,e,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};w(ql,"Utils",_e);var wm=G.extend({Error:Et,getRatio:Vs,read:Le,xhr:Ol},G,wt,Da,Ha),ir=class{constructor(e){w(this,"_events",new q),w(this,"type",""),w(this,"renderer",null),w(this,"scene",null),w(this,"width",0),w(this,"height",0),w(this,"frameCount",0),w(this,"timeDelta",0),w(this,"playing",!1);const t=G.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:ir.Types.svg,autostart:!1});if(G.each(t,function(n,r){/fullscreen/i.test(r)||/autostart/i.test(r)||(this[r]=n)},this),G.isElement(t.domElement)){const n=t.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+n)||(this.type=ir.Types[n])}this.renderer=new ir[this.type](this),this.setPlaying(t.autostart),this.frameCount=0,t.fullscreen?(this.fit=vm.bind(this),this.fit.domElement=window,this.fit.attached=!0,G.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),G.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),Mt.bind(this.fit.domElement,"resize",this.fit),this.fit()):t.fitted?(this.fit=km.bind(this),G.extend(this.renderer.domElement.style,{display:"block"})):typeof t.width=="number"&&typeof t.height=="number"&&(this.renderer.setSize(t.width,t.height,this.ratio),this.width=t.width,this.height=t.height),this.renderer.bind(q.Types.resize,xm.bind(this)),this.scene=this.renderer.scene,ir.Instances.push(this),t.autostart&&rr.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){return this._events.addEventListener.apply(this,arguments)}on(){return this._events.addEventListener.apply(this,arguments)}bind(){return this._events.addEventListener.apply(this,arguments)}removeEventListener(){return this._events.removeEventListener.apply(this,arguments)}off(){return this._events.removeEventListener.apply(this,arguments)}unbind(){return this._events.removeEventListener.apply(this,arguments)}dispatchEvent(){return this._events.dispatchEvent.apply(this,arguments)}trigger(){return this._events.dispatchEvent.apply(this,arguments)}listen(){return this._events.listen.apply(this,arguments)}ignore(){return this._events.ignore.apply(this,arguments)}appendTo(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,rr.init(),this.trigger(q.Types.play)}pause(){return this.playing=!1,this.trigger(q.Types.pause)}setPlaying(e){this.playing=e}release(e){let t,n,r;if(typeof e>"u")return this.release(this.scene);if(typeof e.unbind=="function"&&e.unbind(),typeof e.fill=="object"&&"unbind"in e.fill&&e.fill.unbind(),typeof e.stroke=="object"&&"unbind"in e.stroke&&e.stroke.unbind(),e.vertices)for(typeof e.vertices.unbind=="function"&&e.vertices.unbind(),t=0;t<e.vertices.length;t++)n=e.vertices[t],typeof n.unbind=="function"&&n.unbind(),n.controls&&(n.controls.left&&typeof n.controls.left.unbind=="function"&&n.controls.left.unbind(),n.controls.right&&typeof n.controls.right.unbind=="function"&&n.controls.right.unbind());if(e.children){for(t=0;t<e.children.length;t++)r=e.children[t],this.release(r);typeof e.children.unbind=="function"&&e.children.unbind()}return e}update(){const e=!!this._lastFrame,t=G.performance.now();e&&(this.timeDelta=parseFloat((t-this._lastFrame).toFixed(3))),this._lastFrame=t,this.fit&&this.fit.domElement&&!this.fit.attached&&(Mt.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());const n=this.width,r=this.height,s=this.renderer;return(n!==s.width||r!==s.height)&&s.setSize(n,r,this.ratio),this.trigger(q.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(q.Types.render,this.frameCount++)}add(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.add(e),this}remove(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.remove(e),this}clear(){return this.scene.remove(this.scene.children),this}makeLine(e,t,n,r){const s=new Lr(e,t,n,r);return this.scene.add(s),s}makeArrow(e,t,n,r,s){const o=typeof s=="number"?s:10,a=Math.atan2(r-t,n-e),l=[new ve(e,t,void 0,void 0,void 0,void 0,ne.move),new ve(n,r,void 0,void 0,void 0,void 0,ne.line),new ve(n-o*Math.cos(a-Math.PI/4),r-o*Math.sin(a-Math.PI/4),void 0,void 0,void 0,void 0,ne.line),new ve(n,r,void 0,void 0,void 0,void 0,ne.move),new ve(n-o*Math.cos(a+Math.PI/4),r-o*Math.sin(a+Math.PI/4),void 0,void 0,void 0,void 0,ne.line)],c=new xe(l,!1,!1,!0);return c.noFill(),c.cap="round",c.join="round",this.scene.add(c),c}makeRectangle(e,t,n,r){const s=new Fn(e,t,n,r);return this.scene.add(s),s}makeRoundedRectangle(e,t,n,r,s){const o=new tr(e,t,n,r,s);return this.scene.add(o),o}makeCircle(e,t,n,r){const s=new Qi(e,t,n,r);return this.scene.add(s),s}makeEllipse(e,t,n,r,s){const o=new er(e,t,n,r,s);return this.scene.add(o),o}makeStar(e,t,n,r,s){const o=new Ir(e,t,n,r,s);return this.scene.add(o),o}makeCurve(e){const t=arguments.length;if(!Array.isArray(e)){e=[];for(let o=0;o<t;o+=2){const a=arguments[o];if(typeof a!="number")break;const l=arguments[o+1];e.push(new ve(a,l))}}const n=arguments[t-1],r=new xe(e,!(typeof n=="boolean"&&n),!0),s=r.getBoundingClientRect();return r.center().translation.set(s.left+s.width/2,s.top+s.height/2),this.scene.add(r),r}makePolygon(e,t,n,r){const s=new Vr(e,t,n,r);return this.scene.add(s),s}makeArcSegment(e,t,n,r,s,o,a){const l=new Mr(e,t,n,r,s,o,a);return this.scene.add(l),l}makePoints(e){const t=arguments.length;let n=e;if(!Array.isArray(e)){n=[];for(let s=0;s<t;s+=2){const o=arguments[s];if(typeof o!="number")break;const a=arguments[s+1];n.push(new J(o,a))}}const r=new Ar(n);return this.scene.add(r),r}makePath(e){const t=arguments.length;let n=e;if(!Array.isArray(e)){n=[];for(let a=0;a<t;a+=2){const l=arguments[a];if(typeof l!="number")break;const c=arguments[a+1];n.push(new ve(l,c))}}const r=arguments[t-1],s=new xe(n,!(typeof r=="boolean"&&r)),o=s.getBoundingClientRect();return typeof o.top=="number"&&typeof o.left=="number"&&typeof o.right=="number"&&typeof o.bottom=="number"&&s.center().translation.set(o.left+o.width/2,o.top+o.height/2),this.scene.add(s),s}makeText(e,t,n,r){const s=new Ht(e,t,n,r);return this.add(s),s}makeLinearGradient(e,t,n,r){const s=Array.prototype.slice.call(arguments,4),o=new Ie(e,t,n,r,s);return this.add(o),o}makeRadialGradient(e,t,n){const r=Array.prototype.slice.call(arguments,3),s=new Oe(e,t,n,r);return this.add(s),s}makeSprite(e,t,n,r,s,o,a){const l=new Fr(e,t,n,r,s,o);return a&&l.play(),this.add(l),l}makeImageSequence(e,t,n,r,s){const o=new Dr(e,t,n,r);return s&&o.play(),this.add(o),o}makeTexture(e,t){return new Te(e,t)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const t=new Ke;return this.scene.add(t),t.add(e),t}interpret(e,t,n){const r=e.tagName.toLowerCase();if(n=typeof n<"u"?n:!0,!(r in Le))return null;const s=Le[r].call(this,e);return n?this.add(t&&s instanceof Ke?s.children:s):s.parent&&s.remove(),s}load(e,t){const n=new Ke;let r,s,o;const a=(function(l){for(Mt.temp.innerHTML=l,s=0;s<Mt.temp.children.length;s++)r=Mt.temp.children[s],o=this.interpret(r,!1,!1),o!==null&&n.add(o);if(typeof t=="function"){const c=Mt.temp.children.length<=1?Mt.temp.children[0]:Mt.temp.children;t(n,c)}}).bind(this);return/\.svg$/i.test(e)?(Ol(e,a),n):(a(e),n)}},ue=ir;w(ue,"NextFrameId",vt.NextFrameId),w(ue,"Types",vt.Types),w(ue,"Version",vt.Version),w(ue,"PublishDate",vt.PublishDate),w(ue,"Identifier",vt.Identifier),w(ue,"Resolution",vt.Resolution),w(ue,"AutoCalculateImportedMatrices",vt.AutoCalculateImportedMatrices),w(ue,"Instances",vt.Instances),w(ue,"uniqueId",vt.uniqueId),w(ue,"Anchor",ve),w(ue,"Collection",Nn),w(ue,"Events",q),w(ue,"Group",Ke),w(ue,"Matrix",Gn),w(ue,"Path",xe),w(ue,"Registry",Rr),w(ue,"Element",qn),w(ue,"Shape",mn),w(ue,"Text",Ht),w(ue,"Vector",J),w(ue,"Gradient",Ue),w(ue,"ImageSequence",Dr),w(ue,"LinearGradient",Ie),w(ue,"RadialGradient",Oe),w(ue,"Sprite",Fr),w(ue,"Stop",nn),w(ue,"Texture",Te),w(ue,"ArcSegment",Mr),w(ue,"Circle",Qi),w(ue,"Ellipse",er),w(ue,"Line",Lr),w(ue,"Points",Ar),w(ue,"Polygon",Vr),w(ue,"Rectangle",Fn),w(ue,"RoundedRectangle",tr),w(ue,"Star",Ir),w(ue,"CanvasRenderer",dt),w(ue,"SVGRenderer",Wl),w(ue,"WebGLRenderer",ql),w(ue,"Commands",ne),w(ue,"Utils",wm);function vm(){const e=document.body.getBoundingClientRect(),t=this.width=e.width,n=this.height=e.height;this.renderer.setSize(t,n,this.ratio)}function km(){const e=this.renderer.domElement.parentElement;if(!e){console.warn("Two.js: Attempting to fit to parent, but no parent found.");return}const t=e.getBoundingClientRect(),n=this.width=t.width,r=this.height=t.height;this.renderer.setSize(n,r,this.ratio)}function xm(e,t){this.width=e,this.height=t,this.trigger(q.Types.resize,e,t)}var rr=Mt.getRequestAnimationFrame();function Xl(){for(let e=0;e<ue.Instances.length;e++){const t=ue.Instances[e];t.playing&&t.update()}ue.NextFrameId=rr(Xl)}rr.init=function(){Xl(),rr.init=function(){}};let sn;typeof window<"u"?sn=window:typeof global<"u"?sn=global:typeof self<"u"&&(sn=self);let Yl;const ni=Math.PI*2,it=Math.PI*.5;function Cm(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 Sm(e){Yl=e}function Bm(e,t){t=t&&t.identity()||new Yl;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 on(e,t,n){return n*(t-e)+e}function Ri(e,t){for(;e<0;)e+=t;return e%t}const Ul=sn.Float32Array||Array,Tm=Math.floor;function an(e){return Tm(e*1e6)/1e6}const pe={move:"M",line:"L",curve:"C",close:"Z"};class K{constructor(){C(this,"_events",{});C(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}}C(K,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),C(K,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Gl={x:{enumerable:!0,get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this._bound&&this.dispatchEvent(K.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this._bound&&this.dispatchEvent(K.Types.change))}}},ot=class ot extends K{constructor(n=0,r=0){super();C(this,"_x",0);C(this,"_y",0);for(let s in Gl)Object.defineProperty(this,s,Gl[s]);this.x=n,this.y=r}static add(n,r){return new ot(n.x+r.x,n.y+r.y)}static sub(n,r){return new ot(n.x-r.x,n.y-r.y)}static subtract(n,r){return ot.sub(n,r)}static ratioBetween(n,r){return(n.x*r.x+n.y*r.y)/(n.length()*r.length())}static angleBetween(n,r){if(arguments.length>=4){const a=arguments[0]-arguments[2],l=arguments[1]-arguments[3];return Math.atan2(l,a)}const s=n.x-r.x,o=n.y-r.y;return Math.atan2(o,s)}static distanceBetween(n,r){return Math.sqrt(ot.distanceBetweenSquared(n,r))}static distanceBetweenSquared(n,r){const s=n.x-r.x,o=n.y-r.y;return s*s+o*o}set(n,r){return this.x=n,this.y=r,this}copy(n){return this.x=n.x,this.y=n.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new ot(this.x,this.y)}add(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x+=n,this.y+=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x+=n.x,this.y+=n.y):(this.x+=n,this.y+=r),this)}addSelf(n){return this.add.apply(this,arguments)}sub(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x-=n,this.y-=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x-=n.x,this.y-=n.y):(this.x-=n,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(n){return this.sub.apply(this,arguments)}subtractSelf(n){return this.sub.apply(this,arguments)}multiply(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x*=n,this.y*=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x*=n.x,this.y*=n.y):(this.x*=n,this.y*=r),this)}multiplySelf(n){return this.multiply.apply(this,arguments)}multiplyScalar(n){return this.multiply(n)}divide(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x/=n,this.y/=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x/=n.x,this.y/=n.y):(this.x/=n,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(n){return this.divide.apply(this,arguments)}divideScalar(n){return this.divide(n)}negate(){return this.multiply(-1)}dot(n){return this.x*n.x+this.y*n.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(n){return Math.sqrt(this.distanceToSquared(n))}distanceToSquared(n){const r=this.x-n.x,s=this.y-n.y;return r*r+s*s}setLength(n){return this.normalize().multiplyScalar(n)}equals(n,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(n)<r}lerp(n,r){const s=(n.x-this.x)*r+this.x,o=(n.y-this.y)*r+this.y;return this.set(s,o)}isZero(n){return n=typeof n>"u"?1e-4:n,this.length()<n}toString(){return this.x+", "+this.y}toObject(){return{x:an(this.x),y:an(this.y)}}rotate(n){const r=this.x,s=this.y,o=Math.cos(n),a=Math.sin(n);return this.x=r*o-s*a,this.y=r*a+s*o,this}};C(ot,"zero",new ot),C(ot,"left",new ot(-1,0)),C(ot,"right",new ot(1,0)),C(ot,"up",new ot(0,-1)),C(ot,"down",new ot(0,1));let we=ot;class Ee extends we{constructor(n=0,r=0,s=0,o=0,a=0,l=0,c=pe.move){super(n,r);C(this,"controls",{left:new we,right:new we});C(this,"_command",pe.move);C(this,"_relative",!0);C(this,"_rx",0);C(this,"_ry",0);C(this,"_xAxisRotation",0);C(this,"_largeArcFlag",0);C(this,"_sweepFlag",1);for(let h in Kl)Object.defineProperty(this,h,Kl[h]);this.command=c,this.relative=!0;const d=Ee.makeBroadcast(this);this.controls.left.set(s,o).addEventListener(K.Types.change,d),this.controls.right.set(a,l).addEventListener(K.Types.change,d)}static makeBroadcast(n){return r;function r(){n._bound&&n.dispatchEvent(K.Types.change)}}static fromObject(n){return new Ee().copy(n)}copy(n){return this.x=n.x,this.y=n.y,typeof n.command=="string"&&(this.command=n.command),n.controls&&(n.controls.left&&this.controls.left.copy(n.controls.left),n.controls.right&&this.controls.right.copy(n.controls.right)),typeof n.relative=="boolean"&&(this.relative=n.relative),typeof n.rx=="number"&&(this.rx=n.rx),typeof n.ry=="number"&&(this.ry=n.ry),typeof n.xAxisRotation=="number"&&(this.xAxisRotation=n.xAxisRotation),typeof n.largeArcFlag=="number"&&(this.largeArcFlag=n.largeArcFlag),typeof n.sweepFlag=="number"&&(this.sweepFlag=n.sweepFlag),this}clone(){return new Ee().copy(this)}toObject(){return{x:an(this.x),y:an(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:an(this.rx),ry:an(this.ry),xAxisRotation:an(this.xAxisRotation),largeArcFlag:an(this.largeArcFlag),sweepFlag:an(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const Kl={command:{enumerable:!0,get:function(){return this._command},set:function(e){this._command!==e&&(this._command=e,this._bound&&this.dispatchEvent(K.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(e){this._relative!==!!e&&(this._relative=!!e,this._bound&&this.dispatchEvent(K.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(e){this._rx!==e&&(this._rx=e,this._bound&&this.dispatchEvent(K.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(e){this._ry!==e&&(this._ry=e,this._bound&&this.dispatchEvent(K.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(e){this._xAxisRotation!==e&&(this._xAxisRotation=e,this._bound&&this.dispatchEvent(K.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag!==e&&(this._largeArcFlag=e,this._bound&&this.dispatchEvent(K.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag!==e&&(this._sweepFlag=e,this._bound&&this.dispatchEvent(K.Types.change))}}};let Em=0;const Us={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return Em++}},Yr={RecursionLimit:16,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 Ur(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 Zl(e,t,n,r,s,o,a,l,c){c=c||Yr.RecursionLimit;const d=c+1;if(Math.abs(e-a)<.001&&Math.abs(t-l)<.001)return[new Ee(a,l)];const h=[];for(let u=0;u<d;u++){const p=u/d,f=Ur(p,e,n,s,a),g=Ur(p,t,r,o,l);h.push(new Ee(f,g))}return h}function Rm(e,t,n,r,s,o,a,l,c){if(e===n&&t===r&&s===a&&o===l){const y=a-e,_=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),p=9*(r-o)+3*(l-t),f=6*(t+o)-12*r,g=3*(r-t);function m(y){const _=(d*y+h)*y+u,b=(p*y+f)*y+g;return Math.sqrt(_*_+b*b)}return Nm(m,0,1,c||Yr.RecursionLimit)}function $m(e,t,n,r,s,o,a,l){const c=[],d=[[],[]];let h,u,p,f,g,m,y,_;for(let v=0;v<2;++v){if(v==0?(u=6*e-12*n+6*s,h=-3*e+9*n-9*s+3*a,p=3*n-3*e):(u=6*t-12*r+6*o,h=-3*t+9*r-9*o+3*l,p=3*r-3*t),Math.abs(h)<1e-12){if(Math.abs(u)<1e-12)continue;f=-p/u,0<f&&f<1&&c.push(f);continue}y=u*u-4*p*h,_=Math.sqrt(y),!(y<0)&&(g=(-u+_)/(2*h),0<g&&g<1&&c.push(g),m=(-u-_)/(2*h),0<m&&m<1&&c.push(m))}let b=c.length,S=b,x;for(;b--;)f=c[b],x=1-f,d[0][b]=x*x*x*e+3*x*x*f*n+3*x*f*f*s+f*f*f*a,d[1][b]=x*x*x*t+3*x*x*f*r+3*x*f*f*o+f*f*f*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 Nm(e,t,n,r){let s=Yr.abscissas[r-2],o=Yr.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 Pm(e,t){const n=e.length,r=n-1;for(let s=0;s<n;s++){const o=e[s],a=t?Ri(s-1,n):Math.max(s-1,0),l=t?Ri(s+1,n):Math.min(s+1,r),c=e[a],d=o,h=e[l];Fm(c,d,h),d.command=s===0?pe.move:pe.curve}}function Fm(e,t,n){const r=we.angleBetween(e,t),s=we.angleBetween(n,t);let o=we.distanceBetween(e,t),a=we.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+=it:l-=it,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)}let sr=(_i=class extends K{constructor(){super();C(this,"_flagId",!1);C(this,"_flagClassName",!1);C(this,"_renderer",{});C(this,"_id",Us.Identifier+Us.uniqueId());C(this,"_className","");C(this,"classList",[]);for(let n in Jl)Object.defineProperty(this,n,Jl[n])}static fromObject(n){const r=new _i().copy(n);return"id"in n&&(r.id=n.id),r}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(n){return this.renderer.type=n.renderer.type,this.className=n.className,this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}},C(_i,"Properties",["renderer","id","className"]),_i);const Jl={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)}}};class Gr extends Error{constructor(n){super();C(this,"name","Two.js");C(this,"message");this.message=n}}class Mm{constructor(){C(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}}let Kr;const Ql={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};sn.document&&(Kr=document.createElement("a"));const We=class We extends sr{constructor(n,r){super();C(this,"_flagSrc",!1);C(this,"_flagImage",!1);C(this,"_flagVideo",!1);C(this,"_flagLoaded",!1);C(this,"_flagRepeat",!1);C(this,"_flagOffset",!1);C(this,"_flagScale",!1);C(this,"_src","");C(this,"_image",null);C(this,"_loaded",!1);C(this,"_repeat","no-repeat");C(this,"_scale",1);C(this,"_offset",null);for(let s in ec)Object.defineProperty(this,s,ec[s]);if(this._renderer.type="texture",this._renderer.flagOffset=Am.bind(this),this._renderer.flagScale=Vm.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new we,typeof r=="function"){const s=(function(){this.unbind(K.Types.load,s),typeof r=="function"&&r()}).bind(this);this.bind(K.Types.load,s)}if(typeof n=="string")this.src=n;else if(typeof n=="object"){const s=Object.prototype.toString.call(n);(s==="[object HTMLImageElement]"||s==="[object HTMLCanvasElement]"||s==="[object HTMLVideoElement]"||s==="[object Image]")&&(this.image=n)}this._update()}fromObject(n){const r=new We().copy(n);return"id"in n&&(r.id=n.id),r}static getAbsoluteURL(n){return Kr?(Kr.href=n,Kr.href):n}static loadHeadlessBuffer(n,r){n.image.onload=r,n.image.src=n.src}static getTag(n){return n&&n.nodeName&&n.nodeName.toLowerCase()||"img"}static getImage(n){const r=We.getAbsoluteURL(n);if(We.ImageRegistry.contains(r))return We.ImageRegistry.get(r);let s;return sn.document?Ql.video.test(r)?s=document.createElement("video"):s=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),s.crossOrigin="anonymous",s.referrerPolicy="no-referrer",s}static load(n,r){let s=n.image,o=We.getTag(s);n._flagImage&&(/canvas/i.test(o)?We.Register.canvas(n,r):(n._src=s.getAttribute("two-src")||s.src,We.Register[o](n,r))),n._flagSrc&&(s||(s=We.getImage(n.src),n.image=s),o=We.getTag(s),We.Register[o](n,r))}clone(){const n=new We(this.src);return n.repeat=this.repeat,n.offset.copy(this.offset),n.scale=this.scale,n}copy(n){return this.src=n.src,this.repeat=n.repeat,this.offset=typeof n.offset=="number"||n.offset instanceof we?n.offset:new we().copy(n.offset),this.scale=typeof n.scale=="number"||n.scale instanceof we?n.scale:new we().copy(n.scale),this}toObject(){const n=super.toObject.call(this);return n.renderer.type="texture",n.src=this.src,n.repeat=this.repeat,n.offset=this.offset.toObject(),n.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),n}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(K.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,We.load(this,(function(){this.loaded=!0,this.trigger(K.Types.change).trigger(K.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 n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};C(We,"Properties",["src","loaded","repeat","scale","offset","image"]),C(We,"RegularExpressions",Ql),C(We,"ImageRegistry",new Mm),C(We,"Register",{canvas:function(n,r){n._src="#"+n.id,We.ImageRegistry.add(n.src,n.image),typeof r=="function"&&r()},img:function(n,r){const s=n.image,o=function(l){s.removeEventListener&&typeof s.removeEventListener=="function"&&(s.removeEventListener("load",o,!1),s.removeEventListener("error",a,!1)),typeof r=="function"&&r()},a=function(l){throw typeof s.removeEventListener=="function"&&(s.removeEventListener("load",o,!1),s.removeEventListener("error",a,!1)),new Gr("unable to load "+n.src)};typeof s.width=="number"&&s.width>0&&typeof s.height=="number"&&s.height>0?o():typeof s.addEventListener=="function"&&(s.addEventListener("load",o,!1),s.addEventListener("error",a,!1)),n._src=We.getAbsoluteURL(n._src),!(s&&s.getAttribute("two-src"))&&(s.setAttribute("two-src",n.src),We.ImageRegistry.add(n.src,s),n.image.src=n.src)},video:function(n,r){const s=function(a){n.image.removeEventListener("canplaythrough",s,!1),n.image.removeEventListener("error",o,!1),n.image.width=n.image.videoWidth,n.image.height=n.image.videoHeight,typeof r=="function"&&r()},o=function(a){throw n.image.removeEventListener("canplaythrough",s,!1),n.image.removeEventListener("error",o,!1),new Gr("unable to load "+n.src)};n._src=We.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),We.ImageRegistry.add(n.src,n.image)),n.image.readyState>=4?s():(n.image.addEventListener("canplaythrough",s,!1),n.image.addEventListener("error",o,!1),n.image.src=n.src,n.image.load())}});let rt=We;const ec={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=rt.getTag(e);let n;switch(t){case"canvas":n="#"+e.id;break;default:n=e.src}rt.ImageRegistry.contains(n)?this._image=rt.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(K.Types.change,this._renderer.flagOffset),this._offset=e,this._offset.bind(K.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof we&&this._scale.unbind(K.Types.change,this._renderer.flagScale),this._scale=e,this._scale instanceof we&&this._scale.bind(K.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Am(){this._flagOffset=!0}function Vm(){this._flagScale=!0}class $i extends Array{constructor(){super();pa(this,at,new K);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 Bt(this,at)}set _events(n){Wh(this,at,n)}get _bound(){return Bt(this,at)._bound}set _bound(n){Bt(this,at)._bound=n}addEventListener(){return Bt(this,at).addEventListener.apply(this,arguments)}on(){return Bt(this,at).on.apply(this,arguments)}bind(){return Bt(this,at).bind.apply(this,arguments)}removeEventListener(){return Bt(this,at).removeEventListener.apply(this,arguments)}off(){return Bt(this,at).off.apply(this,arguments)}unbind(){return Bt(this,at).unbind.apply(this,arguments)}dispatchEvent(){return Bt(this,at).dispatchEvent.apply(this,arguments)}trigger(){return Bt(this,at).trigger.apply(this,arguments)}listen(){return Bt(this,at).listen.apply(this,arguments)}ignore(){return Bt(this,at).ignore.apply(this,arguments)}pop(){const n=super.pop.apply(this,arguments);return this.trigger(K.Types.remove,[n]),n}shift(){const n=super.shift.apply(this,arguments);return this.trigger(K.Types.remove,[n]),n}push(){const n=super.push.apply(this,arguments);return this.trigger(K.Types.insert,arguments),n}unshift(){const n=super.unshift.apply(this,arguments);return this.trigger(K.Types.insert,arguments),n}splice(){const n=super.splice.apply(this,arguments);if(this.trigger(K.Types.remove,n),arguments.length>2){const r=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(K.Types.insert,r),this.trigger(K.Types.order)}return n}sort(){return super.sort.apply(this,arguments),this.trigger(K.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(K.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(n,r){const s=[];for(let o=0;o<this.length;o++){const a=this[o];let l;r?l=n.call(r,a,o):l=n(a,o),s.push(l)}return s}}at=new WeakMap;const tc=Array.prototype.slice;function Im(e){if(e==null)return!1;const t=e.length;return typeof t=="number"&&t>=0&&t<4294967296}const Ve={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},isFunction:function(e){return typeof e=="function"},extend:function(e){const t=tc.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=tc.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=!Im(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:sn.performance&&sn.performance.now?sn.performance:Date},$t=class $t extends sr{constructor(n,r,s){super();C(this,"_flagOffset",!0);C(this,"_flagOpacity",!0);C(this,"_flagColor",!0);C(this,"_offset",0);C(this,"_opacity",1);C(this,"_color","#fff");for(let o in nc)Object.defineProperty(this,o,nc[o]);this._renderer.type="stop",this.offset=typeof n=="number"?n:$t.Index<=0?0:1,this.opacity=typeof s=="number"?s:1,this.color=typeof r=="string"?r:$t.Index<=0?"#fff":"#000",$t.Index=($t.Index+1)%2}static fromObject(n){const r=new $t().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<$t.Properties.length;r++){const s=$t.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new $t;return Ve.each($t.Properties,function(s){r[s]=this[s]},this),n&&n.stops&&n.stops.push(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="stop",Ve.each($t.Properties,r=>{n[r]=this[r]},this),n}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};C($t,"Index",0),C($t,"Properties",["offset","opacity","color"]);let ii=$t;const nc={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 hn extends sr{constructor(n){super();C(this,"_flagStops",!1);C(this,"_flagSpread",!1);C(this,"_flagUnits",!1);C(this,"_spread","");C(this,"_units","");for(let r in ic)Object.defineProperty(this,r,ic[r]);this._renderer.type="gradient",this._renderer.flagStops=Om.bind(this),this._renderer.bindStops=zm.bind(this),this._renderer.unbindStops=Lm.bind(this),this.spread="pad",this.units="objectBoundingBox",n&&(this.stops=n)}static fromObject(n){let r=n.stops;r&&r.length>0&&(r=r.map(o=>o instanceof ii?o:new ii().copy(o)));const s=new hn().copy(n);return"id"in n&&(s.id=n.id),s}clone(n){const r=this.stops.map(o=>o.clone()),s=new hn(r);return Ve.each(hn.Properties,o=>{s[o]=this[o]},this),n&&n.add(s),s}copy(n){super.copy.call(this,n);for(let r=0;r<hn.Properties.length;r++){const s=hn.Properties[r];s in n&&(this[s]=n[s])}return this}toObject(){const n={stops:this.stops.map(r=>r.toObject())};return Ve.each(hn.Properties,r=>{n[r]=this[r]},this),n}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(K.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};C(hn,"Stop",ii),C(hn,"Properties",["spread","stops","units"]);let et=hn;const ic={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(K.Types.insert,t).unbind(K.Types.remove,n),this._stops=new $i((e||[]).slice(0)),this._stops.bind(K.Types.insert,t).bind(K.Types.remove,n),t(this._stops)}}};function Om(){this._flagStops=!0}function zm(e){let t=e.length;for(;t--;)e[t].bind(K.Types.change,this._renderer.flagStops),e[t].parent=this;this._renderer.flagStops()}function Lm(e){let t=e.length;for(;t--;)e[t].unbind(K.Types.change,this._renderer.flagStops),delete e[t].parent;this._renderer.flagStops()}const Dn=class Dn extends et{constructor(n,r,s,o,a){super(a);C(this,"_flagEndPoints",!1);C(this,"_left",null);C(this,"_right",null);for(let l in rc)Object.defineProperty(this,l,rc[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=Dm.bind(this),this.left=new we,this.right=new we,typeof n=="number"&&(this.left.x=n),typeof r=="number"&&(this.left.y=r),typeof s=="number"&&(this.right.x=s),typeof o=="number"&&(this.right.y=o)}static fromObject(n){const r=new Dn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Dn.Properties.length;r++){const s=Dn.Properties[r];s in n&&(this[s]=n[s]instanceof we?n[s]:new we().copy(n[s]))}return this}clone(n){const r=this.stops.map(function(o){return o.clone()}),s=new Dn(this.left._x,this.left._y,this.right._x,this.right._y,r);return Ve.each(et.Properties,function(o){s[o]=this[o]},this),n&&n.add(s),s}toObject(){const n=super.toObject.call(this);return n.left=this.left.toObject(),n.right=this.right.toObject(),n}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(K.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};C(Dn,"Stop",ii),C(Dn,"Properties",["left","right"]);let kt=Dn;const rc={left:{enumerable:!0,get:function(){return this._left},set:function(e){this._left instanceof we&&this._left.unbind(K.Types.change,this._renderer.flagEndPoints),this._left=e,this._left.bind(K.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(e){this._right instanceof we&&this._right.unbind(K.Types.change,this._renderer.flagEndPoints),this._right=e,this._right.bind(K.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function Dm(){this._flagEndPoints=!0}const un=class un extends et{constructor(n,r,s,o,a,l){super(o);C(this,"_flagRadius",!1);C(this,"_flagCenter",!1);C(this,"_flagFocal",!1);C(this,"_radius",0);C(this,"_center",null);C(this,"_focal",null);for(let c in sc)Object.defineProperty(this,c,sc[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Hm.bind(this),this._renderer.flagFocal=Wm.bind(this),this.center=new we,this.radius=typeof s=="number"?s:1,this.focal=new we,typeof n=="number"&&(this.center.x=n),typeof r=="number"&&(this.center.y=r),this.focal.copy(this.center),typeof a=="number"&&(this.focal.x=a),typeof l=="number"&&(this.focal.y=l)}static fromObject(n){const r=new un().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<un.Properties.length;r++){const s=un.Properties[r];s in n&&(/(center|focal)i/.test(s)?this[s]=n[s]instanceof we?n[s]:new we().copy(n[s]):typeof n[s]=="number"&&(this[s]=n[MediaKeySystemAccess]))}return this}clone(n){const r=this.stops.map(function(o){return o.clone()}),s=new un(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return Ve.each(et.Properties.concat(un.Properties),function(o){s[o]=this[o]},this),n&&n.add(s),s}toObject(){const n=super.toObject.call(this);return Ve.each(un.Properties,function(r){n[r]=this[r]},this),n.center=this.center.toObject(),n.focal=this.focal.toObject(),n}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(K.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};C(un,"Stop",ii),C(un,"Properties",["center","radius","focal"]);let xt=un;const sc={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(K.Types.change,this._renderer.flagCenter),this._center=e,this._center.bind(K.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(e){this._focal&&this._focal.unbind(K.Types.change,this._renderer.flagFocal),this._focal=e,this._focal.bind(K.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function Hm(){this._flagCenter=!0}function Wm(){this._flagFocal=!0}function oc(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 Zr(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 ac(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,p=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(p||e).x,d=(p||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),p&&e._relative&&(o+=e.x,d+=e.y),Rm(r,l,s,c,o,d,a,h,n)}function lc(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,p=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(p||e).x,d=(p||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),p&&e._relative&&(o+=e.x,d+=e.y),Zl(r,l,s,c,o,d,a,h,n)}function ri(e){switch(e.renderer.type){case"texture":return rt.fromObject(e);case"gradient":return et.fromObject(e);case"linear-gradient":return kt.fromObject(e);case"radial-gradient":return xt.fromObject(e)}return e}const jm=Math.cos,qm=Math.sin,cc=Math.tan,Gs=[],St=class St extends K{constructor(n,r,s,o,a,l){super();C(this,"elements",new Ul(9));C(this,"manual",!1);let c=n;Array.isArray(c)||(c=Array.prototype.slice.call(arguments)),this.identity(),c.length>0&&this.set(c)}static Multiply(n,r,s){if(r.length<=3){const k=n;let E,P,N;const j=r[0]||0,X=r[1]||0,A=r[2]||0;return E=k[0]*j+k[1]*X+k[2]*A,P=k[3]*j+k[4]*X+k[5]*A,N=k[6]*j+k[7]*X+k[8]*A,[E,P,N]}const o=n[0],a=n[1],l=n[2],c=n[3],d=n[4],h=n[5],u=n[6],p=n[7],f=n[8],g=r[0],m=r[1],y=r[2],_=r[3],b=r[4],S=r[5],x=r[6],v=r[7],B=r[8];return s=s||new Ul(9),s[0]=o*g+a*_+l*x,s[1]=o*m+a*b+l*v,s[2]=o*y+a*S+l*B,s[3]=c*g+d*_+h*x,s[4]=c*m+d*b+h*v,s[5]=c*y+d*S+h*B,s[6]=u*g+p*_+f*x,s[7]=u*m+p*b+f*v,s[8]=u*y+p*S+f*B,s}static fromObject(n){return new St().copy(n)}set(n,r,s,o,a,l,c,d,h){if(typeof r>"u"){const u=n;n=u[0],r=u[1],s=u[2],o=u[3],a=u[4],l=u[5],c=u[6],d=u[7],h=u[8]}return this.elements[0]=n,this.elements[1]=r,this.elements[2]=s,this.elements[3]=o,this.elements[4]=a,this.elements[5]=l,this.elements[6]=c,this.elements[7]=d,this.elements[8]=h,this.trigger(K.Types.change)}copy(n){return this.elements[0]=n.elements[0],this.elements[1]=n.elements[1],this.elements[2]=n.elements[2],this.elements[3]=n.elements[3],this.elements[4]=n.elements[4],this.elements[5]=n.elements[5],this.elements[6]=n.elements[6],this.elements[7]=n.elements[7],this.elements[8]=n.elements[8],this.manual=n.manual,this.trigger(K.Types.change)}identity(){return this.elements[0]=St.Identity[0],this.elements[1]=St.Identity[1],this.elements[2]=St.Identity[2],this.elements[3]=St.Identity[3],this.elements[4]=St.Identity[4],this.elements[5]=St.Identity[5],this.elements[6]=St.Identity[6],this.elements[7]=St.Identity[7],this.elements[8]=St.Identity[8],this.trigger(K.Types.change)}multiply(n,r,s,o,a,l,c,d,h){if(typeof r>"u")return this.elements[0]*=n,this.elements[1]*=n,this.elements[2]*=n,this.elements[3]*=n,this.elements[4]*=n,this.elements[5]*=n,this.elements[6]*=n,this.elements[7]*=n,this.elements[8]*=n,this.trigger(K.Types.change);if(typeof s>"u"&&(s=1),typeof o>"u"){n=n||0,r=r||0,s=s||0,a=this.elements;const L=a[0]*n+a[1]*r+a[2]*s,Z=a[3]*n+a[4]*r+a[5]*s,F=a[6]*n+a[7]*r+a[8]*s;return[L,Z,F]}const u=this.elements,p=[n,r,s,o,a,l,c,d,h],f=u[0],g=u[1],m=u[2],y=u[3],_=u[4],b=u[5],S=u[6],x=u[7],v=u[8],B=p[0],k=p[1],E=p[2],P=p[3],N=p[4],j=p[5],X=p[6],A=p[7],V=p[8];return this.elements[0]=f*B+g*P+m*X,this.elements[1]=f*k+g*N+m*A,this.elements[2]=f*E+g*j+m*V,this.elements[3]=y*B+_*P+b*X,this.elements[4]=y*k+_*N+b*A,this.elements[5]=y*E+_*j+b*V,this.elements[6]=S*B+x*P+v*X,this.elements[7]=S*k+x*N+v*A,this.elements[8]=S*E+x*j+v*V,this.trigger(K.Types.change)}inverse(n){const r=this.elements;n=n||new St;const s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],d=r[5],h=r[6],u=r[7],p=r[8],f=p*c-d*u,g=-p*l+d*h,m=u*l-c*h;let y=s*f+o*g+a*m;return y?(y=1/y,n.elements[0]=f*y,n.elements[1]=(-p*o+a*u)*y,n.elements[2]=(d*o-a*c)*y,n.elements[3]=g*y,n.elements[4]=(p*s-a*h)*y,n.elements[5]=(-d*s+a*l)*y,n.elements[6]=m*y,n.elements[7]=(-u*s+o*h)*y,n.elements[8]=(c*s-o*l)*y,n):null}scale(n,r){return arguments.length<=1&&(r=n),this.multiply(n,0,0,0,r,0,0,0,1)}rotate(n){const r=jm(n),s=qm(n);return this.multiply(r,-s,0,s,r,0,0,0,1)}translate(n,r){return this.multiply(1,0,n,0,1,r,0,0,1)}skewX(n){const r=cc(n);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(n){const r=cc(n);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(n){return Gs.length=0,this.toTransformArray(n,Gs),Gs.map(an).join(" ")}toTransformArray(n,r){const s=this.elements,o=!!r,a=s[0],l=s[1],c=s[2],d=s[3],h=s[4],u=s[5];if(n){const p=s[6],f=s[7],g=s[8];if(o){r[0]=a,r[1]=d,r[2]=p,r[3]=l,r[4]=h,r[5]=f,r[6]=c,r[7]=u,r[8]=g;return}return[a,d,p,l,h,f,c,u,g]}if(o){r[0]=a,r[1]=d,r[2]=l,r[3]=h,r[4]=c,r[5]=u;return}return[a,d,l,h,c,u]}toArray(n,r){const s=this.elements,o=!!r,a=s[0],l=s[1],c=s[2],d=s[3],h=s[4],u=s[5];if(n){const p=s[6],f=s[7],g=s[8];if(o){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=h,r[5]=u,r[6]=p,r[7]=f,r[8]=g;return}return[a,l,c,d,h,u,p,f,g]}if(o){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=h,r[5]=u;return}return[a,l,c,d,h,u]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new St().copy(this)}};C(St,"Identity",[1,0,0,0,1,0,0,0,1]);let or=St;Sm(or);const vr=class vr extends sr{constructor(){super();C(this,"_flagMatrix",!0);C(this,"_flagScale",!1);C(this,"_matrix",null);C(this,"_worldMatrix",null);C(this,"_position",null);C(this,"_rotation",0);C(this,"_scale",1);C(this,"_skewX",0);C(this,"_skewY",0);for(let n in Jr)Object.defineProperty(this,n,Jr[n]);this._renderer.flagMatrix=dc.bind(this),this.isShape=!0,this.matrix=new or,this.worldMatrix=new or,this.position=new we,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(n){const r=new vr().copy(n);return"id"in n&&(r.id=n.id),r}get renderer(){return this._renderer}set renderer(n){this._renderer=n}get translation(){return Jr.position.get.apply(this,arguments)}set translation(n){Jr.position.set.apply(this,arguments)}addTo(n){return n.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}copy(n){return super.copy.call(this,n),"position"in n&&(n.position instanceof we?this.position=n.position:this.position.copy(n.position)),"rotation"in n&&(this.rotation=n.rotation),"scale"in n&&(this.scale=typeof n.scale=="number"||n.scale instanceof we?n.scale:new we(n.scale.x,n.scale.y)),"skewX"in n&&(this.skewX=n.skewX),"skewY"in n&&(this.skewY=n.skewY),"matrix"in n&&n.matrix.manual&&(this.matrix.copy(n.matrix),this.matrix.manual=!0),this}clone(n){const r=new vr;return r.position.copy(this.position),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer={type:"shape"},n.isShape=!0,n.translation=this.translation.toObject(),n.rotation=this.translation.rotation,n.scale=this.scale instanceof we?this.scale.toObject():this.scale,n.skewX=this.skewX,n.skewY=this.skewY,n.matrix=this.matrix.toObject(),n}_update(n){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof we?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),n&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};C(vr,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let yn=vr;const Jr={position:{enumerable:!0,get:function(){return this._position},set:function(e){this._position&&this._position.unbind(K.Types.change,this._renderer.flagMatrix),this._position=e,this._position.bind(K.Types.change,this._renderer.flagMatrix),dc.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 we&&this._scale.unbind(K.Types.change,this._renderer.flagMatrix),this._scale=e,this._scale instanceof we&&this._scale.bind(K.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 Bm(this,this._worldMatrix),this._worldMatrix},set:function(e){this._worldMatrix=e}}};function dc(){this._flagMatrix=!0}const Ni=Math.min,Pi=Math.max,Xm=Math.ceil,Ym=Math.floor,Um=new we,Zt=class Zt extends yn{constructor(n,r,s,o){super();C(this,"_flagVertices",!0);C(this,"_flagLength",!0);C(this,"_flagFill",!0);C(this,"_flagStroke",!0);C(this,"_flagLinewidth",!0);C(this,"_flagOpacity",!0);C(this,"_flagVisible",!0);C(this,"_flagCap",!0);C(this,"_flagJoin",!0);C(this,"_flagMiter",!0);C(this,"_flagMask",!1);C(this,"_flagClip",!1);C(this,"_length",0);C(this,"_fill","#fff");C(this,"_stroke","#000");C(this,"_linewidth",1);C(this,"_opacity",1);C(this,"_visible",!0);C(this,"_cap","round");C(this,"_join","round");C(this,"_miter",4);C(this,"_closed",!0);C(this,"_curved",!1);C(this,"_automatic",!0);C(this,"_beginning",0);C(this,"_ending",1);C(this,"_mask",null);C(this,"_clip",!1);C(this,"_dashes",null);for(let a in hc)Object.defineProperty(this,a,hc[a]);this._renderer.type="path",this._renderer.flagVertices=uc.bind(this),this._renderer.bindVertices=fc.bind(this),this._renderer.unbindVertices=pc.bind(this),this._renderer.flagFill=gc.bind(this),this._renderer.flagStroke=mc.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!r,this.curved=!!s,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=n,this.automatic=!o,this.dashes=[],this.dashes.offset=0}static fromObject(n){const r=typeof n.fill=="string"?n.fill:ri(n.fill),s=typeof n.stroke=="string"?n.stroke:ri(n.stroke),o=new Zt().copy({...n,fill:r,stroke:s});return"id"in n&&(o.id=n.id),o}copy(n){super.copy.call(this,n),this.vertices=[];for(let r=0;r<n.vertices.length;r++){const s=n.vertices[r];s instanceof Ee?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Ee().copy(s))}for(let r=0;r<Zt.Properties.length;r++){const s=Zt.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new Zt;for(let s=0;s<this.vertices.length;s++)r.vertices.push(this.vertices[s].clone());for(let s=0;s<Zt.Properties.length;s++){const o=Zt.Properties[s];r[o]=this[o]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="path",n.vertices=this.vertices.map(r=>r.toObject()),Ve.each(Zt.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const n=this.getBoundingClientRect(!0),r=n.width/2,s=n.height/2,o=n.left+n.width/2,a=n.top+n.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=o,c.y-=a,c.x+=r,c.y+=s}return this.mask&&(this.mask.translation.x-=o,this.mask.translation.x+=r,this.mask.translation.y-=a,this.mask.translation.y+=s),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,s=n.top+n.height/2-this.translation.y;for(let o=0;o<this.vertices.length;o++){const a=this.vertices[o];a.x-=r,a.y-=s}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=s),this}getBoundingClientRect(n){let r,s,o,a,l,c,d=1/0,h=-1/0,u=1/0,p=-1/0;if(this._update(!0),r=n?this.matrix:this.worldMatrix,s=(this.linewidth||0)/2,o=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:f,scaleY:g}=Cm(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof f=="number"&&typeof g=="number"&&(s=Math.max(f,g)*(this.linewidth||0)/2)}else s*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(o<=0)return{width:0,height:0};for(a=0;a<o;a++){c=this._renderer.vertices[a],l=this._renderer.vertices[(a+o-1)%o];const[f,g]=r.multiply(l.x,l.y),[m,y]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let _=l.controls.right.x,b=l.controls.right.y;l.relative&&(_+=l.x,b+=l.y);let[S,x]=r.multiply(_,b),v=c.controls.left.x,B=c.controls.left.y;c.relative&&(v+=c.x,B+=c.y);let[k,E]=r.multiply(v,B);const P=$m(f,g,S,x,k,E,m,y);u=Ni(P.min.y-s,u),d=Ni(P.min.x-s,d),h=Pi(P.max.x+s,h),p=Pi(P.max.y+s,p)}else a<=1&&(u=Ni(g-s,u),d=Ni(f-s,d),h=Pi(f+s,h),p=Pi(g+s,p)),u=Ni(y-s,u),d=Ni(m-s,d),h=Pi(m+s,h),p=Pi(y+s,p)}return{top:u,left:d,right:h,bottom:p,width:h-d,height:p-u}}getPointAt(n,r){let s,o,a,l,c,d,h,u,p,f,g,m,y,_,b,S=this.length*Math.min(Math.max(n,0),1);const x=this.vertices.length,v=x-1;let B=null,k=null;for(let R=0,$=this._lengths.length,M=0;R<$;R++){if(M+this._lengths[R]>=S){this._closed?(s=Ri(R,x),o=Ri(R-1,x),R===0&&(s=o,o=R)):(s=R,o=Math.min(Math.max(R-1,0),v)),B=this.vertices[s],k=this.vertices[o],S-=M,this._lengths[R]!==0?n=S/this._lengths[R]:n=0;break}M+=this._lengths[R]}if(B===null||k===null)return null;if(B){if(!k)return B}else return k;b=k.controls&&k.controls.right,_=B.controls&&B.controls.left,c=k.x,f=k.y,d=(b||k).x,g=(b||k).y,h=(_||B).x,m=(_||B).y,u=B.x,y=B.y,b&&k.relative&&(d+=k.x,g+=k.y),_&&B.relative&&(h+=B.x,m+=B.y),l=Ur(n,c,d,h,u),p=Ur(n,f,g,m,y);const E=on(c,d,n),P=on(f,g,n),N=on(d,h,n),j=on(g,m,n),X=on(h,u,n),A=on(m,y,n),V=on(E,N,n),L=on(P,j,n),Z=on(N,X,n),F=on(j,A,n);return Ve.isObject(r)?(r.x=l,r.y=p,r instanceof Ee&&(r.controls.left.x=V,r.controls.left.y=L,r.controls.right.x=Z,r.controls.right.y=F,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=p,r.controls.right.x-=l,r.controls.right.y-=p)),r.t=n,r):(a=new Ee(l,p,V-l,L-p,Z-l,F-p,this._curved?pe.curve:pe.line),a.t=n,a)}plot(){if(this.curved)return Pm(this._collection,this.closed),this;for(let n=0;n<this._collection.length;n++)this._collection[n].command=n===0?pe.move:pe.line;return this}subdivide(n){this._update();const r=this.vertices.length-1,s=this._closed||this.vertices[r]._command===pe.close;let o=this.vertices[r],a=[],l;return Ve.each(this.vertices,function(c,d){if(d<=0&&!s){o=c;return}if(c.command===pe.move){a.push(new Ee(o.x,o.y)),d>0&&(a[a.length-1].command=pe.line),o=c;return}l=lc(c,o,n),a=a.concat(l),Ve.each(l,function(h,u){u<=0&&o.command===pe.move?h.command=pe.move:h.command=pe.line}),d>=r&&(this._closed&&this._automatic&&(o=c,l=lc(c,o,n),a=a.concat(l),Ve.each(l,function(h,u){u<=0&&o.command===pe.move?h.command=pe.move:h.command=pe.line})),a.push(new Ee(c.x,c.y)),a[a.length-1].command=s?pe.close:pe.line),o=c},this),this._automatic=!1,this._curved=!1,this.vertices=a,this}_updateLength(n,r){r||this._update();const o=this.vertices.length-1;let a=this.vertices[o],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),Ve.each(this.vertices,function(c,d){if(d<=0||c.command===pe.move){a=c,this._lengths[d]=0;return}this._lengths[d]=ac(c,a,n),l+=this._lengths[d],a=c},this),this._length=l,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const n=this._collection.length,r=this._closed,s=Math.min(this._beginning,this._ending),o=Math.max(this._beginning,this._ending),a=Zr(this,s*this._length),l=Zr(this,o*this._length),c=Xm(a),d=Ym(l);let h,u,p,f,g,m;for(this._renderer.vertices.length=0,m=0;m<n;m++)this._renderer.collection.length<=m&&this._renderer.collection.push(new Ee),m>d&&!u?(g=this._renderer.collection[m].copy(this._collection[m]),this.getPointAt(o,g),g.command=this._renderer.collection[m].command,this._renderer.vertices.push(g),u=g,p=this._collection[m-1],p&&p.controls&&(g.relative?g.controls.right.clear():g.controls.right.copy(g),p.relative?this._renderer.collection[m-1].controls.right.copy(p.controls.right).lerp(we.zero,1-g.t):this._renderer.collection[m-1].controls.right.copy(p.controls.right).lerp(p,1-g.t))):m>=c&&m<=d&&(g=this._renderer.collection[m].copy(this._collection[m]),this._renderer.vertices.push(g),m===d&&oc(this,o)?(u=g,!r&&u.controls&&(u.relative?u.controls.right.clear():u.controls.right.copy(u))):m===c&&oc(this,s)&&(h=g,h.command=pe.move,!r&&h.controls&&(h.relative?h.controls.left.clear():h.controls.left.copy(h))));c>0&&!h&&(m=c-1,g=this._renderer.collection[m].copy(this._collection[m]),this.getPointAt(s,g),g.command=pe.move,this._renderer.vertices.unshift(g),f=this._collection[m+1],f&&f.controls&&(g.controls.left.clear(),f.relative?this._renderer.collection[m+1].controls.left.copy(f.controls.left).lerp(we.zero,g.t):(Um.copy(f),this._renderer.collection[m+1].controls.left.copy(f.controls.left).lerp(f,g.t))))}return yn.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,yn.prototype.flagReset.call(this),this}};C(Zt,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes"]),C(Zt,"Utils",{getCurveLength:ac});let Re=Zt;const hc={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 et||this._fill instanceof kt||this._fill instanceof xt||this._fill instanceof rt)&&this._fill.unbind(K.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof et||this._fill instanceof kt||this._fill instanceof xt||this._fill instanceof rt)&&this._fill.bind(K.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof et||this._stroke instanceof kt||this._stroke instanceof xt||this._stroke instanceof rt)&&this._stroke.unbind(K.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof et||this._stroke instanceof kt||this._stroke instanceof xt||this._stroke instanceof rt)&&this._stroke.bind(K.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";Ve.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(K.Types.insert,t).unbind(K.Types.remove,n),e instanceof $i?this._collection=e:this._collection=new $i(e||[]),this._collection.bind(K.Types.insert,t).bind(K.Types.remove,n),t(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,Ve.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 uc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function fc(e){let t=e.length;for(;t--;)e[t].bind(K.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function pc(e){let t=e.length;for(;t--;)e[t].unbind(K.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function gc(){this._flagFill=!0}function mc(){this._flagStroke=!0}const Gm=Math.ceil,Km=Math.floor,fn=class fn extends yn{constructor(n){super();C(this,"_flagVertices",!0);C(this,"_flagLength",!0);C(this,"_flagFill",!0);C(this,"_flagStroke",!0);C(this,"_flagLinewidth",!0);C(this,"_flagOpacity",!0);C(this,"_flagVisible",!0);C(this,"_flagSize",!0);C(this,"_flagSizeAttenuation",!0);C(this,"_length",0);C(this,"_fill","#fff");C(this,"_stroke","#000");C(this,"_linewidth",1);C(this,"_opacity",1);C(this,"_visible",!0);C(this,"_size",1);C(this,"_sizeAttenuation",!1);C(this,"_beginning",0);C(this,"_ending",1);C(this,"_dashes",null);C(this,"noFill",Re.prototype.noFill);C(this,"noStroke",Re.prototype.noStroke);C(this,"corner",Re.prototype.corner);C(this,"center",Re.prototype.center);C(this,"getBoundingClientRect",Re.prototype.getBoundingClientRect);C(this,"_updateLength",Re.prototype._updateLength);for(let r in yc)Object.defineProperty(this,r,yc[r]);this._renderer.type="points",this._renderer.flagVertices=uc.bind(this),this._renderer.bindVertices=fc.bind(this),this._renderer.unbindVertices=pc.bind(this),this._renderer.flagFill=gc.bind(this),this._renderer.flagStroke=mc.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=n,this.dashes=[],this.dashes.offset=0}static fromObject(n){const r=typeof n.fill=="string"?n.fill:ri(n.fill),s=typeof n.stroke=="string"?n.stroke:ri(n.stroke),o=new fn().copy({...n,fill:r,stroke:s});return"id"in n&&(o.id=n.id),o}copy(n){super.copy.call(this,n);for(let r=0;r<n.vertices.length;r++){const s=n.vertices[r];s instanceof Ee?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Ee().copy(s))}for(let r=0;r<fn.Properties.length;r++){const s=fn.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new fn;for(let s=0;s<this.vertices.length;s++)r.vertices.push(this.vertices[s].clone());for(let s=0;s<fn.Properties.length;s++){const o=fn.Properties[s];r[o]=this[o]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="points",n.vertices=this.vertices.map(r=>r.toObject()),Ve.each(fn.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}subdivide(n){this._update();let r=[];for(let s=0;s<this.vertices.length;s++){const o=this.vertices[s],a=this.vertices[s-1];if(!a)continue;const l=o.x,c=o.y,d=a.x,h=a.y,u=Zl(l,c,l,c,d,h,d,h,n);r=r.concat(u)}return this.vertices=r,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const n=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),s=Zr(this,n*this._length),o=Zr(this,r*this._length),a=Gm(s),l=Km(o);let c=0,d;this._renderer.vertices=[],this._renderer.collection=[];for(let h=0;h<this._collection.length;h++)h>=a&&h<=l&&(d=this._collection[h],this._renderer.collection.push(d),this._renderer.vertices[c*2+0]=d.x,this._renderer.vertices[c*2+1]=d.y,c++)}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}};C(fn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes"]);let Qr=fn;const yc={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 et||this._fill instanceof kt||this._fill instanceof xt||this._fill instanceof rt)&&this._fill.unbind(K.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof et||this._fill instanceof kt||this._fill instanceof xt||this._fill instanceof rt)&&this._fill.bind(K.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof et||this._stroke instanceof kt||this._stroke instanceof xt||this._stroke instanceof rt)&&this._stroke.unbind(K.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof et||this._stroke instanceof kt||this._stroke instanceof xt||this._stroke instanceof rt)&&this._stroke.bind(K.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(K.Types.insert,t).unbind(K.Types.remove,n),e instanceof $i?this._collection=e:this._collection=new $i(e||[]),this._collection.bind(K.Types.insert,t).bind(K.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}}};class _c extends $i{constructor(n){n=Array.isArray(n)?n:Array.prototype.slice.call(arguments);super(n);pa(this,Ss,{});this.attach(n),this.on(K.Types.insert,this.attach),this.on(K.Types.remove,this.detach)}get ids(){return Bt(this,Ss)}attach(n){for(let r=0;r<n.length;r++){const s=n[r];s&&s.id&&(this.ids[s.id]=s)}return this}detach(n){for(let r=0;r<n.length;r++)delete this.ids[n[r].id];return this}}Ss=new WeakMap;const kn=class kn extends Re{constructor(n,r,s,o,a,l,c){const d=c||Us.Resolution*3,h=[];for(let u=0;u<d;u++)h.push(new Ee);super(h,!0,!1,!0);C(this,"_flagStartAngle",!1);C(this,"_flagEndAngle",!1);C(this,"_flagInnerRadius",!1);C(this,"_flagOuterRadius",!1);C(this,"_startAngle",0);C(this,"_endAngle",ni);C(this,"_innerRadius",0);C(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let u in bc)Object.defineProperty(this,u,bc[u]);typeof s=="number"&&(this.innerRadius=s),typeof o=="number"&&(this.outerRadius=o),typeof a=="number"&&(this.startAngle=a),typeof l=="number"&&(this.endAngle=l),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new kn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<kn.Properties.length;r++){const s=kn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const n=this._startAngle,r=this._endAngle,s=this._innerRadius,o=this._outerRadius,a=Ri(n,ni)===Ri(r,ni),l=s>0,c=this.vertices;let d=l?c.length/2:c.length,h,u=0,p,f,g,m,y,_,b,S,x;for(a?d--:l||(d-=2),p=0,f=d-1;p<d;p++){switch(g=p/f,m=c[u],y=g*(r-n)+n,_=(r-n)/d,b=o*Math.cos(y),S=o*Math.sin(y),p){case 0:h=pe.move;break;default:h=pe.curve}m.command=h,m.x=b,m.y=S,m.controls.left.clear(),m.controls.right.clear(),m.command===pe.curve&&(x=o*_/Math.PI,m.controls.left.x=x*Math.cos(y-it),m.controls.left.y=x*Math.sin(y-it),m.controls.right.x=x*Math.cos(y+it),m.controls.right.y=x*Math.sin(y+it),p===1&&m.controls.left.multiplyScalar(2),p===f&&m.controls.right.multiplyScalar(2)),u++}if(l){for(a?(c[u].command=pe.close,u++):(d--,f=d-1),p=0;p<d;p++)g=p/f,m=c[u],y=(1-g)*(r-n)+n,_=(r-n)/d,b=s*Math.cos(y),S=s*Math.sin(y),h=pe.curve,p<=0&&(h=a?pe.move:pe.line),m.command=h,m.x=b,m.y=S,m.controls.left.clear(),m.controls.right.clear(),m.command===pe.curve&&(x=s*_/Math.PI,m.controls.left.x=x*Math.cos(y+it),m.controls.left.y=x*Math.sin(y+it),m.controls.right.x=x*Math.cos(y-it),m.controls.right.y=x*Math.sin(y-it),p===1&&m.controls.left.multiplyScalar(2),p===f&&m.controls.right.multiplyScalar(2)),u++;c[u].copy(c[0]),c[u].command=pe.line}else a||(c[u].command=pe.line,c[u].x=0,c[u].y=0,u++,c[u].copy(c[0]),c[u].command=pe.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(n){const r=this.innerRadius,s=this.outerRadius,o=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new kn(0,0,r,s,o,a,l);c.translation.copy(this.translation),c.rotation=this.rotation,c.scale=this.scale,c.skewX=this.skewX,c.skewY=this.skewY,this.matrix.manual&&c.matrix.copy(this.matrix);for(let d=0;d<Re.Properties.length;d++){const h=Re.Properties[d];c[h]=this[h]}return n&&n.add(c),c}toObject(){const n=super.toObject.call(this);n.renderer.type="arc-segment";for(let r=0;r<kn.Properties.length;r++){const s=kn.Properties[r];n[s]=this[s]}return n}};C(kn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let Ks=kn;const bc={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}}},Zs=Math.cos,Js=Math.sin,xn=class xn extends Re{constructor(n,r,s,o){const a=o?Math.max(o,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ee(0,0,0,0,0,0));super(l,!0,!0,!0);C(this,"_flagRadius",!1);C(this,"_radius",0);this._renderer.type="circle";for(let c in wc)Object.defineProperty(this,c,wc[c]);typeof s=="number"&&(this.radius=s),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new xn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<xn.Properties.length;r++){const s=xn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagRadius){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(n*2)),s=this._radius,o=s*r;for(let a=0;a<this.vertices.length;a++){const c=a/n*ni,d=s*Zs(c),h=s*Js(c),u=o*Zs(c-it),p=o*Js(c-it),f=o*Zs(c+it),g=o*Js(c+it),m=this.vertices[a];m.command=a===0?pe.move:pe.curve,m.set(d,h),m.controls.left.set(u,p),m.controls.right.set(f,g)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=new xn(0,0,this.radius,this.vertices.length);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let s=0;s<Re.Properties.length;s++){const o=Re.Properties[s];r[o]=this[o]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="circle";for(let r=0;r<xn.Properties.length;r++){const s=xn.Properties[r];n[s]=this[s]}return n}};C(xn,"Properties",["radius"]);let Qs=xn;const wc={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this._flagRadius=!0}}},eo=Math.cos,to=Math.sin,Cn=class Cn extends Re{constructor(n,r,s,o,a){typeof o!="number"&&typeof s=="number"&&(o=s);const l=a?Math.max(a,2):4,c=[];for(let d=0;d<l;d++)c.push(new Ee);super(c,!0,!0,!0);C(this,"_flagWidth",!1);C(this,"_flagHeight",!1);C(this,"_width",0);C(this,"_height",0);this._renderer.type="ellipse";for(let d in vc)Object.defineProperty(this,d,vc[d]);typeof s=="number"&&(this.width=s*2),typeof o=="number"&&(this.height=o*2),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Cn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Cn.Properties.length;r++){const s=Cn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(this.vertices.length*2)),s=this._width/2,o=this._height/2;for(let a=0;a<this.vertices.length;a++){const c=a/n*ni,d=s*eo(c),h=o*to(c),u=s*r*eo(c-it),p=o*r*to(c-it),f=s*r*eo(c+it),g=o*r*to(c+it),m=this.vertices[a];m.command=a===0?pe.move:pe.curve,m.set(d,h),m.controls.left.set(u,p),m.controls.right.set(f,g)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=this.width/2,s=this.height/2,o=this.vertices.length,a=new Cn(0,0,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<Re.Properties.length;l++){const c=Re.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="ellipse";for(let r=0;r<Cn.Properties.length;r++){const s=Cn.Properties[r];n[s]=this[s]}return n}};C(Cn,"Properties",["width","height"]);let no=Cn;const vc={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}}},Zm=Math.cos,Jm=Math.sin,Sn=class Sn extends Re{constructor(n,r,s,o){o=Math.max(o||0,3);super();C(this,"_flagWidth",!1);C(this,"_flagHeight",!1);C(this,"_flagSides",!1);C(this,"_radius",0);C(this,"_width",0);C(this,"_height",0);C(this,"_sides",0);this._renderer.type="polygon";for(let a in kc)Object.defineProperty(this,a,kc[a]);this.closed=!0,this.automatic=!1,typeof s=="number"&&(this.radius=s),typeof o=="number"&&(this.sides=o),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Sn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Sn.Properties.length;r++){const s=Sn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const n=this._sides,r=n+1;let s=this.vertices.length;s>n&&(this.vertices.splice(n-1,s-n),s=n);for(let o=0;o<r;o++){const a=(o+.5)/n,l=ni*a+Math.PI/2,c=this._width*Zm(l)/2,d=this._height*Jm(l)/2;o>=s?this.vertices.push(new Ee(c,d)):this.vertices[o].set(c,d),this.vertices[o].command=o===0?pe.move:pe.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=new Sn(0,0,0,this.sides);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,r.width=this.width,r.height=this.height,this.matrix.manual&&r.matrix.copy(this.matrix);for(let s=0;s<Re.Properties.length;s++){const o=Re.Properties[s];r[o]=this[o]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="polygon";for(let r=0;r<Sn.Properties.length;r++){const s=Sn.Properties[r];n[s]=this[s]}return n}};C(Sn,"Properties",["width","height","sides"]);let io=Sn;const kc={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}}},bi=class bi extends Re{constructor(n,r,s,o){const a=[new Ee,new Ee,new Ee,new Ee];super(a,!0,!1,!0);C(this,"_flagWidth",0);C(this,"_flagHeight",0);C(this,"_width",0);C(this,"_height",0);C(this,"_origin",null);this._renderer.type="rectangle";for(let l in xc)Object.defineProperty(this,l,xc[l]);this.width=typeof s=="number"?s:1,this.height=typeof o=="number"?o:1,this.origin=new we,typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(n){const r=new bi().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<bi.Properties.length;r++){const s=bi.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const n=this._width/2,r=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Ee),this.vertices[0].set(-n,-r).sub(this._origin).command=pe.move,this.vertices[1].set(n,-r).sub(this._origin).command=pe.line,this.vertices[2].set(n,r).sub(this._origin).command=pe.line,this.vertices[3].set(-n,r).sub(this._origin).command=pe.line,this.vertices[4]&&(this.vertices[4].set(-n,-r).sub(this._origin).command=pe.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=new bi(0,0,this.width,this.height);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let s=0;s<Re.Properties.length;s++){const o=Re.Properties[s];r[o]=this[o]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="rectangle",n.width=this.width,n.height=this.height,n.origin=this.origin.toObject(),n}};C(bi,"Properties",["width","height"]);let ro=bi;const xc={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(K.Types.change,this._renderer.flagVertices),this._origin=e,this._origin.bind(K.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Bn=class Bn extends Re{constructor(n,r,s,o,a){typeof a>"u"&&typeof s=="number"&&typeof o=="number"&&(a=Math.floor(Math.min(s,o)/12));const l=[];for(let c=0;c<10;c++)l.push(new Ee(0,0,0,0,0,0,c===0?pe.move:pe.curve));super(l);C(this,"_flagWidth",!1);C(this,"_flagHeight",!1);C(this,"_flagRadius",!1);C(this,"_width",0);C(this,"_height",0);C(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in Cc)Object.defineProperty(this,c,Cc[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=Qm.bind(this),typeof s=="number"&&(this.width=s),typeof o=="number"&&(this.height=o),typeof a=="number"&&(this.radius=a),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Bn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Bn.Properties.length;r++){const s=Bn.Properties[r];if(s in n){const o=n[s];/radius/i.test(s)?this[s]=typeof o=="number"||o instanceof we?o:new we().copy(o):typeof o=="number"&&(this[s]=o)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const n=this._width,r=this._height;let s,o;this._radius instanceof we?(s=this._radius.x,o=this._radius.y):(s=this._radius,o=this._radius);let a,l=n/2,c=r/2;a=this.vertices[0],a.x=-(l-s),a.y=-c,a=this.vertices[1],a.x=l-s,a.y=-c,a.controls.left.clear(),a.controls.right.x=s,a.controls.right.y=0,a=this.vertices[2],a.x=l,a.y=-(c-o),a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[3],a.x=l,a.y=c-o,a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=o,a=this.vertices[4],a.x=l-s,a.y=c,a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[5],a.x=-(l-s),a.y=c,a.controls.left.clear(),a.controls.right.x=-s,a.controls.right.y=0,a=this.vertices[6],a.x=-l,a.y=c-o,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[7],a.x=-l,a.y=-(c-o),a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=-o,a=this.vertices[8],a.x=-(l-s),a.y=-c,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[9],a.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(n){const r=this.width,s=this.height,o=this.radius,a=new Bn(0,0,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<Re.Properties.length;l++){const c=Re.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="rounded-rectangle";for(let r=0;r<Bn.Properties.length;r++){const s=Bn.Properties[r];n[s]=this[s]}return n.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),n}};C(Bn,"Properties",["width","height","radius"]);let so=Bn;const Cc={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 we&&this._radius.unbind(K.Types.change,this._renderer.flagRadius),this._radius=e,this._radius instanceof we&&this._radius.bind(K.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function Qm(){this._flagRadius=!0}const e0=Math.cos,t0=Math.sin,Tn=class Tn extends Re{constructor(n,r,s,o,a){arguments.length<=3&&(o=s,s=o/2),(typeof a!="number"||a<=0)&&(a=5);super();C(this,"_flagInnerRadius",!1);C(this,"_flagOuterRadius",!1);C(this,"_flagSides",!1);C(this,"_innerRadius",0);C(this,"_outerRadius",0);C(this,"_sides",0);this._renderer.type="star";for(let l in Sc)Object.defineProperty(this,l,Sc[l]);this.closed=!0,this.automatic=!1,typeof s=="number"&&(this.innerRadius=s),typeof o=="number"&&(this.outerRadius=o),typeof a=="number"&&(this.sides=a),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Tn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Tn.Properties.length;r++){const s=Tn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const n=this._sides*2,r=n+1;let s=this.vertices.length;s>n&&(this.vertices.splice(n-1,s-n),s=n);for(let o=0;o<r;o++){const a=(o+.5)/n,l=ni*a,c=(o%2?this._outerRadius:this._innerRadius)/2,d=c*e0(l),h=c*t0(l);o>=s?this.vertices.push(new Ee(d,h)):this.vertices[o].set(d,h),this.vertices[o].command=o===0?pe.move:pe.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=this.innerRadius,s=this.outerRadius,o=this.sides,a=new Tn(0,0,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<Re.Properties.length;l++){const c=Re.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="star";for(let r=0;r<Tn.Properties.length;r++){const s=Tn.Properties[r];n[s]=this[s]}return n}};C(Tn,"Properties",["innerRadius","outerRadius","sides"]);let oo=Tn;const Sc={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}}};let ao;const Bc=Math.min,Tc=Math.max;sn.document&&(ao=document.createElement("canvas"));const gt=class gt extends yn{constructor(n,r,s,o){super();C(this,"_flagValue",!0);C(this,"_flagFamily",!0);C(this,"_flagSize",!0);C(this,"_flagLeading",!0);C(this,"_flagAlignment",!0);C(this,"_flagBaseline",!0);C(this,"_flagStyle",!0);C(this,"_flagWeight",!0);C(this,"_flagDecoration",!0);C(this,"_flagFill",!0);C(this,"_flagStroke",!0);C(this,"_flagLinewidth",!0);C(this,"_flagOpacity",!0);C(this,"_flagVisible",!0);C(this,"_flagMask",!1);C(this,"_flagClip",!1);C(this,"_flagDirection",!0);C(this,"_value","");C(this,"_family","sans-serif");C(this,"_size",13);C(this,"_leading",17);C(this,"_alignment","center");C(this,"_baseline","middle");C(this,"_style","normal");C(this,"_weight",500);C(this,"_decoration","none");C(this,"_direction","ltr");C(this,"_fill","#000");C(this,"_stroke","none");C(this,"_linewidth",1);C(this,"_opacity",1);C(this,"_visible",!0);C(this,"_mask",null);C(this,"_clip",!1);C(this,"_dashes",null);for(let a in Ec)Object.defineProperty(this,a,Ec[a]);if(this._renderer.type="text",this._renderer.flagFill=n0.bind(this),this._renderer.flagStroke=i0.bind(this),this.value=n,typeof r=="number"&&(this.translation.x=r),typeof s=="number"&&(this.translation.y=s),this.dashes=[],this.dashes.offset=0,!Ve.isObject(o))return this;for(let a=0;a<gt.Properties.length;a++){const l=gt.Properties[a];l in o&&(this[l]=o[l])}}static Measure(n){if(ao){const r=ao.getContext("2d");r.font=[n._style,n._weight,`${n._size}px/${n._leading}px`,n._family].join(" ");const s=r.measureText(n.value,0,0),o=s.actualBoundingBoxDescent+s.actualBoundingBoxAscent;return{width:s.width,height:o}}else{const r=this.value.length*this.size*gt.Ratio,s=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:r,height:s}}}static fromObject(n){const r=typeof n.fill=="string"?n.fill:ri(n.fill),s=typeof n.stroke=="string"?n.stroke:ri(n.stroke),o=new gt().copy({...n,fill:r,stroke:s});return"id"in n&&(o.id=n.id),o}copy(n){super.copy.call(this,n);for(let r=0;r<gt.Properties.length;r++){const s=gt.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new gt(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let s=0;s<gt.Properties.length;s++){const o=gt.Properties[s];r[o]=this[o]}return this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);n.renderer.type="text";for(let r=0;r<gt.Properties.length;r++){const s=gt.Properties[r];n[s]=this[s]}return n}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(n){let r,s,o,a,l;this._update(!0),r=n?this.matrix:this.worldMatrix;const{width:c,height:d}=gt.Measure(this),h=(this._linewidth||0)/2;switch(this.alignment){case"left":s=-h,o=c+h;break;case"right":s=-(c+h),o=h;break;default:s=-(c/2+h),o=c/2+h}switch(this.baseline){case"middle":a=-(d/2+h),l=d/2+h;break;default:a=-(d+h),l=h}const[u,p]=r.multiply(s,a),[f,g]=r.multiply(s,l),[m,y]=r.multiply(o,a),[_,b]=r.multiply(o,l);return a=Bc(p,g,y,b),s=Bc(u,f,m,_),o=Tc(u,f,m,_),l=Tc(p,g,y,b),{top:a,left:s,right:o,bottom:l,width:o-s,height:l-a}}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}};C(gt,"Ratio",.6),C(gt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes"]);let Fi=gt;const Ec={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 et||this._fill instanceof kt||this._fill instanceof xt||this._fill instanceof rt)&&this._fill.unbind(K.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof et||this._fill instanceof kt||this._fill instanceof xt||this._fill instanceof rt)&&this._fill.bind(K.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof et||this._stroke instanceof kt||this._stroke instanceof xt||this._stroke instanceof rt)&&this._stroke.unbind(K.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof et||this._stroke instanceof kt||this._stroke instanceof xt||this._stroke instanceof rt)&&this._stroke.bind(K.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,Ve.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 n0(){this._flagFill=!0}function i0(){this._flagStroke=!0}const es=Math.min,ts=Math.max,En=class En extends yn{constructor(n){super();C(this,"_flagAdditions",!1);C(this,"_flagSubtractions",!1);C(this,"_flagOrder",!1);C(this,"_flagOpacity",!0);C(this,"_flagBeginning",!1);C(this,"_flagEnding",!1);C(this,"_flagLength",!1);C(this,"_flagMask",!1);C(this,"_fill","#fff");C(this,"_stroke","#000");C(this,"_linewidth",1);C(this,"_opacity",1);C(this,"_visible",!0);C(this,"_cap","round");C(this,"_join","round");C(this,"_miter",4);C(this,"_closed",!0);C(this,"_curved",!1);C(this,"_automatic",!0);C(this,"_beginning",0);C(this,"_ending",1);C(this,"_length",0);C(this,"_mask",null);for(let r in Rc)Object.defineProperty(this,r,Rc[r]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(n)?n:Array.prototype.slice.call(arguments)}static InsertChildren(n){for(let r=0;r<n.length;r++)$c.call(this,n[r],this)}static RemoveChildren(n){for(let r=0;r<n.length;r++)$c.call(this,n[r])}static OrderChildren(n){this._flagOrder=!0}static fromObject(n){const r=new En;for(let o=0;o<En.Properties.length;o++){const a=En.Properties[o];a in n&&(/(fill|stroke)/i.test(a)?r[a]=typeof n[a]=="string"?n[a]:ri(n[a]):r[a]=n[a])}return"mask"in n&&(r.mask=s(n.mask)),"id"in n&&(r.id=n.id),r.children=n.children.map(s),r;function s(o){if(o&&o.renderer)switch(o.renderer.type){case"arc-segment":return Ks.fromObject(o);case"circle":return Qs.fromObject(o);case"ellipse":return no.fromObject(o);case"points":return Qr.fromObject(o);case"polygon":return io.fromObject(o);case"rectangle":return ro.fromObject(o);case"rounded-rectangle":return so.fromObject(o);case"star":return oo.fromObject(o);case"path":return Re.fromObject(o);case"text":return Fi.fromObject(o);case"group":return En.fromObject(o);case"shape":return yn.fromObject(o);case"element":return sr.fromObject(o)}return o}}copy(n){return super.copy.call(this,n),console.warn("Two.Group.copy is not supported yet."),this}clone(n){const r=new En,s=this.children.map(function(o){return o.clone()});return r.add(s),r.opacity=this.opacity,this.mask&&(r.mask=this.mask),r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.className=this.className,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="group",n.children=[],n.opacity=this.opacity,n.className=this.className,n.mask=this.mask?this.mask.toObject():null,Ve.each(this.children,(r,s)=>{n.children[s]=r.toObject()},this),n}corner(){const n=this.getBoundingClientRect(!0);for(let r=0;r<this.children.length;r++){const s=this.children[r];s.translation.x-=n.left,s.translation.y-=n.top}return this.mask&&(this.mask.translation.x-=n.left,this.mask.translation.y-=n.top),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,s=n.top+n.height/2-this.translation.y;for(let o=0;o<this.children.length;o++){const a=this.children[o];a.isShape&&(a.translation.x-=r,a.translation.y-=s)}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=s),this}getById(n){let r=null;function s(o){if(o.id===n)return o;if(o.children){if(o.children.ids[n])return o.children.ids[n];for(let a=0;a<o.children.length;a++)if(r=s(o.children[a]),r)return r}return null}return s(this)}getByClassName(n){const r=[];function s(o){if(Array.prototype.indexOf.call(o.classList,n)>=0&&r.push(o),o.children)for(let a=0;a<o.children.length;a++){const l=o.children[a];s(l)}return r}return s(this)}getByType(n){const r=[];function s(o){if(o instanceof n&&r.push(o),o.children)for(let a=0;a<o.children.length;a++){const l=o.children[a];s(l)}return r}return s(this)}add(n){n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let r=0;r<n.length;r++){const s=n[r];if(!(s&&s.id))continue;const o=Array.prototype.indexOf.call(this.children,s);o>=0&&this.children.splice(o,1),this.children.push(s)}return this}remove(n){const r=arguments.length,s=this.parent;if(r<=0&&s)return s.remove(this),this;n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let o=0;o<n.length;o++){const a=n[o];if(!a||!this.children.ids[a.id])continue;const l=this.children.indexOf(a);l>=0&&this.children.splice(l,1)}return this}getBoundingClientRect(n){let r,s,o,a,l,c;this._update(!0);let d=1/0,h=-1/0,u=1/0,p=-1/0;const f=/texture|gradient/i;s=n?this.matrix:this.worldMatrix;for(let g=0;g<this.children.length;g++){const m=this.children[g];if(!(!m.visible||f.test(m._renderer.type))&&(r=m.getBoundingClientRect(n),o=typeof r.top!="number"||Ve.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||Ve.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||Ve.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||Ve.isNaN(r.bottom)||!isFinite(r.bottom),!(o||a||l||c)))if(n){const[y,_]=s.multiply(r.left,r.top),[b,S]=s.multiply(r.right,r.top),[x,v]=s.multiply(r.left,r.bottom),[B,k]=s.multiply(r.right,r.bottom);u=es(_,S,v,k,u),d=es(y,b,x,B,d),h=ts(y,b,x,B,h),p=ts(_,S,v,k,p)}else u=es(r.top,u),d=es(r.left,d),h=ts(r.right,h),p=ts(r.bottom,p)}return{top:u,left:d,right:h,bottom:p,width:h-d,height:p-u}}noFill(){return this.children.forEach(function(n){n.noFill()}),this}noStroke(){return this.children.forEach(function(n){n.noStroke()}),this}subdivide(){const n=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,n)}),this}_update(){let n,r,s;if(this._flagBeginning||this._flagEnding){const o=Math.min(this._beginning,this._ending),a=Math.max(this._beginning,this._ending),l=this.length;let c=0;const d=o*l,h=a*l;for(n=0;n<this.children.length;n++)s=this.children[n],r=s.length,d>c+r?(s.beginning=1,s.ending=1):h<c?(s.beginning=0,s.ending=0):d>c&&d<c+r?(s.beginning=(d-c)/r,s.ending=1):h>c&&h<c+r?(s.beginning=0,s.ending=(h-c)/r):(s.beginning=0,s.ending=1),c+=r}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}};C(En,"Children",_c),C(En,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let _n=En;const Rc={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=_n.InsertChildren.bind(this),n=_n.RemoveChildren.bind(this),r=_n.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new _c(e),this._children.bind(K.Types.insert,t),this._children.bind(K.Types.remove,n),this._children.bind(K.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,Ve.isObject(e)&&!e.clip&&(e.clip=!0)}}};function $c(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)}}class ns extends Re{constructor(t,n,r,s){const o=[new Ee(t,n),new Ee(r,s)];super(o);for(let a in Nc)Object.defineProperty(this,a,Nc[a]);this.vertices[0].command=pe.move,this.vertices[1].command=pe.line,this.automatic=!1}}C(ns,"Properties",["left","right"]);const Nc={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(e){if(Ve.isObject(e))this.vertices.splice(0,1,e);else{const t=new Gr("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(Ve.isObject(e))this.vertices.splice(1,1,e);else{const t=new Gr("Two.Line.y argument is not an object.");console.warn(t.name,t.message)}}}};class lo{constructor(t=0,n=0){this.x=t,this.y=n}}class si{constructor(t=10,n=0,r="A"){C(this,"start",new lo);C(this,"end",new lo);this.width=t,this.angle=n,this.label=r}}const ze={line:{color:"#000",size:5},previewLine:{color:"#000",size:2},anchorPoint:{color:"#FF8000",size:12,strokeSize:20},lineLabel:{color:"#FF8000",size:22,rotation:-.5},angleLabel:{size:22,color:"#088c00",rotation:-.5},colorSideLabel:{size:20,color:"#439227"}},r0={class:"flex gap-3"},s0={class:"kozyrek-preview w-fill h-[12.5rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},o0={ref:"drawing-container",class:"size-full"},a0={},Pc=i.defineComponent({...a0,__name:"kozyrek-configurator-preview",props:{settings:{},value:{},selectTemplateIndex:{}},emits:["pointer:move","pointer:up","template:select"],setup(e,{emit:t}){const n=e,r=t,s=i.useTemplateRef("drawing-container");let o=[],a=[],l=[],c=null;const d=.75,h=i.computed(()=>n.value.configuratorParams.linesAngles.map((F,R)=>new si(n.value.configuratorParams.linesWidths[R],F,`A-${R+1}`))),u=i.computed(()=>n.value.configuratorParams.colorSide==="bottom"),p=i.computed(()=>{var F,R;return n.value.configuratorParams.startTailType&&((F=n.settings.startTailConfigs)!=null&&F[n.value.configuratorParams.startTailType])?(R=n.settings.startTailConfigs)==null?void 0:R[n.value.configuratorParams.startTailType].points:[]}),f=i.computed(()=>{var F,R;return n.value.configuratorParams.endTailType&&((F=n.settings.endTailConfigs)!=null&&F[n.value.configuratorParams.endTailType])?(R=n.settings.endTailConfigs)==null?void 0:R[n.value.configuratorParams.endTailType].points:[]}),g=(F,R=!1)=>{F[0].start.x=0,F[0].start.y=0;let $=0;for(let M=0;M<F.length;M++){const U=F[M],z=F[M-1]??new si(0,$);$+=!R||M>1?z.angle:0;const O=(!R||M>0?U.angle:0)+$;if(F[M].end.x=U.width*Math.cos(O*Math.PI/180)+F[M].start.x,F[M].end.y=U.width*Math.sin(O*Math.PI/180)+F[M].start.y,M<F.length-1){const ee=M+1;F[ee].start.x=F[M].end.x,F[ee].start.y=F[M].end.y}}return F},m=(F,R,$,M,U=!1)=>{let z=g([...$,...M]);R.length>0&&(z=[...g(R),...z]);let O=0,ee=0,ce=0,se=0;z.forEach(Ae=>{O=Math.min(O,Ae.start.x,Ae.end.x),ee=Math.min(ee,Ae.start.y,Ae.end.y),ce=Math.max(ce,Ae.start.x,Ae.end.x),se=Math.max(se,Ae.start.y,Ae.end.y)});let ge,ie;O===0&&ee===0&&ce===0&&se===0?(ge=1,ie=1):(ge=F.width/Math.abs(ce-O),ie=(U?F.height:F.height-ze.colorSideLabel.size)/Math.abs(se-ee));const Me=Math.min(ge,ie);return O=O<0?-O*Me:0,ee=ee<0?-ee*Me:0,[Me,O,ee]},y=F=>{const R=new Qr([F]);return R._size=ze.anchorPoint.size,R.fill=ze.anchorPoint.color,R.stroke="transparent",R._linewidth=ze.anchorPoint.strokeSize,l.push(R),R},_=(F,R)=>{if(l=[],n.settings.allowChangeFirstPoint){const $=F[0],M=new we($.vertices[0].x,$.vertices[0].y);M.bind(K.Types.change,()=>{$.vertices[0].copy(M)});const U=y(M);R.add(U)}F.forEach(($,M)=>{const U=F[M+1],z=new we($.vertices[1].x,$.vertices[1].y);z.bind(K.Types.change,()=>{$.vertices[1].copy(z),U!==void 0&&U.vertices[0].copy(z)});const O=y(z);R.add(O)})},b=F=>F*(Math.PI/180),S=(F,R,$)=>{const M=R.vertices.length-1;F.position.x=R.vertices[M].x,F.position.y=R.vertices[M].y;const U=Math.atan2(R.vertices[M].y-R.vertices[0].y,R.vertices[M].x-R.vertices[0].x);F.rotation=b($)+U},x=(F,R,$)=>{if(R.vertices[0]===void 0)return;F.position.x=R.vertices[0].x,F.position.y=R.vertices[0].y;const M=R.vertices.length-1,U=Math.atan2(R.vertices[M].y-R.vertices[0].y,R.vertices[M].x-R.vertices[0].x);F.rotation=b($)+U},v=(F,R,$)=>{const M=new _n;if(F.length===0)return M;const U=[];return[...F].reverse().forEach((z,O)=>{O!==0&&z.angle>0&&(z.angle*=-1),U.push(z)}),F=g(U,!0),x(M,R,F[0].angle),[R.vertices[0],R.vertices[1]].forEach(z=>{z.bind(K.Types.change,()=>{x(M,R,F[0].angle)})}),F.forEach(z=>{const O=z.start.x*$,ee=z.end.x*$,ce=z.start.y*$,se=z.end.y*$,ge=new ns(O,ce,ee,se);ge.linewidth=ze.line.size,ge.stroke=ze.line.color,M.add(ge)}),M},B=(F,R,$)=>{const M=new _n;return F.length===0||(F=g(F,!0),S(M,R,F[0].angle),[R.vertices[0],R.vertices[1]].forEach(U=>{U.bind(K.Types.change,()=>{S(M,R,F[0].angle)})}),F.forEach(U=>{const z=U.start.x*$,O=U.end.x*$,ee=U.start.y*$,ce=U.end.y*$,se=new ns(z,ee,O,ce);se.linewidth=ze.line.size,se.stroke=ze.line.color,M.add(se)})),M},k=(F,R,$,M)=>{const U=R.vertices[0].x+(R.vertices[1].x-R.vertices[0].x)/2-8*Math.sin(F.angle*Math.PI/180),z=R.vertices[0].y+(R.vertices[1].y-R.vertices[0].y)/2-8*Math.cos(F.angle*Math.PI/180),O=new Fi(F.label,U+10,z-10);let ee;O.size=ze.lineLabel.size,O.weight=600,O.fill=ze.lineLabel.color,O.id+=1,O.rotation=ze.lineLabel.rotation,M>0&&(ee=new Fi(`${F.angle}°`,R.vertices[0].x+25,R.vertices[0].y-25),ee.size=ze.angleLabel.size,ee.weight=600,ee.fill=ze.angleLabel.color,ee.rotation=ze.angleLabel.rotation,ee.id+=M,o.push(ee),$.add(ee)),$.add(O),P(O,R,0,ee),P(O,R,1)},E=()=>{const{size:F}=ze.colorSideLabel,R=0,$=0,M=u.value?F/2:F/2-F,U=u.value?F/2-F:F/2,z=new _n;if(!c)return z;const O=5,ee=Math.atan2(U-M,$-R),ce=[new Ee(R,M,0,0,0,0,ue.Commands.move),new Ee($,U,0,0,0,0,ue.Commands.line),new Ee($-O*Math.cos(ee-Math.PI/4),U-O*Math.sin(ee-Math.PI/4),0,0,0,0,ue.Commands.line),new Ee($,U,0,0,0,0,ue.Commands.move),new Ee($-O*Math.cos(ee+Math.PI/4),U-O*Math.sin(ee+Math.PI/4),0,0,0,0,ue.Commands.line)],se=new Re(ce,!1,!1,!0);se.noFill(),se.cap="round",se.join="round",se.linewidth=F/7,se.stroke=ze.colorSideLabel.color,z.add(se);const ge=new Fi(u.value?"Цвет снизу":"Цвет сверху",10,0);ge.size=F,ge.weight=600,ge.fill=ze.colorSideLabel.color,ge.alignment="left",z.add(ge);const ie=z.getBoundingClientRect();return z.position.x=(c.width-ie.width)*d+10,z.position.y=u.value?c.height+ie.height*2:ie.height/2,z},P=(F,R,$,M)=>{R.vertices[$].bind(K.Types.change,()=>{const U=R.vertices.length-1,z=Math.atan2(R.vertices[0].y-R.vertices[U].y,R.vertices[0].x-R.vertices[U].x)*180/Math.PI,O=R.vertices[0].x+(R.vertices[U].x-R.vertices[0].x)/2-8*Math.sin(z*Math.PI/180),ee=R.vertices[0].y+(R.vertices[U].y-R.vertices[0].y)/2-8*Math.cos(z*Math.PI/180);F.position.x=O+10,F.position.y=ee-10,F.rotation=-.5,M&&(M.position.x=R.vertices[0].x+25,M.position.y=R.vertices[0].y-25)})},N=(F,R,$,M,U=!1)=>{var Ze;if(F.clear(),$.length===0){F.update();return}const z=g($),[O,ee,ce]=m(F,R,z,M,U),se=new _n,ge=new Array,ie=new Array;U||(o=[],a=[]),z.forEach((De,yt)=>{const Jt=De.start.x*O+ee,Qt=De.end.x*O+ee,_t=De.start.y*O+ce,Ot=De.end.y*O+ce,Fe=new ns(Jt,_t,Qt,Ot);Fe.linewidth=U?ze.previewLine.size:ze.line.size,Fe.stroke=U?ze.previewLine.color:ze.line.color,a.push(Fe),ge.push(Fe),se.add(Fe),!U&&De.label!==""&&k(De,Fe,se,yt)});const Me=ge.at(-1);let Ae=se.getBoundingClientRect();if(!U){const De=E();ie.push(De)}if(R.length>0){const De=v(R,ge[0],O);se.add(De)}if(M.length>0&&Me){const De=B(M,Me,O);se.add(De)}if(ie.push(se),F.makeGroup(ie),Ae=se.getBoundingClientRect(),se.position.x=0-Ae.left+(F.width-Ae.width)/(2*(U?1:d)),se.position.y=0-Ae.top+(F.height-Ae.height)/(2*(U?1:d)),F.update(),!U){const De=((Ze=n.value.configuratorParams)==null?void 0:Ze.colorSide)==="top";se.position.y=se.position.y+ze.colorSideLabel.size*Number(De),_(ge,se),F.update()}},j=(F,R)=>{if(F&&!R.isNewRec()){const $=new ue({width:F.scrollWidth,height:F.scrollHeight});$.appendTo(F),N($,[],R.points,[],!0)}},X=()=>{c&&N(c,p.value,h.value,f.value,!1)},A=F=>F*(180/Math.PI),V=(F,R)=>{const $=F[1].x-F[0].x,M=F[1].y-F[0].y,U=R[1].x-R[0].x,z=R[1].y-R[0].y;let O=Math.atan2($*z-M*U,$*U+M*z);return O=A(O),Math.round(O)*-1},L=F=>{const R=a.map(($,M,U)=>{const z=U[M-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let O=Math.ceil($._length/F/n.settings.lineWidthStep)*n.settings.lineWidthStep;const ee=o[M-1];O<(U.length>1?n.settings.minLineWidth:n.settings.stripMinWidth)&&(O=U.length>1?n.settings.minLineWidth:n.settings.stripMinWidth),O>n.settings.maxLineWidth&&(O=n.settings.maxLineWidth);const ce=V($.vertices,z.vertices);return ee&&(ee.value=`${ce}°`),new si(O,ce,`A-${M+1}`)});r("pointer:move",R)},Z=F=>{let R=null,$;const M=ee=>{R=l.find(ce=>{const se=ce.renderer;return(se==null?void 0:se.elem)===ee.target}),[$]=m(F,p.value,h.value.map(ce=>ce),f.value)},U=ee=>{if(R){const ce=R.renderer,se=ce==null?void 0:ce.elem;if(!se)return;const ge=se.getBoundingClientRect();R.vertices[0].x-=ge.x-(ee instanceof MouseEvent?ee.clientX:ee.targetTouches[0].clientX)+ze.anchorPoint.size/2,R.vertices[0].y-=ge.y-(ee instanceof MouseEvent?ee.clientY:ee.targetTouches[0].clientY)+ze.anchorPoint.size/2,L($),F.update()}},z=()=>{R&&r("pointer:up",h.value),R=null},O=s.value;O&&(O.addEventListener("touchstart",M),O.addEventListener("touchend",z),O.addEventListener("mousedown",M),O.addEventListener("mouseup",z),O.addEventListener("mousemove",U),O.addEventListener("touchmove",U))};return i.onMounted(()=>{s.value&&(c=new ue({width:s.value.scrollWidth,height:s.value.scrollHeight,fullscreen:!1}).appendTo(s.value),c.scene.scale=d,c.update(),i.watch(()=>n.value,()=>{X()},{deep:!0,immediate:!0}),Z(c))}),i.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(F,R)=>(i.openBlock(),i.createElementBlock("div",r0,[i.createVNode(Pa,{"select-template-index":F.selectTemplateIndex,settings:F.settings,"onTemplate:select":R[0]||(R[0]=$=>r("template:select",$)),onInitDrawTemplate:j},null,8,["select-template-index","settings"]),i.createElementVNode("div",s0,[i.createElementVNode("div",o0,null,512)])]))}}),l0={class:"flex max-w-[50rem] flex-col gap-3"},c0={},d0=i.defineComponent({...c0,__name:"kozyrek-configurator",props:{settings:{},cartItem:{},client:{}},emits:["submit-success"],setup(e,{emit:t}){const n=e,r=t,s=i.ref(!1),o=i.ref(!1),a=i.ref(!1),l=i.ref(n.cartItem),c=i.ref(n.settings),d=i.ref({linesWidths:[...n.cartItem.configuratorParams.linesWidths],linesAngles:[...n.cartItem.configuratorParams.linesAngles]}),h=i.ref({quantity:{},marker:{},length:{}}),u=i.ref(0),p=(v=0)=>{const B=c.value.allTemplates.at(v);B!==void 0&&(u.value=v,l.value.configuratorParams.linesWidths=B.points.map(k=>D.isArray(k)?k[0]:k.width),l.value.configuratorParams.linesAngles=B.points.map(k=>D.isArray(k)?k[1]:k.angle),_()),m(l.value.configuratorParams)},f=async()=>{const v=prompt("Введите название шаблона:");if(!v)return;a.value=!0;const B={label:v,points:l.value.configuratorParams.linesWidths.map((k,E)=>[k,l.value.configuratorParams.linesAngles[E]])};await Y.HttpRequester.getInstance(Y.ConfiguratorProvider).createTemplate(n.cartItem.category,B,h.value).then(()=>{c.value.addCustomTemplate(B),u.value=c.value.allTemplates.length-1}).catch(()=>{a.value=!1}),a.value=!1},g=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(u.value=c.value.allTemplates.length-1)},m=async v=>{_(),s.value=!0,await Y.HttpRequester.getInstance(Y.ConfiguratorProvider).searchProduct(n.cartItem.category,v,h.value).then(B=>{l.value.product=B}).catch(()=>{s.value=!1}),s.value=!1},y=async()=>{o.value=!0,await(l.value.isNewRec()?Y.HttpRequester.getInstance(Y.CartProvider).addCartItem(n.client,l.value).then(v=>{r("submit-success",v)}).catch(()=>{o.value=!1}):Y.HttpRequester.getInstance(Y.CartProvider).patchCartItem(n.client,l.value).then(v=>{r("submit-success",v)}).catch(()=>{o.value=!1})),o.value=!1},_=()=>{const v={quantity:h.value.quantity,marker:h.value.marker};l.value.configuratorParams.linesWidths.forEach((B,k)=>{v[`lines_widths[${k+1}]`]={},v[`lines_angles[${k+1}]`]={}}),h.value=v},b=v=>{d.value.linesWidths=v.map(B=>B.width),d.value.linesAngles=v.map(B=>B.angle)},S=v=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,_(),g(),m(l.value.configuratorParams)},x=(v,B)=>{d.value.linesWidths=v,d.value.linesAngles=B};return i.onBeforeMount(()=>{p()}),(v,B)=>(i.openBlock(),i.createElementBlock("div",l0,[i.createVNode(Pc,{value:l.value,"select-template-index":u.value,settings:c.value,"onPointer:up":S,"onPointer:move":b,"onTemplate:select":p},null,8,["value","select-template-index","settings"]),i.createVNode(Aa,{value:l.value,"onUpdate:value":B[0]||(B[0]=k=>l.value=k),"preview-params":d.value,validation:h.value,settings:c.value,"is-submit-processing":o.value,"is-product-searching":s.value,"select-template-index":u.value,"onUpdate:params":B[1]||(B[1]=k=>m(k)),"onUpdate:preview":x,onSubmit:y,"onClick:saveTemplate":f},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])]))}});class Mi extends Y.Identity{constructor(n,r){super();C(this,"label","");C(this,"points",[]);C(this,"isCustom",!1);C(this,"id",-1);C(this,"guid","");n?(this.label=n.label,this.points=n.points.map((s,o)=>D.isArray(s)?new si(s[0],s[1],`A-${o+1}`):new si(s.width,s.angle,`A-${o+1}`))):(this.label="-- Новая конфигурация --",this.points=[new si(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class co extends Mi{constructor(n){super(n);C(this,"isDefault");this.isDefault=n.isDefault??!1}}class h0{constructor(t){C(this,"minLineWidth");C(this,"maxLineWidth");C(this,"lineWidthStep");C(this,"minLineAngle");C(this,"maxLineAngle");C(this,"lineAngleStep");C(this,"stripMinWidth");C(this,"stripMaxWidth");C(this,"stripMinLength");C(this,"stripMaxLength");C(this,"allowShowTable");C(this,"showOnlyTemplates");C(this,"templates");C(this,"customTemplates",[]);C(this,"startTailConfigs");C(this,"endTailConfigs");C(this,"bendCountForExtended");C(this,"extendedProductCatalog");C(this,"allowChangeFirstPoint");C(this,"allowSaveTemplates");C(this,"userTemplatesPrefix");C(this,"lengthStep");this.minLineWidth=t.minLineWidth,this.maxLineWidth=t.maxLineWidth,this.lineWidthStep=t.lineWidthStep,this.minLineAngle=t.minLineAngle,this.maxLineAngle=t.maxLineAngle,this.lineAngleStep=t.lineAngleStep,this.stripMinWidth=t.stripMinWidth,this.stripMaxWidth=t.stripMaxWidth,this.stripMinLength=t.stripMinLength,this.stripMaxLength=t.stripMaxLength,this.allowShowTable=t.allowShowTable,this.showOnlyTemplates=t.showOnlyTemplates,this.templates=t.templates.map(n=>new Mi(n)),this.templates.forEach((n,r)=>{n.id=r}),this.startTailConfigs=t.startTailConfigs.map(n=>new co(n)),this.endTailConfigs=t.endTailConfigs.map(n=>new co(n)),this.bendCountForExtended=t.bendCountForExtended,this.extendedProductCatalog=t.extendedProductCatalog,this.allowChangeFirstPoint=t.allowChangeFirstPoint,this.allowSaveTemplates=t.allowSaveTemplates,this.userTemplatesPrefix=t.userTemplatesPrefix,this.lengthStep=t.lengthStep,this.showOnlyTemplates||(this.customTemplates=t.customTemplates?Object.entries(t.customTemplates).map(([n,r])=>{const s=new Mi(r);return s.isCustom=!0,s.id=+n,s}):[],this.customTemplates.push(new Mi))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(t){var r,s;if(!this.allowSaveTemplates)return;const n=new Mi(t);n.isCustom=!0,n.id=(((r=this.customTemplates.at(-1))==null?void 0:r.id)??((s=this.templates.at(-1))==null?void 0:s.id)??0)+1,this.customTemplates.splice(-1,0,n)}removeCustomTemplate(t){if(this.allowSaveTemplates)return;const n=this.customTemplates.findIndex(r=>r.id===t);n&&n!==-1&&this.customTemplates.splice(n,1)}}const u0={},Ai=i.defineComponent({...u0,__name:"debounced-input-number",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:500},placeholder:{default:""},min:{default:void 0},max:{default:void 0},step:{default:1},validator:{type:Function,default:void 0}},emits:["update:value"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=i.ref(r.value),a=i.computed(()=>i.inject("debounce-input-time",r.debounceTime)),l=D.debounce(()=>s("update:value",o.value),a.value),c=f=>{o.value=f,l()};i.watch(()=>r.value,f=>{o.value=f});const d=i.ref(null);return t({focus:()=>{var f;return(f=d.value)==null?void 0:f.focus()},blur:()=>{var f;return(f=d.value)==null?void 0:f.blur()},select:()=>{var f;return(f=d.value)==null?void 0:f.select()}}),(f,g)=>(i.openBlock(),i.createBlock(i.unref(I.NInputNumber),{ref_key:"inputReference",ref:d,value:o.value,"onUpdate:value":[g[0]||(g[0]=m=>o.value=m),c],clearable:f.clearable,placeholder:f.placeholder,min:f.min,max:f.max,step:f.step,validator:f.validator},{prefix:i.withCtx(()=>[i.renderSlot(f.$slots,"prefix")]),_:3},8,["value","clearable","placeholder","min","max","step","validator"]))}}),f0={class:"flex flex-col gap-3"},p0={},Fc=i.defineComponent({...p0,__name:"metal-for-doors-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","click:view-switch","submit"],setup(e,{emit:t}){const n=e,r=t,s=i.useTemplateRef("first-input-element"),o=i.ref(D.cloneDeep(i.toRaw(n.value.configuratorParams))),a=()=>{o.value.length>0&&o.value.width>0&&(r("update:params",o.value),l("configuratorParams",o.value))},l=(c,d)=>{const h=new Y.CartItemBase(n.value);h[c]=d,r("update:value",h)};return i.onMounted(()=>{n.value.isNewRec()&&i.nextTick(()=>{var c;(c=s.value)==null||c.focus()})}),(c,d)=>{const h=I.NInput;return i.openBlock(),i.createBlock(i.unref(I.NForm),{disabled:c.isSubmitProcessing,class:"flex flex-col gap-2"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NFormItem),{required:!0,feedback:c.validation.width.feedback||"","show-feedback":c.validation.width.showFeedback||!1,"validation-status":c.validation.width.validationStatus||void 0,label:`Ширина, ${c.settings.minWidth?" от "+c.settings.minWidth:""}${c.settings.maxWidth?" до "+c.settings.maxWidth:""} мм`},{default:i.withCtx(()=>[i.createVNode(Ai,{ref:"first-input-element",value:o.value.width,"onUpdate:value":[d[0]||(d[0]=u=>o.value.width=u),a],class:"w-full",max:c.settings.maxWidth??void 0,min:c.settings.minWidth,validator:u=>!!u&&u>=c.settings.minWidth&&(!c.settings.maxWidth||u<=c.settings.maxWidth),placeholder:"Введите ширину"},null,8,["value","max","min","validator"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(I.NFormItem),{required:!0,feedback:c.validation.length.feedback||"","show-feedback":c.validation.length.showFeedback||!1,"validation-status":c.validation.length.validationStatus||void 0,label:`Длина, ${c.settings.minLength?" от "+c.settings.minLength:""}${c.settings.maxLength?" до "+c.settings.maxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(Ai,{value:o.value.length,"onUpdate:value":[d[1]||(d[1]=u=>o.value.length=u),a],placeholder:"Введите длину",max:c.settings.maxLength,min:c.settings.minLength,validator:u=>u>=c.settings.minLength&&u<=c.settings.maxLength,class:"w-full"},null,8,["value","max","min","validator"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(I.NFormItem),{required:!0,feedback:c.validation.quantity.feedback||"","show-feedback":c.validation.quantity.showFeedback||!1,"validation-status":c.validation.quantity.validationStatus||void 0,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NInputNumber),{value:c.value.quantity,placeholder:"Введите количество",min:1,validator:u=>u>0,class:"w-full","onUpdate:value":d[2]||(d[2]=u=>l("quantity",u??0))},null,8,["value","validator"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(I.NFormItem),{feedback:c.validation.marker.feedback||"","show-feedback":c.validation.marker.showFeedback||!1,"validation-status":c.validation.marker.validationStatus||void 0,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(h,{value:c.value.marker,placeholder:"Введите маркировку","onUpdate:value":d[3]||(d[3]=u=>l("marker",u))},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(Ui,{"is-product-searching":c.isProductSearching,product:c.value.product},null,8,["is-product-searching","product"]),i.createElementVNode("div",f0,[i.createVNode(i.unref(I.NButton),{disabled:c.value.product.isNewRec()||c.isProductSearching||c.isSubmitProcessing||c.value.length===0||c.value.width===0||c.value.quantity===0,type:"primary",class:"self-start",onClick:d[4]||(d[4]=u=>r("submit",c.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(c.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"]),c.settings.allowShowTable?(i.openBlock(),i.createBlock(i.unref(I.NButton),{key:0,type:"tertiary",class:"self-start",onClick:d[5]||(d[5]=u=>r("click:view-switch"))},{default:i.withCtx(()=>[...d[6]||(d[6]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1},8,["disabled"])}}}),g0={class:"w-104 px-5"},m0={},y0=i.defineComponent({...m0,__name:"metal-for-doors-configurator",props:{settings:{},cartItem:{},client:{}},emits:["submit-success"],setup(e,{emit:t}){const n=e,r=t,s=i.ref(n.cartItem),o=i.ref({width:{},length:{},quantity:{},marker:{}}),a=i.ref(!1),l=i.ref(!1),c=async h=>{a.value=!0,await Y.HttpRequester.getInstance(Y.ConfiguratorProvider).searchProduct(n.cartItem.category,h,o.value).then(u=>{s.value.product=u}).catch(()=>{a.value=!1}),a.value=!1},d=async()=>{l.value=!0,await(s.value.isNewRec()?Y.HttpRequester.getInstance(Y.CartProvider).addCartItem(n.client,s.value).then(h=>{r("submit-success",h)}).catch(()=>{l.value=!1}):Y.HttpRequester.getInstance(Y.CartProvider).patchCartItem(n.client,s.value).then(h=>{r("submit-success",h)}).catch(()=>{l.value=!1})),l.value=!1};return(h,u)=>(i.openBlock(),i.createElementBlock("div",g0,[i.createVNode(Fc,{value:s.value,"onUpdate:value":u[0]||(u[0]=p=>s.value=p),validation:o.value,settings:h.settings,"is-submit-processing":l.value,"onUpdate:params":u[1]||(u[1]=p=>c(p)),onSubmit:u[2]||(u[2]=p=>d())},null,8,["value","validation","settings","is-submit-processing"])]))}}),_0={key:0,class:"flex items-baseline gap-1"},b0={key:0,class:"flex items-baseline gap-1"},w0={class:"flex gap-3"},v0={},Mc=i.defineComponent({...v0,__name:"mosquito-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:instructions-toggle","click:show-preview-drawer"],setup(e,{emit:t}){const n=e,r=t,s=i.computed(()=>bt.isPhoneDevice()),o=i.ref(D.cloneDeep(i.toRaw(n.value.configuratorParams))),a=i.computed(()=>n.settings.widthOverlaps[o.value.mountType]??0),l=i.computed(()=>n.settings.heightOverlaps[o.value.mountType]??0),c=i.computed(()=>n.settings.maxWidths[o.value.netType]),d=i.computed(()=>n.settings.maxHeights[o.value.netType]-l.value),h=(p,f)=>{p&&p in o.value&&(o.value[p]=f??0),r("update:params",o.value),u("configuratorParams",o.value)},u=(p,f)=>{const g=new Y.CartItemBase(n.value);g[p]=f,r("update:value",g)};return(p,f)=>{const g=I.NInput;return i.openBlock(),i.createBlock(i.unref(I.NForm),{class:"flex flex-col gap-2 px-4 md:max-w-96"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NSelect),{value:o.value.netType,"onUpdate:value":[f[0]||(f[0]=m=>o.value.netType=m),h],options:p.settings.netType.map(m=>({label:p.settings.descriptions.net_type[m],value:m}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NSelect),{value:o.value.color,"onUpdate:value":f[1]||(f[1]=m=>o.value.color=m),options:p.settings.color.map(m=>({label:p.settings.descriptions.color[m],value:m}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NSelect),{value:o.value.mountType,"onUpdate:value":[f[2]||(f[2]=m=>o.value.mountType=m),h],options:p.settings.mountType.map(m=>({label:p.settings.descriptions.mount_type[m],value:m}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(I.NFormItem),{required:!0,feedback:p.validation.width.feedback||"","show-feedback":p.validation.width.showFeedback||o.value.width>=p.settings.minWidth&&o.value.width<=p.settings.maxWidths[o.value.netType],"validation-status":p.validation.width.validationStatus||void 0,label:`Ширина светового проёма от ${p.settings.minWidth-a.value} ${c.value?" до "+c.value:""} мм.`},{feedback:i.withCtx(()=>[!p.validation.width.showFeedback&&o.value.width>=p.settings.minWidth&&o.value.width<=p.settings.maxWidths[o.value.netType]?(i.openBlock(),i.createElementBlock("div",_0,[i.createVNode(i.unref(I.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Ширина готового изделия "+i.toDisplayString(o.value.width+a.value),1)]),_:1}),i.createVNode(i.unref(I.NButton),{quaternary:"",type:"info",size:"tiny",onClick:f[4]||(f[4]=m=>r("click:instructions-toggle"))},{default:i.withCtx(()=>[...f[11]||(f[11]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(Ai,{value:o.value.width&&o.value.width-a.value,max:c.value,min:p.settings.minWidth-a.value,placeholder:"Введите ширину светового проёма",class:"w-full","onUpdate:value":f[3]||(f[3]=m=>h("width",(m&&m+a.value)??void 0))},null,8,["value","max","min"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(I.NFormItem),{required:!0,feedback:p.validation.height.feedback||"","show-feedback":p.validation.height.showFeedback||o.value.height>=p.settings.minHeight&&o.value.height<=p.settings.maxHeights[o.value.netType],"validation-status":p.validation.height.validationStatus||void 0,label:`Высота светового проёма от ${p.settings.minHeight-l.value} ${d.value?" до "+d.value:""} мм.`},{feedback:i.withCtx(()=>[!p.validation.height.showFeedback&&o.value.height>=p.settings.minHeight&&o.value.height<=p.settings.maxHeights[o.value.netType]?(i.openBlock(),i.createElementBlock("div",b0,[i.createVNode(i.unref(I.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Высота готового изделия "+i.toDisplayString(o.value.height+l.value),1)]),_:1}),i.createVNode(i.unref(I.NButton),{quaternary:"",type:"info",size:"tiny",onClick:f[6]||(f[6]=m=>r("click:instructions-toggle"))},{default:i.withCtx(()=>[...f[12]||(f[12]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(Ai,{value:o.value.height&&o.value.height-l.value,max:d.value,min:p.settings.minHeight-l.value,placeholder:"Введите высоту светового проёма",class:"w-full","onUpdate:value":f[5]||(f[5]=m=>h("height",(m&&m+l.value)??void 0))},null,8,["value","max","min"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(I.NFormItem),{required:!0,feedback:p.validation.quantity.feedback||"","show-feedback":p.validation.quantity.showFeedback||!1,"validation-status":p.validation.quantity.validationStatus||void 0,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NInputNumber),{value:p.value.quantity,"onUpdate:value":f[7]||(f[7]=m=>p.value.quantity=m),min:1,validator:m=>Number.isInteger(m),placeholder:"Введите количество",class:"w-full"},null,8,["value","validator"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(I.NFormItem),{feedback:p.validation.marker.feedback||"","show-feedback":p.validation.marker.showFeedback||!1,"validation-status":p.validation.marker.validationStatus||void 0,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(g,{value:p.value.marker,"onUpdate:value":f[8]||(f[8]=m=>p.value.marker=m),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(Ui,{"is-product-searching":p.isProductSearching,product:p.value.product},null,8,["is-product-searching","product"]),i.createElementVNode("div",w0,[i.createVNode(i.unref(I.NButton),{loading:p.isSubmitProcessing,disabled:p.isProductSearching||!p.value.product||p.value.product.isNewRec()||o.value.width<p.settings.minHeight-l.value||o.value.height<p.settings.minHeight-l.value,type:"primary",class:"self-start",onClick:f[9]||(f[9]=m=>r("submit",p.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(p.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"]),s.value?(i.openBlock(),i.createBlock(i.unref(I.NButton),{key:0,type:"default",onClick:f[10]||(f[10]=m=>r("click:show-preview-drawer"))},{default:i.withCtx(()=>[...f[13]||(f[13]=[i.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1})}}}),k0="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",x0="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",C0="/img/configurators/mosquitto/measurement-instructions/mount.png",S0="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",B0="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",T0={class:"flex flex-col gap-6"},E0={class:"flex gap-4"},R0={class:"flex flex-col gap-2"},$0={class:"flex gap-4"},N0={class:"flex flex-col gap-2"},P0={class:"flex gap-4"},F0={class:"flex flex-col gap-2"},M0={},Ac=i.defineComponent({...M0,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(e,{emit:t}){const n=bt.initRefDependingOnDeviceResolution("small","small","medium"),r=bt.initRefDependingOnDeviceResolution(.98,.95,.8),s=i.computed(()=>window.innerWidth*r.value),o=t;return(a,l)=>{const c=I.NText;return i.openBlock(),i.createBlock(i.unref(I.NModal),{show:a.show,"show-icon":!1,size:i.unref(n),style:i.normalizeStyle(`width: ${s.value}px`),title:"Руководство по замеру","action-class":"grid grid-cols-2 !justify-between",preset:"dialog",onClose:l[0]||(l[0]=d=>o("update:show",!1)),onEsc:l[1]||(l[1]=d=>o("update:show",!1)),onMaskClick:l[2]||(l[2]=d=>o("update:show",!1))},{default:i.withCtx(()=>[i.createElementVNode("div",T0,[i.createVNode(c,{type:"error",class:"text-base font-medium"},{default:i.withCtx(()=>[...l[3]||(l[3]=[i.createTextVNode(" Важно! Для того,что бы произвести замер, необходимо открыть оконную створку. ",-1)])]),_:1}),l[22]||(l[22]=i.createElementVNode("div",{class:"grid gap-6 md:grid-cols-2"},[i.createElementVNode("div",{class:"flex items-start gap-4"},[i.createElementVNode("img",{src:k0,alt:"measurement-height",class:"w-[7.5rem]"}),i.createElementVNode("div",{class:"flex flex-col gap-2"},[i.createElementVNode("span",{class:"text-lg font-bold"},"Замер ширины"),i.createElementVNode("span",null,"Замерить по ширине световой проем оконной рамы. Размер учитывать c точностью до 1 мм")])]),i.createElementVNode("div",{class:"flex items-start gap-4"},[i.createElementVNode("img",{src:x0,alt:"measurement-height",class:"w-[7.5rem]"}),i.createElementVNode("div",{class:"flex flex-col gap-2"},[i.createElementVNode("span",{class:"text-lg font-bold"},"Замер высоты"),i.createElementVNode("span",null,"Замерить по высоте световой проем оконной рамы. Размер учитывать с точностью до 1 мм")])])],-1)),i.createElementVNode("div",E0,[l[9]||(l[9]=i.createElementVNode("img",{src:C0,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",R0,[l[8]||(l[8]=i.createElementVNode("span",{class:"text-lg font-bold"},"Крепление на раме сетки",-1)),i.createElementVNode("span",null,[l[4]||(l[4]=i.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[5]||(l[5]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(a.widthOverlaps.frame)+" мм. Высота светового проема +"+i.toDisplayString(a.heightOverlaps.frame)+" мм. ",1),l[6]||(l[6]=i.createElementVNode("br",null,null,-1)),l[7]||(l[7]=i.createTextVNode(" Крепления находятся на раме сетки. ",-1))])])]),i.createElementVNode("div",$0,[l[15]||(l[15]=i.createElementVNode("img",{src:S0,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",N0,[l[14]||(l[14]=i.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление пластик (верх+низ)",-1)),i.createElementVNode("span",null,[l[10]||(l[10]=i.createTextVNode(" Расчетные размеры москитной сетки:",-1)),l[11]||(l[11]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(a.widthOverlaps.external_plastic)+" мм. Высота светового проема +"+i.toDisplayString(a.heightOverlaps.external_plastic)+" мм. ",1),l[12]||(l[12]=i.createElementVNode("br",null,null,-1)),l[13]||(l[13]=i.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])]),i.createElementVNode("div",P0,[l[21]||(l[21]=i.createElementVNode("img",{src:B0,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",F0,[l[20]||(l[20]=i.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление металл (верх+низ)",-1)),i.createElementVNode("span",null,[l[16]||(l[16]=i.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[17]||(l[17]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(a.widthOverlaps.external_metal)+" мм. Высота светового проема +"+i.toDisplayString(a.heightOverlaps.external_metal)+" мм. ",1),l[18]||(l[18]=i.createElementVNode("br",null,null,-1)),l[19]||(l[19]=i.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])])])]),_:1},8,["show","size","style"])}}}),A0={class:"flex flex-col items-center justify-between rounded-xl"},V0={class:"img-preview relative flex justify-center"},I0={},O0=i.defineComponent({...I0,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(e,{emit:t}){const n=e,r=i.computed(()=>D.keys(n.settings.crossbarCount).find(o=>n.settings.crossbarCount[Number(o)]&&(!n.settings.crossbarCount[Number(o)+1]||n.configuratorParams.height<n.settings.crossbarCount[Number(o)+1]-n.settings.heightOverlaps[n.configuratorParams.mountType]))),s=t;return(o,a)=>{const l=I.NButton;return i.openBlock(),i.createElementBlock("div",A0,[i.createElementVNode("div",V0,[a[1]||(a[1]=i.createElementVNode("div",{class:"window"},null,-1)),i.createElementVNode("div",{class:i.normalizeClass(["net",`net-${o.configuratorParams.netType}`])},null,2),i.createElementVNode("div",{class:i.normalizeClass(["frame",`frame-${o.configuratorParams.color}`])},null,2),r.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["frame-crossbar",`frame-crossbar-${r.value}-${o.configuratorParams.color}`])},null,2)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["mount",`mount-${o.configuratorParams.mountType}-${o.configuratorParams.color}`])},null,2),i.createElementVNode("div",{class:i.normalizeClass(["cut-preview",`cut-preview-${o.configuratorParams.mountType}-${o.configuratorParams.color}`])},null,2)]),i.createVNode(l,{type:"primary",class:"block justify-self-center",onClick:a[0]||(a[0]=c=>s("open-instructions"))},{default:i.withCtx(()=>[...a[2]||(a[2]=[i.createTextVNode(" Руководство по замеру ",-1)])]),_:1})])}}}),ho=jn(O0,[["__scopeId","data-v-8b43aa68"]]),z0={class:"grid md:grid-cols-2"},L0={},D0=i.defineComponent({...L0,__name:"mosquito-configurator",props:{settings:{},cartItem:{},client:{}},emits:["submit-success"],setup(e,{emit:t}){const n=e,r=t,s=i.computed(()=>bt.isPhoneDevice()),o=i.ref(!1),a=i.ref(!1),l=i.ref(n.cartItem),c=i.ref({width:{},height:{},quantity:{},marker:{}}),d=i.ref(!1),h=i.ref(!1),u=async f=>{f.height>0&&f.width>0&&(d.value=!0,await Y.HttpRequester.getInstance(Y.ConfiguratorProvider).searchProduct(n.cartItem.category,f,c.value).then(g=>{l.value.product=g}).catch(()=>{d.value=!1}),d.value=!1)},p=async()=>{h.value=!0,await(l.value.isNewRec()?Y.HttpRequester.getInstance(Y.CartProvider).addCartItem(n.client,l.value).then(f=>{r("submit-success",f)}).catch(()=>{h.value=!1}):Y.HttpRequester.getInstance(Y.CartProvider).patchCartItem(n.client,l.value).then(f=>{r("submit-success",f)}).catch(()=>{h.value=!1})),h.value=!1};return(f,g)=>{const m=Er;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(Ac,{show:a.value,"onUpdate:show":g[0]||(g[0]=y=>a.value=y),"height-overlaps":f.settings.heightOverlaps,"width-overlaps":f.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),i.createElementVNode("div",z0,[s.value?(i.openBlock(),i.createBlock(i.unref(I.NDrawer),{key:1,show:o.value,"onUpdate:show":g[4]||(g[4]=y=>o.value=y),"default-width":375,resizable:""},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NDrawerContent),null,{header:i.withCtx(()=>[i.createVNode(i.unref(I.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:g[2]||(g[2]=y=>o.value=!1)},{default:i.withCtx(()=>[i.createVNode(m)]),_:1})]),default:i.withCtx(()=>[i.createVNode(ho,{"configurator-params":l.value.configuratorParams,settings:f.settings,onOpenInstructions:g[3]||(g[3]=y=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(i.openBlock(),i.createBlock(ho,{key:0,"configurator-params":l.value.configuratorParams,settings:f.settings,onOpenInstructions:g[1]||(g[1]=y=>a.value=!0)},null,8,["configurator-params","settings"])),i.createVNode(Mc,{value:l.value,"onUpdate:value":g[5]||(g[5]=y=>l.value=y),validation:c.value,settings:f.settings,"is-product-searching":d.value,"is-submit-processing":h.value,"onUpdate:params":g[6]||(g[6]=y=>u(y)),onSubmit:g[7]||(g[7]=y=>p()),"onClick:instructionsToggle":g[8]||(g[8]=y=>a.value=!a.value),"onClick:showPreviewDrawer":g[9]||(g[9]=y=>o.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),H0={},Vc=i.defineComponent({...H0,__name:"strip-configurator-line-item",props:{value:{},index:{},settings:{},product:{default:void 0},addLineButtonDisabled:{type:Boolean,default:!1},removeLineButtonDisabled:{type:Boolean,default:!1},suggestionOption:{default:void 0},autoFocus:{type:Boolean,default:!1},validation:{default:()=>({})}},emits:["update:value","click:add-line","click:remove-line"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=i.useTemplateRef("width-input-element"),a=i.ref(!1),l=d=>{s("update:value",d??0,r.index,a)};i.onMounted(()=>{r.autoFocus&&i.nextTick(()=>{c()})});const c=()=>{var d;(d=o.value)==null||d.select()};return t({focusWidthInput:c}),(d,h)=>{const u=Ma,p=Fa;return i.openBlock(),i.createBlock(i.unref(I.NFormItem),{label:`Полоса №${d.index+1}, мм`,required:!0},{feedback:i.withCtx(()=>[i.createVNode(Ui,{"is-product-searching":a.value,product:d.product},null,8,["is-product-searching","product"])]),default:i.withCtx(()=>[i.createVNode(i.unref(I.NDropdown),{trigger:"click",options:d.suggestionOption,placement:"bottom-start",size:"large",onSelect:l},{default:i.withCtx(()=>[i.createVNode(Ai,{ref:"width-input-element",value:d.value,class:"w-full",step:d.value<d.settings.minLineWidth?d.settings.minLineWidth-d.value:d.settings.lineWidthStep,validator:f=>!!f&&f>=d.settings.minLineWidth&&f%d.settings.lineWidthStep===0,placeholder:"Введите ширину","onUpdate:value":l},null,8,["value","step","validator"])]),_:1},8,["options"]),i.createVNode(i.unref(I.NButton),{disabled:d.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:h[0]||(h[0]=f=>s("click:add-line",d.index))},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["disabled"]),i.createVNode(i.unref(I.NButton),{disabled:d.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:h[1]||(h[1]=f=>s("click:remove-line",d.index))},{default:i.withCtx(()=>[i.createVNode(p)]),_:1},8,["disabled"])]),_:1},8,["label"])}}}),W0={class:"my-2 flex w-full flex-col"},j0={class:"flex gap-3"},q0={},Ic=i.defineComponent({...q0,__name:"strip-configurator-form",props:{value:{},settings:{},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","click:view-switch","submit","click:add-line","click:remove-line"],setup(e,{emit:t}){const n=e,r=t,s=i.computed(()=>n.value[0].configuratorParams.linesWidths.map(h=>h).reduce((h,u)=>h+u,0)),o=i.computed(()=>n.settings.width-s.value),a=i.computed(()=>!n.value.some(({product:h})=>!h)),l=i.computed(()=>o.value===0?void 0:[{label:`${(o.value>0?"Остаток +":"Излишек ")+o.value} мм.`,key:o.value}]),c=(h,u,p)=>{const f=n.value.at(u);if(f)if(h&&h>=n.settings.minLineWidth&&h%n.settings.lineWidthStep===0){const g={linesWidths:f.configuratorParams.linesWidths.toSpliced(u,1,h)};r("update:params",g,u,p),d("configuratorParams",g)}else f.product.id=-1},d=(h,u)=>{const p=n.value.map(f=>new Y.CartItemBase(f));p.forEach(f=>{f[h]=u}),r("update:value",p)};return(h,u)=>{const p=I.NText,f=I.NInput;return i.openBlock(),i.createBlock(i.unref(I.NForm),{class:"flex flex-col gap-2"},{default:i.withCtx(()=>{var g;return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(m,y)=>(i.openBlock(),i.createBlock(Vc,{key:y,"auto-focus":!0,index:y,value:m.configuratorParams.linesWidths.at(y)??0,product:m.product,settings:h.settings,"suggestion-option":l.value,"add-line-button-disabled":o.value<=0||h.value.length>=h.settings.maxLinesCount,"remove-line-button-disabled":h.value.length===1,"onUpdate:value":c,"onClick:addLine":u[0]||(u[0]=_=>r("click:add-line",_)),"onClick:removeLine":u[1]||(u[1]=_=>r("click:remove-line",_))},null,8,["index","value","product","settings","suggestion-option","add-line-button-disabled","remove-line-button-disabled"]))),128)),i.createElementVNode("div",W0,[o.value<0?(i.openBlock(),i.createBlock(p,{key:0,type:"error"},{default:i.withCtx(()=>[i.createTextVNode(" Сумма ширин всех полос должна быть равна "+i.toDisplayString(h.settings.width),1)]),_:1})):i.createCommentVNode("",!0),a.value&&h.value.length===h.settings.maxLinesCount&&o.value>0?(i.openBlock(),i.createBlock(p,{key:1,type:"error"},{default:i.withCtx(()=>[...u[8]||(u[8]=[i.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",null,[u[9]||(u[9]=i.createTextVNode(" Остаток для резки: ",-1)),i.createVNode(p,{type:o.value>=0?"Success":"error"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(o.value),1)]),_:1},8,["type"]),i.createTextVNode(" из "+i.toDisplayString(h.settings.width)+" мм ",1)])]),i.createVNode(i.unref(I.NButton),{loading:h.isSubmitProcessing,disabled:!a.value||o.value<=0||h.value.length>=h.settings.maxLinesCount,type:"primary",class:"self-center",onClick:u[2]||(u[2]=m=>r("click:add-line",h.value.length))},{default:i.withCtx(()=>[...u[10]||(u[10]=[i.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["loading","disabled"]),i.createVNode(i.unref(I.NFormItem),{required:!0,label:`Метраж ${h.settings.minLength?" от "+h.settings.minLength:""} ${h.settings.maxLength?" до "+h.settings.maxLength:""} м.`},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NInputNumber),{value:n.value[0].length,max:h.settings.maxLength||void 0,min:h.settings.minLength,step:h.settings.lengthStep,validator:m=>m%h.settings.lengthStep===0,placeholder:"Введите метраж",class:"w-full","onUpdate:value":u[3]||(u[3]=m=>d("length",m??0))},null,8,["value","max","min","step","validator"])]),_:1},8,["label"]),i.createVNode(i.unref(I.NFormItem),{required:!0,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NInputNumber),{value:n.value[0].quantity,min:1,validator:m=>Number.isInteger(m),placeholder:"Введите количество",class:"w-full","onUpdate:value":u[4]||(u[4]=m=>d("quantity",m??0))},null,8,["value","validator"])]),_:1}),i.createVNode(i.unref(I.NFormItem),{label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(f,{value:n.value[0].marker,placeholder:"Введите маркировку","onUpdate:value":u[5]||(u[5]=m=>d("marker",m))},null,8,["value"])]),_:1}),i.createElementVNode("div",j0,[i.createVNode(i.unref(I.NButton),{loading:h.isSubmitProcessing,disabled:!a.value||o.value!=0||!((g=h.value[0])!=null&&g.length)||h.value[0].length>h.settings.maxLength||h.value[0].length<h.settings.minLength||h.value[0].quantity===0,type:"primary",class:"self-start",onClick:u[6]||(u[6]=m=>r("submit",h.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(h.value[0].isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"]),h.settings.allowShowTable?(i.openBlock(),i.createBlock(i.unref(I.NButton),{key:0,type:"tertiary",class:"self-start",onClick:u[7]||(u[7]=m=>r("click:view-switch"))},{default:i.withCtx(()=>[...u[11]||(u[11]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0)])]}),_:1})}}}),X0={class:"flex grow flex-col"},Y0=["src"],U0={class:"w-full"},G0={},Oc=i.defineComponent({...G0,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(e){return(t,n)=>(i.openBlock(),i.createElementBlock("div",X0,[i.createElementVNode("img",{src:"/img/configurators/strip/strip-"+t.value.length+".png",class:"w-full max-w-96 self-center",alt:"Штрипс"},null,8,Y0),i.createElementVNode("div",U0,[i.createTextVNode(" Число полос можно указать от "+i.toDisplayString(t.settings.minLinesCount)+" до "+i.toDisplayString(t.settings.maxLinesCount)+". ",1),n[0]||(n[0]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Минимальная ширина полосы "+i.toDisplayString(t.settings.minLineWidth)+" мм. ",1),n[1]||(n[1]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина всех полос "+i.toDisplayString(t.settings.width)+" мм. ",1),n[2]||(n[2]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Шаг ширины полосы - "+i.toDisplayString(t.settings.lineWidthStep)+" мм. ",1)])]))}}),K0={class:"w-104 flex grow flex-col px-5"},Z0={},J0=i.defineComponent({...Z0,__name:"strip-configurator",props:{settings:{},cartItems:{},client:{}},emits:["submit-success"],setup(e,{emit:t}){const n=e,r=t,s=i.ref(n.cartItems),o=i.ref({width:{},length:{},quantity:{},marker:{}}),a=i.ref(!1),l=i.computed(()=>s.value[0].configuratorParams.linesWidths.map(p=>p).reduce((p,f)=>p+f,0)),c=p=>{p===void 0&&(p=s.value.length-1);const f=s.value.at(0);if(!f)return;f.configuratorParams.linesWidths=f.configuratorParams.linesWidths.toSpliced(p+1,0,0),s.value.forEach(m=>{m.configuratorParams.linesWidths=f.configuratorParams.linesWidths});const g=new Y.CartItemBase({quantity:(f==null?void 0:f.quantity)??1,category:f==null?void 0:f.category,length:(f==null?void 0:f.length)??n.settings.minLength,marker:f==null?void 0:f.marker,configuratorParams:{linesWidths:f==null?void 0:f.configuratorParams.linesWidths}});s.value=s.value.toSpliced(p+1,0,g)},d=p=>{const f=s.value.at(0);f&&(f.configuratorParams.linesWidths=f.configuratorParams.linesWidths.toSpliced(p,1),s.value.forEach(g=>{g.configuratorParams.linesWidths=f.configuratorParams.linesWidths}),s.value=s.value.toSpliced(p,1),delete o[`linesWidths.${p}`],delete o[`linesWidths.${p}`])},h=async(p,f,g)=>{g.value=!0,await Y.HttpRequester.getInstance(Y.ConfiguratorProvider).searchProduct(s.value[f].category,{linesWidths:p.linesWidths.at(f)},o.value).then(m=>{s.value[f].product=m,s.value.length<n.settings.maxLinesCount&&l.value<n.settings.width&&c()}).catch(()=>{s.value[f].product=new Y.Product,g.value=!1}),g.value=!1},u=async()=>{a.value=!0,await(s.value[0].isNewRec()?Y.HttpRequester.getInstance(Y.CartProvider).addCartItem(n.client,s.value[0]).then(p=>{r("submit-success",p)}).catch(()=>{a.value=!1}):Y.HttpRequester.getInstance(Y.CartProvider).patchCartItem(n.client,s.value[0]).then(p=>{r("submit-success",p)}).catch(()=>{a.value=!1})),a.value=!1};return(p,f)=>(i.openBlock(),i.createElementBlock("div",K0,[i.createVNode(Oc,{value:s.value,"onUpdate:value":f[0]||(f[0]=g=>s.value=g),settings:p.settings},null,8,["value","settings"]),i.createVNode(Ic,{value:s.value,"onUpdate:value":f[1]||(f[1]=g=>s.value=g),validation:o.value,settings:p.settings,"is-submit-processing":a.value,"onUpdate:params":h,onSubmit:u,"onClick:addLine":c,"onClick:removeLine":d},null,8,["value","validation","settings","is-submit-processing"])]))}}),Q0={class:"flex flex-wrap gap-2"},ey={class:"flex flex-col"},ty={class:"flex flex-col"},ny={},iy=i.defineComponent({...ny,__name:"date-range",props:{clearable:{type:Boolean,default:!0},dateRange:{default:void 0},dateFormat:{default:()=>Y.AppConfigProvider.getConfig().dateFormats.uiDate},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1}},emits:["update:date-range"],setup(e,{emit:t}){const n=e,r=t,s=i.computed(()=>{if(n.predefinedDateRanges)return n.predefinedDateRanges;if(n.useDefaultPredefinedDateRanges){const a={};return D.forOwn(Y.DateTimeProvider.defaultDateRanges(),(l,c)=>{a[c]={label:l.label,from:l.from??void 0,to:l.to??void 0}}),a}}),o=(a,l)=>{r("update:date-range",{from:a?$n.startOfDay(new Date(a)):void 0,to:l?$n.endOfDay(new Date(l)):void 0})};return(a,l)=>{var h,u,p,f,g,m;const c=I.NButton,d=I.NDatePicker;return i.openBlock(),i.createElementBlock("div",Q0,[i.createVNode(d,{value:((u=(h=a.dateRange)==null?void 0:h.from)==null?void 0:u.getTime())??null,clearable:a.clearable,"is-date-disabled":y=>{var _,b;return((_=a.dateRange)==null?void 0:_.to)&&y>((b=a.dateRange)==null?void 0:b.to)},disabled:(p=a.disabled)==null?void 0:p.from,format:a.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[0]||(l[0]=y=>{var _,b;return o(y,(b=(_=a.dateRange)==null?void 0:_.to)==null?void 0:b.getTime())})},i.createSlots({_:2},[s.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",ey,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(y,_)=>(i.openBlock(),i.createBlock(c,{key:_,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:b=>{var S,x;return o((S=y==null?void 0:y.from)==null?void 0:S.getTime(),(x=y==null?void 0:y.to)==null?void 0:x.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"]),i.createVNode(d,{value:((g=(f=a.dateRange)==null?void 0:f.to)==null?void 0:g.getTime())??null,clearable:a.clearable,"is-date-disabled":y=>{var _,b;return((_=a.dateRange)==null?void 0:_.from)&&y<((b=a.dateRange)==null?void 0:b.from)},disabled:(m=a.disabled)==null?void 0:m.to,format:a.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[1]||(l[1]=y=>{var _,b;return o((b=(_=a.dateRange)==null?void 0:_.from)==null?void 0:b.getTime(),y)})},i.createSlots({_:2},[s.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",ty,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(y,_)=>(i.openBlock(),i.createBlock(c,{key:_,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:b=>{var S,x;return o((S=y==null?void 0:y.from)==null?void 0:S.getTime(),(x=y==null?void 0:y.to)==null?void 0:x.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"])])}}}),ry={class:"sc-lbl-date text-nowrap"},sy={},uo=i.defineComponent({...sy,__name:"date-time-label",props:{date:{},isTimeSecondary:{type:Boolean},isTimeOnSecondLine:{type:Boolean}},setup(e){const t=e,n=i.computed(()=>$n.format(t.date,Y.AppConfigProvider.getConfig().dateFormats.uiDate)),r=i.computed(()=>$n.format(t.date,"HH:mm"));return(s,o)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-col":s.isTimeOnSecondLine})},[i.createElementVNode("span",ry,i.toDisplayString(n.value),1),i.createElementVNode("span",{class:i.normalizeClass([{"text-sc-grey":s.isTimeSecondary,"ml-1":!s.isTimeOnSecondLine},"sc-lbl-time"])},i.toDisplayString(r.value),3)],2))}}),oy={class:"flex flex-row gap-2.5"},ay={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},ly={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},cy={class:"mb-0.5 sm:mb-0 sm:ml-3"},dy={},hy=i.defineComponent({...dy,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(e){return(t,n)=>{const r=Er,s=I.NButton,o=I.NPopover;return i.openBlock(),i.createElementBlock("div",oy,[i.createElementVNode("div",ay,[i.renderSlot(t.$slots,"main")]),i.createElementVNode("div",null,[i.createElementVNode("div",ly,[i.renderSlot(t.$slots,"extra-buttons"),i.createElementVNode("div",cy,[t.showCloseButton?(i.openBlock(),i.createBlock(o,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(s,{size:"small",type:"error",onClick:n[0]||(n[0]=a=>t.$emit("close"))},{default:i.withCtx(()=>[i.createVNode(r)]),_:1})]),default:i.withCtx(()=>[n[1]||(n[1]=i.createTextVNode(" Закрыть ",-1))]),_:1})):i.createCommentVNode("",!0)])])])])}}}),uy={key:0,class:"flex flex-row gap-2.5"},fy={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},py={},gy=i.defineComponent({...py,__name:"base-dialog",props:{show:{type:Boolean},title:{},sizes:{default:()=>({phone:{size:"small",scale:.98},tablet:{size:"small",scale:.9},default:{size:"medium",scale:.7}})},processing:{type:Boolean,default:!1},valid:{type:Boolean,default:!0},acceptButton:{default:()=>({show:!0,text:"ОК"})},cancelButton:{default:()=>({show:!0,text:"Отмена"})}},emits:["update:show","opening","closing","accept","processing:cancel"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=i.ref(r.show),a=i.ref(r.processing),l=bt.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=bt.initRefDependingOnDeviceResolution(r.sizes.phone.scale,r.sizes.tablet.scale,r.sizes.default.scale),d=i.computed(()=>window.innerWidth*c.value),h=()=>{s("opening"),o.value=!0,s("update:show",o.value)},u=(f="other")=>{if(a.value){s("processing:cancel",_=>{a.value=_});return}let g=!1;s("closing",f,()=>{g=!0}),g||(o.value=!1,s("update:show",o.value))},p=()=>{s("accept",g=>{a.value=g})};return i.watch(()=>r.show,f=>{f?h():u("other")}),i.watch(()=>r.processing,f=>{a.value=f}),t({open:h,close:u}),(f,g)=>{const m=I.NButton,y=I.NModal;return i.openBlock(),i.createBlock(y,{loading:a.value,show:o.value,"show-icon":!1,size:i.unref(l),style:i.normalizeStyle(`width: ${d.value}px`),title:f.title,"action-class":f.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:g[1]||(g[1]=_=>u("header")),onEsc:g[2]||(g[2]=_=>u("esc")),onMaskClick:g[3]||(g[3]=_=>u("mask"))},i.createSlots({default:i.withCtx(()=>[i.renderSlot(f.$slots,"default")]),_:2},[f.$slots.header?{name:"header",fn:i.withCtx(()=>[i.renderSlot(f.$slots,"header")]),key:"0"}:void 0,f.$slots.action||f.$slots["extra-action"]||f.acceptButton.show||f.cancelButton.show?{name:"action",fn:i.withCtx(()=>[f.$slots["extra-action"]?(i.openBlock(),i.createElementBlock("div",uy,[i.renderSlot(f.$slots,"extra-action")])):i.createCommentVNode("",!0),f.$slots.action||f.acceptButton.show||f.cancelButton.show?(i.openBlock(),i.createElementBlock("div",fy,[i.renderSlot(f.$slots,"action",{disabled:a.value}),f.acceptButton.show??!0?(i.openBlock(),i.createBlock(m,{key:0,disabled:a.value||!f.valid,size:i.unref(l),type:"primary",onClick:p},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(f.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","size"])):i.createCommentVNode("",!0),f.cancelButton.show??!0?(i.openBlock(),i.createBlock(m,{key:1,size:i.unref(l),type:"default",onClick:g[0]||(g[0]=_=>u("footer"))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(f.cancelButton.text??"Отмена"),1)]),_:1},8,["size"])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["loading","show","size","style","title","action-class"])}}}),my={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function yy(e,t){return i.openBlock(),i.createElementBlock("svg",my,[...t[0]||(t[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 176h40a40 40 0 0 1 40 40v208a40 40 0 0 1-40 40H136a40 40 0 0 1-40-40V216a40 40 0 0 1 40-40h40"},null,-1),i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m176 272l80 80l80-80M256 48v288"},null,-1)])])}const _y=i.markRaw({name:"ion-download-outline",render:yy}),by={},wy=i.defineComponent({...by,__name:"single-file-upload-selector",props:{draggedAreaText:{},accept:{}},emits:["update:file"],setup(e,{emit:t}){const n=t,r=i.ref({name:"",content:""}),s=o=>{if(r.value={name:"",content:""},o.length===0)return;const a=o[0];r.value.name=a.name;const l=new FileReader;l.addEventListener("load",()=>{r.value.content=l.result??"",n("update:file",r.value)}),l.readAsDataURL(a.file)};return(o,a)=>{const l=_y,c=I.NUpload;return i.openBlock(),i.createBlock(c,{"default-upload":!1,max:1,action:"",accept:o.accept,"directory-dnd":"",class:"content-center","onUpdate:fileList":s},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NUploadDragger),null,{default:i.withCtx(()=>[i.renderSlot(o.$slots,"dragged-area",{},()=>[i.createElementVNode("div",null,[i.createVNode(l,{class:"text-2xl"}),i.createElementVNode("div",null,i.toDisplayString(o.draggedAreaText??"Перетащите в эту область файл, который необходимо загрузить."),1)])])]),_:3})]),_:3},8,["accept"])}}}),vy={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function ky(e,t){return i.openBlock(),i.createElementBlock("svg",vy,[...t[0]||(t[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"square","stroke-miterlimit":"10","stroke-width":"44",d:"M465 127L241 384l-92-92m-9 93l-93-93m316-165L236 273"},null,-1)])])}const xy=i.markRaw({name:"ion-checkmark-done-sharp",render:ky}),Cy={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Sy(e,t){return i.openBlock(),i.createElementBlock("svg",Cy,[...t[0]||(t[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128h80m-384 0h240m64 256h80m-384 0h240m-96-128h240m-384 0h80"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"128",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"176",cy:"256",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"384",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1)])])}const By=i.markRaw({name:"ion-options-outline",render:Sy}),Ty={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},Ey={class:"flex-auto"},Ry={class:"sticky top-0 flex flex-none flex-col justify-start gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},$y={class:"flex flex-none flex-col-reverse justify-end gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},Ny={},fo=i.defineComponent({...Ny,__name:"inline-view",props:{disabled:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!1},showApplyButton:{type:Boolean,default:!1},showCancelButton:{type:Boolean,default:!1}},emits:["edit","apply","cancel"],setup(e,{emit:t}){const n=t,r=i.ref(!1),s=()=>{n("edit")},o=()=>{r.value=!1},a=()=>{r.value=!0,n("apply",o)},l=()=>{n("cancel",o)};return(c,d)=>{const h=By,u=I.NButton,p=I.NPopover,f=xy,g=Er;return i.openBlock(),i.createElementBlock("div",Ty,[i.createElementVNode("div",Ey,[i.renderSlot(c.$slots,"default")]),i.createElementVNode("div",null,[i.createElementVNode("div",Ry,[i.createElementVNode("div",$y,[c.showEditButton?(i.openBlock(),i.createBlock(p,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(u,{disabled:c.disabled||r.value,type:"info",ghost:"",size:"small",onClick:s},{default:i.withCtx(()=>[i.createVNode(h)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[0]||(d[0]=i.createTextVNode(" Редактировать данные ",-1))]),_:1})):i.createCommentVNode("",!0),c.showApplyButton?(i.openBlock(),i.createBlock(p,{key:1,disabled:r.value,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(u,{disabled:c.disabled||r.value,type:"primary",size:"small",onClick:a},{default:i.withCtx(()=>[i.createVNode(f)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[1]||(d[1]=i.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),c.showCancelButton?(i.openBlock(),i.createBlock(p,{key:2,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(u,{disabled:c.disabled||r.value,type:"error",size:"small",onClick:l},{default:i.withCtx(()=>[i.createVNode(g)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[2]||(d[2]=i.createTextVNode(" Отменить изменения ",-1))]),_:1})):i.createCommentVNode("",!0)]),i.renderSlot(c.$slots,"extra-buttons")])])])}}}),Py={},zc=i.defineComponent({...Py,__name:"inline-editable-item",props:{disabled:{type:Boolean,default:!1},showEditor:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!0}},emits:["editor:apply","editor:cancel"],setup(e,{emit:t}){const n=e,r=t,s=i.ref(n.showEditor),o=l=>{r("editor:apply",d=>{s.value=!d,l()})},a=l=>{s.value=!1,l(),r("editor:cancel")};return i.onMounted(()=>{i.watch(()=>n.showEditor,l=>{s.value=l})}),(l,c)=>(i.openBlock(),i.createElementBlock("div",null,[s.value?(i.openBlock(),i.createBlock(fo,{key:1,disabled:l.disabled,"show-apply-button":!0,"show-cancel-button":!0,onApply:o,onCancel:a},{"extra-buttons":i.withCtx(()=>[i.renderSlot(l.$slots,"extra-editor-buttons")]),default:i.withCtx(()=>[i.renderSlot(l.$slots,"editor")]),_:3},8,["disabled"])):(i.openBlock(),i.createBlock(fo,{key:0,disabled:l.disabled,"show-edit-button":l.showEditButton,onEdit:c[0]||(c[0]=d=>s.value=!0)},{"extra-buttons":i.withCtx(()=>[i.renderSlot(l.$slots,"extra-viewer-buttons")]),default:i.withCtx(()=>[i.renderSlot(l.$slots,"viewer")]),_:3},8,["disabled","show-edit-button"]))]))}}),Fy={},My=i.defineComponent({...Fy,__name:"debounced-input",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:800},placeholder:{default:""}},emits:["update:value"],setup(e,{emit:t}){const n=e,r=t,s=i.ref(n.value),o=i.computed(()=>i.inject("debounce-input-time",n.debounceTime)),a=D.debounce(()=>r("update:value",s.value),o.value),l=c=>{s.value=c,a()};return i.watch(()=>n.value,c=>{s.value=c}),(c,d)=>(i.openBlock(),i.createBlock(i.unref(I.NInput),{value:s.value,"onUpdate:value":[d[0]||(d[0]=h=>s.value=h),l],clearable:c.clearable,placeholder:c.placeholder},{prefix:i.withCtx(()=>[i.renderSlot(c.$slots,"prefix")]),_:3},8,["value","clearable","placeholder"]))}}),Ay={},Vy=i.defineComponent({...Ay,__name:"phone-input",props:{value:{},debounceTime:{},disabled:{type:Boolean},placeholder:{},defaultCountry:{},preferredCountries:{},onlyCountries:{}},emits:["update:value"],setup(e,{emit:t}){const n=e,r=t,s=i.ref((n.value??"").replaceAll(/\D*/g,"")),o=D.debounce(c=>r("update:value",c),n.debounceTime??0),a=c=>{let d="";if(D.isString(c))s.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(D.isObject(c)){if(s.value=c.formatted,!c.valid)return;d=c instanceof qi.PhoneNumber?c.format("E.164"):`+${c.countryCallingCode}${c.nationalNumber}`}n.debounceTime?o(d):r("update:value",d)},l=c=>{const d=c.replaceAll(/\D*/g,"");try{const h=qi.parsePhoneNumberWithError(`+${d}`);h.isValid()?s.value=h.format("E.164"):h.getPossibleCountries().length>0&&(s.value=`+${d}`)}catch(h){if(h instanceof qi.ParseError)s.value=d;else throw h}};return i.watch(()=>n.value,c=>{var d;(c==null?void 0:c.replaceAll(/\D*/g,""))!==((d=s.value)==null?void 0:d.replaceAll(/\D*/g,""))&&l(c)},{immediate:!0}),i.onBeforeMount(()=>l(s.value??"")),(c,d)=>(i.openBlock(),i.createBlock(i.unref(jh.VueTelInput),{modelValue:s.value,"onUpdate:modelValue":[d[0]||(d[0]=h=>s.value=h),a],"auto-default-country":!1,"auto-format":!0,"default-country":c.defaultCountry,disabled:c.disabled,"input-options":{placeholder:c.placeholder},"preferred-countries":c.preferredCountries,"only-countries":c.onlyCountries,mode:"international",class:"tel-input"},null,8,["modelValue","default-country","disabled","input-options","preferred-countries","only-countries"]))}}),Iy=jn(Vy,[["__scopeId","data-v-751dbb0e"]]),Oy={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function zy(e,t){return i.openBlock(),i.createElementBlock("svg",Oy,[...t[0]||(t[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6m-7 1l9-9m-5 0h5v5"},null,-1)])])}const Ly=i.markRaw({name:"tabler-external-link",render:zy}),Dy={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},Hy=["href"],Wy={},jy=i.defineComponent({...Wy,__name:"external-link",props:{text:{},url:{},description:{}},setup(e){return(t,n)=>{const r=Ly,s=I.NTooltip;return i.openBlock(),i.createBlock(s,{disabled:i.unref(D.isUndefined)(t.description),placement:"top-start"},{trigger:i.withCtx(()=>[i.createElementVNode("span",Dy,[i.createElementVNode("a",{href:t.url,target:"_blank",class:"no-underline"},i.toDisplayString(t.text),9,Hy),i.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.description),1)]),_:1},8,["disabled"])}}}),qy={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Xy(e,t){return i.openBlock(),i.createElementBlock("svg",qy,[...t[0]||(t[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192Z"},null,-1),i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 256H176"},null,-1)])])}const Yy=i.markRaw({name:"ion-remove-circle-outline",render:Xy});let is=[];const Lc=new WeakMap;function Uy(){is.forEach(e=>e(...Lc.get(e))),is=[]}function Dc(e,...t){Lc.set(e,t),!is.includes(e)&&is.push(e)===1&&requestAnimationFrame(Uy)}function ar(e,t){let{target:n}=e;for(;n;){if(n.dataset&&n.dataset[t]!==void 0)return!0;n=n.parentElement}return!1}function lr(e){return e.composedPath()[0]||null}function cr(e){return typeof e=="string"?e.endsWith("px")?Number(e.slice(0,e.length-2)):Number(e):e}function dr(e){if(e!=null)return typeof e=="number"?`${e}px`:e.endsWith("px")?e:`${e}px`}function Gt(e,t){const n=e.trim().split(/\s+/g),r={top:n[0]};switch(n.length){case 1:r.right=n[0],r.bottom=n[0],r.left=n[0];break;case 2:r.right=n[1],r.left=n[1],r.bottom=n[0];break;case 3:r.right=n[1],r.bottom=n[2],r.left=n[1];break;case 4:r.right=n[1],r.bottom=n[2],r.left=n[3];break;default:throw new Error("[seemly/getMargin]:"+e+" is not a valid value.")}return t===void 0?r:r[t]}const Hc={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#0FF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000",blanchedalmond:"#FFEBCD",blue:"#00F",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#0FF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#F0F",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#0F0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#F0F",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#F00",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFF",whitesmoke:"#F5F5F5",yellow:"#FF0",yellowgreen:"#9ACD32",transparent:"#0000"};function Gy(e,t,n){t/=100,n/=100;let r=(s,o=(s+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[r(5)*255,r(3)*255,r(1)*255]}function Ky(e,t,n){t/=100,n/=100;let r=t*Math.min(n,1-n),s=(o,a=(o+e/30)%12)=>n-r*Math.max(Math.min(a-3,9-a,1),-1);return[s(0)*255,s(8)*255,s(4)*255]}const ln="^\\s*",cn="\\s*$",Vn="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",It="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",oi="([0-9A-Fa-f])",ai="([0-9A-Fa-f]{2})",Wc=new RegExp(`${ln}hsl\\s*\\(${It},${Vn},${Vn}\\)${cn}`),jc=new RegExp(`${ln}hsv\\s*\\(${It},${Vn},${Vn}\\)${cn}`),qc=new RegExp(`${ln}hsla\\s*\\(${It},${Vn},${Vn},${It}\\)${cn}`),Xc=new RegExp(`${ln}hsva\\s*\\(${It},${Vn},${Vn},${It}\\)${cn}`),Zy=new RegExp(`${ln}rgb\\s*\\(${It},${It},${It}\\)${cn}`),Jy=new RegExp(`${ln}rgba\\s*\\(${It},${It},${It},${It}\\)${cn}`),Qy=new RegExp(`${ln}#${oi}${oi}${oi}${cn}`),e_=new RegExp(`${ln}#${ai}${ai}${ai}${cn}`),t_=new RegExp(`${ln}#${oi}${oi}${oi}${oi}${cn}`),n_=new RegExp(`${ln}#${ai}${ai}${ai}${ai}${cn}`);function Rt(e){return parseInt(e,16)}function i_(e){try{let t;if(t=qc.exec(e))return[ss(t[1]),In(t[5]),In(t[9]),ci(t[13])];if(t=Wc.exec(e))return[ss(t[1]),In(t[5]),In(t[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${e}.`)}catch(t){throw t}}function r_(e){try{let t;if(t=Xc.exec(e))return[ss(t[1]),In(t[5]),In(t[9]),ci(t[13])];if(t=jc.exec(e))return[ss(t[1]),In(t[5]),In(t[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${e}.`)}catch(t){throw t}}function li(e){try{let t;if(t=e_.exec(e))return[Rt(t[1]),Rt(t[2]),Rt(t[3]),1];if(t=Zy.exec(e))return[ht(t[1]),ht(t[5]),ht(t[9]),1];if(t=Jy.exec(e))return[ht(t[1]),ht(t[5]),ht(t[9]),ci(t[13])];if(t=Qy.exec(e))return[Rt(t[1]+t[1]),Rt(t[2]+t[2]),Rt(t[3]+t[3]),1];if(t=n_.exec(e))return[Rt(t[1]),Rt(t[2]),Rt(t[3]),ci(Rt(t[4])/255)];if(t=t_.exec(e))return[Rt(t[1]+t[1]),Rt(t[2]+t[2]),Rt(t[3]+t[3]),ci(Rt(t[4]+t[4])/255)];if(e in Hc)return li(Hc[e]);if(Wc.test(e)||qc.test(e)){const[n,r,s,o]=i_(e);return[...Ky(n,r,s),o]}else if(jc.test(e)||Xc.test(e)){const[n,r,s,o]=r_(e);return[...Gy(n,r,s),o]}throw new Error(`[seemly/rgba]: Invalid color value ${e}.`)}catch(t){throw t}}function s_(e){return e>1?1:e<0?0:e}function po(e,t,n,r){return`rgba(${ht(e)}, ${ht(t)}, ${ht(n)}, ${s_(r)})`}function go(e,t,n,r,s){return ht((e*t*(1-r)+n*r)/s)}function o_(e,t){Array.isArray(e)||(e=li(e)),Array.isArray(t)||(t=li(t));const n=e[3],r=t[3],s=ci(n+r-n*r);return po(go(e[0],n,t[0],r,s),go(e[1],n,t[1],r,s),go(e[2],n,t[2],r,s),s)}function Ne(e,t){const[n,r,s,o=1]=Array.isArray(e)?e:li(e);return typeof t.alpha=="number"?po(n,r,s,t.alpha):po(n,r,s,o)}function rs(e,t){const[n,r,s,o=1]=Array.isArray(e)?e:li(e),{lightness:a=1,alpha:l=1}=t;return a_([n*a,r*a,s*a,o*l])}function ci(e){const t=Math.round(Number(e)*100)/100;return t>1?1:t<0?0:t}function ss(e){const t=Math.round(Number(e));return t>=360||t<0?0:t}function ht(e){const t=Math.round(Number(e));return t>255?255:t<0?0:t}function In(e){const t=Math.round(Number(e));return t>100?100:t<0?0:t}function a_(e){const[t,n,r]=e;return 3 in e?`rgba(${ht(t)}, ${ht(n)}, ${ht(r)}, ${ci(e[3])})`:`rgba(${ht(t)}, ${ht(n)}, ${ht(r)}, 1)`}function l_(e=8){return Math.random().toString(16).slice(2,2+e)}function Yc(e){return Array.isArray(e)?e:[e]}const mo={STOP:"STOP"};function Uc(e,t){const n=t(e);e.children!==void 0&&n!==mo.STOP&&e.children.forEach(r=>Uc(r,t))}function c_(e,t={}){const{preserveGroup:n=!1}=t,r=[],s=n?a=>{a.isLeaf||(r.push(a.key),o(a.children))}:a=>{a.isLeaf||(a.isGroup||r.push(a.key),o(a.children))};function o(a){a.forEach(s)}return o(e),r}function d_(e,t){const{isLeaf:n}=e;return n!==void 0?n:!t(e)}function h_(e){return e.children}function u_(e){return e.key}function f_(){return!1}function p_(e,t){const{isLeaf:n}=e;return!(n===!1&&!Array.isArray(t(e)))}function g_(e){return e.disabled===!0}function m_(e,t){return e.isLeaf===!1&&!Array.isArray(t(e))}function y_(e,t){if(e.isLeaf===!0){const n=t(e);if(Array.isArray(n)&&n.length>0)return!0}return!1}function yo(e){var t;return e==null?[]:Array.isArray(e)?e:(t=e.checkedKeys)!==null&&t!==void 0?t:[]}function _o(e){var t;return e==null||Array.isArray(e)?[]:(t=e.indeterminateKeys)!==null&&t!==void 0?t:[]}function __(e,t){const n=new Set(e);return t.forEach(r=>{n.has(r)||n.add(r)}),Array.from(n)}function b_(e,t){const n=new Set(e);return t.forEach(r=>{n.has(r)&&n.delete(r)}),Array.from(n)}function w_(e){return(e==null?void 0:e.type)==="group"}function v_(e){const t=new Map;return e.forEach((n,r)=>{t.set(n.key,r)}),n=>{var r;return(r=t.get(n))!==null&&r!==void 0?r:null}}class k_ extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function x_(e,t,n,r){return os(t.concat(e),n,r,!1)}function C_(e,t){const n=new Set;return e.forEach(r=>{const s=t.treeNodeMap.get(r);if(s!==void 0){let o=s.parent;for(;o!==null&&!(o.disabled||n.has(o.key));)n.add(o.key),o=o.parent}}),n}function S_(e,t,n,r){const s=os(t,n,r,!1),o=os(e,n,r,!0),a=C_(e,n),l=[];return s.forEach(c=>{(o.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>s.delete(c)),s}function bo(e,t){const{checkedKeys:n,keysToCheck:r,keysToUncheck:s,indeterminateKeys:o,cascade:a,leafOnly:l,checkStrategy:c,allowNotLoaded:d}=e;if(!a)return r!==void 0?{checkedKeys:__(n,r),indeterminateKeys:Array.from(o)}:s!==void 0?{checkedKeys:b_(n,s),indeterminateKeys:Array.from(o)}:{checkedKeys:Array.from(n),indeterminateKeys:Array.from(o)};const{levelTreeNodeMap:h}=t;let u;s!==void 0?u=S_(s,n,t,d):r!==void 0?u=x_(r,n,t,d):u=os(n,t,d,!1);const p=c==="parent",f=c==="child"||l,g=u,m=new Set,y=Math.max.apply(null,Array.from(h.keys()));for(let _=y;_>=0;_-=1){const b=_===0,S=h.get(_);for(const x of S){if(x.isLeaf)continue;const{key:v,shallowLoaded:B}=x;if(f&&B&&x.children.forEach(N=>{!N.disabled&&!N.isLeaf&&N.shallowLoaded&&g.has(N.key)&&g.delete(N.key)}),x.disabled||!B)continue;let k=!0,E=!1,P=!0;for(const N of x.children){const j=N.key;if(!N.disabled){if(P&&(P=!1),g.has(j))E=!0;else if(m.has(j)){E=!0,k=!1;break}else if(k=!1,E)break}}k&&!P?(p&&x.children.forEach(N=>{!N.disabled&&g.has(N.key)&&g.delete(N.key)}),g.add(v)):E&&m.add(v),b&&f&&g.has(v)&&g.delete(v)}}return{checkedKeys:Array.from(g),indeterminateKeys:Array.from(m)}}function os(e,t,n,r){const{treeNodeMap:s,getChildren:o}=t,a=new Set,l=new Set(e);return e.forEach(c=>{const d=s.get(c);d!==void 0&&Uc(d,h=>{if(h.disabled)return mo.STOP;const{key:u}=h;if(!a.has(u)&&(a.add(u),l.add(u),m_(h.rawNode,o))){if(r)return mo.STOP;if(!n)throw new k_}})}),l}function B_(e,{includeGroup:t=!1,includeSelf:n=!0},r){var s;const o=r.treeNodeMap;let a=e==null?null:(s=o.get(e))!==null&&s!==void 0?s:null;const l={keyPath:[],treeNodePath:[],treeNode:a};if(a!=null&&a.ignored)return l.treeNode=null,l;for(;a;)!a.ignored&&(t||!a.isGroup)&&l.treeNodePath.push(a),a=a.parent;return l.treeNodePath.reverse(),n||l.treeNodePath.pop(),l.keyPath=l.treeNodePath.map(c=>c.key),l}function T_(e){if(e.length===0)return null;const t=e[0];return t.isGroup||t.ignored||t.disabled?t.getNext():t}function E_(e,t){const n=e.siblings,r=n.length,{index:s}=e;return t?n[(s+1)%r]:s===n.length-1?null:n[s+1]}function Gc(e,t,{loop:n=!1,includeDisabled:r=!1}={}){const s=t==="prev"?R_:E_,o={reverse:t==="prev"};let a=!1,l=null;function c(d){if(d!==null){if(d===e){if(!a)a=!0;else if(!e.disabled&&!e.isGroup){l=e;return}}else if((!d.disabled||r)&&!d.ignored&&!d.isGroup){l=d;return}if(d.isGroup){const h=wo(d,o);h!==null?l=h:c(s(d,n))}else{const h=s(d,!1);if(h!==null)c(h);else{const u=$_(d);u!=null&&u.isGroup?c(s(u,n)):n&&c(s(d,!0))}}}}return c(e),l}function R_(e,t){const n=e.siblings,r=n.length,{index:s}=e;return t?n[(s-1+r)%r]:s===0?null:n[s-1]}function $_(e){return e.parent}function wo(e,t={}){const{reverse:n=!1}=t,{children:r}=e;if(r){const{length:s}=r,o=n?s-1:0,a=n?-1:s,l=n?-1:1;for(let c=o;c!==a;c+=l){const d=r[c];if(!d.disabled&&!d.ignored)if(d.isGroup){const h=wo(d,t);if(h!==null)return h}else return d}}return null}const N_={getChild(){return this.ignored?null:wo(this)},getParent(){const{parent:e}=this;return e!=null&&e.isGroup?e.getParent():e},getNext(e={}){return Gc(this,"next",e)},getPrev(e={}){return Gc(this,"prev",e)}};function P_(e,t){const n=t?new Set(t):void 0,r=[];function s(o){o.forEach(a=>{r.push(a),!(a.isLeaf||!a.children||a.ignored)&&(a.isGroup||n===void 0||n.has(a.key))&&s(a.children)})}return s(e),r}function F_(e,t){const n=e.key;for(;t;){if(t.key===n)return!0;t=t.parent}return!1}var M_={};function Kc(e,t,n,r,s,o=null,a=0){const l=[];return e.forEach((c,d)=>{var h;M_.NODE_ENV!=="production"&&y_(c,s)&&console.error("[treemate]: node",c,"is invalid");const u=Object.create(r);if(u.rawNode=c,u.siblings=l,u.level=a,u.index=d,u.isFirstChild=d===0,u.isLastChild=d+1===e.length,u.parent=o,!u.ignored){const p=s(c);Array.isArray(p)&&(u.children=Kc(p,t,n,r,s,u,a+1))}l.push(u),t.set(u.key,u),n.has(a)||n.set(a,[]),(h=n.get(a))===null||h===void 0||h.push(u)}),l}function A_(e,t={}){var n;const r=new Map,s=new Map,{getDisabled:o=g_,getIgnored:a=f_,getIsGroup:l=w_,getKey:c=u_}=t,d=(n=t.getChildren)!==null&&n!==void 0?n:h_,h=t.ignoreEmptyChildren?x=>{const v=d(x);return Array.isArray(v)?v.length?v:null:v}:d,u=Object.assign({get key(){return c(this.rawNode)},get disabled(){return o(this.rawNode)},get isGroup(){return l(this.rawNode)},get isLeaf(){return d_(this.rawNode,h)},get shallowLoaded(){return p_(this.rawNode,h)},get ignored(){return a(this.rawNode)},contains(x){return F_(this,x)}},N_),p=Kc(e,r,s,u,h);function f(x){if(x==null)return null;const v=r.get(x);return v&&!v.isGroup&&!v.ignored?v:null}function g(x){if(x==null)return null;const v=r.get(x);return v&&!v.ignored?v:null}function m(x,v){const B=g(x);return B?B.getPrev(v):null}function y(x,v){const B=g(x);return B?B.getNext(v):null}function _(x){const v=g(x);return v?v.getParent():null}function b(x){const v=g(x);return v?v.getChild():null}const S={treeNodes:p,treeNodeMap:r,levelTreeNodeMap:s,maxLevel:Math.max(...s.keys()),getChildren:h,getFlattenedNodes(x){return P_(p,x)},getNode:f,getPrev:m,getNext:y,getParent:_,getChild:b,getFirstAvailableNode(){return T_(p)},getPath(x,v={}){return B_(x,v,S)},getCheckedKeys(x,v={}){const{cascade:B=!0,leafOnly:k=!1,checkStrategy:E="all",allowNotLoaded:P=!1}=v;return bo({checkedKeys:yo(x),indeterminateKeys:_o(x),cascade:B,leafOnly:k,checkStrategy:E,allowNotLoaded:P},S)},check(x,v,B={}){const{cascade:k=!0,leafOnly:E=!1,checkStrategy:P="all",allowNotLoaded:N=!1}=B;return bo({checkedKeys:yo(v),indeterminateKeys:_o(v),keysToCheck:x==null?[]:Yc(x),cascade:k,leafOnly:E,checkStrategy:P,allowNotLoaded:N},S)},uncheck(x,v,B={}){const{cascade:k=!0,leafOnly:E=!1,checkStrategy:P="all",allowNotLoaded:N=!1}=B;return bo({checkedKeys:yo(v),indeterminateKeys:_o(v),keysToUncheck:x==null?[]:Yc(x),cascade:k,leafOnly:E,checkStrategy:P,allowNotLoaded:N},S)},getNonLeafKeys(x={}){return c_(p,x)}};return S}function as(e){return e.composedPath()[0]}const V_={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function I_(e,t,n){if(e==="mousemoveoutside"){const r=s=>{t.contains(as(s))||n(s)};return{mousemove:r,touchstart:r}}else if(e==="clickoutside"){let r=!1;const s=a=>{r=!t.contains(as(a))},o=a=>{r&&(t.contains(as(a))||n(a))};return{mousedown:s,mouseup:o,touchstart:s,touchend:o}}return console.error(`[evtd/create-trap-handler]: name \`${e}\` is invalid. This could be a bug of evtd.`),{}}function Zc(e,t,n){const r=V_[e];let s=r.get(t);s===void 0&&r.set(t,s=new WeakMap);let o=s.get(n);return o===void 0&&s.set(n,o=I_(e,t,n)),o}function O_(e,t,n,r){if(e==="mousemoveoutside"||e==="clickoutside"){const s=Zc(e,t,n);return Object.keys(s).forEach(o=>{Ct(o,document,s[o],r)}),!0}return!1}function z_(e,t,n,r){if(e==="mousemoveoutside"||e==="clickoutside"){const s=Zc(e,t,n);return Object.keys(s).forEach(o=>{tt(o,document,s[o],r)}),!0}return!1}function L_(){if(typeof window>"u")return{on:()=>{},off:()=>{}};const e=new WeakMap,t=new WeakMap;function n(){e.set(this,!0)}function r(){e.set(this,!0),t.set(this,!0)}function s(k,E,P){const N=k[E];return k[E]=function(){return P.apply(k,arguments),N.apply(k,arguments)},k}function o(k,E){k[E]=Event.prototype[E]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var k;return(k=a.get(this))!==null&&k!==void 0?k:null}function d(k,E){l!==void 0&&Object.defineProperty(k,"currentTarget",{configurable:!0,enumerable:!0,get:E??l.get})}const h={bubble:{},capture:{}},u={};function p(){const k=function(E){const{type:P,eventPhase:N,bubbles:j}=E,X=as(E);if(N===2)return;const A=N===1?"capture":"bubble";let V=X;const L=[];for(;V===null&&(V=window),L.push(V),V!==window;)V=V.parentNode||null;const Z=h.capture[P],F=h.bubble[P];if(s(E,"stopPropagation",n),s(E,"stopImmediatePropagation",r),d(E,c),A==="capture"){if(Z===void 0)return;for(let R=L.length-1;R>=0&&!e.has(E);--R){const $=L[R],M=Z.get($);if(M!==void 0){a.set(E,$);for(const U of M){if(t.has(E))break;U(E)}}if(R===0&&!j&&F!==void 0){const U=F.get($);if(U!==void 0)for(const z of U){if(t.has(E))break;z(E)}}}}else if(A==="bubble"){if(F===void 0)return;for(let R=0;R<L.length&&!e.has(E);++R){const $=L[R],M=F.get($);if(M!==void 0){a.set(E,$);for(const U of M){if(t.has(E))break;U(E)}}}}o(E,"stopPropagation"),o(E,"stopImmediatePropagation"),d(E)};return k.displayName="evtdUnifiedHandler",k}function f(){const k=function(E){const{type:P,eventPhase:N}=E;if(N!==2)return;const j=u[P];j!==void 0&&j.forEach(X=>X(E))};return k.displayName="evtdUnifiedWindowEventHandler",k}const g=p(),m=f();function y(k,E){const P=h[k];return P[E]===void 0&&(P[E]=new Map,window.addEventListener(E,g,k==="capture")),P[E]}function _(k){return u[k]===void 0&&(u[k]=new Set,window.addEventListener(k,m)),u[k]}function b(k,E){let P=k.get(E);return P===void 0&&k.set(E,P=new Set),P}function S(k,E,P,N){const j=h[E][P];if(j!==void 0){const X=j.get(k);if(X!==void 0&&X.has(N))return!0}return!1}function x(k,E){const P=u[k];return!!(P!==void 0&&P.has(E))}function v(k,E,P,N){let j;if(typeof N=="object"&&N.once===!0?j=Z=>{B(k,E,j,N),P(Z)}:j=P,O_(k,E,j,N))return;const A=N===!0||typeof N=="object"&&N.capture===!0?"capture":"bubble",V=y(A,k),L=b(V,E);if(L.has(j)||L.add(j),E===window){const Z=_(k);Z.has(j)||Z.add(j)}}function B(k,E,P,N){if(z_(k,E,P,N))return;const X=N===!0||typeof N=="object"&&N.capture===!0,A=X?"capture":"bubble",V=y(A,k),L=b(V,E);if(E===window&&!S(E,X?"bubble":"capture",k,P)&&x(k,P)){const F=u[k];F.delete(P),F.size===0&&(window.removeEventListener(k,m),u[k]=void 0)}L.has(P)&&L.delete(P),L.size===0&&V.delete(E),V.size===0&&(window.removeEventListener(k,g,A==="capture"),h[A][k]=void 0)}return{on:v,off:B}}const{on:Ct,off:tt}=L_(),Vi="@@mmoContext",D_={mounted(e,{value:t}){e[Vi]={handler:void 0},typeof t=="function"&&(e[Vi].handler=t,Ct("mousemoveoutside",e,t))},updated(e,{value:t}){const n=e[Vi];typeof t=="function"?n.handler?n.handler!==t&&(tt("mousemoveoutside",e,n.handler),n.handler=t,Ct("mousemoveoutside",e,t)):(e[Vi].handler=t,Ct("mousemoveoutside",e,t)):n.handler&&(tt("mousemoveoutside",e,n.handler),n.handler=void 0)},unmounted(e){const{handler:t}=e[Vi];t&&tt("mousemoveoutside",e,t),e[Vi].handler=void 0}},Ii="@@coContext",ls={mounted(e,{value:t,modifiers:n}){e[Ii]={handler:void 0},typeof t=="function"&&(e[Ii].handler=t,Ct("clickoutside",e,t,{capture:n.capture}))},updated(e,{value:t,modifiers:n}){const r=e[Ii];typeof t=="function"?r.handler?r.handler!==t&&(tt("clickoutside",e,r.handler,{capture:n.capture}),r.handler=t,Ct("clickoutside",e,t,{capture:n.capture})):(e[Ii].handler=t,Ct("clickoutside",e,t,{capture:n.capture})):r.handler&&(tt("clickoutside",e,r.handler,{capture:n.capture}),r.handler=void 0)},unmounted(e,{modifiers:t}){const{handler:n}=e[Ii];n&&tt("clickoutside",e,n,{capture:t.capture}),e[Ii].handler=void 0}};function H_(e,t){console.error(`[vdirs/${e}]: ${t}`)}class W_{constructor(){this.elementZIndex=new Map,this.nextZIndex=2e3}get elementCount(){return this.elementZIndex.size}ensureZIndex(t,n){const{elementZIndex:r}=this;if(n!==void 0){t.style.zIndex=`${n}`,r.delete(t);return}const{nextZIndex:s}=this;r.has(t)&&r.get(t)+1===this.nextZIndex||(t.style.zIndex=`${s}`,r.set(t,s),this.nextZIndex=s+1,this.squashState())}unregister(t,n){const{elementZIndex:r}=this;r.has(t)?r.delete(t):n===void 0&&H_("z-index-manager/unregister-element","Element not found when unregistering."),this.squashState()}squashState(){const{elementCount:t}=this;t||(this.nextZIndex=2e3),this.nextZIndex-t>2500&&this.rearrange()}rearrange(){const t=Array.from(this.elementZIndex.entries());t.sort((n,r)=>n[1]-r[1]),this.nextZIndex=2e3,t.forEach(n=>{const r=n[0],s=this.nextZIndex++;`${s}`!==r.style.zIndex&&(r.style.zIndex=`${s}`)})}}const vo=new W_,Oi="@@ziContext",Jc={mounted(e,t){const{value:n={}}=t,{zIndex:r,enabled:s}=n;e[Oi]={enabled:!!s,initialized:!1},s&&(vo.ensureZIndex(e,r),e[Oi].initialized=!0)},updated(e,t){const{value:n={}}=t,{zIndex:r,enabled:s}=n,o=e[Oi].enabled;s&&!o&&(vo.ensureZIndex(e,r),e[Oi].initialized=!0),e[Oi].enabled=!!s},unmounted(e,t){if(!e[Oi].initialized)return;const{value:n={}}=t,{zIndex:r}=n;vo.unregister(e,r)}};function j_(e){const t=i.ref(!!e.value);if(t.value)return i.readonly(t);const n=i.watch(e,r=>{r&&(t.value=!0,n())});return i.readonly(t)}function qt(e){const t=i.computed(e),n=i.ref(t.value);return i.watch(t,r=>{n.value=r}),typeof e=="function"?n:{__v_isRef:!0,get value(){return n.value},set value(r){e.set(r)}}}const q_=typeof window<"u";let zi,hr;(()=>{var e,t;zi=q_?(t=(e=document)===null||e===void 0?void 0:e.fonts)===null||t===void 0?void 0:t.ready:void 0,hr=!1,zi!==void 0?zi.then(()=>{hr=!0}):hr=!0})();function X_(e){if(hr)return;let t=!1;i.onMounted(()=>{hr||zi==null||zi.then(()=>{t||e()})}),i.onBeforeUnmount(()=>{t=!0})}function ko(e,t){return i.watch(e,n=>{n!==void 0&&(t.value=n)}),i.computed(()=>e.value===void 0?t.value:e.value)}function cs(){const e=i.ref(!1);return i.onMounted(()=>{e.value=!0}),i.readonly(e)}function Qc(e,t){return i.computed(()=>{for(const n of t)if(e[n]!==void 0)return e[n];return e[t[t.length-1]]})}const Y_=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function U_(){return Y_}function xo(e,t,n="default"){const r=t[n];if(r===void 0)throw new Error(`[vueuc/${e}]: slot[${n}] is empty.`);return r()}function Co(e,t=!0,n=[]){return e.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&n.push(i.createTextVNode(String(r)));return}if(Array.isArray(r)){Co(r,t,n);return}if(r.type===i.Fragment){if(r.children===null)return;Array.isArray(r.children)&&Co(r.children,t,n)}else r.type!==i.Comment&&n.push(r)}}),n}function ed(e,t,n="default"){const r=t[n];if(r===void 0)throw new Error(`[vueuc/${e}]: slot[${n}] is empty.`);const s=Co(r());if(s.length===1)return s[0];throw new Error(`[vueuc/${e}]: slot[${n}] should have exactly one child.`)}let On=null;function td(){if(On===null&&(On=document.getElementById("v-binder-view-measurer"),On===null)){On=document.createElement("div"),On.id="v-binder-view-measurer";const{style:e}=On;e.position="fixed",e.left="0",e.right="0",e.top="0",e.bottom="0",e.pointerEvents="none",e.visibility="hidden",document.body.appendChild(On)}return On.getBoundingClientRect()}function G_(e,t){const n=td();return{top:t,left:e,height:0,width:0,right:n.width-e,bottom:n.height-t}}function So(e){const t=e.getBoundingClientRect(),n=td();return{left:t.left-n.left,top:t.top-n.top,bottom:n.height+n.top-t.bottom,right:n.width+n.left-t.right,width:t.width,height:t.height}}function K_(e){return e.nodeType===9?null:e.parentNode}function nd(e){if(e===null)return null;const t=K_(e);if(t===null)return null;if(t.nodeType===9)return document;if(t.nodeType===1){const{overflow:n,overflowX:r,overflowY:s}=getComputedStyle(t);if(/(auto|scroll|overlay)/.test(n+s+r))return t}return nd(t)}const id=i.defineComponent({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(e){var t;i.provide("VBinder",(t=i.getCurrentInstance())===null||t===void 0?void 0:t.proxy);const n=i.inject("VBinder",null),r=i.ref(null),s=_=>{r.value=_,n&&e.syncTargetWithParent&&n.setTargetRef(_)};let o=[];const a=()=>{let _=r.value;for(;_=nd(_),_!==null;)o.push(_);for(const b of o)Ct("scroll",b,u,!0)},l=()=>{for(const _ of o)tt("scroll",_,u,!0);o=[]},c=new Set,d=_=>{c.size===0&&a(),c.has(_)||c.add(_)},h=_=>{c.has(_)&&c.delete(_),c.size===0&&l()},u=()=>{Dc(p)},p=()=>{c.forEach(_=>_())},f=new Set,g=_=>{f.size===0&&Ct("resize",window,y),f.has(_)||f.add(_)},m=_=>{f.has(_)&&f.delete(_),f.size===0&&tt("resize",window,y)},y=()=>{f.forEach(_=>_())};return i.onBeforeUnmount(()=>{tt("resize",window,y),l()}),{targetRef:r,setTargetRef:s,addScrollListener:d,removeScrollListener:h,addResizeListener:g,removeResizeListener:m}},render(){return xo("binder",this.$slots)}}),rd=i.defineComponent({name:"Target",setup(){const{setTargetRef:e,syncTarget:t}=i.inject("VBinder");return{syncTarget:t,setTargetDirective:{mounted:e,updated:e}}},render(){const{syncTarget:e,setTargetDirective:t}=this;return e?i.withDirectives(ed("follower",this.$slots),[[t]]):ed("follower",this.$slots)}}),Z_="@css-render/vue3-ssr";function J_(e,t){return`<style cssr-id="${e}">
|
|
103
|
+
`}},Xr=Gn.Multiply,_m=[1,0,0,0,1,0,0,0,1],An=new tn(9),bm=dt.Utils,jl=new J,Ys=new tn([0,0,1,0,0,1,0,1,1,0,1,1]),_e={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:He.document?He.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new Gn,group:{removeChild:function(e,t){if(e.children)for(let n=0;n<e.children.length;n++)_e.group.removeChild(e.children[n],t);e._renderer.texture&&(t.deleteTexture(e._renderer.texture),delete e._renderer.texture),e._renderer.positionBuffer&&(t.deleteBuffer(e._renderer.positionBuffer),delete e._renderer.positionBuffer)},render:function(e,t){if(!this._visible)return;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.parent,r=n._matrix&&n._matrix.manual||n._flagMatrix,s=this._matrix.manual||this._flagMatrix;if((r||s)&&(this._renderer.matrix||(this._renderer.matrix=new tn(9)),this._matrix.toTransformArray(!0,An),Xr(An,n._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof J||(this._renderer.scale=new J),this._scale instanceof J?(this._renderer.scale.x=this._scale.x,this._renderer.scale.y=this._scale.y):(this._renderer.scale.x=this._scale,this._renderer.scale.y=this._scale),/renderer/i.test(n._renderer.type)||(this._renderer.scale.x*=n._renderer.scale.x,this._renderer.scale.y*=n._renderer.scale.y),r&&(this._flagMatrix=!0)),this._mask){e.clear(e.STENCIL_BUFFER_BIT),e.enable(e.STENCIL_TEST),e.stencilFunc(e.ALWAYS,1,0),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE),e.colorMask(!1,!1,!1,!1);const a=dt.Utils.getRendererType(this._mask._renderer.type);_e[a].render.call(this._mask,e,t,this),e.stencilFunc(e.EQUAL,1,255),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.colorMask(!0,!0,!0,!0)}this._flagOpacity=n._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);let o;if(this._flagSubtractions)for(o=0;o<this.subtractions.length;o++)_e.group.removeChild(this.subtractions[o],e);for(o=0;o<this.children.length;o++){const a=this.children[o],l=dt.Utils.getRendererType(a._renderer.type);_e[l].render.call(a,e,t)}return this._mask&&e.disable(e.STENCIL_TEST),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(e,t){let n,r,s,o,a,l,c,d,h,u,p,f,g,m;const y=t._renderer.vertices,_=this.canvas,b=this.ctx,S=e.renderer.ratio,x=jl.copy(t._renderer.scale).multiply(S),v=t._stroke,B=t._linewidth,k=t._fill,E=t._renderer.opacity||t._opacity,P=t._cap,N=t._join,j=t._miter,X=t._closed,A=t.dashes,V=y.length,L=V-1;_.width=Math.max(Math.ceil(t._renderer.rect.width*x.x),1),_.height=Math.max(Math.ceil(t._renderer.rect.height*x.y),1);const Z=t._renderer.rect.centroid,F=Z.x,R=Z.y;if(b.clearRect(0,0,_.width,_.height),k)if(typeof k=="string")b.fillStyle=k;else{const ge=dt.Utils.getRendererType(k._renderer.type);_e[ge].render.call(k,b,t),b.fillStyle=k._renderer.effect}if(v){if(typeof v=="string")b.strokeStyle=v;else{const ge=dt.Utils.getRendererType(v._renderer.type);_e[ge].render.call(v,b,t),b.strokeStyle=v._renderer.effect}B&&(b.lineWidth=B),j&&(b.miterLimit=j),N&&(b.lineJoin=N),!X&&P&&(b.lineCap=P)}typeof E=="number"&&(b.globalAlpha=E),A&&A.length>0&&(b.lineDashOffset=A.offset||0,b.setLineDash(A));let $,M,U,z,O,ee,ce,se;b.save(),b.scale(x.x,x.y),b.translate(F,R),b.beginPath();for(let ge=0;ge<y.length;ge++){const ie=y[ge];switch(f=ie.x,g=ie.y,ie.command){case ne.close:b.closePath();break;case ne.arc:M=ie.rx,U=ie.ry,z=ie.xAxisRotation,O=ie.largeArcFlag,ee=ie.sweepFlag,n=X?Ft(ge-1,V):Math.max(ge-1,0),r=y[n],ce=r.x,se=r.y,bm.renderSvgArcCommand(b,ce,se,M,U,O,ee,z,f,g);break;case ne.curve:n=X?Ft(ge-1,V):Math.max(ge-1,0),r=y[n],d=r.controls&&r.controls.right||J.zero,h=ie.controls&&ie.controls.left||J.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),ie._relative?(o=h.x+ie.x,a=h.y+ie.y):(o=h.x,a=h.y),b.bezierCurveTo(l,c,o,a,f,g),ge>=L&&X&&(s=$,u=ie.controls&&ie.controls.right||J.zero,p=s.controls&&s.controls.left||J.zero,ie._relative?(l=u.x+ie.x,c=u.y+ie.y):(l=u.x,c=u.y),s._relative?(o=p.x+s.x,a=p.y+s.y):(o=p.x,a=p.y),f=s.x,g=s.y,b.bezierCurveTo(l,c,o,a,f,g));break;case ne.line:b.lineTo(f,g);break;case ne.move:$=ie,b.moveTo(f,g);break}}X&&b.closePath(),_e.isHidden.test(k)||(m=k._renderer&&k._renderer.offset,m&&(b.save(),b.translate(-k._renderer.offset.x,-k._renderer.offset.y),b.scale(k._renderer.scale.x,k._renderer.scale.y)),b.fill(),m&&b.restore()),_e.isHidden.test(v)||(m=v._renderer&&v._renderer.offset,m&&(b.save(),b.translate(-v._renderer.offset.x,-v._renderer.offset.y),b.scale(v._renderer.scale.x,v._renderer.scale.y),b.lineWidth=B/v._renderer.scale.x),b.stroke(),m&&b.restore()),b.restore()},getBoundingClientRect:function(e,t,n){let r=1/0,s=-1/0,o=1/0,a=-1/0,l,c;e.forEach(function(d){const h=d.x,u=d.y,p=d.controls;let f,g,m,y,_,b;o=Math.min(u,o),r=Math.min(h,r),s=Math.max(h,s),a=Math.max(u,a),d.controls&&(_=p.left,b=p.right,!(!_||!b)&&(f=d._relative?_.x+h:_.x,g=d._relative?_.y+u:_.y,m=d._relative?b.x+h:b.x,y=d._relative?b.y+u:b.y,!(!f||!g||!m||!y)&&(o=Math.min(g,y,o),r=Math.min(f,m,r),s=Math.max(f,m,s),a=Math.max(g,y,a))))}),typeof t=="number"&&(o-=t,r-=t,s+=t,a+=t),l=s-r,c=a-o,n.top=o,n.left=r,n.right=s,n.bottom=a,n.width=l,n.height=c,n.centroid||(n.centroid={}),n.centroid.x=-r,n.centroid.y=-o},render:function(e,t,n){if(!this._visible||!this._opacity)return this;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,s=dt.Utils.getRendererType(this._renderer.type),o=t[s],a=r._matrix.manual||r._flagMatrix,l=this._matrix.manual||this._flagMatrix,c=this._renderer.parent!==r,d=this._flagVertices||this._flagFill||this._fill instanceof Ie&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Oe&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Te&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ie&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Oe&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Te&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(a||l||c){this._renderer.matrix||(this._renderer.matrix=new tn(9)),this._matrix.toTransformArray(!0,An),Xr(An,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof J||(this._renderer.scale=new J);let u,p;this._scale instanceof J?(u=this._scale.x*r._renderer.scale.x,p=this._scale.y*r._renderer.scale.y):(u=this._scale*r._renderer.scale.x,p=this._scale*r._renderer.scale.y),this._renderer.scale.x=u<0?-u:u,this._renderer.scale.y=p<0?-p:p,c&&(this._renderer.parent=r)}if(this._mask){e.clear(e.STENCIL_BUFFER_BIT),e.enable(e.STENCIL_TEST),e.stencilFunc(e.ALWAYS,1,0),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE),e.colorMask(!1,!1,!1,!1);const u=dt.Utils.getRendererType(this._mask._renderer.type);_e[u].render.call(this._mask,e,t,this),e.stencilFunc(e.EQUAL,1,255),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.colorMask(!0,!0,!0,!0)}if(d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,_e.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),_e.updateTexture.call(_e,e,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;t.current!==o&&(e.useProgram(o),e.bindBuffer(e.ARRAY_BUFFER,t.buffers.position),e.vertexAttribPointer(o.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(o.position),e.bufferData(e.ARRAY_BUFFER,Ys,e.STATIC_DRAW),t.resolution.flagged||e.uniform2f(e.getUniformLocation(o,"u_resolution"),t.resolution.width,t.resolution.height),t.current=o),t.resolution.flagged&&e.uniform2f(e.getUniformLocation(o,"u_resolution"),t.resolution.width,t.resolution.height),e.bindTexture(e.TEXTURE_2D,this._renderer.texture);const h=this._renderer.rect;return e.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),e.uniform4f(o.rect,h.left,h.top,h.right,h.bottom),e.drawArrays(e.TRIANGLES,0,6),this._mask&&e.disable(e.STENCIL_TEST),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(e,t){let n;const r=this.canvas,s=this.ctx,o=e.renderer.ratio,a=t._stroke,l=t._linewidth,c=t._fill,d=t._renderer.opacity||t._opacity,h=t.dashes,u=t._size*o;let p=u;_e.isHidden.test(a)||(p+=l),r.width=Xa(p),r.height=r.width;const f=p/r.width,g=r.width/2,m=r.height/2;if(s.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")s.fillStyle=c;else{const y=dt.Utils.getRendererType(c._renderer.type);_e[y].render.call(c,s,t),s.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")s.strokeStyle=a;else{const y=dt.Utils.getRendererType(a._renderer.type);_e[y].render.call(a,s,t),s.strokeStyle=a._renderer.effect}l&&(s.lineWidth=l/f)}typeof d=="number"&&(s.globalAlpha=d),h&&h.length>0&&(s.lineDashOffset=h.offset||0,s.setLineDash(h)),s.save(),s.translate(g,m),s.scale(_e.precision,_e.precision),s.beginPath(),s.arc(0,0,u/f*.5,0,lt),s.restore(),closed&&s.closePath(),_e.isHidden.test(c)||(n=c._renderer&&c._renderer.offset,n&&(s.save(),s.translate(-c._renderer.offset.x,-c._renderer.offset.y),s.scale(c._renderer.scale.x,c._renderer.scale.y)),s.fill(),n&&s.restore()),_e.isHidden.test(a)||(n=a._renderer&&a._renderer.offset,n&&(s.save(),s.translate(-a._renderer.offset.x,-a._renderer.offset.y),s.scale(a._renderer.scale.x,a._renderer.scale.y),s.lineWidth=l/a._renderer.scale.x),s.stroke(),n&&s.restore())},render:function(e,t,n){if(!this._visible||!this._opacity)return this;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const s=n||this.parent,o=t[this._renderer.type],a=this._sizeAttenuation,l=this._stroke,c=this._linewidth,d=s._matrix.manual||s._flagMatrix,h=this._matrix.manual||this._flagMatrix,u=this._renderer.parent!==s,p=this._renderer.vertices,f=this._renderer.collection.length,g=this._flagVertices,m=this._flagFill||this._fill instanceof Ie&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Oe&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Te&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ie&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Oe&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Te&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||s._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(d||h||u){this._renderer.matrix||(this._renderer.matrix=new tn(9)),this._matrix.toTransformArray(!0,An),Xr(An,s._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof J||(this._renderer.scale=new J);let y,_;this._scale instanceof J?(y=this._scale.x*s._renderer.scale.x,_=this._scale.y*s._renderer.scale.y):(y=this._scale*s._renderer.scale.x,_=this._scale*s._renderer.scale.y),this._renderer.scale.x=y<0?-y:y,this._renderer.scale.y=_<0?-_:_,u&&(this._renderer.parent=s)}if(g){const y=this._renderer.positionBuffer;y&&e.deleteBuffer(y),this._renderer.positionBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this._renderer.positionBuffer),e.vertexAttribPointer(o.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(o.position),e.bufferData(e.ARRAY_BUFFER,p,e.STATIC_DRAW)}return m?(this._renderer.opacity=this._opacity*s._renderer.opacity,_e.updateTexture.call(_e,e,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture?this:(_e.isHidden.test(l)||(r+=c),r/=_e.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),t.current!==o&&(e.useProgram(o),t.resolution.flagged||e.uniform2f(e.getUniformLocation(o,"u_resolution"),t.resolution.width,t.resolution.height),t.current=o),t.resolution.flagged&&e.uniform2f(e.getUniformLocation(o,"u_resolution"),t.resolution.width,t.resolution.height),e.bindTexture(e.TEXTURE_2D,this._renderer.texture),e.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),e.uniform1f(o.size,r*t.resolution.ratio),e.drawArrays(e.POINTS,0,f),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(e,t){const n=this.canvas,r=this.ctx,s=e.renderer.ratio,o=jl.copy(t._renderer.scale).multiply(s),a=t._stroke,l=t._linewidth,c=t._fill,d=t._renderer.opacity||t._opacity,h=t.dashes,u=t._decoration,p=t._direction;n.width=Math.max(Math.ceil(t._renderer.rect.width*o.x),1),n.height=Math.max(Math.ceil(t._renderer.rect.height*o.y),1);const f=t._renderer.rect.centroid,g=f.x,m=f.y;let y,_,b,S,x,v,B,k,E,P,N;const j=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,n.width,n.height),j||(r.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=p,c)if(typeof c=="string")r.fillStyle=c;else{const X=dt.Utils.getRendererType(c._renderer.type);_e[X].render.call(c,r,t),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const X=dt.Utils.getRendererType(a._renderer.type);_e[X].render.call(a,r,t),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=l)}if(typeof d=="number"&&(r.globalAlpha=d),h&&h.length>0&&(r.lineDashOffset=h.offset||0,r.setLineDash(h)),r.save(),r.scale(o.x,o.y),r.translate(g,m),_e.isHidden.test(c)||(c._renderer&&c._renderer.offset?(v=c._renderer.scale.x,B=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(v,B),y=t._size/c._renderer.scale.y,_=t._leading/c._renderer.scale.y,r.font=[t._style,t._weight,y+"px/",_+"px",t._family].join(" "),b=c._renderer.offset.x/c._renderer.scale.x,S=c._renderer.offset.y/c._renderer.scale.y,r.fillText(t.value,b,S),r.restore()):r.fillText(t.value,0,0)),_e.isHidden.test(a)||(a._renderer&&a._renderer.offset?(v=a._renderer.scale.x,B=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(v,B),y=t._size/a._renderer.scale.y,_=t._leading/a._renderer.scale.y,r.font=[t._style,t._weight,y+"px/",_+"px",t._family].join(" "),b=a._renderer.offset.x/a._renderer.scale.x,S=a._renderer.offset.y/a._renderer.scale.y,x=l/a._renderer.scale.x,r.lineWidth=x,r.strokeText(t.value,b,S),r.restore()):r.strokeText(t.value,0,0)),/(underline|strikethrough)/i.test(u)){const X=r.measureText(t.value);switch(u){case"underline":E=X.actualBoundingBoxDescent,N=X.actualBoundingBoxDescent;break;case"strikethrough":E=0,N=0;break}k=-X.width/2,P=X.width/2,r.lineWidth=Math.max(Math.floor(t._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(k,E),r.lineTo(P,N),r.stroke()}r.restore()},getBoundingClientRect:function(e,t){const n=_e.ctx;n.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" "),n.textAlign="center",n.textBaseline=dt.Utils.baselines[e._baseline]||e._baseline;const r=n.measureText(e._value);let s=r.width,o=1.15*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent);this._linewidth&&!_e.isHidden.test(this._stroke)&&(s+=this._linewidth*2,o+=this._linewidth*2);const a=s/2,l=o/2;switch(_e.alignments[e._alignment]||e._alignment){case _e.alignments.left:e.direction==="ltr"?(t.left=0,t.right=s):(t.left=-s,t.right=0);break;case _e.alignments.right:e.direction==="ltr"?(t.left=-s,t.right=0):(t.left=0,t.right=s);break;default:t.left=-a,t.right=a}switch(e._baseline){case"bottom":t.top=-o,t.bottom=0;break;case"top":t.top=0,t.bottom=o;break;case"baseline":t.top=-l*1.5,t.bottom=l*.5;break;default:t.top=-l,t.bottom=l}t.width=s,t.height=o,t.centroid||(t.centroid={}),t.centroid.x=a,t.centroid.y=l},render:function(e,t,n){if(!this._visible||!this._opacity)return this;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,s=t[this._renderer.type],o=r._matrix.manual||r._flagMatrix,a=this._matrix.manual||this._flagMatrix,l=this._renderer.parent!==r,c=this._flagVertices||this._flagFill||this._fill instanceof Ie&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Oe&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Te&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ie&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Oe&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Te&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(o||a||l){this._renderer.matrix||(this._renderer.matrix=new tn(9)),this._matrix.toTransformArray(!0,An),Xr(An,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof J||(this._renderer.scale=new J);let h,u;this._scale instanceof J?(h=this._scale.x*r._renderer.scale.x,u=this._scale.y*r._renderer.scale.y):(h=this._scale*r._renderer.scale.x,u=this._scale*r._renderer.scale.y),this._renderer.scale.x=h<0?-h:h,this._renderer.scale.y=u<0?-u:u,l&&(this._renderer.parent=r)}if(this._mask){e.clear(e.STENCIL_BUFFER_BIT),e.enable(e.STENCIL_TEST),e.stencilFunc(e.ALWAYS,1,0),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE),e.colorMask(!1,!1,!1,!1);const h=dt.Utils.getRendererType(this._mask._renderer.type);_e[h].render.call(this._mask,e,t,this),e.stencilFunc(e.EQUAL,1,255),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.colorMask(!0,!0,!0,!0)}if(c?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,_e.text.getBoundingClientRect(this,this._renderer.rect),_e.updateTexture.call(_e,e,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;t.current!==s&&(e.useProgram(s),e.bindBuffer(e.ARRAY_BUFFER,t.buffers.position),e.vertexAttribPointer(s.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(s.position),e.bufferData(e.ARRAY_BUFFER,Ys,e.STATIC_DRAW),t.resolution.flagged||e.uniform2f(e.getUniformLocation(s,"u_resolution"),t.resolution.width,t.resolution.height),t.current=s),t.resolution.flagged&&e.uniform2f(e.getUniformLocation(s,"u_resolution"),t.resolution.width,t.resolution.height),e.bindTexture(e.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return e.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),e.uniform4f(s.rect,d.left,d.top,d.right,d.bottom),e.drawArrays(e.TRIANGLES,0,6),this._mask&&e.disable(e.STENCIL_TEST),G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(e,t){if(!(!e.canvas.getContext("2d")||!t)){if(G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),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 G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(e,t){if(!(!e.canvas.getContext("2d")||!t)){if(G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let n,r=this.center._x,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 G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(e,t){if(!e.canvas.getContext("2d"))return;G.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=e.createPattern(n,this._repeat);else if(!this._renderer.effect)return this.flagReset();if((this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof J||(this._renderer.offset=new J),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,n&&(this._renderer.offset.x+=n.width/2,this._renderer.offset.y+=n.height/2,this._scale instanceof J?(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 J||(this._renderer.scale=new J);let r,s;this._scale instanceof J?(r=this._scale.x,s=this._scale.y):(r=this._scale,s=this._scale),this._renderer.scale.x=r<0?-r:r,this._renderer.scale.y=s<0?-s:s}return G.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(e,t){const n=dt.Utils.getRendererType(t._renderer.type);if(this[n].updateCanvas.call(_e,e,t),this.canvas.width<=0||this.canvas.height<=0){t._renderer.texture&&e.deleteTexture(t._renderer.texture),delete t._renderer.texture;return}t._renderer.texture||(t._renderer.texture=e.createTexture()),e.bindTexture(e.TEXTURE_2D,t._renderer.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.canvas),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR)},program:{create:function(e,t){let n,r,s;if(n=e.createProgram(),G.each(t,function(o){e.attachShader(n,o)}),e.linkProgram(n),r=e.getProgramParameter(n,e.LINK_STATUS),!r)throw s=e.getProgramInfoLog(n),e.deleteProgram(n),new Et("unable to link program: "+s);return n}},extensions:{init:function(e){const t={},n=["EXT_texture_filter_anisotropic","WEBGL_compressed_texture_s3tc","OES_texture_float_linear","WEBGL_multisampled_render_to_texture"];for(let r=0;r<n.length;r++){const s=n[r];t[s]=_e.extensions.get(e,s)}return t},get:function(e,t){return e.getExtension(t)||e.getExtension(`MOZ_${t}`)||e.getExtension(`WEBKIT_${t}`)}},TextureRegistry:new Rr};_e.ctx=_e.canvas.getContext("2d");var ql=class extends q{constructor(e){super();let t,n,r,s;if(this.domElement=e.domElement||document.createElement("canvas"),typeof e.offscreenElement<"u"&&(_e.canvas=e.offscreenElement,_e.ctx=_e.canvas.getContext("2d")),this.scene=new Ke,this.scene.parent=this,this._renderer={type:"renderer",matrix:new tn(_m),scale:1,opacity:1},this._flagMatrix=!0,e=G.defaults(e||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=e.overdraw,t=this.ctx=this.domElement.getContext("webgl",e)||this.domElement.getContext("experimental-webgl",e),!this.ctx)throw new Et("unable to create a webgl context. Try using another renderer.");r=jt.create(t,jt.path.vertex,jt.types.vertex),s=jt.create(t,jt.path.fragment,jt.types.fragment),this.programs={current:null,buffers:{position:t.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},n=this.programs.path=_e.program.create(t,[r,s]),this.programs.text=this.programs.path,t.extensions=_e.extensions.init(t),t.renderer=this,n.position=t.getAttribLocation(n,"a_position"),n.matrix=t.getUniformLocation(n,"u_matrix"),n.rect=t.getUniformLocation(n,"u_rect");const o=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,o),t.vertexAttribPointer(n.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(n.position),t.bufferData(t.ARRAY_BUFFER,Ys,t.STATIC_DRAW),r=jt.create(t,jt.points.vertex,jt.types.vertex),s=jt.create(t,jt.points.fragment,jt.types.fragment),n=this.programs.points=_e.program.create(t,[r,s]),n.position=t.getAttribLocation(n,"a_position"),n.matrix=t.getUniformLocation(n,"u_matrix"),n.size=t.getUniformLocation(n,"u_size"),t.enable(t.BLEND),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA)}setSize(e,t,n){let r,s;const o=this.ctx;return this.width=e,this.height=t,this.ratio=typeof n>"u"?Vs(o):n,this.domElement.width=e*this.ratio,this.domElement.height=t*this.ratio,G.isObject(this.domElement.style)&&G.extend(this.domElement.style,{width:e+"px",height:t+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=e*this.ratio,s=t*this.ratio,o.viewport(0,0,r,s),this.programs.resolution.width=r,this.programs.resolution.height=s,this.programs.resolution.ratio=this.ratio,this.programs.resolution.flagged=!0,this.trigger(q.Types.resize,e,t,n)}render(){const e=this.ctx;return this.overdraw||e.clear(e.COLOR_BUFFER_BIT),_e.group.render.call(this.scene,e,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};w(ql,"Utils",_e);var wm=G.extend({Error:Et,getRatio:Vs,read:Le,xhr:Ol},G,wt,Da,Ha),ir=class{constructor(e){w(this,"_events",new q),w(this,"type",""),w(this,"renderer",null),w(this,"scene",null),w(this,"width",0),w(this,"height",0),w(this,"frameCount",0),w(this,"timeDelta",0),w(this,"playing",!1);const t=G.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:ir.Types.svg,autostart:!1});if(G.each(t,function(n,r){/fullscreen/i.test(r)||/autostart/i.test(r)||(this[r]=n)},this),G.isElement(t.domElement)){const n=t.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+n)||(this.type=ir.Types[n])}this.renderer=new ir[this.type](this),this.setPlaying(t.autostart),this.frameCount=0,t.fullscreen?(this.fit=vm.bind(this),this.fit.domElement=window,this.fit.attached=!0,G.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),G.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),Mt.bind(this.fit.domElement,"resize",this.fit),this.fit()):t.fitted?(this.fit=km.bind(this),G.extend(this.renderer.domElement.style,{display:"block"})):typeof t.width=="number"&&typeof t.height=="number"&&(this.renderer.setSize(t.width,t.height,this.ratio),this.width=t.width,this.height=t.height),this.renderer.bind(q.Types.resize,xm.bind(this)),this.scene=this.renderer.scene,ir.Instances.push(this),t.autostart&&rr.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){return this._events.addEventListener.apply(this,arguments)}on(){return this._events.addEventListener.apply(this,arguments)}bind(){return this._events.addEventListener.apply(this,arguments)}removeEventListener(){return this._events.removeEventListener.apply(this,arguments)}off(){return this._events.removeEventListener.apply(this,arguments)}unbind(){return this._events.removeEventListener.apply(this,arguments)}dispatchEvent(){return this._events.dispatchEvent.apply(this,arguments)}trigger(){return this._events.dispatchEvent.apply(this,arguments)}listen(){return this._events.listen.apply(this,arguments)}ignore(){return this._events.ignore.apply(this,arguments)}appendTo(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,rr.init(),this.trigger(q.Types.play)}pause(){return this.playing=!1,this.trigger(q.Types.pause)}setPlaying(e){this.playing=e}release(e){let t,n,r;if(typeof e>"u")return this.release(this.scene);if(typeof e.unbind=="function"&&e.unbind(),typeof e.fill=="object"&&"unbind"in e.fill&&e.fill.unbind(),typeof e.stroke=="object"&&"unbind"in e.stroke&&e.stroke.unbind(),e.vertices)for(typeof e.vertices.unbind=="function"&&e.vertices.unbind(),t=0;t<e.vertices.length;t++)n=e.vertices[t],typeof n.unbind=="function"&&n.unbind(),n.controls&&(n.controls.left&&typeof n.controls.left.unbind=="function"&&n.controls.left.unbind(),n.controls.right&&typeof n.controls.right.unbind=="function"&&n.controls.right.unbind());if(e.children){for(t=0;t<e.children.length;t++)r=e.children[t],this.release(r);typeof e.children.unbind=="function"&&e.children.unbind()}return e}update(){const e=!!this._lastFrame,t=G.performance.now();e&&(this.timeDelta=parseFloat((t-this._lastFrame).toFixed(3))),this._lastFrame=t,this.fit&&this.fit.domElement&&!this.fit.attached&&(Mt.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());const n=this.width,r=this.height,s=this.renderer;return(n!==s.width||r!==s.height)&&s.setSize(n,r,this.ratio),this.trigger(q.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(q.Types.render,this.frameCount++)}add(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.add(e),this}remove(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.remove(e),this}clear(){return this.scene.remove(this.scene.children),this}makeLine(e,t,n,r){const s=new Lr(e,t,n,r);return this.scene.add(s),s}makeArrow(e,t,n,r,s){const o=typeof s=="number"?s:10,a=Math.atan2(r-t,n-e),l=[new ve(e,t,void 0,void 0,void 0,void 0,ne.move),new ve(n,r,void 0,void 0,void 0,void 0,ne.line),new ve(n-o*Math.cos(a-Math.PI/4),r-o*Math.sin(a-Math.PI/4),void 0,void 0,void 0,void 0,ne.line),new ve(n,r,void 0,void 0,void 0,void 0,ne.move),new ve(n-o*Math.cos(a+Math.PI/4),r-o*Math.sin(a+Math.PI/4),void 0,void 0,void 0,void 0,ne.line)],c=new xe(l,!1,!1,!0);return c.noFill(),c.cap="round",c.join="round",this.scene.add(c),c}makeRectangle(e,t,n,r){const s=new Fn(e,t,n,r);return this.scene.add(s),s}makeRoundedRectangle(e,t,n,r,s){const o=new tr(e,t,n,r,s);return this.scene.add(o),o}makeCircle(e,t,n,r){const s=new Qi(e,t,n,r);return this.scene.add(s),s}makeEllipse(e,t,n,r,s){const o=new er(e,t,n,r,s);return this.scene.add(o),o}makeStar(e,t,n,r,s){const o=new Ir(e,t,n,r,s);return this.scene.add(o),o}makeCurve(e){const t=arguments.length;if(!Array.isArray(e)){e=[];for(let o=0;o<t;o+=2){const a=arguments[o];if(typeof a!="number")break;const l=arguments[o+1];e.push(new ve(a,l))}}const n=arguments[t-1],r=new xe(e,!(typeof n=="boolean"&&n),!0),s=r.getBoundingClientRect();return r.center().translation.set(s.left+s.width/2,s.top+s.height/2),this.scene.add(r),r}makePolygon(e,t,n,r){const s=new Vr(e,t,n,r);return this.scene.add(s),s}makeArcSegment(e,t,n,r,s,o,a){const l=new Mr(e,t,n,r,s,o,a);return this.scene.add(l),l}makePoints(e){const t=arguments.length;let n=e;if(!Array.isArray(e)){n=[];for(let s=0;s<t;s+=2){const o=arguments[s];if(typeof o!="number")break;const a=arguments[s+1];n.push(new J(o,a))}}const r=new Ar(n);return this.scene.add(r),r}makePath(e){const t=arguments.length;let n=e;if(!Array.isArray(e)){n=[];for(let a=0;a<t;a+=2){const l=arguments[a];if(typeof l!="number")break;const c=arguments[a+1];n.push(new ve(l,c))}}const r=arguments[t-1],s=new xe(n,!(typeof r=="boolean"&&r)),o=s.getBoundingClientRect();return typeof o.top=="number"&&typeof o.left=="number"&&typeof o.right=="number"&&typeof o.bottom=="number"&&s.center().translation.set(o.left+o.width/2,o.top+o.height/2),this.scene.add(s),s}makeText(e,t,n,r){const s=new Ht(e,t,n,r);return this.add(s),s}makeLinearGradient(e,t,n,r){const s=Array.prototype.slice.call(arguments,4),o=new Ie(e,t,n,r,s);return this.add(o),o}makeRadialGradient(e,t,n){const r=Array.prototype.slice.call(arguments,3),s=new Oe(e,t,n,r);return this.add(s),s}makeSprite(e,t,n,r,s,o,a){const l=new Fr(e,t,n,r,s,o);return a&&l.play(),this.add(l),l}makeImageSequence(e,t,n,r,s){const o=new Dr(e,t,n,r);return s&&o.play(),this.add(o),o}makeTexture(e,t){return new Te(e,t)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const t=new Ke;return this.scene.add(t),t.add(e),t}interpret(e,t,n){const r=e.tagName.toLowerCase();if(n=typeof n<"u"?n:!0,!(r in Le))return null;const s=Le[r].call(this,e);return n?this.add(t&&s instanceof Ke?s.children:s):s.parent&&s.remove(),s}load(e,t){const n=new Ke;let r,s,o;const a=(function(l){for(Mt.temp.innerHTML=l,s=0;s<Mt.temp.children.length;s++)r=Mt.temp.children[s],o=this.interpret(r,!1,!1),o!==null&&n.add(o);if(typeof t=="function"){const c=Mt.temp.children.length<=1?Mt.temp.children[0]:Mt.temp.children;t(n,c)}}).bind(this);return/\.svg$/i.test(e)?(Ol(e,a),n):(a(e),n)}},ue=ir;w(ue,"NextFrameId",vt.NextFrameId),w(ue,"Types",vt.Types),w(ue,"Version",vt.Version),w(ue,"PublishDate",vt.PublishDate),w(ue,"Identifier",vt.Identifier),w(ue,"Resolution",vt.Resolution),w(ue,"AutoCalculateImportedMatrices",vt.AutoCalculateImportedMatrices),w(ue,"Instances",vt.Instances),w(ue,"uniqueId",vt.uniqueId),w(ue,"Anchor",ve),w(ue,"Collection",Nn),w(ue,"Events",q),w(ue,"Group",Ke),w(ue,"Matrix",Gn),w(ue,"Path",xe),w(ue,"Registry",Rr),w(ue,"Element",qn),w(ue,"Shape",mn),w(ue,"Text",Ht),w(ue,"Vector",J),w(ue,"Gradient",Ue),w(ue,"ImageSequence",Dr),w(ue,"LinearGradient",Ie),w(ue,"RadialGradient",Oe),w(ue,"Sprite",Fr),w(ue,"Stop",nn),w(ue,"Texture",Te),w(ue,"ArcSegment",Mr),w(ue,"Circle",Qi),w(ue,"Ellipse",er),w(ue,"Line",Lr),w(ue,"Points",Ar),w(ue,"Polygon",Vr),w(ue,"Rectangle",Fn),w(ue,"RoundedRectangle",tr),w(ue,"Star",Ir),w(ue,"CanvasRenderer",dt),w(ue,"SVGRenderer",Wl),w(ue,"WebGLRenderer",ql),w(ue,"Commands",ne),w(ue,"Utils",wm);function vm(){const e=document.body.getBoundingClientRect(),t=this.width=e.width,n=this.height=e.height;this.renderer.setSize(t,n,this.ratio)}function km(){const e=this.renderer.domElement.parentElement;if(!e){console.warn("Two.js: Attempting to fit to parent, but no parent found.");return}const t=e.getBoundingClientRect(),n=this.width=t.width,r=this.height=t.height;this.renderer.setSize(n,r,this.ratio)}function xm(e,t){this.width=e,this.height=t,this.trigger(q.Types.resize,e,t)}var rr=Mt.getRequestAnimationFrame();function Xl(){for(let e=0;e<ue.Instances.length;e++){const t=ue.Instances[e];t.playing&&t.update()}ue.NextFrameId=rr(Xl)}rr.init=function(){Xl(),rr.init=function(){}};let sn;typeof window<"u"?sn=window:typeof global<"u"?sn=global:typeof self<"u"&&(sn=self);let Yl;const ni=Math.PI*2,it=Math.PI*.5;function Cm(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 Sm(e){Yl=e}function Bm(e,t){t=t&&t.identity()||new Yl;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 on(e,t,n){return n*(t-e)+e}function Ri(e,t){for(;e<0;)e+=t;return e%t}const Ul=sn.Float32Array||Array,Tm=Math.floor;function an(e){return Tm(e*1e6)/1e6}const pe={move:"M",line:"L",curve:"C",close:"Z"};class K{constructor(){C(this,"_events",{});C(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}}C(K,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),C(K,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Gl={x:{enumerable:!0,get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this._bound&&this.dispatchEvent(K.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this._bound&&this.dispatchEvent(K.Types.change))}}},ot=class ot extends K{constructor(n=0,r=0){super();C(this,"_x",0);C(this,"_y",0);for(let s in Gl)Object.defineProperty(this,s,Gl[s]);this.x=n,this.y=r}static add(n,r){return new ot(n.x+r.x,n.y+r.y)}static sub(n,r){return new ot(n.x-r.x,n.y-r.y)}static subtract(n,r){return ot.sub(n,r)}static ratioBetween(n,r){return(n.x*r.x+n.y*r.y)/(n.length()*r.length())}static angleBetween(n,r){if(arguments.length>=4){const a=arguments[0]-arguments[2],l=arguments[1]-arguments[3];return Math.atan2(l,a)}const s=n.x-r.x,o=n.y-r.y;return Math.atan2(o,s)}static distanceBetween(n,r){return Math.sqrt(ot.distanceBetweenSquared(n,r))}static distanceBetweenSquared(n,r){const s=n.x-r.x,o=n.y-r.y;return s*s+o*o}set(n,r){return this.x=n,this.y=r,this}copy(n){return this.x=n.x,this.y=n.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new ot(this.x,this.y)}add(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x+=n,this.y+=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x+=n.x,this.y+=n.y):(this.x+=n,this.y+=r),this)}addSelf(n){return this.add.apply(this,arguments)}sub(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x-=n,this.y-=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x-=n.x,this.y-=n.y):(this.x-=n,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(n){return this.sub.apply(this,arguments)}subtractSelf(n){return this.sub.apply(this,arguments)}multiply(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x*=n,this.y*=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x*=n.x,this.y*=n.y):(this.x*=n,this.y*=r),this)}multiplySelf(n){return this.multiply.apply(this,arguments)}multiplyScalar(n){return this.multiply(n)}divide(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x/=n,this.y/=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x/=n.x,this.y/=n.y):(this.x/=n,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(n){return this.divide.apply(this,arguments)}divideScalar(n){return this.divide(n)}negate(){return this.multiply(-1)}dot(n){return this.x*n.x+this.y*n.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(n){return Math.sqrt(this.distanceToSquared(n))}distanceToSquared(n){const r=this.x-n.x,s=this.y-n.y;return r*r+s*s}setLength(n){return this.normalize().multiplyScalar(n)}equals(n,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(n)<r}lerp(n,r){const s=(n.x-this.x)*r+this.x,o=(n.y-this.y)*r+this.y;return this.set(s,o)}isZero(n){return n=typeof n>"u"?1e-4:n,this.length()<n}toString(){return this.x+", "+this.y}toObject(){return{x:an(this.x),y:an(this.y)}}rotate(n){const r=this.x,s=this.y,o=Math.cos(n),a=Math.sin(n);return this.x=r*o-s*a,this.y=r*a+s*o,this}};C(ot,"zero",new ot),C(ot,"left",new ot(-1,0)),C(ot,"right",new ot(1,0)),C(ot,"up",new ot(0,-1)),C(ot,"down",new ot(0,1));let we=ot;class Ee extends we{constructor(n=0,r=0,s=0,o=0,a=0,l=0,c=pe.move){super(n,r);C(this,"controls",{left:new we,right:new we});C(this,"_command",pe.move);C(this,"_relative",!0);C(this,"_rx",0);C(this,"_ry",0);C(this,"_xAxisRotation",0);C(this,"_largeArcFlag",0);C(this,"_sweepFlag",1);for(let h in Kl)Object.defineProperty(this,h,Kl[h]);this.command=c,this.relative=!0;const d=Ee.makeBroadcast(this);this.controls.left.set(s,o).addEventListener(K.Types.change,d),this.controls.right.set(a,l).addEventListener(K.Types.change,d)}static makeBroadcast(n){return r;function r(){n._bound&&n.dispatchEvent(K.Types.change)}}static fromObject(n){return new Ee().copy(n)}copy(n){return this.x=n.x,this.y=n.y,typeof n.command=="string"&&(this.command=n.command),n.controls&&(n.controls.left&&this.controls.left.copy(n.controls.left),n.controls.right&&this.controls.right.copy(n.controls.right)),typeof n.relative=="boolean"&&(this.relative=n.relative),typeof n.rx=="number"&&(this.rx=n.rx),typeof n.ry=="number"&&(this.ry=n.ry),typeof n.xAxisRotation=="number"&&(this.xAxisRotation=n.xAxisRotation),typeof n.largeArcFlag=="number"&&(this.largeArcFlag=n.largeArcFlag),typeof n.sweepFlag=="number"&&(this.sweepFlag=n.sweepFlag),this}clone(){return new Ee().copy(this)}toObject(){return{x:an(this.x),y:an(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:an(this.rx),ry:an(this.ry),xAxisRotation:an(this.xAxisRotation),largeArcFlag:an(this.largeArcFlag),sweepFlag:an(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const Kl={command:{enumerable:!0,get:function(){return this._command},set:function(e){this._command!==e&&(this._command=e,this._bound&&this.dispatchEvent(K.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(e){this._relative!==!!e&&(this._relative=!!e,this._bound&&this.dispatchEvent(K.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(e){this._rx!==e&&(this._rx=e,this._bound&&this.dispatchEvent(K.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(e){this._ry!==e&&(this._ry=e,this._bound&&this.dispatchEvent(K.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(e){this._xAxisRotation!==e&&(this._xAxisRotation=e,this._bound&&this.dispatchEvent(K.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(e){this._largeArcFlag!==e&&(this._largeArcFlag=e,this._bound&&this.dispatchEvent(K.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(e){this._sweepFlag!==e&&(this._sweepFlag=e,this._bound&&this.dispatchEvent(K.Types.change))}}};let Em=0;const Us={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return Em++}},Yr={RecursionLimit:16,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 Ur(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 Zl(e,t,n,r,s,o,a,l,c){c=c||Yr.RecursionLimit;const d=c+1;if(Math.abs(e-a)<.001&&Math.abs(t-l)<.001)return[new Ee(a,l)];const h=[];for(let u=0;u<d;u++){const p=u/d,f=Ur(p,e,n,s,a),g=Ur(p,t,r,o,l);h.push(new Ee(f,g))}return h}function Rm(e,t,n,r,s,o,a,l,c){if(e===n&&t===r&&s===a&&o===l){const y=a-e,_=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),p=9*(r-o)+3*(l-t),f=6*(t+o)-12*r,g=3*(r-t);function m(y){const _=(d*y+h)*y+u,b=(p*y+f)*y+g;return Math.sqrt(_*_+b*b)}return Nm(m,0,1,c||Yr.RecursionLimit)}function $m(e,t,n,r,s,o,a,l){const c=[],d=[[],[]];let h,u,p,f,g,m,y,_;for(let v=0;v<2;++v){if(v==0?(u=6*e-12*n+6*s,h=-3*e+9*n-9*s+3*a,p=3*n-3*e):(u=6*t-12*r+6*o,h=-3*t+9*r-9*o+3*l,p=3*r-3*t),Math.abs(h)<1e-12){if(Math.abs(u)<1e-12)continue;f=-p/u,0<f&&f<1&&c.push(f);continue}y=u*u-4*p*h,_=Math.sqrt(y),!(y<0)&&(g=(-u+_)/(2*h),0<g&&g<1&&c.push(g),m=(-u-_)/(2*h),0<m&&m<1&&c.push(m))}let b=c.length,S=b,x;for(;b--;)f=c[b],x=1-f,d[0][b]=x*x*x*e+3*x*x*f*n+3*x*f*f*s+f*f*f*a,d[1][b]=x*x*x*t+3*x*x*f*r+3*x*f*f*o+f*f*f*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 Nm(e,t,n,r){let s=Yr.abscissas[r-2],o=Yr.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 Pm(e,t){const n=e.length,r=n-1;for(let s=0;s<n;s++){const o=e[s],a=t?Ri(s-1,n):Math.max(s-1,0),l=t?Ri(s+1,n):Math.min(s+1,r),c=e[a],d=o,h=e[l];Fm(c,d,h),d.command=s===0?pe.move:pe.curve}}function Fm(e,t,n){const r=we.angleBetween(e,t),s=we.angleBetween(n,t);let o=we.distanceBetween(e,t),a=we.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+=it:l-=it,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)}let sr=(_i=class extends K{constructor(){super();C(this,"_flagId",!1);C(this,"_flagClassName",!1);C(this,"_renderer",{});C(this,"_id",Us.Identifier+Us.uniqueId());C(this,"_className","");C(this,"classList",[]);for(let n in Jl)Object.defineProperty(this,n,Jl[n])}static fromObject(n){const r=new _i().copy(n);return"id"in n&&(r.id=n.id),r}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(n){return this.renderer.type=n.renderer.type,this.className=n.className,this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}},C(_i,"Properties",["renderer","id","className"]),_i);const Jl={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)}}};class Gr extends Error{constructor(n){super();C(this,"name","Two.js");C(this,"message");this.message=n}}class Mm{constructor(){C(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}}let Kr;const Ql={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};sn.document&&(Kr=document.createElement("a"));const We=class We extends sr{constructor(n,r){super();C(this,"_flagSrc",!1);C(this,"_flagImage",!1);C(this,"_flagVideo",!1);C(this,"_flagLoaded",!1);C(this,"_flagRepeat",!1);C(this,"_flagOffset",!1);C(this,"_flagScale",!1);C(this,"_src","");C(this,"_image",null);C(this,"_loaded",!1);C(this,"_repeat","no-repeat");C(this,"_scale",1);C(this,"_offset",null);for(let s in ec)Object.defineProperty(this,s,ec[s]);if(this._renderer.type="texture",this._renderer.flagOffset=Am.bind(this),this._renderer.flagScale=Vm.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new we,typeof r=="function"){const s=(function(){this.unbind(K.Types.load,s),typeof r=="function"&&r()}).bind(this);this.bind(K.Types.load,s)}if(typeof n=="string")this.src=n;else if(typeof n=="object"){const s=Object.prototype.toString.call(n);(s==="[object HTMLImageElement]"||s==="[object HTMLCanvasElement]"||s==="[object HTMLVideoElement]"||s==="[object Image]")&&(this.image=n)}this._update()}fromObject(n){const r=new We().copy(n);return"id"in n&&(r.id=n.id),r}static getAbsoluteURL(n){return Kr?(Kr.href=n,Kr.href):n}static loadHeadlessBuffer(n,r){n.image.onload=r,n.image.src=n.src}static getTag(n){return n&&n.nodeName&&n.nodeName.toLowerCase()||"img"}static getImage(n){const r=We.getAbsoluteURL(n);if(We.ImageRegistry.contains(r))return We.ImageRegistry.get(r);let s;return sn.document?Ql.video.test(r)?s=document.createElement("video"):s=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),s.crossOrigin="anonymous",s.referrerPolicy="no-referrer",s}static load(n,r){let s=n.image,o=We.getTag(s);n._flagImage&&(/canvas/i.test(o)?We.Register.canvas(n,r):(n._src=s.getAttribute("two-src")||s.src,We.Register[o](n,r))),n._flagSrc&&(s||(s=We.getImage(n.src),n.image=s),o=We.getTag(s),We.Register[o](n,r))}clone(){const n=new We(this.src);return n.repeat=this.repeat,n.offset.copy(this.offset),n.scale=this.scale,n}copy(n){return this.src=n.src,this.repeat=n.repeat,this.offset=typeof n.offset=="number"||n.offset instanceof we?n.offset:new we().copy(n.offset),this.scale=typeof n.scale=="number"||n.scale instanceof we?n.scale:new we().copy(n.scale),this}toObject(){const n=super.toObject.call(this);return n.renderer.type="texture",n.src=this.src,n.repeat=this.repeat,n.offset=this.offset.toObject(),n.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),n}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(K.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,We.load(this,(function(){this.loaded=!0,this.trigger(K.Types.change).trigger(K.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 n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};C(We,"Properties",["src","loaded","repeat","scale","offset","image"]),C(We,"RegularExpressions",Ql),C(We,"ImageRegistry",new Mm),C(We,"Register",{canvas:function(n,r){n._src="#"+n.id,We.ImageRegistry.add(n.src,n.image),typeof r=="function"&&r()},img:function(n,r){const s=n.image,o=function(l){s.removeEventListener&&typeof s.removeEventListener=="function"&&(s.removeEventListener("load",o,!1),s.removeEventListener("error",a,!1)),typeof r=="function"&&r()},a=function(l){throw typeof s.removeEventListener=="function"&&(s.removeEventListener("load",o,!1),s.removeEventListener("error",a,!1)),new Gr("unable to load "+n.src)};typeof s.width=="number"&&s.width>0&&typeof s.height=="number"&&s.height>0?o():typeof s.addEventListener=="function"&&(s.addEventListener("load",o,!1),s.addEventListener("error",a,!1)),n._src=We.getAbsoluteURL(n._src),!(s&&s.getAttribute("two-src"))&&(s.setAttribute("two-src",n.src),We.ImageRegistry.add(n.src,s),n.image.src=n.src)},video:function(n,r){const s=function(a){n.image.removeEventListener("canplaythrough",s,!1),n.image.removeEventListener("error",o,!1),n.image.width=n.image.videoWidth,n.image.height=n.image.videoHeight,typeof r=="function"&&r()},o=function(a){throw n.image.removeEventListener("canplaythrough",s,!1),n.image.removeEventListener("error",o,!1),new Gr("unable to load "+n.src)};n._src=We.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),We.ImageRegistry.add(n.src,n.image)),n.image.readyState>=4?s():(n.image.addEventListener("canplaythrough",s,!1),n.image.addEventListener("error",o,!1),n.image.src=n.src,n.image.load())}});let rt=We;const ec={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=rt.getTag(e);let n;switch(t){case"canvas":n="#"+e.id;break;default:n=e.src}rt.ImageRegistry.contains(n)?this._image=rt.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(K.Types.change,this._renderer.flagOffset),this._offset=e,this._offset.bind(K.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof we&&this._scale.unbind(K.Types.change,this._renderer.flagScale),this._scale=e,this._scale instanceof we&&this._scale.bind(K.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Am(){this._flagOffset=!0}function Vm(){this._flagScale=!0}class $i extends Array{constructor(){super();pa(this,at,new K);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 Bt(this,at)}set _events(n){Wh(this,at,n)}get _bound(){return Bt(this,at)._bound}set _bound(n){Bt(this,at)._bound=n}addEventListener(){return Bt(this,at).addEventListener.apply(this,arguments)}on(){return Bt(this,at).on.apply(this,arguments)}bind(){return Bt(this,at).bind.apply(this,arguments)}removeEventListener(){return Bt(this,at).removeEventListener.apply(this,arguments)}off(){return Bt(this,at).off.apply(this,arguments)}unbind(){return Bt(this,at).unbind.apply(this,arguments)}dispatchEvent(){return Bt(this,at).dispatchEvent.apply(this,arguments)}trigger(){return Bt(this,at).trigger.apply(this,arguments)}listen(){return Bt(this,at).listen.apply(this,arguments)}ignore(){return Bt(this,at).ignore.apply(this,arguments)}pop(){const n=super.pop.apply(this,arguments);return this.trigger(K.Types.remove,[n]),n}shift(){const n=super.shift.apply(this,arguments);return this.trigger(K.Types.remove,[n]),n}push(){const n=super.push.apply(this,arguments);return this.trigger(K.Types.insert,arguments),n}unshift(){const n=super.unshift.apply(this,arguments);return this.trigger(K.Types.insert,arguments),n}splice(){const n=super.splice.apply(this,arguments);if(this.trigger(K.Types.remove,n),arguments.length>2){const r=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(K.Types.insert,r),this.trigger(K.Types.order)}return n}sort(){return super.sort.apply(this,arguments),this.trigger(K.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(K.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(n,r){const s=[];for(let o=0;o<this.length;o++){const a=this[o];let l;r?l=n.call(r,a,o):l=n(a,o),s.push(l)}return s}}at=new WeakMap;const tc=Array.prototype.slice;function Im(e){if(e==null)return!1;const t=e.length;return typeof t=="number"&&t>=0&&t<4294967296}const Ve={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},isFunction:function(e){return typeof e=="function"},extend:function(e){const t=tc.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=tc.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=!Im(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:sn.performance&&sn.performance.now?sn.performance:Date},$t=class $t extends sr{constructor(n,r,s){super();C(this,"_flagOffset",!0);C(this,"_flagOpacity",!0);C(this,"_flagColor",!0);C(this,"_offset",0);C(this,"_opacity",1);C(this,"_color","#fff");for(let o in nc)Object.defineProperty(this,o,nc[o]);this._renderer.type="stop",this.offset=typeof n=="number"?n:$t.Index<=0?0:1,this.opacity=typeof s=="number"?s:1,this.color=typeof r=="string"?r:$t.Index<=0?"#fff":"#000",$t.Index=($t.Index+1)%2}static fromObject(n){const r=new $t().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<$t.Properties.length;r++){const s=$t.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new $t;return Ve.each($t.Properties,function(s){r[s]=this[s]},this),n&&n.stops&&n.stops.push(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="stop",Ve.each($t.Properties,r=>{n[r]=this[r]},this),n}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};C($t,"Index",0),C($t,"Properties",["offset","opacity","color"]);let ii=$t;const nc={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 hn extends sr{constructor(n){super();C(this,"_flagStops",!1);C(this,"_flagSpread",!1);C(this,"_flagUnits",!1);C(this,"_spread","");C(this,"_units","");for(let r in ic)Object.defineProperty(this,r,ic[r]);this._renderer.type="gradient",this._renderer.flagStops=Om.bind(this),this._renderer.bindStops=zm.bind(this),this._renderer.unbindStops=Lm.bind(this),this.spread="pad",this.units="objectBoundingBox",n&&(this.stops=n)}static fromObject(n){let r=n.stops;r&&r.length>0&&(r=r.map(o=>o instanceof ii?o:new ii().copy(o)));const s=new hn().copy(n);return"id"in n&&(s.id=n.id),s}clone(n){const r=this.stops.map(o=>o.clone()),s=new hn(r);return Ve.each(hn.Properties,o=>{s[o]=this[o]},this),n&&n.add(s),s}copy(n){super.copy.call(this,n);for(let r=0;r<hn.Properties.length;r++){const s=hn.Properties[r];s in n&&(this[s]=n[s])}return this}toObject(){const n={stops:this.stops.map(r=>r.toObject())};return Ve.each(hn.Properties,r=>{n[r]=this[r]},this),n}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(K.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};C(hn,"Stop",ii),C(hn,"Properties",["spread","stops","units"]);let et=hn;const ic={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(K.Types.insert,t).unbind(K.Types.remove,n),this._stops=new $i((e||[]).slice(0)),this._stops.bind(K.Types.insert,t).bind(K.Types.remove,n),t(this._stops)}}};function Om(){this._flagStops=!0}function zm(e){let t=e.length;for(;t--;)e[t].bind(K.Types.change,this._renderer.flagStops),e[t].parent=this;this._renderer.flagStops()}function Lm(e){let t=e.length;for(;t--;)e[t].unbind(K.Types.change,this._renderer.flagStops),delete e[t].parent;this._renderer.flagStops()}const Dn=class Dn extends et{constructor(n,r,s,o,a){super(a);C(this,"_flagEndPoints",!1);C(this,"_left",null);C(this,"_right",null);for(let l in rc)Object.defineProperty(this,l,rc[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=Dm.bind(this),this.left=new we,this.right=new we,typeof n=="number"&&(this.left.x=n),typeof r=="number"&&(this.left.y=r),typeof s=="number"&&(this.right.x=s),typeof o=="number"&&(this.right.y=o)}static fromObject(n){const r=new Dn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Dn.Properties.length;r++){const s=Dn.Properties[r];s in n&&(this[s]=n[s]instanceof we?n[s]:new we().copy(n[s]))}return this}clone(n){const r=this.stops.map(function(o){return o.clone()}),s=new Dn(this.left._x,this.left._y,this.right._x,this.right._y,r);return Ve.each(et.Properties,function(o){s[o]=this[o]},this),n&&n.add(s),s}toObject(){const n=super.toObject.call(this);return n.left=this.left.toObject(),n.right=this.right.toObject(),n}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(K.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};C(Dn,"Stop",ii),C(Dn,"Properties",["left","right"]);let kt=Dn;const rc={left:{enumerable:!0,get:function(){return this._left},set:function(e){this._left instanceof we&&this._left.unbind(K.Types.change,this._renderer.flagEndPoints),this._left=e,this._left.bind(K.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(e){this._right instanceof we&&this._right.unbind(K.Types.change,this._renderer.flagEndPoints),this._right=e,this._right.bind(K.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function Dm(){this._flagEndPoints=!0}const un=class un extends et{constructor(n,r,s,o,a,l){super(o);C(this,"_flagRadius",!1);C(this,"_flagCenter",!1);C(this,"_flagFocal",!1);C(this,"_radius",0);C(this,"_center",null);C(this,"_focal",null);for(let c in sc)Object.defineProperty(this,c,sc[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Hm.bind(this),this._renderer.flagFocal=Wm.bind(this),this.center=new we,this.radius=typeof s=="number"?s:1,this.focal=new we,typeof n=="number"&&(this.center.x=n),typeof r=="number"&&(this.center.y=r),this.focal.copy(this.center),typeof a=="number"&&(this.focal.x=a),typeof l=="number"&&(this.focal.y=l)}static fromObject(n){const r=new un().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<un.Properties.length;r++){const s=un.Properties[r];s in n&&(/(center|focal)i/.test(s)?this[s]=n[s]instanceof we?n[s]:new we().copy(n[s]):typeof n[s]=="number"&&(this[s]=n[MediaKeySystemAccess]))}return this}clone(n){const r=this.stops.map(function(o){return o.clone()}),s=new un(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return Ve.each(et.Properties.concat(un.Properties),function(o){s[o]=this[o]},this),n&&n.add(s),s}toObject(){const n=super.toObject.call(this);return Ve.each(un.Properties,function(r){n[r]=this[r]},this),n.center=this.center.toObject(),n.focal=this.focal.toObject(),n}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(K.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};C(un,"Stop",ii),C(un,"Properties",["center","radius","focal"]);let xt=un;const sc={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(K.Types.change,this._renderer.flagCenter),this._center=e,this._center.bind(K.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(e){this._focal&&this._focal.unbind(K.Types.change,this._renderer.flagFocal),this._focal=e,this._focal.bind(K.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function Hm(){this._flagCenter=!0}function Wm(){this._flagFocal=!0}function oc(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 Zr(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 ac(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,p=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(p||e).x,d=(p||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),p&&e._relative&&(o+=e.x,d+=e.y),Rm(r,l,s,c,o,d,a,h,n)}function lc(e,t,n){let r,s,o,a,l,c,d,h;const u=t.controls&&t.controls.right,p=e.controls&&e.controls.left;return r=t.x,l=t.y,s=(u||t).x,c=(u||t).y,o=(p||e).x,d=(p||e).y,a=e.x,h=e.y,u&&t._relative&&(s+=t.x,c+=t.y),p&&e._relative&&(o+=e.x,d+=e.y),Zl(r,l,s,c,o,d,a,h,n)}function ri(e){switch(e.renderer.type){case"texture":return rt.fromObject(e);case"gradient":return et.fromObject(e);case"linear-gradient":return kt.fromObject(e);case"radial-gradient":return xt.fromObject(e)}return e}const jm=Math.cos,qm=Math.sin,cc=Math.tan,Gs=[],St=class St extends K{constructor(n,r,s,o,a,l){super();C(this,"elements",new Ul(9));C(this,"manual",!1);let c=n;Array.isArray(c)||(c=Array.prototype.slice.call(arguments)),this.identity(),c.length>0&&this.set(c)}static Multiply(n,r,s){if(r.length<=3){const k=n;let E,P,N;const j=r[0]||0,X=r[1]||0,A=r[2]||0;return E=k[0]*j+k[1]*X+k[2]*A,P=k[3]*j+k[4]*X+k[5]*A,N=k[6]*j+k[7]*X+k[8]*A,[E,P,N]}const o=n[0],a=n[1],l=n[2],c=n[3],d=n[4],h=n[5],u=n[6],p=n[7],f=n[8],g=r[0],m=r[1],y=r[2],_=r[3],b=r[4],S=r[5],x=r[6],v=r[7],B=r[8];return s=s||new Ul(9),s[0]=o*g+a*_+l*x,s[1]=o*m+a*b+l*v,s[2]=o*y+a*S+l*B,s[3]=c*g+d*_+h*x,s[4]=c*m+d*b+h*v,s[5]=c*y+d*S+h*B,s[6]=u*g+p*_+f*x,s[7]=u*m+p*b+f*v,s[8]=u*y+p*S+f*B,s}static fromObject(n){return new St().copy(n)}set(n,r,s,o,a,l,c,d,h){if(typeof r>"u"){const u=n;n=u[0],r=u[1],s=u[2],o=u[3],a=u[4],l=u[5],c=u[6],d=u[7],h=u[8]}return this.elements[0]=n,this.elements[1]=r,this.elements[2]=s,this.elements[3]=o,this.elements[4]=a,this.elements[5]=l,this.elements[6]=c,this.elements[7]=d,this.elements[8]=h,this.trigger(K.Types.change)}copy(n){return this.elements[0]=n.elements[0],this.elements[1]=n.elements[1],this.elements[2]=n.elements[2],this.elements[3]=n.elements[3],this.elements[4]=n.elements[4],this.elements[5]=n.elements[5],this.elements[6]=n.elements[6],this.elements[7]=n.elements[7],this.elements[8]=n.elements[8],this.manual=n.manual,this.trigger(K.Types.change)}identity(){return this.elements[0]=St.Identity[0],this.elements[1]=St.Identity[1],this.elements[2]=St.Identity[2],this.elements[3]=St.Identity[3],this.elements[4]=St.Identity[4],this.elements[5]=St.Identity[5],this.elements[6]=St.Identity[6],this.elements[7]=St.Identity[7],this.elements[8]=St.Identity[8],this.trigger(K.Types.change)}multiply(n,r,s,o,a,l,c,d,h){if(typeof r>"u")return this.elements[0]*=n,this.elements[1]*=n,this.elements[2]*=n,this.elements[3]*=n,this.elements[4]*=n,this.elements[5]*=n,this.elements[6]*=n,this.elements[7]*=n,this.elements[8]*=n,this.trigger(K.Types.change);if(typeof s>"u"&&(s=1),typeof o>"u"){n=n||0,r=r||0,s=s||0,a=this.elements;const L=a[0]*n+a[1]*r+a[2]*s,Z=a[3]*n+a[4]*r+a[5]*s,F=a[6]*n+a[7]*r+a[8]*s;return[L,Z,F]}const u=this.elements,p=[n,r,s,o,a,l,c,d,h],f=u[0],g=u[1],m=u[2],y=u[3],_=u[4],b=u[5],S=u[6],x=u[7],v=u[8],B=p[0],k=p[1],E=p[2],P=p[3],N=p[4],j=p[5],X=p[6],A=p[7],V=p[8];return this.elements[0]=f*B+g*P+m*X,this.elements[1]=f*k+g*N+m*A,this.elements[2]=f*E+g*j+m*V,this.elements[3]=y*B+_*P+b*X,this.elements[4]=y*k+_*N+b*A,this.elements[5]=y*E+_*j+b*V,this.elements[6]=S*B+x*P+v*X,this.elements[7]=S*k+x*N+v*A,this.elements[8]=S*E+x*j+v*V,this.trigger(K.Types.change)}inverse(n){const r=this.elements;n=n||new St;const s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],d=r[5],h=r[6],u=r[7],p=r[8],f=p*c-d*u,g=-p*l+d*h,m=u*l-c*h;let y=s*f+o*g+a*m;return y?(y=1/y,n.elements[0]=f*y,n.elements[1]=(-p*o+a*u)*y,n.elements[2]=(d*o-a*c)*y,n.elements[3]=g*y,n.elements[4]=(p*s-a*h)*y,n.elements[5]=(-d*s+a*l)*y,n.elements[6]=m*y,n.elements[7]=(-u*s+o*h)*y,n.elements[8]=(c*s-o*l)*y,n):null}scale(n,r){return arguments.length<=1&&(r=n),this.multiply(n,0,0,0,r,0,0,0,1)}rotate(n){const r=jm(n),s=qm(n);return this.multiply(r,-s,0,s,r,0,0,0,1)}translate(n,r){return this.multiply(1,0,n,0,1,r,0,0,1)}skewX(n){const r=cc(n);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(n){const r=cc(n);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(n){return Gs.length=0,this.toTransformArray(n,Gs),Gs.map(an).join(" ")}toTransformArray(n,r){const s=this.elements,o=!!r,a=s[0],l=s[1],c=s[2],d=s[3],h=s[4],u=s[5];if(n){const p=s[6],f=s[7],g=s[8];if(o){r[0]=a,r[1]=d,r[2]=p,r[3]=l,r[4]=h,r[5]=f,r[6]=c,r[7]=u,r[8]=g;return}return[a,d,p,l,h,f,c,u,g]}if(o){r[0]=a,r[1]=d,r[2]=l,r[3]=h,r[4]=c,r[5]=u;return}return[a,d,l,h,c,u]}toArray(n,r){const s=this.elements,o=!!r,a=s[0],l=s[1],c=s[2],d=s[3],h=s[4],u=s[5];if(n){const p=s[6],f=s[7],g=s[8];if(o){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=h,r[5]=u,r[6]=p,r[7]=f,r[8]=g;return}return[a,l,c,d,h,u,p,f,g]}if(o){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=h,r[5]=u;return}return[a,l,c,d,h,u]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new St().copy(this)}};C(St,"Identity",[1,0,0,0,1,0,0,0,1]);let or=St;Sm(or);const vr=class vr extends sr{constructor(){super();C(this,"_flagMatrix",!0);C(this,"_flagScale",!1);C(this,"_matrix",null);C(this,"_worldMatrix",null);C(this,"_position",null);C(this,"_rotation",0);C(this,"_scale",1);C(this,"_skewX",0);C(this,"_skewY",0);for(let n in Jr)Object.defineProperty(this,n,Jr[n]);this._renderer.flagMatrix=dc.bind(this),this.isShape=!0,this.matrix=new or,this.worldMatrix=new or,this.position=new we,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(n){const r=new vr().copy(n);return"id"in n&&(r.id=n.id),r}get renderer(){return this._renderer}set renderer(n){this._renderer=n}get translation(){return Jr.position.get.apply(this,arguments)}set translation(n){Jr.position.set.apply(this,arguments)}addTo(n){return n.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}copy(n){return super.copy.call(this,n),"position"in n&&(n.position instanceof we?this.position=n.position:this.position.copy(n.position)),"rotation"in n&&(this.rotation=n.rotation),"scale"in n&&(this.scale=typeof n.scale=="number"||n.scale instanceof we?n.scale:new we(n.scale.x,n.scale.y)),"skewX"in n&&(this.skewX=n.skewX),"skewY"in n&&(this.skewY=n.skewY),"matrix"in n&&n.matrix.manual&&(this.matrix.copy(n.matrix),this.matrix.manual=!0),this}clone(n){const r=new vr;return r.position.copy(this.position),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer={type:"shape"},n.isShape=!0,n.translation=this.translation.toObject(),n.rotation=this.translation.rotation,n.scale=this.scale instanceof we?this.scale.toObject():this.scale,n.skewX=this.skewX,n.skewY=this.skewY,n.matrix=this.matrix.toObject(),n}_update(n){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof we?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),n&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};C(vr,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let yn=vr;const Jr={position:{enumerable:!0,get:function(){return this._position},set:function(e){this._position&&this._position.unbind(K.Types.change,this._renderer.flagMatrix),this._position=e,this._position.bind(K.Types.change,this._renderer.flagMatrix),dc.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 we&&this._scale.unbind(K.Types.change,this._renderer.flagMatrix),this._scale=e,this._scale instanceof we&&this._scale.bind(K.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 Bm(this,this._worldMatrix),this._worldMatrix},set:function(e){this._worldMatrix=e}}};function dc(){this._flagMatrix=!0}const Ni=Math.min,Pi=Math.max,Xm=Math.ceil,Ym=Math.floor,Um=new we,Zt=class Zt extends yn{constructor(n,r,s,o){super();C(this,"_flagVertices",!0);C(this,"_flagLength",!0);C(this,"_flagFill",!0);C(this,"_flagStroke",!0);C(this,"_flagLinewidth",!0);C(this,"_flagOpacity",!0);C(this,"_flagVisible",!0);C(this,"_flagCap",!0);C(this,"_flagJoin",!0);C(this,"_flagMiter",!0);C(this,"_flagMask",!1);C(this,"_flagClip",!1);C(this,"_length",0);C(this,"_fill","#fff");C(this,"_stroke","#000");C(this,"_linewidth",1);C(this,"_opacity",1);C(this,"_visible",!0);C(this,"_cap","round");C(this,"_join","round");C(this,"_miter",4);C(this,"_closed",!0);C(this,"_curved",!1);C(this,"_automatic",!0);C(this,"_beginning",0);C(this,"_ending",1);C(this,"_mask",null);C(this,"_clip",!1);C(this,"_dashes",null);for(let a in hc)Object.defineProperty(this,a,hc[a]);this._renderer.type="path",this._renderer.flagVertices=uc.bind(this),this._renderer.bindVertices=fc.bind(this),this._renderer.unbindVertices=pc.bind(this),this._renderer.flagFill=gc.bind(this),this._renderer.flagStroke=mc.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!r,this.curved=!!s,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=n,this.automatic=!o,this.dashes=[],this.dashes.offset=0}static fromObject(n){const r=typeof n.fill=="string"?n.fill:ri(n.fill),s=typeof n.stroke=="string"?n.stroke:ri(n.stroke),o=new Zt().copy({...n,fill:r,stroke:s});return"id"in n&&(o.id=n.id),o}copy(n){super.copy.call(this,n),this.vertices=[];for(let r=0;r<n.vertices.length;r++){const s=n.vertices[r];s instanceof Ee?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Ee().copy(s))}for(let r=0;r<Zt.Properties.length;r++){const s=Zt.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new Zt;for(let s=0;s<this.vertices.length;s++)r.vertices.push(this.vertices[s].clone());for(let s=0;s<Zt.Properties.length;s++){const o=Zt.Properties[s];r[o]=this[o]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="path",n.vertices=this.vertices.map(r=>r.toObject()),Ve.each(Zt.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const n=this.getBoundingClientRect(!0),r=n.width/2,s=n.height/2,o=n.left+n.width/2,a=n.top+n.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=o,c.y-=a,c.x+=r,c.y+=s}return this.mask&&(this.mask.translation.x-=o,this.mask.translation.x+=r,this.mask.translation.y-=a,this.mask.translation.y+=s),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,s=n.top+n.height/2-this.translation.y;for(let o=0;o<this.vertices.length;o++){const a=this.vertices[o];a.x-=r,a.y-=s}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=s),this}getBoundingClientRect(n){let r,s,o,a,l,c,d=1/0,h=-1/0,u=1/0,p=-1/0;if(this._update(!0),r=n?this.matrix:this.worldMatrix,s=(this.linewidth||0)/2,o=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:f,scaleY:g}=Cm(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof f=="number"&&typeof g=="number"&&(s=Math.max(f,g)*(this.linewidth||0)/2)}else s*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(o<=0)return{width:0,height:0};for(a=0;a<o;a++){c=this._renderer.vertices[a],l=this._renderer.vertices[(a+o-1)%o];const[f,g]=r.multiply(l.x,l.y),[m,y]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let _=l.controls.right.x,b=l.controls.right.y;l.relative&&(_+=l.x,b+=l.y);let[S,x]=r.multiply(_,b),v=c.controls.left.x,B=c.controls.left.y;c.relative&&(v+=c.x,B+=c.y);let[k,E]=r.multiply(v,B);const P=$m(f,g,S,x,k,E,m,y);u=Ni(P.min.y-s,u),d=Ni(P.min.x-s,d),h=Pi(P.max.x+s,h),p=Pi(P.max.y+s,p)}else a<=1&&(u=Ni(g-s,u),d=Ni(f-s,d),h=Pi(f+s,h),p=Pi(g+s,p)),u=Ni(y-s,u),d=Ni(m-s,d),h=Pi(m+s,h),p=Pi(y+s,p)}return{top:u,left:d,right:h,bottom:p,width:h-d,height:p-u}}getPointAt(n,r){let s,o,a,l,c,d,h,u,p,f,g,m,y,_,b,S=this.length*Math.min(Math.max(n,0),1);const x=this.vertices.length,v=x-1;let B=null,k=null;for(let R=0,$=this._lengths.length,M=0;R<$;R++){if(M+this._lengths[R]>=S){this._closed?(s=Ri(R,x),o=Ri(R-1,x),R===0&&(s=o,o=R)):(s=R,o=Math.min(Math.max(R-1,0),v)),B=this.vertices[s],k=this.vertices[o],S-=M,this._lengths[R]!==0?n=S/this._lengths[R]:n=0;break}M+=this._lengths[R]}if(B===null||k===null)return null;if(B){if(!k)return B}else return k;b=k.controls&&k.controls.right,_=B.controls&&B.controls.left,c=k.x,f=k.y,d=(b||k).x,g=(b||k).y,h=(_||B).x,m=(_||B).y,u=B.x,y=B.y,b&&k.relative&&(d+=k.x,g+=k.y),_&&B.relative&&(h+=B.x,m+=B.y),l=Ur(n,c,d,h,u),p=Ur(n,f,g,m,y);const E=on(c,d,n),P=on(f,g,n),N=on(d,h,n),j=on(g,m,n),X=on(h,u,n),A=on(m,y,n),V=on(E,N,n),L=on(P,j,n),Z=on(N,X,n),F=on(j,A,n);return Ve.isObject(r)?(r.x=l,r.y=p,r instanceof Ee&&(r.controls.left.x=V,r.controls.left.y=L,r.controls.right.x=Z,r.controls.right.y=F,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=p,r.controls.right.x-=l,r.controls.right.y-=p)),r.t=n,r):(a=new Ee(l,p,V-l,L-p,Z-l,F-p,this._curved?pe.curve:pe.line),a.t=n,a)}plot(){if(this.curved)return Pm(this._collection,this.closed),this;for(let n=0;n<this._collection.length;n++)this._collection[n].command=n===0?pe.move:pe.line;return this}subdivide(n){this._update();const r=this.vertices.length-1,s=this._closed||this.vertices[r]._command===pe.close;let o=this.vertices[r],a=[],l;return Ve.each(this.vertices,function(c,d){if(d<=0&&!s){o=c;return}if(c.command===pe.move){a.push(new Ee(o.x,o.y)),d>0&&(a[a.length-1].command=pe.line),o=c;return}l=lc(c,o,n),a=a.concat(l),Ve.each(l,function(h,u){u<=0&&o.command===pe.move?h.command=pe.move:h.command=pe.line}),d>=r&&(this._closed&&this._automatic&&(o=c,l=lc(c,o,n),a=a.concat(l),Ve.each(l,function(h,u){u<=0&&o.command===pe.move?h.command=pe.move:h.command=pe.line})),a.push(new Ee(c.x,c.y)),a[a.length-1].command=s?pe.close:pe.line),o=c},this),this._automatic=!1,this._curved=!1,this.vertices=a,this}_updateLength(n,r){r||this._update();const o=this.vertices.length-1;let a=this.vertices[o],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),Ve.each(this.vertices,function(c,d){if(d<=0||c.command===pe.move){a=c,this._lengths[d]=0;return}this._lengths[d]=ac(c,a,n),l+=this._lengths[d],a=c},this),this._length=l,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const n=this._collection.length,r=this._closed,s=Math.min(this._beginning,this._ending),o=Math.max(this._beginning,this._ending),a=Zr(this,s*this._length),l=Zr(this,o*this._length),c=Xm(a),d=Ym(l);let h,u,p,f,g,m;for(this._renderer.vertices.length=0,m=0;m<n;m++)this._renderer.collection.length<=m&&this._renderer.collection.push(new Ee),m>d&&!u?(g=this._renderer.collection[m].copy(this._collection[m]),this.getPointAt(o,g),g.command=this._renderer.collection[m].command,this._renderer.vertices.push(g),u=g,p=this._collection[m-1],p&&p.controls&&(g.relative?g.controls.right.clear():g.controls.right.copy(g),p.relative?this._renderer.collection[m-1].controls.right.copy(p.controls.right).lerp(we.zero,1-g.t):this._renderer.collection[m-1].controls.right.copy(p.controls.right).lerp(p,1-g.t))):m>=c&&m<=d&&(g=this._renderer.collection[m].copy(this._collection[m]),this._renderer.vertices.push(g),m===d&&oc(this,o)?(u=g,!r&&u.controls&&(u.relative?u.controls.right.clear():u.controls.right.copy(u))):m===c&&oc(this,s)&&(h=g,h.command=pe.move,!r&&h.controls&&(h.relative?h.controls.left.clear():h.controls.left.copy(h))));c>0&&!h&&(m=c-1,g=this._renderer.collection[m].copy(this._collection[m]),this.getPointAt(s,g),g.command=pe.move,this._renderer.vertices.unshift(g),f=this._collection[m+1],f&&f.controls&&(g.controls.left.clear(),f.relative?this._renderer.collection[m+1].controls.left.copy(f.controls.left).lerp(we.zero,g.t):(Um.copy(f),this._renderer.collection[m+1].controls.left.copy(f.controls.left).lerp(f,g.t))))}return yn.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,yn.prototype.flagReset.call(this),this}};C(Zt,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes"]),C(Zt,"Utils",{getCurveLength:ac});let Re=Zt;const hc={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 et||this._fill instanceof kt||this._fill instanceof xt||this._fill instanceof rt)&&this._fill.unbind(K.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof et||this._fill instanceof kt||this._fill instanceof xt||this._fill instanceof rt)&&this._fill.bind(K.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof et||this._stroke instanceof kt||this._stroke instanceof xt||this._stroke instanceof rt)&&this._stroke.unbind(K.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof et||this._stroke instanceof kt||this._stroke instanceof xt||this._stroke instanceof rt)&&this._stroke.bind(K.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";Ve.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(K.Types.insert,t).unbind(K.Types.remove,n),e instanceof $i?this._collection=e:this._collection=new $i(e||[]),this._collection.bind(K.Types.insert,t).bind(K.Types.remove,n),t(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,Ve.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 uc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function fc(e){let t=e.length;for(;t--;)e[t].bind(K.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function pc(e){let t=e.length;for(;t--;)e[t].unbind(K.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function gc(){this._flagFill=!0}function mc(){this._flagStroke=!0}const Gm=Math.ceil,Km=Math.floor,fn=class fn extends yn{constructor(n){super();C(this,"_flagVertices",!0);C(this,"_flagLength",!0);C(this,"_flagFill",!0);C(this,"_flagStroke",!0);C(this,"_flagLinewidth",!0);C(this,"_flagOpacity",!0);C(this,"_flagVisible",!0);C(this,"_flagSize",!0);C(this,"_flagSizeAttenuation",!0);C(this,"_length",0);C(this,"_fill","#fff");C(this,"_stroke","#000");C(this,"_linewidth",1);C(this,"_opacity",1);C(this,"_visible",!0);C(this,"_size",1);C(this,"_sizeAttenuation",!1);C(this,"_beginning",0);C(this,"_ending",1);C(this,"_dashes",null);C(this,"noFill",Re.prototype.noFill);C(this,"noStroke",Re.prototype.noStroke);C(this,"corner",Re.prototype.corner);C(this,"center",Re.prototype.center);C(this,"getBoundingClientRect",Re.prototype.getBoundingClientRect);C(this,"_updateLength",Re.prototype._updateLength);for(let r in yc)Object.defineProperty(this,r,yc[r]);this._renderer.type="points",this._renderer.flagVertices=uc.bind(this),this._renderer.bindVertices=fc.bind(this),this._renderer.unbindVertices=pc.bind(this),this._renderer.flagFill=gc.bind(this),this._renderer.flagStroke=mc.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=n,this.dashes=[],this.dashes.offset=0}static fromObject(n){const r=typeof n.fill=="string"?n.fill:ri(n.fill),s=typeof n.stroke=="string"?n.stroke:ri(n.stroke),o=new fn().copy({...n,fill:r,stroke:s});return"id"in n&&(o.id=n.id),o}copy(n){super.copy.call(this,n);for(let r=0;r<n.vertices.length;r++){const s=n.vertices[r];s instanceof Ee?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Ee().copy(s))}for(let r=0;r<fn.Properties.length;r++){const s=fn.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new fn;for(let s=0;s<this.vertices.length;s++)r.vertices.push(this.vertices[s].clone());for(let s=0;s<fn.Properties.length;s++){const o=fn.Properties[s];r[o]=this[o]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="points",n.vertices=this.vertices.map(r=>r.toObject()),Ve.each(fn.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}subdivide(n){this._update();let r=[];for(let s=0;s<this.vertices.length;s++){const o=this.vertices[s],a=this.vertices[s-1];if(!a)continue;const l=o.x,c=o.y,d=a.x,h=a.y,u=Zl(l,c,l,c,d,h,d,h,n);r=r.concat(u)}return this.vertices=r,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const n=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),s=Zr(this,n*this._length),o=Zr(this,r*this._length),a=Gm(s),l=Km(o);let c=0,d;this._renderer.vertices=[],this._renderer.collection=[];for(let h=0;h<this._collection.length;h++)h>=a&&h<=l&&(d=this._collection[h],this._renderer.collection.push(d),this._renderer.vertices[c*2+0]=d.x,this._renderer.vertices[c*2+1]=d.y,c++)}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}};C(fn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes"]);let Qr=fn;const yc={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 et||this._fill instanceof kt||this._fill instanceof xt||this._fill instanceof rt)&&this._fill.unbind(K.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof et||this._fill instanceof kt||this._fill instanceof xt||this._fill instanceof rt)&&this._fill.bind(K.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof et||this._stroke instanceof kt||this._stroke instanceof xt||this._stroke instanceof rt)&&this._stroke.unbind(K.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof et||this._stroke instanceof kt||this._stroke instanceof xt||this._stroke instanceof rt)&&this._stroke.bind(K.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(K.Types.insert,t).unbind(K.Types.remove,n),e instanceof $i?this._collection=e:this._collection=new $i(e||[]),this._collection.bind(K.Types.insert,t).bind(K.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}}};class _c extends $i{constructor(n){n=Array.isArray(n)?n:Array.prototype.slice.call(arguments);super(n);pa(this,Ss,{});this.attach(n),this.on(K.Types.insert,this.attach),this.on(K.Types.remove,this.detach)}get ids(){return Bt(this,Ss)}attach(n){for(let r=0;r<n.length;r++){const s=n[r];s&&s.id&&(this.ids[s.id]=s)}return this}detach(n){for(let r=0;r<n.length;r++)delete this.ids[n[r].id];return this}}Ss=new WeakMap;const kn=class kn extends Re{constructor(n,r,s,o,a,l,c){const d=c||Us.Resolution*3,h=[];for(let u=0;u<d;u++)h.push(new Ee);super(h,!0,!1,!0);C(this,"_flagStartAngle",!1);C(this,"_flagEndAngle",!1);C(this,"_flagInnerRadius",!1);C(this,"_flagOuterRadius",!1);C(this,"_startAngle",0);C(this,"_endAngle",ni);C(this,"_innerRadius",0);C(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let u in bc)Object.defineProperty(this,u,bc[u]);typeof s=="number"&&(this.innerRadius=s),typeof o=="number"&&(this.outerRadius=o),typeof a=="number"&&(this.startAngle=a),typeof l=="number"&&(this.endAngle=l),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new kn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<kn.Properties.length;r++){const s=kn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const n=this._startAngle,r=this._endAngle,s=this._innerRadius,o=this._outerRadius,a=Ri(n,ni)===Ri(r,ni),l=s>0,c=this.vertices;let d=l?c.length/2:c.length,h,u=0,p,f,g,m,y,_,b,S,x;for(a?d--:l||(d-=2),p=0,f=d-1;p<d;p++){switch(g=p/f,m=c[u],y=g*(r-n)+n,_=(r-n)/d,b=o*Math.cos(y),S=o*Math.sin(y),p){case 0:h=pe.move;break;default:h=pe.curve}m.command=h,m.x=b,m.y=S,m.controls.left.clear(),m.controls.right.clear(),m.command===pe.curve&&(x=o*_/Math.PI,m.controls.left.x=x*Math.cos(y-it),m.controls.left.y=x*Math.sin(y-it),m.controls.right.x=x*Math.cos(y+it),m.controls.right.y=x*Math.sin(y+it),p===1&&m.controls.left.multiplyScalar(2),p===f&&m.controls.right.multiplyScalar(2)),u++}if(l){for(a?(c[u].command=pe.close,u++):(d--,f=d-1),p=0;p<d;p++)g=p/f,m=c[u],y=(1-g)*(r-n)+n,_=(r-n)/d,b=s*Math.cos(y),S=s*Math.sin(y),h=pe.curve,p<=0&&(h=a?pe.move:pe.line),m.command=h,m.x=b,m.y=S,m.controls.left.clear(),m.controls.right.clear(),m.command===pe.curve&&(x=s*_/Math.PI,m.controls.left.x=x*Math.cos(y+it),m.controls.left.y=x*Math.sin(y+it),m.controls.right.x=x*Math.cos(y-it),m.controls.right.y=x*Math.sin(y-it),p===1&&m.controls.left.multiplyScalar(2),p===f&&m.controls.right.multiplyScalar(2)),u++;c[u].copy(c[0]),c[u].command=pe.line}else a||(c[u].command=pe.line,c[u].x=0,c[u].y=0,u++,c[u].copy(c[0]),c[u].command=pe.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(n){const r=this.innerRadius,s=this.outerRadius,o=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new kn(0,0,r,s,o,a,l);c.translation.copy(this.translation),c.rotation=this.rotation,c.scale=this.scale,c.skewX=this.skewX,c.skewY=this.skewY,this.matrix.manual&&c.matrix.copy(this.matrix);for(let d=0;d<Re.Properties.length;d++){const h=Re.Properties[d];c[h]=this[h]}return n&&n.add(c),c}toObject(){const n=super.toObject.call(this);n.renderer.type="arc-segment";for(let r=0;r<kn.Properties.length;r++){const s=kn.Properties[r];n[s]=this[s]}return n}};C(kn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let Ks=kn;const bc={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}}},Zs=Math.cos,Js=Math.sin,xn=class xn extends Re{constructor(n,r,s,o){const a=o?Math.max(o,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ee(0,0,0,0,0,0));super(l,!0,!0,!0);C(this,"_flagRadius",!1);C(this,"_radius",0);this._renderer.type="circle";for(let c in wc)Object.defineProperty(this,c,wc[c]);typeof s=="number"&&(this.radius=s),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new xn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<xn.Properties.length;r++){const s=xn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagRadius){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(n*2)),s=this._radius,o=s*r;for(let a=0;a<this.vertices.length;a++){const c=a/n*ni,d=s*Zs(c),h=s*Js(c),u=o*Zs(c-it),p=o*Js(c-it),f=o*Zs(c+it),g=o*Js(c+it),m=this.vertices[a];m.command=a===0?pe.move:pe.curve,m.set(d,h),m.controls.left.set(u,p),m.controls.right.set(f,g)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=new xn(0,0,this.radius,this.vertices.length);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let s=0;s<Re.Properties.length;s++){const o=Re.Properties[s];r[o]=this[o]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="circle";for(let r=0;r<xn.Properties.length;r++){const s=xn.Properties[r];n[s]=this[s]}return n}};C(xn,"Properties",["radius"]);let Qs=xn;const wc={radius:{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius=e,this._flagRadius=!0}}},eo=Math.cos,to=Math.sin,Cn=class Cn extends Re{constructor(n,r,s,o,a){typeof o!="number"&&typeof s=="number"&&(o=s);const l=a?Math.max(a,2):4,c=[];for(let d=0;d<l;d++)c.push(new Ee);super(c,!0,!0,!0);C(this,"_flagWidth",!1);C(this,"_flagHeight",!1);C(this,"_width",0);C(this,"_height",0);this._renderer.type="ellipse";for(let d in vc)Object.defineProperty(this,d,vc[d]);typeof s=="number"&&(this.width=s*2),typeof o=="number"&&(this.height=o*2),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Cn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Cn.Properties.length;r++){const s=Cn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(this.vertices.length*2)),s=this._width/2,o=this._height/2;for(let a=0;a<this.vertices.length;a++){const c=a/n*ni,d=s*eo(c),h=o*to(c),u=s*r*eo(c-it),p=o*r*to(c-it),f=s*r*eo(c+it),g=o*r*to(c+it),m=this.vertices[a];m.command=a===0?pe.move:pe.curve,m.set(d,h),m.controls.left.set(u,p),m.controls.right.set(f,g)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=this.width/2,s=this.height/2,o=this.vertices.length,a=new Cn(0,0,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<Re.Properties.length;l++){const c=Re.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="ellipse";for(let r=0;r<Cn.Properties.length;r++){const s=Cn.Properties[r];n[s]=this[s]}return n}};C(Cn,"Properties",["width","height"]);let no=Cn;const vc={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}}},Zm=Math.cos,Jm=Math.sin,Sn=class Sn extends Re{constructor(n,r,s,o){o=Math.max(o||0,3);super();C(this,"_flagWidth",!1);C(this,"_flagHeight",!1);C(this,"_flagSides",!1);C(this,"_radius",0);C(this,"_width",0);C(this,"_height",0);C(this,"_sides",0);this._renderer.type="polygon";for(let a in kc)Object.defineProperty(this,a,kc[a]);this.closed=!0,this.automatic=!1,typeof s=="number"&&(this.radius=s),typeof o=="number"&&(this.sides=o),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Sn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Sn.Properties.length;r++){const s=Sn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const n=this._sides,r=n+1;let s=this.vertices.length;s>n&&(this.vertices.splice(n-1,s-n),s=n);for(let o=0;o<r;o++){const a=(o+.5)/n,l=ni*a+Math.PI/2,c=this._width*Zm(l)/2,d=this._height*Jm(l)/2;o>=s?this.vertices.push(new Ee(c,d)):this.vertices[o].set(c,d),this.vertices[o].command=o===0?pe.move:pe.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=new Sn(0,0,0,this.sides);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,r.width=this.width,r.height=this.height,this.matrix.manual&&r.matrix.copy(this.matrix);for(let s=0;s<Re.Properties.length;s++){const o=Re.Properties[s];r[o]=this[o]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="polygon";for(let r=0;r<Sn.Properties.length;r++){const s=Sn.Properties[r];n[s]=this[s]}return n}};C(Sn,"Properties",["width","height","sides"]);let io=Sn;const kc={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}}},bi=class bi extends Re{constructor(n,r,s,o){const a=[new Ee,new Ee,new Ee,new Ee];super(a,!0,!1,!0);C(this,"_flagWidth",0);C(this,"_flagHeight",0);C(this,"_width",0);C(this,"_height",0);C(this,"_origin",null);this._renderer.type="rectangle";for(let l in xc)Object.defineProperty(this,l,xc[l]);this.width=typeof s=="number"?s:1,this.height=typeof o=="number"?o:1,this.origin=new we,typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(n){const r=new bi().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<bi.Properties.length;r++){const s=bi.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const n=this._width/2,r=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Ee),this.vertices[0].set(-n,-r).sub(this._origin).command=pe.move,this.vertices[1].set(n,-r).sub(this._origin).command=pe.line,this.vertices[2].set(n,r).sub(this._origin).command=pe.line,this.vertices[3].set(-n,r).sub(this._origin).command=pe.line,this.vertices[4]&&(this.vertices[4].set(-n,-r).sub(this._origin).command=pe.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=new bi(0,0,this.width,this.height);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let s=0;s<Re.Properties.length;s++){const o=Re.Properties[s];r[o]=this[o]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="rectangle",n.width=this.width,n.height=this.height,n.origin=this.origin.toObject(),n}};C(bi,"Properties",["width","height"]);let ro=bi;const xc={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(K.Types.change,this._renderer.flagVertices),this._origin=e,this._origin.bind(K.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Bn=class Bn extends Re{constructor(n,r,s,o,a){typeof a>"u"&&typeof s=="number"&&typeof o=="number"&&(a=Math.floor(Math.min(s,o)/12));const l=[];for(let c=0;c<10;c++)l.push(new Ee(0,0,0,0,0,0,c===0?pe.move:pe.curve));super(l);C(this,"_flagWidth",!1);C(this,"_flagHeight",!1);C(this,"_flagRadius",!1);C(this,"_width",0);C(this,"_height",0);C(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in Cc)Object.defineProperty(this,c,Cc[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=Qm.bind(this),typeof s=="number"&&(this.width=s),typeof o=="number"&&(this.height=o),typeof a=="number"&&(this.radius=a),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Bn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Bn.Properties.length;r++){const s=Bn.Properties[r];if(s in n){const o=n[s];/radius/i.test(s)?this[s]=typeof o=="number"||o instanceof we?o:new we().copy(o):typeof o=="number"&&(this[s]=o)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const n=this._width,r=this._height;let s,o;this._radius instanceof we?(s=this._radius.x,o=this._radius.y):(s=this._radius,o=this._radius);let a,l=n/2,c=r/2;a=this.vertices[0],a.x=-(l-s),a.y=-c,a=this.vertices[1],a.x=l-s,a.y=-c,a.controls.left.clear(),a.controls.right.x=s,a.controls.right.y=0,a=this.vertices[2],a.x=l,a.y=-(c-o),a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[3],a.x=l,a.y=c-o,a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=o,a=this.vertices[4],a.x=l-s,a.y=c,a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[5],a.x=-(l-s),a.y=c,a.controls.left.clear(),a.controls.right.x=-s,a.controls.right.y=0,a=this.vertices[6],a.x=-l,a.y=c-o,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[7],a.x=-l,a.y=-(c-o),a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=-o,a=this.vertices[8],a.x=-(l-s),a.y=-c,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[9],a.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(n){const r=this.width,s=this.height,o=this.radius,a=new Bn(0,0,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<Re.Properties.length;l++){const c=Re.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="rounded-rectangle";for(let r=0;r<Bn.Properties.length;r++){const s=Bn.Properties[r];n[s]=this[s]}return n.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),n}};C(Bn,"Properties",["width","height","radius"]);let so=Bn;const Cc={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 we&&this._radius.unbind(K.Types.change,this._renderer.flagRadius),this._radius=e,this._radius instanceof we&&this._radius.bind(K.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function Qm(){this._flagRadius=!0}const e0=Math.cos,t0=Math.sin,Tn=class Tn extends Re{constructor(n,r,s,o,a){arguments.length<=3&&(o=s,s=o/2),(typeof a!="number"||a<=0)&&(a=5);super();C(this,"_flagInnerRadius",!1);C(this,"_flagOuterRadius",!1);C(this,"_flagSides",!1);C(this,"_innerRadius",0);C(this,"_outerRadius",0);C(this,"_sides",0);this._renderer.type="star";for(let l in Sc)Object.defineProperty(this,l,Sc[l]);this.closed=!0,this.automatic=!1,typeof s=="number"&&(this.innerRadius=s),typeof o=="number"&&(this.outerRadius=o),typeof a=="number"&&(this.sides=a),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Tn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Tn.Properties.length;r++){const s=Tn.Properties[r];s in n&&typeof n[s]=="number"&&(this[s]=n[s])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const n=this._sides*2,r=n+1;let s=this.vertices.length;s>n&&(this.vertices.splice(n-1,s-n),s=n);for(let o=0;o<r;o++){const a=(o+.5)/n,l=ni*a,c=(o%2?this._outerRadius:this._innerRadius)/2,d=c*e0(l),h=c*t0(l);o>=s?this.vertices.push(new Ee(d,h)):this.vertices[o].set(d,h),this.vertices[o].command=o===0?pe.move:pe.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=this.innerRadius,s=this.outerRadius,o=this.sides,a=new Tn(0,0,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<Re.Properties.length;l++){const c=Re.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="star";for(let r=0;r<Tn.Properties.length;r++){const s=Tn.Properties[r];n[s]=this[s]}return n}};C(Tn,"Properties",["innerRadius","outerRadius","sides"]);let oo=Tn;const Sc={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}}};let ao;const Bc=Math.min,Tc=Math.max;sn.document&&(ao=document.createElement("canvas"));const gt=class gt extends yn{constructor(n,r,s,o){super();C(this,"_flagValue",!0);C(this,"_flagFamily",!0);C(this,"_flagSize",!0);C(this,"_flagLeading",!0);C(this,"_flagAlignment",!0);C(this,"_flagBaseline",!0);C(this,"_flagStyle",!0);C(this,"_flagWeight",!0);C(this,"_flagDecoration",!0);C(this,"_flagFill",!0);C(this,"_flagStroke",!0);C(this,"_flagLinewidth",!0);C(this,"_flagOpacity",!0);C(this,"_flagVisible",!0);C(this,"_flagMask",!1);C(this,"_flagClip",!1);C(this,"_flagDirection",!0);C(this,"_value","");C(this,"_family","sans-serif");C(this,"_size",13);C(this,"_leading",17);C(this,"_alignment","center");C(this,"_baseline","middle");C(this,"_style","normal");C(this,"_weight",500);C(this,"_decoration","none");C(this,"_direction","ltr");C(this,"_fill","#000");C(this,"_stroke","none");C(this,"_linewidth",1);C(this,"_opacity",1);C(this,"_visible",!0);C(this,"_mask",null);C(this,"_clip",!1);C(this,"_dashes",null);for(let a in Ec)Object.defineProperty(this,a,Ec[a]);if(this._renderer.type="text",this._renderer.flagFill=n0.bind(this),this._renderer.flagStroke=i0.bind(this),this.value=n,typeof r=="number"&&(this.translation.x=r),typeof s=="number"&&(this.translation.y=s),this.dashes=[],this.dashes.offset=0,!Ve.isObject(o))return this;for(let a=0;a<gt.Properties.length;a++){const l=gt.Properties[a];l in o&&(this[l]=o[l])}}static Measure(n){if(ao){const r=ao.getContext("2d");r.font=[n._style,n._weight,`${n._size}px/${n._leading}px`,n._family].join(" ");const s=r.measureText(n.value,0,0),o=s.actualBoundingBoxDescent+s.actualBoundingBoxAscent;return{width:s.width,height:o}}else{const r=this.value.length*this.size*gt.Ratio,s=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:r,height:s}}}static fromObject(n){const r=typeof n.fill=="string"?n.fill:ri(n.fill),s=typeof n.stroke=="string"?n.stroke:ri(n.stroke),o=new gt().copy({...n,fill:r,stroke:s});return"id"in n&&(o.id=n.id),o}copy(n){super.copy.call(this,n);for(let r=0;r<gt.Properties.length;r++){const s=gt.Properties[r];s in n&&(this[s]=n[s])}return this}clone(n){const r=new gt(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let s=0;s<gt.Properties.length;s++){const o=gt.Properties[s];r[o]=this[o]}return this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);n.renderer.type="text";for(let r=0;r<gt.Properties.length;r++){const s=gt.Properties[r];n[s]=this[s]}return n}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(n){let r,s,o,a,l;this._update(!0),r=n?this.matrix:this.worldMatrix;const{width:c,height:d}=gt.Measure(this),h=(this._linewidth||0)/2;switch(this.alignment){case"left":s=-h,o=c+h;break;case"right":s=-(c+h),o=h;break;default:s=-(c/2+h),o=c/2+h}switch(this.baseline){case"middle":a=-(d/2+h),l=d/2+h;break;default:a=-(d+h),l=h}const[u,p]=r.multiply(s,a),[f,g]=r.multiply(s,l),[m,y]=r.multiply(o,a),[_,b]=r.multiply(o,l);return a=Bc(p,g,y,b),s=Bc(u,f,m,_),o=Tc(u,f,m,_),l=Tc(p,g,y,b),{top:a,left:s,right:o,bottom:l,width:o-s,height:l-a}}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}};C(gt,"Ratio",.6),C(gt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes"]);let Fi=gt;const Ec={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 et||this._fill instanceof kt||this._fill instanceof xt||this._fill instanceof rt)&&this._fill.unbind(K.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof et||this._fill instanceof kt||this._fill instanceof xt||this._fill instanceof rt)&&this._fill.bind(K.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof et||this._stroke instanceof kt||this._stroke instanceof xt||this._stroke instanceof rt)&&this._stroke.unbind(K.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof et||this._stroke instanceof kt||this._stroke instanceof xt||this._stroke instanceof rt)&&this._stroke.bind(K.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,Ve.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 n0(){this._flagFill=!0}function i0(){this._flagStroke=!0}const es=Math.min,ts=Math.max,En=class En extends yn{constructor(n){super();C(this,"_flagAdditions",!1);C(this,"_flagSubtractions",!1);C(this,"_flagOrder",!1);C(this,"_flagOpacity",!0);C(this,"_flagBeginning",!1);C(this,"_flagEnding",!1);C(this,"_flagLength",!1);C(this,"_flagMask",!1);C(this,"_fill","#fff");C(this,"_stroke","#000");C(this,"_linewidth",1);C(this,"_opacity",1);C(this,"_visible",!0);C(this,"_cap","round");C(this,"_join","round");C(this,"_miter",4);C(this,"_closed",!0);C(this,"_curved",!1);C(this,"_automatic",!0);C(this,"_beginning",0);C(this,"_ending",1);C(this,"_length",0);C(this,"_mask",null);for(let r in Rc)Object.defineProperty(this,r,Rc[r]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(n)?n:Array.prototype.slice.call(arguments)}static InsertChildren(n){for(let r=0;r<n.length;r++)$c.call(this,n[r],this)}static RemoveChildren(n){for(let r=0;r<n.length;r++)$c.call(this,n[r])}static OrderChildren(n){this._flagOrder=!0}static fromObject(n){const r=new En;for(let o=0;o<En.Properties.length;o++){const a=En.Properties[o];a in n&&(/(fill|stroke)/i.test(a)?r[a]=typeof n[a]=="string"?n[a]:ri(n[a]):r[a]=n[a])}return"mask"in n&&(r.mask=s(n.mask)),"id"in n&&(r.id=n.id),r.children=n.children.map(s),r;function s(o){if(o&&o.renderer)switch(o.renderer.type){case"arc-segment":return Ks.fromObject(o);case"circle":return Qs.fromObject(o);case"ellipse":return no.fromObject(o);case"points":return Qr.fromObject(o);case"polygon":return io.fromObject(o);case"rectangle":return ro.fromObject(o);case"rounded-rectangle":return so.fromObject(o);case"star":return oo.fromObject(o);case"path":return Re.fromObject(o);case"text":return Fi.fromObject(o);case"group":return En.fromObject(o);case"shape":return yn.fromObject(o);case"element":return sr.fromObject(o)}return o}}copy(n){return super.copy.call(this,n),console.warn("Two.Group.copy is not supported yet."),this}clone(n){const r=new En,s=this.children.map(function(o){return o.clone()});return r.add(s),r.opacity=this.opacity,this.mask&&(r.mask=this.mask),r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.className=this.className,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="group",n.children=[],n.opacity=this.opacity,n.className=this.className,n.mask=this.mask?this.mask.toObject():null,Ve.each(this.children,(r,s)=>{n.children[s]=r.toObject()},this),n}corner(){const n=this.getBoundingClientRect(!0);for(let r=0;r<this.children.length;r++){const s=this.children[r];s.translation.x-=n.left,s.translation.y-=n.top}return this.mask&&(this.mask.translation.x-=n.left,this.mask.translation.y-=n.top),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,s=n.top+n.height/2-this.translation.y;for(let o=0;o<this.children.length;o++){const a=this.children[o];a.isShape&&(a.translation.x-=r,a.translation.y-=s)}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=s),this}getById(n){let r=null;function s(o){if(o.id===n)return o;if(o.children){if(o.children.ids[n])return o.children.ids[n];for(let a=0;a<o.children.length;a++)if(r=s(o.children[a]),r)return r}return null}return s(this)}getByClassName(n){const r=[];function s(o){if(Array.prototype.indexOf.call(o.classList,n)>=0&&r.push(o),o.children)for(let a=0;a<o.children.length;a++){const l=o.children[a];s(l)}return r}return s(this)}getByType(n){const r=[];function s(o){if(o instanceof n&&r.push(o),o.children)for(let a=0;a<o.children.length;a++){const l=o.children[a];s(l)}return r}return s(this)}add(n){n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let r=0;r<n.length;r++){const s=n[r];if(!(s&&s.id))continue;const o=Array.prototype.indexOf.call(this.children,s);o>=0&&this.children.splice(o,1),this.children.push(s)}return this}remove(n){const r=arguments.length,s=this.parent;if(r<=0&&s)return s.remove(this),this;n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let o=0;o<n.length;o++){const a=n[o];if(!a||!this.children.ids[a.id])continue;const l=this.children.indexOf(a);l>=0&&this.children.splice(l,1)}return this}getBoundingClientRect(n){let r,s,o,a,l,c;this._update(!0);let d=1/0,h=-1/0,u=1/0,p=-1/0;const f=/texture|gradient/i;s=n?this.matrix:this.worldMatrix;for(let g=0;g<this.children.length;g++){const m=this.children[g];if(!(!m.visible||f.test(m._renderer.type))&&(r=m.getBoundingClientRect(n),o=typeof r.top!="number"||Ve.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||Ve.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||Ve.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||Ve.isNaN(r.bottom)||!isFinite(r.bottom),!(o||a||l||c)))if(n){const[y,_]=s.multiply(r.left,r.top),[b,S]=s.multiply(r.right,r.top),[x,v]=s.multiply(r.left,r.bottom),[B,k]=s.multiply(r.right,r.bottom);u=es(_,S,v,k,u),d=es(y,b,x,B,d),h=ts(y,b,x,B,h),p=ts(_,S,v,k,p)}else u=es(r.top,u),d=es(r.left,d),h=ts(r.right,h),p=ts(r.bottom,p)}return{top:u,left:d,right:h,bottom:p,width:h-d,height:p-u}}noFill(){return this.children.forEach(function(n){n.noFill()}),this}noStroke(){return this.children.forEach(function(n){n.noStroke()}),this}subdivide(){const n=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,n)}),this}_update(){let n,r,s;if(this._flagBeginning||this._flagEnding){const o=Math.min(this._beginning,this._ending),a=Math.max(this._beginning,this._ending),l=this.length;let c=0;const d=o*l,h=a*l;for(n=0;n<this.children.length;n++)s=this.children[n],r=s.length,d>c+r?(s.beginning=1,s.ending=1):h<c?(s.beginning=0,s.ending=0):d>c&&d<c+r?(s.beginning=(d-c)/r,s.ending=1):h>c&&h<c+r?(s.beginning=0,s.ending=(h-c)/r):(s.beginning=0,s.ending=1),c+=r}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}};C(En,"Children",_c),C(En,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let _n=En;const Rc={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=_n.InsertChildren.bind(this),n=_n.RemoveChildren.bind(this),r=_n.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new _c(e),this._children.bind(K.Types.insert,t),this._children.bind(K.Types.remove,n),this._children.bind(K.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,Ve.isObject(e)&&!e.clip&&(e.clip=!0)}}};function $c(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)}}class ns extends Re{constructor(t,n,r,s){const o=[new Ee(t,n),new Ee(r,s)];super(o);for(let a in Nc)Object.defineProperty(this,a,Nc[a]);this.vertices[0].command=pe.move,this.vertices[1].command=pe.line,this.automatic=!1}}C(ns,"Properties",["left","right"]);const Nc={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(e){if(Ve.isObject(e))this.vertices.splice(0,1,e);else{const t=new Gr("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(Ve.isObject(e))this.vertices.splice(1,1,e);else{const t=new Gr("Two.Line.y argument is not an object.");console.warn(t.name,t.message)}}}};class lo{constructor(t=0,n=0){this.x=t,this.y=n}}class si{constructor(t=10,n=0,r="A"){C(this,"start",new lo);C(this,"end",new lo);this.width=t,this.angle=n,this.label=r}}const ze={line:{color:"#000",size:5},previewLine:{color:"#000",size:2},anchorPoint:{color:"#FF8000",size:12,strokeSize:20},lineLabel:{color:"#FF8000",size:22,rotation:-.5},angleLabel:{size:22,color:"#088c00",rotation:-.5},colorSideLabel:{size:20,color:"#439227"}},r0={class:"flex gap-3"},s0={class:"kozyrek-preview w-fill h-[12.5rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},o0={ref:"drawing-container",class:"size-full"},a0={},Pc=i.defineComponent({...a0,__name:"kozyrek-configurator-preview",props:{settings:{},value:{},selectTemplateIndex:{}},emits:["pointer:move","pointer:up","template:select"],setup(e,{emit:t}){const n=e,r=t,s=i.useTemplateRef("drawing-container");let o=[],a=[],l=[],c=null;const d=.75,h=i.computed(()=>n.value.configuratorParams.linesAngles.map((F,R)=>new si(n.value.configuratorParams.linesWidths[R],F,`A-${R+1}`))),u=i.computed(()=>n.value.configuratorParams.colorSide==="bottom"),p=i.computed(()=>{var F,R;return n.value.configuratorParams.startTailType&&((F=n.settings.startTailConfigs)!=null&&F[n.value.configuratorParams.startTailType])?(R=n.settings.startTailConfigs)==null?void 0:R[n.value.configuratorParams.startTailType].points:[]}),f=i.computed(()=>{var F,R;return n.value.configuratorParams.endTailType&&((F=n.settings.endTailConfigs)!=null&&F[n.value.configuratorParams.endTailType])?(R=n.settings.endTailConfigs)==null?void 0:R[n.value.configuratorParams.endTailType].points:[]}),g=(F,R=!1)=>{F[0].start.x=0,F[0].start.y=0;let $=0;for(let M=0;M<F.length;M++){const U=F[M],z=F[M-1]??new si(0,$);$+=!R||M>1?z.angle:0;const O=(!R||M>0?U.angle:0)+$;if(F[M].end.x=U.width*Math.cos(O*Math.PI/180)+F[M].start.x,F[M].end.y=U.width*Math.sin(O*Math.PI/180)+F[M].start.y,M<F.length-1){const ee=M+1;F[ee].start.x=F[M].end.x,F[ee].start.y=F[M].end.y}}return F},m=(F,R,$,M,U=!1)=>{let z=g([...$,...M]);R.length>0&&(z=[...g(R),...z]);let O=0,ee=0,ce=0,se=0;z.forEach(Ae=>{O=Math.min(O,Ae.start.x,Ae.end.x),ee=Math.min(ee,Ae.start.y,Ae.end.y),ce=Math.max(ce,Ae.start.x,Ae.end.x),se=Math.max(se,Ae.start.y,Ae.end.y)});let ge,ie;O===0&&ee===0&&ce===0&&se===0?(ge=1,ie=1):(ge=F.width/Math.abs(ce-O),ie=(U?F.height:F.height-ze.colorSideLabel.size)/Math.abs(se-ee));const Me=Math.min(ge,ie);return O=O<0?-O*Me:0,ee=ee<0?-ee*Me:0,[Me,O,ee]},y=F=>{const R=new Qr([F]);return R._size=ze.anchorPoint.size,R.fill=ze.anchorPoint.color,R.stroke="transparent",R._linewidth=ze.anchorPoint.strokeSize,l.push(R),R},_=(F,R)=>{if(l=[],n.settings.allowChangeFirstPoint){const $=F[0],M=new we($.vertices[0].x,$.vertices[0].y);M.bind(K.Types.change,()=>{$.vertices[0].copy(M)});const U=y(M);R.add(U)}F.forEach(($,M)=>{const U=F[M+1],z=new we($.vertices[1].x,$.vertices[1].y);z.bind(K.Types.change,()=>{$.vertices[1].copy(z),U!==void 0&&U.vertices[0].copy(z)});const O=y(z);R.add(O)})},b=F=>F*(Math.PI/180),S=(F,R,$)=>{const M=R.vertices.length-1;F.position.x=R.vertices[M].x,F.position.y=R.vertices[M].y;const U=Math.atan2(R.vertices[M].y-R.vertices[0].y,R.vertices[M].x-R.vertices[0].x);F.rotation=b($)+U},x=(F,R,$)=>{if(R.vertices[0]===void 0)return;F.position.x=R.vertices[0].x,F.position.y=R.vertices[0].y;const M=R.vertices.length-1,U=Math.atan2(R.vertices[M].y-R.vertices[0].y,R.vertices[M].x-R.vertices[0].x);F.rotation=b($)+U},v=(F,R,$)=>{const M=new _n;if(F.length===0)return M;const U=[];return[...F].reverse().forEach((z,O)=>{O!==0&&z.angle>0&&(z.angle*=-1),U.push(z)}),F=g(U,!0),x(M,R,F[0].angle),[R.vertices[0],R.vertices[1]].forEach(z=>{z.bind(K.Types.change,()=>{x(M,R,F[0].angle)})}),F.forEach(z=>{const O=z.start.x*$,ee=z.end.x*$,ce=z.start.y*$,se=z.end.y*$,ge=new ns(O,ce,ee,se);ge.linewidth=ze.line.size,ge.stroke=ze.line.color,M.add(ge)}),M},B=(F,R,$)=>{const M=new _n;return F.length===0||(F=g(F,!0),S(M,R,F[0].angle),[R.vertices[0],R.vertices[1]].forEach(U=>{U.bind(K.Types.change,()=>{S(M,R,F[0].angle)})}),F.forEach(U=>{const z=U.start.x*$,O=U.end.x*$,ee=U.start.y*$,ce=U.end.y*$,se=new ns(z,ee,O,ce);se.linewidth=ze.line.size,se.stroke=ze.line.color,M.add(se)})),M},k=(F,R,$,M)=>{const U=R.vertices[0].x+(R.vertices[1].x-R.vertices[0].x)/2-8*Math.sin(F.angle*Math.PI/180),z=R.vertices[0].y+(R.vertices[1].y-R.vertices[0].y)/2-8*Math.cos(F.angle*Math.PI/180),O=new Fi(F.label,U+10,z-10);let ee;O.size=ze.lineLabel.size,O.weight=600,O.fill=ze.lineLabel.color,O.id+=1,O.rotation=ze.lineLabel.rotation,M>0&&(ee=new Fi(`${F.angle}°`,R.vertices[0].x+25,R.vertices[0].y-25),ee.size=ze.angleLabel.size,ee.weight=600,ee.fill=ze.angleLabel.color,ee.rotation=ze.angleLabel.rotation,ee.id+=M,o.push(ee),$.add(ee)),$.add(O),P(O,R,0,ee),P(O,R,1)},E=()=>{const{size:F}=ze.colorSideLabel,R=0,$=0,M=u.value?F/2:F/2-F,U=u.value?F/2-F:F/2,z=new _n;if(!c)return z;const O=5,ee=Math.atan2(U-M,$-R),ce=[new Ee(R,M,0,0,0,0,ue.Commands.move),new Ee($,U,0,0,0,0,ue.Commands.line),new Ee($-O*Math.cos(ee-Math.PI/4),U-O*Math.sin(ee-Math.PI/4),0,0,0,0,ue.Commands.line),new Ee($,U,0,0,0,0,ue.Commands.move),new Ee($-O*Math.cos(ee+Math.PI/4),U-O*Math.sin(ee+Math.PI/4),0,0,0,0,ue.Commands.line)],se=new Re(ce,!1,!1,!0);se.noFill(),se.cap="round",se.join="round",se.linewidth=F/7,se.stroke=ze.colorSideLabel.color,z.add(se);const ge=new Fi(u.value?"Цвет снизу":"Цвет сверху",10,0);ge.size=F,ge.weight=600,ge.fill=ze.colorSideLabel.color,ge.alignment="left",z.add(ge);const ie=z.getBoundingClientRect();return z.position.x=(c.width-ie.width)*d+10,z.position.y=u.value?c.height+ie.height*2:ie.height/2,z},P=(F,R,$,M)=>{R.vertices[$].bind(K.Types.change,()=>{const U=R.vertices.length-1,z=Math.atan2(R.vertices[0].y-R.vertices[U].y,R.vertices[0].x-R.vertices[U].x)*180/Math.PI,O=R.vertices[0].x+(R.vertices[U].x-R.vertices[0].x)/2-8*Math.sin(z*Math.PI/180),ee=R.vertices[0].y+(R.vertices[U].y-R.vertices[0].y)/2-8*Math.cos(z*Math.PI/180);F.position.x=O+10,F.position.y=ee-10,F.rotation=-.5,M&&(M.position.x=R.vertices[0].x+25,M.position.y=R.vertices[0].y-25)})},N=(F,R,$,M,U=!1)=>{var Ze;if(F.clear(),$.length===0){F.update();return}const z=g($),[O,ee,ce]=m(F,R,z,M,U),se=new _n,ge=new Array,ie=new Array;U||(o=[],a=[]),z.forEach((De,yt)=>{const Jt=De.start.x*O+ee,Qt=De.end.x*O+ee,_t=De.start.y*O+ce,Ot=De.end.y*O+ce,Fe=new ns(Jt,_t,Qt,Ot);Fe.linewidth=U?ze.previewLine.size:ze.line.size,Fe.stroke=U?ze.previewLine.color:ze.line.color,a.push(Fe),ge.push(Fe),se.add(Fe),!U&&De.label!==""&&k(De,Fe,se,yt)});const Me=ge.at(-1);let Ae=se.getBoundingClientRect();if(!U){const De=E();ie.push(De)}if(R.length>0){const De=v(R,ge[0],O);se.add(De)}if(M.length>0&&Me){const De=B(M,Me,O);se.add(De)}if(ie.push(se),F.makeGroup(ie),Ae=se.getBoundingClientRect(),se.position.x=0-Ae.left+(F.width-Ae.width)/(2*(U?1:d)),se.position.y=0-Ae.top+(F.height-Ae.height)/(2*(U?1:d)),F.update(),!U){const De=((Ze=n.value.configuratorParams)==null?void 0:Ze.colorSide)==="top";se.position.y=se.position.y+ze.colorSideLabel.size*Number(De),_(ge,se),F.update()}},j=(F,R)=>{if(F&&!R.isNewRec()){const $=new ue({width:F.scrollWidth,height:F.scrollHeight});$.appendTo(F),N($,[],R.points,[],!0)}},X=()=>{c&&N(c,p.value,h.value,f.value,!1)},A=F=>F*(180/Math.PI),V=(F,R)=>{const $=F[1].x-F[0].x,M=F[1].y-F[0].y,U=R[1].x-R[0].x,z=R[1].y-R[0].y;let O=Math.atan2($*z-M*U,$*U+M*z);return O=A(O),Math.round(O)*-1},L=F=>{const R=a.map(($,M,U)=>{const z=U[M-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let O=Math.ceil($._length/F/n.settings.lineWidthStep)*n.settings.lineWidthStep;const ee=o[M-1];O<(U.length>1?n.settings.minLineWidth:n.settings.stripMinWidth)&&(O=U.length>1?n.settings.minLineWidth:n.settings.stripMinWidth),O>n.settings.maxLineWidth&&(O=n.settings.maxLineWidth);const ce=V($.vertices,z.vertices);return ee&&(ee.value=`${ce}°`),new si(O,ce,`A-${M+1}`)});r("pointer:move",R)},Z=F=>{let R=null,$;const M=ee=>{R=l.find(ce=>{const se=ce.renderer;return(se==null?void 0:se.elem)===ee.target}),[$]=m(F,p.value,h.value.map(ce=>ce),f.value)},U=ee=>{if(R){const ce=R.renderer,se=ce==null?void 0:ce.elem;if(!se)return;const ge=se.getBoundingClientRect();R.vertices[0].x-=ge.x-(ee instanceof MouseEvent?ee.clientX:ee.targetTouches[0].clientX)+ze.anchorPoint.size/2,R.vertices[0].y-=ge.y-(ee instanceof MouseEvent?ee.clientY:ee.targetTouches[0].clientY)+ze.anchorPoint.size/2,L($),F.update()}},z=()=>{R&&r("pointer:up",h.value),R=null},O=s.value;O&&(O.addEventListener("touchstart",M),O.addEventListener("touchend",z),O.addEventListener("mousedown",M),O.addEventListener("mouseup",z),O.addEventListener("mousemove",U),O.addEventListener("touchmove",U))};return i.onMounted(()=>{s.value&&(c=new ue({width:s.value.scrollWidth,height:s.value.scrollHeight,fullscreen:!1}).appendTo(s.value),c.scene.scale=d,c.update(),i.watch(()=>n.value,()=>{X()},{deep:!0,immediate:!0}),Z(c))}),i.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(F,R)=>(i.openBlock(),i.createElementBlock("div",r0,[i.createVNode(Pa,{"select-template-index":F.selectTemplateIndex,settings:F.settings,"onTemplate:select":R[0]||(R[0]=$=>r("template:select",$)),onInitDrawTemplate:j},null,8,["select-template-index","settings"]),i.createElementVNode("div",s0,[i.createElementVNode("div",o0,null,512)])]))}}),l0={class:"flex max-w-[50rem] flex-col gap-3"},c0={},d0=i.defineComponent({...c0,__name:"kozyrek-configurator",props:{settings:{},cartItem:{},client:{}},emits:["submit-success"],setup(e,{emit:t}){const n=e,r=t,s=i.ref(!1),o=i.ref(!1),a=i.ref(!1),l=i.ref(n.cartItem),c=i.ref(n.settings),d=i.ref({linesWidths:[...n.cartItem.configuratorParams.linesWidths],linesAngles:[...n.cartItem.configuratorParams.linesAngles]}),h=i.ref({quantity:{},marker:{},length:{}}),u=i.ref(0),p=(v=0)=>{const B=c.value.allTemplates.at(v);B!==void 0&&(u.value=v,l.value.configuratorParams.linesWidths=B.points.map(k=>D.isArray(k)?k[0]:k.width),l.value.configuratorParams.linesAngles=B.points.map(k=>D.isArray(k)?k[1]:k.angle),_()),m(l.value.configuratorParams)},f=async()=>{const v=prompt("Введите название шаблона:");if(!v)return;a.value=!0;const B={label:v,points:l.value.configuratorParams.linesWidths.map((k,E)=>[k,l.value.configuratorParams.linesAngles[E]])};await Y.HttpRequester.getInstance(Y.ConfiguratorProvider).createTemplate(n.cartItem.category,B,h.value).then(()=>{c.value.addCustomTemplate(B),u.value=c.value.allTemplates.length-1}).catch(()=>{a.value=!1}),a.value=!1},g=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(u.value=c.value.allTemplates.length-1)},m=async v=>{_(),s.value=!0,await Y.HttpRequester.getInstance(Y.ConfiguratorProvider).searchProduct(n.cartItem.category,v,h.value).then(B=>{l.value.product=B}).catch(()=>{s.value=!1}),s.value=!1},y=async()=>{o.value=!0,await(l.value.isNewRec()?Y.HttpRequester.getInstance(Y.CartProvider).addCartItem(n.client,l.value).then(v=>{r("submit-success",v)}).catch(()=>{o.value=!1}):Y.HttpRequester.getInstance(Y.CartProvider).patchCartItem(n.client,l.value).then(v=>{r("submit-success",v)}).catch(()=>{o.value=!1})),o.value=!1},_=()=>{const v={quantity:h.value.quantity,marker:h.value.marker};l.value.configuratorParams.linesWidths.forEach((B,k)=>{v[`lines_widths[${k+1}]`]={},v[`lines_angles[${k+1}]`]={}}),h.value=v},b=v=>{d.value.linesWidths=v.map(B=>B.width),d.value.linesAngles=v.map(B=>B.angle)},S=v=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,_(),g(),m(l.value.configuratorParams)},x=(v,B)=>{d.value.linesWidths=v,d.value.linesAngles=B};return i.onBeforeMount(()=>{p()}),(v,B)=>(i.openBlock(),i.createElementBlock("div",l0,[i.createVNode(Pc,{value:l.value,"select-template-index":u.value,settings:c.value,"onPointer:up":S,"onPointer:move":b,"onTemplate:select":p},null,8,["value","select-template-index","settings"]),i.createVNode(Aa,{value:l.value,"onUpdate:value":B[0]||(B[0]=k=>l.value=k),"preview-params":d.value,validation:h.value,settings:c.value,"is-submit-processing":o.value,"is-product-searching":s.value,"select-template-index":u.value,"onUpdate:params":B[1]||(B[1]=k=>m(k)),"onUpdate:preview":x,onSubmit:y,"onClick:saveTemplate":f},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])]))}});class Mi extends Y.Identity{constructor(n,r){super();C(this,"label","");C(this,"points",[]);C(this,"isCustom",!1);C(this,"id",-1);C(this,"guid","");n?(this.label=n.label,this.points=n.points.map((s,o)=>D.isArray(s)?new si(s[0],s[1],`A-${o+1}`):new si(s.width,s.angle,`A-${o+1}`))):(this.label="-- Новая конфигурация --",this.points=[new si(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class co extends Mi{constructor(n){super(n);C(this,"isDefault");this.isDefault=n.isDefault??!1}}class h0{constructor(t){C(this,"minLineWidth");C(this,"maxLineWidth");C(this,"lineWidthStep");C(this,"minLineAngle");C(this,"maxLineAngle");C(this,"lineAngleStep");C(this,"stripMinWidth");C(this,"stripMaxWidth");C(this,"stripMinLength");C(this,"stripMaxLength");C(this,"allowShowTable");C(this,"showOnlyTemplates");C(this,"templates");C(this,"customTemplates",[]);C(this,"startTailConfigs");C(this,"endTailConfigs");C(this,"bendCountForExtended");C(this,"extendedProductCatalog");C(this,"allowChangeFirstPoint");C(this,"allowSaveTemplates");C(this,"userTemplatesPrefix");C(this,"lengthStep");this.minLineWidth=t.minLineWidth,this.maxLineWidth=t.maxLineWidth,this.lineWidthStep=t.lineWidthStep,this.minLineAngle=t.minLineAngle,this.maxLineAngle=t.maxLineAngle,this.lineAngleStep=t.lineAngleStep,this.stripMinWidth=t.stripMinWidth,this.stripMaxWidth=t.stripMaxWidth,this.stripMinLength=t.stripMinLength,this.stripMaxLength=t.stripMaxLength,this.allowShowTable=t.allowShowTable,this.showOnlyTemplates=t.showOnlyTemplates,this.templates=t.templates.map(n=>new Mi(n)),this.templates.forEach((n,r)=>{n.id=r}),this.startTailConfigs=t.startTailConfigs.map(n=>new co(n)),this.endTailConfigs=t.endTailConfigs.map(n=>new co(n)),this.bendCountForExtended=t.bendCountForExtended,this.extendedProductCatalog=t.extendedProductCatalog,this.allowChangeFirstPoint=t.allowChangeFirstPoint,this.allowSaveTemplates=t.allowSaveTemplates,this.userTemplatesPrefix=t.userTemplatesPrefix,this.lengthStep=t.lengthStep,this.showOnlyTemplates||(this.customTemplates=t.customTemplates?Object.entries(t.customTemplates).map(([n,r])=>{const s=new Mi(r);return s.isCustom=!0,s.id=+n,s}):[],this.customTemplates.push(new Mi))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(t){var r,s;if(!this.allowSaveTemplates)return;const n=new Mi(t);n.isCustom=!0,n.id=(((r=this.customTemplates.at(-1))==null?void 0:r.id)??((s=this.templates.at(-1))==null?void 0:s.id)??0)+1,this.customTemplates.splice(-1,0,n)}removeCustomTemplate(t){if(this.allowSaveTemplates)return;const n=this.customTemplates.findIndex(r=>r.id===t);n&&n!==-1&&this.customTemplates.splice(n,1)}}const u0={},Ai=i.defineComponent({...u0,__name:"debounced-input-number",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:500},placeholder:{default:""},min:{default:void 0},max:{default:void 0},step:{default:1},validator:{type:Function,default:void 0}},emits:["update:value"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=i.ref(r.value),a=i.computed(()=>i.inject("debounce-input-time",r.debounceTime)),l=D.debounce(()=>s("update:value",o.value),a.value),c=f=>{o.value=f,l()};i.watch(()=>r.value,f=>{o.value=f});const d=i.ref(null);return t({focus:()=>{var f;return(f=d.value)==null?void 0:f.focus()},blur:()=>{var f;return(f=d.value)==null?void 0:f.blur()},select:()=>{var f;return(f=d.value)==null?void 0:f.select()}}),(f,g)=>(i.openBlock(),i.createBlock(i.unref(I.NInputNumber),{ref_key:"inputReference",ref:d,value:o.value,"onUpdate:value":[g[0]||(g[0]=m=>o.value=m),c],clearable:f.clearable,placeholder:f.placeholder,min:f.min,max:f.max,step:f.step,validator:f.validator},{prefix:i.withCtx(()=>[i.renderSlot(f.$slots,"prefix")]),_:3},8,["value","clearable","placeholder","min","max","step","validator"]))}}),f0={class:"flex flex-col gap-3"},p0={},Fc=i.defineComponent({...p0,__name:"metal-for-doors-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","click:view-switch","submit"],setup(e,{emit:t}){const n=e,r=t,s=i.useTemplateRef("first-input-element"),o=i.ref(D.cloneDeep(i.toRaw(n.value.configuratorParams))),a=()=>{o.value.length>0&&o.value.width>0&&(r("update:params",o.value),l("configuratorParams",o.value))},l=(c,d)=>{const h=new Y.CartItemBase(n.value);h[c]=d,r("update:value",h)};return i.onMounted(()=>{n.value.isNewRec()&&i.nextTick(()=>{var c;(c=s.value)==null||c.focus()})}),(c,d)=>{const h=I.NInput;return i.openBlock(),i.createBlock(i.unref(I.NForm),{disabled:c.isSubmitProcessing,class:"flex flex-col gap-2"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NFormItem),{required:!0,feedback:c.validation.width.feedback||"","show-feedback":c.validation.width.showFeedback||!1,"validation-status":c.validation.width.validationStatus||void 0,label:`Ширина, ${c.settings.minWidth?" от "+c.settings.minWidth:""}${c.settings.maxWidth?" до "+c.settings.maxWidth:""} мм`},{default:i.withCtx(()=>[i.createVNode(Ai,{ref:"first-input-element",value:o.value.width,"onUpdate:value":[d[0]||(d[0]=u=>o.value.width=u),a],class:"w-full",max:c.settings.maxWidth??void 0,min:c.settings.minWidth,validator:u=>!!u&&u>=c.settings.minWidth&&(!c.settings.maxWidth||u<=c.settings.maxWidth),placeholder:"Введите ширину"},null,8,["value","max","min","validator"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(I.NFormItem),{required:!0,feedback:c.validation.length.feedback||"","show-feedback":c.validation.length.showFeedback||!1,"validation-status":c.validation.length.validationStatus||void 0,label:`Длина, ${c.settings.minLength?" от "+c.settings.minLength:""}${c.settings.maxLength?" до "+c.settings.maxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(Ai,{value:o.value.length,"onUpdate:value":[d[1]||(d[1]=u=>o.value.length=u),a],placeholder:"Введите длину",max:c.settings.maxLength,min:c.settings.minLength,validator:u=>u>=c.settings.minLength&&u<=c.settings.maxLength,class:"w-full"},null,8,["value","max","min","validator"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(I.NFormItem),{required:!0,feedback:c.validation.quantity.feedback||"","show-feedback":c.validation.quantity.showFeedback||!1,"validation-status":c.validation.quantity.validationStatus||void 0,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NInputNumber),{value:c.value.quantity,placeholder:"Введите количество",min:1,validator:u=>u>0,class:"w-full","onUpdate:value":d[2]||(d[2]=u=>l("quantity",u??0))},null,8,["value","validator"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(I.NFormItem),{feedback:c.validation.marker.feedback||"","show-feedback":c.validation.marker.showFeedback||!1,"validation-status":c.validation.marker.validationStatus||void 0,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(h,{value:c.value.marker,placeholder:"Введите маркировку","onUpdate:value":d[3]||(d[3]=u=>l("marker",u))},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(Ui,{"is-product-searching":c.isProductSearching,product:c.value.product},null,8,["is-product-searching","product"]),i.createElementVNode("div",f0,[i.createVNode(i.unref(I.NButton),{disabled:c.value.product.isNewRec()||c.isProductSearching||c.isSubmitProcessing||c.value.length===0||c.value.width===0||c.value.quantity===0,type:"primary",class:"self-start",onClick:d[4]||(d[4]=u=>r("submit",c.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(c.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"]),c.settings.allowShowTable?(i.openBlock(),i.createBlock(i.unref(I.NButton),{key:0,type:"tertiary",class:"self-start",onClick:d[5]||(d[5]=u=>r("click:view-switch"))},{default:i.withCtx(()=>[...d[6]||(d[6]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1},8,["disabled"])}}}),g0={class:"w-104 px-5"},m0={},y0=i.defineComponent({...m0,__name:"metal-for-doors-configurator",props:{settings:{},cartItem:{},client:{}},emits:["submit-success"],setup(e,{emit:t}){const n=e,r=t,s=i.ref(n.cartItem),o=i.ref({width:{},length:{},quantity:{},marker:{}}),a=i.ref(!1),l=i.ref(!1),c=async h=>{a.value=!0,await Y.HttpRequester.getInstance(Y.ConfiguratorProvider).searchProduct(n.cartItem.category,h,o.value).then(u=>{s.value.product=u}).catch(()=>{a.value=!1}),a.value=!1},d=async()=>{l.value=!0,await(s.value.isNewRec()?Y.HttpRequester.getInstance(Y.CartProvider).addCartItem(n.client,s.value).then(h=>{r("submit-success",h)}).catch(()=>{l.value=!1}):Y.HttpRequester.getInstance(Y.CartProvider).patchCartItem(n.client,s.value).then(h=>{r("submit-success",h)}).catch(()=>{l.value=!1})),l.value=!1};return(h,u)=>(i.openBlock(),i.createElementBlock("div",g0,[i.createVNode(Fc,{value:s.value,"onUpdate:value":u[0]||(u[0]=p=>s.value=p),validation:o.value,settings:h.settings,"is-submit-processing":l.value,"onUpdate:params":u[1]||(u[1]=p=>c(p)),onSubmit:u[2]||(u[2]=p=>d())},null,8,["value","validation","settings","is-submit-processing"])]))}}),_0={key:0,class:"flex items-baseline gap-1"},b0={key:0,class:"flex items-baseline gap-1"},w0={class:"flex gap-3"},v0={},Mc=i.defineComponent({...v0,__name:"mosquito-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:instructions-toggle","click:show-preview-drawer"],setup(e,{emit:t}){const n=e,r=t,s=i.computed(()=>bt.isPhoneDevice()),o=i.ref(D.cloneDeep(i.toRaw(n.value.configuratorParams))),a=i.computed(()=>n.settings.widthOverlaps[o.value.mountType]??0),l=i.computed(()=>n.settings.heightOverlaps[o.value.mountType]??0),c=i.computed(()=>n.settings.maxWidths[o.value.netType]),d=i.computed(()=>n.settings.maxHeights[o.value.netType]-l.value),h=(p,f)=>{p&&p in o.value&&(o.value[p]=f??0),r("update:params",o.value),u("configuratorParams",o.value)},u=(p,f)=>{const g=new Y.CartItemBase(n.value);g[p]=f,r("update:value",g)};return(p,f)=>{const g=I.NInput;return i.openBlock(),i.createBlock(i.unref(I.NForm),{class:"flex flex-col gap-2 px-4 md:max-w-96"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NSelect),{value:o.value.netType,"onUpdate:value":[f[0]||(f[0]=m=>o.value.netType=m),h],options:p.settings.netType.map(m=>({label:p.settings.descriptions.net_type[m],value:m}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NSelect),{value:o.value.color,"onUpdate:value":f[1]||(f[1]=m=>o.value.color=m),options:p.settings.color.map(m=>({label:p.settings.descriptions.color[m],value:m}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NSelect),{value:o.value.mountType,"onUpdate:value":[f[2]||(f[2]=m=>o.value.mountType=m),h],options:p.settings.mountType.map(m=>({label:p.settings.descriptions.mount_type[m],value:m}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(I.NFormItem),{required:!0,feedback:p.validation.width.feedback||"","show-feedback":p.validation.width.showFeedback||o.value.width>=p.settings.minWidth&&o.value.width<=p.settings.maxWidths[o.value.netType],"validation-status":p.validation.width.validationStatus||void 0,label:`Ширина светового проёма от ${p.settings.minWidth-a.value} ${c.value?" до "+c.value:""} мм.`},{feedback:i.withCtx(()=>[!p.validation.width.showFeedback&&o.value.width>=p.settings.minWidth&&o.value.width<=p.settings.maxWidths[o.value.netType]?(i.openBlock(),i.createElementBlock("div",_0,[i.createVNode(i.unref(I.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Ширина готового изделия "+i.toDisplayString(o.value.width+a.value),1)]),_:1}),i.createVNode(i.unref(I.NButton),{quaternary:"",type:"info",size:"tiny",onClick:f[4]||(f[4]=m=>r("click:instructions-toggle"))},{default:i.withCtx(()=>[...f[11]||(f[11]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(Ai,{value:o.value.width&&o.value.width-a.value,max:c.value,min:p.settings.minWidth-a.value,placeholder:"Введите ширину светового проёма",class:"w-full","onUpdate:value":f[3]||(f[3]=m=>h("width",(m&&m+a.value)??void 0))},null,8,["value","max","min"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(I.NFormItem),{required:!0,feedback:p.validation.height.feedback||"","show-feedback":p.validation.height.showFeedback||o.value.height>=p.settings.minHeight&&o.value.height<=p.settings.maxHeights[o.value.netType],"validation-status":p.validation.height.validationStatus||void 0,label:`Высота светового проёма от ${p.settings.minHeight-l.value} ${d.value?" до "+d.value:""} мм.`},{feedback:i.withCtx(()=>[!p.validation.height.showFeedback&&o.value.height>=p.settings.minHeight&&o.value.height<=p.settings.maxHeights[o.value.netType]?(i.openBlock(),i.createElementBlock("div",b0,[i.createVNode(i.unref(I.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Высота готового изделия "+i.toDisplayString(o.value.height+l.value),1)]),_:1}),i.createVNode(i.unref(I.NButton),{quaternary:"",type:"info",size:"tiny",onClick:f[6]||(f[6]=m=>r("click:instructions-toggle"))},{default:i.withCtx(()=>[...f[12]||(f[12]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(Ai,{value:o.value.height&&o.value.height-l.value,max:d.value,min:p.settings.minHeight-l.value,placeholder:"Введите высоту светового проёма",class:"w-full","onUpdate:value":f[5]||(f[5]=m=>h("height",(m&&m+l.value)??void 0))},null,8,["value","max","min"])]),_:1},8,["feedback","show-feedback","validation-status","label"]),i.createVNode(i.unref(I.NFormItem),{required:!0,feedback:p.validation.quantity.feedback||"","show-feedback":p.validation.quantity.showFeedback||!1,"validation-status":p.validation.quantity.validationStatus||void 0,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NInputNumber),{value:p.value.quantity,"onUpdate:value":f[7]||(f[7]=m=>p.value.quantity=m),min:1,validator:m=>Number.isInteger(m),placeholder:"Введите количество",class:"w-full"},null,8,["value","validator"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(i.unref(I.NFormItem),{feedback:p.validation.marker.feedback||"","show-feedback":p.validation.marker.showFeedback||!1,"validation-status":p.validation.marker.validationStatus||void 0,label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(g,{value:p.value.marker,"onUpdate:value":f[8]||(f[8]=m=>p.value.marker=m),placeholder:"Введите маркировку"},null,8,["value"])]),_:1},8,["feedback","show-feedback","validation-status"]),i.createVNode(Ui,{"is-product-searching":p.isProductSearching,product:p.value.product},null,8,["is-product-searching","product"]),i.createElementVNode("div",w0,[i.createVNode(i.unref(I.NButton),{loading:p.isSubmitProcessing,disabled:p.isProductSearching||!p.value.product||p.value.product.isNewRec()||o.value.width<p.settings.minHeight-l.value||o.value.height<p.settings.minHeight-l.value,type:"primary",class:"self-start",onClick:f[9]||(f[9]=m=>r("submit",p.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(p.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"]),s.value?(i.openBlock(),i.createBlock(i.unref(I.NButton),{key:0,type:"default",onClick:f[10]||(f[10]=m=>r("click:show-preview-drawer"))},{default:i.withCtx(()=>[...f[13]||(f[13]=[i.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1})}}}),k0="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",x0="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",C0="/img/configurators/mosquitto/measurement-instructions/mount.png",S0="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",B0="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",T0={class:"flex flex-col gap-6"},E0={class:"flex gap-4"},R0={class:"flex flex-col gap-2"},$0={class:"flex gap-4"},N0={class:"flex flex-col gap-2"},P0={class:"flex gap-4"},F0={class:"flex flex-col gap-2"},M0={},Ac=i.defineComponent({...M0,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(e,{emit:t}){const n=bt.initRefDependingOnDeviceResolution("small","small","medium"),r=bt.initRefDependingOnDeviceResolution(.98,.95,.8),s=i.computed(()=>window.innerWidth*r.value),o=t;return(a,l)=>{const c=I.NText;return i.openBlock(),i.createBlock(i.unref(I.NModal),{show:a.show,"show-icon":!1,size:i.unref(n),style:i.normalizeStyle(`width: ${s.value}px`),title:"Руководство по замеру","action-class":"grid grid-cols-2 !justify-between",preset:"dialog",onClose:l[0]||(l[0]=d=>o("update:show",!1)),onEsc:l[1]||(l[1]=d=>o("update:show",!1)),onMaskClick:l[2]||(l[2]=d=>o("update:show",!1))},{default:i.withCtx(()=>[i.createElementVNode("div",T0,[i.createVNode(c,{type:"error",class:"text-base font-medium"},{default:i.withCtx(()=>[...l[3]||(l[3]=[i.createTextVNode(" Важно! Для того,что бы произвести замер, необходимо открыть оконную створку. ",-1)])]),_:1}),l[22]||(l[22]=i.createElementVNode("div",{class:"grid gap-6 md:grid-cols-2"},[i.createElementVNode("div",{class:"flex items-start gap-4"},[i.createElementVNode("img",{src:k0,alt:"measurement-height",class:"w-[7.5rem]"}),i.createElementVNode("div",{class:"flex flex-col gap-2"},[i.createElementVNode("span",{class:"text-lg font-bold"},"Замер ширины"),i.createElementVNode("span",null,"Замерить по ширине световой проем оконной рамы. Размер учитывать c точностью до 1 мм")])]),i.createElementVNode("div",{class:"flex items-start gap-4"},[i.createElementVNode("img",{src:x0,alt:"measurement-height",class:"w-[7.5rem]"}),i.createElementVNode("div",{class:"flex flex-col gap-2"},[i.createElementVNode("span",{class:"text-lg font-bold"},"Замер высоты"),i.createElementVNode("span",null,"Замерить по высоте световой проем оконной рамы. Размер учитывать с точностью до 1 мм")])])],-1)),i.createElementVNode("div",E0,[l[9]||(l[9]=i.createElementVNode("img",{src:C0,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",R0,[l[8]||(l[8]=i.createElementVNode("span",{class:"text-lg font-bold"},"Крепление на раме сетки",-1)),i.createElementVNode("span",null,[l[4]||(l[4]=i.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[5]||(l[5]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(a.widthOverlaps.frame)+" мм. Высота светового проема +"+i.toDisplayString(a.heightOverlaps.frame)+" мм. ",1),l[6]||(l[6]=i.createElementVNode("br",null,null,-1)),l[7]||(l[7]=i.createTextVNode(" Крепления находятся на раме сетки. ",-1))])])]),i.createElementVNode("div",$0,[l[15]||(l[15]=i.createElementVNode("img",{src:S0,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",N0,[l[14]||(l[14]=i.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление пластик (верх+низ)",-1)),i.createElementVNode("span",null,[l[10]||(l[10]=i.createTextVNode(" Расчетные размеры москитной сетки:",-1)),l[11]||(l[11]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(a.widthOverlaps.external_plastic)+" мм. Высота светового проема +"+i.toDisplayString(a.heightOverlaps.external_plastic)+" мм. ",1),l[12]||(l[12]=i.createElementVNode("br",null,null,-1)),l[13]||(l[13]=i.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])]),i.createElementVNode("div",P0,[l[21]||(l[21]=i.createElementVNode("img",{src:B0,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",F0,[l[20]||(l[20]=i.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление металл (верх+низ)",-1)),i.createElementVNode("span",null,[l[16]||(l[16]=i.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[17]||(l[17]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(a.widthOverlaps.external_metal)+" мм. Высота светового проема +"+i.toDisplayString(a.heightOverlaps.external_metal)+" мм. ",1),l[18]||(l[18]=i.createElementVNode("br",null,null,-1)),l[19]||(l[19]=i.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])])])]),_:1},8,["show","size","style"])}}}),A0={class:"flex flex-col items-center justify-between rounded-xl"},V0={class:"img-preview relative flex justify-center"},I0={},O0=i.defineComponent({...I0,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(e,{emit:t}){const n=e,r=i.computed(()=>D.keys(n.settings.crossbarCount).find(o=>n.settings.crossbarCount[Number(o)]&&(!n.settings.crossbarCount[Number(o)+1]||n.configuratorParams.height<n.settings.crossbarCount[Number(o)+1]-n.settings.heightOverlaps[n.configuratorParams.mountType]))),s=t;return(o,a)=>{const l=I.NButton;return i.openBlock(),i.createElementBlock("div",A0,[i.createElementVNode("div",V0,[a[1]||(a[1]=i.createElementVNode("div",{class:"window"},null,-1)),i.createElementVNode("div",{class:i.normalizeClass(["net",`net-${o.configuratorParams.netType}`])},null,2),i.createElementVNode("div",{class:i.normalizeClass(["frame",`frame-${o.configuratorParams.color}`])},null,2),r.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["frame-crossbar",`frame-crossbar-${r.value}-${o.configuratorParams.color}`])},null,2)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["mount",`mount-${o.configuratorParams.mountType}-${o.configuratorParams.color}`])},null,2),i.createElementVNode("div",{class:i.normalizeClass(["cut-preview",`cut-preview-${o.configuratorParams.mountType}-${o.configuratorParams.color}`])},null,2)]),i.createVNode(l,{type:"primary",class:"block justify-self-center",onClick:a[0]||(a[0]=c=>s("open-instructions"))},{default:i.withCtx(()=>[...a[2]||(a[2]=[i.createTextVNode(" Руководство по замеру ",-1)])]),_:1})])}}}),ho=jn(O0,[["__scopeId","data-v-8b43aa68"]]),z0={class:"grid md:grid-cols-2"},L0={},D0=i.defineComponent({...L0,__name:"mosquito-configurator",props:{settings:{},cartItem:{},client:{}},emits:["submit-success"],setup(e,{emit:t}){const n=e,r=t,s=i.computed(()=>bt.isPhoneDevice()),o=i.ref(!1),a=i.ref(!1),l=i.ref(n.cartItem),c=i.ref({width:{},height:{},quantity:{},marker:{}}),d=i.ref(!1),h=i.ref(!1),u=async f=>{f.height>0&&f.width>0&&(d.value=!0,await Y.HttpRequester.getInstance(Y.ConfiguratorProvider).searchProduct(n.cartItem.category,f,c.value).then(g=>{l.value.product=g}).catch(()=>{d.value=!1}),d.value=!1)},p=async()=>{h.value=!0,await(l.value.isNewRec()?Y.HttpRequester.getInstance(Y.CartProvider).addCartItem(n.client,l.value).then(f=>{r("submit-success",f)}).catch(()=>{h.value=!1}):Y.HttpRequester.getInstance(Y.CartProvider).patchCartItem(n.client,l.value).then(f=>{r("submit-success",f)}).catch(()=>{h.value=!1})),h.value=!1};return(f,g)=>{const m=Er;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(Ac,{show:a.value,"onUpdate:show":g[0]||(g[0]=y=>a.value=y),"height-overlaps":f.settings.heightOverlaps,"width-overlaps":f.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),i.createElementVNode("div",z0,[s.value?(i.openBlock(),i.createBlock(i.unref(I.NDrawer),{key:1,show:o.value,"onUpdate:show":g[4]||(g[4]=y=>o.value=y),"default-width":375,resizable:""},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NDrawerContent),null,{header:i.withCtx(()=>[i.createVNode(i.unref(I.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:g[2]||(g[2]=y=>o.value=!1)},{default:i.withCtx(()=>[i.createVNode(m)]),_:1})]),default:i.withCtx(()=>[i.createVNode(ho,{"configurator-params":l.value.configuratorParams,settings:f.settings,onOpenInstructions:g[3]||(g[3]=y=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(i.openBlock(),i.createBlock(ho,{key:0,"configurator-params":l.value.configuratorParams,settings:f.settings,onOpenInstructions:g[1]||(g[1]=y=>a.value=!0)},null,8,["configurator-params","settings"])),i.createVNode(Mc,{value:l.value,"onUpdate:value":g[5]||(g[5]=y=>l.value=y),validation:c.value,settings:f.settings,"is-product-searching":d.value,"is-submit-processing":h.value,"onUpdate:params":g[6]||(g[6]=y=>u(y)),onSubmit:g[7]||(g[7]=y=>p()),"onClick:instructionsToggle":g[8]||(g[8]=y=>a.value=!a.value),"onClick:showPreviewDrawer":g[9]||(g[9]=y=>o.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),H0={},Vc=i.defineComponent({...H0,__name:"strip-configurator-line-item",props:{value:{},index:{},settings:{},product:{default:void 0},addLineButtonDisabled:{type:Boolean,default:!1},removeLineButtonDisabled:{type:Boolean,default:!1},suggestionOption:{default:void 0},autoFocus:{type:Boolean,default:!1},validation:{default:()=>({})}},emits:["update:value","click:add-line","click:remove-line"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=i.useTemplateRef("width-input-element"),a=i.ref(!1),l=d=>{s("update:value",d??0,r.index,a)};i.onMounted(()=>{r.autoFocus&&i.nextTick(()=>{c()})});const c=()=>{var d;(d=o.value)==null||d.select()};return t({focusWidthInput:c}),(d,h)=>{const u=Ma,p=Fa;return i.openBlock(),i.createBlock(i.unref(I.NFormItem),{label:`Полоса №${d.index+1}, мм`,required:!0},{feedback:i.withCtx(()=>[i.createVNode(Ui,{"is-product-searching":a.value,product:d.product},null,8,["is-product-searching","product"])]),default:i.withCtx(()=>[i.createVNode(i.unref(I.NDropdown),{trigger:"click",options:d.suggestionOption,placement:"bottom-start",size:"large",onSelect:l},{default:i.withCtx(()=>[i.createVNode(Ai,{ref:"width-input-element",value:d.value,class:"w-full",step:d.value<d.settings.minLineWidth?d.settings.minLineWidth-d.value:d.settings.lineWidthStep,validator:f=>!!f&&f>=d.settings.minLineWidth&&f%d.settings.lineWidthStep===0,placeholder:"Введите ширину","onUpdate:value":l},null,8,["value","step","validator"])]),_:1},8,["options"]),i.createVNode(i.unref(I.NButton),{disabled:d.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:h[0]||(h[0]=f=>s("click:add-line",d.index))},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["disabled"]),i.createVNode(i.unref(I.NButton),{disabled:d.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:h[1]||(h[1]=f=>s("click:remove-line",d.index))},{default:i.withCtx(()=>[i.createVNode(p)]),_:1},8,["disabled"])]),_:1},8,["label"])}}}),W0={class:"my-2 flex w-full flex-col"},j0={class:"flex gap-3"},q0={},Ic=i.defineComponent({...q0,__name:"strip-configurator-form",props:{value:{},settings:{},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","click:view-switch","submit","click:add-line","click:remove-line"],setup(e,{emit:t}){const n=e,r=t,s=i.computed(()=>n.value[0].configuratorParams.linesWidths.map(h=>h).reduce((h,u)=>h+u,0)),o=i.computed(()=>n.settings.width-s.value),a=i.computed(()=>!n.value.some(({product:h})=>!h)),l=i.computed(()=>o.value===0?void 0:[{label:`${(o.value>0?"Остаток +":"Излишек ")+o.value} мм.`,key:o.value}]),c=(h,u,p)=>{const f=n.value.at(u);if(f)if(h&&h>=n.settings.minLineWidth&&h%n.settings.lineWidthStep===0){const g={linesWidths:f.configuratorParams.linesWidths.toSpliced(u,1,h)};r("update:params",g,u,p),d("configuratorParams",g)}else f.product.id=-1},d=(h,u)=>{const p=n.value.map(f=>new Y.CartItemBase(f));p.forEach(f=>{f[h]=u}),r("update:value",p)};return(h,u)=>{const p=I.NText,f=I.NInput;return i.openBlock(),i.createBlock(i.unref(I.NForm),{class:"flex flex-col gap-2"},{default:i.withCtx(()=>{var g;return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(m,y)=>(i.openBlock(),i.createBlock(Vc,{key:y,"auto-focus":!0,index:y,value:m.configuratorParams.linesWidths.at(y)??0,product:m.product,settings:h.settings,"suggestion-option":l.value,"add-line-button-disabled":o.value<=0||h.value.length>=h.settings.maxLinesCount,"remove-line-button-disabled":h.value.length===1,"onUpdate:value":c,"onClick:addLine":u[0]||(u[0]=_=>r("click:add-line",_)),"onClick:removeLine":u[1]||(u[1]=_=>r("click:remove-line",_))},null,8,["index","value","product","settings","suggestion-option","add-line-button-disabled","remove-line-button-disabled"]))),128)),i.createElementVNode("div",W0,[o.value<0?(i.openBlock(),i.createBlock(p,{key:0,type:"error"},{default:i.withCtx(()=>[i.createTextVNode(" Сумма ширин всех полос должна быть равна "+i.toDisplayString(h.settings.width),1)]),_:1})):i.createCommentVNode("",!0),a.value&&h.value.length===h.settings.maxLinesCount&&o.value>0?(i.openBlock(),i.createBlock(p,{key:1,type:"error"},{default:i.withCtx(()=>[...u[8]||(u[8]=[i.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",null,[u[9]||(u[9]=i.createTextVNode(" Остаток для резки: ",-1)),i.createVNode(p,{type:o.value>=0?"Success":"error"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(o.value),1)]),_:1},8,["type"]),i.createTextVNode(" из "+i.toDisplayString(h.settings.width)+" мм ",1)])]),i.createVNode(i.unref(I.NButton),{loading:h.isSubmitProcessing,disabled:!a.value||o.value<=0||h.value.length>=h.settings.maxLinesCount,type:"primary",class:"self-center",onClick:u[2]||(u[2]=m=>r("click:add-line",h.value.length))},{default:i.withCtx(()=>[...u[10]||(u[10]=[i.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["loading","disabled"]),i.createVNode(i.unref(I.NFormItem),{required:!0,label:`Метраж ${h.settings.minLength?" от "+h.settings.minLength:""} ${h.settings.maxLength?" до "+h.settings.maxLength:""} м.`},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NInputNumber),{value:n.value[0].length,max:h.settings.maxLength||void 0,min:h.settings.minLength,step:h.settings.lengthStep,validator:m=>m%h.settings.lengthStep===0,placeholder:"Введите метраж",class:"w-full","onUpdate:value":u[3]||(u[3]=m=>d("length",m??0))},null,8,["value","max","min","step","validator"])]),_:1},8,["label"]),i.createVNode(i.unref(I.NFormItem),{required:!0,label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NInputNumber),{value:n.value[0].quantity,min:1,validator:m=>Number.isInteger(m),placeholder:"Введите количество",class:"w-full","onUpdate:value":u[4]||(u[4]=m=>d("quantity",m??0))},null,8,["value","validator"])]),_:1}),i.createVNode(i.unref(I.NFormItem),{label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(f,{value:n.value[0].marker,placeholder:"Введите маркировку","onUpdate:value":u[5]||(u[5]=m=>d("marker",m))},null,8,["value"])]),_:1}),i.createElementVNode("div",j0,[i.createVNode(i.unref(I.NButton),{loading:h.isSubmitProcessing,disabled:!a.value||o.value!=0||!((g=h.value[0])!=null&&g.length)||h.value[0].length>h.settings.maxLength||h.value[0].length<h.settings.minLength||h.value[0].quantity===0,type:"primary",class:"self-start",onClick:u[6]||(u[6]=m=>r("submit",h.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(h.value[0].isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"]),h.settings.allowShowTable?(i.openBlock(),i.createBlock(i.unref(I.NButton),{key:0,type:"tertiary",class:"self-start",onClick:u[7]||(u[7]=m=>r("click:view-switch"))},{default:i.withCtx(()=>[...u[11]||(u[11]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0)])]}),_:1})}}}),X0={class:"flex grow flex-col"},Y0=["src"],U0={class:"w-full"},G0={},Oc=i.defineComponent({...G0,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(e){return(t,n)=>(i.openBlock(),i.createElementBlock("div",X0,[i.createElementVNode("img",{src:"/img/configurators/strip/strip-"+t.value.length+".png",class:"w-full max-w-96 self-center",alt:"Штрипс"},null,8,Y0),i.createElementVNode("div",U0,[i.createTextVNode(" Число полос можно указать от "+i.toDisplayString(t.settings.minLinesCount)+" до "+i.toDisplayString(t.settings.maxLinesCount)+". ",1),n[0]||(n[0]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Минимальная ширина полосы "+i.toDisplayString(t.settings.minLineWidth)+" мм. ",1),n[1]||(n[1]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина всех полос "+i.toDisplayString(t.settings.width)+" мм. ",1),n[2]||(n[2]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Шаг ширины полосы - "+i.toDisplayString(t.settings.lineWidthStep)+" мм. ",1)])]))}}),K0={class:"w-104 flex grow flex-col px-5"},Z0={},J0=i.defineComponent({...Z0,__name:"strip-configurator",props:{settings:{},cartItems:{},client:{}},emits:["submit-success"],setup(e,{emit:t}){const n=e,r=t,s=i.ref(n.cartItems),o=i.ref({width:{},length:{},quantity:{},marker:{}}),a=i.ref(!1),l=i.computed(()=>s.value[0].configuratorParams.linesWidths.map(p=>p).reduce((p,f)=>p+f,0)),c=p=>{p===void 0&&(p=s.value.length-1);const f=s.value.at(0);if(!f)return;f.configuratorParams.linesWidths=f.configuratorParams.linesWidths.toSpliced(p+1,0,0),s.value.forEach(m=>{m.configuratorParams.linesWidths=f.configuratorParams.linesWidths});const g=new Y.CartItemBase({quantity:(f==null?void 0:f.quantity)??1,category:f==null?void 0:f.category,length:(f==null?void 0:f.length)??n.settings.minLength,marker:f==null?void 0:f.marker,configuratorParams:{linesWidths:f==null?void 0:f.configuratorParams.linesWidths}});s.value=s.value.toSpliced(p+1,0,g)},d=p=>{const f=s.value.at(0);f&&(f.configuratorParams.linesWidths=f.configuratorParams.linesWidths.toSpliced(p,1),s.value.forEach(g=>{g.configuratorParams.linesWidths=f.configuratorParams.linesWidths}),s.value=s.value.toSpliced(p,1),delete o[`linesWidths.${p}`],delete o[`linesWidths.${p}`])},h=async(p,f,g)=>{g.value=!0,await Y.HttpRequester.getInstance(Y.ConfiguratorProvider).searchProduct(s.value[f].category,{linesWidths:p.linesWidths.at(f)},o.value).then(m=>{s.value[f].product=m,s.value.length<n.settings.maxLinesCount&&l.value<n.settings.width&&c()}).catch(()=>{s.value[f].product=new Y.Product,g.value=!1}),g.value=!1},u=async()=>{a.value=!0,await(s.value[0].isNewRec()?Y.HttpRequester.getInstance(Y.CartProvider).addCartItem(n.client,s.value[0]).then(p=>{r("submit-success",p)}).catch(()=>{a.value=!1}):Y.HttpRequester.getInstance(Y.CartProvider).patchCartItem(n.client,s.value[0]).then(p=>{r("submit-success",p)}).catch(()=>{a.value=!1})),a.value=!1};return(p,f)=>(i.openBlock(),i.createElementBlock("div",K0,[i.createVNode(Oc,{value:s.value,"onUpdate:value":f[0]||(f[0]=g=>s.value=g),settings:p.settings},null,8,["value","settings"]),i.createVNode(Ic,{value:s.value,"onUpdate:value":f[1]||(f[1]=g=>s.value=g),validation:o.value,settings:p.settings,"is-submit-processing":a.value,"onUpdate:params":h,onSubmit:u,"onClick:addLine":c,"onClick:removeLine":d},null,8,["value","validation","settings","is-submit-processing"])]))}}),Q0={class:"flex flex-wrap gap-2"},ey={class:"flex flex-col"},ty={class:"flex flex-col"},ny={},iy=i.defineComponent({...ny,__name:"date-range",props:{clearable:{type:Boolean,default:!0},dateRange:{default:void 0},dateFormat:{default:()=>Y.AppConfigProvider.getConfig().dateFormats.uiDate},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1}},emits:["update:date-range"],setup(e,{emit:t}){const n=e,r=t,s=i.computed(()=>{if(n.predefinedDateRanges)return n.predefinedDateRanges;if(n.useDefaultPredefinedDateRanges){const a={};return D.forOwn(Y.DateTimeProvider.defaultDateRanges(),(l,c)=>{a[c]={label:l.label,from:l.from??void 0,to:l.to??void 0}}),a}}),o=(a,l)=>{r("update:date-range",{from:a?$n.startOfDay(new Date(a)):void 0,to:l?$n.endOfDay(new Date(l)):void 0})};return(a,l)=>{var h,u,p,f,g,m;const c=I.NButton,d=I.NDatePicker;return i.openBlock(),i.createElementBlock("div",Q0,[i.createVNode(d,{value:((u=(h=a.dateRange)==null?void 0:h.from)==null?void 0:u.getTime())??null,clearable:a.clearable,"is-date-disabled":y=>{var _,b;return((_=a.dateRange)==null?void 0:_.to)&&y>((b=a.dateRange)==null?void 0:b.to)},disabled:(p=a.disabled)==null?void 0:p.from,format:a.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[0]||(l[0]=y=>{var _,b;return o(y,(b=(_=a.dateRange)==null?void 0:_.to)==null?void 0:b.getTime())})},i.createSlots({_:2},[s.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",ey,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(y,_)=>(i.openBlock(),i.createBlock(c,{key:_,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:b=>{var S,x;return o((S=y==null?void 0:y.from)==null?void 0:S.getTime(),(x=y==null?void 0:y.to)==null?void 0:x.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"]),i.createVNode(d,{value:((g=(f=a.dateRange)==null?void 0:f.to)==null?void 0:g.getTime())??null,clearable:a.clearable,"is-date-disabled":y=>{var _,b;return((_=a.dateRange)==null?void 0:_.from)&&y<((b=a.dateRange)==null?void 0:b.from)},disabled:(m=a.disabled)==null?void 0:m.to,format:a.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[1]||(l[1]=y=>{var _,b;return o((b=(_=a.dateRange)==null?void 0:_.from)==null?void 0:b.getTime(),y)})},i.createSlots({_:2},[s.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",ty,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(y,_)=>(i.openBlock(),i.createBlock(c,{key:_,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:b=>{var S,x;return o((S=y==null?void 0:y.from)==null?void 0:S.getTime(),(x=y==null?void 0:y.to)==null?void 0:x.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"])])}}}),ry={class:"sc-lbl-date text-nowrap"},sy={},uo=i.defineComponent({...sy,__name:"date-time-label",props:{date:{},isTimeSecondary:{type:Boolean},isTimeOnSecondLine:{type:Boolean}},setup(e){const t=e,n=i.computed(()=>$n.format(t.date,Y.AppConfigProvider.getConfig().dateFormats.uiDate)),r=i.computed(()=>$n.format(t.date,"HH:mm"));return(s,o)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-col":s.isTimeOnSecondLine})},[i.createElementVNode("span",ry,i.toDisplayString(n.value),1),i.createElementVNode("span",{class:i.normalizeClass([{"text-sc-grey":s.isTimeSecondary,"ml-1":!s.isTimeOnSecondLine},"sc-lbl-time"])},i.toDisplayString(r.value),3)],2))}}),oy={class:"flex flex-row gap-2.5"},ay={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},ly={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},cy={class:"mb-0.5 sm:mb-0 sm:ml-3"},dy={},hy=i.defineComponent({...dy,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(e){return(t,n)=>{const r=Er,s=I.NButton,o=I.NPopover;return i.openBlock(),i.createElementBlock("div",oy,[i.createElementVNode("div",ay,[i.renderSlot(t.$slots,"main")]),i.createElementVNode("div",null,[i.createElementVNode("div",ly,[i.renderSlot(t.$slots,"extra-buttons"),i.createElementVNode("div",cy,[t.showCloseButton?(i.openBlock(),i.createBlock(o,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(s,{size:"small",type:"error",onClick:n[0]||(n[0]=a=>t.$emit("close"))},{default:i.withCtx(()=>[i.createVNode(r)]),_:1})]),default:i.withCtx(()=>[n[1]||(n[1]=i.createTextVNode(" Закрыть ",-1))]),_:1})):i.createCommentVNode("",!0)])])])])}}}),uy={key:0,class:"flex flex-row gap-2.5"},fy={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},py={},gy=i.defineComponent({...py,__name:"base-dialog",props:{show:{type:Boolean},title:{},sizes:{default:()=>({phone:{size:"small",scale:.98},tablet:{size:"small",scale:.9},default:{size:"medium",scale:.7}})},processing:{type:Boolean,default:!1},valid:{type:Boolean,default:!0},acceptButton:{default:()=>({show:!0,text:"ОК"})},cancelButton:{default:()=>({show:!0,text:"Отмена"})}},emits:["update:show","opening","closing","accept","processing:cancel"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=i.ref(r.show),a=i.ref(r.processing),l=bt.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=bt.initRefDependingOnDeviceResolution(r.sizes.phone.scale,r.sizes.tablet.scale,r.sizes.default.scale),d=i.computed(()=>window.innerWidth*c.value),h=()=>{s("opening"),o.value=!0,s("update:show",o.value)},u=(f="other")=>{if(a.value){s("processing:cancel",_=>{a.value=_});return}let g=!1;s("closing",f,()=>{g=!0}),g||(o.value=!1,s("update:show",o.value))},p=()=>{s("accept",g=>{a.value=g})};return i.watch(()=>r.show,f=>{f?h():u("other")}),i.watch(()=>r.processing,f=>{a.value=f}),t({open:h,close:u}),(f,g)=>{const m=I.NButton,y=I.NModal;return i.openBlock(),i.createBlock(y,{loading:a.value,show:o.value,"show-icon":!1,size:i.unref(l),style:i.normalizeStyle(`width: ${d.value}px`),title:f.title,"action-class":f.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:g[1]||(g[1]=_=>u("header")),onEsc:g[2]||(g[2]=_=>u("esc")),onMaskClick:g[3]||(g[3]=_=>u("mask"))},i.createSlots({default:i.withCtx(()=>[i.renderSlot(f.$slots,"default")]),_:2},[f.$slots.header?{name:"header",fn:i.withCtx(()=>[i.renderSlot(f.$slots,"header")]),key:"0"}:void 0,f.$slots.action||f.$slots["extra-action"]||f.acceptButton.show||f.cancelButton.show?{name:"action",fn:i.withCtx(()=>[f.$slots["extra-action"]?(i.openBlock(),i.createElementBlock("div",uy,[i.renderSlot(f.$slots,"extra-action")])):i.createCommentVNode("",!0),f.$slots.action||f.acceptButton.show||f.cancelButton.show?(i.openBlock(),i.createElementBlock("div",fy,[i.renderSlot(f.$slots,"action",{disabled:a.value}),f.acceptButton.show??!0?(i.openBlock(),i.createBlock(m,{key:0,disabled:a.value||!f.valid,size:i.unref(l),type:"primary",onClick:p},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(f.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","size"])):i.createCommentVNode("",!0),f.cancelButton.show??!0?(i.openBlock(),i.createBlock(m,{key:1,size:i.unref(l),type:"default",onClick:g[0]||(g[0]=_=>u("footer"))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(f.cancelButton.text??"Отмена"),1)]),_:1},8,["size"])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["loading","show","size","style","title","action-class"])}}}),my={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function yy(e,t){return i.openBlock(),i.createElementBlock("svg",my,[...t[0]||(t[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 176h40a40 40 0 0 1 40 40v208a40 40 0 0 1-40 40H136a40 40 0 0 1-40-40V216a40 40 0 0 1 40-40h40"},null,-1),i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m176 272l80 80l80-80M256 48v288"},null,-1)])])}const _y=i.markRaw({name:"ion-download-outline",render:yy}),by={},wy=i.defineComponent({...by,__name:"single-file-upload-selector",props:{draggedAreaText:{},accept:{},isError:{type:Boolean}},emits:["update:file"],setup(e,{emit:t}){const n=e,r=t,s=i.ref([]),o=i.computed(()=>s.value.map(l=>(l.status=n.isError?"error":"finished",l))),a=l=>{s.value=l;const c={name:"",content:""};if(l.length===0){r("update:file",null);return}const d=l[0];c.name=d.name;const h=new FileReader;h.addEventListener("load",()=>{c.content=h.result??"",r("update:file",c)}),h.readAsDataURL(d.file)};return(l,c)=>{const d=_y;return i.openBlock(),i.createBlock(i.unref(I.NUpload),{"file-list":o.value,"default-upload":!1,max:1,"show-retry-button":!1,action:"",accept:l.accept,"directory-dnd":"",class:"content-center","onUpdate:fileList":a},{default:i.withCtx(()=>[i.createVNode(i.unref(I.NUploadDragger),null,{default:i.withCtx(()=>[i.renderSlot(l.$slots,"dragged-area",{},()=>[i.createElementVNode("div",null,[i.createVNode(d,{class:"text-2xl"}),i.createElementVNode("div",null,i.toDisplayString(l.draggedAreaText??"Перетащите в эту область файл, который необходимо загрузить."),1)])])]),_:3})]),_:3},8,["file-list","accept"])}}}),vy={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function ky(e,t){return i.openBlock(),i.createElementBlock("svg",vy,[...t[0]||(t[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"square","stroke-miterlimit":"10","stroke-width":"44",d:"M465 127L241 384l-92-92m-9 93l-93-93m316-165L236 273"},null,-1)])])}const xy=i.markRaw({name:"ion-checkmark-done-sharp",render:ky}),Cy={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Sy(e,t){return i.openBlock(),i.createElementBlock("svg",Cy,[...t[0]||(t[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128h80m-384 0h240m64 256h80m-384 0h240m-96-128h240m-384 0h80"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"128",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"176",cy:"256",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"384",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1)])])}const By=i.markRaw({name:"ion-options-outline",render:Sy}),Ty={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},Ey={class:"flex-auto"},Ry={class:"sticky top-0 flex flex-none flex-col justify-start gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},$y={class:"flex flex-none flex-col-reverse justify-end gap-y-1 sm:flex-row sm:justify-start sm:gap-x-1 sm:gap-y-0"},Ny={},fo=i.defineComponent({...Ny,__name:"inline-view",props:{disabled:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!1},showApplyButton:{type:Boolean,default:!1},showCancelButton:{type:Boolean,default:!1}},emits:["edit","apply","cancel"],setup(e,{emit:t}){const n=t,r=i.ref(!1),s=()=>{n("edit")},o=()=>{r.value=!1},a=()=>{r.value=!0,n("apply",o)},l=()=>{n("cancel",o)};return(c,d)=>{const h=By,u=I.NButton,p=I.NPopover,f=xy,g=Er;return i.openBlock(),i.createElementBlock("div",Ty,[i.createElementVNode("div",Ey,[i.renderSlot(c.$slots,"default")]),i.createElementVNode("div",null,[i.createElementVNode("div",Ry,[i.createElementVNode("div",$y,[c.showEditButton?(i.openBlock(),i.createBlock(p,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(u,{disabled:c.disabled||r.value,type:"info",ghost:"",size:"small",onClick:s},{default:i.withCtx(()=>[i.createVNode(h)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[0]||(d[0]=i.createTextVNode(" Редактировать данные ",-1))]),_:1})):i.createCommentVNode("",!0),c.showApplyButton?(i.openBlock(),i.createBlock(p,{key:1,disabled:r.value,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(u,{disabled:c.disabled||r.value,type:"primary",size:"small",onClick:a},{default:i.withCtx(()=>[i.createVNode(f)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[1]||(d[1]=i.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),c.showCancelButton?(i.openBlock(),i.createBlock(p,{key:2,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(u,{disabled:c.disabled||r.value,type:"error",size:"small",onClick:l},{default:i.withCtx(()=>[i.createVNode(g)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[2]||(d[2]=i.createTextVNode(" Отменить изменения ",-1))]),_:1})):i.createCommentVNode("",!0)]),i.renderSlot(c.$slots,"extra-buttons")])])])}}}),Py={},zc=i.defineComponent({...Py,__name:"inline-editable-item",props:{disabled:{type:Boolean,default:!1},showEditor:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!0}},emits:["editor:apply","editor:cancel"],setup(e,{emit:t}){const n=e,r=t,s=i.ref(n.showEditor),o=l=>{r("editor:apply",d=>{s.value=!d,l()})},a=l=>{s.value=!1,l(),r("editor:cancel")};return i.onMounted(()=>{i.watch(()=>n.showEditor,l=>{s.value=l})}),(l,c)=>(i.openBlock(),i.createElementBlock("div",null,[s.value?(i.openBlock(),i.createBlock(fo,{key:1,disabled:l.disabled,"show-apply-button":!0,"show-cancel-button":!0,onApply:o,onCancel:a},{"extra-buttons":i.withCtx(()=>[i.renderSlot(l.$slots,"extra-editor-buttons")]),default:i.withCtx(()=>[i.renderSlot(l.$slots,"editor")]),_:3},8,["disabled"])):(i.openBlock(),i.createBlock(fo,{key:0,disabled:l.disabled,"show-edit-button":l.showEditButton,onEdit:c[0]||(c[0]=d=>s.value=!0)},{"extra-buttons":i.withCtx(()=>[i.renderSlot(l.$slots,"extra-viewer-buttons")]),default:i.withCtx(()=>[i.renderSlot(l.$slots,"viewer")]),_:3},8,["disabled","show-edit-button"]))]))}}),Fy={},My=i.defineComponent({...Fy,__name:"debounced-input",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:800},placeholder:{default:""}},emits:["update:value"],setup(e,{emit:t}){const n=e,r=t,s=i.ref(n.value),o=i.computed(()=>i.inject("debounce-input-time",n.debounceTime)),a=D.debounce(()=>r("update:value",s.value),o.value),l=c=>{s.value=c,a()};return i.watch(()=>n.value,c=>{s.value=c}),(c,d)=>(i.openBlock(),i.createBlock(i.unref(I.NInput),{value:s.value,"onUpdate:value":[d[0]||(d[0]=h=>s.value=h),l],clearable:c.clearable,placeholder:c.placeholder},{prefix:i.withCtx(()=>[i.renderSlot(c.$slots,"prefix")]),_:3},8,["value","clearable","placeholder"]))}}),Ay={},Vy=i.defineComponent({...Ay,__name:"phone-input",props:{value:{},debounceTime:{},disabled:{type:Boolean},placeholder:{},defaultCountry:{},preferredCountries:{},onlyCountries:{}},emits:["update:value"],setup(e,{emit:t}){const n=e,r=t,s=i.ref((n.value??"").replaceAll(/\D*/g,"")),o=D.debounce(c=>r("update:value",c),n.debounceTime??0),a=c=>{let d="";if(D.isString(c))s.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(D.isObject(c)){if(s.value=c.formatted,!c.valid)return;d=c instanceof qi.PhoneNumber?c.format("E.164"):`+${c.countryCallingCode}${c.nationalNumber}`}n.debounceTime?o(d):r("update:value",d)},l=c=>{const d=c.replaceAll(/\D*/g,"");try{const h=qi.parsePhoneNumberWithError(`+${d}`);h.isValid()?s.value=h.format("E.164"):h.getPossibleCountries().length>0&&(s.value=`+${d}`)}catch(h){if(h instanceof qi.ParseError)s.value=d;else throw h}};return i.watch(()=>n.value,c=>{var d;(c==null?void 0:c.replaceAll(/\D*/g,""))!==((d=s.value)==null?void 0:d.replaceAll(/\D*/g,""))&&l(c)},{immediate:!0}),i.onBeforeMount(()=>l(s.value??"")),(c,d)=>(i.openBlock(),i.createBlock(i.unref(jh.VueTelInput),{modelValue:s.value,"onUpdate:modelValue":[d[0]||(d[0]=h=>s.value=h),a],"auto-default-country":!1,"auto-format":!0,"default-country":c.defaultCountry,disabled:c.disabled,"input-options":{placeholder:c.placeholder},"preferred-countries":c.preferredCountries,"only-countries":c.onlyCountries,mode:"international",class:"tel-input"},null,8,["modelValue","default-country","disabled","input-options","preferred-countries","only-countries"]))}}),Iy=jn(Vy,[["__scopeId","data-v-751dbb0e"]]),Oy={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function zy(e,t){return i.openBlock(),i.createElementBlock("svg",Oy,[...t[0]||(t[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6m-7 1l9-9m-5 0h5v5"},null,-1)])])}const Ly=i.markRaw({name:"tabler-external-link",render:zy}),Dy={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},Hy=["href"],Wy={},jy=i.defineComponent({...Wy,__name:"external-link",props:{text:{},url:{},description:{}},setup(e){return(t,n)=>{const r=Ly,s=I.NTooltip;return i.openBlock(),i.createBlock(s,{disabled:i.unref(D.isUndefined)(t.description),placement:"top-start"},{trigger:i.withCtx(()=>[i.createElementVNode("span",Dy,[i.createElementVNode("a",{href:t.url,target:"_blank",class:"no-underline"},i.toDisplayString(t.text),9,Hy),i.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.description),1)]),_:1},8,["disabled"])}}}),qy={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Xy(e,t){return i.openBlock(),i.createElementBlock("svg",qy,[...t[0]||(t[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192Z"},null,-1),i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 256H176"},null,-1)])])}const Yy=i.markRaw({name:"ion-remove-circle-outline",render:Xy});let is=[];const Lc=new WeakMap;function Uy(){is.forEach(e=>e(...Lc.get(e))),is=[]}function Dc(e,...t){Lc.set(e,t),!is.includes(e)&&is.push(e)===1&&requestAnimationFrame(Uy)}function ar(e,t){let{target:n}=e;for(;n;){if(n.dataset&&n.dataset[t]!==void 0)return!0;n=n.parentElement}return!1}function lr(e){return e.composedPath()[0]||null}function cr(e){return typeof e=="string"?e.endsWith("px")?Number(e.slice(0,e.length-2)):Number(e):e}function dr(e){if(e!=null)return typeof e=="number"?`${e}px`:e.endsWith("px")?e:`${e}px`}function Gt(e,t){const n=e.trim().split(/\s+/g),r={top:n[0]};switch(n.length){case 1:r.right=n[0],r.bottom=n[0],r.left=n[0];break;case 2:r.right=n[1],r.left=n[1],r.bottom=n[0];break;case 3:r.right=n[1],r.bottom=n[2],r.left=n[1];break;case 4:r.right=n[1],r.bottom=n[2],r.left=n[3];break;default:throw new Error("[seemly/getMargin]:"+e+" is not a valid value.")}return t===void 0?r:r[t]}const Hc={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#0FF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000",blanchedalmond:"#FFEBCD",blue:"#00F",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#0FF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#F0F",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#0F0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#F0F",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#F00",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFF",whitesmoke:"#F5F5F5",yellow:"#FF0",yellowgreen:"#9ACD32",transparent:"#0000"};function Gy(e,t,n){t/=100,n/=100;let r=(s,o=(s+e/60)%6)=>n-n*t*Math.max(Math.min(o,4-o,1),0);return[r(5)*255,r(3)*255,r(1)*255]}function Ky(e,t,n){t/=100,n/=100;let r=t*Math.min(n,1-n),s=(o,a=(o+e/30)%12)=>n-r*Math.max(Math.min(a-3,9-a,1),-1);return[s(0)*255,s(8)*255,s(4)*255]}const ln="^\\s*",cn="\\s*$",Vn="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",It="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",oi="([0-9A-Fa-f])",ai="([0-9A-Fa-f]{2})",Wc=new RegExp(`${ln}hsl\\s*\\(${It},${Vn},${Vn}\\)${cn}`),jc=new RegExp(`${ln}hsv\\s*\\(${It},${Vn},${Vn}\\)${cn}`),qc=new RegExp(`${ln}hsla\\s*\\(${It},${Vn},${Vn},${It}\\)${cn}`),Xc=new RegExp(`${ln}hsva\\s*\\(${It},${Vn},${Vn},${It}\\)${cn}`),Zy=new RegExp(`${ln}rgb\\s*\\(${It},${It},${It}\\)${cn}`),Jy=new RegExp(`${ln}rgba\\s*\\(${It},${It},${It},${It}\\)${cn}`),Qy=new RegExp(`${ln}#${oi}${oi}${oi}${cn}`),e_=new RegExp(`${ln}#${ai}${ai}${ai}${cn}`),t_=new RegExp(`${ln}#${oi}${oi}${oi}${oi}${cn}`),n_=new RegExp(`${ln}#${ai}${ai}${ai}${ai}${cn}`);function Rt(e){return parseInt(e,16)}function i_(e){try{let t;if(t=qc.exec(e))return[ss(t[1]),In(t[5]),In(t[9]),ci(t[13])];if(t=Wc.exec(e))return[ss(t[1]),In(t[5]),In(t[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${e}.`)}catch(t){throw t}}function r_(e){try{let t;if(t=Xc.exec(e))return[ss(t[1]),In(t[5]),In(t[9]),ci(t[13])];if(t=jc.exec(e))return[ss(t[1]),In(t[5]),In(t[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${e}.`)}catch(t){throw t}}function li(e){try{let t;if(t=e_.exec(e))return[Rt(t[1]),Rt(t[2]),Rt(t[3]),1];if(t=Zy.exec(e))return[ht(t[1]),ht(t[5]),ht(t[9]),1];if(t=Jy.exec(e))return[ht(t[1]),ht(t[5]),ht(t[9]),ci(t[13])];if(t=Qy.exec(e))return[Rt(t[1]+t[1]),Rt(t[2]+t[2]),Rt(t[3]+t[3]),1];if(t=n_.exec(e))return[Rt(t[1]),Rt(t[2]),Rt(t[3]),ci(Rt(t[4])/255)];if(t=t_.exec(e))return[Rt(t[1]+t[1]),Rt(t[2]+t[2]),Rt(t[3]+t[3]),ci(Rt(t[4]+t[4])/255)];if(e in Hc)return li(Hc[e]);if(Wc.test(e)||qc.test(e)){const[n,r,s,o]=i_(e);return[...Ky(n,r,s),o]}else if(jc.test(e)||Xc.test(e)){const[n,r,s,o]=r_(e);return[...Gy(n,r,s),o]}throw new Error(`[seemly/rgba]: Invalid color value ${e}.`)}catch(t){throw t}}function s_(e){return e>1?1:e<0?0:e}function po(e,t,n,r){return`rgba(${ht(e)}, ${ht(t)}, ${ht(n)}, ${s_(r)})`}function go(e,t,n,r,s){return ht((e*t*(1-r)+n*r)/s)}function o_(e,t){Array.isArray(e)||(e=li(e)),Array.isArray(t)||(t=li(t));const n=e[3],r=t[3],s=ci(n+r-n*r);return po(go(e[0],n,t[0],r,s),go(e[1],n,t[1],r,s),go(e[2],n,t[2],r,s),s)}function Ne(e,t){const[n,r,s,o=1]=Array.isArray(e)?e:li(e);return typeof t.alpha=="number"?po(n,r,s,t.alpha):po(n,r,s,o)}function rs(e,t){const[n,r,s,o=1]=Array.isArray(e)?e:li(e),{lightness:a=1,alpha:l=1}=t;return a_([n*a,r*a,s*a,o*l])}function ci(e){const t=Math.round(Number(e)*100)/100;return t>1?1:t<0?0:t}function ss(e){const t=Math.round(Number(e));return t>=360||t<0?0:t}function ht(e){const t=Math.round(Number(e));return t>255?255:t<0?0:t}function In(e){const t=Math.round(Number(e));return t>100?100:t<0?0:t}function a_(e){const[t,n,r]=e;return 3 in e?`rgba(${ht(t)}, ${ht(n)}, ${ht(r)}, ${ci(e[3])})`:`rgba(${ht(t)}, ${ht(n)}, ${ht(r)}, 1)`}function l_(e=8){return Math.random().toString(16).slice(2,2+e)}function Yc(e){return Array.isArray(e)?e:[e]}const mo={STOP:"STOP"};function Uc(e,t){const n=t(e);e.children!==void 0&&n!==mo.STOP&&e.children.forEach(r=>Uc(r,t))}function c_(e,t={}){const{preserveGroup:n=!1}=t,r=[],s=n?a=>{a.isLeaf||(r.push(a.key),o(a.children))}:a=>{a.isLeaf||(a.isGroup||r.push(a.key),o(a.children))};function o(a){a.forEach(s)}return o(e),r}function d_(e,t){const{isLeaf:n}=e;return n!==void 0?n:!t(e)}function h_(e){return e.children}function u_(e){return e.key}function f_(){return!1}function p_(e,t){const{isLeaf:n}=e;return!(n===!1&&!Array.isArray(t(e)))}function g_(e){return e.disabled===!0}function m_(e,t){return e.isLeaf===!1&&!Array.isArray(t(e))}function y_(e,t){if(e.isLeaf===!0){const n=t(e);if(Array.isArray(n)&&n.length>0)return!0}return!1}function yo(e){var t;return e==null?[]:Array.isArray(e)?e:(t=e.checkedKeys)!==null&&t!==void 0?t:[]}function _o(e){var t;return e==null||Array.isArray(e)?[]:(t=e.indeterminateKeys)!==null&&t!==void 0?t:[]}function __(e,t){const n=new Set(e);return t.forEach(r=>{n.has(r)||n.add(r)}),Array.from(n)}function b_(e,t){const n=new Set(e);return t.forEach(r=>{n.has(r)&&n.delete(r)}),Array.from(n)}function w_(e){return(e==null?void 0:e.type)==="group"}function v_(e){const t=new Map;return e.forEach((n,r)=>{t.set(n.key,r)}),n=>{var r;return(r=t.get(n))!==null&&r!==void 0?r:null}}class k_ extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function x_(e,t,n,r){return os(t.concat(e),n,r,!1)}function C_(e,t){const n=new Set;return e.forEach(r=>{const s=t.treeNodeMap.get(r);if(s!==void 0){let o=s.parent;for(;o!==null&&!(o.disabled||n.has(o.key));)n.add(o.key),o=o.parent}}),n}function S_(e,t,n,r){const s=os(t,n,r,!1),o=os(e,n,r,!0),a=C_(e,n),l=[];return s.forEach(c=>{(o.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>s.delete(c)),s}function bo(e,t){const{checkedKeys:n,keysToCheck:r,keysToUncheck:s,indeterminateKeys:o,cascade:a,leafOnly:l,checkStrategy:c,allowNotLoaded:d}=e;if(!a)return r!==void 0?{checkedKeys:__(n,r),indeterminateKeys:Array.from(o)}:s!==void 0?{checkedKeys:b_(n,s),indeterminateKeys:Array.from(o)}:{checkedKeys:Array.from(n),indeterminateKeys:Array.from(o)};const{levelTreeNodeMap:h}=t;let u;s!==void 0?u=S_(s,n,t,d):r!==void 0?u=x_(r,n,t,d):u=os(n,t,d,!1);const p=c==="parent",f=c==="child"||l,g=u,m=new Set,y=Math.max.apply(null,Array.from(h.keys()));for(let _=y;_>=0;_-=1){const b=_===0,S=h.get(_);for(const x of S){if(x.isLeaf)continue;const{key:v,shallowLoaded:B}=x;if(f&&B&&x.children.forEach(N=>{!N.disabled&&!N.isLeaf&&N.shallowLoaded&&g.has(N.key)&&g.delete(N.key)}),x.disabled||!B)continue;let k=!0,E=!1,P=!0;for(const N of x.children){const j=N.key;if(!N.disabled){if(P&&(P=!1),g.has(j))E=!0;else if(m.has(j)){E=!0,k=!1;break}else if(k=!1,E)break}}k&&!P?(p&&x.children.forEach(N=>{!N.disabled&&g.has(N.key)&&g.delete(N.key)}),g.add(v)):E&&m.add(v),b&&f&&g.has(v)&&g.delete(v)}}return{checkedKeys:Array.from(g),indeterminateKeys:Array.from(m)}}function os(e,t,n,r){const{treeNodeMap:s,getChildren:o}=t,a=new Set,l=new Set(e);return e.forEach(c=>{const d=s.get(c);d!==void 0&&Uc(d,h=>{if(h.disabled)return mo.STOP;const{key:u}=h;if(!a.has(u)&&(a.add(u),l.add(u),m_(h.rawNode,o))){if(r)return mo.STOP;if(!n)throw new k_}})}),l}function B_(e,{includeGroup:t=!1,includeSelf:n=!0},r){var s;const o=r.treeNodeMap;let a=e==null?null:(s=o.get(e))!==null&&s!==void 0?s:null;const l={keyPath:[],treeNodePath:[],treeNode:a};if(a!=null&&a.ignored)return l.treeNode=null,l;for(;a;)!a.ignored&&(t||!a.isGroup)&&l.treeNodePath.push(a),a=a.parent;return l.treeNodePath.reverse(),n||l.treeNodePath.pop(),l.keyPath=l.treeNodePath.map(c=>c.key),l}function T_(e){if(e.length===0)return null;const t=e[0];return t.isGroup||t.ignored||t.disabled?t.getNext():t}function E_(e,t){const n=e.siblings,r=n.length,{index:s}=e;return t?n[(s+1)%r]:s===n.length-1?null:n[s+1]}function Gc(e,t,{loop:n=!1,includeDisabled:r=!1}={}){const s=t==="prev"?R_:E_,o={reverse:t==="prev"};let a=!1,l=null;function c(d){if(d!==null){if(d===e){if(!a)a=!0;else if(!e.disabled&&!e.isGroup){l=e;return}}else if((!d.disabled||r)&&!d.ignored&&!d.isGroup){l=d;return}if(d.isGroup){const h=wo(d,o);h!==null?l=h:c(s(d,n))}else{const h=s(d,!1);if(h!==null)c(h);else{const u=$_(d);u!=null&&u.isGroup?c(s(u,n)):n&&c(s(d,!0))}}}}return c(e),l}function R_(e,t){const n=e.siblings,r=n.length,{index:s}=e;return t?n[(s-1+r)%r]:s===0?null:n[s-1]}function $_(e){return e.parent}function wo(e,t={}){const{reverse:n=!1}=t,{children:r}=e;if(r){const{length:s}=r,o=n?s-1:0,a=n?-1:s,l=n?-1:1;for(let c=o;c!==a;c+=l){const d=r[c];if(!d.disabled&&!d.ignored)if(d.isGroup){const h=wo(d,t);if(h!==null)return h}else return d}}return null}const N_={getChild(){return this.ignored?null:wo(this)},getParent(){const{parent:e}=this;return e!=null&&e.isGroup?e.getParent():e},getNext(e={}){return Gc(this,"next",e)},getPrev(e={}){return Gc(this,"prev",e)}};function P_(e,t){const n=t?new Set(t):void 0,r=[];function s(o){o.forEach(a=>{r.push(a),!(a.isLeaf||!a.children||a.ignored)&&(a.isGroup||n===void 0||n.has(a.key))&&s(a.children)})}return s(e),r}function F_(e,t){const n=e.key;for(;t;){if(t.key===n)return!0;t=t.parent}return!1}var M_={};function Kc(e,t,n,r,s,o=null,a=0){const l=[];return e.forEach((c,d)=>{var h;M_.NODE_ENV!=="production"&&y_(c,s)&&console.error("[treemate]: node",c,"is invalid");const u=Object.create(r);if(u.rawNode=c,u.siblings=l,u.level=a,u.index=d,u.isFirstChild=d===0,u.isLastChild=d+1===e.length,u.parent=o,!u.ignored){const p=s(c);Array.isArray(p)&&(u.children=Kc(p,t,n,r,s,u,a+1))}l.push(u),t.set(u.key,u),n.has(a)||n.set(a,[]),(h=n.get(a))===null||h===void 0||h.push(u)}),l}function A_(e,t={}){var n;const r=new Map,s=new Map,{getDisabled:o=g_,getIgnored:a=f_,getIsGroup:l=w_,getKey:c=u_}=t,d=(n=t.getChildren)!==null&&n!==void 0?n:h_,h=t.ignoreEmptyChildren?x=>{const v=d(x);return Array.isArray(v)?v.length?v:null:v}:d,u=Object.assign({get key(){return c(this.rawNode)},get disabled(){return o(this.rawNode)},get isGroup(){return l(this.rawNode)},get isLeaf(){return d_(this.rawNode,h)},get shallowLoaded(){return p_(this.rawNode,h)},get ignored(){return a(this.rawNode)},contains(x){return F_(this,x)}},N_),p=Kc(e,r,s,u,h);function f(x){if(x==null)return null;const v=r.get(x);return v&&!v.isGroup&&!v.ignored?v:null}function g(x){if(x==null)return null;const v=r.get(x);return v&&!v.ignored?v:null}function m(x,v){const B=g(x);return B?B.getPrev(v):null}function y(x,v){const B=g(x);return B?B.getNext(v):null}function _(x){const v=g(x);return v?v.getParent():null}function b(x){const v=g(x);return v?v.getChild():null}const S={treeNodes:p,treeNodeMap:r,levelTreeNodeMap:s,maxLevel:Math.max(...s.keys()),getChildren:h,getFlattenedNodes(x){return P_(p,x)},getNode:f,getPrev:m,getNext:y,getParent:_,getChild:b,getFirstAvailableNode(){return T_(p)},getPath(x,v={}){return B_(x,v,S)},getCheckedKeys(x,v={}){const{cascade:B=!0,leafOnly:k=!1,checkStrategy:E="all",allowNotLoaded:P=!1}=v;return bo({checkedKeys:yo(x),indeterminateKeys:_o(x),cascade:B,leafOnly:k,checkStrategy:E,allowNotLoaded:P},S)},check(x,v,B={}){const{cascade:k=!0,leafOnly:E=!1,checkStrategy:P="all",allowNotLoaded:N=!1}=B;return bo({checkedKeys:yo(v),indeterminateKeys:_o(v),keysToCheck:x==null?[]:Yc(x),cascade:k,leafOnly:E,checkStrategy:P,allowNotLoaded:N},S)},uncheck(x,v,B={}){const{cascade:k=!0,leafOnly:E=!1,checkStrategy:P="all",allowNotLoaded:N=!1}=B;return bo({checkedKeys:yo(v),indeterminateKeys:_o(v),keysToUncheck:x==null?[]:Yc(x),cascade:k,leafOnly:E,checkStrategy:P,allowNotLoaded:N},S)},getNonLeafKeys(x={}){return c_(p,x)}};return S}function as(e){return e.composedPath()[0]}const V_={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function I_(e,t,n){if(e==="mousemoveoutside"){const r=s=>{t.contains(as(s))||n(s)};return{mousemove:r,touchstart:r}}else if(e==="clickoutside"){let r=!1;const s=a=>{r=!t.contains(as(a))},o=a=>{r&&(t.contains(as(a))||n(a))};return{mousedown:s,mouseup:o,touchstart:s,touchend:o}}return console.error(`[evtd/create-trap-handler]: name \`${e}\` is invalid. This could be a bug of evtd.`),{}}function Zc(e,t,n){const r=V_[e];let s=r.get(t);s===void 0&&r.set(t,s=new WeakMap);let o=s.get(n);return o===void 0&&s.set(n,o=I_(e,t,n)),o}function O_(e,t,n,r){if(e==="mousemoveoutside"||e==="clickoutside"){const s=Zc(e,t,n);return Object.keys(s).forEach(o=>{Ct(o,document,s[o],r)}),!0}return!1}function z_(e,t,n,r){if(e==="mousemoveoutside"||e==="clickoutside"){const s=Zc(e,t,n);return Object.keys(s).forEach(o=>{tt(o,document,s[o],r)}),!0}return!1}function L_(){if(typeof window>"u")return{on:()=>{},off:()=>{}};const e=new WeakMap,t=new WeakMap;function n(){e.set(this,!0)}function r(){e.set(this,!0),t.set(this,!0)}function s(k,E,P){const N=k[E];return k[E]=function(){return P.apply(k,arguments),N.apply(k,arguments)},k}function o(k,E){k[E]=Event.prototype[E]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var k;return(k=a.get(this))!==null&&k!==void 0?k:null}function d(k,E){l!==void 0&&Object.defineProperty(k,"currentTarget",{configurable:!0,enumerable:!0,get:E??l.get})}const h={bubble:{},capture:{}},u={};function p(){const k=function(E){const{type:P,eventPhase:N,bubbles:j}=E,X=as(E);if(N===2)return;const A=N===1?"capture":"bubble";let V=X;const L=[];for(;V===null&&(V=window),L.push(V),V!==window;)V=V.parentNode||null;const Z=h.capture[P],F=h.bubble[P];if(s(E,"stopPropagation",n),s(E,"stopImmediatePropagation",r),d(E,c),A==="capture"){if(Z===void 0)return;for(let R=L.length-1;R>=0&&!e.has(E);--R){const $=L[R],M=Z.get($);if(M!==void 0){a.set(E,$);for(const U of M){if(t.has(E))break;U(E)}}if(R===0&&!j&&F!==void 0){const U=F.get($);if(U!==void 0)for(const z of U){if(t.has(E))break;z(E)}}}}else if(A==="bubble"){if(F===void 0)return;for(let R=0;R<L.length&&!e.has(E);++R){const $=L[R],M=F.get($);if(M!==void 0){a.set(E,$);for(const U of M){if(t.has(E))break;U(E)}}}}o(E,"stopPropagation"),o(E,"stopImmediatePropagation"),d(E)};return k.displayName="evtdUnifiedHandler",k}function f(){const k=function(E){const{type:P,eventPhase:N}=E;if(N!==2)return;const j=u[P];j!==void 0&&j.forEach(X=>X(E))};return k.displayName="evtdUnifiedWindowEventHandler",k}const g=p(),m=f();function y(k,E){const P=h[k];return P[E]===void 0&&(P[E]=new Map,window.addEventListener(E,g,k==="capture")),P[E]}function _(k){return u[k]===void 0&&(u[k]=new Set,window.addEventListener(k,m)),u[k]}function b(k,E){let P=k.get(E);return P===void 0&&k.set(E,P=new Set),P}function S(k,E,P,N){const j=h[E][P];if(j!==void 0){const X=j.get(k);if(X!==void 0&&X.has(N))return!0}return!1}function x(k,E){const P=u[k];return!!(P!==void 0&&P.has(E))}function v(k,E,P,N){let j;if(typeof N=="object"&&N.once===!0?j=Z=>{B(k,E,j,N),P(Z)}:j=P,O_(k,E,j,N))return;const A=N===!0||typeof N=="object"&&N.capture===!0?"capture":"bubble",V=y(A,k),L=b(V,E);if(L.has(j)||L.add(j),E===window){const Z=_(k);Z.has(j)||Z.add(j)}}function B(k,E,P,N){if(z_(k,E,P,N))return;const X=N===!0||typeof N=="object"&&N.capture===!0,A=X?"capture":"bubble",V=y(A,k),L=b(V,E);if(E===window&&!S(E,X?"bubble":"capture",k,P)&&x(k,P)){const F=u[k];F.delete(P),F.size===0&&(window.removeEventListener(k,m),u[k]=void 0)}L.has(P)&&L.delete(P),L.size===0&&V.delete(E),V.size===0&&(window.removeEventListener(k,g,A==="capture"),h[A][k]=void 0)}return{on:v,off:B}}const{on:Ct,off:tt}=L_(),Vi="@@mmoContext",D_={mounted(e,{value:t}){e[Vi]={handler:void 0},typeof t=="function"&&(e[Vi].handler=t,Ct("mousemoveoutside",e,t))},updated(e,{value:t}){const n=e[Vi];typeof t=="function"?n.handler?n.handler!==t&&(tt("mousemoveoutside",e,n.handler),n.handler=t,Ct("mousemoveoutside",e,t)):(e[Vi].handler=t,Ct("mousemoveoutside",e,t)):n.handler&&(tt("mousemoveoutside",e,n.handler),n.handler=void 0)},unmounted(e){const{handler:t}=e[Vi];t&&tt("mousemoveoutside",e,t),e[Vi].handler=void 0}},Ii="@@coContext",ls={mounted(e,{value:t,modifiers:n}){e[Ii]={handler:void 0},typeof t=="function"&&(e[Ii].handler=t,Ct("clickoutside",e,t,{capture:n.capture}))},updated(e,{value:t,modifiers:n}){const r=e[Ii];typeof t=="function"?r.handler?r.handler!==t&&(tt("clickoutside",e,r.handler,{capture:n.capture}),r.handler=t,Ct("clickoutside",e,t,{capture:n.capture})):(e[Ii].handler=t,Ct("clickoutside",e,t,{capture:n.capture})):r.handler&&(tt("clickoutside",e,r.handler,{capture:n.capture}),r.handler=void 0)},unmounted(e,{modifiers:t}){const{handler:n}=e[Ii];n&&tt("clickoutside",e,n,{capture:t.capture}),e[Ii].handler=void 0}};function H_(e,t){console.error(`[vdirs/${e}]: ${t}`)}class W_{constructor(){this.elementZIndex=new Map,this.nextZIndex=2e3}get elementCount(){return this.elementZIndex.size}ensureZIndex(t,n){const{elementZIndex:r}=this;if(n!==void 0){t.style.zIndex=`${n}`,r.delete(t);return}const{nextZIndex:s}=this;r.has(t)&&r.get(t)+1===this.nextZIndex||(t.style.zIndex=`${s}`,r.set(t,s),this.nextZIndex=s+1,this.squashState())}unregister(t,n){const{elementZIndex:r}=this;r.has(t)?r.delete(t):n===void 0&&H_("z-index-manager/unregister-element","Element not found when unregistering."),this.squashState()}squashState(){const{elementCount:t}=this;t||(this.nextZIndex=2e3),this.nextZIndex-t>2500&&this.rearrange()}rearrange(){const t=Array.from(this.elementZIndex.entries());t.sort((n,r)=>n[1]-r[1]),this.nextZIndex=2e3,t.forEach(n=>{const r=n[0],s=this.nextZIndex++;`${s}`!==r.style.zIndex&&(r.style.zIndex=`${s}`)})}}const vo=new W_,Oi="@@ziContext",Jc={mounted(e,t){const{value:n={}}=t,{zIndex:r,enabled:s}=n;e[Oi]={enabled:!!s,initialized:!1},s&&(vo.ensureZIndex(e,r),e[Oi].initialized=!0)},updated(e,t){const{value:n={}}=t,{zIndex:r,enabled:s}=n,o=e[Oi].enabled;s&&!o&&(vo.ensureZIndex(e,r),e[Oi].initialized=!0),e[Oi].enabled=!!s},unmounted(e,t){if(!e[Oi].initialized)return;const{value:n={}}=t,{zIndex:r}=n;vo.unregister(e,r)}};function j_(e){const t=i.ref(!!e.value);if(t.value)return i.readonly(t);const n=i.watch(e,r=>{r&&(t.value=!0,n())});return i.readonly(t)}function qt(e){const t=i.computed(e),n=i.ref(t.value);return i.watch(t,r=>{n.value=r}),typeof e=="function"?n:{__v_isRef:!0,get value(){return n.value},set value(r){e.set(r)}}}const q_=typeof window<"u";let zi,hr;(()=>{var e,t;zi=q_?(t=(e=document)===null||e===void 0?void 0:e.fonts)===null||t===void 0?void 0:t.ready:void 0,hr=!1,zi!==void 0?zi.then(()=>{hr=!0}):hr=!0})();function X_(e){if(hr)return;let t=!1;i.onMounted(()=>{hr||zi==null||zi.then(()=>{t||e()})}),i.onBeforeUnmount(()=>{t=!0})}function ko(e,t){return i.watch(e,n=>{n!==void 0&&(t.value=n)}),i.computed(()=>e.value===void 0?t.value:e.value)}function cs(){const e=i.ref(!1);return i.onMounted(()=>{e.value=!0}),i.readonly(e)}function Qc(e,t){return i.computed(()=>{for(const n of t)if(e[n]!==void 0)return e[n];return e[t[t.length-1]]})}const Y_=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function U_(){return Y_}function xo(e,t,n="default"){const r=t[n];if(r===void 0)throw new Error(`[vueuc/${e}]: slot[${n}] is empty.`);return r()}function Co(e,t=!0,n=[]){return e.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&n.push(i.createTextVNode(String(r)));return}if(Array.isArray(r)){Co(r,t,n);return}if(r.type===i.Fragment){if(r.children===null)return;Array.isArray(r.children)&&Co(r.children,t,n)}else r.type!==i.Comment&&n.push(r)}}),n}function ed(e,t,n="default"){const r=t[n];if(r===void 0)throw new Error(`[vueuc/${e}]: slot[${n}] is empty.`);const s=Co(r());if(s.length===1)return s[0];throw new Error(`[vueuc/${e}]: slot[${n}] should have exactly one child.`)}let On=null;function td(){if(On===null&&(On=document.getElementById("v-binder-view-measurer"),On===null)){On=document.createElement("div"),On.id="v-binder-view-measurer";const{style:e}=On;e.position="fixed",e.left="0",e.right="0",e.top="0",e.bottom="0",e.pointerEvents="none",e.visibility="hidden",document.body.appendChild(On)}return On.getBoundingClientRect()}function G_(e,t){const n=td();return{top:t,left:e,height:0,width:0,right:n.width-e,bottom:n.height-t}}function So(e){const t=e.getBoundingClientRect(),n=td();return{left:t.left-n.left,top:t.top-n.top,bottom:n.height+n.top-t.bottom,right:n.width+n.left-t.right,width:t.width,height:t.height}}function K_(e){return e.nodeType===9?null:e.parentNode}function nd(e){if(e===null)return null;const t=K_(e);if(t===null)return null;if(t.nodeType===9)return document;if(t.nodeType===1){const{overflow:n,overflowX:r,overflowY:s}=getComputedStyle(t);if(/(auto|scroll|overlay)/.test(n+s+r))return t}return nd(t)}const id=i.defineComponent({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(e){var t;i.provide("VBinder",(t=i.getCurrentInstance())===null||t===void 0?void 0:t.proxy);const n=i.inject("VBinder",null),r=i.ref(null),s=_=>{r.value=_,n&&e.syncTargetWithParent&&n.setTargetRef(_)};let o=[];const a=()=>{let _=r.value;for(;_=nd(_),_!==null;)o.push(_);for(const b of o)Ct("scroll",b,u,!0)},l=()=>{for(const _ of o)tt("scroll",_,u,!0);o=[]},c=new Set,d=_=>{c.size===0&&a(),c.has(_)||c.add(_)},h=_=>{c.has(_)&&c.delete(_),c.size===0&&l()},u=()=>{Dc(p)},p=()=>{c.forEach(_=>_())},f=new Set,g=_=>{f.size===0&&Ct("resize",window,y),f.has(_)||f.add(_)},m=_=>{f.has(_)&&f.delete(_),f.size===0&&tt("resize",window,y)},y=()=>{f.forEach(_=>_())};return i.onBeforeUnmount(()=>{tt("resize",window,y),l()}),{targetRef:r,setTargetRef:s,addScrollListener:d,removeScrollListener:h,addResizeListener:g,removeResizeListener:m}},render(){return xo("binder",this.$slots)}}),rd=i.defineComponent({name:"Target",setup(){const{setTargetRef:e,syncTarget:t}=i.inject("VBinder");return{syncTarget:t,setTargetDirective:{mounted:e,updated:e}}},render(){const{syncTarget:e,setTargetDirective:t}=this;return e?i.withDirectives(ed("follower",this.$slots),[[t]]):ed("follower",this.$slots)}}),Z_="@css-render/vue3-ssr";function J_(e,t){return`<style cssr-id="${e}">
|
|
104
104
|
${t}
|
|
105
105
|
</style>`}function Q_(e,t,n){const{styles:r,ids:s}=n;s.has(e)||r!==null&&(s.add(e),r.push(J_(e,t)))}const eb=typeof document<"u";function di(){if(eb)return;const e=i.inject(Z_,null);if(e!==null)return{adapter:(t,n)=>Q_(t,n,e),context:e}}function sd(e,t){console.error(`[vueuc/${e}]: ${t}`)}function tb(e){let t=0;for(let n=0;n<e.length;++n)e[n]==="&"&&++t;return t}const od=/\s*,(?![^(]*\))\s*/g,nb=/\s+/g;function ib(e,t){const n=[];return t.split(od).forEach(r=>{let s=tb(r);if(s){if(s===1){e.forEach(a=>{n.push(r.replace("&",a))});return}}else{e.forEach(a=>{n.push((a&&a+" ")+r)});return}let o=[r];for(;s--;){const a=[];o.forEach(l=>{e.forEach(c=>{a.push(l.replace("&",c))})}),o=a}o.forEach(a=>n.push(a))}),n}function rb(e,t){const n=[];return t.split(od).forEach(r=>{e.forEach(s=>{n.push((s&&s+" ")+r)})}),n}function sb(e){let t=[""];return e.forEach(n=>{n=n&&n.trim(),n&&(n.includes("&")?t=ib(t,n):t=rb(t,n))}),t.join(", ").replace(nb," ")}function ad(e){if(!e)return;const t=e.parentElement;t&&t.removeChild(e)}function ds(e,t){return(t??document.head).querySelector(`style[cssr-id="${e}"]`)}function ob(e){const t=document.createElement("style");return t.setAttribute("cssr-id",e),t}function hs(e){return e?/^\s*@(s|m)/.test(e):!1}const ab=/[A-Z]/g;function ld(e){return e.replace(ab,t=>"-"+t.toLowerCase())}function lb(e,t=" "){return typeof e=="object"&&e!==null?` {
|
|
106
106
|
`+Object.entries(e).map(n=>t+` ${ld(n[0])}: ${n[1]};`).join(`
|