@snabcentr/vue-ui-lib 5.6.0 → 5.6.1

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.
@@ -100,7 +100,7 @@
100
100
  }
101
101
  gl_FragColor = texel;
102
102
  }
103
- `}},Po=vi.Multiply,F0=[1,0,0,0,1,0,0,0,1],ui=new Cn(9),V0=St.Utils,Fd=new re,ua=new Cn([0,0,1,0,0,1,0,1,1,0,1,1]),Se={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Ke.document?Ke.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new vi,group:{removeChild:function(n,e){if(n.children)for(let i=0;i<n.children.length;i++)Se.group.removeChild(n.children[i],e);n._renderer.texture&&(e.deleteTexture(n._renderer.texture),delete n._renderer.texture),n._renderer.positionBuffer&&(e.deleteBuffer(n._renderer.positionBuffer),delete n._renderer.positionBuffer)},render:function(n,e){if(!this._visible)return;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const i=this.parent,r=i._matrix&&i._matrix.manual||i._flagMatrix,o=this._matrix.manual||this._flagMatrix;if((r||o)&&(this._renderer.matrix||(this._renderer.matrix=new Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,i._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re),this._scale instanceof re?(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(i._renderer.type)||(this._renderer.scale.x*=i._renderer.scale.x,this._renderer.scale.y*=i._renderer.scale.y),r&&(this._flagMatrix=!0)),this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const a=St.Utils.getRendererType(this._mask._renderer.type);Se[a].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}this._flagOpacity=i._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);let s;if(this._flagSubtractions)for(s=0;s<this.subtractions.length;s++)Se.group.removeChild(this.subtractions[s],n);for(s=0;s<this.children.length;s++){const a=this.children[s],l=St.Utils.getRendererType(a._renderer.type);Se[l].render.call(a,n,e)}return this._mask&&n.disable(n.STENCIL_TEST),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(n,e){let i,r,o,s,a,l,c,d,u,f,h,p,m,g;const b=e._renderer.vertices,y=this.canvas,_=this.ctx,k=n.renderer.ratio,x=Fd.copy(e._renderer.scale).multiply(k),v=e._stroke,B=e._linewidth,w=e._fill,T=e._renderer.opacity||e._opacity,C=e._cap,$=e._join,E=e._miter,I=e._closed,R=e.dashes,O=b.length,U=O-1;y.width=Math.max(Math.ceil(e._renderer.rect.width*x.x),1),y.height=Math.max(Math.ceil(e._renderer.rect.height*x.y),1);const Q=e._renderer.rect.centroid,G=Q.x,W=Q.y;if(_.clearRect(0,0,y.width,y.height),w)if(typeof w=="string")_.fillStyle=w;else{const V=St.Utils.getRendererType(w._renderer.type);Se[V].render.call(w,_,e),_.fillStyle=w._renderer.effect}if(v){if(typeof v=="string")_.strokeStyle=v;else{const V=St.Utils.getRendererType(v._renderer.type);Se[V].render.call(v,_,e),_.strokeStyle=v._renderer.effect}B&&(_.lineWidth=vn(e)),E&&(_.miterLimit=E),$&&(_.lineJoin=$),!I&&C&&(_.lineCap=C)}typeof T=="number"&&(_.globalAlpha=T),R&&R.length>0&&(_.lineDashOffset=R.offset||0,_.setLineDash(R));let D,L,z,P,q,K,J,Y;_.save(),_.scale(x.x,x.y),_.translate(G,W),_.beginPath();for(let V=0;V<b.length;V++){const A=b[V];switch(p=A.x,m=A.y,A.command){case ne.close:_.closePath();break;case ne.arc:L=A.rx,z=A.ry,P=A.xAxisRotation,q=A.largeArcFlag,K=A.sweepFlag,i=I?st(V-1,O):Math.max(V-1,0),r=b[i],J=r.x,Y=r.y,V0.renderSvgArcCommand(_,J,Y,L,z,q,K,P,p,m);break;case ne.curve:i=I?st(V-1,O):Math.max(V-1,0),r=b[i],d=r.controls&&r.controls.right||re.zero,u=A.controls&&A.controls.left||re.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),A._relative?(s=u.x+A.x,a=u.y+A.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,p,m),V>=U&&I&&(o=D,f=A.controls&&A.controls.right||re.zero,h=o.controls&&o.controls.left||re.zero,A._relative?(l=f.x+A.x,c=f.y+A.y):(l=f.x,c=f.y),o._relative?(s=h.x+o.x,a=h.y+o.y):(s=h.x,a=h.y),p=o.x,m=o.y,_.bezierCurveTo(l,c,s,a,p,m));break;case ne.line:_.lineTo(p,m);break;case ne.move:D=A,_.moveTo(p,m);break}}I&&_.closePath(),Se.isHidden.test(w)||(g=w._renderer&&w._renderer.offset,g&&(_.save(),_.translate(-w._renderer.offset.x,-w._renderer.offset.y),_.scale(w._renderer.scale.x,w._renderer.scale.y)),_.fill(),g&&_.restore()),Se.isHidden.test(v)||(g=v._renderer&&v._renderer.offset,g&&(_.save(),_.translate(-v._renderer.offset.x,-v._renderer.offset.y),_.scale(v._renderer.scale.x,v._renderer.scale.y),_.lineWidth=B/v._renderer.scale.x),_.stroke(),g&&_.restore()),_.restore()},getBoundingClientRect:function(n,e,i){let r=1/0,o=-1/0,s=1/0,a=-1/0,l,c;n.forEach(function(d){const u=d.x,f=d.y,h=d.controls;let p,m,g,b,y,_;s=Math.min(f,s),r=Math.min(u,r),o=Math.max(u,o),a=Math.max(f,a),d.controls&&(y=h.left,_=h.right,!(!y||!_)&&(p=d._relative?y.x+u:y.x,m=d._relative?y.y+f:y.y,g=d._relative?_.x+u:_.x,b=d._relative?_.y+f:_.y,!(!p||!m||!g||!b)&&(s=Math.min(m,b,s),r=Math.min(p,g,r),o=Math.max(p,g,o),a=Math.max(m,b,a))))}),typeof e=="number"&&(s-=e,r-=e,o+=e,a+=e),l=o-r,c=a-s,i.top=s,i.left=r,i.right=o,i.bottom=a,i.width=l,i.height=c,i.centroid||(i.centroid={}),i.centroid.x=-r,i.centroid.y=-s},render:function(n,e,i){if(!this._visible||!this._opacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=i||this.parent,o=St.Utils.getRendererType(this._renderer.type),s=e[o],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 Ge&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ze&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof ze&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ge&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ze&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof ze&&(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 Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let f,h;this._scale instanceof re?(f=this._scale.x*r._renderer.scale.x,h=this._scale.y*r._renderer.scale.y):(f=this._scale*r._renderer.scale.x,h=this._scale*r._renderer.scale.y),this._renderer.scale.x=f<0?-f:f,this._renderer.scale.y=h<0?-h:h,c&&(this._renderer.parent=r)}if(this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const f=St.Utils.getRendererType(this._mask._renderer.type);Se[f].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}if(d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,Se.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;e.current!==s&&(n.useProgram(s),n.bindBuffer(n.ARRAY_BUFFER,e.buffers.position),n.vertexAttribPointer(s.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(s.position),n.bufferData(n.ARRAY_BUFFER,ua,n.STATIC_DRAW),e.resolution.flagged||n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture);const u=this._renderer.rect;return n.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),n.uniform4f(s.rect,u.left,u.top,u.right,u.bottom),n.drawArrays(n.TRIANGLES,0,6),this._mask&&n.disable(n.STENCIL_TEST),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(n,e){let i;const r=this.canvas,o=this.ctx,s=n.renderer.ratio,a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._size*s;let h=f;Se.isHidden.test(a)||(h+=l),r.width=_c(h),r.height=r.width;const p=h/r.width,m=r.width/2,g=r.height/2;if(o.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")o.fillStyle=c;else{const b=St.Utils.getRendererType(c._renderer.type);Se[b].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const b=St.Utils.getRendererType(a._renderer.type);Se[b].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=vn(e)/p)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(m,g),o.scale(Se.precision,Se.precision),o.beginPath(),o.arc(0,0,f/p*.5,0,tt),o.restore(),closed&&o.closePath(),Se.isHidden.test(c)||(i=c._renderer&&c._renderer.offset,i&&(o.save(),o.translate(-c._renderer.offset.x,-c._renderer.offset.y),o.scale(c._renderer.scale.x,c._renderer.scale.y)),o.fill(),i&&o.restore()),Se.isHidden.test(a)||(i=a._renderer&&a._renderer.offset,i&&(o.save(),o.translate(-a._renderer.offset.x,-a._renderer.offset.y),o.scale(a._renderer.scale.x,a._renderer.scale.y),o.lineWidth=l/a._renderer.scale.x),o.stroke(),i&&o.restore())},render:function(n,e,i){if(!this._visible||!this._opacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const o=i||this.parent,s=e[this._renderer.type],a=this._sizeAttenuation,l=this._stroke,c=this._linewidth,d=o._matrix.manual||o._flagMatrix,u=this._matrix.manual||this._flagMatrix,f=this._renderer.parent!==o,h=this._renderer.vertices,p=this._renderer.collection.length,m=this._flagVertices,g=this._flagFill||this._fill instanceof Ge&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ze&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof ze&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ge&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ze&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof ze&&(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||o._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(d||u||f){this._renderer.matrix||(this._renderer.matrix=new Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,o._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let b,y;this._scale instanceof re?(b=this._scale.x*o._renderer.scale.x,y=this._scale.y*o._renderer.scale.y):(b=this._scale*o._renderer.scale.x,y=this._scale*o._renderer.scale.y),this._renderer.scale.x=b<0?-b:b,this._renderer.scale.y=y<0?-y:y,f&&(this._renderer.parent=o)}if(m){const b=this._renderer.positionBuffer;b&&n.deleteBuffer(b),this._renderer.positionBuffer=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this._renderer.positionBuffer),n.vertexAttribPointer(s.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(s.position),n.bufferData(n.ARRAY_BUFFER,h,n.STATIC_DRAW)}return g?(this._renderer.opacity=this._opacity*o._renderer.opacity,Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture?this:(Se.isHidden.test(l)||(r+=c),r/=Se.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),e.current!==s&&(n.useProgram(s),e.resolution.flagged||n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture),n.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),n.uniform1f(s.size,r*e.resolution.ratio),n.drawArrays(n.POINTS,0,p),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(n,e){const i=this.canvas,r=this.ctx,o=n.renderer.ratio,s=Fd.copy(e._renderer.scale).multiply(o),a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._decoration,h=e._direction;i.width=Math.max(Math.ceil(e._renderer.rect.width*s.x),1),i.height=Math.max(Math.ceil(e._renderer.rect.height*s.y),1);const p=e._renderer.rect.centroid,m=p.x,g=p.y;let b,y,_,k,x,v,B,w,T,C,$;const E=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,i.width,i.height),E||(r.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=h,c)if(typeof c=="string")r.fillStyle=c;else{const I=St.Utils.getRendererType(c._renderer.type);Se[I].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const I=St.Utils.getRendererType(a._renderer.type);Se[I].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=vn(e))}if(typeof d=="number"&&(r.globalAlpha=d),u&&u.length>0&&(r.lineDashOffset=u.offset||0,r.setLineDash(u)),r.save(),r.scale(s.x,s.y),r.translate(m,g),Se.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),b=e._size/c._renderer.scale.y,y=e._leading/c._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=c._renderer.offset.x/c._renderer.scale.x,k=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,k),r.restore()):r.fillText(e.value,0,0)),Se.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),b=e._size/a._renderer.scale.y,y=e._leading/a._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=a._renderer.offset.x/a._renderer.scale.x,k=a._renderer.offset.y/a._renderer.scale.y,x=l/a._renderer.scale.x,r.lineWidth=x,r.strokeText(e.value,_,k),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(f)){const I=r.measureText(e.value);switch(f){case"underline":T=I.actualBoundingBoxDescent,$=I.actualBoundingBoxDescent;break;case"strikethrough":T=0,$=0;break}w=-I.width/2,C=I.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(w,T),r.lineTo(C,$),r.stroke()}r.restore()},getBoundingClientRect:function(n,e){const i=Se.ctx;i.font=[n._style,n._weight,n._size+"px/"+n._leading+"px",n._family].join(" "),i.textAlign="center",i.textBaseline=St.Utils.baselines[n._baseline]||n._baseline;const r=i.measureText(n._value);let o=r.width,s=1.15*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent);this._linewidth&&!Se.isHidden.test(this._stroke)&&(o+=this._linewidth*2,s+=this._linewidth*2);const a=o/2,l=s/2;switch(Se.alignments[n._alignment]||n._alignment){case Se.alignments.left:n.direction==="ltr"?(e.left=0,e.right=o):(e.left=-o,e.right=0);break;case Se.alignments.right:n.direction==="ltr"?(e.left=-o,e.right=0):(e.left=0,e.right=o);break;default:e.left=-a,e.right=a}switch(n._baseline){case"bottom":e.top=-s,e.bottom=0;break;case"top":e.top=0,e.bottom=s;break;case"baseline":e.top=-l*1.5,e.bottom=l*.5;break;default:e.top=-l,e.bottom=l}e.width=o,e.height=s,e.centroid||(e.centroid={}),e.centroid.x=a,e.centroid.y=l},render:function(n,e,i){if(!this._visible||!this._opacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=i||this.parent,o=e[this._renderer.type],s=r._matrix.manual||r._flagMatrix,a=this._matrix.manual||this._flagMatrix,l=this._renderer.parent!==r,c=this._flagVertices||this._flagFill||this._fill instanceof Ge&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ze&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof ze&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ge&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ze&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof ze&&(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(s||a||l){this._renderer.matrix||(this._renderer.matrix=new Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let u,f;this._scale instanceof re?(u=this._scale.x*r._renderer.scale.x,f=this._scale.y*r._renderer.scale.y):(u=this._scale*r._renderer.scale.x,f=this._scale*r._renderer.scale.y),this._renderer.scale.x=u<0?-u:u,this._renderer.scale.y=f<0?-f:f,l&&(this._renderer.parent=r)}if(this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const u=St.Utils.getRendererType(this._mask._renderer.type);Se[u].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}if(c?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,Se.text.getBoundingClientRect(this,this._renderer.rect),Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;e.current!==o&&(n.useProgram(o),n.bindBuffer(n.ARRAY_BUFFER,e.buffers.position),n.vertexAttribPointer(o.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(o.position),n.bufferData(n.ARRAY_BUFFER,ua,n.STATIC_DRAW),e.resolution.flagged||n.uniform2f(n.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return n.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),n.uniform4f(o.rect,d.left,d.top,d.right,d.bottom),n.drawArrays(n.TRIANGLES,0,6),this._mask&&n.disable(n.STENCIL_TEST),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let i,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width,o=(o-.5)*i.height,s=(s-.5)*i.width,a=(a-.5)*i.height),this._renderer.effect=n.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let i,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width*.5,o=(o-.5)*i.height*.5,s=(s-.5)*i.width*.5,a=(a-.5)*i.height*.5,l*=Math.min(i.width,i.height)),this._renderer.effect=n.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(n,e){if(!n.canvas.getContext("2d"))return;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const i=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=n.createPattern(i,this._repeat);else if(!this._renderer.effect)return this.flagReset();if((this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof re||(this._renderer.offset=new re),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,i&&(this._renderer.offset.x+=i.width/2,this._renderer.offset.y+=i.height/2,this._scale instanceof re?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),this._flagScale||this._flagLoaded){this._renderer.scale instanceof re||(this._renderer.scale=new re);let r,o;this._scale instanceof re?(r=this._scale.x,o=this._scale.y):(r=this._scale,o=this._scale),this._renderer.scale.x=r<0?-r:r,this._renderer.scale.y=o<0?-o:o}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(n,e){const i=St.Utils.getRendererType(e._renderer.type);if(this[i].updateCanvas.call(Se,n,e),this.canvas.width<=0||this.canvas.height<=0){e._renderer.texture&&n.deleteTexture(e._renderer.texture),delete e._renderer.texture;return}e._renderer.texture||(e._renderer.texture=n.createTexture()),n.bindTexture(n.TEXTURE_2D,e._renderer.texture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,this.canvas),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR)},program:{create:function(n,e){let i,r,o;if(i=n.createProgram(),oe.each(e,function(s){n.attachShader(i,s)}),n.linkProgram(i),r=n.getProgramParameter(i,n.LINK_STATUS),!r)throw o=n.getProgramInfoLog(i),n.deleteProgram(i),new Ht("unable to link program: "+o);return i}},extensions:{init:function(n){const e={},i=["EXT_texture_filter_anisotropic","WEBGL_compressed_texture_s3tc","OES_texture_float_linear","WEBGL_multisampled_render_to_texture"];for(let r=0;r<i.length;r++){const o=i[r];e[o]=Se.extensions.get(n,o)}return e},get:function(n,e){return n.getExtension(e)||n.getExtension(`MOZ_${e}`)||n.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new ho};Se.ctx=Se.canvas.getContext("2d");var Vd=class extends ee{constructor(n){super();let e,i,r,o;if(this.domElement=n.domElement||document.createElement("canvas"),typeof n.offscreenElement<"u"&&(Se.canvas=n.offscreenElement,Se.ctx=Se.canvas.getContext("2d")),this.scene=new yt,this.scene.parent=this,this._renderer={type:"renderer",matrix:new Cn(F0),scale:1,opacity:1},this._flagMatrix=!0,n=oe.defaults(n||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=n.overdraw,e=this.ctx=this.domElement.getContext("webgl",n)||this.domElement.getContext("experimental-webgl",n),!this.ctx)throw new Ht("unable to create a webgl context. Try using another renderer.");r=sn.create(e,sn.path.vertex,sn.types.vertex),o=sn.create(e,sn.path.fragment,sn.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},i=this.programs.path=Se.program.create(e,[r,o]),this.programs.text=this.programs.path,e.extensions=Se.extensions.init(e),e.renderer=this,i.position=e.getAttribLocation(i,"a_position"),i.matrix=e.getUniformLocation(i,"u_matrix"),i.rect=e.getUniformLocation(i,"u_rect");const s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(i.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(i.position),e.bufferData(e.ARRAY_BUFFER,ua,e.STATIC_DRAW),r=sn.create(e,sn.points.vertex,sn.types.vertex),o=sn.create(e,sn.points.fragment,sn.types.fragment),i=this.programs.points=Se.program.create(e,[r,o]),i.position=e.getAttribLocation(i,"a_position"),i.matrix=e.getUniformLocation(i,"u_matrix"),i.size=e.getUniformLocation(i,"u_size"),e.enable(e.BLEND),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}setSize(n,e,i){let r,o;const s=this.ctx;return this.width=n,this.height=e,this.ratio=typeof i>"u"?zs(s):i,this.domElement.width=n*this.ratio,this.domElement.height=e*this.ratio,oe.isObject(this.domElement.style)&&oe.extend(this.domElement.style,{width:n+"px",height:e+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=n*this.ratio,o=e*this.ratio,s.viewport(0,0,r,o),this.programs.resolution.width=r,this.programs.resolution.height=o,this.programs.resolution.ratio=this.ratio,this.programs.resolution.flagged=!0,this.trigger(ee.Types.resize,n,e,i)}render(){const n=this.ctx;return this.overdraw||n.clear(n.COLOR_BUFFER_BIT),Se.group.render.call(this.scene,n,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};S(Vd,"Utils",Se);var M0=oe.extend({Error:Ht,getRatio:zs,read:Ue,xhr:Nd},oe,Ft,pc,gc),Te=class ro{constructor(e){S(this,"_events",new ee),S(this,"type",""),S(this,"renderer",null),S(this,"scene",null),S(this,"width",0),S(this,"height",0),S(this,"frameCount",0),S(this,"timeDelta",0),S(this,"playing",!1);const i=oe.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:ro.Types.svg,autostart:!1});if(oe.each(i,function(r,o){/fullscreen/i.test(o)||/autostart/i.test(o)||(this[o]=r)},this),oe.isElement(i.domElement)){const r=i.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=ro.Types[r])}this.renderer=new ro[this.type](this),this.setPlaying(i.autostart),this.frameCount=0,i.fullscreen?(this.fit=I0.bind(this),this.fit.domElement=window,this.fit.attached=!0,oe.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),oe.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),Gt.bind(this.fit.domElement,"resize",this.fit),this.fit()):i.fitted?(this.fit=A0.bind(this),oe.extend(this.renderer.domElement.style,{display:"block"})):typeof i.width=="number"&&typeof i.height=="number"&&(this.renderer.setSize(i.width,i.height,this.ratio),this.width=i.width,this.height=i.height),this.renderer.bind(ee.Types.resize,O0.bind(this)),this.scene=this.renderer.scene,ro.Instances.push(this),i.autostart&&Fr.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=this._events.listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=this._events.ignore)==null?void 0:e.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,Fr.init(),this.trigger(ee.Types.play)}pause(){return this.playing=!1,this.trigger(ee.Types.pause)}setPlaying(e){this.playing=e}release(e){let i,r,o;if(typeof e>"u")return this.release(this.scene);if(typeof e.unbind=="function"&&e.unbind(),typeof e.fill=="object"&&typeof e.fill.unbind=="function"&&e.fill.unbind(),typeof e.stroke=="object"&&typeof e.stroke.unbind=="function"&&e.stroke.unbind(),e.vertices){if(typeof e.vertices.unbind=="function")try{e.vertices.unbind()}catch{}for(i=0;i<e.vertices.length;i++)r=e.vertices[i],typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}if(e.children){for(i=0;i<e.children.length;i++)o=e.children[i],this.release(o);if(typeof e.children.unbind=="function")try{e.children.unbind()}catch{}}if(e._renderer){if(e._renderer.elem&&e._renderer.elem.parentNode&&(e._renderer.elem.parentNode.removeChild(e._renderer.elem),delete e._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const s=this.renderer.ctx;e._renderer.texture&&(s.deleteTexture(e._renderer.texture),delete e._renderer.texture),e._renderer.positionBuffer&&(s.deleteBuffer(e._renderer.positionBuffer),delete e._renderer.positionBuffer),e._renderer.effect&&(e._renderer.effect=null)}this.type==="CanvasRenderer"&&e._renderer.context&&delete e._renderer.context}return e}getShapesAtPoint(e,i,r){return this.scene&&typeof this.scene.getShapesAtPoint=="function"?this.scene.getShapesAtPoint(e,i,r):[]}update(){const e=!!this._lastFrame,i=oe.performance.now();e&&(this.timeDelta=parseFloat((i-this._lastFrame).toFixed(3))),this._lastFrame=i,this.fit&&this.fit.domElement&&!this.fit.attached&&(Gt.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());const r=this.width,o=this.height,s=this.renderer;return(r!==s.width||o!==s.height)&&s.setSize(r,o,this.ratio),this.trigger(ee.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(ee.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,i,r,o){const s=new No(e,i,r,o);return this.scene.add(s),s}makeArrow(e,i,r,o,s){const a=typeof s=="number"?s:10,l=Math.atan2(o-i,r-e),c=[new Ee(e,i,void 0,void 0,void 0,void 0,ne.move),new Ee(r,o,void 0,void 0,void 0,void 0,ne.line),new Ee(r-a*Math.cos(l-Math.PI/4),o-a*Math.sin(l-Math.PI/4),void 0,void 0,void 0,void 0,ne.line),new Ee(r,o,void 0,void 0,void 0,void 0,ne.move),new Ee(r-a*Math.cos(l+Math.PI/4),o-a*Math.sin(l+Math.PI/4),void 0,void 0,void 0,void 0,ne.line)],d=new Pe(c,!1,!1,!0);return d.noFill(),d.cap="round",d.join="round",this.scene.add(d),d}makeRectangle(e,i,r,o){const s=new di(e,i,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,i,r,o,s){const a=new vo(e,i,r,o,s);return this.scene.add(a),a}makeCircle(e,i,r,o){const s=new ko(e,i,r,o);return this.scene.add(s),s}makeEllipse(e,i,r,o,s){const a=new Co(e,i,r,o,s);return this.scene.add(a),a}makeStar(e,i,r,o,s){const a=new na(e,i,r,o,s);return this.scene.add(a),a}makeCurve(e){const i=arguments.length;if(!Array.isArray(e)){e=[];for(let a=0;a<i;a+=2){const l=arguments[a];if(typeof l!="number")break;const c=arguments[a+1];e.push(new Ee(l,c))}}const r=arguments[i-1],o=new Pe(e,!(typeof r=="boolean"&&r),!0),s=o.getBoundingClientRect();return o.center().translation.set(s.left+s.width/2,s.top+s.height/2),this.scene.add(o),o}makePolygon(e,i,r,o){const s=new ta(e,i,r,o);return this.scene.add(s),s}makeArcSegment(e,i,r,o,s,a,l){const c=new Ks(e,i,r,o,s,a,l);return this.scene.add(c),c}makePoints(e){const i=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let s=0;s<i;s+=2){const a=arguments[s];if(typeof a!="number")break;const l=arguments[s+1];r.push(new re(a,l))}}const o=new ea(r);return this.scene.add(o),o}makePath(e){const i=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let l=0;l<i;l+=2){const c=arguments[l];if(typeof c!="number")break;const d=arguments[l+1];r.push(new Ee(c,d))}}const o=arguments[i-1],s=new Pe(r,!(typeof o=="boolean"&&o)),a=s.getBoundingClientRect();return typeof a.top=="number"&&typeof a.left=="number"&&typeof a.right=="number"&&typeof a.bottom=="number"&&s.center().translation.set(a.left+a.width/2,a.top+a.height/2),this.scene.add(s),s}makeText(e,i,r,o){const s=new Sn(e,i,r,o);return this.add(s),s}makeLinearGradient(e,i,r,o){const s=Array.prototype.slice.call(arguments,4),a=new Ge(e,i,r,o,s);return this.add(a),a}makeRadialGradient(e,i,r){const o=Array.prototype.slice.call(arguments,3),s=new Ze(e,i,r,o);return this.add(s),s}makeSprite(e,i,r,o,s,a,l){const c=new xo(e,i,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,i,r,o,s,a){const l=new Td(e,i,r,o,s,a);return this.add(l),l}makeImageSequence(e,i,r,o,s){const a=new sa(e,i,r,o);return s&&a.play(),this.add(a),a}makeTexture(e,i){return new ze(e,i)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const i=new yt;return this.scene.add(i),i.add(e),i}interpret(e,i,r){const o=e.tagName.toLowerCase();if(r=typeof r<"u"?r:!0,!(o in Ue))return null;const s=Ue[o].call(this,e);return r?this.add(i&&s instanceof yt?s.children:s):s.parent&&s.remove(),s}load(e,i){const r=new yt;let o,s,a;const l=(function(c){for(Gt.temp.innerHTML=c,s=0;s<Gt.temp.children.length;s++)o=Gt.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof i=="function"){const d=Gt.temp.children.length<=1?Gt.temp.children[0]:Gt.temp.children;i(r,d)}}).bind(this);return/\.svg$/i.test(e)?(Nd(e,l),r):(l(e),r)}};S(Te,"NextFrameId",Ct.NextFrameId),S(Te,"Types",Ct.Types),S(Te,"Version",Ct.Version),S(Te,"PublishDate",Ct.PublishDate),S(Te,"Identifier",Ct.Identifier),S(Te,"Resolution",Ct.Resolution),S(Te,"AutoCalculateImportedMatrices",Ct.AutoCalculateImportedMatrices),S(Te,"Instances",Ct.Instances),S(Te,"uniqueId",Ct.uniqueId),S(Te,"Anchor",Ee),S(Te,"Collection",li),S(Te,"Events",ee),S(Te,"Group",yt),S(Te,"Matrix",vi),S(Te,"Path",Pe),S(Te,"Registry",ho),S(Te,"Element",er),S(Te,"Shape",Hn),S(Te,"Text",Sn),S(Te,"Vector",re),S(Te,"Gradient",ut),S(Te,"Image",Td),S(Te,"ImageSequence",sa),S(Te,"LinearGradient",Ge),S(Te,"RadialGradient",Ze),S(Te,"Sprite",xo),S(Te,"Stop",ci),S(Te,"Texture",ze),S(Te,"ArcSegment",Ks),S(Te,"Circle",ko),S(Te,"Ellipse",Co),S(Te,"Line",No),S(Te,"Points",ea),S(Te,"Polygon",ta),S(Te,"Rectangle",di),S(Te,"RoundedRectangle",vo),S(Te,"Star",na),S(Te,"CanvasRenderer",St),S(Te,"SVGRenderer",Pd),S(Te,"WebGLRenderer",Vd),S(Te,"Commands",ne),S(Te,"Utils",M0);var Nn=Te;function I0(){const n=document.body.getBoundingClientRect(),e=this.width=n.width,i=this.height=n.height;this.renderer.setSize(e,i,this.ratio)}function A0(){const n=this.renderer.domElement.parentElement;if(!n){console.warn("Two.js: Attempting to fit to parent, but no parent found.");return}const e=n.getBoundingClientRect(),i=this.width=e.width,r=this.height=e.height;this.renderer.setSize(i,r,this.ratio)}function O0(n,e){this.width=n,this.height=e,this.trigger(ee.Types.resize,n,e)}var Fr=Gt.getRequestAnimationFrame();function Md(){for(let n=0;n<Nn.Instances.length;n++){const e=Nn.Instances[n];e.playing&&e.update()}Nn.NextFrameId=Fr(Md)}Fr.init=function(){Md(),Fr.init=function(){}};let Tn;typeof window<"u"?Tn=window:typeof global<"u"?Tn=global:typeof self<"u"&&(Tn=self);let Id;const Zt=Math.PI*2,bt=Math.PI*.5;function z0(n,e,i,r,o,s){let a;return arguments.length<=1?(a=n.a,e=n.b,i=n.c,r=n.d,o=n.e,s=n.f):a=n,{translateX:o,translateY:s,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(i*i+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function D0(n){Id=n}function L0(n,e){e=e&&e.identity()||new Id;let i=n;const r=[];for(;i&&i._matrix;)r.push(i._matrix),i=i.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function jt(n,e,i){return i*(e-n)+n}function qt(n,e){for(;n<0;)n+=e;return n%e}const Ad=Tn.Float32Array||Array,H0=Math.floor;function $n(n){return H0(n*1e6)/1e6}const fe={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};class te{constructor(){N(this,"_events",{});N(this,"_bound",!1)}addEventListener(e,i){return(this._events[e]||(this._events[e]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,i){if(!this._events)return this;if(!e&&!i)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(i)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,i!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const i=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...i);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,i,r){const o=this;e&&(s.obj=e,s.name=i,s.handler=r,e.on(i,s));function s(){r.apply(o,arguments)}return o}ignore(e,i,r){return e.off(i,r),this}}N(te,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),N(te,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Od={x:{enumerable:!0,get:function(){return this._x},set:function(n){this._x!==n&&(this._x=n,this._bound&&this.dispatchEvent(te.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(n){this._y!==n&&(this._y=n,this._bound&&this.dispatchEvent(te.Types.change))}}},wt=class wt extends te{constructor(i=0,r=0){super();N(this,"_x",0);N(this,"_y",0);for(let o in Od)Object.defineProperty(this,o,Od[o]);this.x=i,this.y=r}static add(i,r){return new wt(i.x+r.x,i.y+r.y)}static sub(i,r){return new wt(i.x-r.x,i.y-r.y)}static subtract(i,r){return wt.sub(i,r)}static ratioBetween(i,r){return(i.x*r.x+i.y*r.y)/(i.length()*r.length())}static angleBetween(i,r){if(arguments.length>=4){const a=arguments[0]-arguments[2],l=arguments[1]-arguments[3];return Math.atan2(l,a)}const o=i.x-r.x,s=i.y-r.y;return Math.atan2(s,o)}static distanceBetween(i,r){return Math.sqrt(wt.distanceBetweenSquared(i,r))}static distanceBetweenSquared(i,r){const o=i.x-r.x,s=i.y-r.y;return o*o+s*s}set(i,r){return this.x=i,this.y=r,this}copy(i){return this.x=i.x,this.y=i.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new wt(this.x,this.y)}add(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x+=i,this.y+=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x+=i.x,this.y+=i.y):(this.x+=i,this.y+=r),this)}addSelf(i){return this.add.apply(this,arguments)}sub(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x-=i,this.y-=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x-=i.x,this.y-=i.y):(this.x-=i,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(i){return this.sub.apply(this,arguments)}subtractSelf(i){return this.sub.apply(this,arguments)}multiply(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x*=i,this.y*=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x*=i.x,this.y*=i.y):(this.x*=i,this.y*=r),this)}multiplySelf(i){return this.multiply.apply(this,arguments)}multiplyScalar(i){return this.multiply(i)}divide(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x/=i,this.y/=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x/=i.x,this.y/=i.y):(this.x/=i,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(i){return this.divide.apply(this,arguments)}divideScalar(i){return this.divide(i)}negate(){return this.multiply(-1)}dot(i){return this.x*i.x+this.y*i.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(i){return Math.sqrt(this.distanceToSquared(i))}distanceToSquared(i){const r=this.x-i.x,o=this.y-i.y;return r*r+o*o}setLength(i){return this.normalize().multiplyScalar(i)}equals(i,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(i)<r}lerp(i,r){const o=(i.x-this.x)*r+this.x,s=(i.y-this.y)*r+this.y;return this.set(o,s)}isZero(i){return i=typeof i>"u"?1e-4:i,this.length()<i}toString(){return this.x+", "+this.y}toObject(){return{x:$n(this.x),y:$n(this.y)}}rotate(i){const r=this.x,o=this.y,s=Math.cos(i),a=Math.sin(i);return this.x=r*s-o*a,this.y=r*a+o*s,this}};N(wt,"zero",new wt),N(wt,"left",new wt(-1,0)),N(wt,"right",new wt(1,0)),N(wt,"up",new wt(0,-1)),N(wt,"down",new wt(0,1));let ge=wt;class Ie extends ge{constructor(i=0,r=0,o=0,s=0,a=0,l=0,c=fe.move){super(i,r);N(this,"controls",{left:new ge,right:new ge});N(this,"_command",fe.move);N(this,"_relative",!0);N(this,"_rx",0);N(this,"_ry",0);N(this,"_xAxisRotation",0);N(this,"_largeArcFlag",0);N(this,"_sweepFlag",1);for(let u in zd)Object.defineProperty(this,u,zd[u]);this.command=c,this.relative=!0;const d=Ie.makeBroadcast(this);this.controls.left.set(o,s).addEventListener(te.Types.change,d),this.controls.right.set(a,l).addEventListener(te.Types.change,d)}static makeBroadcast(i){return r;function r(){i._bound&&i.dispatchEvent(te.Types.change)}}static fromObject(i){return new Ie().copy(i)}copy(i){return this.x=i.x,this.y=i.y,typeof i.command=="string"&&(this.command=i.command),i.controls&&(i.controls.left&&this.controls.left.copy(i.controls.left),i.controls.right&&this.controls.right.copy(i.controls.right)),typeof i.relative=="boolean"&&(this.relative=i.relative),typeof i.rx=="number"&&(this.rx=i.rx),typeof i.ry=="number"&&(this.ry=i.ry),typeof i.xAxisRotation=="number"&&(this.xAxisRotation=i.xAxisRotation),typeof i.largeArcFlag=="number"&&(this.largeArcFlag=i.largeArcFlag),typeof i.sweepFlag=="number"&&(this.sweepFlag=i.sweepFlag),this}clone(){return new Ie().copy(this)}toObject(){return{x:$n(this.x),y:$n(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:$n(this.rx),ry:$n(this.ry),xAxisRotation:$n(this.xAxisRotation),largeArcFlag:$n(this.largeArcFlag),sweepFlag:$n(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const zd={command:{enumerable:!0,get:function(){return this._command},set:function(n){this._command!==n&&(this._command=n,this._bound&&this.dispatchEvent(te.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(n){this._relative!==!!n&&(this._relative=!!n,this._bound&&this.dispatchEvent(te.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(n){this._rx!==n&&(this._rx=n,this._bound&&this.dispatchEvent(te.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(n){this._ry!==n&&(this._ry=n,this._bound&&this.dispatchEvent(te.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(n){this._xAxisRotation!==n&&(this._xAxisRotation=n,this._bound&&this.dispatchEvent(te.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(n){this._largeArcFlag!==n&&(this._largeArcFlag=n,this._bound&&this.dispatchEvent(te.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(n){this._sweepFlag!==n&&(this._sweepFlag=n,this._bound&&this.dispatchEvent(te.Types.change))}}};let W0=0;const Fo={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return W0++}},Vo={RecursionLimit:16,abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Mo(n,e,i,r,o){const s=1-n;return s*s*s*e+3*s*s*n*i+3*s*n*n*r+n*n*n*o}function Dd(n,e,i,r,o,s,a,l,c){c=c||Vo.RecursionLimit;const d=c+1;if(Math.abs(n-a)<.001&&Math.abs(e-l)<.001)return[new Ie(a,l)];const u=[];for(let f=0;f<d;f++){const h=f/d,p=Mo(h,n,i,o,a),m=Mo(h,e,r,s,l);u.push(new Ie(p,m))}return u}function j0(n,e,i,r,o,s,a,l,c){if(n===i&&e===r&&o===a&&s===l){const b=a-n,y=l-e;return Math.sqrt(b*b+y*y)}const d=9*(i-o)+3*(a-n),u=6*(n+o)-12*i,f=3*(i-n),h=9*(r-s)+3*(l-e),p=6*(e+s)-12*r,m=3*(r-e);function g(b){const y=(d*b+u)*b+f,_=(h*b+p)*b+m;return Math.sqrt(y*y+_*_)}return X0(g,0,1,c||Vo.RecursionLimit)}function q0(n,e,i,r,o,s,a,l){const c=[],d=[[],[]];let u,f,h,p,m,g,b,y;for(let v=0;v<2;++v){if(v===0?(f=6*n-12*i+6*o,u=-3*n+9*i-9*o+3*a,h=3*i-3*n):(f=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,h=3*r-3*e),Math.abs(u)<.001){if(Math.abs(f)<.001)continue;p=-h/f,0<p&&p<1&&c.push(p);continue}b=f*f-4*h*u,y=Math.sqrt(b),!(b<0)&&(m=(-f+y)/(2*u),0<m&&m<1&&c.push(m),g=(-f-y)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,k=_,x;for(;_--;)p=c[_],x=1-p,d[0][_]=x*x*x*n+3*x*x*p*i+3*x*p*p*o+p*p*p*a,d[1][_]=x*x*x*e+3*x*x*p*r+3*x*p*p*s+p*p*p*l;return d[0][k]=n,d[1][k]=e,d[0][k+1]=a,d[1][k+1]=l,d[0].length=d[1].length=k+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function X0(n,e,i,r){let o=Vo.abscissas[r-2],s=Vo.weights[r-2],a=.5*(i-e),l=a+e,c=0,d=r+1>>1,u=r&1?s[c++]*n(l):0;for(;c<d;){const f=a*o[c];u+=s[c++]*(n(l+f)+n(l-f))}return a*u}function Y0(n,e){const i=n.length,r=i-1;for(let o=0;o<i;o++){const s=n[o],a=e?qt(o-1,i):Math.max(o-1,0),l=e?qt(o+1,i):Math.min(o+1,r),c=n[a],d=s,u=n[l];U0(c,d,u),d.command=o===0?fe.move:fe.curve}}function U0(n,e,i){const r=ge.angleBetween(n,e),o=ge.angleBetween(i,e);let s=ge.distanceBetween(n,e),a=ge.distanceBetween(i,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=bt:l-=bt,e.controls.left.x=Math.cos(l)*s,e.controls.left.y=Math.sin(l)*s,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}let Vr=(Li=class extends te{constructor(){super();N(this,"_flagId",!1);N(this,"_flagClassName",!1);N(this,"_renderer",{});N(this,"_id",Fo.Identifier+Fo.uniqueId());N(this,"_className","");N(this,"classList",[]);for(let i in Ld)Object.defineProperty(this,i,Ld[i])}static fromObject(i){const r=new Li().copy(i);return"id"in i&&(r.id=i.id),r}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(i){return i.renderer&&typeof i.renderer.type=="string"&&(this.renderer.type=i.renderer.type),typeof i.className=="string"&&(this.className=i.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const r=this.renderer.ctx;this._renderer.texture&&(r.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(r.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const i=this._renderer.type;return this._renderer={type:i},this}},N(Li,"Properties",["renderer","id","className"]),Li);const Ld={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(n){const e=this._id;n!==this._id&&(this._id=n,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(n){this._className!==n&&(this._flagClassName=!0,this.classList=n.split(/\s+?/),this._className=n)}}};class Io extends Error{constructor(i){super();N(this,"name","Two.js");N(this,"message");this.message=i}}class K0{constructor(){N(this,"map",{})}add(e,i){return this.map[e]=i,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}}let Ao;const Hd={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Tn.document&&(Ao=document.createElement("a"));const Je=class Je extends Vr{constructor(i,r){super();N(this,"_flagSrc",!1);N(this,"_flagImage",!1);N(this,"_flagVideo",!1);N(this,"_flagLoaded",!1);N(this,"_flagRepeat",!1);N(this,"_flagOffset",!1);N(this,"_flagScale",!1);N(this,"_src","");N(this,"_image",null);N(this,"_loaded",!1);N(this,"_repeat","no-repeat");N(this,"_scale",1);N(this,"_offset",null);for(let o in Wd)Object.defineProperty(this,o,Wd[o]);if(this._renderer.type="texture",this._renderer.flagOffset=G0.bind(this),this._renderer.flagScale=Z0.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new ge,typeof r=="function"){const o=(function(){this.unbind(te.Types.load,o),typeof r=="function"&&r()}).bind(this);this.bind(te.Types.load,o)}if(typeof i=="string")this.src=i;else if(typeof i=="object"){const o=Object.prototype.toString.call(i);(o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]"||o==="[object HTMLVideoElement]"||o==="[object Image]")&&(this.image=i)}this._update()}fromObject(i){const r=new Je().copy(i);return"id"in i&&(r.id=i.id),r}static getAbsoluteURL(i){return Ao?(Ao.href=i,Ao.href):i}static loadHeadlessBuffer(i,r){i.image.onload=r,i.image.src=i.src}static getTag(i){return i&&i.nodeName&&i.nodeName.toLowerCase()||"img"}static getImage(i){const r=Je.getAbsoluteURL(i);if(Je.ImageRegistry.contains(r))return Je.ImageRegistry.get(r);let o;return Tn.document?Hd.video.test(r)?o=document.createElement("video"):o=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),o.crossOrigin="anonymous",o.referrerPolicy="no-referrer",o}static load(i,r){let o=i.image,s=Je.getTag(o);i._flagImage&&(/canvas/i.test(s)?Je.Register.canvas(i,r):(i._src=o.getAttribute("two-src")||o.src,Je.Register[s](i,r))),i._flagSrc&&(o||(o=Je.getImage(i.src),i.image=o),s=Je.getTag(o),Je.Register[s](i,r))}clone(){const i=new Je(this.src);return i.repeat=this.repeat,i.offset.copy(this.offset),i.scale=this.scale,i}copy(i){return this.src=i.src,this.repeat=i.repeat,this.offset=typeof i.offset=="number"||i.offset instanceof ge?i.offset:new ge().copy(i.offset),this.scale=typeof i.scale=="number"||i.scale instanceof ge?i.scale:new ge().copy(i.scale),this}toObject(){const i=super.toObject.call(this);return i.renderer.type="texture",i.src=this.src,i.repeat=this.repeat,i.offset=this.offset.toObject(),i.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),i}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(te.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Je.load(this,(function(){this.loaded=!0,this.trigger(te.Types.change).trigger(te.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const i=this._renderer.elem;i.parentNode.removeChild(i)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};N(Je,"Properties",["src","loaded","repeat","scale","offset","image"]),N(Je,"RegularExpressions",Hd),N(Je,"ImageRegistry",new K0),N(Je,"Register",{canvas:function(i,r){i._src="#"+i.id,Je.ImageRegistry.add(i.src,i.image),typeof r=="function"&&r()},img:function(i,r){const o=i.image,s=function(l){o.removeEventListener&&typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),typeof r=="function"&&r()},a=function(l){throw typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),new Io("unable to load "+i.src)};typeof o.width=="number"&&o.width>0&&typeof o.height=="number"&&o.height>0?s():typeof o.addEventListener=="function"&&(o.addEventListener("load",s,!1),o.addEventListener("error",a,!1)),i._src=Je.getAbsoluteURL(i._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",i.src),Je.ImageRegistry.add(i.src,o),i.image.src=i.src)},video:function(i,r){const o=function(a){i.image.removeEventListener("canplaythrough",o,!1),i.image.removeEventListener("error",s,!1),i.image.width=i.image.videoWidth,i.image.height=i.image.videoHeight,typeof r=="function"&&r()},s=function(a){throw i.image.removeEventListener("canplaythrough",o,!1),i.image.removeEventListener("error",s,!1),new Io("unable to load "+i.src)};i._src=Je.getAbsoluteURL(i._src),i.image.getAttribute("two-src")||(i.image.setAttribute("two-src",i.src),Je.ImageRegistry.add(i.src,i.image)),i.image.readyState>=4?o():(i.image.addEventListener("canplaythrough",o,!1),i.image.addEventListener("error",s,!1),i.image.src=i.src,i.image.load())}});let Qe=Je;const Wd={src:{enumerable:!0,get:function(){return this._src},set:function(n){this._src=n,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(n){this._loaded=n,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(n){this._repeat=n,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(n){const e=Qe.getTag(n);let i;switch(e){case"canvas":i="#"+n.id;break;default:i=n.src}Qe.ImageRegistry.contains(i)?this._image=Qe.ImageRegistry.get(n.src):this._image=n,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset&&this._offset.unbind(te.Types.change,this._renderer.flagOffset),this._offset=n,this._offset.bind(te.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof ge&&this._scale.unbind(te.Types.change,this._renderer.flagScale),this._scale=n,this._scale instanceof ge&&this._scale.bind(te.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function G0(){this._flagOffset=!0}function Z0(){this._flagScale=!0}class Si extends Array{constructor(){super();Il(this,xt,new te);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 Dt(this,xt)}set _events(i){Cm(this,xt,i)}get _bound(){return Dt(this,xt)._bound}set _bound(i){Dt(this,xt)._bound=i}addEventListener(){var i;return(i=Dt(this,xt).addEventListener)==null?void 0:i.apply(this,arguments)}on(){var i;return(i=Dt(this,xt).on)==null?void 0:i.apply(this,arguments)}bind(){var i;return(i=Dt(this,xt).bind)==null?void 0:i.apply(this,arguments)}removeEventListener(){var i;return(i=Dt(this,xt).removeEventListener)==null?void 0:i.apply(this,arguments)}off(){var i;return(i=Dt(this,xt).off)==null?void 0:i.apply(this,arguments)}unbind(){var i;return(i=Dt(this,xt).unbind)==null?void 0:i.apply(this,arguments)}dispatchEvent(){var i;return(i=Dt(this,xt).dispatchEvent)==null?void 0:i.apply(this,arguments)}trigger(){var i;return(i=Dt(this,xt).trigger)==null?void 0:i.apply(this,arguments)}listen(){var i;return(i=Dt(this,xt).listen)==null?void 0:i.apply(this,arguments)}ignore(){var i;return(i=Dt(this,xt).ignore)==null?void 0:i.apply(this,arguments)}pop(){const i=super.pop.apply(this,arguments);return this.trigger(te.Types.remove,[i]),i}shift(){const i=super.shift.apply(this,arguments);return this.trigger(te.Types.remove,[i]),i}push(){const i=super.push.apply(this,arguments);return this.trigger(te.Types.insert,arguments),i}unshift(){const i=super.unshift.apply(this,arguments);return this.trigger(te.Types.insert,arguments),i}splice(){const i=super.splice.apply(this,arguments);if(this.trigger(te.Types.remove,i),arguments.length>2){const r=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(te.Types.insert,r),this.trigger(te.Types.order)}return i}sort(){return super.sort.apply(this,arguments),this.trigger(te.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(te.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(i,r){const o=[];for(let s=0;s<this.length;s++){const a=this[s];let l;r?l=i.call(r,a,s):l=i(a,s),o.push(l)}return o}}xt=new WeakMap;const jd=Array.prototype.slice;function Q0(n){if(n==null)return!1;const e=n.length;return typeof e=="number"&&e>=0&&e<4294967296}const We={isNaN:function(n){return typeof n=="number"&&n!==+n},isElement:function(n){return!!(n&&n.nodeType===1)},isObject:function(n){const e=typeof n;return e==="function"||e==="object"&&!!n},isFunction:function(n){return typeof n=="function"},extend:function(n){const e=jd.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]=r[o]}return n},defaults:function(n){const e=jd.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]===void 0&&(n[o]=r[o])}return n},each:function(n,e,i){const r=i||this,o=!Q0(n)&&Object.keys(n),s=(o||n).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,n[l],l,n)}return n},performance:Tn.performance&&Tn.performance.now?Tn.performance:Date},Ut=class Ut extends Vr{constructor(i,r,o){super();N(this,"_flagOffset",!0);N(this,"_flagOpacity",!0);N(this,"_flagColor",!0);N(this,"_offset",0);N(this,"_opacity",1);N(this,"_color","#fff");for(let s in qd)Object.defineProperty(this,s,qd[s]);this._renderer.type="stop",this.offset=typeof i=="number"?i:Ut.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:Ut.Index<=0?"#fff":"#000",Ut.Index=(Ut.Index+1)%2}static fromObject(i){const r=new Ut().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Ut.Properties.length;r++){const o=Ut.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Ut;return We.each(Ut.Properties,function(o){r[o]=this[o]},this),i&&i.stops&&i.stops.push(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="stop",We.each(Ut.Properties,r=>{i[r]=this[r]},this),i}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};N(Ut,"Index",0),N(Ut,"Properties",["offset","opacity","color"]);let Bi=Ut;const qd={offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset=n,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(n){this._color=n,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Mn=class Mn extends Vr{constructor(i){super();N(this,"_flagStops",!1);N(this,"_flagSpread",!1);N(this,"_flagUnits",!1);N(this,"_spread","");N(this,"_units","");for(let r in Xd)Object.defineProperty(this,r,Xd[r]);this._renderer.type="gradient",this._renderer.flagStops=J0.bind(this),this._renderer.bindStops=e1.bind(this),this._renderer.unbindStops=t1.bind(this),this.spread="pad",this.units="objectBoundingBox",i&&(this.stops=i)}static fromObject(i){let r=i.stops;r&&r.length>0&&(r=r.map(s=>s instanceof Bi?s:new Bi().copy(s)));const o=new Mn(r).copy(i);return"id"in i&&(o.id=i.id),o}clone(i){const r=this.stops.map(s=>s.clone()),o=new Mn(r);return We.each(Mn.Properties,s=>{o[s]=this[s]},this),i&&i.add(o),o}copy(i){super.copy.call(this,i);for(let r=0;r<Mn.Properties.length;r++){const o=Mn.Properties[r];o in i&&(this[o]=i[o])}return this}toObject(){const i={stops:this.stops.map(r=>r.toObject())};return We.each(Mn.Properties,r=>{i[r]=this[r]},this),i}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const i=this._renderer.elem;i.parentNode.removeChild(i)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};N(Mn,"Stop",Bi),N(Mn,"Properties",["spread","stops","units"]);let ft=Mn;const Xd={spread:{enumerable:!0,get:function(){return this._spread},set:function(n){this._spread=n,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(n){this._units=n,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(n){const e=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(te.Types.insert,e).unbind(te.Types.remove,i),this._stops=new Si((n||[]).slice(0)),this._stops.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._stops)}}};function J0(){this._flagStops=!0}function e1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagStops),n[e].parent=this;this._renderer.flagStops()}function t1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagStops),delete n[e].parent;this._renderer.flagStops()}const yi=class yi extends ft{constructor(i,r,o,s,a){super(a);N(this,"_flagEndPoints",!1);N(this,"_left",null);N(this,"_right",null);for(let l in Yd)Object.defineProperty(this,l,Yd[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=n1.bind(this),this.left=new ge,this.right=new ge,typeof i=="number"&&(this.left.x=i),typeof r=="number"&&(this.left.y=r),typeof o=="number"&&(this.right.x=o),typeof s=="number"&&(this.right.y=s)}static fromObject(i){const r=new yi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<yi.Properties.length;r++){const o=yi.Properties[r];o in i&&(this[o]=i[o]instanceof ge?i[o]:new ge().copy(i[o]))}return this}clone(i){const r=this.stops.map(function(s){return s.clone()}),o=new yi(this.left._x,this.left._y,this.right._x,this.right._y,r);return We.each(ft.Properties,function(s){o[s]=this[s]},this),i&&i.add(o),o}toObject(){const i=super.toObject.call(this);return i.left=this.left.toObject(),i.right=this.right.toObject(),i}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};N(yi,"Stop",Bi),N(yi,"Properties",["left","right"]);let Mt=yi;const Yd={left:{enumerable:!0,get:function(){return this._left},set:function(n){this._left instanceof ge&&this._left.unbind(te.Types.change,this._renderer.flagEndPoints),this._left=n,this._left.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(n){this._right instanceof ge&&this._right.unbind(te.Types.change,this._renderer.flagEndPoints),this._right=n,this._right.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function n1(){this._flagEndPoints=!0}const In=class In extends ft{constructor(i,r,o,s,a,l){super(s);N(this,"_flagRadius",!1);N(this,"_flagCenter",!1);N(this,"_flagFocal",!1);N(this,"_radius",0);N(this,"_center",null);N(this,"_focal",null);for(let c in Ud)Object.defineProperty(this,c,Ud[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=i1.bind(this),this._renderer.flagFocal=r1.bind(this),this.center=new ge,this.radius=typeof o=="number"?o:1,this.focal=new ge,typeof i=="number"&&(this.center.x=i),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(i){const r=new In().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<In.Properties.length;r++){const o=In.Properties[r];o in i&&(/(center|focal)i/.test(o)?this[o]=i[o]instanceof ge?i[o]:new ge().copy(i[o]):typeof i[o]=="number"&&(this[o]=i[MediaKeySystemAccess]))}return this}clone(i){const r=this.stops.map(function(s){return s.clone()}),o=new In(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return We.each(ft.Properties.concat(In.Properties),function(s){o[s]=this[s]},this),i&&i.add(o),o}toObject(){const i=super.toObject.call(this);return We.each(In.Properties,function(r){i[r]=this[r]},this),i.center=this.center.toObject(),i.focal=this.focal.toObject(),i}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};N(In,"Stop",Bi),N(In,"Properties",["center","radius","focal"]);let It=In;const Ud={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(n){this._center&&this._center.unbind(te.Types.change,this._renderer.flagCenter),this._center=n,this._center.bind(te.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(n){this._focal&&this._focal.unbind(te.Types.change,this._renderer.flagFocal),this._focal=n,this._focal.bind(te.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function i1(){this._flagCenter=!0}function r1(){this._flagFocal=!0}function Kd(n,e){if(e===0||e===1)return!0;const r=n._length*e;let o=0;for(let s=0;s<n._lengths.length;s++){const a=n._lengths[s];if(o>=r)return r-o>=0;o+=a}return!1}function Oo(n,e){const i=n._length;if(e<=0)return 0;if(e>=i)return n._lengths.length-1;for(let r=0,o=0;r<n._lengths.length;r++){if(o+n._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/n._lengths[r];o+=n._lengths[r]}return-1}function Gd(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),j0(r,l,o,c,s,d,a,u,i)}function fa(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),Dd(r,l,o,c,s,d,a,u,i)}function Ni(n){switch(n.renderer.type){case"texture":return Qe.fromObject(n);case"gradient":return ft.fromObject(n);case"linear-gradient":return Mt.fromObject(n);case"radial-gradient":return It.fromObject(n)}return n}const o1=Math.cos,s1=Math.sin,Zd=Math.tan,ha=[],Ot=class Ot extends te{constructor(i,r,o,s,a,l){super();N(this,"elements",new Ad(9));N(this,"manual",!1);let c=i;Array.isArray(c)||(c=Array.prototype.slice.call(arguments)),this.identity(),c.length>0&&this.set(c)}static Multiply(i,r,o){if(r.length<=3){const w=i;let T,C,$;const E=r[0]||0,I=r[1]||0,R=r[2]||0;return T=w[0]*E+w[1]*I+w[2]*R,C=w[3]*E+w[4]*I+w[5]*R,$=w[6]*E+w[7]*I+w[8]*R,[T,C,$]}const s=i[0],a=i[1],l=i[2],c=i[3],d=i[4],u=i[5],f=i[6],h=i[7],p=i[8],m=r[0],g=r[1],b=r[2],y=r[3],_=r[4],k=r[5],x=r[6],v=r[7],B=r[8];return o=o||new Ad(9),o[0]=s*m+a*y+l*x,o[1]=s*g+a*_+l*v,o[2]=s*b+a*k+l*B,o[3]=c*m+d*y+u*x,o[4]=c*g+d*_+u*v,o[5]=c*b+d*k+u*B,o[6]=f*m+h*y+p*x,o[7]=f*g+h*_+p*v,o[8]=f*b+h*k+p*B,o}static fromObject(i){return new Ot().copy(i)}set(i,r,o,s,a,l,c,d,u){if(typeof r>"u"){const f=i;i=f[0],r=f[1],o=f[2],s=f[3],a=f[4],l=f[5],c=f[6],d=f[7],u=f[8]}return this.elements[0]=i,this.elements[1]=r,this.elements[2]=o,this.elements[3]=s,this.elements[4]=a,this.elements[5]=l,this.elements[6]=c,this.elements[7]=d,this.elements[8]=u,this.trigger(te.Types.change)}copy(i){return this.elements[0]=i.elements[0],this.elements[1]=i.elements[1],this.elements[2]=i.elements[2],this.elements[3]=i.elements[3],this.elements[4]=i.elements[4],this.elements[5]=i.elements[5],this.elements[6]=i.elements[6],this.elements[7]=i.elements[7],this.elements[8]=i.elements[8],this.manual=i.manual,this.trigger(te.Types.change)}identity(){return this.elements[0]=Ot.Identity[0],this.elements[1]=Ot.Identity[1],this.elements[2]=Ot.Identity[2],this.elements[3]=Ot.Identity[3],this.elements[4]=Ot.Identity[4],this.elements[5]=Ot.Identity[5],this.elements[6]=Ot.Identity[6],this.elements[7]=Ot.Identity[7],this.elements[8]=Ot.Identity[8],this.trigger(te.Types.change)}multiply(i,r,o,s,a,l,c,d,u){if(typeof r>"u")return this.elements[0]*=i,this.elements[1]*=i,this.elements[2]*=i,this.elements[3]*=i,this.elements[4]*=i,this.elements[5]*=i,this.elements[6]*=i,this.elements[7]*=i,this.elements[8]*=i,this.trigger(te.Types.change);if(typeof o>"u"&&(o=1),typeof s>"u"){i=i||0,r=r||0,o=o||0,a=this.elements;const U=a[0]*i+a[1]*r+a[2]*o,Q=a[3]*i+a[4]*r+a[5]*o,G=a[6]*i+a[7]*r+a[8]*o;return[U,Q,G]}const f=this.elements,h=[i,r,o,s,a,l,c,d,u],p=f[0],m=f[1],g=f[2],b=f[3],y=f[4],_=f[5],k=f[6],x=f[7],v=f[8],B=h[0],w=h[1],T=h[2],C=h[3],$=h[4],E=h[5],I=h[6],R=h[7],O=h[8];return this.elements[0]=p*B+m*C+g*I,this.elements[1]=p*w+m*$+g*R,this.elements[2]=p*T+m*E+g*O,this.elements[3]=b*B+y*C+_*I,this.elements[4]=b*w+y*$+_*R,this.elements[5]=b*T+y*E+_*O,this.elements[6]=k*B+x*C+v*I,this.elements[7]=k*w+x*$+v*R,this.elements[8]=k*T+x*E+v*O,this.trigger(te.Types.change)}inverse(i){const r=this.elements;i=i||new Ot;const o=r[0],s=r[1],a=r[2],l=r[3],c=r[4],d=r[5],u=r[6],f=r[7],h=r[8],p=h*c-d*f,m=-h*l+d*u,g=f*l-c*u;let b=o*p+s*m+a*g;return b?(b=1/b,i.elements[0]=p*b,i.elements[1]=(-h*s+a*f)*b,i.elements[2]=(d*s-a*c)*b,i.elements[3]=m*b,i.elements[4]=(h*o-a*u)*b,i.elements[5]=(-d*o+a*l)*b,i.elements[6]=g*b,i.elements[7]=(-f*o+s*u)*b,i.elements[8]=(c*o-s*l)*b,i):null}scale(i,r){return arguments.length<=1&&(r=i),this.multiply(i,0,0,0,r,0,0,0,1)}rotate(i){const r=o1(i),o=s1(i);return this.multiply(r,-o,0,o,r,0,0,0,1)}translate(i,r){return this.multiply(1,0,i,0,1,r,0,0,1)}skewX(i){const r=Zd(i);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(i){const r=Zd(i);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(i){return ha.length=0,this.toTransformArray(i,ha),ha.map($n).join(" ")}toTransformArray(i,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(i){const h=o[6],p=o[7],m=o[8];if(s){r[0]=a,r[1]=d,r[2]=h,r[3]=l,r[4]=u,r[5]=p,r[6]=c,r[7]=f,r[8]=m;return}return[a,d,h,l,u,p,c,f,m]}if(s){r[0]=a,r[1]=d,r[2]=l,r[3]=u,r[4]=c,r[5]=f;return}return[a,d,l,u,c,f]}toArray(i,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(i){const h=o[6],p=o[7],m=o[8];if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f,r[6]=h,r[7]=p,r[8]=m;return}return[a,l,c,d,u,f,h,p,m]}if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f;return}return[a,l,c,d,u,f]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Ot().copy(this)}};N(Ot,"Identity",[1,0,0,0,1,0,0,0,1]);let or=Ot;D0(or);const eo=class eo extends Vr{constructor(){super();N(this,"_flagMatrix",!0);N(this,"_flagScale",!1);N(this,"_matrix",null);N(this,"_worldMatrix",null);N(this,"_position",null);N(this,"_rotation",0);N(this,"_scale",1);N(this,"_skewX",0);N(this,"_skewY",0);for(let i in zo)Object.defineProperty(this,i,zo[i]);this._renderer.flagMatrix=Qd.bind(this),this.isShape=!0,this.matrix=new or,this.worldMatrix=new or,this.position=new ge,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(i){const r=new eo().copy(i);return"id"in i&&(r.id=i.id),r}get renderer(){return this._renderer}set renderer(i){this._renderer=i}get translation(){return zo.position.get.apply(this,arguments)}set translation(i){zo.position.set.apply(this,arguments)}addTo(i){return i.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(i,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&"visible"in this&&this.visible===!1||!a&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();return c?i>=c.left-l&&i<=c.right+l&&r>=c.top-l&&r<=c.bottom+l:!1}copy(i){return super.copy.call(this,i),"position"in i&&(i.position instanceof ge?this.position=i.position:this.position.copy(i.position)),"rotation"in i&&(this.rotation=i.rotation),"scale"in i&&(this.scale=typeof i.scale=="number"||i.scale instanceof ge?i.scale:new ge(i.scale.x,i.scale.y)),"skewX"in i&&(this.skewX=i.skewX),"skewY"in i&&(this.skewY=i.skewY),"matrix"in i&&i.matrix.manual&&(this.matrix.copy(i.matrix),this.matrix.manual=!0),this}clone(i){const r=new eo;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),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer={type:"shape"},i.isShape=!0,i.translation=this.translation.toObject(),i.rotation=this.translation.rotation,i.scale=this.scale instanceof ge?this.scale.toObject():this.scale,i.skewX=this.skewX,i.skewY=this.skewY,i.matrix=this.matrix.toObject(),i}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(i){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof ge?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),i&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};N(eo,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let En=eo;const zo={position:{enumerable:!0,get:function(){return this._position},set:function(n){this._position&&this._position.unbind(te.Types.change,this._renderer.flagMatrix),this._position=n,this._position.bind(te.Types.change,this._renderer.flagMatrix),Qd.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(n){this._rotation=n,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof ge&&this._scale.unbind(te.Types.change,this._renderer.flagMatrix),this._scale=n,this._scale instanceof ge&&this._scale.bind(te.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(n){this._skewX=n,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(n){this._skewY=n,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(n){this._matrix=n,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return L0(this,this._worldMatrix),this._worldMatrix},set:function(n){this._worldMatrix=n}}};function Qd(){this._flagMatrix=!0}const Jd=/^(?:none|transparent)$/i,a1=8,ma=Number.EPSILON;function jn(n,e){return{x:n,y:e}}function Do(n,e,i=ma){return Math.abs(n.x-e.x)<=i&&Math.abs(n.y-e.y)<=i}function eu(n,e,i,r){const o=n*i+e*r,s=Math.sqrt(n*n+e*e)*Math.sqrt(i*i+r*r)||1e-12;let a=Math.acos(Math.max(-1,Math.min(1,o/s)));return n*r-e*i<0&&(a=-a),a}function l1(n,e,i){if(!n)return[jn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[jn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,a=e.largeArcFlag?1:0,l=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=n.x,d=n.y,u=e.x,f=e.y,h=(c-u)/2,p=(d-f)/2,m=Math.cos(s),g=Math.sin(s);let b=m*h+g*p,y=-g*h+m*p,_=r*r,k=o*o;const x=b*b/_+y*y/k;if(x>1){const D=Math.sqrt(x);r*=D,o*=D,_=r*r,k=o*o}const v=_*y*y+k*b*b,B=v===0?0:(_*k-v)/v;let w=Math.sqrt(Math.max(0,B));a===l&&(w=-w);const T=w*r*y/o,C=-w*o*b/r,$=m*T-g*C+(c+u)/2,E=g*T+m*C+(d+f)/2,I=eu(1,0,(b-T)/r,(y-C)/o),R=eu((b-T)/r,(y-C)/o,(-b-T)/r,(-y-C)/o)%Zt,O=I+R,U=l===0,Q=(()=>{const D=O-I,L=Math.abs(D)<Number.EPSILON;let z=qt(D,Zt);return z<Number.EPSILON&&(z=L?0:Zt),U&&!L&&(z=z===Zt?-Zt:z-Zt),z})(),G=Math.max(Fo.Resolution,Math.max(i*2,1)),W=[];for(let D=1;D<=G;D++){const L=D/G,z=I+L*Q;let P=$+r*Math.cos(z),q=E+o*Math.sin(z);if(s!==0){const K=P-$,J=q-E,Y=Math.cos(s),V=Math.sin(s);P=K*Y-J*V+$,q=K*V+J*Y+E}W.push(jn(P,q))}return W}function c1(n,e=a1){const i=[],r=[],o=n._renderer&&n._renderer.vertices&&n._renderer.vertices.length>0?n._renderer.vertices:n.vertices;if(!o||o.length===0)return{polygons:i,segments:r};const s=Math.max(1,Math.floor(e));let a=null,l=null,c=null,d=null;const u=(h=!1)=>{if(a){if(h&&l&&c&&!Do(l,c)){const p=jn(l.x,l.y);r.push({a:c,b:p}),a.push(p),c=p}a.length>=3&&l&&c&&Do(l,c)&&i.push(a),a=null,l=null,c=null}},f=h=>{if(!c){c=h,a&&a.push(h);return}Do(c,h)||(r.push({a:c,b:h}),a&&a.push(h),c=h)};for(let h=0;h<o.length;h++){const p=o[h],m=p.command||(h===0?fe.move:fe.line);if(m===fe.move){u(!1);const g=jn(p.x,p.y);a=[g],l=g,c=g,d=p;continue}if(d||(d=o[Math.max(h-1,0)]),m===fe.line)f(jn(p.x,p.y));else if(m===fe.curve){const g=fa(p,d,s);for(let b=1;b<g.length;b++){const y=g[b];f(jn(y.x,y.y))}f(jn(p.x,p.y))}else if(m===fe.arc){const g=l1(d,p,s);for(let b=0;b<g.length;b++)f(g[b])}else if(m===fe.close){u(!0),d=p;continue}else f(jn(p.x,p.y));d=p}if(a){const h=!!n._closed||!!n.closed||l&&c&&!Do(l,c);u(h)}return{polygons:i,segments:r}}function d1(n,e,i){let r=!1;for(let o=0;o<n.length;o++){const s=n[o];if(!s||s.length<3)continue;let a=s.length-1;for(let l=0;l<s.length;l++){const c=s[a],d=s[l];d.y>i!=c.y>i&&e<(c.x-d.x)*(i-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),a=l}}return r}function u1(n,e,i,r){const o=r.x-i.x,s=r.y-i.y;if(Math.abs(o)<ma&&Math.abs(s)<ma){const h=n-i.x,p=e-i.y;return h*h+p*p}const a=((n-i.x)*o+(e-i.y)*s)/(o*o+s*s),l=Math.max(0,Math.min(1,a)),c=i.x+l*o,d=i.y+l*s,u=n-c,f=e-d;return u*u+f*f}function f1(n,e,i){if(!n||n.length===0)return 1/0;let r=1/0;for(let o=0;o<n.length;o++){const s=n[o],a=u1(e,i,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function h1(n,e){if(typeof e=="boolean")return e;const i=n.fill;return!i&&i!==0?!1:typeof i=="string"?!Jd.test(i):!0}function m1(n,e){const i=typeof n.linewidth=="number"?n.linewidth:n._linewidth||0;if(typeof e=="boolean")return e&&i>0;if(!(i>0))return!1;const r=n.stroke;return!r&&r!==0?!1:typeof r=="string"?!Jd.test(r):!0}function p1(n,e,i,r=0){if(!n)return!1;const o=n.left-r,s=n.right+r,a=n.top-r,l=n.bottom+r;return e>=o&&e<=s&&i>=a&&i<=l}const Lo=Number.EPSILON;function Ho(n){return typeof n.relative!="boolean"||!!n.relative}function gn(n,e,i,r){const o=n.controls;if(!(!o||!o[e])){if(Math.abs(i)<Lo&&Math.abs(r)<Lo){Ho(n)?o[e].clear():o[e].set(n.x,n.y);return}Ho(n)?o[e].set(i,r):o[e].set(n.x+i,n.y+r)}}function Xt(n,e){gn(n,e,0,0)}function g1(n,e){const i=n.controls;return!i||!i[e]?{x:0,y:0}:Ho(n)?{x:i[e].x,y:i[e].y}:{x:i[e].x-n.x,y:i[e].y-n.y}}function sr(n,e){const i=g1(n,e);return Math.abs(i.x)>Lo||Math.abs(i.y)>Lo}function Wo(n){n.command===fe.move||n.command===fe.close||(n.command=sr(n,"left")||sr(n,"right")?fe.curve:fe.line)}function tu(n,e){typeof e.relative=="boolean"&&(n.relative=e.relative)}function y1(n,e){return sr(e,"right")||sr(n,"left")||sr(n,"right")||sr(e,"left")||n.command===fe.curve||e.command===fe.curve}function ar(n,e,i){return{x:jt(n.x,e.x,i),y:jt(n.y,e.y,i)}}function nu(n,e){const i=n.controls&&n.controls[e];return i?Ho(n)?{x:n.x+i.x,y:n.y+i.y}:{x:i.x,y:i.y}:{x:n.x,y:n.y}}function b1(n,e,i){const r=n.controls&&n.controls.right,o=e.controls&&e.controls.left,s={x:n.x,y:n.y},a=r?nu(n,"right"):{...s},l={x:e.x,y:e.y},c=o?nu(e,"left"):{...l},d=ar(s,a,i),u=ar(a,c,i),f=ar(c,l,i),h=ar(d,u,i),p=ar(u,f,i),m=ar(h,p,i),g=new Ie(m.x,m.y);return tu(g,n),gn(g,"left",h.x-m.x,h.y-m.y),gn(g,"right",p.x-m.x,p.y-m.y),g.command=fe.curve,{anchor:g,startOut:d,endIn:f}}function _1(n,e,i,r,o,s){const a=n.length,l=i-e+1;let c=l-1,d=o?Math.min(l,4):1,u=d,f=d;if(r||(u=Math.min(1,e),f=Math.min(1,a-i-1)),c+=u+f,c<=1)return;const h=new Array(c+1);for(let w=0,T=e-u;w<=c;w+=1,T+=1){const C=qt(T,a);h[w]=n[C]}let p=h[0].x+2*h[1].x,m=h[0].y+2*h[1].y,g=2;const b=c-1,y=[p],_=[m],k=[g],x=new Array(c+1),v=new Array(c+1);for(let w=1;w<c;w+=1){const T=w<b,C=T||s?1:2,$=T?4:s?2:7,E=T?4:s?3:8,I=T?2:s?0:1,R=C/g;g=k[w]=$-R,p=y[w]=E*h[w].x+I*h[w+1].x-R*p,m=_[w]=E*h[w].y+I*h[w+1].y-R*m}x[b]=y[b]/k[b],v[b]=_[b]/k[b];for(let w=c-2;w>=0;w-=1)x[w]=(y[w]-x[w+1])/k[w],v[w]=(_[w]-v[w+1])/k[w];x[c]=(3*h[c].x-x[b])/2,v[c]=(3*h[c].y-v[b])/2;const B=c-f;for(let w=u,T=e;w<=B;w+=1,T+=1){const C=qt(T,a),$=n[C],E=x[w]-$.x,I=v[w]-$.y;o||w<B?gn($,"right",E,I):Xt($,"right"),o||w>u?gn($,"left",-E,-I):Xt($,"left"),Wo($)}}function w1(n,e,i,r,o,s){const a=e||n,l=n,c=i||n,d=ge.distanceBetween(a,l),u=ge.distanceBetween(l,c),f=r===void 0?.5:r,h=Math.pow(d,f),p=Math.pow(u,f),m=h*h,g=p*p;if(!o&&e){const b=2*g+3*p*h+m,y=3*p*(p+h);if(y!==0){const _=(g*a.x+b*l.x-m*c.x)/y-l.x,k=(g*a.y+b*l.y-m*c.y)/y-l.y;gn(n,"left",_,k)}else Xt(n,"left")}else Xt(n,"left");if(!s&&i){const b=2*m+3*h*p+g,y=3*h*(h+p);if(y!==0){const _=(m*c.x+b*l.x-g*a.x)/y-l.x,k=(m*c.y+b*l.y-g*a.y)/y-l.y;gn(n,"right",_,k)}else Xt(n,"right")}else Xt(n,"right");Wo(n)}function x1(n,e,i,r,o,s){if(!(e&&i)){e||Xt(n,"left"),i||Xt(n,"right"),Wo(n);return}const a=e,l=n,c=i,d=ge.distanceBetween(a,l),u=ge.distanceBetween(l,c),f=d+u,h=r===void 0?.4:r,p={x:a.x-c.x,y:a.y-c.y};if(!o&&f!==0){const m=h*d/f;gn(n,"left",p.x*m,p.y*m)}else Xt(n,"left");if(!s&&f!==0){const m=h*d/f-h;gn(n,"right",p.x*m,p.y*m)}else Xt(n,"right");Wo(n)}function k1(n,e,i,r,o,s){const a=s.type,l=s.factor,c=n.length;for(let d=e;d<=i;d+=1){const u=qt(d,c),f=n[u];if(f.command===fe.move){Xt(f,"left"),Xt(f,"right");continue}const h=d===e&&!o?null:d-1,p=d===i&&!o?null:d+1,m=h===null?null:n[qt(h,c)],g=p===null?null:n[qt(p,c)],b=h===null,y=p===null;a==="geometric"?x1(f,m,g,l,b,y):w1(f,m,g,l,b,y)}}const lr=Math.min,cr=Math.max,C1=Math.ceil,v1=Math.floor,S1=new ge,B1=new or,_n=class _n extends En{constructor(i,r,o,s){super();N(this,"_flagVertices",!0);N(this,"_flagLength",!0);N(this,"_flagFill",!0);N(this,"_flagStroke",!0);N(this,"_flagLinewidth",!0);N(this,"_flagOpacity",!0);N(this,"_flagVisible",!0);N(this,"_flagCap",!0);N(this,"_flagJoin",!0);N(this,"_flagMiter",!0);N(this,"_flagStrokeAttenuation",!0);N(this,"_flagMask",!1);N(this,"_flagClip",!1);N(this,"_length",0);N(this,"_fill","#fff");N(this,"_stroke","#000");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_cap","round");N(this,"_join","round");N(this,"_miter",4);N(this,"_closed",!0);N(this,"_curved",!1);N(this,"_automatic",!0);N(this,"_beginning",0);N(this,"_ending",1);N(this,"_mask",null);N(this,"_clip",!1);N(this,"_dashes",null);N(this,"_strokeAttenuation",!0);for(let a in iu)Object.defineProperty(this,a,iu[a]);this._renderer.type="path",this._renderer.flagVertices=ru.bind(this),this._renderer.bindVertices=ou.bind(this),this._renderer.unbindVertices=su.bind(this),this._renderer.flagFill=au.bind(this),this._renderer.flagStroke=lu.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!r,this.curved=!!o,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=i,this.automatic=!s,this.dashes=[],this.dashes.offset=0}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ni(i.fill),o=typeof i.stroke=="string"?i.stroke:Ni(i.stroke),s=new _n().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){if(super.copy.call(this,i),i.vertices){this.vertices=[];for(let r=0;r<i.vertices.length;r++){const o=i.vertices[r];o instanceof Ie?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ie().copy(o))}}for(let r=0;r<_n.Properties.length;r++){const o=_n.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new _n;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<_n.Properties.length;o++){const s=_n.Properties[o];r[s]=this[s]}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),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="path",i.vertices=this.vertices.map(r=>r.toObject()),We.each(_n.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?i[r]=this[r].toObject():i[r]=this[r])},this),i}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let i=0;i<this.vertices.length;i++){const r=this.vertices[i];typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const i=this.getBoundingClientRect(!0),r=i.width/2,o=i.height/2,s=i.left+i.width/2,a=i.top+i.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=s,c.y-=a,c.x+=r,c.y+=o}return this.mask&&(this.mask.translation.x-=s,this.mask.translation.x+=r,this.mask.translation.y-=a,this.mask.translation.y+=o),this}center(){const i=this.getBoundingClientRect(!0),r=i.left+i.width/2-this.translation.x,o=i.top+i.height/2-this.translation.y;for(let s=0;s<this.vertices.length;s++){const a=this.vertices[s];a.x-=r,a.y-=o}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getBoundingClientRect(i){let r,o,s,a,l,c,d=1/0,u=-1/0,f=1/0,h=-1/0;if(this._update(!0),r=i?this.matrix:this.worldMatrix,o=(this.linewidth||0)/2,s=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:p,scaleY:m}=z0(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof p=="number"&&typeof m=="number"&&(o=Math.max(p,m)*(this.linewidth||0)/2)}else o*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(s<=0)return{width:0,height:0};for(a=0;a<s;a++){c=this._renderer.vertices[a],l=this._renderer.vertices[(a+s-1)%s];const[p,m]=r.multiply(l.x,l.y),[g,b]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let y=l.controls.right.x,_=l.controls.right.y;l.relative&&(y+=l.x,_+=l.y);let[k,x]=r.multiply(y,_),v=c.controls.left.x,B=c.controls.left.y;c.relative&&(v+=c.x,B+=c.y);let[w,T]=r.multiply(v,B);const C=q0(p,m,k,x,w,T,g,b);f=lr(C.min.y-o,f),d=lr(C.min.x-o,d),u=cr(C.max.x+o,u),h=cr(C.max.y+o,h)}else a<=1&&(f=lr(m-o,f),d=lr(p-o,d),u=cr(p+o,u),h=cr(m+o,h)),f=lr(b-o,f),d=lr(g-o,d),u=cr(g+o,u),h=cr(b+o,h)}return{top:f,left:d,right:u,bottom:h,width:u-d,height:h-f}}contains(i,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&this.visible===!1||!a&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();if(!c||i<c.left-l||i>c.right+l||r<c.top-l||r>c.bottom+l)return!1;const d=this.worldMatrix,u=d&&d.inverse(B1);if(!u)return super.contains(i,r,s);const[f,h]=u.multiply(i,r,1),p=typeof s.precision=="number"&&!Number.isNaN(s.precision)?Math.max(1,Math.floor(s.precision)):8,m=h1(this,s.fill),g=m1(this,s.stroke),{polygons:b,segments:y}=c1(this,p);if(m&&b.length>0&&d1(b,f,h))return!0;if(g&&y.length>0){const _=typeof this.linewidth=="number"?this.linewidth:0;if(_>0&&f1(y,f,h)<=_/2+l)return!0}return!m&&!g?super.contains(i,r,s):m&&b.length===0?super.contains(i,r,s):!1}getPointAt(i,r){let o,s,a,l,c,d,u,f,h,p,m,g,b,y,_,k=this.length*Math.min(Math.max(i,0),1);const x=this.vertices.length,v=x-1;let B=null,w=null;for(let W=0,D=this._lengths.length,L=0;W<D;W++){if(L+this._lengths[W]>=k){this._closed?(o=qt(W,x),s=qt(W-1,x),W===0&&(o=s,s=W)):(o=W,s=Math.min(Math.max(W-1,0),v)),B=this.vertices[o],w=this.vertices[s],k-=L,this._lengths[W]!==0?i=k/this._lengths[W]:i=0;break}L+=this._lengths[W]}if(B===null||w===null)return null;if(B){if(!w)return B}else return w;_=w.controls&&w.controls.right,y=B.controls&&B.controls.left,c=w.x,p=w.y,d=(_||w).x,m=(_||w).y,u=(y||B).x,g=(y||B).y,f=B.x,b=B.y,_&&w.relative&&(d+=w.x,m+=w.y),y&&B.relative&&(u+=B.x,g+=B.y),l=Mo(i,c,d,u,f),h=Mo(i,p,m,g,b);const T=jt(c,d,i),C=jt(p,m,i),$=jt(d,u,i),E=jt(m,g,i),I=jt(u,f,i),R=jt(g,b,i),O=jt(T,$,i),U=jt(C,E,i),Q=jt($,I,i),G=jt(E,R,i);return We.isObject(r)?(r.x=l,r.y=h,r instanceof Ie&&(r.controls.left.x=O,r.controls.left.y=U,r.controls.right.x=Q,r.controls.right.y=G,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=h,r.controls.right.x-=l,r.controls.right.y-=h)),r.t=i,r):(a=new Ie(l,h,O-l,U-h,Q-l,G-h,this._curved?fe.curve:fe.line),a.t=i,a)}plot(){if(this.curved)return Y0(this._collection,this.closed),this;for(let i=0;i<this._collection.length;i++)this._collection[i].command=i===0?fe.move:fe.line;return this}smooth(i){const r=i||{},o=r.type||"continuous",s=this._collection,a=s.length;if(a<2)return this;const l=this._closed||a>0&&s[a-1]&&s[a-1].command===fe.close,c=(p,m)=>{if(p==null)return m;if(typeof p=="number"){if(l)return qt(p,a);let b=p;return b<0&&(b+=a),Math.min(Math.max(b,0),a-1)}const g=s.indexOf(p);return g!==-1?g:m},d=l&&r.from===void 0&&r.to===void 0;let u=c(r.from,0),f=c(r.to,a-1);if(u>f)if(l)u-=a;else{const p=u;u=f,f=p}const h=f-u+1;for(let p=0;p<h;p+=1){const m=qt(u+p,a),g=s[m],b=!l&&m===0;g.command===fe.move&&!b&&(g.command=fe.line)}if(o==="continuous"||o==="asymmetric")_1(s,u,f,l,d,o==="asymmetric");else if(o==="catmull-rom"||o==="geometric"){const p={type:o,factor:r.factor};k1(s,u,f,l,d,p)}else throw new Error(`Path.smooth does not support type "${o}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(i){this._update();const r=this.vertices,o=r.length;if(o<2)return this;const s=[];let a=null,l=null;for(let c=0;c<o;c+=1){const d=r[c];if(!a||d.command===fe.move){const f=d.clone();s.push(f),a=d,l=d;continue}if(y1(d,a)){const h=fa(d,a,i).length,p=s[s.length-1];let m=p.clone(),g=d.clone(),b=p,y=0;if(h<=1){const _=d.clone();s.push(_)}else{for(let k=1;k<h;k+=1){const x=k/h,v=1-y,B=v<=Number.EPSILON?x:(x-y)/v,w=b1(m,g,B);gn(b,"right",w.startOut.x-b.x,w.startOut.y-b.y);const T=w.anchor;s.push(T),b=T,m=T.clone(),y=x,gn(g,"left",w.endIn.x-g.x,w.endIn.y-g.y)}const _=d.clone();_.controls.left.copy(g.controls.left),s.push(_)}}else{const f=fa(d,a,i);for(let p=1;p<f.length;p+=1){const m=f[p];tu(m,a),Xt(m,"left"),Xt(m,"right"),m.command=fe.line,s.push(m)}const h=d.clone();s.push(h)}a=d,d.command===fe.close&&(a=l)}return this._automatic=!1,this._curved=!1,this.vertices=s,this}_updateLength(i,r){r||this._update();const s=this.vertices.length-1;let a=this.vertices[s],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),We.each(this.vertices,function(c,d){if(d<=0||c.command===fe.move){a=c,this._lengths[d]=0;return}this._lengths[d]=Gd(c,a,i),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 i=this._collection.length,r=this._closed,o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),a=Oo(this,o*this._length),l=Oo(this,s*this._length),c=C1(a),d=v1(l);let u,f,h,p,m,g;for(this._renderer.vertices.length=0,g=0;g<i;g++)this._renderer.collection.length<=g&&this._renderer.collection.push(new Ie),g>d&&!f?(m=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(s,m),m.command=this._renderer.collection[g].command,this._renderer.vertices.push(m),f=m,h=this._collection[g-1],h&&h.controls&&(m.relative?m.controls.right.clear():m.controls.right.copy(m),h.relative?this._renderer.collection[g-1].controls.right.copy(h.controls.right).lerp(ge.zero,1-m.t):this._renderer.collection[g-1].controls.right.copy(h.controls.right).lerp(h,1-m.t))):g>=c&&g<=d&&(m=this._renderer.collection[g].copy(this._collection[g]),this._renderer.vertices.push(m),g===d&&Kd(this,s)?(f=m,!r&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):g===c&&Kd(this,o)&&(u=m,u.command=fe.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(g=c-1,m=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(o,m),m.command=fe.move,this._renderer.vertices.unshift(m),p=this._collection[g+1],p&&p.controls&&(m.controls.left.clear(),p.relative?this._renderer.collection[g+1].controls.left.copy(p.controls.left).lerp(ge.zero,m.t):(S1.copy(p),this._renderer.collection[g+1].controls.left.copy(p.controls.left).lerp(p,m.t))))}return En.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,En.prototype.flagReset.call(this),this}};N(_n,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),N(_n,"Utils",{getCurveLength:Gd});let Ae=_n;const iu={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.bind(te.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(n){this._closed=!!n,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=!!n,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){if(n===this._automatic)return;this._automatic=!!n;const e=this._automatic?"ignore":"listen";We.each(this.vertices,function(i){i[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,i),n instanceof Si?this._collection=n:this._collection=new Si(n||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,We.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function ru(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function ou(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function su(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function au(){this._flagFill=!0}function lu(){this._flagStroke=!0}const N1=Math.ceil,T1=Math.floor,An=class An extends En{constructor(i){super();N(this,"_flagVertices",!0);N(this,"_flagLength",!0);N(this,"_flagFill",!0);N(this,"_flagStroke",!0);N(this,"_flagLinewidth",!0);N(this,"_flagOpacity",!0);N(this,"_flagVisible",!0);N(this,"_flagSize",!0);N(this,"_flagSizeAttenuation",!0);N(this,"_flagStrokeAttenuation",!0);N(this,"_length",0);N(this,"_fill","#fff");N(this,"_stroke","#000");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_size",1);N(this,"_sizeAttenuation",!1);N(this,"_beginning",0);N(this,"_ending",1);N(this,"_dashes",null);N(this,"_strokeAttenuation",!0);N(this,"noFill",Ae.prototype.noFill);N(this,"noStroke",Ae.prototype.noStroke);N(this,"corner",Ae.prototype.corner);N(this,"center",Ae.prototype.center);N(this,"getBoundingClientRect",Ae.prototype.getBoundingClientRect);N(this,"_updateLength",Ae.prototype._updateLength);for(let r in cu)Object.defineProperty(this,r,cu[r]);this._renderer.type="points",this._renderer.flagVertices=ru.bind(this),this._renderer.bindVertices=ou.bind(this),this._renderer.unbindVertices=su.bind(this),this._renderer.flagFill=au.bind(this),this._renderer.flagStroke=lu.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=i,this.dashes=[],this.dashes.offset=0}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ni(i.fill),o=typeof i.stroke=="string"?i.stroke:Ni(i.stroke),s=new An().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){super.copy.call(this,i);for(let r=0;r<i.vertices.length;r++){const o=i.vertices[r];o instanceof Ie?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ie().copy(o))}for(let r=0;r<An.Properties.length;r++){const o=An.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new An;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<An.Properties.length;o++){const s=An.Properties[o];r[s]=this[s]}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),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="points",i.vertices=this.vertices.map(r=>r.toObject()),We.each(An.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?i[r]=this[r].toObject():i[r]=this[r])},this),i}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let i=0;i<this.vertices.length;i++){const r=this.vertices[i];typeof r.unbind=="function"&&r.unbind()}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(i){this._update();let r=[];for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o],a=this.vertices[o-1];if(!a)continue;const l=s.x,c=s.y,d=a.x,u=a.y,f=Dd(l,c,l,c,d,u,d,u,i);r=r.concat(f)}return this.vertices=r,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const i=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),o=Oo(this,i*this._length),s=Oo(this,r*this._length),a=N1(o),l=T1(s);let c=0,d;this._renderer.vertices=[],this._renderer.collection=[];for(let u=0;u<this._collection.length;u++)u>=a&&u<=l&&(d=this._collection[u],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}};N(An,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let jo=An;const cu={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(n){this._sizeAttenuation=n,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.bind(te.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(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,i),n instanceof Si?this._collection=n:this._collection=new Si(n||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};class du extends Si{constructor(i){i=Array.isArray(i)?i:Array.prototype.slice.call(arguments);super(i);Il(this,ys,{});this.attach(i),this.on(te.Types.insert,this.attach),this.on(te.Types.remove,this.detach)}get ids(){return Dt(this,ys)}attach(i){for(let r=0;r<i.length;r++){const o=i[r];o&&o.id&&(this.ids[o.id]=o)}return this}detach(i){for(let r=0;r<i.length;r++)delete this.ids[i[r].id];return this}}ys=new WeakMap;const Kn=class Kn extends Ae{constructor(i,r,o,s,a,l,c){const d=c||Fo.Resolution*3,u=[];for(let f=0;f<d;f++)u.push(new Ie);super(u,!0,!1,!0);N(this,"_flagStartAngle",!1);N(this,"_flagEndAngle",!1);N(this,"_flagInnerRadius",!1);N(this,"_flagOuterRadius",!1);N(this,"_startAngle",0);N(this,"_endAngle",Zt);N(this,"_innerRadius",0);N(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let f in uu)Object.defineProperty(this,f,uu[f]);typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.startAngle=a),typeof l=="number"&&(this.endAngle=l),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Kn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Kn.Properties.length;r++){const o=Kn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const i=this._startAngle,r=this._endAngle,o=this._innerRadius,s=this._outerRadius,a=qt(i,Zt)===qt(r,Zt),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,f=0,h,p,m,g,b,y,_,k,x;for(a?d--:l||(d-=2),h=0,p=d-1;h<d;h++){switch(m=h/p,g=c[f],b=m*(r-i)+i,y=(r-i)/d,_=s*Math.cos(b),k=s*Math.sin(b),h){case 0:u=fe.move;break;default:u=fe.curve}g.command=u,g.x=_,g.y=k,g.controls.left.clear(),g.controls.right.clear(),g.command===fe.curve&&(x=s*y/Math.PI,g.controls.left.x=x*Math.cos(b-bt),g.controls.left.y=x*Math.sin(b-bt),g.controls.right.x=x*Math.cos(b+bt),g.controls.right.y=x*Math.sin(b+bt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++}if(l){for(a?(c[f].command=fe.close,f++):(d--,p=d-1),h=0;h<d;h++)m=h/p,g=c[f],b=(1-m)*(r-i)+i,y=(r-i)/d,_=o*Math.cos(b),k=o*Math.sin(b),u=fe.curve,h<=0&&(u=a?fe.move:fe.line),g.command=u,g.x=_,g.y=k,g.controls.left.clear(),g.controls.right.clear(),g.command===fe.curve&&(x=o*y/Math.PI,g.controls.left.x=x*Math.cos(b+bt),g.controls.left.y=x*Math.sin(b+bt),g.controls.right.x=x*Math.cos(b-bt),g.controls.right.y=x*Math.sin(b-bt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++;c[f].copy(c[0]),c[f].command=fe.line}else a||(c[f].command=fe.line,c[f].x=0,c[f].y=0,f++,c[f].copy(c[0]),c[f].command=fe.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(i){const r=this.innerRadius,o=this.outerRadius,s=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new Kn(0,0,r,o,s,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<Ae.Properties.length;d++){const u=Ae.Properties[d];c[u]=this[u]}return i&&i.add(c),c}toObject(){const i=super.toObject.call(this);i.renderer.type="arc-segment";for(let r=0;r<Kn.Properties.length;r++){const o=Kn.Properties[r];i[o]=this[o]}return i}};N(Kn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let pa=Kn;const uu={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(n){this._startAngle=n,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(n){this._endAngle=n,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}}},ga=Math.cos,ya=Math.sin,Gn=class Gn extends Ae{constructor(i,r,o,s){const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ie(0,0,0,0,0,0));super(l,!0,!0,!0);N(this,"_flagRadius",!1);N(this,"_radius",0);this._renderer.type="circle";for(let c in fu)Object.defineProperty(this,c,fu[c]);typeof o=="number"&&(this.radius=o),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Gn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Gn.Properties.length;r++){const o=Gn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagRadius){let i=this.vertices.length;!this._closed&&i>2&&(i-=1);const r=4/3*Math.tan(Math.PI/(i*2)),o=this._radius,s=o*r;for(let a=0;a<this.vertices.length;a++){const c=a/i*Zt,d=o*ga(c),u=o*ya(c),f=s*ga(c-bt),h=s*ya(c-bt),p=s*ga(c+bt),m=s*ya(c+bt),g=this.vertices[a];g.command=a===0?fe.move:fe.curve,g.set(d,u),g.controls.left.set(f,h),g.controls.right.set(p,m)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(i){const r=new Gn(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 o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);i.renderer.type="circle";for(let r=0;r<Gn.Properties.length;r++){const o=Gn.Properties[r];i[o]=this[o]}return i}};N(Gn,"Properties",["radius"]);let ba=Gn;const fu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}}},_a=Math.cos,wa=Math.sin,Zn=class Zn extends Ae{constructor(i,r,o,s,a){typeof s!="number"&&typeof o=="number"&&(s=o);const l=a?Math.max(a,2):4,c=[];for(let d=0;d<l;d++)c.push(new Ie);super(c,!0,!0,!0);N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_width",0);N(this,"_height",0);this._renderer.type="ellipse";for(let d in hu)Object.defineProperty(this,d,hu[d]);typeof o=="number"&&(this.width=o*2),typeof s=="number"&&(this.height=s*2),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Zn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Zn.Properties.length;r++){const o=Zn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let i=this.vertices.length;!this._closed&&i>2&&(i-=1);const r=4/3*Math.tan(Math.PI/(this.vertices.length*2)),o=this._width/2,s=this._height/2;for(let a=0;a<this.vertices.length;a++){const c=a/i*Zt,d=o*_a(c),u=s*wa(c),f=o*r*_a(c-bt),h=s*r*wa(c-bt),p=o*r*_a(c+bt),m=s*r*wa(c+bt),g=this.vertices[a];g.command=a===0?fe.move:fe.curve,g.set(d,u),g.controls.left.set(f,h),g.controls.right.set(p,m)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(i){const r=this.width/2,o=this.height/2,s=this.vertices.length,a=new Zn(0,0,r,o,s);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<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="ellipse";for(let r=0;r<Zn.Properties.length;r++){const o=Zn.Properties[r];i[o]=this[o]}return i}};N(Zn,"Properties",["width","height"]);let xa=Zn;const hu={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}}},$1=Math.cos,E1=Math.sin,Qn=class Qn extends Ae{constructor(i,r,o,s){s=Math.max(s||0,3);super();N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_flagSides",!1);N(this,"_radius",0);N(this,"_width",0);N(this,"_height",0);N(this,"_sides",0);this._renderer.type="polygon";for(let a in mu)Object.defineProperty(this,a,mu[a]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.radius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Qn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Qn.Properties.length;r++){const o=Qn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const i=this._sides,r=i+1;let o=this.vertices.length;o>i&&(this.vertices.splice(i-1,o-i),o=i);for(let s=0;s<r;s++){const a=(s+.5)/i,l=Zt*a+Math.PI/2,c=this._width*$1(l)/2,d=this._height*E1(l)/2;s>=o?this.vertices.push(new Ie(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?fe.move:fe.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(i){const r=new Qn(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 o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);i.renderer.type="polygon";for(let r=0;r<Qn.Properties.length;r++){const o=Qn.Properties[r];i[o]=this[o]}return i}};N(Qn,"Properties",["width","height","sides"]);let ka=Qn;const mu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this.width=n*2,this.height=n*2}},width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}},Hi=class Hi extends Ae{constructor(i,r,o,s){const a=[new Ie,new Ie,new Ie,new Ie];super(a,!0,!1,!0);N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_width",0);N(this,"_height",0);N(this,"_origin",null);this._renderer.type="rectangle";for(let l in pu)Object.defineProperty(this,l,pu[l]);this.width=typeof o=="number"?o:1,this.height=typeof s=="number"?s:1,this.origin=new ge,typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(i){const r=new Hi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Hi.Properties.length;r++){const o=Hi.Properties[r];o in i&&(typeof i[o]=="number"?this[o]=i[o]:this[o]instanceof ge&&this[o].copy(i[o]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const i=this._width/2,r=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Ie),this.vertices[0].set(-i,-r).sub(this._origin).command=fe.move,this.vertices[1].set(i,-r).sub(this._origin).command=fe.line,this.vertices[2].set(i,r).sub(this._origin).command=fe.line,this.vertices[3].set(-i,r).sub(this._origin).command=fe.line,this.vertices[4]&&(this.vertices[4].set(-i,-r).sub(this._origin).command=fe.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(i){const r=new Hi(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 o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]instanceof ge?r[s].copy(this[s]):r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="rectangle",i.width=this.width,i.height=this.height,i.origin=this.origin.toObject(),i}};N(Hi,"Properties",["width","height","origin"]);let Mr=Hi;const pu={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(n){this._origin&&this._origin.unbind(te.Types.change,this._renderer.flagVertices),this._origin=n,this._origin.bind(te.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Jn=class Jn extends Ae{constructor(i,r,o,s,a){typeof a>"u"&&typeof o=="number"&&typeof s=="number"&&(a=Math.floor(Math.min(o,s)/12));const l=[];for(let c=0;c<10;c++)l.push(new Ie(0,0,0,0,0,0,c===0?fe.move:fe.curve));super(l);N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_flagRadius",!1);N(this,"_width",0);N(this,"_height",0);N(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in gu)Object.defineProperty(this,c,gu[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=R1.bind(this),typeof o=="number"&&(this.width=o),typeof s=="number"&&(this.height=s),(typeof a=="number"||a instanceof ge)&&(this.radius=a),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Jn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Jn.Properties.length;r++){const o=Jn.Properties[r];if(o in i){const s=i[o];/radius/i.test(o)?this[o]=typeof s=="number"||s instanceof ge?s:new ge().copy(s):typeof s=="number"&&(this[o]=s)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const i=this._width,r=this._height;let o,s;this._radius instanceof ge?(o=this._radius.x,s=this._radius.y):(o=this._radius,s=this._radius);let a,l=i/2,c=r/2;a=this.vertices[0],a.x=-(l-o),a.y=-c,a=this.vertices[1],a.x=l-o,a.y=-c,a.controls.left.clear(),a.controls.right.x=o,a.controls.right.y=0,a=this.vertices[2],a.x=l,a.y=-(c-s),a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[3],a.x=l,a.y=c-s,a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=s,a=this.vertices[4],a.x=l-o,a.y=c,a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[5],a.x=-(l-o),a.y=c,a.controls.left.clear(),a.controls.right.x=-o,a.controls.right.y=0,a=this.vertices[6],a.x=-l,a.y=c-s,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[7],a.x=-l,a.y=-(c-s),a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=-s,a=this.vertices[8],a.x=-(l-o),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(i){const r=this.width,o=this.height,s=this.radius,a=new Jn(0,0,r,o,s);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<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="rounded-rectangle";for(let r=0;r<Jn.Properties.length;r++){const o=Jn.Properties[r];i[o]=this[o]}return i.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),i}};N(Jn,"Properties",["width","height","radius"]);let Ca=Jn;const gu={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius instanceof ge&&this._radius.unbind(te.Types.change,this._renderer.flagRadius),this._radius=n,this._radius instanceof ge&&this._radius.bind(te.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function R1(){this._flagRadius=!0}const P1=Math.cos,F1=Math.sin,ei=class ei extends Ae{constructor(i,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();N(this,"_flagInnerRadius",!1);N(this,"_flagOuterRadius",!1);N(this,"_flagSides",!1);N(this,"_innerRadius",0);N(this,"_outerRadius",0);N(this,"_sides",0);this._renderer.type="star";for(let l in yu)Object.defineProperty(this,l,yu[l]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.sides=a),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new ei().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ei.Properties.length;r++){const o=ei.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const i=this._sides*2,r=i+1;let o=this.vertices.length;o>i&&(this.vertices.splice(i-1,o-i),o=i);for(let s=0;s<r;s++){const a=(s+.5)/i,l=Zt*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*P1(l),u=c*F1(l);s>=o?this.vertices.push(new Ie(d,u)):this.vertices[s].set(d,u),this.vertices[s].command=s===0?fe.move:fe.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(i){const r=this.innerRadius,o=this.outerRadius,s=this.sides,a=new ei(0,0,r,o,s);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<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="star";for(let r=0;r<ei.Properties.length;r++){const o=ei.Properties[r];i[o]=this[o]}return i}};N(ei,"Properties",["innerRadius","outerRadius","sides"]);let va=ei;const yu={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}};let Sa;const bu=Math.min,_u=Math.max;Tn.document&&(Sa=document.createElement("canvas"));const Rt=class Rt extends En{constructor(i,r,o,s){super();N(this,"_flagValue",!0);N(this,"_flagFamily",!0);N(this,"_flagSize",!0);N(this,"_flagLeading",!0);N(this,"_flagAlignment",!0);N(this,"_flagBaseline",!0);N(this,"_flagStyle",!0);N(this,"_flagWeight",!0);N(this,"_flagDecoration",!0);N(this,"_flagFill",!0);N(this,"_flagStroke",!0);N(this,"_flagLinewidth",!0);N(this,"_flagOpacity",!0);N(this,"_flagVisible",!0);N(this,"_flagMask",!1);N(this,"_flagClip",!1);N(this,"_flagDirection",!0);N(this,"_flagStrokeAttenuation",!0);N(this,"_value","");N(this,"_family","sans-serif");N(this,"_size",13);N(this,"_leading",17);N(this,"_alignment","center");N(this,"_baseline","middle");N(this,"_style","normal");N(this,"_weight",500);N(this,"_decoration","none");N(this,"_direction","ltr");N(this,"_fill","#000");N(this,"_stroke","none");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_mask",null);N(this,"_clip",!1);N(this,"_dashes",null);N(this,"_strokeAttenuation",!0);for(let a in wu)Object.defineProperty(this,a,wu[a]);if(this._renderer.type="text",this._renderer.flagFill=V1.bind(this),this._renderer.flagStroke=M1.bind(this),this.value=i,typeof r=="number"&&(this.translation.x=r),typeof o=="number"&&(this.translation.y=o),this.dashes=[],this.dashes.offset=0,!We.isObject(s))return this;for(let a=0;a<Rt.Properties.length;a++){const l=Rt.Properties[a];l in s&&(this[l]=s[l])}}static Measure(i){if(Sa){const r=Sa.getContext("2d");r.font=[i._style,i._weight,`${i._size}px/${i._leading}px`,i._family].join(" ");const o=r.measureText(i.value,0,0),s=o.actualBoundingBoxDescent+o.actualBoundingBoxAscent;return{width:o.width,height:s}}else{const r=this.value.length*this.size*Rt.Ratio,o=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:r,height:o}}}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ni(i.fill),o=typeof i.stroke=="string"?i.stroke:Ni(i.stroke),s=new Rt().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){super.copy.call(this,i);for(let r=0;r<Rt.Properties.length;r++){const o=Rt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Rt(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<Rt.Properties.length;o++){const s=Rt.Properties[o];r[s]=this[s]}return this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);i.renderer.type="text";for(let r=0;r<Rt.Properties.length;r++){const o=Rt.Properties[r];i[o]=this[o]}return i}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(i){let r,o,s,a,l;this._update(!0),r=i?this.matrix:this.worldMatrix;const{width:c,height:d}=Rt.Measure(this),u=(this._linewidth||0)/2;switch(this.alignment){case"left":o=-u,s=c+u;break;case"right":o=-(c+u),s=u;break;default:o=-(c/2+u),s=c/2+u}switch(this.baseline){case"middle":a=-(d/2+u),l=d/2+u;break;default:a=-(d+u),l=u}const[f,h]=r.multiply(o,a),[p,m]=r.multiply(o,l),[g,b]=r.multiply(s,a),[y,_]=r.multiply(s,l);return a=bu(h,m,b,_),o=bu(f,p,g,y),s=_u(f,p,g,y),l=_u(h,m,b,_),{top:a,left:o,right:s,bottom:l,width:s-o,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}};N(Rt,"Ratio",.6),N(Rt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let dr=Rt;const wu={value:{enumerable:!0,get:function(){return this._value},set:function(n){this._value=n,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(n){this._family=n,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(n){this._leading=n,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(n){this._alignment=n,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(n){this._style=n,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(n){this._weight=n,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(n){this._decoration=n,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(n){this._direction=n,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(n){this._baseline=n,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,We.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function V1(){this._flagFill=!0}function M1(){this._flagStroke=!0}const ti=class ti extends Mr{constructor(i,r,o,s){super(r,o,0,0);N(this,"_flagTextures",!1);N(this,"_flagFrameRate",!1);N(this,"_flagIndex",!1);N(this,"_amount",1);N(this,"_duration",0);N(this,"_index",0);N(this,"_startTime",0);N(this,"_playing",!1);N(this,"_firstFrame",0);N(this,"_lastFrame",0);N(this,"_loop",!0);N(this,"_textures",null);N(this,"_frameRate",0);N(this,"_origin",null);this._renderer.type="image-sequence";for(let a in xu)Object.defineProperty(this,a,xu[a]);this._renderer.flagTextures=I1.bind(this),this._renderer.bindTextures=A1.bind(this),this._renderer.unbindTextures=O1.bind(this),this.noStroke(),this.noFill(),Array.isArray(i)?this.textures=i.map(ku.bind(this)):typeof i=="string"&&(this.textures=[ku(i)]),this.origin=new ge,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=ti.DefaultFrameRate,this.index=0}static fromObject(i){const r=new ti().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ti.Properties.length;r++){const o=ti.Properties[r];o in i&&(this[o]=i[o])}return this}play(i,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=We.performance.now(),typeof i=="number"&&(this._firstFrame=i),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o: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(i){const r=new ti(this.textures,this.translation.x,this.translation.y,this.frameRate);return r._loop=this._loop,this._playing&&r.play(),i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="image-sequence",i.textures=this.textures.map(function(r){return r.toObject()}),i.frameRate=this.frameRate,i.index=this.index,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,i.loop=this.loop,i}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let i=0;i<this.textures.length;i++){const r=this.textures[i];typeof r.dispose=="function"?r.dispose():typeof r.unbind=="function"&&r.unbind()}return this}_update(){const i=this._textures;let r,o,s,a,l,c,d,u;return i&&(this._flagTextures&&(this._amount=i.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(a=this._amount,We.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=We.performance.now()-this._startTime,u=this._lastFrame+1,l=1e3*(u-this._firstFrame)/this._frameRate,this._loop?s=s%l:s=Math.min(s,l),d=jt(this._firstFrame,u,s/l),d=Math.floor(d),d!==this._index&&(this._index=d,c=i[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o),this.fill=c,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof Qe))&&(c=i[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o)),this.fill=c)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};N(ti,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),N(ti,"DefaultFrameRate",30);let Ba=ti;const xu={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(n){const e=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(te.Types.insert,e).unbind(te.Types.remove,i),this._textures=new Si((n||[]).slice(0)),this._textures.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}};function I1(){this._flagTextures=!0}function A1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function O1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function ku(n){if(n instanceof Qe)return n;if(typeof n=="string")return new Qe(n)}const Wi=class Wi extends Mr{constructor(i,r,o,s,a,l){super(r,o,0,0);N(this,"_flagTexture",!1);N(this,"_flagColumns",!1);N(this,"_flagRows",!1);N(this,"_flagFrameRate",!1);N(this,"_flagIndex",!1);N(this,"_amount",1);N(this,"_duration",0);N(this,"_startTime",0);N(this,"_playing",!1);N(this,"_firstFrame",0);N(this,"_lastFrame",0);N(this,"_loop",!0);N(this,"_texture",null);N(this,"_columns",1);N(this,"_rows",1);N(this,"_frameRate",0);N(this,"_index",0);N(this,"_origin",null);this._renderer.type="sprite";for(let c in Cu)Object.defineProperty(this,c,Cu[c]);this.noStroke(),this.noFill(),i instanceof Qe?this.texture=i:typeof i=="string"&&(this.texture=new Qe(i)),this.origin=new ge,this._update(),typeof s=="number"&&(this.columns=s),typeof a=="number"&&(this.rows=a),typeof l=="number"&&(this.frameRate=l),this.index=0}static fromObject(i){const r=new Wi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Wi.Properties.length;r++){const o=Wi.Properties[r];o in i&&(this[o]=i[o])}return this}play(i,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=We.performance.now(),typeof i=="number"&&(this._firstFrame=i),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o: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(i){const r=new Wi(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&r.play(this._firstFrame,this._lastFrame),r.loop=this.loop,r.firstFrame=this.firstFrame,r.lastFrame=this.lastFrame,i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="sprite",i.texture=this.texture.toObject(),i.columns=this.columns,i.rows=this.rows,i.frameRate=this.frameRate,i.index=this.index,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,i.loop=this.loop,i}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const i=this._texture,r=this._columns,o=this._rows;let s,a,l,c,d,u,f,h,p;if(i&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=i),i.loaded)){f=i.image.width,h=i.image.height,s=f/r,a=h/o,c=this._amount,this.width!==s&&(this.width=s),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&(We.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=We.performance.now()-this._startTime,p=this._lastFrame+1,d=1e3*(p-this._firstFrame)/this._frameRate,this._loop?l=l%d:l=Math.min(l,d),u=jt(this._firstFrame,p,l/d),u=Math.floor(u),u!==this._index&&(this._index=u,u>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const m=this._index%r,g=Math.floor(this._index/r),b=-s*m+(f-s)/2,y=-a*g+(h-a)/2;b!==i.offset.x&&(i.offset.x=b),y!==i.offset.y&&(i.offset.y=y)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};N(Wi,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let Na=Wi;const Cu={texture:{enumerable:!0,get:function(){return this._texture},set:function(n){this._texture=n,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(n){this._columns=n,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(n){this._rows=n,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}},qo=Math.min,Xo=Math.max,z1={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},zt=class zt extends En{constructor(i){super();N(this,"_flagAdditions",!1);N(this,"_flagSubtractions",!1);N(this,"_flagOrder",!1);N(this,"_flagOpacity",!0);N(this,"_flagBeginning",!1);N(this,"_flagEnding",!1);N(this,"_flagLength",!1);N(this,"_flagMask",!1);N(this,"_fill","#fff");N(this,"_stroke","#000");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_cap","round");N(this,"_join","round");N(this,"_miter",4);N(this,"_closed",!0);N(this,"_curved",!1);N(this,"_automatic",!0);N(this,"_beginning",0);N(this,"_ending",1);N(this,"_length",0);N(this,"_mask",null);N(this,"_strokeAttenuation",!0);for(let r in vu)Object.defineProperty(this,r,vu[r]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(i)?i:Array.prototype.slice.call(arguments)}static InsertChildren(i){for(let r=0;r<i.length;r++)Su.call(this,i[r],this)}static RemoveChildren(i){for(let r=0;r<i.length;r++)Su.call(this,i[r])}static OrderChildren(i){this._flagOrder=!0}static fromObject(i){const r=new zt;for(let s=0;s<zt.Properties.length;s++){const a=zt.Properties[s];a in i&&(/(fill|stroke)/i.test(a)?r[a]=typeof i[a]=="string"?i[a]:Ni(i[a]):r[a]=i[a])}return"mask"in i&&(r.mask=o(i.mask)),"id"in i&&(r.id=i.id),r.children=i.children.map(o),r;function o(s){if(s&&s.renderer)switch(s.renderer.type){case"arc-segment":return pa.fromObject(s);case"circle":return ba.fromObject(s);case"element":return Vr.fromObject(s);case"ellipse":return xa.fromObject(s);case"group":return zt.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Ba.fromObject(s);case"path":return Ae.fromObject(s);case"points":return jo.fromObject(s);case"polygon":return ka.fromObject(s);case"rectangle":return Mr.fromObject(s);case"rounded-rectangle":return Ca.fromObject(s);case"shape":return En.fromObject(s);case"sprite":return Na.fromObject(s);case"star":return va.fromObject(s);case"text":return dr.fromObject(s)}return s}}static IsVisible(i,r){if(!r)return!0;let o=i;for(;o;){if(typeof o.visible=="boolean"&&!o.visible||typeof o.opacity=="number"&&o.opacity<=0)return!1;o=o.parent}return!0}static VisitForHitTest(i,r,o,s,a,l,c){const d=i&&i.children;if(!d)return!1;const u=r.results;for(let f=d.length-1;f>=0;f--){const h=d[f];if(!h||!zt.IsVisible(h,r.visibleOnly))continue;const p=typeof h.getBoundingClientRect=="function"?h.getBoundingClientRect():null;if(!(p&&!p1(p,r.x,r.y,l))){if(h instanceof zt){if(o&&(!s||s(h))&&typeof h.contains=="function"&&h.contains(r.x,r.y,a)&&(u.push(h),c)||zt.VisitForHitTest(h,r,o,s,a,l,c))return!0;continue}if(h instanceof En&&!(s&&!s(h))&&typeof h.contains=="function"&&h.contains(r.x,r.y,a)&&(u.push(h),c))return!0}}return!1}copy(i){super.copy.call(this,i),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let r=0;r<zt.Properties.length;r++){const o=zt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new zt,o=this.children.map(function(s){return s.clone()});return r.add(o),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),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="group",i.children=[],i.opacity=this.opacity,i.className=this.className,i.mask=this.mask?this.mask.toObject():null,We.each(this.children,(r,o)=>{i.children[o]=r.toObject()},this),i}dispose(){if(super.dispose(),this.children)for(let i=0;i<this.children.length;i++){const r=this.children[i];typeof r.dispose=="function"&&r.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}getShapesAtPoint(i,r,o){const s=o||{},{results:a,hitOptions:l,context:c,single:d,empty:u}=z1.getShapesAtPoint;a.length=0;const f=s.mode==="deepest"||s.deepest?"deepest":"all",h=s.visibleOnly!==!1,p=!!s.includeGroups,m=typeof s.filter=="function"?s.filter:null,g=typeof s.tolerance=="number"?s.tolerance:0;typeof s.precision=="number"?l.precision=s.precision:delete l.precision,typeof s.fill<"u"?l.fill=s.fill:delete l.fill,typeof s.stroke<"u"?l.stroke=s.stroke:delete l.stroke,l.tolerance=g,l.ignoreVisibility=!h;const b=f==="deepest";if(c.x=i,c.y=r,c.visibleOnly=h,c.results=a,zt.VisitForHitTest(this,c,p,m,l,g,b),b){if(a.length>0){const _=a[0];return a.length=0,d[0]=_,d.length=1,d}return u.length=0,u}const y=a.slice();return a.length=0,y}corner(){const i=this.getBoundingClientRect(!0);for(let r=0;r<this.children.length;r++){const o=this.children[r];o.translation.x-=i.left,o.translation.y-=i.top}return this.mask&&(this.mask.translation.x-=i.left,this.mask.translation.y-=i.top),this}center(){const i=this.getBoundingClientRect(!0),r=i.left+i.width/2-this.translation.x,o=i.top+i.height/2-this.translation.y;for(let s=0;s<this.children.length;s++){const a=this.children[s];a.isShape&&(a.translation.x-=r,a.translation.y-=o)}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getById(i){let r=null;function o(s){if(s.id===i)return s;if(s.children){if(s.children.ids[i])return s.children.ids[i];for(let a=0;a<s.children.length;a++)if(r=o(s.children[a]),r)return r}return null}return o(this)}getByClassName(i){const r=[];function o(s){if(Array.prototype.indexOf.call(s.classList,i)>=0&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}getByType(i){const r=[];function o(s){if(s instanceof i&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}add(i){i instanceof Array?i=i.slice():i=Array.prototype.slice.call(arguments);for(let r=0;r<i.length;r++){const o=i[r];if(!(o&&o.id))continue;const s=Array.prototype.indexOf.call(this.children,o);s>=0&&this.children.splice(s,1),this.children.push(o)}return this}remove(i){const r=arguments.length,o=this.parent;if(r<=0&&o)return o.remove(this),this;i instanceof Array?i=i.slice():i=Array.prototype.slice.call(arguments);for(let s=0;s<i.length;s++){const a=i[s];if(!a||!this.children.ids[a.id])continue;const l=this.children.indexOf(a);l>=0&&this.children.splice(l,1)}return this}getBoundingClientRect(i){let r,o,s,a,l,c;this._update(!0);let d=1/0,u=-1/0,f=1/0,h=-1/0;const p=/texture|gradient/i;o=i?this.matrix:this.worldMatrix;for(let m=0;m<this.children.length;m++){const g=this.children[m];if(!(!g.visible||p.test(g._renderer.type))&&(r=g.getBoundingClientRect(i),s=typeof r.top!="number"||We.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||We.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||We.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||We.isNaN(r.bottom)||!isFinite(r.bottom),!(s||a||l||c)))if(i){const[b,y]=o.multiply(r.left,r.top),[_,k]=o.multiply(r.right,r.top),[x,v]=o.multiply(r.left,r.bottom),[B,w]=o.multiply(r.right,r.bottom);f=qo(y,k,v,w,f),d=qo(b,_,x,B,d),u=Xo(b,_,x,B,u),h=Xo(y,k,v,w,h)}else f=qo(r.top,f),d=qo(r.left,d),u=Xo(r.right,u),h=Xo(r.bottom,h)}return{top:f,left:d,right:u,bottom:h,width:u-d,height:h-f}}noFill(){return this.children.forEach(function(i){i.noFill()}),this}noStroke(){return this.children.forEach(function(i){i.noStroke()}),this}subdivide(){const i=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,i)}),this}_update(){let i,r,o;if(this._flagBeginning||this._flagEnding){const s=Math.min(this._beginning,this._ending),a=Math.max(this._beginning,this._ending),l=this.length;let c=0;const d=s*l,u=a*l;for(i=0;i<this.children.length;i++)o=this.children[i],r=o.length,d>c+r?(o.beginning=1,o.ending=1):u<c?(o.beginning=0,o.ending=0):d>c&&d<c+r?(o.beginning=(d-c)/r,o.ending=1):u>c&&u<c+r?(o.beginning=0,o.ending=(u-c)/r):(o.beginning=0,o.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}};N(zt,"Children",du),N(zt,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let qn=zt;const vu={visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._flagVisible=this._visible!==n||this._flagVisible,this._visible=n}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._flagOpacity=this._opacity!==n||this._flagOpacity,this._opacity=n}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._flagBeginning=this._beginning!==n||this._flagBeginning,this._beginning=n}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._flagEnding=this._ending!==n||this._flagEnding,this._ending=n}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let n=0;n<this.children.length;n++){const e=this.children[n];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){this._fill=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.fill=n}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){this._stroke=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.stroke=n}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.linewidth=n}}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.join=n}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.miter=n}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.cap=n}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.closed=n}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.curved=n}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){this._automatic=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.automatic=n}}},children:{enumerable:!0,get:function(){return this._children},set:function(n){const e=qn.InsertChildren.bind(this),i=qn.RemoveChildren.bind(this),r=qn.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&i(this._children)),this._children=new du(n),this._children.bind(te.Types.insert,e),this._children.bind(te.Types.remove,i),this._children.bind(te.Types.order,r),n.length>0&&e(n)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,We.isObject(n)&&!n.clip&&(n.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.strokeAttenuation!==void 0&&(i.strokeAttenuation=n)}}}};function Su(n,e){const i=n.parent;let r;if(i===e){o();return}if(i&&i.children.ids[n.id]&&(r=Array.prototype.indexOf.call(i.children,n),i.children.splice(r,1),s()),e){o();return}s(),i._flagAdditions&&i.additions.length===0&&(i._flagAdditions=!1),i._flagSubtractions&&i.subtractions.length===0&&(i._flagSubtractions=!1),delete n.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,n),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,n),r>=0&&e.additions.splice(r,1)),n.parent=e,e.additions.push(n),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(i.additions,n),r>=0&&i.additions.splice(r,1),r=Array.prototype.indexOf.call(i.subtractions,n),r<0&&(i.subtractions.push(n),i._flagSubtractions=!0)}}class Yo extends Ae{constructor(e,i,r,o){const s=[new Ie(e,i),new Ie(r,o)];super(s);for(let a in Bu)Object.defineProperty(this,a,Bu[a]);this.vertices[0].command=fe.move,this.vertices[1].command=fe.line,this.automatic=!1}}N(Yo,"Properties",["left","right"]);const Bu={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(n){if(We.isObject(n))this.vertices.splice(0,1,n),this.vertices[0].command=fe.move;else{const e=new Io("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(n){if(We.isObject(n))this.vertices.splice(1,1,n),this.vertices[1].command=fe.line;else{const e=new Io("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class Ta{constructor(e=0,i=0){this.x=e,this.y=i}}class Rn{constructor(e=10,i=0,r="A"){N(this,"start",new Ta);N(this,"end",new Ta);this.width=e,this.angle=i,this.label=r}}const Ye={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"}},D1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function L1(n,e){return t.openBlock(),t.createElementBlock("svg",D1,[...e[0]||(e[0]=[t.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 Uo=t.markRaw({name:"ion-close",render:L1}),H1={class:"mr-3 flex flex-col gap-2"},W1=["onClick"],j1={class:"h-full p-2"},q1={},X1=t.defineComponent({...q1,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(n,{emit:e}){const i=n,r=t.ref(!1),o=t.useTemplateRef("drawing-template-containers"),s=t.useTemplateRef("drawing-custom-template-containers"),a=e,l=c=>{r.value=!0,a("remove-custom-template",c,()=>{r.value=!1})};return t.onMounted(()=>{var c,d;(c=i.settings.templates)==null||c.forEach((u,f)=>{var p;const h=(p=o.value)==null?void 0:p.at(f);h&&a("init-draw-template",h,u)}),(d=i.settings.customTemplates)==null||d.forEach((u,f)=>{var p;const h=(p=s.value)==null?void 0:p.at(f);h&&a("init-draw-template",h,u)})}),t.watch(()=>[...i.settings.customTemplates],(c,d)=>{t.nextTick(()=>{c.forEach((u,f)=>{var h;if(!(d!=null&&d.includes(u))){const p=(h=s.value)==null?void 0:h.at(f);p&&a("init-draw-template",p,u)}}),d.length>c.length&&d.forEach((u,f)=>{var p;const h=(p=s.value)==null?void 0:p.at(f);h&&(h.innerHTML="",a("init-draw-template",h,u))})})},{deep:!0}),(c,d)=>{const u=Uo;return t.openBlock(),t.createBlock(t.unref(F.NScrollbar),{style:{width:"auto"},trigger:"none",class:"max-h-[19rem] md:max-h-[40rem] w-auto"},{default:t.withCtx(()=>[t.createElementVNode("div",H1,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.settings.allTemplates,(f,h)=>(t.openBlock(),t.createElementBlock("div",{key:`${f.id}-${h}`,class:"group relative"},[t.createVNode(t.unref(F.NPopover),{trigger:"hover",placement:"right"},{trigger:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["relative h-10 w-24 shrink-0 rounded-md border-2 border-solid border-slate-200",{"!border-green-700":h===n.selectTemplateIndex}]),onClick:p=>a("template:select",h)},[t.createElementVNode("div",j1,[t.createElementVNode("div",{ref_for:!0,ref:f.isCustom&&f.id!==-1?"drawing-custom-template-containers":"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,W1)]),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f.label),1)]),_:2},1024),f.isCustom&&!f.isNewRec()?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,size:"tiny",quaternary:"",loading:r.value,disabled:r.value,circle:"",class:"!absolute right-0.5 top-0.5 !hidden group-hover:!flex",onClick:p=>l(h)},{default:t.withCtx(()=>[t.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):t.createCommentVNode("",!0)]))),128))])]),_:1})}}}),Nu=fn(X1,[["__scopeId","data-v-afccb364"]]),Y1={class:"flex gap-3 min-w-[20rem] relative"},U1={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},K1={ref:"drawing-container",class:"size-full"},G1={},Tu=t.defineComponent({...G1,__name:"kozyrek-configurator-preview",props:{settings:{},value:{},selectTemplateIndex:{}},emits:["pointer:move","pointer:up","template:select","remove-custom-template"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("drawing-container");let s=[],a=[],l=[],c=null;const d=.75,u=t.computed(()=>i.value.configuratorParams.linesAngles.map((W,D)=>new Rn(i.value.configuratorParams.linesWidths[D],W,`A-${D+1}`))),f=t.computed(()=>i.value.configuratorParams.colorSide==="bottom"),h=t.computed(()=>{var W,D;return i.value.configuratorParams.startTailType&&((W=i.settings.startTailConfigs)!=null&&W[i.value.configuratorParams.startTailType])?(D=i.settings.startTailConfigs)==null?void 0:D[i.value.configuratorParams.startTailType].points:[]}),p=t.computed(()=>{var D;const W=i.value.configuratorParams.endTailType!==void 0&&((D=i.settings.endTailConfigs)==null?void 0:D[i.value.configuratorParams.endTailType]);return!W||!W.points?[]:W.points.map((L,z)=>Array.isArray(L)?new Rn(L[0],L[1],`A-${z+1}`):new Rn(L.width,L.angle,`A-${z+1}`))}),m=(W,D=!1)=>{W[0].start.x=0,W[0].start.y=0;let L=0;for(let z=0;z<W.length;z++){const P=W[z],q=W[z-1]??new Rn(0,L);L+=!D||z>1?q.angle:0;const K=(!D||z>0?P.angle:0)+L;if(W[z].end.x=P.width*Math.cos(K*Math.PI/180)+W[z].start.x,W[z].end.y=P.width*Math.sin(K*Math.PI/180)+W[z].start.y,z<W.length-1){const J=z+1;W[J].start.x=W[z].end.x,W[J].start.y=W[z].end.y}}return W},g=(W,D,L,z,P=!1)=>{let q=m([...L,...z]);D.length>0&&(q=[...m(D),...q]);let K=0,J=0,Y=0,V=0;q.forEach(pe=>{K=Math.min(K,pe.start.x,pe.end.x),J=Math.min(J,pe.start.y,pe.end.y),Y=Math.max(Y,pe.start.x,pe.end.x),V=Math.max(V,pe.start.y,pe.end.y)});let A,ie;K===0&&J===0&&Y===0&&V===0?(A=1,ie=1):(A=W.width/Math.abs(Y-K),ie=(P?W.height:W.height-Ye.colorSideLabel.size)/Math.abs(V-J));const ce=Math.min(A,ie);return K=K<0?-K*ce:0,J=J<0?-J*ce:0,[ce,K,J]},b=W=>{const D=new jo([W]);return D._size=Ye.anchorPoint.size,D.fill=Ye.anchorPoint.color,D.stroke="transparent",D._linewidth=Ye.anchorPoint.strokeSize,l.push(D),D},y=(W,D)=>{if(l=[],i.settings.allowChangeFirstPoint){const L=W[0],z=new ge(L.vertices[0].x,L.vertices[0].y);z.bind(te.Types.change,()=>{L.vertices[0].copy(z)});const P=b(z);D.add(P)}W.forEach((L,z)=>{const P=W[z+1],q=new ge(L.vertices[1].x,L.vertices[1].y);q.bind(te.Types.change,()=>{L.vertices[1].copy(q),P!==void 0&&P.vertices[0].copy(q)});const K=b(q);D.add(K)})},_=W=>W*(Math.PI/180),k=(W,D,L)=>{const z=D.vertices.length-1;W.position.x=D.vertices[z].x,W.position.y=D.vertices[z].y;const P=Math.atan2(D.vertices[z].y-D.vertices[0].y,D.vertices[z].x-D.vertices[0].x);W.rotation=_(L)+P},x=(W,D,L)=>{if(D.vertices[0]===void 0)return;W.position.x=D.vertices[0].x,W.position.y=D.vertices[0].y;const z=D.vertices.length-1,P=Math.atan2(D.vertices[z].y-D.vertices[0].y,D.vertices[z].x-D.vertices[0].x);W.rotation=_(L)+P},v=(W,D,L)=>{const z=new qn;if(W.length===0)return z;const P=[];return[...W].reverse().forEach((q,K)=>{K!==0&&q.angle>0&&(q.angle*=-1),P.push(q)}),W=m(P,!0),x(z,D,W[0].angle),[D.vertices[0],D.vertices[1]].forEach(q=>{q.bind(te.Types.change,()=>{x(z,D,W[0].angle)})}),W.forEach(q=>{const K=q.start.x*L,J=q.end.x*L,Y=q.start.y*L,V=q.end.y*L,A=new Yo(K,Y,J,V);A.linewidth=Ye.line.size,A.stroke=Ye.line.color,z.add(A)}),z},B=(W,D,L)=>{const z=new qn;return W.length===0||(W=m(W,!0),k(z,D,W[0].angle),[D.vertices[0],D.vertices[1]].forEach(P=>{P.bind(te.Types.change,()=>{k(z,D,W[0].angle)})}),W.forEach(P=>{const q=P.start.x*L,K=P.end.x*L,J=P.start.y*L,Y=P.end.y*L,V=new Yo(q,J,K,Y);V.linewidth=Ye.line.size,V.stroke=Ye.line.color,z.add(V)})),z},w=(W,D,L,z)=>{const P=D.vertices[0].x+(D.vertices[1].x-D.vertices[0].x)/2-8*Math.sin(W.angle*Math.PI/180),q=D.vertices[0].y+(D.vertices[1].y-D.vertices[0].y)/2-8*Math.cos(W.angle*Math.PI/180),K=new dr(W.label,P+10,q-10);let J;K.size=Ye.lineLabel.size,K.weight=600,K.fill=Ye.lineLabel.color,K.id+=1,K.rotation=Ye.lineLabel.rotation,z>0&&(J=new dr(`${W.angle}°`,D.vertices[0].x+25,D.vertices[0].y-25),J.size=Ye.angleLabel.size,J.weight=600,J.fill=Ye.angleLabel.color,J.rotation=Ye.angleLabel.rotation,J.id+=z,s.push(J),L.add(J)),L.add(K),C(K,D,0,J),C(K,D,1)},T=()=>{const{size:W}=Ye.colorSideLabel,D=0,L=0,z=f.value?W/2:W/2-W,P=f.value?W/2-W:W/2,q=new qn;if(!c)return q;const K=5,J=Math.atan2(P-z,L-D),Y=[new Ie(D,z,0,0,0,0,Nn.Commands.move),new Ie(L,P,0,0,0,0,Nn.Commands.line),new Ie(L-K*Math.cos(J-Math.PI/4),P-K*Math.sin(J-Math.PI/4),0,0,0,0,Nn.Commands.line),new Ie(L,P,0,0,0,0,Nn.Commands.move),new Ie(L-K*Math.cos(J+Math.PI/4),P-K*Math.sin(J+Math.PI/4),0,0,0,0,Nn.Commands.line)],V=new Ae(Y,!1,!1,!0);V.noFill(),V.cap="round",V.join="round",V.linewidth=W/7,V.stroke=Ye.colorSideLabel.color,q.add(V);const A=new dr(f.value?"Цвет снизу":"Цвет сверху",10,0);A.size=W,A.weight=600,A.fill=Ye.colorSideLabel.color,A.alignment="left",q.add(A);const ie=q.getBoundingClientRect();return q.position.x=(c.width-ie.width)*d+10,q.position.y=f.value?c.height+ie.height*2:ie.height/2,q},C=(W,D,L,z)=>{D.vertices[L].bind(te.Types.change,()=>{const P=D.vertices.length-1,q=Math.atan2(D.vertices[0].y-D.vertices[P].y,D.vertices[0].x-D.vertices[P].x)*180/Math.PI,K=D.vertices[0].x+(D.vertices[P].x-D.vertices[0].x)/2-8*Math.sin(q*Math.PI/180),J=D.vertices[0].y+(D.vertices[P].y-D.vertices[0].y)/2-8*Math.cos(q*Math.PI/180);W.position.x=K+10,W.position.y=J-10,W.rotation=-.5,z&&(z.position.x=D.vertices[0].x+25,z.position.y=D.vertices[0].y-25)})},$=(W,D,L,z,P=!1)=>{var at;if(W.clear(),L.length===0){W.update();return}const q=m(L),[K,J,Y]=g(W,D,q,z,P),V=new qn,A=new Array,ie=new Array;P||(s=[],a=[]),q.forEach((we,ke)=>{const kt=we.start.x*K+J,Ne=we.end.x*K+J,Jt=we.start.y*K+Y,wn=we.end.y*K+Y,Pt=new Yo(kt,Jt,Ne,wn);Pt.linewidth=P?Ye.previewLine.size:Ye.line.size,Pt.stroke=P?Ye.previewLine.color:Ye.line.color,a.push(Pt),A.push(Pt),V.add(Pt),!P&&we.label!==""&&w(we,Pt,V,ke)});const ce=A.at(-1);let pe=V.getBoundingClientRect();if(!P){const we=T();ie.push(we)}if(D.length>0){const we=v(D,A[0],K);V.add(we)}if(z.length>0&&ce){const we=B(z,ce,K);V.add(we)}if(ie.push(V),W.makeGroup(ie),pe=V.getBoundingClientRect(),V.position.x=0-pe.left+(W.width-pe.width)/(2*(P?1:d)),V.position.y=0-pe.top+(W.height-pe.height)/(2*(P?1:d)),W.update(),!P){const we=((at=i.value.configuratorParams)==null?void 0:at.colorSide)==="top";V.position.y=V.position.y+Ye.colorSideLabel.size*Number(we),y(A,V),W.update()}},E=(W,D)=>{if(W&&!D.isNewRec()){const L=new Nn({width:W.scrollWidth,height:W.scrollHeight});L.appendTo(W),$(L,[],D.points,[],!0)}},I=()=>{c&&$(c,h.value,u.value,p.value,!1)},R=W=>W*(180/Math.PI),O=(W,D)=>{const L=W[1].x-W[0].x,z=W[1].y-W[0].y,P=D[1].x-D[0].x,q=D[1].y-D[0].y;let K=Math.atan2(L*q-z*P,L*P+z*q);return K=R(K),Math.round(K)*-1},U=W=>{const D=a.map((L,z,P)=>{const q=P[z-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let K=Math.ceil(L._length/W/i.settings.lineWidthStep)*i.settings.lineWidthStep;const J=s[z-1];K<(P.length>1?i.settings.minLineWidth:i.settings.stripMinWidth)&&(K=P.length>1?i.settings.minLineWidth:i.settings.stripMinWidth),K>i.settings.maxLineWidth&&(K=i.settings.maxLineWidth);const Y=O(L.vertices,q.vertices);return J&&(J.value=`${Y}°`),new Rn(K,Y,`A-${z+1}`)});r("pointer:move",D)},Q=W=>{let D=null,L;const z=J=>{D=l.find(Y=>{const V=Y.renderer;return(V==null?void 0:V.elem)===J.target}),[L]=g(W,h.value,u.value.map(Y=>Y),p.value)},P=J=>{if(D){const Y=D.renderer,V=Y==null?void 0:Y.elem;if(!V)return;const A=V.getBoundingClientRect();D.vertices[0].x-=A.x-(J instanceof MouseEvent?J.clientX:J.targetTouches[0].clientX)+Ye.anchorPoint.size/2,D.vertices[0].y-=A.y-(J instanceof MouseEvent?J.clientY:J.targetTouches[0].clientY)+Ye.anchorPoint.size/2,U(L),W.update()}},q=()=>{D&&r("pointer:up",u.value),D=null},K=o.value;K&&(K.addEventListener("touchstart",z,{passive:!0}),K.addEventListener("touchend",q,{passive:!0}),K.addEventListener("mousedown",z),K.addEventListener("mouseup",q),K.addEventListener("mousemove",P),K.addEventListener("touchmove",P,{passive:!0}))},G=(W,D)=>{r("remove-custom-template",W,D)};return t.onMounted(()=>{o.value&&(c=new Nn({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),t.watch(()=>i.value,()=>{I()},{deep:!0,immediate:!0}),Q(c))}),t.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(W,D)=>(t.openBlock(),t.createElementBlock("div",Y1,[t.createVNode(Nu,{"select-template-index":n.selectTemplateIndex,settings:n.settings,"onTemplate:select":D[0]||(D[0]=L=>r("template:select",L)),onInitDrawTemplate:E,onRemoveCustomTemplate:G},null,8,["select-template-index","settings"]),t.createElementVNode("div",U1,[t.createElementVNode("div",K1,null,512)])]))}});class ur extends j.Identity{constructor(i,r){super();N(this,"label","");N(this,"points",[]);N(this,"isCustom",!1);N(this,"id",-1);N(this,"guid","");i?(this.label=i.label,this.points=i.points.map((o,s)=>M.isArray(o)?new Rn(o[0],o[1],`A-${s+1}`):new Rn(o.width,o.angle,`A-${s+1}`)),this.isCustom=i.isCustom):(this.label="-- Новая конфигурация --",this.points=[new Rn(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class $a extends ur{constructor(i){super(i);N(this,"isDefault");this.isDefault=i.isDefault??!1}}class $u{constructor(e){N(this,"minLineWidth");N(this,"maxLineWidth");N(this,"lineWidthStep");N(this,"minLineAngle");N(this,"maxLineAngle");N(this,"lineAngleStep");N(this,"stripMinWidth");N(this,"stripMaxWidth");N(this,"stripMinLength");N(this,"stripMaxLength");N(this,"allowShowTable");N(this,"showOnlyTemplates");N(this,"templates");N(this,"customTemplates",[]);N(this,"startTailConfigs");N(this,"endTailConfigs");N(this,"bendCountForExtended");N(this,"extendedProductCatalog");N(this,"allowChangeFirstPoint");N(this,"allowSaveTemplates");N(this,"userTemplatesPrefix");N(this,"lengthStep");N(this,"canSetDopProdaga");var i,r;this.minLineWidth=e.minLineWidth,this.maxLineWidth=e.maxLineWidth,this.lineWidthStep=e.lineWidthStep,this.minLineAngle=e.minLineAngle,this.maxLineAngle=e.maxLineAngle,this.lineAngleStep=e.lineAngleStep,this.stripMinWidth=e.stripMinWidth,this.stripMaxWidth=e.stripMaxWidth,this.stripMinLength=e.stripMinLength,this.stripMaxLength=e.stripMaxLength,this.allowShowTable=e.allowShowTable,this.showOnlyTemplates=e.showOnlyTemplates,this.templates=e.templates.map(o=>new ur(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((i=e.startTailConfigs)==null?void 0:i.map(o=>new $a(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new $a(o)))??[],this.bendCountForExtended=e.bendCountForExtended,this.extendedProductCatalog=e.extendedProductCatalog,this.allowChangeFirstPoint=e.allowChangeFirstPoint,this.allowSaveTemplates=e.allowSaveTemplates,this.userTemplatesPrefix=e.userTemplatesPrefix,this.lengthStep=e.lengthStep,this.canSetDopProdaga=e.canSetDopProdaga,this.showOnlyTemplates||(this.customTemplates=e.customTemplates?Object.entries(e.customTemplates).filter(([,o])=>o.id!==-1).map(([o,s])=>{const a=new ur(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new ur({label:"-- Новая конфигурация --",points:[new Rn(this.stripMinWidth,0,"A-1")],isCustom:!0,id:-1,guid:""})))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(e){if(!this.allowSaveTemplates)return;const i=this.customTemplates.findLast(o=>!o.isNewRec()),r=new ur(e);r.isCustom=!0,r.id=i?i.id+1:0,this.customTemplates.splice(-1,0,r)}removeCustomTemplate(e){if(!this.allowSaveTemplates)return;const i=this.customTemplates.findIndex(r=>r.id===e);i!==-1&&this.customTemplates.splice(i,1)}}const Z1={class:"flex flex-col gap-3"},Q1={class:"grid gap-5 md:grid-cols-5"},J1={},Eu=t.defineComponent({...J1,__name:"kozyrek-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.ref(!1),a=t.ref(!1),l=t.ref(i.cartItem),c=t.ref(new $u(i.settings)),d=t.ref({linesWidths:[...i.cartItem.configuratorParams.linesWidths],linesAngles:[...i.cartItem.configuratorParams.linesAngles]}),u=t.ref({quantity:{},marker:{},length:{}}),f=t.ref(0),h=t.useTemplateRef("kozyrek-configurator-params-form"),p=(C=0)=>{var E;const $=(E=c.value.allTemplates)==null?void 0:E.at(C);$!==void 0&&(f.value=C,l.value.configuratorParams.linesWidths=$.points.map(I=>M.isArray(I)?I[0]:I.width),l.value.configuratorParams.linesAngles=$.points.map(I=>M.isArray(I)?I[1]:I.angle),k()),y(l.value.configuratorParams)},m=async()=>{const C=prompt("Введите название шаблона:");if(!C)return;a.value=!0;const $={label:C,points:l.value.configuratorParams.linesWidths.map((I,R)=>[I,l.value.configuratorParams.linesAngles[R]])},E=I=>{I&&(c.value.addCustomTemplate($),f.value=c.value.allTemplates.length-2),a.value=!1};i.eventEmitter.emit("configurator:create-template",{category:i.cartItem.category,template:$,callback:E})},g=async(C,$)=>{var R;const E=(R=c.value.allTemplates)==null?void 0:R.at(C);if(!E||!E.isCustom)return;const I=O=>{O&&(c.value.removeCustomTemplate(E.id),p()),$==null||$()};i.eventEmitter.emit("configurator:remove-template",{category:i.cartItem.category,templateId:E.id,callback:I})},b=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(f.value=c.value.allTemplates.length-1)},y=async C=>{var $,E;l.value.product=new j.ClientProduct,(E=($=h.value)==null?void 0:$.formReference)==null||E.validate(I=>{I||(k(),o.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:C,validationFieldResultData:u.value,callback:R=>{R?l.value.product=R:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(M.noop)},_=async()=>{var C,$;($=(C=h.value)==null?void 0:C.formReference)==null||$.validate(E=>{var I,R;if(!E){s.value=!0;const O=new j.OrderItemBase(l.value);(I=c.value.startTailConfigs)!=null&&I.length||delete O.configuratorParams.startTailType,(R=c.value.endTailConfigs)!=null&&R.length||delete O.configuratorParams.endTailType,r("submit",O,u.value,()=>{s.value=!1,t.nextTick(()=>{var U,Q;(Q=(U=h.value)==null?void 0:U.formReference)==null||Q.restoreValidation()})})}}).catch(M.noop)},k=()=>{const C={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach(($,E)=>{C[`lines_widths[${E+1}]`]={},C[`lines_angles[${E+1}]`]={}}),u.value=C},x=C=>{d.value.linesWidths=C.map($=>$.width),d.value.linesAngles=C.map($=>$.angle)},v=C=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,k(),b(),y(l.value.configuratorParams)},B=(C,$)=>{d.value.linesWidths=C,d.value.linesAngles=$},w=C=>{const $=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,E=0;l.value.configuratorParams.linesWidths.splice(C+1,0,$),l.value.configuratorParams.linesAngles.splice(C+1,0,E),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],k(),b(),y(l.value.configuratorParams)},T=C=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(C,1),l.value.configuratorParams.linesAngles.splice(C,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],k(),b(),y(l.value.configuratorParams))};return t.onMounted(()=>{i.cartItem.isNewRec()?p():(k(),f.value=-1,y(l.value.configuratorParams))}),t.watch(()=>i.cartItem,C=>{l.value=new j.OrderItemBase(C),C.isNewRec()?p():(k(),f.value=-1,y(l.value.configuratorParams))}),(C,$)=>{const E=F.NButton;return t.openBlock(),t.createElementBlock("div",Z1,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(E,{key:0,type:"tertiary",class:"self-end",onClick:$[0]||($[0]=I=>r("click:view-switch"))},{default:t.withCtx(()=>[...$[3]||($[3]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",Q1,[t.createVNode(Tu,{value:l.value,"select-template-index":f.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":v,"onPointer:move":x,"onTemplate:select":p,onRemoveCustomTemplate:g},null,8,["value","select-template-index","settings"]),t.createVNode(lc,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":$[1]||($[1]=I=>l.value=I),"preview-params":d.value,validation:u.value,settings:c.value,"is-submit-processing":s.value,"is-product-searching":o.value,"select-template-index":f.value,class:"col-span-2","onUpdate:params":$[2]||($[2]=I=>y(I)),"onUpdate:preview":B,onSubmit:_,"onClick:saveTemplate":m,"onClick:addLine":w,"onClick:removeLine":T},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),eb={class:"flex flex-col items-center justify-between rounded-xl"},tb={class:"img-preview relative flex justify-center"},nb={},ib=t.defineComponent({...nb,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(n,{emit:e}){const i=n,r=t.computed(()=>{const{height:s}=i.configuratorParams;return M.keys(i.settings.crossbarCount).reverse().find(a=>s>=i.settings.crossbarCount[Number(a)])}),o=e;return(s,a)=>{const l=F.NButton;return t.openBlock(),t.createElementBlock("div",eb,[t.createElementVNode("div",tb,[a[1]||(a[1]=t.createElementVNode("div",{class:"window"},null,-1)),t.createElementVNode("div",{class:t.normalizeClass(["net",`net-${n.configuratorParams.netType}`])},null,2),t.createElementVNode("div",{class:t.normalizeClass(["frame",`frame-${n.configuratorParams.color}`])},null,2),r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["frame-crossbar",`frame-crossbar-${r.value}-${n.configuratorParams.color}`])},null,2)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["mount",`mount-${n.configuratorParams.mountType}-${n.configuratorParams.color}`])},null,2),t.createElementVNode("div",{class:t.normalizeClass(["cut-preview",`cut-preview-${n.configuratorParams.mountType}-${n.configuratorParams.color}`])},null,2)]),t.createVNode(l,{type:"primary",class:"block justify-self-center",onClick:a[0]||(a[0]=c=>o("open-instructions"))},{default:t.withCtx(()=>[...a[2]||(a[2]=[t.createTextVNode(" Руководство по замеру ",-1)])]),_:1})])}}}),Ea=fn(ib,[["__scopeId","data-v-2a790a20"]]),rb={key:0,class:"flex items-baseline gap-1"},ob={key:0,class:"flex items-baseline gap-1"},sb={key:1},ab={class:"text-lg font-semibold"},lb={key:2,class:"text-red-500 text-sm mb-2"},cb={class:"flex gap-3"},db={},Ru=t.defineComponent({...db,__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(n,{expose:e,emit:i}){var w;const r=n,o=i,s=t.computed(()=>Xe.isPhoneDevice()),a=t.useTemplateRef("form-reference"),l=t.useTemplateRef("width-form-item-reference"),c=t.useTemplateRef("height-form-item-reference"),d=t.useTemplateRef("width-input-reference"),u=t.ref(M.cloneDeep(r.value)),f=t.computed(()=>r.settings.widthOverlaps[u.value.configuratorParams.mountType]??0),h=t.computed(()=>r.settings.heightOverlaps[u.value.configuratorParams.mountType]??0),p=t.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),m=t.computed(()=>r.settings.maxHeights[u.value.configuratorParams.netType]),g=t.computed(()=>u.value.configuratorParams.width?u.value.configuratorParams.width+f.value:0),b=t.computed(()=>u.value.configuratorParams.height?u.value.configuratorParams.height+h.value:0),y=t.ref(r.settings.canSetDopProdaga??!1),_=t.computed(()=>({"configuratorParams.width":[le.required,le.min(r.settings.minWidth-f.value),le.max(p.value-f.value),le.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[le.required,le.min(r.settings.minHeight-h.value),le.max(m.value-h.value),le.step(1),He.serverValidation(r.validation.height.feedback)],quantity:[le.required,le.min(1),le.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),k=t.computed(()=>{var R;const T=g.value,C=b.value,{quantity:$}=r.value,E=((R=r.value.product)==null?void 0:R.costRub)||0;if(!T||!C||!$||E===0)return null;const I=T*C/1e6;return(E*$*I).toLocaleString("ru-ru",{minimumFractionDigits:2})}),x=t.computed(()=>{const T=g.value,C=b.value,$=!!(T&&T>=r.settings.minWidth&&T<=r.settings.maxWidths[u.value.configuratorParams.netType]),E=!!(C&&C>=r.settings.minHeight&&C<=r.settings.maxHeights[u.value.configuratorParams.netType]),I=!!(r.value.quantity&&r.value.quantity>0);return $&&E&&I}),v=(T,C)=>{var I,R;const $=u.value.configuratorParams;T&&T in $&&($[T]=C);const E={...$,width:g.value??0,height:b.value??0};T==="width"&&((I=l.value)==null||I.validate().catch(M.noop)),T==="height"&&((R=c.value)==null||R.validate().catch(M.noop)),t.nextTick(()=>{var U,Q;!((U=l.value)!=null&&U.validationErrored)&&!((Q=c.value)!=null&&Q.validationErrored)&&E.height&&E.width&&o("update:params",E),B("configuratorParams",E)})},B=(T,C)=>{const $=new j.OrderItemBase(r.value);$[T]=C,T==="configuratorParams"&&($.product=new j.ClientProduct),o("update:value",$)};return t.watch(()=>r.value,T=>{const C=M.cloneDeep(t.toRaw(T)),$=C.configuratorParams.mountType,E=r.settings.widthOverlaps[$]??0,I=r.settings.heightOverlaps[$]??0;C.configuratorParams.width&&C.configuratorParams.width>0&&(C.configuratorParams.width-=E),C.configuratorParams.height&&C.configuratorParams.height>0&&(C.configuratorParams.height-=I),u.value=C},{deep:!0,immediate:!0}),t.onMounted(()=>{var T;(T=d.value)==null||T.select()}),e({validate:(w=a.value)==null?void 0:w.validate,formReference:a}),(T,C)=>{const $=F.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:u.value,rules:_.value,class:"flex flex-col gap-2 px-4 md:max-w-96 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:u.value.configuratorParams.netType,"onUpdate:value":[C[0]||(C[0]=E=>u.value.configuratorParams.netType=E),C[1]||(C[1]=E=>v("netType",E))],options:n.settings.netType.map(E=>({label:n.settings.descriptions.net_type[E],value:E}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:u.value.configuratorParams.color,"onUpdate:value":[C[2]||(C[2]=E=>u.value.configuratorParams.color=E),C[3]||(C[3]=E=>v("color",E))],options:n.settings.color.map(E=>({label:n.settings.descriptions.color[E],value:E}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:u.value.configuratorParams.mountType,"onUpdate:value":[C[4]||(C[4]=E=>u.value.configuratorParams.mountType=E),C[5]||(C[5]=E=>v("mountType",E))],options:n.settings.mountType.map(E=>({label:n.settings.descriptions.mount_type[E],value:E}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{ref:"width-form-item-reference",path:"configuratorParams.width",label:`Ширина светового проёма от ${n.settings.minWidth-f.value} ${p.value?" до "+(p.value-f.value):""} мм.`},{feedback:t.withCtx(()=>[!n.validation.width.showFeedback&&g.value>=n.settings.minWidth&&g.value<=n.settings.maxWidths[u.value.configuratorParams.netType]?(t.openBlock(),t.createElementBlock("div",rb,[t.createVNode(t.unref(F.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Ширина готового изделия "+t.toDisplayString(g.value),1)]),_:1}),t.createVNode(t.unref(F.NButton),{quaternary:"",type:"info",size:"tiny",onClick:C[10]||(C[10]=E=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...C[25]||(C[25]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref:"width-input-reference",value:u.value.configuratorParams.width,"onUpdate:value":[C[6]||(C[6]=E=>u.value.configuratorParams.width=E),C[9]||(C[9]=E=>v("width",E))],parse:t.unref(ct),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:C[7]||(C[7]=E=>t.unref(lt)(E)),onInput:C[8]||(C[8]=E=>t.unref(ot)(n.validation,"width")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{ref:"height-form-item-reference",path:"configuratorParams.height",label:`Высота светового проёма от ${n.settings.minHeight-h.value} ${m.value?" до "+(m.value-h.value):""} мм.`},{feedback:t.withCtx(()=>[!n.validation.height.showFeedback&&b.value>=n.settings.minHeight&&b.value<=n.settings.maxHeights[u.value.configuratorParams.netType]?(t.openBlock(),t.createElementBlock("div",ob,[t.createVNode(t.unref(F.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Высота готового изделия "+t.toDisplayString(b.value),1)]),_:1}),t.createVNode(t.unref(F.NButton),{quaternary:"",type:"info",size:"tiny",onClick:C[15]||(C[15]=E=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...C[26]||(C[26]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[C[11]||(C[11]=E=>u.value.configuratorParams.height=E),C[14]||(C[14]=E=>v("height",E))],parse:t.unref(ct),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:C[12]||(C[12]=E=>t.unref(lt)(E)),onInput:C[13]||(C[13]=E=>t.unref(ot)(n.validation,"height")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:u.value.quantity,"onUpdate:value":[C[16]||(C[16]=E=>u.value.quantity=E),C[19]||(C[19]=E=>B("quantity",E??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:C[17]||(C[17]=E=>t.unref(lt)(E,!1)),onInput:C[18]||(C[18]=E=>t.unref(ot)(n.validation,"quantity")),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:C[20]||(C[20]=E=>t.unref(ot)(n.validation,"marker")),"onUpdate:value":C[21]||(C[21]=E=>{u.value.marker=E??null,B("marker",E??null)}),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),y.value?(t.openBlock(),t.createBlock($,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":C[22]||(C[22]=E=>{u.value.isAdditionalSale=E??!1,B("isAdditionalSale",E??!1)})},{default:t.withCtx(()=>[...C[27]||(C[27]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode($r,{"is-product-searching":n.isProductSearching,product:u.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),k.value?(t.openBlock(),t.createElementBlock("div",sb,[C[28]||(C[28]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",ab,t.toDisplayString(k.value)+" ₽",1)])):t.createCommentVNode("",!0),x.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",lb," Пожалуйста, заполните все обязательные поля корректно. ")),t.createElementVNode("div",cb,[t.createVNode(t.unref(F.NButton),{loading:n.isSubmitProcessing,disabled:!x.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:C[23]||(C[23]=E=>o("submit",n.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"]),s.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,type:"default",onClick:C[24]||(C[24]=E=>o("click:show-preview-drawer"))},{default:t.withCtx(()=>[...C[29]||(C[29]=[t.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):t.createCommentVNode("",!0)])]),_:1},8,["model","rules"])),[[t.unref(oi),()=>o("submit",u.value)]])}}}),ub="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",fb="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",hb="/img/configurators/mosquitto/measurement-instructions/mount.png",mb="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",pb="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",gb={class:"flex flex-col gap-6"},yb={class:"flex gap-4"},bb={class:"flex flex-col gap-2"},_b={class:"flex gap-4"},wb={class:"flex flex-col gap-2"},xb={class:"flex gap-4"},kb={class:"flex flex-col gap-2"},Cb={},Pu=t.defineComponent({...Cb,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(n,{emit:e}){const i=Xe.initRefDependingOnDeviceResolution("small","small","medium"),r=Xe.initRefDependingOnDeviceResolution(.98,.95,.8),o=t.computed(()=>window.innerWidth*r.value),s=e;return(a,l)=>{const c=F.NText;return t.openBlock(),t.createBlock(t.unref(F.NModal),{show:n.show,"show-icon":!1,size:t.unref(i),style:t.normalizeStyle(`width: ${o.value}px`),title:"Руководство по замеру","action-class":"grid grid-cols-2 !justify-between",preset:"dialog",onClose:l[0]||(l[0]=d=>s("update:show",!1)),onEsc:l[1]||(l[1]=d=>s("update:show",!1)),onMaskClick:l[2]||(l[2]=d=>s("update:show",!1))},{default:t.withCtx(()=>[t.createElementVNode("div",gb,[t.createVNode(c,{type:"error",class:"text-base font-medium"},{default:t.withCtx(()=>[...l[3]||(l[3]=[t.createTextVNode(" Важно! Для того,что бы произвести замер, необходимо открыть оконную створку. ",-1)])]),_:1}),l[22]||(l[22]=t.createElementVNode("div",{class:"grid gap-6 md:grid-cols-2"},[t.createElementVNode("div",{class:"flex items-start gap-4"},[t.createElementVNode("img",{src:ub,alt:"measurement-height",class:"w-[7.5rem]"}),t.createElementVNode("div",{class:"flex flex-col gap-2"},[t.createElementVNode("span",{class:"text-lg font-bold"},"Замер ширины"),t.createElementVNode("span",null,"Замерить по ширине световой проем оконной рамы. Размер учитывать c точностью до 1 мм")])]),t.createElementVNode("div",{class:"flex items-start gap-4"},[t.createElementVNode("img",{src:fb,alt:"measurement-height",class:"w-[7.5rem]"}),t.createElementVNode("div",{class:"flex flex-col gap-2"},[t.createElementVNode("span",{class:"text-lg font-bold"},"Замер высоты"),t.createElementVNode("span",null,"Замерить по высоте световой проем оконной рамы. Размер учитывать с точностью до 1 мм")])])],-1)),t.createElementVNode("div",yb,[l[9]||(l[9]=t.createElementVNode("img",{src:hb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",bb,[l[8]||(l[8]=t.createElementVNode("span",{class:"text-lg font-bold"},"Крепление на раме сетки",-1)),t.createElementVNode("span",null,[l[4]||(l[4]=t.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[5]||(l[5]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.frame)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.frame)+" мм. ",1),l[6]||(l[6]=t.createElementVNode("br",null,null,-1)),l[7]||(l[7]=t.createTextVNode(" Крепления находятся на раме сетки. ",-1))])])]),t.createElementVNode("div",_b,[l[15]||(l[15]=t.createElementVNode("img",{src:mb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",wb,[l[14]||(l[14]=t.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление пластик (верх+низ)",-1)),t.createElementVNode("span",null,[l[10]||(l[10]=t.createTextVNode(" Расчетные размеры москитной сетки:",-1)),l[11]||(l[11]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.external_plastic)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.external_plastic)+" мм. ",1),l[12]||(l[12]=t.createElementVNode("br",null,null,-1)),l[13]||(l[13]=t.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])]),t.createElementVNode("div",xb,[l[21]||(l[21]=t.createElementVNode("img",{src:pb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",kb,[l[20]||(l[20]=t.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление металл (верх+низ)",-1)),t.createElementVNode("span",null,[l[16]||(l[16]=t.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[17]||(l[17]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.external_metal)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.external_metal)+" мм. ",1),l[18]||(l[18]=t.createElementVNode("br",null,null,-1)),l[19]||(l[19]=t.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])])])]),_:1},8,["show","size","style"])}}}),vb={class:"grid md:grid-cols-2"},Sb={},Fu=t.defineComponent({...Sb,__name:"mosquito-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>Xe.isPhoneDevice()),s=t.ref(!1),a=t.ref(!1),l=t.ref(i.cartItem),c=t.useTemplateRef("mosquito-configurator-form"),d=t.ref({width:{},height:{},quantity:{},marker:{}}),u=t.ref(!1),f=t.ref(!1),h=t.computed(()=>t.inject("debounce-input-time",300)),p=M.debounce(async g=>{var b,y;l.value.product=new j.ClientProduct,(y=(b=c.value)==null?void 0:b.formReference)==null||y.validate(_=>{_||(u.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:g,validationFieldResultData:d.value,callback:k=>{k?l.value.product=k:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(M.noop)},h.value),m=()=>{f.value=!0,r("submit",l.value,d.value,()=>{f.value=!1})};return t.watch(()=>i.cartItem,g=>{l.value=g},{deep:!0}),(g,b)=>{const y=Uo;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(Pu,{show:a.value,"onUpdate:show":b[0]||(b[0]=_=>a.value=_),"height-overlaps":n.settings.heightOverlaps,"width-overlaps":n.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),t.createElementVNode("div",vb,[o.value?(t.openBlock(),t.createBlock(t.unref(F.NDrawer),{key:1,show:s.value,"onUpdate:show":b[4]||(b[4]=_=>s.value=_),"default-width":375,resizable:""},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NDrawerContent),null,{header:t.withCtx(()=>[t.createVNode(t.unref(F.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:b[2]||(b[2]=_=>s.value=!1)},{default:t.withCtx(()=>[t.createVNode(y)]),_:1})]),default:t.withCtx(()=>[t.createVNode(Ea,{"configurator-params":l.value.configuratorParams,settings:n.settings,onOpenInstructions:b[3]||(b[3]=_=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(t.openBlock(),t.createBlock(Ea,{key:0,"configurator-params":l.value.configuratorParams,settings:n.settings,onOpenInstructions:b[1]||(b[1]=_=>a.value=!0)},null,8,["configurator-params","settings"])),t.createVNode(Ru,{ref:"mosquito-configurator-form",value:l.value,"onUpdate:value":b[5]||(b[5]=_=>l.value=_),validation:d.value,settings:n.settings,"is-product-searching":u.value,"is-submit-processing":f.value,"onUpdate:params":b[6]||(b[6]=_=>t.unref(p)(_)),onSubmit:b[7]||(b[7]=_=>m()),"onClick:instructionsToggle":b[8]||(b[8]=_=>a.value=!a.value),"onClick:showPreviewDrawer":b[9]||(b[9]=_=>s.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),Bb={},Vu=t.defineComponent({...Bb,__name:"strip-configurator-line-item",props:{value:{},index:{},path:{},settings:{},product:{default:void 0},addLineButtonDisabled:{type:Boolean,default:!1},removeLineButtonDisabled:{type:Boolean,default:!1},suggestionOption:{default:void 0},autoFocus:{type:Boolean,default:!1},isLastLine:{type:Boolean,default:!1},validation:{}},emits:["update:value","click:add-line","click:remove-line"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.useTemplateRef("width-input-element"),a=t.ref(!1),l=t.ref(r.value),c=t.useTemplateRef("form-item-reference"),d=t.computed(()=>{var p;return!((p=c.value)!=null&&p.validationErrored)}),u=p=>{l.value=p,o("update:value",p,r.index,a)},f=p=>{lt(p),(p.key==="Enter"||p.code==="Enter")&&!r.isLastLine&&(p.preventDefault(),p.stopPropagation())},h=()=>{var p;(p=s.value)==null||p.select()};return t.watch(()=>r.value,p=>{l.value=p}),t.onMounted(()=>{r.autoFocus&&t.nextTick(()=>{h()})}),e({isValid:d,formItemReference:c}),(p,m)=>{const g=ac,b=fo;return t.openBlock(),t.createBlock(t.unref(F.NFormItem),{ref:"form-item-reference",path:n.path,label:`Полоса №${n.index+1}, мм`,class:"sc-hide-empty-feedback-message"},{feedback:t.withCtx(()=>[d.value?(t.openBlock(),t.createBlock($r,{key:0,"is-product-searching":a.value,product:n.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(F.NDropdown),{trigger:"click",options:n.suggestionOption,placement:"bottom-start",size:"large",onSelect:u},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref:"width-input-element",value:l.value??null,class:"w-full","show-button":!1,parse:t.unref(ct),placeholder:"Введите ширину",onKeydown:f,onInput:m[0]||(m[0]=y=>t.unref(ot)(n.validation,`linesWidths.${n.index}`)),onFocus:t.unref(Le),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),t.createVNode(t.unref(F.NButton),{disabled:n.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:m[1]||(m[1]=y=>o("click:add-line",n.index))},{default:t.withCtx(()=>[t.createVNode(g)]),_:1},8,["disabled"]),t.createVNode(t.unref(F.NButton),{disabled:n.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:m[2]||(m[2]=y=>o("click:remove-line",n.index))},{default:t.withCtx(()=>[t.createVNode(b)]),_:1},8,["disabled"])]),_:1},8,["path","label"])}}}),Nb={class:"my-2 flex w-full flex-col"},Tb={key:1},$b={class:"text-lg font-semibold"},Eb={class:"flex gap-3"},Rb={},Mu=t.defineComponent({...Rb,__name:"strip-configurator-form",props:{value:{},settings:{},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:add-line","click:remove-line"],setup(n,{expose:e,emit:i}){var _;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("line-items-reference"),l=t.ref(M.cloneDeep(r.value)),c=t.computed(()=>{const k={length:[le.required,le.min(r.settings.minLength),le.max(r.settings.maxLength),le.step(r.settings.lengthStep),He.serverValidation(r.validation.length.feedback)],quantity:[le.required,le.min(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]};return M.forEach(l.value,(x,v)=>{var B;k[`configuratorParams.linesWidths.${v}`]=[le.required,le.min(r.settings.minLineWidth),le.step(r.settings.lineWidthStep),He.serverValidation((B=r.validation[`linesWidths.${v}`])==null?void 0:B.feedback)]}),k}),d=t.ref(r.settings.canSetDopProdaga??!1),u=t.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((k,x)=>(k??0)+(x??0),0)),f=t.computed(()=>r.settings.width-u.value),h=t.computed(()=>!r.value.some(({product:k})=>!k||k.isNewRec())),p=t.computed(()=>r.isSubmitProcessing||!h.value||f.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(k=>k.product.isNewRec())),m=t.computed(()=>k=>f.value===0?void 0:[{label:`${(f.value>0?"Остаток +":"Излишек ")+f.value} мм.`,key:f.value+k}]),g=t.computed(()=>{const{length:k}=r.value[0];return!k||u.value!==r.settings.width?null:(M.reduce(r.value,(v,B)=>{var T;const w=((T=B.product)==null?void 0:T.costRub)||0;return v+w},0)*r.value[0].quantity*k).toLocaleString("ru-ru",{minimumFractionDigits:2})}),b=(k,x,v)=>{var w,T,C;l.value[x].product.id=-1;const{configuratorParams:B}=l.value[x];B.linesWidths[x]=k,y("configuratorParams",B),(C=(T=(w=a.value)==null?void 0:w.at(x))==null?void 0:T.formItemReference)==null||C.validate().catch(M.noop),t.nextTick(()=>{var $,E;(E=($=a.value)==null?void 0:$.at(x))!=null&&E.isValid&&o("update:params",B,x,v)})},y=(k,x)=>{l.value.forEach(v=>{v[k]=x}),o("update:value",l.value)};return t.watch(()=>r.value,k=>{l.value=M.cloneDeep(k)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(k,x)=>{const v=F.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:l.value[0],rules:c.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var B;return[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,(w,T)=>{var C,$,E;return t.openBlock(),t.createBlock(Vu,{key:T,ref_for:!0,ref:"line-items-reference",value:((C=w.configuratorParams)==null?void 0:C.linesWidths.at(T))??null,"auto-focus":((($=w.configuratorParams)==null?void 0:$.linesWidths.at(T))??0)===0,index:T,path:`configuratorParams.linesWidths.${T}`,product:w.product,settings:n.settings,validation:n.validation,"suggestion-option":m.value(((E=w.configuratorParams)==null?void 0:E.linesWidths.at(T))??0),"add-line-button-disabled":f.value<=0||n.value.length>=n.settings.maxLinesCount||n.value.some(I=>I.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"is-last-line":T===l.value.length-1&&f.value===0,"onUpdate:value":b,"onClick:addLine":x[0]||(x[0]=I=>o("click:add-line",I)),"onClick:removeLine":x[1]||(x[1]=I=>o("click:remove-line",I))},null,8,["value","auto-focus","index","path","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled","is-last-line"])}),128)),t.createElementVNode("div",Nb,[f.value<0?(t.openBlock(),t.createBlock(t.unref(F.NText),{key:0,type:"error"},{default:t.withCtx(()=>[t.createTextVNode(" Сумма ширин всех полос должна быть равна "+t.toDisplayString(n.settings.width),1)]),_:1})):t.createCommentVNode("",!0),h.value&&l.value.length===n.settings.maxLinesCount&&f.value>0?(t.openBlock(),t.createBlock(t.unref(F.NText),{key:1,type:"error"},{default:t.withCtx(()=>[...x[15]||(x[15]=[t.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",null,[x[16]||(x[16]=t.createTextVNode(" Остаток для резки: ",-1)),t.createVNode(t.unref(F.NText),{type:f.value>=0?"Success":"error"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f.value),1)]),_:1},8,["type"]),t.createTextVNode(" из "+t.toDisplayString(n.settings.width)+" мм ",1)])]),t.createVNode(t.unref(F.NButton),{disabled:p.value,type:"primary",class:"self-center",onClick:x[2]||(x[2]=w=>o("click:add-line",l.value.length))},{default:t.withCtx(()=>[...x[17]||(x[17]=[t.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["disabled"]),t.createVNode(t.unref(F.NFormItem),{path:"length",label:`Метраж ${n.settings.minLength?" от "+n.settings.minLength:""} ${n.settings.maxLength?" до "+n.settings.maxLength:""} м.`},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value[0].length,"onUpdate:value":[x[3]||(x[3]=w=>l.value[0].length=w),x[6]||(x[6]=w=>y("length",w))],parse:t.unref(ct),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:x[4]||(x[4]=w=>t.unref(lt)(w,!1)),onInput:x[5]||(x[5]=w=>t.unref(ot)(n.validation,"length")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value[0].quantity,"onUpdate:value":[x[7]||(x[7]=w=>l.value[0].quantity=w),x[10]||(x[10]=w=>y("quantity",w))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:x[8]||(x[8]=w=>t.unref(lt)(w,!1)),onInput:x[9]||(x[9]=w=>t.unref(ot)(n.validation,"quantity")),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:l.value[0].marker??null,placeholder:"Введите маркировку",onInput:x[11]||(x[11]=w=>t.unref(ot)(n.validation,"marker")),"onUpdate:value":x[12]||(x[12]=w=>{l.value[0].marker=w??null,y("marker",w??null)}),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(v,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":x[13]||(x[13]=w=>{l.value[0].isAdditionalSale=w??!1,y("isAdditionalSale",w??!1)})},{default:t.withCtx(()=>[...x[18]||(x[18]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),g.value?(t.openBlock(),t.createElementBlock("div",Tb,[x[19]||(x[19]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",$b,t.toDisplayString(g.value)+" ₽",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Eb,[t.createVNode(t.unref(F.NButton),{loading:n.isSubmitProcessing,disabled:!h.value||f.value!=0||!((B=l.value[0])!=null&&B.length)||l.value[0].length>n.settings.maxLength||l.value[0].length<n.settings.minLength||l.value[0].quantity===0,type:"primary",class:"self-start",onClick:x[14]||(x[14]=w=>o("submit",l.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(l.value[0].isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[t.unref(oi),()=>o("submit",l.value)]])}}}),Pb={class:"flex grow flex-col"},Fb=["src"],Vb={class:"w-full"},Mb={},Iu=t.defineComponent({...Mb,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",Pb,[t.createElementVNode("img",{src:"/img/configurators/strip/strip-"+n.value.length+".png",class:"w-full max-w-96 self-center py-5",alt:"Штрипс"},null,8,Fb),t.createElementVNode("div",Vb,[t.createTextVNode(" Число полос можно указать от "+t.toDisplayString(n.settings.minLinesCount)+" до "+t.toDisplayString(n.settings.maxLinesCount)+". ",1),i[0]||(i[0]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Минимальная ширина полосы "+t.toDisplayString(n.settings.minLineWidth)+" мм. ",1),i[1]||(i[1]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина всех полос "+t.toDisplayString(n.settings.width)+" мм. ",1),i[2]||(i[2]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Шаг ширины полосы - "+t.toDisplayString(n.settings.lineWidthStep)+" мм. ",1)])]))}}),Ib={class:"flex flex-col gap-2"},Ab={class:"flex grow flex-col px-5 md:w-104"},Ob={},Au=t.defineComponent({...Ob,__name:"strip-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("strip-configurator-form"),s=t.ref(i.cartItems),a=t.ref({width:{},length:{},quantity:{},marker:{}}),l=t.ref(!1),c=t.computed(()=>t.inject("debounce-input-time",300)),d=t.computed(()=>{var m;return(m=s.value[0].configuratorParams)==null?void 0:m.linesWidths.reduce((g,b)=>(g??0)+(b??0),0)}),u=m=>{m===void 0&&(m=s.value.length-1);const g=s.value.at(0);if(!g)return;g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m+1,0,null),s.value.forEach(y=>{y.configuratorParams.linesWidths=g.configuratorParams.linesWidths});const b=new j.OrderItemBase({quantity:(g==null?void 0:g.quantity)??1,category:g==null?void 0:g.category,length:(g==null?void 0:g.length)??i.settings.minLength,marker:g==null?void 0:g.marker,configuratorParams:{linesWidths:g==null?void 0:g.configuratorParams.linesWidths}});s.value=s.value.toSpliced(m+1,0,b)},f=m=>{const g=s.value.at(0);g&&(g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m,1),s.value.forEach(b=>{b.configuratorParams.linesWidths=g.configuratorParams.linesWidths}),s.value=s.value.toSpliced(m,1),delete a[`linesWidths.${m}`],delete a[`linesWidths.${m}`])},h=M.debounce(async(m,g,b)=>{const y={linesWidths:m.linesWidths.at(g)};b.value=!0,a.value[`linesWidths.${g}`]={},s.value[g].product=new j.ClientProduct,i.eventEmitter.emit("configurator:search-product",{category:s.value[g].category,params:y,validationFieldResultData:a.value,callback:_=>{_?(s.value[g].product=_,g===s.value.length-1&&s.value.length<i.settings.maxLinesCount&&d.value&&d.value<i.settings.width&&u()):(s.value[g].product=new j.ClientProduct,a.value[`linesWidths.${g}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},b.value=!1),b.value=!1}})},c.value),p=async()=>{var m,g;(g=(m=o.value)==null?void 0:m.formReference)==null||g.validate(b=>{if(!b){l.value=!0;const y=s.value.at(0);if(!y)return;r("submit",y,a.value,()=>{l.value=!1,t.nextTick(()=>{var _,k;(k=(_=o.value)==null?void 0:_.formReference)==null||k.restoreValidation()})})}}).catch(M.noop)};return t.watch(()=>i.cartItems,m=>{s.value=m.map(g=>new j.OrderItemBase(g))}),(m,g)=>{const b=F.NButton;return t.openBlock(),t.createElementBlock("div",Ib,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(b,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=y=>r("click:view-switch"))},{default:t.withCtx(()=>[...g[3]||(g[3]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",Ab,[t.createVNode(Iu,{value:s.value,"onUpdate:value":g[1]||(g[1]=y=>s.value=y),settings:n.settings},null,8,["value","settings"]),t.createVNode(Mu,{ref:"strip-configurator-form",value:s.value,"onUpdate:value":g[2]||(g[2]=y=>s.value=y),validation:a.value,settings:n.settings,"is-submit-processing":l.value,"onUpdate:params":t.unref(h),onSubmit:p,"onClick:addLine":u,"onClick:removeLine":f},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),zb={class:"flex flex-col gap-3"},Db={},Ou=t.defineComponent({...Db,__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","submit"],setup(n,{expose:e,emit:i}){var p;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("first-input-element"),l=t.ref(M.cloneDeep(r.value)),c=t.computed(()=>({"configuratorParams.width":[le.required,le.min(r.settings.minWidth),...r.settings.maxWidth?[le.max(r.settings.maxWidth)]:[],le.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[le.required,le.min(r.settings.minLength),le.max(r.settings.maxLength),le.step(1),He.serverValidation(r.validation.length.feedback)],quantity:[le.required,le.min(1),le.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),d=t.ref(r.settings.canSetDopProdaga??!1),u=()=>{o("update:params",l.value.configuratorParams),f("configuratorParams",l.value.configuratorParams)},f=(m,g)=>{const b=new j.OrderItemBase(r.value);b[m]=g,m==="configuratorParams"&&(b.product=new j.ClientProduct),o("update:value",b)},h=()=>{var m;(m=a.value)==null||m.select()};return t.watch(()=>r.value,m=>{l.value=M.cloneDeep(m)},{deep:!0}),t.onMounted(()=>{r.value.isNewRec()&&t.nextTick(()=>{h()})}),e({validate:(p=s.value)==null?void 0:p.validate,formReference:s}),(m,g)=>{const b=F.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:l.value,rules:c.value,disabled:n.isSubmitProcessing,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NFormItem),{path:"configuratorParams.width",label:`Ширина, ${n.settings.minWidth?" от "+n.settings.minWidth:""}${n.settings.maxWidth?" до "+n.settings.maxWidth:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref:"first-input-element",value:l.value.configuratorParams.width,"onUpdate:value":[g[0]||(g[0]=y=>l.value.configuratorParams.width=y),u],class:"w-full",parse:t.unref(ct),"show-button":!1,placeholder:"Введите ширину",onKeydown:g[1]||(g[1]=y=>t.unref(lt)(y)),onInput:g[2]||(g[2]=y=>t.unref(ot)(n.validation,"width")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"configuratorParams.length",label:`Длина, ${n.settings.minLength?" от "+n.settings.minLength:""}${n.settings.maxLength?" до "+n.settings.maxLength:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[g[3]||(g[3]=y=>l.value.configuratorParams.length=y),u],placeholder:"Введите длину",parse:t.unref(ct),"show-button":!1,class:"w-full",onKeydown:g[4]||(g[4]=y=>t.unref(lt)(y)),onInput:g[5]||(g[5]=y=>t.unref(ot)(n.validation,"length")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:n.value.quantity,placeholder:"Введите количество",min:1,"show-button":!1,class:"w-full",onKeydown:g[6]||(g[6]=y=>t.unref(lt)(y,!1)),onInput:g[7]||(g[7]=y=>t.unref(ot)(n.validation,"quantity")),"onUpdate:value":g[8]||(g[8]=y=>f("quantity",y??0)),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:n.value.marker??null,placeholder:"Введите маркировку",onInput:g[9]||(g[9]=y=>t.unref(ot)(n.validation,"marker")),"onUpdate:value":g[10]||(g[10]=y=>f("marker",y??null)),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(b,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":g[11]||(g[11]=y=>{l.value.isAdditionalSale=y??!1,f("isAdditionalSale",y??!1)})},{default:t.withCtx(()=>[...g[13]||(g[13]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode($r,{"is-product-searching":n.isProductSearching,product:n.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),t.createElementVNode("div",zb,[t.createVNode(t.unref(F.NButton),{disabled:n.value.product.isNewRec()||n.isProductSearching||n.isSubmitProcessing||n.value.length===0||n.value.width===0||n.value.quantity===0,type:"primary",class:"self-start",onClick:g[12]||(g[12]=y=>o("submit",n.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["model","rules","disabled"])),[[t.unref(oi),()=>o("submit",l.value)]])}}}),Lb={class:"flex flex-col gap-2 w-72"},Hb={},zu=t.defineComponent({...Hb,__name:"metal-for-doors-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("metal-for-doors-configurator-form"),s=t.ref(i.cartItem),a=t.ref({width:{},length:{},quantity:{},marker:{}}),l=t.ref(!1),c=t.ref(!1),d=t.computed(()=>t.inject("debounce-input-time",300)),u=M.debounce(async h=>{var p,m;s.value.product=new j.ClientProduct,(m=(p=o.value)==null?void 0:p.formReference)==null||m.validate(g=>{g||(l.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:h,validationFieldResultData:a.value,callback:b=>{b?s.value.product=b:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(M.noop)},d.value),f=async()=>{var h,p;(p=(h=o.value)==null?void 0:h.formReference)==null||p.validate(m=>{m||(c.value=!0,r("submit",s.value,a.value,()=>{c.value=!1,t.nextTick(()=>{var g,b;(b=(g=o.value)==null?void 0:g.formReference)==null||b.restoreValidation()})}))}).catch(M.noop)};return t.watch(()=>i.cartItem,h=>{s.value=new j.OrderItemBase(h)},{deep:!0}),(h,p)=>{const m=F.NButton;return t.openBlock(),t.createElementBlock("div",Lb,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(m,{key:0,type:"tertiary",class:"self-center",onClick:p[0]||(p[0]=g=>r("click:view-switch"))},{default:t.withCtx(()=>[...p[4]||(p[4]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createVNode(Ou,{ref:"metal-for-doors-configurator-form",value:s.value,"onUpdate:value":p[1]||(p[1]=g=>s.value=g),validation:a.value,settings:n.settings,"is-submit-processing":c.value,"is-product-searching":l.value,"onUpdate:params":p[2]||(p[2]=g=>t.unref(u)(g)),onSubmit:p[3]||(p[3]=g=>f())},null,8,["value","validation","settings","is-submit-processing","is-product-searching"])])}}}),Wb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function jb(n,e){return t.openBlock(),t.createElementBlock("svg",Wb,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 112v288m144-144H112"},null,-1)])])}const Du=t.markRaw({name:"ion-add",render:jb}),qb={key:0,class:"-mt-1 text-sm text-gray-500"},Xb={class:"font-bold"},Yb={class:"flex flex-col gap-3"},Ub={key:0,class:"mt-4 flex flex-col gap-1.5"},Kb={class:"flex flex-col gap-1 text-sm text-gray-700"},Gb={key:0},Zb={key:1},Qb={"form-array-name":"items",class:"flex flex-col gap-3"},Jb={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},e_={key:0,class:"flex flex-wrap items-end gap-2"},t_={class:"whitespace-nowrap text-xl font-bold"},n_={key:0,class:"whitespace-nowrap text-lg text-gray-500"},i_={class:"font-bold"},r_={class:"font-bold"},o_={class:"flex gap-3"},s_={},Lu=t.defineComponent({...s_,__name:"sandwich-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","add-item","remove-item"],setup(n,{expose:e,emit:i}){var D;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.ref(M.cloneDeep(r.value)),l=t.ref({...r.validation}),c=L=>{var z;delete l.value[L],(z=s.value)==null||z.restoreValidation()};t.watch(()=>r.validation,L=>{l.value={...L},Object.values(L).some(P=>P==null?void 0:P.feedback)&&t.nextTick(()=>{var P;return(P=s.value)==null?void 0:P.validate(M.noop).catch(M.noop)})},{deep:!0});const d=t.computed(()=>r.value.category),u=t.ref(null),f=t.ref(null),h=t.computed(()=>d.value.products??[]),p=t.computed(()=>h.value.map(L=>({label:L.name,value:L.id}))),m=(L,z,P)=>{const q=L!=null&&L>0,K=z!=null&&z>0;return!q&&!K?null:q&&K?`от ${L} ${P} до ${z} ${P}`:q?`от ${L} ${P}`:`до ${z} ${P}`},g=t.computed(()=>{var L,z;return m(r.settings.minWidth,(z=(L=u.value)==null?void 0:L.properties)==null?void 0:z.width,"мм")}),b=t.computed(()=>{var L,z;return m(r.settings.minLength,(z=(L=u.value)==null?void 0:L.properties)==null?void 0:z.length,"мм")}),y=t.ref(null),_=t.ref(!1),k=t.computed(()=>{var z;const L={marker:[He.serverValidation((z=l.value.marker)==null?void 0:z.feedback)]};return a.value.configuratorParams.items.forEach((P,q)=>{var K,J,Y,V,A,ie,ce;L[`configuratorParams.items.${q}.width`]=[le.required,le.min(r.settings.minWidth),...(J=(K=u.value)==null?void 0:K.properties)!=null&&J.width?[le.max(u.value.properties.width)]:[],le.step(1),He.serverValidation((Y=l.value[`items.${q}.width`])==null?void 0:Y.feedback)],L[`configuratorParams.items.${q}.length`]=[le.required,le.min(r.settings.minLength),...(A=(V=u.value)==null?void 0:V.properties)!=null&&A.length?[le.max(u.value.properties.length)]:[],le.step(1),He.serverValidation((ie=l.value[`items.${q}.length`])==null?void 0:ie.feedback)],L[`configuratorParams.items.${q}.count`]=[le.required,le.min(1),le.step(1),He.serverValidation((ce=l.value[`items.${q}.count`])==null?void 0:ce.feedback)]}),L}),x=t.ref(r.settings.canSetDopProdaga??!1),v=t.computed(()=>a.value.configuratorParams.items.some(L=>{var z,P;return!u.value||!L.width||L.width<r.settings.minWidth||L.width>(((z=u.value.properties)==null?void 0:z.width)??0)||L.length===0||L.length<r.settings.minLength||L.length>(((P=u.value.properties)==null?void 0:P.length)??0)||!L.count||L.count<1})),B=t.computed(()=>!u.value||v.value||a.value.configuratorParams.items.length===0),w=t.ref(null),T=L=>{if(!L){u.value=null,f.value=null,a.value.product=new j.ClientProduct,y.value=null;return}const z=h.value.find(P=>P.id===L);z&&(u.value=z,f.value=L,a.value.product=z,G("product",a.value.product),a.value.configuratorParams.items.forEach(P=>{var q,K;(q=z.properties)!=null&&q.width&&P.width>z.properties.width&&(P.width=z.properties.width),(K=z.properties)!=null&&K.length&&P.length>z.properties.length&&(P.length=z.properties.length)}),$())};let C=!1;const $=()=>{C=!0,y.value=null,w.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},E=async()=>{var L;if(!u.value||a.value.configuratorParams.items.length===0||v.value){$();return}(L=s.value)==null||L.validate(z=>{if(z){$();return}if(_.value=!0,!u.value||!d.value){$(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:P=>{P?(y.value=P,a.value.configuratorParams.calculationId=P.id,a.value.quantity=P.quantity,t.nextTick(()=>{G("quantity",P.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,$()),G("configuratorParams",a.value.configuratorParams),I(),_.value=!1}})}).catch(()=>{$(),_.value=!1})},I=()=>{var z;if(!((z=u.value)!=null&&z.costRub)||!y.value){w.value=null;return}const L=y.value.quantity*u.value.costRub;w.value=Math.round(L*100)/100},R=L=>{var P,q;const z=a.value.configuratorParams.items[L];u.value&&((P=u.value.properties)!=null&&P.width&&z.width>u.value.properties.width&&(z.width=u.value.properties.width),(q=u.value.properties)!=null&&q.length&&z.length>u.value.properties.length&&(z.length=u.value.properties.length)),G("configuratorParams",a.value.configuratorParams),$()},O=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),G("configuratorParams",a.value.configuratorParams),$(),o("add-item",a.value.configuratorParams.items.length)},U=L=>{a.value.configuratorParams.items.splice(L,1),G("configuratorParams",a.value.configuratorParams),$(),o("remove-item",L)},Q=()=>{if(!(B.value||_.value||r.isSubmitProcessing)){if(!y.value){E();return}o("submit",a.value)}},G=(L,z)=>{const P=new j.OrderItemBase(r.value);P[L]=z,o("update:value",P)};t.watch(()=>r.value,L=>{const z=M.cloneDeep(t.toRaw(L));(!z.configuratorParams.items||z.configuratorParams.items.length===0)&&(z.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=z,r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),r.value.product.isNewRec()&&(u.value=null,f.value=null),C?C=!1:W()},{deep:!0});const W=()=>{const{calculationId:L}=a.value.configuratorParams,z=a.value.quantity??0;L&&z>0&&a.value.product&&!a.value.product.isNewRec()&&(y.value={id:L,quantity:z,sheets:[]},I())};return t.onMounted(()=>{r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),W()}),e({validate:(D=s.value)==null?void 0:D.validate,formReference:s}),(L,z)=>{const P=fo,q=Du;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:a.value,rules:k.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var K;return[t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:f.value,"onUpdate:value":[z[0]||(z[0]=J=>f.value=J),T],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((K=u.value)==null?void 0:K.costRub)!=null?(t.openBlock(),t.createElementBlock("div",qb,[t.createElementVNode("span",Xb,t.toDisplayString(u.value.code),1),t.createTextVNode(" — "+t.toDisplayString(u.value.costRub.toLocaleString())+" "+t.toDisplayString(u.value.currency.symbol)+"/шт. ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Yb,[u.value?(t.openBlock(),t.createElementBlock("div",Ub,[z[7]||(z[7]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",Kb,[g.value?(t.openBlock(),t.createElementBlock("div",Gb,"Ширина "+t.toDisplayString(g.value)+".",1)):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock("div",Zb,"Длина "+t.toDisplayString(b.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",Qb,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value.configuratorParams.items,(J,Y)=>(t.openBlock(),t.createElementBlock("div",{key:Y,class:"flex grow gap-2"},[t.createElementVNode("div",Jb,[t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.items.${Y}.width`,label:"Ширина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:a.value.configuratorParams.items[Y].width,"onUpdate:value":[V=>a.value.configuratorParams.items[Y].width=V,V=>R(Y)],parse:t.unref(ct),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:z[1]||(z[1]=V=>t.unref(lt)(V)),onInput:V=>c(`items.${Y}.width`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.items.${Y}.length`,label:"Длина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:a.value.configuratorParams.items[Y].length,"onUpdate:value":[V=>a.value.configuratorParams.items[Y].length=V,V=>R(Y)],parse:t.unref(ct),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:z[2]||(z[2]=V=>t.unref(lt)(V)),onInput:V=>c(`items.${Y}.length`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.items.${Y}.count`,label:"Количество, шт"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:a.value.configuratorParams.items[Y].count,"onUpdate:value":[V=>a.value.configuratorParams.items[Y].count=V,V=>R(Y)],parse:t.unref(ct),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:z[3]||(z[3]=V=>t.unref(lt)(V,!1)),onInput:V=>c(`items.${Y}.count`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createVNode(t.unref(F.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:V=>U(Y)},{default:t.withCtx(()=>[t.createVNode(P)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:1,disabled:v.value,type:"default",class:"self-center",onClick:O},{default:t.withCtx(()=>[t.createVNode(q),z[8]||(z[8]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0)]),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка распила"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:a.value.marker??null,disabled:!u.value,placeholder:"Введите маркировку распила",onInput:z[4]||(z[4]=J=>c("marker")),"onUpdate:value":z[5]||(z[5]=J=>G("marker",J??null)),onFocus:t.unref(Le)},null,8,["value","disabled","onFocus"])]),_:1}),x.value?(t.openBlock(),t.createBlock(t.unref(F.NCheckbox),{key:1,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":z[6]||(z[6]=J=>{a.value.isAdditionalSale=J??!1,G("isAdditionalSale",J??!1)})},{default:t.withCtx(()=>[...z[9]||(z[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode(t.unref(F.NSpin),{show:_.value,size:"small",class:"grow"},{default:t.withCtx(()=>{var J;return[y.value&&u.value&&w.value?(t.openBlock(),t.createElementBlock("div",e_,[t.createElementVNode("div",null,[z[10]||(z[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",t_,t.toDisplayString(w.value.toLocaleString())+" "+t.toDisplayString(u.value.currency.symbol),1)]),y.value.quantity&&u.value?(t.openBlock(),t.createElementBlock("div",n_,[t.createElementVNode("span",i_,"("+t.toDisplayString(y.value.quantity)+" шт.",1),z[11]||(z[11]=t.createTextVNode(" x ",-1)),t.createElementVNode("span",r_,t.toDisplayString((J=u.value.costRub)==null?void 0:J.toLocaleString())+" "+t.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]}),_:1},8,["show"]),t.createElementVNode("div",o_,[y.value&&!_.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,loading:n.isSubmitProcessing,disabled:B.value||_.value,type:"primary",class:"self-start",onClick:Q},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])):(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:1,loading:_.value,disabled:B.value||_.value,type:"info",class:"self-start",onClick:E},{default:t.withCtx(()=>[...z[12]||(z[12]=[t.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules"])),[[t.unref(oi),Q]])}}}),a_={class:"flex flex-col gap-2"},l_={class:"w-104 flex grow flex-col px-5"},c_={},Hu=t.defineComponent({...c_,__name:"sandwich-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("sandwich-configurator-form"),s=t.ref(i.cartItem),a=t.ref({width:{},length:{},quantity:{},marker:{},product:{}}),l=t.ref(!1),c=async()=>{var f,h;(h=(f=o.value)==null?void 0:f.formReference)==null||h.validate(p=>{if(!p){l.value=!0;const m=M.cloneDeep(s.value);"items"in m.configuratorParams&&delete m.configuratorParams.items,r("submit",m,a.value,()=>{l.value=!1,t.nextTick(()=>{var g,b;(b=(g=o.value)==null?void 0:g.formReference)==null||b.restoreValidation()})})}}).catch(M.noop)},d=f=>{a.value[`items.${f}.width`]={},a.value[`items.${f}.length`]={},a.value[`items.${f}.count`]={}},u=f=>{delete a.value[`items.${f}.width`],delete a.value[`items.${f}.length`],delete a.value[`items.${f}.count`]};return t.onMounted(()=>{i.cartItem.configuratorParams.items.forEach((f,h)=>{a.value[`items.${h}.width`]={},a.value[`items.${h}.length`]={},a.value[`items.${h}.count`]={}})}),t.watch(()=>i.cartItem,f=>{s.value=new j.OrderItemBase(f)},{deep:!0}),(f,h)=>{const p=F.NButton;return t.openBlock(),t.createElementBlock("div",a_,[n.settings.allowShowTable&&s.value.isNewRec()?(t.openBlock(),t.createBlock(p,{key:0,type:"tertiary",class:"self-center",onClick:h[0]||(h[0]=m=>r("click:view-switch"))},{default:t.withCtx(()=>[...h[2]||(h[2]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",l_,[t.createVNode(Lu,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":h[1]||(h[1]=m=>s.value=m),validation:a.value,settings:n.settings,"event-emitter":n.eventEmitter,"is-submit-processing":l.value,onSubmit:c,onAddItem:d,onRemoveItem:u},null,8,["value","validation","settings","event-emitter","is-submit-processing"])])])}}}),d_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function u_(n,e){return t.openBlock(),t.createElementBlock("svg",d_,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"},null,-1)])])}const f_=t.markRaw({name:"ion-checkmark",render:u_}),h_={key:0,class:"-mt-1 text-sm text-gray-500"},m_={class:"font-bold"},p_={class:"flex flex-col gap-3"},g_={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},y_={class:"flex flex-col gap-1 text-sm text-gray-700"},b_={key:0},__={key:1},w_={"form-array-name":"items",class:"flex flex-col gap-3"},x_={class:"min-w-0 flex-1"},k_={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},C_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},v_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},S_={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},B_={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},N_={key:0,class:"lg:!flex-[2]"},T_={class:"font-bold"},$_={key:1,class:"lg:!flex-[3]"},E_={class:"font-bold"},R_={key:1,class:"min-w-0 flex flex-col items-end gap-1 text-right text-sm text-gray-700 border-t border-gray-200 pt-2"},P_={key:0},F_={class:"font-bold"},V_={key:1},M_={class:"font-bold"},I_={class:"flex flex-wrap items-center gap-3"},A_={},Wu=t.defineComponent({...A_,__name:"sandwich-m2-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},itemStates:{default:()=>[]}},emits:["submit","update:value","add-item","remove-item","item-reset"],setup(n,{expose:e,emit:i}){var J;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("widthInputs"),l=r.value==null?[]:M.cloneDeep(t.toRaw(r.value)),c=t.ref(l.map(Y=>new j.OrderItemBase(Y))),d=t.computed(()=>({items:c.value})),u=t.ref({...r.validation}),f=Y=>{var V;delete u.value[Y],(V=s.value)==null||V.restoreValidation()},h=t.ref(null),p=t.ref(null),m=t.computed(()=>{var Y,V;return((V=(Y=c.value[0])==null?void 0:Y.category)==null?void 0:V.products)??[]}),g=t.computed(()=>m.value.map(Y=>({label:Y.name,value:Y.id}))),b=(Y,V,A)=>{const ie=Y!=null&&Y>0,ce=V!=null&&V>0;return!ie&&!ce?null:ie&&ce?`от ${Y} ${A} до ${V} ${A}`:ie?`от ${Y} ${A}`:`до ${V} ${A}`},y=t.computed(()=>{var Y,V;return b(r.settings.minWidth,(V=(Y=h.value)==null?void 0:Y.properties)==null?void 0:V.width,"мм")}),_=t.computed(()=>{var Y,V;return b(r.settings.minLength,(V=(Y=h.value)==null?void 0:Y.properties)==null?void 0:V.length,"мм")}),k=t.computed(()=>{const Y={};return c.value.forEach((V,A)=>{var ie,ce,pe,at,we,ke,kt,Ne;Y[`items.${A}.configuratorParams.width`]=[le.required,le.min(r.settings.minWidth),...(ce=(ie=h.value)==null?void 0:ie.properties)!=null&&ce.width?[le.max(h.value.properties.width)]:[],le.step(1),He.serverValidation((pe=u.value[`items.${A}.width`])==null?void 0:pe.feedback)],Y[`items.${A}.configuratorParams.length`]=[le.required,le.min(r.settings.minLength),...(we=(at=h.value)==null?void 0:at.properties)!=null&&we.length?[le.max(h.value.properties.length)]:[],le.step(1),He.serverValidation((ke=u.value[`items.${A}.length`])==null?void 0:ke.feedback)],Y[`items.${A}.quantity`]=[le.required,le.min(1),le.step(1),He.serverValidation((kt=u.value[`items.${A}.quantity`])==null?void 0:kt.feedback)],Y[`items.${A}.marker`]=[He.serverValidation((Ne=u.value[`items.${A}.marker`])==null?void 0:Ne.feedback)]}),Y});t.watch(()=>r.validation,Y=>{u.value={...Y},Object.values(Y).some(A=>A==null?void 0:A.feedback)&&t.nextTick(()=>{var A;return(A=s.value)==null?void 0:A.validate(M.noop).catch(M.noop)})},{deep:!0});const x=t.ref(r.settings.canSetDopProdaga??!1),v=t.computed(()=>{const Y=h.value;return Y?c.value.some(V=>{var pe,at;const A=V.configuratorParams,ie=(pe=Y.properties)==null?void 0:pe.width,ce=(at=Y.properties)==null?void 0:at.length;return A.width===0||A.width<r.settings.minWidth||ie!=null&&A.width>ie||A.length===0||A.length<r.settings.minLength||ce!=null&&A.length>ce||V.quantity===0||V.quantity<1}):!0}),B=t.computed(()=>!h.value||v.value||c.value.length===0),w=t.computed(()=>{const Y=c.value[0];return Y!=null&&!Y.isNewRec()}),T=Y=>r.itemStates[Y]??"idle",C=Y=>T(Y)==="success",$=Y=>T(Y)==="loading",E=t.computed(()=>c.value.length===0?!0:c.value.every((Y,V)=>{const A=T(V);return A==="success"||A==="loading"})),I=Y=>Y.width===0||Y.length===0?0:Y.width*Y.length/1e6,R=Y=>I(Y).toLocaleString(void 0,{maximumFractionDigits:4}),O=Y=>{var pe;const V=Y.configuratorParams,A=I(V),ie=((pe=h.value)==null?void 0:pe.costRub)??0,ce=Y.quantity??0;return!A||!ce?0:Math.round(A*ie*ce*100)/100},U=t.computed(()=>M.sum(c.value.map(Y=>{const V=Y.configuratorParams;return!V.width||V.length===0||!Y.quantity?0:V.width*V.length*Y.quantity/1e6}))),Q=t.computed(()=>Math.round(M.sum(c.value.map(Y=>O(Y)))*100)/100),G=()=>{var Y,V,A;return new j.OrderItemBase({category:(Y=c.value[0])==null?void 0:Y.category,configurator:(V=c.value[0])==null?void 0:V.configurator,product:h.value??new j.ClientProduct,quantity:1,isAdditionalSale:(A=c.value[0])==null?void 0:A.isAdditionalSale,configuratorParams:{width:0,length:0}})},W=Y=>{if(!Y){h.value=null,p.value=null,c.value.forEach(A=>{A.product=new j.ClientProduct}),o("update:value",c.value);return}const V=m.value.find(A=>A.id===Y);V&&(h.value=V,p.value=Y,c.value.forEach((A,ie)=>{var ce,pe;A.product=V,(ce=V.properties)!=null&&ce.width&&A.configuratorParams.width>V.properties.width&&(A.configuratorParams.width=V.properties.width),(pe=V.properties)!=null&&pe.length&&A.configuratorParams.length>V.properties.length&&(A.configuratorParams.length=V.properties.length),o("item-reset",ie)}),o("update:value",c.value))},D=Y=>{var ie,ce;const V=c.value[Y],A=h.value;A&&((ie=A.properties)!=null&&ie.width&&V.configuratorParams.width>A.properties.width&&(V.configuratorParams.width=A.properties.width),(ce=A.properties)!=null&&ce.length&&V.configuratorParams.length>A.properties.length&&(V.configuratorParams.length=A.properties.length)),o("item-reset",Y),o("update:value",c.value)},L=(Y,V)=>{c.value[Y].marker=V===null||V===""?void 0:V,o("item-reset",Y),o("update:value",c.value)},z=Y=>{c.value.forEach(V=>{V.isAdditionalSale=Y}),o("update:value",c.value)},P=()=>{c.value.push(G()),o("update:value",c.value),o("add-item",c.value.length),t.nextTick(()=>{var V,A,ie,ce;const Y=c.value.length-1;(A=(V=a.value)==null?void 0:V[Y])==null||A.focus(),(ce=(ie=a.value)==null?void 0:ie[Y])==null||ce.select()})},q=Y=>{c.value.splice(Y,1),o("update:value",c.value),o("remove-item",Y)};t.watch(()=>r.value,Y=>{var ce;const A=(Y==null?[]:M.cloneDeep(t.toRaw(Y))).map(pe=>new j.OrderItemBase(pe));c.value=A.length>0?A:[G()];const ie=(ce=c.value[0])==null?void 0:ce.product;ie&&!ie.isNewRec()?(h.value=ie,p.value=ie.id):(h.value=null,p.value=null)},{deep:!0});const K=()=>{var V;if(h.value!==null)return;const Y=(V=m.value[0])==null?void 0:V.id;Y!=null&&W(Y)};return t.watch(m,()=>{K()}),t.onMounted(()=>{var V;c.value.length===0&&(c.value=[G()]);const Y=(V=c.value[0])==null?void 0:V.product;Y&&!Y.isNewRec()&&(h.value=Y,p.value=Y.id),K()}),e({validate:(J=s.value)==null?void 0:J.validate,formReference:s}),(Y,V)=>{const A=f_,ie=fo,ce=Du;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:d.value,rules:k.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var pe,at;return[t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:p.value,"onUpdate:value":[V[0]||(V[0]=we=>p.value=we),W],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((pe=h.value)==null?void 0:pe.costRub)!=null?(t.openBlock(),t.createElementBlock("div",h_,[t.createElementVNode("span",m_,t.toDisplayString(h.value.code),1),t.createTextVNode(" — "+t.toDisplayString(h.value.costRub.toLocaleString())+" "+t.toDisplayString(h.value.currency.symbol)+"/м² ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",p_,[h.value?(t.openBlock(),t.createElementBlock("div",g_,[V[6]||(V[6]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",y_,[y.value?(t.openBlock(),t.createElementBlock("div",b_,"Ширина "+t.toDisplayString(y.value)+".",1)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock("div",__,"Длина "+t.toDisplayString(_.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",w_,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value.items,(we,ke)=>{var kt;return t.openBlock(),t.createElementBlock("div",{key:ke,class:t.normalizeClass(["flex min-w-0 items-start gap-2 border-b border-gray-100 last:border-0",C(ke)?"opacity-70":""])},[t.createElementVNode("div",x_,[t.createElementVNode("div",k_,[t.createElementVNode("div",C_,[t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.configuratorParams.width`,label:"Ширина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref_for:!0,ref:"widthInputs",value:d.value.items[ke].configuratorParams.width,"onUpdate:value":[Ne=>d.value.items[ke].configuratorParams.width=Ne,Ne=>D(ke)],parse:t.unref(ct),"show-button":!1,disabled:!h.value||C(ke)||$(ke),placeholder:"Ширина",class:"w-full",onKeydown:V[1]||(V[1]=Ne=>t.unref(lt)(Ne)),onInput:Ne=>f(`items.${ke}.width`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:d.value.items[ke].configuratorParams.length,"onUpdate:value":[Ne=>d.value.items[ke].configuratorParams.length=Ne,Ne=>D(ke)],parse:t.unref(ct),"show-button":!1,disabled:!h.value||C(ke)||$(ke),placeholder:"Длина",class:"w-full",onKeydown:V[2]||(V[2]=Ne=>t.unref(lt)(Ne)),onInput:Ne=>f(`items.${ke}.length`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createElementVNode("div",v_,[t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:d.value.items[ke].quantity,"onUpdate:value":[Ne=>d.value.items[ke].quantity=Ne,Ne=>D(ke)],parse:t.unref(ct),"show-button":!1,disabled:!h.value||C(ke)||$(ke),placeholder:"Кол-во",class:"w-full",onKeydown:V[3]||(V[3]=Ne=>t.unref(lt)(Ne,!1)),onInput:Ne=>f(`items.${ke}.quantity`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.marker`,label:"Маркировка",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:d.value.items[ke].marker??null,disabled:!h.value||C(ke)||$(ke),placeholder:"Маркировка",class:"w-full",onInput:Ne=>f(`items.${ke}.marker`),"onUpdate:value":Ne=>L(ke,Ne??null),onFocus:t.unref(Le)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),$(ke)||C(ke)?(t.openBlock(),t.createElementBlock("div",S_,[$(ke)?(t.openBlock(),t.createBlock(t.unref(F.NSpin),{key:0,size:14})):C(ke)?(t.openBlock(),t.createBlock(A,{key:1,class:"text-green-600 text-xl"})):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("div",B_,[we.configuratorParams.width>0&&we.configuratorParams.length>0?(t.openBlock(),t.createElementBlock("div",N_,[V[7]||(V[7]=t.createTextVNode(" Площадь (S) = ",-1)),t.createElementVNode("span",T_,t.toDisplayString(R(we.configuratorParams))+" м²",1)])):t.createCommentVNode("",!0),O(we)>0?(t.openBlock(),t.createElementBlock("div",$_,[V[8]||(V[8]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",E_,t.toDisplayString(O(we).toLocaleString())+" "+t.toDisplayString((kt=h.value)==null?void 0:kt.currency.symbol),1)])):t.createCommentVNode("",!0)])]),w.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,disabled:$(ke)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:Ne=>q(ke)},{default:t.withCtx(()=>[t.createVNode(ie)]),_:1},8,["disabled","onClick"]))],2)}),128))]),h.value?(t.openBlock(),t.createElementBlock("div",R_,[U.value>0?(t.openBlock(),t.createElementBlock("div",P_,[V[9]||(V[9]=t.createTextVNode(" Общая площадь: ",-1)),t.createElementVNode("span",F_,t.toDisplayString(U.value.toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):t.createCommentVNode("",!0),Q.value>0?(t.openBlock(),t.createElementBlock("div",V_,[V[10]||(V[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",M_,t.toDisplayString(Q.value.toLocaleString())+" "+t.toDisplayString(h.value.currency.symbol),1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),x.value?(t.openBlock(),t.createBlock(t.unref(F.NCheckbox),{key:1,checked:((at=c.value[0])==null?void 0:at.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":V[4]||(V[4]=we=>z(we??!1))},{default:t.withCtx(()=>[...V[11]||(V[11]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createElementVNode("div",I_,[h.value&&!w.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,disabled:v.value,type:"default",onClick:P},{default:t.withCtx(()=>[t.createVNode(ce),V[12]||(V[12]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),t.createVNode(t.unref(F.NButton),{loading:n.isSubmitProcessing,disabled:B.value||E.value,type:"primary",class:"ml-auto",onClick:V[5]||(V[5]=we=>o("submit",c.value))},{default:t.withCtx(()=>{var we;return[t.createTextVNode(t.toDisplayString((we=c.value[0])!=null&&we.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[t.unref(oi),()=>o("submit",c.value)]])}}}),O_={class:"flex flex-col gap-2"},z_={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},D_={},ju=t.defineComponent({...D_,__name:"sandwich-m2-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["click:view-switch","submit"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("sandwich-m2-configurator-form"),s=t.ref((i.cartItems??[]).map(k=>new j.OrderItemBase(k))),a=t.ref([]),l=t.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=k=>{c.forEach(x=>{l.value[`items.${k}.${x}`]={}})},u=k=>{c.forEach(x=>{delete l.value[`items.${k}.${x}`]})},f=t.computed(()=>a.value.includes("loading")),h=()=>({width:{},length:{},quantity:{},marker:{}}),p=(k,x)=>{let v=!1;return c.forEach(B=>{var I,R;const w=`items.0.${B}`,T=(I=k[B])==null?void 0:I.feedback,$=((R=k[w])==null?void 0:R.feedback)??T,E=`items.${x}.${B}`;$?(l.value[E]=k[w]??k[B],v=!0):l.value[E]={}}),v},m=(k,x,v)=>new Promise(B=>{const w=h();let T=!1;const C=$=>{if(T)return;T=!0;const E=p(w,x),I=($===void 0?!E:$)&&!E;a.value[x]=I?"success":"error",t.nextTick(()=>{var R,O;(O=(R=o.value)==null?void 0:R.formReference)==null||O.restoreValidation()}),B(I)};a.value[x]="loading",r("submit",[M.cloneDeep(k)],w,C,{isFinalSuccessfulCompletion:v})}),g=async()=>{var v,B;try{await((B=(v=o.value)==null?void 0:v.formReference)==null?void 0:B.validate())}catch{return}const k=s.value.map((w,T)=>T).filter(w=>{const T=a.value[w]??"idle";return T!=="success"&&T!=="loading"});let x=!0;for(let w=0;w<k.length;w+=1){const T=k[w],C=s.value[T];if(!C)break;const E=w===k.length-1&&x;await m(C,T,E)||(x=!1)}},b=k=>{const x=k-1;a.value[x]="idle",d(x)},y=k=>{a.value.splice(k,1),u(k);for(let x=k;x<s.value.length;x+=1)d(x)},_=k=>{const x=a.value[k];(x==="success"||x==="error")&&(a.value[k]="idle")};return t.onMounted(()=>{(i.cartItems??[]).forEach((k,x)=>{a.value[x]="idle",d(x)})}),t.watch(()=>i.cartItems,k=>{const x=(k??[]).map(v=>new j.OrderItemBase(v));s.value=x,a.value=x.map(()=>"idle"),x.forEach((v,B)=>{d(B)})},{deep:!0}),(k,x)=>{var B;const v=F.NButton;return t.openBlock(),t.createElementBlock("div",O_,[n.settings.allowShowTable&&((B=s.value[0])!=null&&B.isNewRec())?(t.openBlock(),t.createBlock(v,{key:0,type:"tertiary",class:"self-center",onClick:x[0]||(x[0]=w=>r("click:view-switch"))},{default:t.withCtx(()=>[...x[2]||(x[2]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",z_,[t.createVNode(Wu,{ref:"sandwich-m2-configurator-form",value:s.value,"onUpdate:value":x[1]||(x[1]=w=>s.value=w),validation:l.value,settings:n.settings,"event-emitter":n.eventEmitter,"is-submit-processing":f.value,"item-states":a.value,onSubmit:g,onAddItem:b,onRemoveItem:y,onItemReset:_},null,8,["value","validation","settings","event-emitter","is-submit-processing","item-states"])])])}}}),L_={key:0,class:"flex justify-center p-4"},H_={key:1,class:"p-4 text-center text-red-500"},W_={key:2,class:"flex justify-center"},j_={class:"!bg-white p-4 m-2 rounded-md w-max"},q_={key:3,class:"p-4 text-center text-gray-500"},X_={},qu=t.defineComponent({...X_,__name:"dynamic-configurator",props:{eventEmitter:{},settings:{},editor:{},cartItem:{},cartItems:{},category:{}},setup(n){const e=n,i=t.ref(!1),r=t.ref(null),o=t.ref(e.cartItem??null),s=t.ref(e.cartItems??null),a=h=>{const p=h.configuratorParams;return[new j.OrderItemBase({...h,quantity:h.quantity??1,marker:h.marker,configuratorParams:{width:(p==null?void 0:p.width)??h.width??0,length:(p==null?void 0:p.length)??h.length??0}})]},l=t.ref(e.editor===j.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var p,m,g;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const h={category:((p=e.cartItem)==null?void 0:p.category)??e.category,configurator:e.editor,quantity:1};switch(e.editor){case"kozyrek":{const b=e.settings;o.value=new j.OrderItemBase({...h,configuratorParams:{length:b.stripMinLength,linesAngles:[],linesWidths:[],startTailType:M.some(b.startTailConfigs,y=>y.isDefault)?(m=b.startTailConfigs)==null?void 0:m.findIndex(y=>y.isDefault):void 0,endTailType:M.some(b.endTailConfigs,y=>y.isDefault)?(g=b.endTailConfigs)==null?void 0:g.findIndex(y=>y.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const b=e.settings;o.value=new j.OrderItemBase({...h,configuratorParams:{width:0,height:0,netType:b.netType[0]||"",color:b.color[0]||"",mountType:b.mountType[0]||""}});break}case"strip":{const b=e.settings;s.value=[new j.OrderItemBase({...h,length:b.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const b=e.settings;o.value=new j.OrderItemBase({...h,configuratorParams:{width:b.minWidth,length:b.minLength}});break}case"sandwich":{o.value=new j.OrderItemBase({...h,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new j.OrderItemBase({...h,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(h,p,m)=>{const g=b=>{m==null||m(),b&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:h,callback:g,validation:p})},u=(h,p,m,g)=>{const b=h[0];if(!b){m==null||m();return}const y=(g==null?void 0:g.isFinalSuccessfulCompletion)===!0,_=k=>{m==null||m(k),y&&k&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:b,callback:_,validation:p,additionalParams:g})},f=()=>{e.category&&e.eventEmitter.emit("configurator:click-view-switch",{category:e.category})};return t.onMounted(()=>{!e.cartItem&&!e.cartItems&&c()}),(h,p)=>{const m=F.NSpin;return t.openBlock(),t.createElementBlock(t.Fragment,null,[i.value?(t.openBlock(),t.createElementBlock("div",L_,[t.createVNode(m,{size:"large"})])):r.value?(t.openBlock(),t.createElementBlock("div",H_,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0),n.settings!==null&&(o.value!==null||s.value!==null||l.value!==null)?(t.openBlock(),t.createElementBlock("div",W_,[t.createElementVNode("div",j_,[n.editor==="kozyrek"?(t.openBlock(),t.createBlock(Eu,{key:0,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="mosquitto"?(t.openBlock(),t.createBlock(Fu,{key:1,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="strip"?(t.openBlock(),t.createBlock(Au,{key:2,"event-emitter":n.eventEmitter,settings:n.settings,"cart-items":s.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-items"])):n.editor==="metal_for_doors"?(t.openBlock(),t.createBlock(zu,{key:3,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="sandwich"?(t.openBlock(),t.createBlock(Hu,{key:4,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="sandwich_m2"?(t.openBlock(),t.createBlock(ju,{key:5,"event-emitter":n.eventEmitter,settings:n.settings,"cart-items":l.value,"onClick:viewSwitch":f,onSubmit:u},null,8,["event-emitter","settings","cart-items"])):t.createCommentVNode("",!0)])])):(t.openBlock(),t.createElementBlock("div",q_,' Конфигуратор "'+t.toDisplayString(n.editor)+'" не поддерживается. ',1))],64)}}});function Xu(n){return Object.values(j.ConfiguratorsEnum).includes(n)}function Yu(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.Sandwich?!0:n.properties.configuratorSettings!==void 0&&M.isArray(n.products)&&n.products.length>0}const Y_={key:0,class:"pt-0.5"},U_={key:0},K_={class:"line-through"},G_={key:0},Z_={key:1},Q_={class:"flex flex-row gap-1"},J_={key:0},ew={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},tw={class:"flex flex-col gap-2.5 sm:flex-row"},nw={key:0,class:"header-extra"},iw={class:"inline-flex"},rw={class:"inline-flex"},ow={class:"inline-flex"},sw={class:"mt-2"},aw={key:1,class:"flex flex-col"},lw={},cw=t.defineComponent({...lw,__name:"category-collapse-item",props:{categoryItem:{},filteredItems:{},isCategoryItemSelected:{type:[Boolean,String,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},showConfigurator:{type:[Boolean,Function],default:!1},canShowConfigurator:{type:[Boolean,Function],default:!1},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},showProductInfoButton:{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(n){const e=n,i=t.inject(Br,"medium"),r=t.computed(()=>{var V;return(V=e==null?void 0:e.filteredItems)==null?void 0:V[e.categoryItem.id]}),o=t.computed(()=>{var V,A;return M.isArray((V=e.categoryItem)==null?void 0:V.categories)&&((A=e.categoryItem.categories)==null?void 0:A.length)>0}),s=t.computed(()=>{var V;return M.isArray((V=e.categoryItem)==null?void 0:V.products)?e.categoryItem.products:[]}),a=t.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([V,A])=>`${A} руб./${O(V)}`).join(", ")),l=t.computed(()=>M.isUndefined(e.filteredItems)||r.value==="*"?s.value:s.value.filter(V=>{var ie;const A=(ie=r.value)==null?void 0:ie.products;return M.isArray(A)&&A.includes(V.id)})),c=t.computed(()=>l.value.length>0),d=t.computed(()=>M.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),u=t.computed(()=>M.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),f=t.computed(()=>M.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),h=t.computed(()=>{var ie,ce;const V=(ie=k.value)==null?void 0:ie.hidingComment,A=(ce=k.value)!=null&&ce.isDisabled?`Скрыто для клиента${V?`. Причина: '${V}'`:""}`:"Видимо клиенту";return d.value==="disabled"?`${A}. ${kr}`:A}),p=t.computed(()=>{var ie;const V=(ie=k.value)==null?void 0:ie.manager,A=V?`Категория закреплена за "${V.name??"-"}"`:"Закрепить";return u.value==="disabled"?`${A}. ${kr}`:A}),m=t.computed(()=>f.value==="disabled"?`${Cs}. ${kr}`:Cs),g=t.computed(()=>M.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),b=t.computed(()=>{var V,A,ie;return((V=e.categoryItem.properties)==null?void 0:V.configurator)!==void 0&&Xu((A=e.categoryItem.properties)==null?void 0:A.configurator)&&Yu(e.categoryItem)&&((ie=e.categoryItem.properties)==null?void 0:ie.configuratorSettings)!==void 0&&(M.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),y=t.computed(()=>b.value&&(M.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),_=t.computed(()=>M.isNil(e.categoryContextButtonsConfig)?[]:M.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),k=t.computed(()=>new j.ClientCategory(e.categoryItem)),x=t.ref(!1),v=t.ref(!1),B=t.computed(()=>!M.isUndefined(e.isCategoryItemSelected)),w=t.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),T=t.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),C=t.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),$=t.computed(()=>K.value&&Xe.getDeviceTypeByResolution()===je.laptop?"auto":"fixed"),E=t.useTemplateRef("collapse-item-reference"),I=t.computed(()=>{var V,A;return(A=(V=e.categoryItem.properties)==null?void 0:V.templateCost)==null?void 0:A.priceCoefficient}),R=t.computed(()=>{var V,A;return(A=(V=e.categoryItem.properties)==null?void 0:V.templateCost)==null?void 0:A.increasePercent}),O=(V,A="ru-RU")=>0 .toLocaleString(A,{style:"currency",currency:V,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),U=V=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:V,target:E.value})},Q=(V,A)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:A,isLoadingState:x,target:E.value})},G=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:E.value})},W=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:E.value})},D=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:E.value})},L=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:E.value})},z=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:E.value})},P=V=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:V,target:E.value})},q=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},K=t.ref(0),J=t.computed(()=>K.value&&s.value.length>0?Qg(s.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),Y=M.debounce(()=>{K.value=window.innerWidth},20);return t.onUnmounted(()=>{window.removeEventListener("resize",Y),Y.cancel()}),window.addEventListener("resize",Y),Y(),(V,A)=>{const ie=F.NCheckbox,ce=up,pe=F.NTooltip,at=lp,we=F.NTag,ke=op,kt=np,Ne=F.NButton,Jt=Jm,wn=Ql,Pt=Zl,ni=Gl,On=$s,cn=F.NDropdown,pt=F.NDataTable,se=F.NAlert,de=F.NSpin;return t.openBlock(),t.createBlock(Jl,{ref:"collapse-item-reference",name:n.categoryItem.id,"data-id":n.categoryItem.id,"onHeader:click":Q},{"pre-arrow":t.withCtx(()=>{var Re,qe;return[B.value?(t.openBlock(),t.createElementBlock("div",Y_,[t.createVNode(ie,{checked:w.value,indeterminate:C.value,disabled:T.value,"onUpdate:checked":U},null,8,["checked","indeterminate","disabled"])])):t.createCommentVNode("",!0),!d.value&&((Re=k.value)!=null&&Re.isDisabled)?(t.openBlock(),t.createBlock(pe,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(ce,{class:"pt-1.5"})]),default:t.withCtx(()=>[A[1]||(A[1]=t.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):t.createCommentVNode("",!0),((qe=k.value)==null?void 0:qe.isFavorite)??!1?(t.openBlock(),t.createBlock(pe,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(at,{class:"pt-1.5"})]),default:t.withCtx(()=>[A[2]||(A[2]=t.createTextVNode(" Избранная категория ",-1))]),_:1})):t.createCommentVNode("",!0)]}),header:t.withCtx(()=>{var Re,qe,dn,Kt,ii;return[t.createElementVNode("div",{class:t.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":n.categoryItem.isHidden,"text-gray-400":(Re=k.value)==null?void 0:Re.isDisabled})},[t.createVNode(pe,{disabled:!n.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",null,t.toDisplayString(n.categoryItem.name),1)]),default:t.withCtx(()=>[A[3]||(A[3]=t.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),t.createElementVNode("div",{class:"w-fit",onClick:A[0]||(A[0]=t.withModifiers((...it)=>t.unref(M.noop)&&t.unref(M.noop)(...it),["prevent","stop"]))},[(qe=n.categoryItem.properties)!=null&&qe.m2Price?(t.openBlock(),t.createBlock(we,{key:0,size:t.unref(i),class:t.normalizeClass({"!pr-0":((dn=n.categoryItem.properties)==null?void 0:dn.templateCost)&&n.categoryItem.properties.m2PriceRetail&&R.value}),round:""},{default:t.withCtx(()=>{var it;return[t.createTextVNode(" Установленная стоимость: "+t.toDisplayString(n.categoryItem.properties.m2Price)+" руб./м2 ",1),(it=n.categoryItem.properties)!=null&&it.templateCost&&n.categoryItem.properties.m2PriceRetail&&R.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[R.value?(t.openBlock(),t.createBlock(we,{key:0,type:"success",bordered:!1,size:t.unref(i),class:"ml-2 !pr-0",round:""},{default:t.withCtx(()=>[R.value?(t.openBlock(),t.createElementBlock("span",U_,t.toDisplayString(R.value.toFixed(2))+"%",1)):t.createCommentVNode("",!0),t.createVNode(we,{size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createElementVNode("span",K_,t.toDisplayString(n.categoryItem.properties.m2PriceRetail)+" руб./м2",1)]),_:1},8,["size"])]),_:1},8,["size"])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)]}),_:1},8,["size","class"])):(Kt=n.categoryItem.properties)!=null&&Kt.templateCost?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[I.value||R.value?(t.openBlock(),t.createBlock(we,{key:0,size:t.unref(i),round:""},{default:t.withCtx(()=>{var it;return[I.value?(t.openBlock(),t.createElementBlock("span",G_,t.toDisplayString((it=I.value)==null?void 0:it.name),1)):t.createCommentVNode("",!0),R.value?(t.openBlock(),t.createElementBlock("span",Z_,t.toDisplayString(R.value>0?"+":"")+t.toDisplayString(R.value.toFixed(2))+"%",1)):t.createCommentVNode("",!0)]}),_:1},8,["size"])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),a.value?(t.openBlock(),t.createBlock(we,{key:2,size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createTextVNode(" Фиксированный курс: "+t.toDisplayString(a.value),1)]),_:1},8,["size"])):t.createCommentVNode("",!0),u.value&&((ii=k.value)!=null&&ii.manager)?(t.openBlock(),t.createBlock(we,{key:3,size:t.unref(i),closable:u.value!=="disabled",round:"",class:"align-bottom",onClose:L},{default:t.withCtx(()=>[t.createVNode(pe,{placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>{var it,en;return[t.createElementVNode("span",Q_,[t.createVNode(ke),t.createTextVNode(" "+t.toDisplayString((en=(it=k.value)==null?void 0:it.manager)==null?void 0:en.name),1)])]}),default:t.withCtx(()=>{var it,en;return[t.createTextVNode(' Категория закреплена за "'+t.toDisplayString((en=(it=k.value)==null?void 0:it.manager)==null?void 0:en.name)+'" ',1)]}),_:1})]),_:1},8,["size","closable"])):t.createCommentVNode("",!0)])]}),"sub-header":t.withCtx(()=>[n.showSlugs||n.showProperties?(t.openBlock(),t.createElementBlock("div",J_,[t.createElementVNode("ul",ew,[n.showSlugs?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList({id:n.categoryItem.id,slug:n.categoryItem.slug},(Re,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(Re),1))),128)):t.createCommentVNode("",!0),n.showProperties?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.categoryItem.properties,(Re,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(Re),1))),128)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)]),"header-extra":t.withCtx(()=>{var Re;return[t.createElementVNode("div",tw,[V.$slots["header-extra"]?(t.openBlock(),t.createElementBlock("div",nw,[t.renderSlot(V.$slots,"header-extra",{categoryItem:n.categoryItem},void 0,!0)])):t.createCommentVNode("",!0),d.value?(t.openBlock(),t.createBlock(pe,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",iw,[t.createVNode(Ne,{ghost:!0,disabled:d.value==="disabled",size:t.unref(i),onClick:G},{default:t.withCtx(()=>{var qe;return[(qe=k.value)!=null&&qe.isDisabled?(t.openBlock(),t.createBlock(ce,{key:1})):(t.openBlock(),t.createBlock(kt,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(h.value),1)]),_:1})):t.createCommentVNode("",!0),u.value&&!((Re=k.value)!=null&&Re.manager)?(t.openBlock(),t.createBlock(pe,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",rw,[t.createVNode(Ne,{ghost:!0,disabled:u.value==="disabled",size:t.unref(i),onClick:D},{default:t.withCtx(()=>[t.createVNode(Jt)]),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(p.value),1)]),_:1})):t.createCommentVNode("",!0),f.value?(t.openBlock(),t.createBlock(pe,{key:3,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",ow,[t.createVNode(Ne,{ghost:!0,disabled:f.value==="disabled",size:t.unref(i),onClick:W},{default:t.withCtx(()=>{var qe;return[(qe=k.value)!=null&&qe.isRequired?(t.openBlock(),t.createBlock(Pt,{key:1})):(t.openBlock(),t.createBlock(wn,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(m.value),1)]),_:1})):t.createCommentVNode("",!0),g.value?(t.openBlock(),t.createBlock(pe,{key:4,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(Ne,{ghost:!0,size:t.unref(i),type:"primary",onClick:z},{default:t.withCtx(()=>[t.createVNode(ni)]),_:1},8,["size"])]),default:t.withCtx(()=>[A[4]||(A[4]=t.createTextVNode(" Редактировать ",-1))]),_:1})):t.createCommentVNode("",!0),_.value.length>0?(t.openBlock(),t.createBlock(cn,{key:5,options:_.value,size:t.unref(i),trigger:"click",onSelect:P},{default:t.withCtx(()=>[t.createVNode(Ne,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(On)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)])]}),default:t.withCtx(()=>[t.renderSlot(V.$slots,"default",{},()=>{var Re,qe,dn;return[t.createElementVNode("div",sw,[o.value?(t.openBlock(),t.createBlock(Ku,{key:0,"categories-items":n.categoryItem.categories??[],"has-products":c.value||x.value,"event-emitter":n.eventEmitter,"filtered-items":r.value?((Re=r.value)==null?void 0:Re.categories)??{}:void 0,"is-category-item-selected":n.isCategoryItemSelected,"show-slugs":n.showSlugs,"show-properties":n.showProperties,"allow-name-click":n.allowNameClick,"allow-price-click":n.allowPriceClick,"show-price-history":n.showPriceHistory,"show-cost-date":n.showCostDate,"show-product-info-button":n.showProductInfoButton,"show-category-required-button":n.showCategoryRequiredButton,"show-category-hide-for-client-button":n.showCategoryHideForClientButton,"show-category-pin-button":n.showCategoryPinButton,"show-category-edit-button":n.showCategoryEditButton,"category-context-buttons-config":n.categoryContextButtonsConfig,"is-product-item-selected":n.isProductItemSelected,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-costs":n.showProductCosts,"show-product-required-button":n.showProductRequiredButton,"show-product-edit-button":n.showProductEditButton,"product-context-buttons-config":n.productContextButtonsConfig,"show-configurator":n.showConfigurator,"can-show-configurator":n.canShowConfigurator},t.createSlots({_:2},[V.$slots["header-extra"]?{name:"header-extra",fn:t.withCtx(({categoryItem:Kt})=>[t.renderSlot(V.$slots,"header-extra",{categoryItem:Kt},void 0,!0)]),key:"0"}:void 0]),1032,["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-product-info-button","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","show-configurator","can-show-configurator"])):t.createCommentVNode("",!0)]),b.value&&y.value?(t.openBlock(),t.createBlock(qu,{key:0,"event-emitter":n.eventEmitter,settings:(qe=n.categoryItem.properties)==null?void 0:qe.configuratorSettings,editor:(dn=n.categoryItem.properties)==null?void 0:dn.configurator,category:n.categoryItem},null,8,["event-emitter","settings","editor","category"])):c.value?(t.openBlock(),t.createElementBlock("div",aw,[b.value?(t.openBlock(),t.createBlock(Ne,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:q},{default:t.withCtx(()=>[...A[5]||(A[5]=[t.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createVNode(pt,{columns:J.value,data:l.value,bordered:!0,loading:x.value,remote:!0,"row-key":Kt=>Kt.id,"table-layout":$.value,class:"mt-2"},null,8,["columns","data","loading","row-key","table-layout"])])):t.createCommentVNode("",!0),!x.value&&!v.value&&!o.value&&!c.value?(t.openBlock(),t.createBlock(se,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):t.createCommentVNode("",!0),v.value?(t.openBlock(),t.createBlock(se,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):t.createCommentVNode("",!0),x.value?(t.openBlock(),t.createBlock(de,{key:4,size:t.unref(i),class:"w-full"},{description:t.withCtx(()=>[...A[6]||(A[6]=[t.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):t.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),dw=fn(cw,[["__scopeId","data-v-a02c9f27"]]),uw={class:"sc-collapse flex w-full flex-col"},fw={},Uu=t.defineComponent({...fw,__name:"collapse",props:{defaultExpandedNames:{default:()=>[]},expandedNames:{default:()=>[]}},emits:["on-item-header-click"],setup(n,{emit:e}){const i=n,r=e,o=(s,a)=>{r("on-item-header-click",s,a)};return t.provide("itemHeaderClickHandler",o),t.provide("defaultExpandedNames",i.defaultExpandedNames),t.provide("expandedNames",i.expandedNames),(s,a)=>(t.openBlock(),t.createElementBlock("div",uw,[t.renderSlot(s.$slots,"default")]))}}),hw={},Ku=t.defineComponent({...hw,__name:"category-collapse",props:{categoriesItems:{},hasProducts:{type:Boolean},loading:{type:Boolean,default:!1},client:{default:void 0},filteredItems:{default:void 0},isCategoryItemSelected:{type:[Boolean,String,Function],default:void 0},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},showConfigurator:{type:[Boolean,Function]},canShowConfigurator:{type:[Boolean,Function]},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},showProductInfoButton:{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(n){const e=n,i=t.inject(Br,"medium"),r=t.computed(()=>M.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(M.isUndefined(a))return;const l=a[s.id];if(l==="*")return;const c={};return c[s.id]=structuredClone(t.toRaw(l)),c};return(s,a)=>{const l=F.NSpin,c=F.NAlert;return t.openBlock(),t.createElementBlock(t.Fragment,null,[r.value.length>0?(t.openBlock(),t.createBlock(Uu,{key:0},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,d=>(t.openBlock(),t.createBlock(dw,{key:d.id,"category-item":d,"event-emitter":n.eventEmitter,"filtered-items":o(d,n.filteredItems),"is-category-item-selected":n.isCategoryItemSelected,"show-slugs":n.showSlugs,"show-properties":n.showProperties,"allow-name-click":n.allowNameClick,"allow-price-click":n.allowPriceClick,"show-price-history":n.showPriceHistory,"show-cost-date":n.showCostDate,"show-product-info-button":n.showProductInfoButton,"show-category-required-button":n.showCategoryRequiredButton,"show-category-hide-for-client-button":n.showCategoryHideForClientButton,"show-category-pin-button":n.showCategoryPinButton,"show-category-edit-button":n.showCategoryEditButton,"category-context-buttons-config":n.categoryContextButtonsConfig,"is-product-item-selected":n.isProductItemSelected,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-costs":n.showProductCosts,"show-product-required-button":n.showProductRequiredButton,"show-product-edit-button":n.showProductEditButton,"product-context-buttons-config":n.productContextButtonsConfig,"show-configurator":n.showConfigurator,"can-show-configurator":n.canShowConfigurator},t.createSlots({_:2},[s.$slots["header-extra"]?{name:"header-extra",fn:t.withCtx(({categoryItem:u})=>[t.renderSlot(s.$slots,"header-extra",{categoryItem:u})]),key:"0"}:void 0]),1032,["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-product-info-button","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","show-configurator","can-show-configurator"]))),128))]),_:3})):n.loading?(t.openBlock(),t.createBlock(l,{key:1,size:t.unref(i),class:"w-full"},{description:t.withCtx(()=>[...a[0]||(a[0]=[t.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):t.createCommentVNode("",!0),!n.hasProducts&&!n.loading&&n.categoriesItems.length>0&&r.value.length===0?(t.openBlock(),t.createBlock(c,{key:2,"show-icon":!0,type:"warning",title:"Товары не найдены",class:"mx-10"})):t.createCommentVNode("",!0)],64)}}}),mw={},Gu=t.defineComponent({...mw,__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,default:!1},referenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1},sortOptionsByLabel:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},maxTagCount:{default:void 0},disabledItem:{type:Function,default:void 0}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>M.isArray(r.value)),a=new j.Reference,l=t.computed(()=>M.isNil(r.value)?s.value?[]:null:M.isArray(r.value)?r.value.filter(m=>!M.isNil(m)).map(m=>m.id):r.value.id),c=t.computed(()=>gt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue,void 0,r.disabledItem)),d=t.computed(()=>c.value.map(m=>({...m,class:r.wrapContent?`${m.class} consistent-menu-width`:m.class}))),u=m=>{var g;if(M.isArray(m)){const b=m.length>0?m.map(y=>{var _;return(_=c.value.find(k=>k.value===y))==null?void 0:_.item}).filter(y=>!M.isNil(y)):[];o("update:value",b)}else{const b=m===a.id||M.isNil(m)||(g=c.value.find(y=>y.value===m))==null?void 0:g.item;o("update:value",b)}},f=t.useTemplateRef("select-component");return e({focus:()=>{var m;return(m=f.value)==null?void 0:m.focus()},blur:()=>{var m;return(m=f.value)==null?void 0:m.blur()}}),(m,g)=>(t.openBlock(),t.createBlock(t.unref(F.NSelect),{ref:"select-component",value:l.value,clearable:r.clearable,"consistent-menu-width":n.consistentMenuWidth,disabled:n.disabled||c.value.length===0,filterable:n.filterable,"max-tag-count":n.maxTagCount,multiple:s.value,options:d.value,placeholder:"",class:"w-full","onUpdate:value":u},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),pw={},gw=t.defineComponent({...pw,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{},disabledCoefficient:{type:Function},visibleCoefficient:{type:Function}},emits:["update:value"],setup(n,{emit:e}){var x,v;const i=n,r=e,o=()=>{const B=j.PriceCoefficient.getRetailPriceCoefficient();return M.unset(B,"isNewRec"),B},s=B=>!B||B.id===o().id,a=t.computed(()=>{var B;return((B=i.catalogItem)==null?void 0:B.type)==="product"}),l=t.computed(()=>a.value?i.catalogItem:void 0),c=B=>{var w,T,C,$;return B.id===o().id?(w=l.value)==null?void 0:w.getRetailCost():($=(C=(T=l.value)==null?void 0:T.priceCoefficients)==null?void 0:C.find(E=>E.coefficient.id===B.id))==null?void 0:$.cost},d=t.computed(()=>{var T;const w=[...((T=j.useReferencesStore().priceCoefficientsReference)==null?void 0:T.map(C=>structuredClone(t.toRaw(C))))??[],o()].filter(C=>{var $;return(($=i.visibleCoefficient)==null?void 0:$.call(i,C))??!0});return a.value&&w.forEach(C=>{var E;const $=c(C);$?C.name+=` (${$} ${(E=l.value)==null?void 0:E.currency.symbol})`:C.name=""}),w.filter(C=>C.name!=="")}),u=t.ref(i.value.coefficient),f=t.ref(((v=(x=i.value)==null?void 0:x.value)==null?void 0:v.toString())??null),h=t.ref(null),p=t.computed(()=>{var B,w;return(w=(B=l.value)==null?void 0:B.priceCoefficients)==null?void 0:w.find(T=>T.coefficient.slug===j.PriceCoefficientEnum.K0)}),m=t.ref(void 0),g=B=>Number.parseFloat((B??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),b=()=>{var w,T;m.value=void 0;let B=g(f.value);if(B=Number.isNaN(B)?void 0:B,a.value)if(u.value||f.value){const C=o(),$=c(u.value??C)??0,E=$+$*((B??0)/100);h.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(E),E>(((w=l.value)==null?void 0:w.getRetailCost())??E)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),p.value&&E<(((T=p.value)==null?void 0:T.cost)??0)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else h.value=null;r("update:value",{value:Number.isNaN(B)?void 0:B,coefficient:s(u.value)?void 0:structuredClone(t.toRaw(u.value))})},y=B=>{M.isArray(B)||M.isNull(B)||(u.value=B,f.value=null,!u.value&&f.value&&(u.value=o()),b())},_=()=>{u.value||(u.value=o()),b()},k=B=>{var T,C,$,E,I;const w=g(B);if(a.value){if(Number.isNaN(w)){u.value=void 0,f.value=null,r("update:value",{value:void 0,coefficient:void 0});return}let R=0;if(w<=0)u.value=void 0,f.value=null;else if(p.value&&w<(((T=p.value)==null?void 0:T.cost)??0))u.value=(C=p.value)==null?void 0:C.coefficient,R=(w-p.value.cost)*100/p.value.cost,m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(w>((($=l.value)==null?void 0:$.getRetailCost())??w)){u.value=o();const O=((E=l.value)==null?void 0:E.getRetailCost())??0;R=(w-O)*100/O,m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const O=((I=l.value)==null?void 0:I.priceCoefficients)??[],U=M.sortBy(O,[W=>W.cost]),G=U.filter(W=>W.cost<=w).at(-1)??U.at(0);G&&(u.value=G.coefficient,R=(w-G.cost)*100/G.cost),m.value={validationStatus:void 0,feedback:void 0}}f.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:5}).format(R),r("update:value",{value:Number.isNaN(R)?void 0:R,coefficient:s(u.value)?void 0:structuredClone(t.toRaw(u.value))})}else r("update:value",{value:Number.isNaN(w)?void 0:w,coefficient:void 0})};return t.onMounted(()=>{var B,w,T,C;i.calculationType===j.CalculationTypeEnum.m2Cost?h.value=((w=(B=i.value)==null?void 0:B.value)==null?void 0:w.toString())??null:!((T=i.value)!=null&&T.coefficient)&&((C=i.value)!=null&&C.value)&&(u.value=o()),b()}),(B,w)=>{var $,E,I;const T=F.NInput,C=F.NInputGroup;return t.openBlock(),t.createBlock(t.unref(F.NFormItem),{"show-label":!t.unref(M.isNil)(n.label),label:n.label,"show-feedback":!t.unref(M.isNil)((($=m.value)==null?void 0:$.feedback)??n.feedback),feedback:((E=m.value)==null?void 0:E.feedback)??n.feedback,"validation-status":((I=m.value)==null?void 0:I.validationStatus)??n.validationStatus},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass([{"sm:grid-cols-3":a.value&&n.calculationType!==t.unref(j.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[n.calculationType!==t.unref(j.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(C,{key:0,class:t.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:t.withCtx(()=>[t.createVNode(Gu,{class:"w-full min-w-0 flex-1",value:u.value,"reference-list":d.value,clearable:n.clearable,disabled:n.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"disabled-item":n.disabledCoefficient,"onUpdate:value":y},null,8,["value","reference-list","clearable","disabled","disabled-item"]),t.createVNode(T,{value:f.value,"onUpdate:value":[w[0]||(w[0]=R=>f.value=R),_],clearable:n.clearable,disabled:n.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},t.createSlots({suffix:t.withCtx(()=>[w[3]||(w[3]=t.createTextVNode("%",-1))]),_:2},[f.value&&!f.value.startsWith("-")?{name:"prefix",fn:t.withCtx(()=>[w[2]||(w[2]=t.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):t.createCommentVNode("",!0),a.value||n.calculationType===t.unref(j.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(T,{key:1,value:h.value,"onUpdate:value":[w[1]||(w[1]=R=>h.value=R),k],clearable:n.clearable,disabled:n.disabled,placeholder:"Стоимость",class:"w-full"},t.createSlots({_:2},[a.value?{name:"suffix",fn:t.withCtx(()=>{var R;return[t.createTextVNode(t.toDisplayString((R=l.value)==null?void 0:R.currency.symbol),1)]}),key:"0"}:void 0]),1032,["value","clearable","disabled"])):t.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),yw={class:"text-sm"},bw={class:"text-sm"},_w={},ww=t.defineComponent({..._w,__name:"add-product-to-cart-dialog",emits:["submit"],setup(n,{expose:e,emit:i}){const r=t.useTemplateRef("form-reference"),o=t.useTemplateRef("base-dialog-reference"),s=t.ref(!1),a=t.ref(null),l=t.computed(()=>{var R,O,U;return((R=a.value)==null?void 0:R.unit.isLinear)&&((U=(O=a.value)==null?void 0:O.properties)==null?void 0:U.isLengthConfigurator)}),c=t.computed(()=>a.value?j.UnitsHelper.productIsMeasurable(a.value)||l.value?"шт.":a.value.unit.name:"шт."),d=t.ref(void 0),u=t.ref(void 0),f=t.ref(!0),h=t.ref(null),p=t.computed({get:()=>{var R;return((R=h.value)==null?void 0:R.quantity)??null},set:R=>{h.value&&(h.value.quantity=R??0)}}),m=t.computed({get:()=>{var R;return((R=h.value)==null?void 0:R.length)??null},set:R=>{h.value&&(h.value.length=R??void 0)}}),g=R=>{h.value&&(h.value.marker=R??void 0)},b=i,y=()=>({length:{},quantity:{},marker:{}}),_=t.ref(y()),k=t.ref(!1),x=t.computed(()=>{var G,W,D,L;if(!a.value)return{};const R=j.UnitsHelper.getProductLengthMultiplicity(a.value),O=j.UnitsHelper.getProductMultiplicity(a.value),U=((W=(G=a.value)==null?void 0:G.properties)==null?void 0:W.minLength)||R,Q=(L=(D=a.value)==null?void 0:D.properties)==null?void 0:L.maxLength;return{length:[le.required,le.min(U??.1),le.max(Q),le.step(R),He.serverValidation(_.value.length.feedback)],quantity:[le.required,le.min(O),le.step(O),He.serverValidation(_.value.quantity.feedback)],marker:[He.serverValidation(_.value.marker.feedback)]}}),v=t.computed(()=>{var R,O,U;return a.value?((R=a.value.properties)==null?void 0:R.lengthStep)??((O=a.value.properties)!=null&&O.ignoreMinCountCheck?0:((U=a.value.properties)==null?void 0:U.minCount)??0):0}),B=t.computed(()=>{var U,Q,G,W,D,L,z,P,q;if(!a.value)return"";const R=((Q=(U=a.value)==null?void 0:U.properties)==null?void 0:Q.minLength)??((W=(G=a.value)==null?void 0:G.properties)!=null&&W.ignoreMinCountCheck?0:(L=(D=a.value)==null?void 0:D.properties)==null?void 0:L.minCount),O=(P=(z=a.value)==null?void 0:z.properties)==null?void 0:P.maxLength;return R||O?`(${R?`от ${R}`:""}${R&&O?" ":""}${O?`до ${O}`:""} ${(q=a.value)==null?void 0:q.unit.name})`:""}),w=R=>{var W,D;if(!((D=(W=a.value)==null?void 0:W.properties)!=null&&D.isLengthConfigurator)||!h.value||M.isNil(R)||v.value===0)return;const O=R/v.value,U=Math.round(O),Q=j.UnitsHelper.getProductMultiplicity(a.value),G=Math.max(U,Q);h.value.quantity=G},T=R=>{var G,W,D,L;if(!((W=(G=a.value)==null?void 0:G.properties)!=null&&W.isLengthConfigurator)||!h.value||M.isNil(R)||v.value===0)return;const O=R*v.value,U=((D=a.value.properties)==null?void 0:D.minLength)||j.UnitsHelper.getProductLengthMultiplicity(a.value),Q=(L=a.value.properties)==null?void 0:L.maxLength;U!==void 0&&O<U?h.value.length=U:Q!==void 0&&O>Q?h.value.length=Q:h.value.length=O},C=async R=>{var U;const O=M.cloneDeep(h.value);try{await((U=r.value)==null?void 0:U.validate(Q=>{if(!Q){if(!a.value||!O)return;j.UnitsHelper.productIsMeasurable(a.value)||delete O.length,l.value&&v.value&&(O.length=v.value),k.value=!0,b("submit",O,_.value,()=>{k.value=!1,R(!1),t.nextTick(()=>{var G;(G=r.value)==null||G.validate(M.noop).catch(M.noop)})})}}))}catch{}},$=()=>{a.value=null,d.value=void 0,h.value=null,_.value=y()},E=()=>{s.value=!1};return e({show:(R,O)=>{var U,Q,G,W,D;if($(),s.value=!0,a.value=R,d.value=O==null?void 0:O.cartItemData,u.value=O==null?void 0:O.orderId,f.value=(O==null?void 0:O.canSetDopProdaga)??!1,h.value=new j.OrderItemBase((O==null?void 0:O.cartItemData)??new j.OrderItemBase({product:R,quantity:j.UnitsHelper.productIsMeasurable(a.value)?1:((U=R==null?void 0:R.properties)==null?void 0:U.minCount)??1,length:((Q=R==null?void 0:R.properties)==null?void 0:Q.minLength)||((G=R==null?void 0:R.properties)!=null&&G.ignoreMinCountCheck?0:(W=R==null?void 0:R.properties)==null?void 0:W.minCount)||0})),(D=R==null?void 0:R.properties)!=null&&D.isLengthConfigurator&&h.value&&v.value>0){const L=v.value,z=h.value.quantity||1;h.value.length=z*L}},closeDialog:E}),(R,O)=>{var D;const U=F.NFormItem,Q=F.NInputGroupLabel,G=F.NInputGroup,W=F.NCheckbox;return t.openBlock(),t.createBlock(Ps,{ref:"base-dialog-reference",show:s.value,title:`${d.value?"Изменение":"Добавление"} товара ${(D=a.value)==null?void 0:D.name} в ${u.value?` заказ №${u.value}`:"корзину"}`,"accept-button":{show:!0,text:d.value?"Изменить":"Добавить"},processing:k.value,"modal-width":500,onAccept:C,onClosing:E},{default:t.withCtx(()=>[a.value&&h.value?t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{key:0,ref:"form-reference",model:h.value,rules:x.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.unref(j.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(U,{key:0,path:"length",label:`Метраж, ${B.value+a.value.unit.name}`},t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:m.value,"onUpdate:value":[O[0]||(O[0]=L=>m.value=L),w],parse:t.unref(ct),step:t.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:O[1]||(O[1]=L=>t.unref(ao)(L,".",!1)),onInput:O[2]||(O[2]=L=>t.unref(ot)(_.value,"length")),onFocus:t.unref(Le)},null,8,["value","parse","step","onFocus"])]),_:2},[!_.value.length.feedback&&t.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",yw,"Метраж должно быть кратно "+t.toDisplayString(t.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)),1)]),key:"0"}:void 0]),1032,["label"])):t.createCommentVNode("",!0),t.createVNode(U,{path:"quantity",label:`Количество, ${c.value}`},{default:t.withCtx(()=>[t.createVNode(G,null,t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:p.value,"onUpdate:value":[O[3]||(O[3]=L=>p.value=L),T],parse:t.unref(ct),step:t.unref(j.UnitsHelper).getProductMultiplicity(a.value),"show-button":t.unref(j.UnitsHelper).getProductMultiplicity(a.value)>1,"button-placement":"both",placeholder:"Введите количество",class:"w-full",onKeydown:O[4]||(O[4]=L=>t.unref(ao)(L,".",!1)),onInput:O[5]||(O[5]=L=>t.unref(ot)(_.value,"quantity")),onFocus:t.unref(Le)},null,8,["value","parse","step","show-button","onFocus"]),l.value?(t.openBlock(),t.createBlock(Q,{key:0,class:"bg-orange-100 font-bold"},{default:t.withCtx(()=>[t.createTextVNode(" x "+t.toDisplayString(v.value)+" "+t.toDisplayString(a.value.unit.name),1)]),_:1})):t.createCommentVNode("",!0)]),_:2},[!_.value.quantity.feedback&&t.unref(j.UnitsHelper).getProductMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",bw,"Количество должно быть кратно "+t.toDisplayString(t.unref(j.UnitsHelper).getProductMultiplicity(a.value)),1)]),key:"0"}:void 0]),1024)]),_:1},8,["label"]),t.unref(j.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(U,{key:1,path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:h.value.marker??null,placeholder:"Введите маркировку",onInput:O[6]||(O[6]=L=>t.unref(ot)(_.value,"marker")),"onUpdate:value":O[7]||(O[7]=L=>g(L)),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1})):t.createCommentVNode("",!0),f.value?(t.openBlock(),t.createBlock(W,{key:2,checked:h.value.isAdditionalSale,"onUpdate:checked":O[8]||(O[8]=L=>h.value.isAdditionalSale=L),"true-value":!0,"false-value":!1},{default:t.withCtx(()=>[...O[9]||(O[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0)]),_:1},8,["model","rules"])),[[t.unref(oi),()=>{var L,z;return(z=(L=o.value)==null?void 0:L.acceptHandler)==null?void 0:z.call(L)}]]):t.createCommentVNode("",!0)]),_:1},8,["show","title","accept-button","processing"])}}}),xw={class:"flex flex-row gap-1"},kw={class:"sc-client-name flex flex-col gap-1 text-base"},Cw=["href"],vw={key:1,class:"text-sc-grey"},Sw={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Bw={key:0},Nw={key:1,class:"text-sm"},Tw={},Ir=t.defineComponent({...Tw,__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(n,{emit:e}){const i=n,r=e,o=t.computed(()=>i.client.lastLoginAt?xe.format(i.client.lastLoginAt,j.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{M.isNil(i.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",i.client,a)};return(a,l)=>{const c=lo,d=F.NButton,u=F.NPopover;return t.openBlock(),t.createElementBlock("div",xw,[n.showClientInfoIcon?(t.openBlock(),t.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=f=>a.$emit("click:client-info",n.client))},{default:t.withCtx(()=>[t.createVNode(c)]),_:1})):t.createCommentVNode("",!0),t.createVNode(u,{disabled:t.unref(M.isNil)(n.popoverPosition),placement:n.popoverPosition},{trigger:t.withCtx(()=>[t.createElementVNode("div",kw,[t.createElementVNode("a",{href:n.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=f=>s(f))},[t.createElementVNode("span",{class:t.normalizeClass({"line-through":!n.client.isActive})},t.toDisplayString(n.client.name),3),n.showSalesDirection&&n.client.salesDirection?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass({"line-through":!n.client.isActive})}," ("+t.toDisplayString(n.client.salesDirection.name)+") ",3)):t.createCommentVNode("",!0),n.client.isActive?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",vw," [ Деактивирован ] "))],8,Cw),n.showCityAndRegion&&n.client.city?(t.openBlock(),t.createElementBlock("span",Sw," г. "+t.toDisplayString(n.client.city.name)+", "+t.toDisplayString(n.client.city.region.name),1)):t.createCommentVNode("",!0)])]),default:t.withCtx(()=>[n.client.alternativeName?(t.openBlock(),t.createElementBlock("div",Bw,t.toDisplayString(n.client.alternativeName),1)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("span",Nw," Последний вход: "+t.toDisplayString(o.value),1)):t.createCommentVNode("",!0),t.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),$w={class:"text-base"},Ew={},Zu=t.defineComponent({...Ew,__name:"contragent-with-short-info",props:{contragent:{}},setup(n){const e=n,i=t.computed(()=>si.getFormatEntityName(e.contragent));return(r,o)=>(t.openBlock(),t.createElementBlock("span",$w,t.toDisplayString(i.value),1))}}),Rw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Pw(n,e){return t.openBlock(),t.createElementBlock("svg",Rw,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.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"}),t.createElementVNode("path",{d:"m3 7l9 6l9-6"})],-1)])])}const Fw=t.markRaw({name:"tabler-mail",render:Pw}),Vw=["href"],Mw={},Iw=t.defineComponent({...Mw,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(n){return(e,i)=>{const r=Fw;return t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass({"flex flex-row items-center gap-1":n.showEmailIcon})},[n.showEmailIcon?(t.openBlock(),t.createBlock(r,{key:0})):t.createCommentVNode("",!0),t.createElementVNode("a",{href:`mailto:${n.email}`,class:"no-underline"},t.toDisplayString(n.email),9,Vw)],2)}}}),Aw={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Ow(n,e){return t.openBlock(),t.createElementBlock("svg",Aw,[...e[0]||(e[0]=[t.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 Qu=t.markRaw({name:"fa6-brands-viber",render:Ow}),zw={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},Dw=["id"],Lw=["id"],Hw=["fill"],Ww=["fill"];function jw(n,e){return t.openBlock(),t.createElementBlock("svg",zw,[t.createElementVNode("defs",null,[t.createElementVNode("linearGradient",{id:n.idMap.SVGBRLHCcSy,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[0]||(e[0]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#1FAF38"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#60D669"},null,-1)])],8,Dw),t.createElementVNode("linearGradient",{id:n.idMap.SVGHW6lecxh,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[1]||(e[1]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#F9F9F9"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#FFF"},null,-1)])],8,Lw)]),t.createElementVNode("path",{fill:"url(#"+n.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,Hw),t.createElementVNode("path",{fill:"url(#"+n.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,Ww),e[2]||(e[2]=t.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 Ju=t.markRaw({name:"logos-whatsapp-icon",render:jw,setup(){const n=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+n(),SVGHW6lecxh:"uicons-"+n()}}}}),qw={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},Xw=["id"],Yw=["fill"];function Uw(n,e){return t.openBlock(),t.createElementBlock("svg",qw,[t.createElementVNode("defs",null,[t.createElementVNode("linearGradient",{id:n.idMap.SVGuySfwdaH,x1:"50%",x2:"50%",y1:"0%",y2:"100%"},[...e[0]||(e[0]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#2AABEE"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#229ED9"},null,-1)])],8,Xw)]),t.createElementVNode("path",{fill:"url(#"+n.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,Yw),e[1]||(e[1]=t.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 ef=t.markRaw({name:"logos-telegram",render:Uw,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),Kw={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Gw(n,e){return t.openBlock(),t.createElementBlock("svg",Kw,[...e[0]||(e[0]=[t.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 tf=t.markRaw({name:"ion-call",render:Gw}),Zw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Qw(n,e){return t.openBlock(),t.createElementBlock("svg",Zw,[...e[0]||(e[0]=[t.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 Jw=t.markRaw({name:"tabler-phone-call",render:Qw}),ex={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},tx=["href"],nx=["href"],ix=["href"],rx=["href"],ox={},sx=t.defineComponent({...ox,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>{try{return e.phone?xr.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=t.computed(()=>{var l;return M.isString(i.value)?!1:((l=i.value)==null?void 0:l.isValid())??!1}),o=t.computed(()=>{var l;return M.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=t.computed(()=>{var l;return M.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("E.164"))??""}),a=t.ref(!1);return(l,c)=>{const d=Jw,u=tf,f=ef,h=Ju,p=Qu;return t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",{class:t.normalizeClass({"border-xl relative inline-flex items-center rounded px-2":r.value&&a.value,"min-w-10":!0}),onClick:c[0]||(c[0]=m=>a.value=!a.value),onFocusout:c[1]||(c[1]=m=>a.value=!1),onMouseleave:c[2]||(c[2]=m=>a.value=!1)},[t.createElementVNode("div",{class:t.normalizeClass({"flex flex-row items-center gap-1":n.showPhoneIcon})},[n.showPhoneIcon?(t.openBlock(),t.createBlock(d,{key:0})):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(o.value),1)],2),r.value&&a.value?(t.openBlock(),t.createElementBlock("div",ex,[r.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:`tel:${s.value}`,class:"text-blue-600 hover:animate-pulse hover:text-blue-600"},[t.createVNode(u)],8,tx)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:1,href:`https://t.me/${s.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[t.createVNode(f)],8,nx)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:2,href:`https://wa.me/${s.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[t.createVNode(h)],8,ix)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:3,href:`viber://chat?number=${s.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[t.createVNode(p)],8,rx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],34)])}}}),ax={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function lx(n,e){return t.openBlock(),t.createElementBlock("svg",ax,[...e[0]||(e[0]=[t.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 cx=t.markRaw({name:"mdi-envelope",render:lx}),dx={class:"flex flex-col gap-1"},ux={key:0,class:"mb-2 flex flex-col text-base"},fx={key:0,class:"text-sc-dark-grey text-sm"},hx={key:1,class:"whitespace-nowrap text-sm"},mx={key:2,class:"whitespace-nowrap text-sm"},px={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},gx=["href"],yx=["href"],bx=["href"],_x=["href"],wx=["href"],xx={key:0,class:"flex flex-col text-base"},kx={key:0,class:"text-sc-dark-grey text-sm"},Cx={key:1,class:"mt-2 text-sm"},vx={key:0,class:"-mt-1"},Sx={},Bx=t.defineComponent({...Sx,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(n){const e=n,i=t.computed(()=>si.getFormatEntityName(e.contact)),r=t.computed(()=>{try{return e.contact.phone?xr.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),o=t.computed(()=>{var d;return M.isString(r.value)?!1:((d=r.value)==null?void 0:d.isValid())??!1}),s=t.computed(()=>{var d;return M.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("INTERNATIONAL"))??""}),a=t.computed(()=>{var d;return M.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("E.164"))??""}),l=t.computed(()=>o.value||e.contact.email),c=t.ref(!1);return(d,u)=>{var y,_;const f=tf,h=ef,p=Ju,m=Qu,g=cx,b=F.NPopover;return t.openBlock(),t.createElementBlock("div",dx,[t.createVNode(b,{disabled:n.fullView,placement:"bottom"},{trigger:t.withCtx(()=>{var k,x,v,B;return[t.createElementVNode("div",{class:t.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(k=n.contact)!=null&&k.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${n.classes}`),style:t.normalizeStyle(n.styles),onMouseenter:u[0]||(u[0]=w=>c.value=!0),onFocusin:u[1]||(u[1]=w=>c.value=!0),onMouseleave:u[2]||(u[2]=w=>c.value=!1),onFocusout:u[3]||(u[3]=w=>c.value=!1)},[t.createElementVNode("div",null,[n.fullView&&(n.contact.name||(x=n.contact)!=null&&x.position)?(t.openBlock(),t.createElementBlock("div",ux,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(v=n.contact)!=null&&v.position?(t.openBlock(),t.createElementBlock("span",fx,t.toDisplayString((B=n.contact)==null?void 0:B.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),n.contact.phone?(t.openBlock(),t.createElementBlock("div",hx,t.toDisplayString(s.value),1)):t.createCommentVNode("",!0),n.contact.email?(t.openBlock(),t.createElementBlock("div",mx,t.toDisplayString(n.contact.email),1)):t.createCommentVNode("",!0),l.value&&c.value?(t.openBlock(),t.createElementBlock("div",px,[o.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:`tel:${a.value}`,class:"text-blue-600 hover:text-3xl hover:text-blue-600"},[t.createVNode(f)],8,gx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:1,href:`https://t.me/${a.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[t.createVNode(h)],8,yx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:2,href:`https://wa.me/${a.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[t.createVNode(p)],8,bx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:3,href:`viber://chat?number=${a.value}`,class:"text-purple-600 hover:text-3xl hover:text-purple-600"},[t.createVNode(m)],8,_x)):t.createCommentVNode("",!0),n.contact.email?(t.openBlock(),t.createElementBlock("a",{key:4,href:`mailto:${n.contact.email}`,class:"hover:text-3xl"},[t.createVNode(g)],8,wx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)])],38)]}),default:t.withCtx(()=>{var k,x,v,B;return[n.contact.name?(t.openBlock(),t.createElementBlock("div",xx,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(k=n.contact)!=null&&k.position?(t.openBlock(),t.createElementBlock("span",kx,t.toDisplayString((x=n.contact)==null?void 0:x.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),(v=n.contact)!=null&&v.comment?(t.openBlock(),t.createElementBlock("div",Cx,[u[4]||(u[4]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((B=n.contact)==null?void 0:B.comment),1)])):t.createCommentVNode("",!0)]}),_:1},8,["disabled"]),n.fullView&&((y=n.contact)!=null&&y.comment)?(t.openBlock(),t.createElementBlock("div",vx,[u[5]||(u[5]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((_=n.contact)==null?void 0:_.comment),1)])):t.createCommentVNode("",!0)])}}});class Nx{constructor(e){N(this,"minHeight");N(this,"maxHeights");N(this,"minWidth");N(this,"maxWidths");N(this,"netType");N(this,"color");N(this,"mountType");N(this,"descriptions");N(this,"crossbarCount");N(this,"heightOverlaps");N(this,"widthOverlaps");N(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=xs.objectToSnake(e.descriptions),this.maxHeights=e.maxHeights,this.maxWidths=e.maxWidths,this.minHeight=e.minHeight,this.minWidth=e.minWidth,this.mountType=e.mountType,this.netType=e.netType,this.heightOverlaps=xs.objectToSnake(e.heightOverlaps),this.widthOverlaps=xs.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function Tx(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.SandwichM2?!0:n.properties.configuratorSettings!==void 0&&M.isArray(n.products)&&n.products.length>0}const $x={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ex(n,e){return t.openBlock(),t.createElementBlock("svg",$x,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M16 12a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2"},null,-1)])])}const Rx=t.markRaw({name:"mdi-dots-horizontal",render:Ex}),Px={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fx(n,e){return t.openBlock(),t.createElementBlock("svg",Px,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5A6.5 6.5 0 0 0 9.5 3A6.5 6.5 0 0 0 3 9.5A6.5 6.5 0 0 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5l1.5-1.5zm-6 0C7 14 5 12 5 9.5S7 5 9.5 5S14 7 14 9.5S12 14 9.5 14M7 9h5v1H7z"},null,-1)])])}const Vx=t.markRaw({name:"mdi-magnify-minus-outline",render:Fx}),Mx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ix(n,e){return t.openBlock(),t.createElementBlock("svg",Mx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m15.5 14l5 5l-1.5 1.5l-5-5v-.79l-.27-.28A6.47 6.47 0 0 1 9.5 16A6.5 6.5 0 0 1 3 9.5A6.5 6.5 0 0 1 9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27zm-6 0C12 14 14 12 14 9.5S12 5 9.5 5S5 7 5 9.5S7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2z"},null,-1)])])}const Ax=t.markRaw({name:"mdi-magnify-plus-outline",render:Ix}),Ox={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function zx(n,e){return t.openBlock(),t.createElementBlock("svg",Ox,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z"},null,-1)])])}const nf=t.markRaw({name:"mdi-chevron-right",render:zx}),Dx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Lx(n,e){return t.openBlock(),t.createElementBlock("svg",Dx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6z"},null,-1)])])}const rf=t.markRaw({name:"mdi-chevron-left",render:Lx}),Hx={heightMedium:"40px",paddingMedium:"0 16px",borderRadiusMedium:"10px",fontSizeMedium:"14px",iconSizeMedium:"18px",iconMarginMedium:"8px",border:"1px solid #d1d5db",borderHover:"1px solid #9ca3af",borderPressed:"1px solid #9ca3af",borderFocus:"1px solid #9ca3af"},Ar={heightSmall:"36px",paddingSmall:"0 10px",borderRadiusSmall:"8px",iconSizeSmall:"18px",border:"1px solid #d1d5db",borderHover:"1px solid #9ca3af",borderPressed:"1px solid #9ca3af",borderFocus:"1px solid #9ca3af"},of="date-range.dialog.mode",sf="date-range.dialog.scale",af="date-range.quick-periods",lf=["thisMonth","lastMonth","thisQuarter","lastQuarter","thisYear","lastYear","fromBeginningOfThisYear"],cf=["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],Wx=["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],jx=["Пн","Вт","Ср","Чт","Пт","Сб","Вс"],df=new Date(2e3,0,1),Ti=n=>xe.differenceInCalendarDays(n,df),uf=n=>xe.addDays(df,n),ff=(n,e,i)=>{let r=n??void 0,o=e??void 0;return r&&o&&r>o&&(i!=null&&i.from?o=r:i!=null&&i.to?r=o:[r,o]=[o,r]),{from:r?xe.startOfDay(r):void 0,to:o?xe.endOfDay(o):void 0}},Ra=n=>Object.entries(n).map(([e,i])=>({value:e,label:i.label,item:i})),hf=(n,e)=>{const i=Object.entries(n).filter(([,r])=>r.group===e);return e!=="other"?[{type:"group",key:e,children:Ra(Object.fromEntries(i))}]:j.STANDARD_PERIOD_SECTIONS.map(r=>{const o=i.filter(([,s])=>s.section===r.key);return{type:"group",key:r.key,label:r.label,children:Ra(Object.fromEntries(o))}}).filter(r=>r.children.length>0)},mf=(n,e)=>{const i=t.ref(null),r=t.ref(null),o=t.ref(!1),s=t.ref(null),a=(g,b)=>g<=b?[g,b]:[b,g],l=t.computed(()=>o.value&&r.value!==null&&s.value!==null?a(r.value,s.value):i.value!==null?s.value===null?[i.value,i.value]:a(i.value,s.value):n.value),c=(g,b)=>{i.value=null,e(...a(g,b))},d=g=>{i.value===null?(i.value=g,e(g,g)):c(i.value,g)},u=()=>{globalThis.removeEventListener("pointerup",u);const g=r.value;if(g!==null){if(r.value=null,o.value){o.value=!1,s.value!==null&&c(g,s.value);return}d(g)}},f=g=>{r.value=g,o.value=!1,globalThis.addEventListener("pointerup",u)},h=g=>{s.value=g,r.value!==null&&g!==r.value&&(o.value=!0)},p=()=>{s.value=null},m=g=>{const b=l.value;return!b||g<b[0]||g>b[1]?null:g===b[0]||g===b[1]?"bound":"in-range"};return t.onBeforeUnmount(()=>{globalThis.removeEventListener("pointerup",u)}),{activeRange:l,cellPosition:m,pointerDownHandler:f,pointerEnterHandler:h,pointerLeaveHandler:p,selectHandler:d}},qx={class:"flex items-center justify-between gap-2"},Xx={class:"flex items-center gap-2"},Yx={class:"text-center font-semibold"},Ux={class:"grid grid-cols-7 gap-0.5 text-center text-xs text-gray-500"},Kx={class:"grid grid-cols-7 gap-0.5"},Gx=["disabled","onPointerdown","onPointerenter","onKeydown"],Zx={},Qx=t.defineComponent({...Zx,__name:"day-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=42,s=F.useThemeVars(),a=t.computed(()=>({"--sc-primary-color":s.value.primaryColor,"--sc-primary-color-hover":s.value.primaryColorHover,"--sc-primary-color-suppl":s.value.primaryColorSuppl,"--sc-hover-color":s.value.hoverColor})),l=Xe.initRefDependingOnDeviceResolution(1,2,3),c=t.computed(()=>["grid-cols-1","grid-cols-2","grid-cols-3"][l.value-1]),d=y=>xe.subMonths(xe.startOfMonth(y),l.value===3?1:0),u=y=>y&&xe.isValid(y)?y:new Date,f=t.ref(d(u(i.from??i.to))),h=t.computed(()=>{const{from:y,to:_}=i;return!y||!_||!xe.isValid(y)||!xe.isValid(_)?null:[Ti(y),Ti(_)]}),p=mf(h,(y,_)=>{r("select",{from:xe.startOfDay(uf(y)),to:xe.endOfDay(uf(_))})}),m=y=>{const _=xe.subDays(y,(xe.getDay(y)+6)%7);return M.times(o,k=>{const x=xe.addDays(_,k);return{index:Ti(x),day:x.getDate(),isCurrentMonth:xe.isSameMonth(x,y),isToday:xe.isToday(x)}})},g=t.computed(()=>M.times(l.value,y=>{const _=xe.addMonths(f.value,y);return{key:`${_.getFullYear()}-${_.getMonth()}`,title:`${Wx[_.getMonth()]} ${_.getFullYear()}`,cells:m(_)}})),b=y=>{if(!y.isCurrentMonth)return["sc-day--outside"];const _=y.isToday?["sc-day--today"]:[],k=p.cellPosition(y.index);return k&&_.push(`sc-day--${k}`),_};return t.watch(()=>[i.from,i.to],()=>{const y=i.from??i.to;if(!y||!xe.isValid(y))return;const _=`${y.getFullYear()}-${y.getMonth()}`;M.some(g.value,["key",_])||(f.value=d(y))}),(y,_)=>{const k=rf,x=F.NButton,v=nf;return t.openBlock(),t.createElementBlock("div",{class:"flex select-none flex-col gap-3",style:t.normalizeStyle(a.value),onPointerleave:_[2]||(_[2]=(...B)=>t.unref(p).pointerLeaveHandler&&t.unref(p).pointerLeaveHandler(...B))},[t.createElementVNode("div",qx,[t.createVNode(x,{size:"small","aria-label":"Предыдущий месяц","theme-overrides":t.unref(Ar),onClick:_[0]||(_[0]=B=>f.value=t.unref(xe.subMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(k)]),_:1},8,["theme-overrides"]),_[3]||(_[3]=t.createElementVNode("span",{class:"text-sm text-gray-600"},"Выберите диапазон на календаре",-1)),t.createElementVNode("div",Xx,[t.renderSlot(y.$slots,"actions",{},void 0,!0),t.createVNode(x,{size:"small","aria-label":"Следующий месяц","theme-overrides":t.unref(Ar),onClick:_[1]||(_[1]=B=>f.value=t.unref(xe.addMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(v)]),_:1},8,["theme-overrides"])])]),t.createElementVNode("div",{class:t.normalizeClass(["grid gap-3",c.value])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,B=>(t.openBlock(),t.createElementBlock("div",{key:B.key,class:"flex flex-col gap-1"},[t.createElementVNode("div",Yx,t.toDisplayString(B.title),1),t.createElementVNode("div",Ux,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(jx),w=>(t.openBlock(),t.createElementBlock("span",{key:w},t.toDisplayString(w),1))),128))]),t.createElementVNode("div",Kx,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(B.cells,w=>(t.openBlock(),t.createElementBlock("button",{key:w.index,type:"button",class:t.normalizeClass(["sc-day h-7 rounded border-0 p-0 text-xs",b(w)]),disabled:!w.isCurrentMonth,onPointerdown:t.withModifiers(T=>t.unref(p).pointerDownHandler(w.index),["prevent"]),onPointerenter:T=>t.unref(p).pointerEnterHandler(w.index),onKeydown:[t.withKeys(t.withModifiers(T=>t.unref(p).selectHandler(w.index),["prevent"]),["enter"]),t.withKeys(t.withModifiers(T=>t.unref(p).selectHandler(w.index),["prevent"]),["space"])]},t.toDisplayString(w.day),43,Gx))),128))])]))),128))],2),_[4]||(_[4]=t.createStaticVNode('<div class="flex flex-wrap items-center gap-x-6 gap-y-1 text-xs text-gray-700" data-v-a41e813d><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--bound" data-v-a41e813d></i>Дата начала</span><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--in-range" data-v-a41e813d></i>Выбранный период</span><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--bound" data-v-a41e813d></i>Дата окончания</span></div>',1))],36)}}}),Jx=fn(Qx,[["__scopeId","data-v-a41e813d"]]),ek={class:"flex items-center justify-between gap-2"},tk={class:"flex items-center gap-2"},nk={class:"text-center font-semibold"},ik={class:"grid grid-cols-3 gap-2"},rk=["onPointerdown","onPointerenter","onKeydown"],ok={},sk=t.defineComponent({...ok,__name:"month-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=F.useThemeVars(),s=t.computed(()=>({"--sc-primary-color":o.value.primaryColor,"--sc-primary-color-hover":o.value.primaryColorHover,"--sc-primary-color-suppl":o.value.primaryColorSuppl,"--sc-hover-color":o.value.hoverColor})),a=p=>{const m=new Date().getFullYear();return p&&xe.isValid(p)?p.getFullYear():m},l=t.ref(a(i.from??i.to)),c=Xe.initRefDependingOnDeviceResolution(1,3,3),d=t.computed(()=>c.value===1?[l.value]:[l.value-1,l.value,l.value+1]),u=t.computed(()=>{const{from:p,to:m}=i;return!p||!m||!xe.isValid(p)||!xe.isValid(m)?null:[p.getFullYear()*12+p.getMonth(),m.getFullYear()*12+m.getMonth()]}),f=mf(u,(p,m)=>{r("select",{from:new Date(Math.floor(p/12),p%12,1),to:xe.endOfMonth(new Date(Math.floor(m/12),m%12,1))})}),h=(p,m)=>{const g=f.cellPosition(p*12+m);return g?[`sc-month--${g}`]:[]};return t.watch(()=>[i.from,i.to],()=>{const p=i.from??i.to;if(!p||!xe.isValid(p))return;const m=p.getFullYear();(m<l.value-1||m>l.value+1)&&(l.value=m)}),(p,m)=>{const g=rf,b=F.NButton,y=nf;return t.openBlock(),t.createElementBlock("div",{class:"flex select-none flex-col gap-3",style:t.normalizeStyle(s.value),onPointerleave:m[2]||(m[2]=(..._)=>t.unref(f).pointerLeaveHandler&&t.unref(f).pointerLeaveHandler(..._))},[t.createElementVNode("div",ek,[t.createVNode(b,{size:"small","aria-label":"Предыдущий год","theme-overrides":t.unref(Ar),onClick:m[0]||(m[0]=_=>l.value-=1)},{icon:t.withCtx(()=>[t.createVNode(g)]),_:1},8,["theme-overrides"]),m[3]||(m[3]=t.createElementVNode("span",{class:"text-sm text-gray-600"},"Выберите диапазон месяцев",-1)),t.createElementVNode("div",tk,[t.renderSlot(p.$slots,"actions",{},void 0,!0),t.createVNode(b,{size:"small","aria-label":"Следующий год","theme-overrides":t.unref(Ar),onClick:m[1]||(m[1]=_=>l.value+=1)},{icon:t.withCtx(()=>[t.createVNode(y)]),_:1},8,["theme-overrides"])])]),t.createElementVNode("div",{class:t.normalizeClass(["grid gap-4 sm:gap-6",d.value.length===1?"grid-cols-1":"grid-cols-3"])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,_=>(t.openBlock(),t.createElementBlock("div",{key:_,class:"flex flex-col gap-2"},[t.createElementVNode("div",nk,t.toDisplayString(_),1),t.createElementVNode("div",ik,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(cf),(k,x)=>(t.openBlock(),t.createElementBlock("button",{key:k,type:"button",class:t.normalizeClass(["sc-month cursor-pointer rounded-lg px-1 py-2.5 text-sm",h(_,x)]),onPointerdown:t.withModifiers(v=>t.unref(f).pointerDownHandler(_*12+x),["prevent"]),onPointerenter:v=>t.unref(f).pointerEnterHandler(_*12+x),onKeydown:[t.withKeys(t.withModifiers(v=>t.unref(f).selectHandler(_*12+x),["prevent"]),["enter"]),t.withKeys(t.withModifiers(v=>t.unref(f).selectHandler(_*12+x),["prevent"]),["space"])]},t.toDisplayString(k),43,rk))),128))])]))),128))],2)],36)}}}),ak=fn(sk,[["__scopeId","data-v-dd09a19d"]]),lk={class:"sc-date-range-sidebar flex flex-col gap-1"},ck={class:"flex items-center justify-center gap-1"},dk={class:"min-w-12 text-center font-semibold"},uk={class:"grid grid-flow-col grid-cols-2 grid-rows-6 gap-1"},fk={},hk=t.defineComponent({...fk,__name:"month-year-sidebar",props:{year:{},month:{}},emits:["update:year","select-month","today"],setup(n,{emit:e}){const i=e;return(r,o)=>{const s=F.NButton;return t.openBlock(),t.createElementBlock("div",lk,[t.createElementVNode("div",ck,[t.createVNode(s,{size:"small",quaternary:"",onClick:o[0]||(o[0]=a=>i("update:year",n.year-1))},{default:t.withCtx(()=>[...o[3]||(o[3]=[t.createTextVNode(" ‹ ",-1)])]),_:1}),t.createElementVNode("span",dk,t.toDisplayString(n.year),1),t.createVNode(s,{size:"small",quaternary:"",onClick:o[1]||(o[1]=a=>i("update:year",n.year+1))},{default:t.withCtx(()=>[...o[4]||(o[4]=[t.createTextVNode(" › ",-1)])]),_:1})]),t.createElementVNode("div",uk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(cf),(a,l)=>(t.openBlock(),t.createBlock(s,{key:a,size:"small",quaternary:"",type:l===n.month?"primary":"default",onClick:c=>i("select-month",l)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a),1)]),_:2},1032,["type","onClick"]))),128))]),t.createVNode(s,{size:"small",text:"",type:"info",onClick:o[2]||(o[2]=a=>i("today"))},{default:t.withCtx(()=>[...o[5]||(o[5]=[t.createTextVNode(" Сегодня ",-1)])]),_:1})])}}}),mk={},pf=t.defineComponent({...mk,__name:"date-range-input",props:{clearable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{default:void 0},value:{default:null},dateFormat:{default:()=>j.useBaseConfigStateStore().config.dateFormats.uiDate}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=Xe.initRefDependingOnDeviceResolution(!0,!1,!1),s=t.ref(null),a=t.ref(!1),l=t.ref(0),c=t.ref(i.value&&xe.isValid(i.value)?i.value:new Date),d=t.computed(()=>{const k=i.value&&xe.isValid(i.value)?i.value:c.value;return k.getFullYear()===c.value.getFullYear()?k.getMonth():null});let u=0;const f=k=>{var x,v;(v=(x=k.target)==null?void 0:x.closest)!=null&&v.call(x,".n-base-clear")&&(u=performance.now())},h=k=>{k&&performance.now()-u<300||(a.value=k,k&&(c.value=i.value&&xe.isValid(i.value)?i.value:new Date))},p=k=>{r("update:value",k===null?null:new Date(k))},m=(k,x)=>{const v=new Date(k,x,1);if(c.value=v,i.value&&xe.isValid(i.value)){const B=Math.min(xe.getDate(i.value),xe.getDaysInMonth(v));r("update:value",new Date(k,x,B));return}l.value+=1,t.nextTick().then(()=>{var B;return(B=s.value)==null?void 0:B.focus()})},g=(k,x)=>{c.value=xe.addYears(xe.addMonths(c.value,k),x)},b=k=>{m(k,c.value.getMonth())},y=k=>{m(c.value.getFullYear(),k)},_=()=>{a.value=!1,r("update:value",new Date)};return(k,x)=>{const v=F.NButton,B=F.NDatePicker;return t.openBlock(),t.createBlock(B,{ref_key:"pickerReference",ref:s,key:l.value,value:i.value?i.value.getTime():null,show:a.value,clearable:n.clearable,disabled:n.disabled,placeholder:n.placeholder,format:n.dateFormat,actions:[],"default-calendar-start-time":c.value.getTime(),type:"date",class:"w-full min-w-0",onMousedownCapture:f,"onUpdate:show":h,"onUpdate:value":p,onNextMonth:x[0]||(x[0]=w=>g(1,0)),onPrevMonth:x[1]||(x[1]=w=>g(-1,0)),onNextYear:x[2]||(x[2]=w=>g(0,1)),onPrevYear:x[3]||(x[3]=w=>g(0,-1))},{footer:t.withCtx(()=>[t.unref(o)?(t.openBlock(),t.createBlock(v,{key:1,size:"small",text:"",type:"info",onClick:_},{default:t.withCtx(()=>[...x[4]||(x[4]=[t.createTextVNode(" Сегодня ",-1)])]),_:1})):(t.openBlock(),t.createBlock(hk,{key:0,year:c.value.getFullYear(),month:d.value,"onUpdate:year":b,onSelectMonth:y,onToday:_},null,8,["year","month"]))]),_:1},8,["value","show","clearable","disabled","placeholder","format","default-calendar-start-time"])}}}),pk={key:0,class:"text-gray-400"},gk={},gf=t.defineComponent({...gk,__name:"date-range-fields",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},from:{default:null},to:{default:null},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:from","update:to"],setup(n,{emit:e}){const i=Xe.initRefDependingOnDeviceResolution(!0,!1,!1),r=e;return(o,s)=>{var a,l;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["flex w-full min-w-0 gap-1",t.unref(i)?"flex-col":"flex-row items-center"])},[t.createVNode(pf,{value:n.from,clearable:n.clearable,disabled:(a=n.disabled)==null?void 0:a.from,placeholder:n.placeholderFrom,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:value":s[0]||(s[0]=c=>r("update:from",c))},null,8,["value","clearable","disabled","placeholder","date-format"]),t.unref(i)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",pk," – ")),t.createVNode(pf,{value:n.to,clearable:n.clearable,disabled:(l=n.disabled)==null?void 0:l.to,placeholder:n.placeholderTo,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:value":s[1]||(s[1]=c=>r("update:to",c))},null,8,["value","clearable","disabled","placeholder","date-format"])],2)}}}),yk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function bk(n,e){return t.openBlock(),t.createElementBlock("svg",yk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M7 11h2v2H7zm14-6v14c0 1.11-.89 2-2 2H5a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h1V1h2v2h8V1h2v2h1a2 2 0 0 1 2 2M5 7h14V5H5zm14 12V9H5v10zm-4-6v-2h2v2zm-4 0v-2h2v2zm-4 2h2v2H7zm8 2v-2h2v2zm-4 0v-2h2v2z"},null,-1)])])}const _k=t.markRaw({name:"mdi-calendar-month-outline",render:bk}),wk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function xk(n,e){return t.openBlock(),t.createElementBlock("svg",wk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m16 11.78l4.24-7.33l1.73 1l-5.23 9.05l-6.51-3.75L5.46 19H22v2H2V3h2v14.54L9.5 8z"},null,-1)])])}const kk=t.markRaw({name:"mdi-chart-line",render:xk}),Ck={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function vk(n,e){return t.openBlock(),t.createElementBlock("svg",Ck,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M22 21H2V3h2v16h2v-9h4v9h2V6h4v13h2v-5h4z"},null,-1)])])}const Sk=t.markRaw({name:"mdi-chart-bar",render:vk}),Bk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Nk(n,e){return t.openBlock(),t.createElementBlock("svg",Bk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M5 3h1V1h2v2h8V1h2v2h1c1.11 0 2 .89 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m0 16h14V9H5zM5 7h14V5H5zm12 4v2H7v-2z"},null,-1)])])}const Tk=t.markRaw({name:"mdi-calendar-week-outline",render:Nk}),$k={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ek(n,e){return t.openBlock(),t.createElementBlock("svg",$k,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M19 3h-1V1h-2v2H8V1H6v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.11 0 2-.89 2-2V5c0-1.11-.89-2-2-2m0 16H5V9h14zm0-12H5V5h14M7 11h5v5H7"},null,-1)])])}const Rk=t.markRaw({name:"mdi-calendar-today-outline",render:Ek}),Pk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fk(n,e){return t.openBlock(),t.createElementBlock("svg",Pk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M12 8a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m0 2a2 2 0 0 0-2 2a2 2 0 0 0 2 2a2 2 0 0 0 2-2a2 2 0 0 0-2-2m-2 12c-.25 0-.46-.18-.5-.42l-.37-2.65c-.63-.25-1.17-.59-1.69-.99l-2.49 1.01c-.22.08-.49 0-.61-.22l-2-3.46a.493.493 0 0 1 .12-.64l2.11-1.66L4.5 12l.07-1l-2.11-1.63a.493.493 0 0 1-.12-.64l2-3.46c.12-.22.39-.31.61-.22l2.49 1c.52-.39 1.06-.73 1.69-.98l.37-2.65c.04-.24.25-.42.5-.42h4c.25 0 .46.18.5.42l.37 2.65c.63.25 1.17.59 1.69.98l2.49-1c.22-.09.49 0 .61.22l2 3.46c.13.22.07.49-.12.64L19.43 11l.07 1l-.07 1l2.11 1.63c.19.15.25.42.12.64l-2 3.46c-.12.22-.39.31-.61.22l-2.49-1c-.52.39-1.06.73-1.69.98l-.37 2.65c-.04.24-.25.42-.5.42zm1.25-18l-.37 2.61c-1.2.25-2.26.89-3.03 1.78L5.44 7.35l-.75 1.3L6.8 10.2a5.55 5.55 0 0 0 0 3.6l-2.12 1.56l.75 1.3l2.43-1.04c.77.88 1.82 1.52 3.01 1.76l.37 2.62h1.52l.37-2.61c1.19-.25 2.24-.89 3.01-1.77l2.43 1.04l.75-1.3l-2.12-1.55c.4-1.17.4-2.44 0-3.61l2.11-1.55l-.75-1.3l-2.41 1.04a5.42 5.42 0 0 0-3.03-1.77L12.75 4z"},null,-1)])])}const Vk=t.markRaw({name:"mdi-cog-outline",render:Fk}),Mk={class:"grid gap-x-6 gap-y-4 pr-3 sm:grid-cols-2"},Ik={class:"font-medium"},Ak={key:0,class:"pt-1 text-xs text-gray-500"},Ok={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},zk={class:"flex items-center gap-3"},Dk={class:"text-sm text-gray-600"},Lk={class:"flex gap-2"},Hk={},Wk=t.defineComponent({...Hk,__name:"quick-periods-settings",props:{show:{type:Boolean},selectedKeys:{}},emits:["update:show","save"],setup(n,{emit:e}){const i=n,r=e,o=Xe.initRefDependingOnDeviceResolution("100%","90%","40rem"),s=j.DateTimeProvider.standardPeriods(),a=j.STANDARD_PERIOD_GROUPS.map(u=>({key:u.key,label:u.label,sections:hf(s,u.key)})),l=t.ref([]),c=t.computed(()=>{const u=l.value.length;return`Выбрано: ${u} ${j.pluralize(u,["период","периода","периодов"])}`}),d=()=>{r("save",[...l.value]),r("update:show",!1)};return t.watch(()=>i.show,u=>{u&&(l.value=[...i.selectedKeys])}),(u,f)=>{const h=F.NCheckbox,p=F.NCheckboxGroup,m=F.NScrollbar,g=F.NButton,b=F.NModal;return t.openBlock(),t.createBlock(b,{show:n.show,preset:"card",title:"Настройка быстрого выбора",closable:"",style:t.normalizeStyle({width:t.unref(o),maxWidth:"calc(100vw - 1rem)"}),class:"sc-date-range-dialog","onUpdate:show":f[4]||(f[4]=y=>r("update:show",y))},{footer:t.withCtx(()=>[t.createElementVNode("div",Ok,[t.createElementVNode("div",zk,[t.createElementVNode("span",Dk,t.toDisplayString(c.value),1),t.createVNode(g,{text:"",type:"info",onClick:f[1]||(f[1]=y=>l.value=[...t.unref(lf)])},{default:t.withCtx(()=>[...f[5]||(f[5]=[t.createTextVNode(" По умолчанию ",-1)])]),_:1}),t.createVNode(g,{text:"",type:"info",disabled:l.value.length===0,onClick:f[2]||(f[2]=y=>l.value=[])},{default:t.withCtx(()=>[...f[6]||(f[6]=[t.createTextVNode(" Снять все ",-1)])]),_:1},8,["disabled"])]),t.createElementVNode("div",Lk,[t.createVNode(g,{type:"primary",onClick:d},{default:t.withCtx(()=>[...f[7]||(f[7]=[t.createTextVNode(" Сохранить ",-1)])]),_:1}),t.createVNode(g,{onClick:f[3]||(f[3]=y=>r("update:show",!1))},{default:t.withCtx(()=>[...f[8]||(f[8]=[t.createTextVNode("Отмена",-1)])]),_:1})])])]),default:t.withCtx(()=>[t.createVNode(m,{class:"max-h-[60vh]"},{default:t.withCtx(()=>[t.createVNode(p,{value:l.value,"onUpdate:value":f[0]||(f[0]=y=>l.value=y)},{default:t.withCtx(()=>[t.createElementVNode("div",Mk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a),y=>(t.openBlock(),t.createElementBlock("div",{key:y.key,class:"flex flex-col gap-1.5"},[t.createElementVNode("div",Ik,t.toDisplayString(y.label),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.sections,_=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:_.key},[_.label?(t.openBlock(),t.createElementBlock("div",Ak,t.toDisplayString(_.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.children,k=>(t.openBlock(),t.createBlock(h,{key:k.value,value:k.value,label:k.label},null,8,["value","label"]))),128))],64))),128))]))),128))])]),_:1},8,["value"])]),_:1})]),_:1},8,["show","style"])}}}),jk={class:"flex flex-col gap-2"},qk={class:"flex items-center gap-2"},Xk={class:"flex gap-2 px-px pb-4 pt-px"},Yk={key:0,class:"text-sm text-gray-500"},Uk={},Kk=t.defineComponent({...Uk,__name:"quick-periods",props:{from:{},to:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o=j.DateTimeProvider.standardPeriods(),s=()=>{const f=af,h=j.PreferencesStorageProvider.getActualDataFromStorage(f);return(M.isArray(h)?h:lf).filter(m=>M.isString(m)&&m in o)},a=t.ref(s()),l=t.ref(!1),c=t.computed(()=>Object.entries(o).filter(([f])=>a.value.includes(f)).map(([f,h])=>({value:f,label:h.label,item:h,group:h.group}))),d=t.computed(()=>{const f=i.from?Ti(i.from):null,h=i.to?Ti(i.to):null;if(f===null||h===null)return null;const p=c.value.find(m=>{const{from:g,to:b}=m.item;return!g||!b?!1:Ti(g)===f&&Ti(b)===h});return p?String(p.value):null}),u=f=>{a.value=f;const h=af;j.PreferencesStorageProvider.saveActualDataToStorage(h,f,xe.addYears(xe.startOfToday(),1))};return(f,h)=>{const p=Vk,m=F.NButton,g=Rk,b=Tk,y=Sk,_=kk,k=_k,x=F.NScrollbar;return t.openBlock(),t.createElementBlock("div",jk,[t.createElementVNode("div",qk,[h[3]||(h[3]=t.createElementVNode("span",{class:"text-sm font-medium text-gray-700"},"Быстрый выбор",-1)),t.createVNode(m,{size:"tiny",quaternary:"",circle:"","aria-label":"Настроить быстрый выбор",onClick:h[0]||(h[0]=v=>l.value=!0)},{icon:t.withCtx(()=>[t.createVNode(p)]),_:1})]),t.createVNode(x,{"x-scrollable":""},{default:t.withCtx(()=>[t.createElementVNode("div",Xk,[c.value.length===0?(t.openBlock(),t.createElementBlock("span",Yk," Периоды не выбраны ")):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,v=>(t.openBlock(),t.createBlock(m,{key:v.value,type:v.value===d.value?"primary":"default",ghost:v.value===d.value,"theme-overrides":t.unref(Hx),class:"shrink-0",onClick:B=>r("apply",v),onMouseenter:B=>r("preview",v),onMouseleave:h[1]||(h[1]=B=>r("preview"))},{icon:t.withCtx(()=>[v.group==="day"?(t.openBlock(),t.createBlock(g,{key:0})):v.group==="week"||v.group==="decade"?(t.openBlock(),t.createBlock(b,{key:1})):v.group==="quarter"||v.group==="halfYear"?(t.openBlock(),t.createBlock(y,{key:2})):v.group==="other"?(t.openBlock(),t.createBlock(_,{key:3})):(t.openBlock(),t.createBlock(k,{key:4}))]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(v.label),1)]),_:2},1032,["type","ghost","theme-overrides","onClick","onMouseenter"]))),128))])]),_:1}),t.createVNode(Wk,{show:l.value,"onUpdate:show":h[2]||(h[2]=v=>l.value=v),"selected-keys":a.value,onSave:u},null,8,["show","selected-keys"])])}}}),Gk={class:"flex flex-col items-stretch gap-3 sm:flex-row"},Zk={class:"order-2 flex-1 rounded-lg border border-solid border-gray-200 p-2 shadow-sm"},Qk={class:"flex flex-col items-stretch pr-3"},Jk={key:0,class:"px-2 pb-0.5 pt-2 text-xs text-gray-400"},e2={key:1,class:"order-2 w-44 shrink-0 rounded-lg border border-solid border-gray-200 p-1 shadow-sm"},t2={},n2=t.defineComponent({...t2,__name:"standard-periods",props:{activeKey:{},customPeriods:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o="custom",s=Xe.initRefDependingOnDeviceResolution(!0,!1,!1),a=j.DateTimeProvider.standardPeriods(),l=t.ref(j.STANDARD_PERIOD_GROUPS[0].key),c=t.computed(()=>{const u=j.STANDARD_PERIOD_GROUPS.map(f=>({key:f.key,value:f.key,label:f.label}));return M.isEmpty(i.customPeriods)||u.push({key:o,value:o,label:"Пользовательские"}),u}),d=t.computed(()=>l.value===o?[{type:"group",key:o,children:Ra(i.customPeriods??{})}]:hf(a,l.value));return(u,f)=>{const h=F.NButton,p=F.NScrollbar,m=F.NSelect,g=F.NMenu;return t.openBlock(),t.createElementBlock("div",Gk,[t.createElementVNode("div",Zk,[t.createVNode(p,{class:"max-h-96"},{default:t.withCtx(()=>[t.createElementVNode("div",Qk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,b=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:b.key},[b.label?(t.openBlock(),t.createElementBlock("div",Jk,t.toDisplayString(b.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.children,y=>(t.openBlock(),t.createBlock(h,{key:y.value,size:"small",quaternary:"",type:y.value===n.activeKey?"primary":"default",class:"justify-start",onClick:_=>r("apply",y),onMouseenter:_=>r("preview",y),onMouseleave:f[0]||(f[0]=_=>r("preview"))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(y.label),1)]),_:2},1032,["type","onClick","onMouseenter"]))),128))],64))),128))])]),_:1})]),t.unref(s)?(t.openBlock(),t.createBlock(m,{key:0,value:l.value,options:c.value,class:"order-1","onUpdate:value":f[1]||(f[1]=b=>l.value=b)},null,8,["value","options"])):(t.openBlock(),t.createElementBlock("div",e2,[t.createVNode(g,{value:l.value,options:c.value,mode:"vertical","onUpdate:value":f[2]||(f[2]=b=>l.value=b)},null,8,["value","options"])]))])}}}),i2={class:"flex flex-col gap-3"},r2={class:"flex flex-col gap-1 sm:flex-row sm:items-center"},o2={key:1,class:"overflow-x-auto rounded-lg border border-solid border-gray-200 p-2 shadow-sm sm:p-3"},s2={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},a2={class:"flex gap-2"},l2={},c2=t.defineComponent({...l2,__name:"date-range-dialog",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},show:{type:Boolean},dateRange:{default:void 0},customPeriods:{default:void 0},dateFormat:{default:void 0}},emits:["update:show","select"],setup(n,{emit:e}){const i=n,r=e,o=Xe.initRefDependingOnDeviceResolution("100%","90%","48rem"),s=t.ref("custom"),a=t.ref("months"),l=t.computed(()=>a.value==="months"?"Показать по дням":"Показать по месяцам"),c=()=>j.PreferencesStorageProvider.getActualDataFromStorage(of)==="standard"?"standard":"custom",d=()=>j.PreferencesStorageProvider.getActualDataFromStorage(sf)==="days"?"days":"months",u=(C,$)=>{j.PreferencesStorageProvider.saveActualDataToStorage(C,$,xe.addYears(xe.startOfToday(),1))},f=t.ref({}),h=t.ref(null),p=t.ref(null),m=t.computed(()=>h.value??f.value),g=(C,$)=>{var R,O;const E=(R=i.disabled)!=null&&R.from?f.value.from:C,I=(O=i.disabled)!=null&&O.to?f.value.to:$;h.value=null,f.value=ff(E,I,i.disabled)},b=C=>{p.value=null,g(C,f.value.to)},y=C=>{p.value=null,g(f.value.from,C)},_=()=>{p.value=null,g(null,null)},k=C=>{p.value=null,g(C.from,C.to)},x=C=>{const $=C.item;g($.from,$.to),p.value=String(C.value)},v=C=>{const $=C==null?void 0:C.item;h.value=$?{from:$.from,to:$.to}:null},B=()=>{h.value=null,s.value=s.value==="custom"?"standard":"custom",u(of,s.value)},w=()=>{a.value=a.value==="months"?"days":"months",u(sf,a.value)},T=()=>{r("select",f.value),r("update:show",!1)};return t.watch(()=>i.show,C=>{C&&(s.value=c(),a.value=d(),p.value=null,h.value=null,f.value={...i.dateRange})}),(C,$)=>{const E=F.NButton,I=Ax,R=Vx,O=F.NTooltip,U=F.NModal;return t.openBlock(),t.createBlock(U,{show:n.show,preset:"card",title:"Выберите период",closable:"",style:t.normalizeStyle({width:t.unref(o),maxWidth:"calc(100vw - 1rem)"}),class:"sc-date-range-dialog","onUpdate:show":$[1]||($[1]=Q=>r("update:show",Q))},{footer:t.withCtx(()=>[t.createElementVNode("div",s2,[t.createVNode(E,{text:"",type:"info",onClick:B},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.value==="custom"?"Показать стандартные периоды":"Показать произвольный период"),1)]),_:1}),t.createElementVNode("div",a2,[t.createVNode(E,{type:"primary",onClick:T},{default:t.withCtx(()=>[...$[3]||($[3]=[t.createTextVNode(" Выбрать ",-1)])]),_:1}),t.createVNode(E,{onClick:$[0]||($[0]=Q=>r("update:show",!1))},{default:t.withCtx(()=>[...$[4]||($[4]=[t.createTextVNode("Отмена",-1)])]),_:1})])])]),default:t.withCtx(()=>[t.createElementVNode("div",i2,[s.value==="custom"?(t.openBlock(),t.createBlock(Kk,{key:0,from:f.value.from,to:f.value.to,onApply:x,onPreview:v},null,8,["from","to"])):t.createCommentVNode("",!0),t.createElementVNode("div",r2,[t.createVNode(gf,{from:m.value.from,to:m.value.to,clearable:n.clearable,disabled:n.disabled,"date-format":n.dateFormat,class:"flex-1","onUpdate:from":b,"onUpdate:to":y},null,8,["from","to","clearable","disabled","date-format"]),n.clearable?(t.openBlock(),t.createBlock(E,{key:0,text:"",type:"info",class:"sm:ml-2",onClick:_},{default:t.withCtx(()=>[...$[2]||($[2]=[t.createTextVNode(" Очистить период ",-1)])]),_:1})):t.createCommentVNode("",!0)]),s.value==="custom"?(t.openBlock(),t.createElementBlock("div",o2,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.value==="months"?ak:Jx),{from:f.value.from,to:f.value.to,onSelect:k},{actions:t.withCtx(()=>[t.createVNode(O,{placement:"top",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(E,{size:"small","aria-label":l.value,"theme-overrides":t.unref(Ar),onClick:w},{icon:t.withCtx(()=>[a.value==="months"?(t.openBlock(),t.createBlock(I,{key:0})):(t.openBlock(),t.createBlock(R,{key:1}))]),_:1},8,["aria-label","theme-overrides"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(l.value),1)]),_:1})]),_:1},40,["from","to"]))])):(t.openBlock(),t.createBlock(n2,{key:2,"active-key":p.value,"custom-periods":n.customPeriods,onApply:x,onPreview:v},null,8,["active-key","custom-periods"]))])]),_:1},8,["show","style"])}}}),d2={class:"flex w-full min-w-0 items-center gap-1"},u2={},f2=t.defineComponent({...u2,__name:"date-range",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},dateRange:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:date-range"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.computed(()=>{const u={...i.useDefaultPredefinedDateRanges?j.DateTimeProvider.defaultDateRanges():{},...i.predefinedDateRanges};return M.isEmpty(u)?void 0:u}),a=(u,f)=>{r("update:date-range",ff(u,f,i.disabled))},l=u=>{var f;a(u,(f=i.dateRange)==null?void 0:f.to)},c=u=>{var f;a((f=i.dateRange)==null?void 0:f.from,u)},d=u=>{a(u.from,u.to)};return(u,f)=>{var m,g,b,y;const h=Rx,p=F.NButton;return t.openBlock(),t.createElementBlock("div",d2,[t.createVNode(gf,{from:(m=n.dateRange)==null?void 0:m.from,to:(g=n.dateRange)==null?void 0:g.to,clearable:n.clearable,disabled:n.disabled,"placeholder-from":n.placeholderFrom,"placeholder-to":n.placeholderTo,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:from":l,"onUpdate:to":c},null,8,["from","to","clearable","disabled","placeholder-from","placeholder-to","date-format"]),t.createVNode(p,{disabled:!!((b=n.disabled)!=null&&b.from&&((y=n.disabled)!=null&&y.to)),title:"Выбрать период","aria-label":"Выбрать период",onClick:f[0]||(f[0]=_=>o.value=!0)},{default:t.withCtx(()=>[t.createVNode(h)]),_:1},8,["disabled"]),t.createVNode(c2,{show:o.value,"onUpdate:show":f[1]||(f[1]=_=>o.value=_),"date-range":n.dateRange,clearable:n.clearable,disabled:n.disabled,"custom-periods":s.value,"date-format":n.dateFormat,onSelect:d},null,8,["show","date-range","clearable","disabled","custom-periods","date-format"])])}}}),h2={class:"sc-lbl-date text-nowrap"},m2={},Ko=t.defineComponent({...m2,__name:"date-time-label",props:{date:{},isTimeSecondary:{type:Boolean},isTimeOnSecondLine:{type:Boolean},isShowTime:{type:Boolean,default:!0}},setup(n){const e=n,i=t.computed(()=>xe.format(e.date,j.useBaseConfigStateStore().config.dateFormats.uiDate)),r=t.computed(()=>xe.format(e.date,"HH:mm"));return(o,s)=>(t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass({"flex flex-col":n.isTimeOnSecondLine})},[t.createElementVNode("span",h2,t.toDisplayString(i.value),1),n.isShowTime?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass([{"text-sc-grey":n.isTimeSecondary,"ml-1":!n.isTimeOnSecondLine},"sc-lbl-time"])},t.toDisplayString(r.value),3)):t.createCommentVNode("",!0)],2))}}),p2={},g2=t.defineComponent({...p2,__name:"debt",props:{debt:{default:0},showLabel:{type:Boolean,default:!1},wrapAsSmall:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>{let r="";return(e.showLabel??!1)&&(e.debt>0?r="Переплата: ":e.debt<0&&(r="Задолженность: ")),r});return(r,o)=>n.debt!==0?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass({"text-sm":n.wrapAsSmall})},[t.createTextVNode(t.toDisplayString(i.value)+" ",1),t.createElementVNode("span",{class:t.normalizeClass({"text-green-700":n.debt>0,"text-red-700":n.debt<0})},t.toDisplayString(n.debt)+" ₽ ",3)],2)):t.createCommentVNode("",!0)}}),y2={class:"flex flex-row gap-2.5"},b2={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},_2={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},w2={class:"mb-0.5 sm:mb-0 sm:ml-3"},x2={},k2=t.defineComponent({...x2,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(n){return(e,i)=>{const r=Uo,o=F.NButton,s=F.NPopover;return t.openBlock(),t.createElementBlock("div",y2,[t.createElementVNode("div",b2,[t.renderSlot(e.$slots,"main")]),t.createElementVNode("div",null,[t.createElementVNode("div",_2,[t.renderSlot(e.$slots,"extra-buttons"),t.createElementVNode("div",w2,[n.showCloseButton?(t.openBlock(),t.createBlock(s,{key:0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(o,{size:"small",type:"error",onClick:i[0]||(i[0]=a=>e.$emit("close"))},{default:t.withCtx(()=>[t.createVNode(r)]),_:1})]),default:t.withCtx(()=>[i[1]||(i[1]=t.createTextVNode(" Закрыть ",-1))]),_:1})):t.createCommentVNode("",!0)])])])])}}}),C2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function v2(n,e){return t.openBlock(),t.createElementBlock("svg",C2,[...e[0]||(e[0]=[t.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 S2=t.markRaw({name:"ion-checkmark-done-sharp",render:v2}),B2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function N2(n,e){return t.openBlock(),t.createElementBlock("svg",B2,[...e[0]||(e[0]=[t.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),t.createElementVNode("circle",{cx:"336",cy:"128",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"176",cy:"256",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"336",cy:"384",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1)])])}const T2=t.markRaw({name:"ion-options-outline",render:N2}),$2={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},E2={class:"flex-auto"},R2={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"},P2={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"},F2={},Pa=t.defineComponent({...F2,__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(n,{emit:e}){const i=e,r=t.ref(!1),o=()=>{i("edit")},s=()=>{r.value=!1},a=()=>{r.value=!0,i("apply",s)},l=()=>{i("cancel",s)};return(c,d)=>{const u=T2,f=F.NButton,h=F.NPopover,p=S2,m=Uo;return t.openBlock(),t.createElementBlock("div",$2,[t.createElementVNode("div",E2,[t.renderSlot(c.$slots,"default")]),t.createElementVNode("div",null,[t.createElementVNode("div",R2,[t.createElementVNode("div",P2,[n.showEditButton?(t.openBlock(),t.createBlock(h,{key:0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"info",ghost:"",size:"small",onClick:o},{default:t.withCtx(()=>[t.createVNode(u)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[0]||(d[0]=t.createTextVNode(" Редактировать данные ",-1))]),_:1})):t.createCommentVNode("",!0),n.showApplyButton?(t.openBlock(),t.createBlock(h,{key:1,disabled:r.value,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"primary",size:"small",onClick:a},{default:t.withCtx(()=>[t.createVNode(p)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[1]||(d[1]=t.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),n.showCancelButton?(t.openBlock(),t.createBlock(h,{key:2,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"error",size:"small",onClick:l},{default:t.withCtx(()=>[t.createVNode(m)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[2]||(d[2]=t.createTextVNode(" Отменить изменения ",-1))]),_:1})):t.createCommentVNode("",!0)]),t.renderSlot(c.$slots,"extra-buttons")])])])}}}),V2={},yf=t.defineComponent({...V2,__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(n,{emit:e}){const i=n,r=e,o=t.ref(i.showEditor),s=l=>{r("editor:apply",d=>{o.value=!d,l()})},a=l=>{o.value=!1,l(),r("editor:cancel")};return t.onMounted(()=>{t.watch(()=>i.showEditor,l=>{o.value=l})}),(l,c)=>(t.openBlock(),t.createElementBlock("div",null,[o.value?(t.openBlock(),t.createBlock(Pa,{key:1,disabled:n.disabled,"show-apply-button":!0,"show-cancel-button":!0,onApply:s,onCancel:a},{"extra-buttons":t.withCtx(()=>[t.renderSlot(l.$slots,"extra-editor-buttons")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"editor")]),_:3},8,["disabled"])):(t.openBlock(),t.createBlock(Pa,{key:0,disabled:n.disabled,"show-edit-button":n.showEditButton,onEdit:c[0]||(c[0]=d=>o.value=!0)},{"extra-buttons":t.withCtx(()=>[t.renderSlot(l.$slots,"extra-viewer-buttons")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"viewer")]),_:3},8,["disabled","show-edit-button"]))]))}}),M2={key:0,class:"whitespace-pre-line"},I2={key:1,class:"text-sc-dark-grey"},A2={},O2=t.defineComponent({...A2,__name:"comment-editor",props:{disabled:{type:Boolean,default:!1},comment:{default:""}},emits:["update:comment"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.comment);t.watch(()=>o.value,l=>{o.value=l});const s=l=>{r("update:comment",o.value,l)},a=()=>{o.value=i.comment};return(l,c)=>{const d=F.NInput;return t.openBlock(),t.createBlock(yf,{disabled:n.disabled,"onEditor:apply":s,"onEditor:cancel":a},{viewer:t.withCtx(()=>[t.createElementVNode("div",null,[n.comment?(t.openBlock(),t.createElementBlock("span",M2,t.toDisplayString(n.comment),1)):(t.openBlock(),t.createElementBlock("span",I2," - Комментарий отсутствует - "))])]),editor:t.withCtx(()=>[t.createVNode(d,{value:o.value,"onUpdate:value":c[0]||(c[0]=u=>o.value=u),clearable:!0,type:"textarea"},null,8,["value"])]),_:1},8,["disabled"])}}}),z2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function D2(n,e){return t.openBlock(),t.createElementBlock("svg",z2,[...e[0]||(e[0]=[t.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),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m176 272l80 80l80-80M256 48v288"},null,-1)])])}const L2=t.markRaw({name:"ion-download-outline",render:D2}),H2={},W2=t.defineComponent({...H2,__name:"single-file-upload-selector",props:{draggedAreaText:{},accept:{},isError:{type:Boolean}},emits:["update:file"],setup(n,{emit:e}){const i=n,r=e,o=t.ref([]),s=t.computed(()=>o.value.map(l=>(l.status=i.isError?"error":"finished",l))),a=l=>{o.value=l;const c={name:"",content:""};if(l.length===0){r("update:file",null);return}const d=l[0];c.name=d.name;const u=new FileReader;u.addEventListener("load",()=>{c.content=u.result??"",r("update:file",c)}),u.readAsDataURL(d.file)};return(l,c)=>{const d=L2;return t.openBlock(),t.createBlock(t.unref(F.NUpload),{"file-list":s.value,"default-upload":!1,max:1,"show-retry-button":!1,action:"",accept:n.accept,"directory-dnd":"",class:"content-center","onUpdate:fileList":a},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NUploadDragger),null,{default:t.withCtx(()=>[t.renderSlot(l.$slots,"dragged-area",{},()=>[t.createElementVNode("div",null,[t.createVNode(d,{class:"text-2xl"}),t.createElementVNode("div",null,t.toDisplayString(n.draggedAreaText??"Перетащите в эту область файл, который необходимо загрузить."),1)])])]),_:3})]),_:3},8,["file-list","accept"])}}}),j2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function q2(n,e){return t.openBlock(),t.createElementBlock("svg",j2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0 0 80 446.25h340.89a32 32 0 0 0 28.18-47.17m-198.6-1.83a20 20 0 1 1 20-20a20 20 0 0 1-20 20m21.72-201.15l-5.74 122a16 16 0 0 1-32 0l-5.74-121.95a21.73 21.73 0 0 1 21.5-22.69h.21a21.74 21.74 0 0 1 21.73 22.7Z"},null,-1)])])}const X2=t.markRaw({name:"ion-warning",render:q2}),Y2={},U2=t.defineComponent({...Y2,__name:"warning-icon",props:{popoverText:{default:""},iconClass:{default:"text-sc-warning"}},setup(n){return(e,i)=>{const r=X2,o=F.NPopover;return t.openBlock(),t.createBlock(o,{disabled:n.popoverText.length===0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(r,{class:t.normalizeClass(`ml-0.5 ${n.iconClass}`)},null,8,["class"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.popoverText),1)]),_:1},8,["disabled"])}}}),K2={},G2=t.defineComponent({...K2,__name:"debounced-input",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:800},placeholder:{default:""}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.value),s=t.computed(()=>t.inject("debounce-input-time",i.debounceTime)),a=M.debounce(()=>r("update:value",o.value),s.value),l=c=>{o.value=c,a()};return t.watch(()=>i.value,c=>{o.value=c}),(c,d)=>(t.openBlock(),t.createBlock(t.unref(F.NInput),{value:o.value,"onUpdate:value":[d[0]||(d[0]=u=>o.value=u),l],clearable:n.clearable,placeholder:n.placeholder},{prefix:t.withCtx(()=>[t.renderSlot(c.$slots,"prefix")]),_:3},8,["value","clearable","placeholder"]))}}),Z2={},Q2=t.defineComponent({...Z2,__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},parse:{type:Function,default:void 0},showButton:{type:Boolean,default:!0}},emits:["update:value","keydown","input","focus"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.computed(()=>t.inject("debounce-input-time",r.debounceTime)),l=M.debounce(()=>o("update:value",s.value),a.value),c=p=>{s.value=p,l()};t.watch(()=>r.value,p=>{s.value=p});const d=t.ref(null);return e({focus:()=>{var p;return(p=d.value)==null?void 0:p.focus()},blur:()=>{var p;return(p=d.value)==null?void 0:p.blur()},select:()=>{var p;return(p=d.value)==null?void 0:p.select()}}),(p,m)=>(t.openBlock(),t.createBlock(t.unref(F.NInputNumber),{ref_key:"inputReference",ref:d,value:s.value??null,clearable:n.clearable,parse:n.parse,"show-button":n.showButton,placeholder:n.placeholder,min:n.min,max:n.max,step:n.step,validator:n.validator,"onUpdate:value":c,onKeydown:m[0]||(m[0]=g=>o("keydown",g)),onInput:m[1]||(m[1]=g=>o("input",g)),onFocus:m[2]||(m[2]=g=>o("focus",g))},{prefix:t.withCtx(()=>[t.renderSlot(p.$slots,"prefix")]),_:3},8,["value","clearable","parse","show-button","placeholder","min","max","step","validator"]))}}),J2={},eC=t.defineComponent({...J2,__name:"phone-input",props:{value:{},debounceTime:{},disabled:{type:Boolean},placeholder:{},defaultCountry:{},preferredCountries:{},onlyCountries:{}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref((i.value??"").replaceAll(/\D*/g,"")),s=M.debounce(c=>r("update:value",c),i.debounceTime??0),a=c=>{let d="";if(M.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(M.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof xr.PhoneNumber?c.format("E.164"):`+${c.countryCallingCode}${c.nationalNumber}`}i.debounceTime?s(d):r("update:value",d)},l=c=>{const d=c.replaceAll(/\D*/g,"");try{const u=xr.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof xr.ParseError)o.value=d;else throw u}};return t.watch(()=>i.value,c=>{var d;(c==null?void 0:c.replaceAll(/\D*/g,""))!==((d=o.value)==null?void 0:d.replaceAll(/\D*/g,""))&&l(c)},{immediate:!0}),t.onBeforeMount(()=>l(o.value??"")),(c,d)=>(t.openBlock(),t.createBlock(t.unref(Sm.VueTelInput),{modelValue:o.value,"onUpdate:modelValue":[d[0]||(d[0]=u=>o.value=u),a],"auto-default-country":!1,"auto-format":!0,"default-country":n.defaultCountry,disabled:n.disabled,"input-options":{placeholder:n.placeholder},"preferred-countries":n.preferredCountries,"only-countries":n.onlyCountries,mode:"international",class:"tel-input"},null,8,["modelValue","default-country","disabled","input-options","preferred-countries","only-countries"]))}}),tC=fn(eC,[["__scopeId","data-v-751dbb0e"]]),nC={class:"mb-7 grid grid-cols-2 gap-3.5 lg:grid-cols-4"},iC={class:"mb-2 text-[11.5px] font-semibold uppercase text-gray-500"},rC={},oC=t.defineComponent({...rC,__name:"kpi-grid",props:{items:{},isLoading:{type:Boolean}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",nC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.items,r=>(t.openBlock(),t.createElementBlock("div",{key:r.label,class:"rounded-lg border border-solid border-gray-200 px-4 py-4"},[t.createElementVNode("div",iC,t.toDisplayString(r.label),1),t.createElementVNode("div",{class:t.normalizeClass(["text-[25px] font-bold",r.valueClass])},t.toDisplayString(n.isLoading?"…":r.value),3),t.createElementVNode("div",{class:t.normalizeClass(["mt-1.5 text-xs font-medium",r.noteClass])},t.toDisplayString(r.note),3)]))),128))]))}}),sC={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function aC(n,e){return t.openBlock(),t.createElementBlock("svg",sC,[...e[0]||(e[0]=[t.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 lC=t.markRaw({name:"tabler-external-link",render:aC}),cC={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},dC=["href"],uC={},fC=t.defineComponent({...uC,__name:"external-link",props:{text:{},url:{},description:{}},setup(n){return(e,i)=>{const r=lC,o=F.NTooltip;return t.openBlock(),t.createBlock(o,{disabled:t.unref(M.isUndefined)(n.description),placement:"top-start"},{trigger:t.withCtx(()=>[t.createElementVNode("span",cC,[t.createElementVNode("a",{href:n.url,target:"_blank",class:"no-underline"},t.toDisplayString(n.text),9,dC),t.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.description),1)]),_:1},8,["disabled"])}}}),hC={key:1,class:"h-24"},mC={key:2,class:"flex flex-col gap-3"},pC={},gC=t.defineComponent({...pC,__name:"compact-card-list",props:{isLoading:{type:Boolean},isEmpty:{type:Boolean},emptyDescription:{},pagination:{}},emits:["update:page","update:pageSize"],setup(n,{emit:e}){const i=e,r=[20,50,100];return(o,s)=>(t.openBlock(),t.createBlock(t.unref(F.NSpin),{show:n.isLoading},{default:t.withCtx(()=>[!n.isLoading&&n.isEmpty?(t.openBlock(),t.createBlock(t.unref(F.NEmpty),{key:0,description:n.emptyDescription},null,8,["description"])):n.isLoading&&n.isEmpty?(t.openBlock(),t.createElementBlock("div",hC)):(t.openBlock(),t.createElementBlock("div",mC,[t.renderSlot(o.$slots,"default")])),n.pagination&&n.pagination.itemCount>0?(t.openBlock(),t.createBlock(t.unref(F.NPagination),{key:3,class:"mt-4 flex-wrap justify-center gap-y-2",size:"small",page:n.pagination.page,"page-size":n.pagination.pageSize,"item-count":n.pagination.itemCount,"page-slot":n.pagination.pageSlot,"page-sizes":r,"show-size-picker":!0,prefix:t.unref(Ul),"onUpdate:page":s[0]||(s[0]=a=>i("update:page",a)),"onUpdate:pageSize":s[1]||(s[1]=a=>i("update:pageSize",a))},null,8,["page","page-size","item-count","page-slot","prefix"])):t.createCommentVNode("",!0)]),_:3},8,["show"]))}}),yC={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function bC(n,e){return t.openBlock(),t.createElementBlock("svg",yC,[...e[0]||(e[0]=[t.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),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 256H176"},null,-1)])])}const _C=t.markRaw({name:"ion-remove-circle-outline",render:bC});let Go=[];const bf=new WeakMap;function wC(){Go.forEach(n=>n(...bf.get(n))),Go=[]}function _f(n,...e){bf.set(n,e),!Go.includes(n)&&Go.push(n)===1&&requestAnimationFrame(wC)}function Or(n,e){let{target:i}=n;for(;i;){if(i.dataset&&i.dataset[e]!==void 0)return!0;i=i.parentElement}return!1}function zr(n){return n.composedPath()[0]||null}function Dr(n){return typeof n=="string"?n.endsWith("px")?Number(n.slice(0,n.length-2)):Number(n):n}function Lr(n){if(n!=null)return typeof n=="number"?`${n}px`:n.endsWith("px")?n:`${n}px`}function yn(n,e){const i=n.trim().split(/\s+/g),r={top:i[0]};switch(i.length){case 1:r.right=i[0],r.bottom=i[0],r.left=i[0];break;case 2:r.right=i[1],r.left=i[1],r.bottom=i[0];break;case 3:r.right=i[1],r.bottom=i[2],r.left=i[1];break;case 4:r.right=i[1],r.bottom=i[2],r.left=i[3];break;default:throw new Error("[seemly/getMargin]:"+n+" is not a valid value.")}return e===void 0?r:r[e]}const wf={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 xC(n,e,i){e/=100,i/=100;let r=(o,s=(o+n/60)%6)=>i-i*e*Math.max(Math.min(s,4-s,1),0);return[r(5)*255,r(3)*255,r(1)*255]}function kC(n,e,i){e/=100,i/=100;let r=e*Math.min(i,1-i),o=(s,a=(s+n/30)%12)=>i-r*Math.max(Math.min(a-3,9-a,1),-1);return[o(0)*255,o(8)*255,o(4)*255]}const Pn="^\\s*",Fn="\\s*$",fi="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Qt="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",$i="([0-9A-Fa-f])",Ei="([0-9A-Fa-f]{2})",xf=new RegExp(`${Pn}hsl\\s*\\(${Qt},${fi},${fi}\\)${Fn}`),kf=new RegExp(`${Pn}hsv\\s*\\(${Qt},${fi},${fi}\\)${Fn}`),Cf=new RegExp(`${Pn}hsla\\s*\\(${Qt},${fi},${fi},${Qt}\\)${Fn}`),vf=new RegExp(`${Pn}hsva\\s*\\(${Qt},${fi},${fi},${Qt}\\)${Fn}`),CC=new RegExp(`${Pn}rgb\\s*\\(${Qt},${Qt},${Qt}\\)${Fn}`),vC=new RegExp(`${Pn}rgba\\s*\\(${Qt},${Qt},${Qt},${Qt}\\)${Fn}`),SC=new RegExp(`${Pn}#${$i}${$i}${$i}${Fn}`),BC=new RegExp(`${Pn}#${Ei}${Ei}${Ei}${Fn}`),NC=new RegExp(`${Pn}#${$i}${$i}${$i}${$i}${Fn}`),TC=new RegExp(`${Pn}#${Ei}${Ei}${Ei}${Ei}${Fn}`);function Yt(n){return parseInt(n,16)}function $C(n){try{let e;if(e=Cf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),Pi(e[13])];if(e=xf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${n}.`)}catch(e){throw e}}function EC(n){try{let e;if(e=vf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),Pi(e[13])];if(e=kf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${n}.`)}catch(e){throw e}}function Ri(n){try{let e;if(e=BC.exec(n))return[Yt(e[1]),Yt(e[2]),Yt(e[3]),1];if(e=CC.exec(n))return[Bt(e[1]),Bt(e[5]),Bt(e[9]),1];if(e=vC.exec(n))return[Bt(e[1]),Bt(e[5]),Bt(e[9]),Pi(e[13])];if(e=SC.exec(n))return[Yt(e[1]+e[1]),Yt(e[2]+e[2]),Yt(e[3]+e[3]),1];if(e=TC.exec(n))return[Yt(e[1]),Yt(e[2]),Yt(e[3]),Pi(Yt(e[4])/255)];if(e=NC.exec(n))return[Yt(e[1]+e[1]),Yt(e[2]+e[2]),Yt(e[3]+e[3]),Pi(Yt(e[4]+e[4])/255)];if(n in wf)return Ri(wf[n]);if(xf.test(n)||Cf.test(n)){const[i,r,o,s]=$C(n);return[...kC(i,r,o),s]}else if(kf.test(n)||vf.test(n)){const[i,r,o,s]=EC(n);return[...xC(i,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${n}.`)}catch(e){throw e}}function RC(n){return n>1?1:n<0?0:n}function Fa(n,e,i,r){return`rgba(${Bt(n)}, ${Bt(e)}, ${Bt(i)}, ${RC(r)})`}function Va(n,e,i,r,o){return Bt((n*e*(1-r)+i*r)/o)}function PC(n,e){Array.isArray(n)||(n=Ri(n)),Array.isArray(e)||(e=Ri(e));const i=n[3],r=e[3],o=Pi(i+r-i*r);return Fa(Va(n[0],i,e[0],r,o),Va(n[1],i,e[1],r,o),Va(n[2],i,e[2],r,o),o)}function De(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Ri(n);return typeof e.alpha=="number"?Fa(i,r,o,e.alpha):Fa(i,r,o,s)}function Zo(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Ri(n),{lightness:a=1,alpha:l=1}=e;return FC([i*a,r*a,o*a,s*l])}function Pi(n){const e=Math.round(Number(n)*100)/100;return e>1?1:e<0?0:e}function Qo(n){const e=Math.round(Number(n));return e>=360||e<0?0:e}function Bt(n){const e=Math.round(Number(n));return e>255?255:e<0?0:e}function hi(n){const e=Math.round(Number(n));return e>100?100:e<0?0:e}function FC(n){const[e,i,r]=n;return 3 in n?`rgba(${Bt(e)}, ${Bt(i)}, ${Bt(r)}, ${Pi(n[3])})`:`rgba(${Bt(e)}, ${Bt(i)}, ${Bt(r)}, 1)`}function VC(n=8){return Math.random().toString(16).slice(2,2+n)}function Sf(n){return Array.isArray(n)?n:[n]}const Ma={STOP:"STOP"};function Bf(n,e){const i=e(n);n.children!==void 0&&i!==Ma.STOP&&n.children.forEach(r=>Bf(r,e))}function MC(n,e={}){const{preserveGroup:i=!1}=e,r=[],o=i?a=>{a.isLeaf||(r.push(a.key),s(a.children))}:a=>{a.isLeaf||(a.isGroup||r.push(a.key),s(a.children))};function s(a){a.forEach(o)}return s(n),r}function IC(n,e){const{isLeaf:i}=n;return i!==void 0?i:!e(n)}function AC(n){return n.children}function OC(n){return n.key}function zC(){return!1}function DC(n,e){const{isLeaf:i}=n;return!(i===!1&&!Array.isArray(e(n)))}function LC(n){return n.disabled===!0}function HC(n,e){return n.isLeaf===!1&&!Array.isArray(e(n))}function WC(n,e){if(n.isLeaf===!0){const i=e(n);if(Array.isArray(i)&&i.length>0)return!0}return!1}function Ia(n){var e;return n==null?[]:Array.isArray(n)?n:(e=n.checkedKeys)!==null&&e!==void 0?e:[]}function Aa(n){var e;return n==null||Array.isArray(n)?[]:(e=n.indeterminateKeys)!==null&&e!==void 0?e:[]}function jC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)||i.add(r)}),Array.from(i)}function qC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)&&i.delete(r)}),Array.from(i)}function XC(n){return(n==null?void 0:n.type)==="group"}function YC(n){const e=new Map;return n.forEach((i,r)=>{e.set(i.key,r)}),i=>{var r;return(r=e.get(i))!==null&&r!==void 0?r:null}}class UC extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function KC(n,e,i,r){return Jo(e.concat(n),i,r,!1)}function GC(n,e){const i=new Set;return n.forEach(r=>{const o=e.treeNodeMap.get(r);if(o!==void 0){let s=o.parent;for(;s!==null&&!(s.disabled||i.has(s.key));)i.add(s.key),s=s.parent}}),i}function ZC(n,e,i,r){const o=Jo(e,i,r,!1),s=Jo(n,i,r,!0),a=GC(n,i),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function Oa(n,e){const{checkedKeys:i,keysToCheck:r,keysToUncheck:o,indeterminateKeys:s,cascade:a,leafOnly:l,checkStrategy:c,allowNotLoaded:d}=n;if(!a)return r!==void 0?{checkedKeys:jC(i,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:qC(i,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(i),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let f;o!==void 0?f=ZC(o,i,e,d):r!==void 0?f=KC(r,i,e,d):f=Jo(i,e,d,!1);const h=c==="parent",p=c==="child"||l,m=f,g=new Set,b=Math.max.apply(null,Array.from(u.keys()));for(let y=b;y>=0;y-=1){const _=y===0,k=u.get(y);for(const x of k){if(x.isLeaf)continue;const{key:v,shallowLoaded:B}=x;if(p&&B&&x.children.forEach($=>{!$.disabled&&!$.isLeaf&&$.shallowLoaded&&m.has($.key)&&m.delete($.key)}),x.disabled||!B)continue;let w=!0,T=!1,C=!0;for(const $ of x.children){const E=$.key;if(!$.disabled){if(C&&(C=!1),m.has(E))T=!0;else if(g.has(E)){T=!0,w=!1;break}else if(w=!1,T)break}}w&&!C?(h&&x.children.forEach($=>{!$.disabled&&m.has($.key)&&m.delete($.key)}),m.add(v)):T&&g.add(v),_&&p&&m.has(v)&&m.delete(v)}}return{checkedKeys:Array.from(m),indeterminateKeys:Array.from(g)}}function Jo(n,e,i,r){const{treeNodeMap:o,getChildren:s}=e,a=new Set,l=new Set(n);return n.forEach(c=>{const d=o.get(c);d!==void 0&&Bf(d,u=>{if(u.disabled)return Ma.STOP;const{key:f}=u;if(!a.has(f)&&(a.add(f),l.add(f),HC(u.rawNode,s))){if(r)return Ma.STOP;if(!i)throw new UC}})}),l}function QC(n,{includeGroup:e=!1,includeSelf:i=!0},r){var o;const s=r.treeNodeMap;let a=n==null?null:(o=s.get(n))!==null&&o!==void 0?o:null;const l={keyPath:[],treeNodePath:[],treeNode:a};if(a!=null&&a.ignored)return l.treeNode=null,l;for(;a;)!a.ignored&&(e||!a.isGroup)&&l.treeNodePath.push(a),a=a.parent;return l.treeNodePath.reverse(),i||l.treeNodePath.pop(),l.keyPath=l.treeNodePath.map(c=>c.key),l}function JC(n){if(n.length===0)return null;const e=n[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function ev(n,e){const i=n.siblings,r=i.length,{index:o}=n;return e?i[(o+1)%r]:o===i.length-1?null:i[o+1]}function Nf(n,e,{loop:i=!1,includeDisabled:r=!1}={}){const o=e==="prev"?tv:ev,s={reverse:e==="prev"};let a=!1,l=null;function c(d){if(d!==null){if(d===n){if(!a)a=!0;else if(!n.disabled&&!n.isGroup){l=n;return}}else if((!d.disabled||r)&&!d.ignored&&!d.isGroup){l=d;return}if(d.isGroup){const u=za(d,s);u!==null?l=u:c(o(d,i))}else{const u=o(d,!1);if(u!==null)c(u);else{const f=nv(d);f!=null&&f.isGroup?c(o(f,i)):i&&c(o(d,!0))}}}}return c(n),l}function tv(n,e){const i=n.siblings,r=i.length,{index:o}=n;return e?i[(o-1+r)%r]:o===0?null:i[o-1]}function nv(n){return n.parent}function za(n,e={}){const{reverse:i=!1}=e,{children:r}=n;if(r){const{length:o}=r,s=i?o-1:0,a=i?-1:o,l=i?-1:1;for(let c=s;c!==a;c+=l){const d=r[c];if(!d.disabled&&!d.ignored)if(d.isGroup){const u=za(d,e);if(u!==null)return u}else return d}}return null}const iv={getChild(){return this.ignored?null:za(this)},getParent(){const{parent:n}=this;return n!=null&&n.isGroup?n.getParent():n},getNext(n={}){return Nf(this,"next",n)},getPrev(n={}){return Nf(this,"prev",n)}};function rv(n,e){const i=e?new Set(e):void 0,r=[];function o(s){s.forEach(a=>{r.push(a),!(a.isLeaf||!a.children||a.ignored)&&(a.isGroup||i===void 0||i.has(a.key))&&o(a.children)})}return o(n),r}function ov(n,e){const i=n.key;for(;e;){if(e.key===i)return!0;e=e.parent}return!1}var sv={};function Tf(n,e,i,r,o,s=null,a=0){const l=[];return n.forEach((c,d)=>{var u;sv.NODE_ENV!=="production"&&WC(c,o)&&console.error("[treemate]: node",c,"is invalid");const f=Object.create(r);if(f.rawNode=c,f.siblings=l,f.level=a,f.index=d,f.isFirstChild=d===0,f.isLastChild=d+1===n.length,f.parent=s,!f.ignored){const h=o(c);Array.isArray(h)&&(f.children=Tf(h,e,i,r,o,f,a+1))}l.push(f),e.set(f.key,f),i.has(a)||i.set(a,[]),(u=i.get(a))===null||u===void 0||u.push(f)}),l}function av(n,e={}){var i;const r=new Map,o=new Map,{getDisabled:s=LC,getIgnored:a=zC,getIsGroup:l=XC,getKey:c=OC}=e,d=(i=e.getChildren)!==null&&i!==void 0?i:AC,u=e.ignoreEmptyChildren?x=>{const v=d(x);return Array.isArray(v)?v.length?v:null:v}:d,f=Object.assign({get key(){return c(this.rawNode)},get disabled(){return s(this.rawNode)},get isGroup(){return l(this.rawNode)},get isLeaf(){return IC(this.rawNode,u)},get shallowLoaded(){return DC(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(x){return ov(this,x)}},iv),h=Tf(n,r,o,f,u);function p(x){if(x==null)return null;const v=r.get(x);return v&&!v.isGroup&&!v.ignored?v:null}function m(x){if(x==null)return null;const v=r.get(x);return v&&!v.ignored?v:null}function g(x,v){const B=m(x);return B?B.getPrev(v):null}function b(x,v){const B=m(x);return B?B.getNext(v):null}function y(x){const v=m(x);return v?v.getParent():null}function _(x){const v=m(x);return v?v.getChild():null}const k={treeNodes:h,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(x){return rv(h,x)},getNode:p,getPrev:g,getNext:b,getParent:y,getChild:_,getFirstAvailableNode(){return JC(h)},getPath(x,v={}){return QC(x,v,k)},getCheckedKeys(x,v={}){const{cascade:B=!0,leafOnly:w=!1,checkStrategy:T="all",allowNotLoaded:C=!1}=v;return Oa({checkedKeys:Ia(x),indeterminateKeys:Aa(x),cascade:B,leafOnly:w,checkStrategy:T,allowNotLoaded:C},k)},check(x,v,B={}){const{cascade:w=!0,leafOnly:T=!1,checkStrategy:C="all",allowNotLoaded:$=!1}=B;return Oa({checkedKeys:Ia(v),indeterminateKeys:Aa(v),keysToCheck:x==null?[]:Sf(x),cascade:w,leafOnly:T,checkStrategy:C,allowNotLoaded:$},k)},uncheck(x,v,B={}){const{cascade:w=!0,leafOnly:T=!1,checkStrategy:C="all",allowNotLoaded:$=!1}=B;return Oa({checkedKeys:Ia(v),indeterminateKeys:Aa(v),keysToUncheck:x==null?[]:Sf(x),cascade:w,leafOnly:T,checkStrategy:C,allowNotLoaded:$},k)},getNonLeafKeys(x={}){return MC(h,x)}};return k}function es(n){return n.composedPath()[0]}const lv={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function cv(n,e,i){if(n==="mousemoveoutside"){const r=o=>{e.contains(es(o))||i(o)};return{mousemove:r,touchstart:r}}else if(n==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(es(a))},s=a=>{r&&(e.contains(es(a))||i(a))};return{mousedown:o,mouseup:s,touchstart:o,touchend:s}}return console.error(`[evtd/create-trap-handler]: name \`${n}\` is invalid. This could be a bug of evtd.`),{}}function $f(n,e,i){const r=lv[n];let o=r.get(e);o===void 0&&r.set(e,o=new WeakMap);let s=o.get(i);return s===void 0&&o.set(i,s=cv(n,e,i)),s}function dv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=$f(n,e,i);return Object.keys(o).forEach(s=>{At(s,document,o[s],r)}),!0}return!1}function uv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=$f(n,e,i);return Object.keys(o).forEach(s=>{ht(s,document,o[s],r)}),!0}return!1}function fv(){if(typeof window>"u")return{on:()=>{},off:()=>{}};const n=new WeakMap,e=new WeakMap;function i(){n.set(this,!0)}function r(){n.set(this,!0),e.set(this,!0)}function o(w,T,C){const $=w[T];return w[T]=function(){return C.apply(w,arguments),$.apply(w,arguments)},w}function s(w,T){w[T]=Event.prototype[T]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var w;return(w=a.get(this))!==null&&w!==void 0?w:null}function d(w,T){l!==void 0&&Object.defineProperty(w,"currentTarget",{configurable:!0,enumerable:!0,get:T??l.get})}const u={bubble:{},capture:{}},f={};function h(){const w=function(T){const{type:C,eventPhase:$,bubbles:E}=T,I=es(T);if($===2)return;const R=$===1?"capture":"bubble";let O=I;const U=[];for(;O===null&&(O=window),U.push(O),O!==window;)O=O.parentNode||null;const Q=u.capture[C],G=u.bubble[C];if(o(T,"stopPropagation",i),o(T,"stopImmediatePropagation",r),d(T,c),R==="capture"){if(Q===void 0)return;for(let W=U.length-1;W>=0&&!n.has(T);--W){const D=U[W],L=Q.get(D);if(L!==void 0){a.set(T,D);for(const z of L){if(e.has(T))break;z(T)}}if(W===0&&!E&&G!==void 0){const z=G.get(D);if(z!==void 0)for(const P of z){if(e.has(T))break;P(T)}}}}else if(R==="bubble"){if(G===void 0)return;for(let W=0;W<U.length&&!n.has(T);++W){const D=U[W],L=G.get(D);if(L!==void 0){a.set(T,D);for(const z of L){if(e.has(T))break;z(T)}}}}s(T,"stopPropagation"),s(T,"stopImmediatePropagation"),d(T)};return w.displayName="evtdUnifiedHandler",w}function p(){const w=function(T){const{type:C,eventPhase:$}=T;if($!==2)return;const E=f[C];E!==void 0&&E.forEach(I=>I(T))};return w.displayName="evtdUnifiedWindowEventHandler",w}const m=h(),g=p();function b(w,T){const C=u[w];return C[T]===void 0&&(C[T]=new Map,window.addEventListener(T,m,w==="capture")),C[T]}function y(w){return f[w]===void 0&&(f[w]=new Set,window.addEventListener(w,g)),f[w]}function _(w,T){let C=w.get(T);return C===void 0&&w.set(T,C=new Set),C}function k(w,T,C,$){const E=u[T][C];if(E!==void 0){const I=E.get(w);if(I!==void 0&&I.has($))return!0}return!1}function x(w,T){const C=f[w];return!!(C!==void 0&&C.has(T))}function v(w,T,C,$){let E;if(typeof $=="object"&&$.once===!0?E=Q=>{B(w,T,E,$),C(Q)}:E=C,dv(w,T,E,$))return;const R=$===!0||typeof $=="object"&&$.capture===!0?"capture":"bubble",O=b(R,w),U=_(O,T);if(U.has(E)||U.add(E),T===window){const Q=y(w);Q.has(E)||Q.add(E)}}function B(w,T,C,$){if(uv(w,T,C,$))return;const I=$===!0||typeof $=="object"&&$.capture===!0,R=I?"capture":"bubble",O=b(R,w),U=_(O,T);if(T===window&&!k(T,I?"bubble":"capture",w,C)&&x(w,C)){const G=f[w];G.delete(C),G.size===0&&(window.removeEventListener(w,g),f[w]=void 0)}U.has(C)&&U.delete(C),U.size===0&&O.delete(T),O.size===0&&(window.removeEventListener(w,m,R==="capture"),u[R][w]=void 0)}return{on:v,off:B}}const{on:At,off:ht}=fv(),fr="@@mmoContext",hv={mounted(n,{value:e}){n[fr]={handler:void 0},typeof e=="function"&&(n[fr].handler=e,At("mousemoveoutside",n,e))},updated(n,{value:e}){const i=n[fr];typeof e=="function"?i.handler?i.handler!==e&&(ht("mousemoveoutside",n,i.handler),i.handler=e,At("mousemoveoutside",n,e)):(n[fr].handler=e,At("mousemoveoutside",n,e)):i.handler&&(ht("mousemoveoutside",n,i.handler),i.handler=void 0)},unmounted(n){const{handler:e}=n[fr];e&&ht("mousemoveoutside",n,e),n[fr].handler=void 0}},hr="@@coContext",ts={mounted(n,{value:e,modifiers:i}){n[hr]={handler:void 0},typeof e=="function"&&(n[hr].handler=e,At("clickoutside",n,e,{capture:i.capture}))},updated(n,{value:e,modifiers:i}){const r=n[hr];typeof e=="function"?r.handler?r.handler!==e&&(ht("clickoutside",n,r.handler,{capture:i.capture}),r.handler=e,At("clickoutside",n,e,{capture:i.capture})):(n[hr].handler=e,At("clickoutside",n,e,{capture:i.capture})):r.handler&&(ht("clickoutside",n,r.handler,{capture:i.capture}),r.handler=void 0)},unmounted(n,{modifiers:e}){const{handler:i}=n[hr];i&&ht("clickoutside",n,i,{capture:e.capture}),n[hr].handler=void 0}};function mv(n,e){console.error(`[vdirs/${n}]: ${e}`)}class pv{constructor(){this.elementZIndex=new Map,this.nextZIndex=2e3}get elementCount(){return this.elementZIndex.size}ensureZIndex(e,i){const{elementZIndex:r}=this;if(i!==void 0){e.style.zIndex=`${i}`,r.delete(e);return}const{nextZIndex:o}=this;r.has(e)&&r.get(e)+1===this.nextZIndex||(e.style.zIndex=`${o}`,r.set(e,o),this.nextZIndex=o+1,this.squashState())}unregister(e,i){const{elementZIndex:r}=this;r.has(e)?r.delete(e):i===void 0&&mv("z-index-manager/unregister-element","Element not found when unregistering."),this.squashState()}squashState(){const{elementCount:e}=this;e||(this.nextZIndex=2e3),this.nextZIndex-e>2500&&this.rearrange()}rearrange(){const e=Array.from(this.elementZIndex.entries());e.sort((i,r)=>i[1]-r[1]),this.nextZIndex=2e3,e.forEach(i=>{const r=i[0],o=this.nextZIndex++;`${o}`!==r.style.zIndex&&(r.style.zIndex=`${o}`)})}}const Da=new pv,mr="@@ziContext",Ef={mounted(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i;n[mr]={enabled:!!o,initialized:!1},o&&(Da.ensureZIndex(n,r),n[mr].initialized=!0)},updated(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i,s=n[mr].enabled;o&&!s&&(Da.ensureZIndex(n,r),n[mr].initialized=!0),n[mr].enabled=!!o},unmounted(n,e){if(!n[mr].initialized)return;const{value:i={}}=e,{zIndex:r}=i;Da.unregister(n,r)}};function gv(n){const e=t.ref(!!n.value);if(e.value)return t.readonly(e);const i=t.watch(n,r=>{r&&(e.value=!0,i())});return t.readonly(e)}function an(n){const e=t.computed(n),i=t.ref(e.value);return t.watch(e,r=>{i.value=r}),typeof n=="function"?i:{__v_isRef:!0,get value(){return i.value},set value(r){n.set(r)}}}const yv=typeof window<"u";let pr,Hr;(()=>{var n,e;pr=yv?(e=(n=document)===null||n===void 0?void 0:n.fonts)===null||e===void 0?void 0:e.ready:void 0,Hr=!1,pr!==void 0?pr.then(()=>{Hr=!0}):Hr=!0})();function bv(n){if(Hr)return;let e=!1;t.onMounted(()=>{Hr||pr==null||pr.then(()=>{e||n()})}),t.onBeforeUnmount(()=>{e=!0})}function La(n,e){return t.watch(n,i=>{i!==void 0&&(e.value=i)}),t.computed(()=>n.value===void 0?e.value:n.value)}function ns(){const n=t.ref(!1);return t.onMounted(()=>{n.value=!0}),t.readonly(n)}function Rf(n,e){return t.computed(()=>{for(const i of e)if(n[i]!==void 0)return n[i];return n[e[e.length-1]]})}const _v=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function wv(){return _v}function Ha(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);return r()}function Wa(n,e=!0,i=[]){return n.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&i.push(t.createTextVNode(String(r)));return}if(Array.isArray(r)){Wa(r,e,i);return}if(r.type===t.Fragment){if(r.children===null)return;Array.isArray(r.children)&&Wa(r.children,e,i)}else r.type!==t.Comment&&i.push(r)}}),i}function Pf(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);const o=Wa(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${n}]: slot[${i}] should have exactly one child.`)}let mi=null;function Ff(){if(mi===null&&(mi=document.getElementById("v-binder-view-measurer"),mi===null)){mi=document.createElement("div"),mi.id="v-binder-view-measurer";const{style:n}=mi;n.position="fixed",n.left="0",n.right="0",n.top="0",n.bottom="0",n.pointerEvents="none",n.visibility="hidden",document.body.appendChild(mi)}return mi.getBoundingClientRect()}function xv(n,e){const i=Ff();return{top:e,left:n,height:0,width:0,right:i.width-n,bottom:i.height-e}}function ja(n){const e=n.getBoundingClientRect(),i=Ff();return{left:e.left-i.left,top:e.top-i.top,bottom:i.height+i.top-e.bottom,right:i.width+i.left-e.right,width:e.width,height:e.height}}function kv(n){return n.nodeType===9?null:n.parentNode}function Vf(n){if(n===null)return null;const e=kv(n);if(e===null)return null;if(e.nodeType===9)return document;if(e.nodeType===1){const{overflow:i,overflowX:r,overflowY:o}=getComputedStyle(e);if(/(auto|scroll|overlay)/.test(i+o+r))return e}return Vf(e)}const Mf=t.defineComponent({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(n){var e;t.provide("VBinder",(e=t.getCurrentInstance())===null||e===void 0?void 0:e.proxy);const i=t.inject("VBinder",null),r=t.ref(null),o=y=>{r.value=y,i&&n.syncTargetWithParent&&i.setTargetRef(y)};let s=[];const a=()=>{let y=r.value;for(;y=Vf(y),y!==null;)s.push(y);for(const _ of s)At("scroll",_,f,!0)},l=()=>{for(const y of s)ht("scroll",y,f,!0);s=[]},c=new Set,d=y=>{c.size===0&&a(),c.has(y)||c.add(y)},u=y=>{c.has(y)&&c.delete(y),c.size===0&&l()},f=()=>{_f(h)},h=()=>{c.forEach(y=>y())},p=new Set,m=y=>{p.size===0&&At("resize",window,b),p.has(y)||p.add(y)},g=y=>{p.has(y)&&p.delete(y),p.size===0&&ht("resize",window,b)},b=()=>{p.forEach(y=>y())};return t.onBeforeUnmount(()=>{ht("resize",window,b),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:m,removeResizeListener:g}},render(){return Ha("binder",this.$slots)}}),If=t.defineComponent({name:"Target",setup(){const{setTargetRef:n,syncTarget:e}=t.inject("VBinder");return{syncTarget:e,setTargetDirective:{mounted:n,updated:n}}},render(){const{syncTarget:n,setTargetDirective:e}=this;return n?t.withDirectives(Pf("follower",this.$slots),[[e]]):Pf("follower",this.$slots)}}),Cv="@css-render/vue3-ssr";function vv(n,e){return`<style cssr-id="${n}">
103
+ `}},Po=vi.Multiply,F0=[1,0,0,0,1,0,0,0,1],ui=new Cn(9),V0=St.Utils,Fd=new re,ua=new Cn([0,0,1,0,0,1,0,1,1,0,1,1]),Se={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Ke.document?Ke.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new vi,group:{removeChild:function(n,e){if(n.children)for(let i=0;i<n.children.length;i++)Se.group.removeChild(n.children[i],e);n._renderer.texture&&(e.deleteTexture(n._renderer.texture),delete n._renderer.texture),n._renderer.positionBuffer&&(e.deleteBuffer(n._renderer.positionBuffer),delete n._renderer.positionBuffer)},render:function(n,e){if(!this._visible)return;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const i=this.parent,r=i._matrix&&i._matrix.manual||i._flagMatrix,o=this._matrix.manual||this._flagMatrix;if((r||o)&&(this._renderer.matrix||(this._renderer.matrix=new Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,i._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re),this._scale instanceof re?(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(i._renderer.type)||(this._renderer.scale.x*=i._renderer.scale.x,this._renderer.scale.y*=i._renderer.scale.y),r&&(this._flagMatrix=!0)),this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const a=St.Utils.getRendererType(this._mask._renderer.type);Se[a].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}this._flagOpacity=i._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);let s;if(this._flagSubtractions)for(s=0;s<this.subtractions.length;s++)Se.group.removeChild(this.subtractions[s],n);for(s=0;s<this.children.length;s++){const a=this.children[s],l=St.Utils.getRendererType(a._renderer.type);Se[l].render.call(a,n,e)}return this._mask&&n.disable(n.STENCIL_TEST),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(n,e){let i,r,o,s,a,l,c,d,u,f,h,p,m,g;const b=e._renderer.vertices,y=this.canvas,_=this.ctx,k=n.renderer.ratio,x=Fd.copy(e._renderer.scale).multiply(k),v=e._stroke,B=e._linewidth,w=e._fill,T=e._renderer.opacity||e._opacity,C=e._cap,$=e._join,E=e._miter,I=e._closed,R=e.dashes,O=b.length,U=O-1;y.width=Math.max(Math.ceil(e._renderer.rect.width*x.x),1),y.height=Math.max(Math.ceil(e._renderer.rect.height*x.y),1);const Q=e._renderer.rect.centroid,G=Q.x,W=Q.y;if(_.clearRect(0,0,y.width,y.height),w)if(typeof w=="string")_.fillStyle=w;else{const V=St.Utils.getRendererType(w._renderer.type);Se[V].render.call(w,_,e),_.fillStyle=w._renderer.effect}if(v){if(typeof v=="string")_.strokeStyle=v;else{const V=St.Utils.getRendererType(v._renderer.type);Se[V].render.call(v,_,e),_.strokeStyle=v._renderer.effect}B&&(_.lineWidth=vn(e)),E&&(_.miterLimit=E),$&&(_.lineJoin=$),!I&&C&&(_.lineCap=C)}typeof T=="number"&&(_.globalAlpha=T),R&&R.length>0&&(_.lineDashOffset=R.offset||0,_.setLineDash(R));let D,L,z,P,q,K,J,Y;_.save(),_.scale(x.x,x.y),_.translate(G,W),_.beginPath();for(let V=0;V<b.length;V++){const A=b[V];switch(p=A.x,m=A.y,A.command){case ne.close:_.closePath();break;case ne.arc:L=A.rx,z=A.ry,P=A.xAxisRotation,q=A.largeArcFlag,K=A.sweepFlag,i=I?st(V-1,O):Math.max(V-1,0),r=b[i],J=r.x,Y=r.y,V0.renderSvgArcCommand(_,J,Y,L,z,q,K,P,p,m);break;case ne.curve:i=I?st(V-1,O):Math.max(V-1,0),r=b[i],d=r.controls&&r.controls.right||re.zero,u=A.controls&&A.controls.left||re.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),A._relative?(s=u.x+A.x,a=u.y+A.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,p,m),V>=U&&I&&(o=D,f=A.controls&&A.controls.right||re.zero,h=o.controls&&o.controls.left||re.zero,A._relative?(l=f.x+A.x,c=f.y+A.y):(l=f.x,c=f.y),o._relative?(s=h.x+o.x,a=h.y+o.y):(s=h.x,a=h.y),p=o.x,m=o.y,_.bezierCurveTo(l,c,s,a,p,m));break;case ne.line:_.lineTo(p,m);break;case ne.move:D=A,_.moveTo(p,m);break}}I&&_.closePath(),Se.isHidden.test(w)||(g=w._renderer&&w._renderer.offset,g&&(_.save(),_.translate(-w._renderer.offset.x,-w._renderer.offset.y),_.scale(w._renderer.scale.x,w._renderer.scale.y)),_.fill(),g&&_.restore()),Se.isHidden.test(v)||(g=v._renderer&&v._renderer.offset,g&&(_.save(),_.translate(-v._renderer.offset.x,-v._renderer.offset.y),_.scale(v._renderer.scale.x,v._renderer.scale.y),_.lineWidth=B/v._renderer.scale.x),_.stroke(),g&&_.restore()),_.restore()},getBoundingClientRect:function(n,e,i){let r=1/0,o=-1/0,s=1/0,a=-1/0,l,c;n.forEach(function(d){const u=d.x,f=d.y,h=d.controls;let p,m,g,b,y,_;s=Math.min(f,s),r=Math.min(u,r),o=Math.max(u,o),a=Math.max(f,a),d.controls&&(y=h.left,_=h.right,!(!y||!_)&&(p=d._relative?y.x+u:y.x,m=d._relative?y.y+f:y.y,g=d._relative?_.x+u:_.x,b=d._relative?_.y+f:_.y,!(!p||!m||!g||!b)&&(s=Math.min(m,b,s),r=Math.min(p,g,r),o=Math.max(p,g,o),a=Math.max(m,b,a))))}),typeof e=="number"&&(s-=e,r-=e,o+=e,a+=e),l=o-r,c=a-s,i.top=s,i.left=r,i.right=o,i.bottom=a,i.width=l,i.height=c,i.centroid||(i.centroid={}),i.centroid.x=-r,i.centroid.y=-s},render:function(n,e,i){if(!this._visible||!this._opacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=i||this.parent,o=St.Utils.getRendererType(this._renderer.type),s=e[o],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 Ge&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ze&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof ze&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ge&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ze&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof ze&&(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 Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let f,h;this._scale instanceof re?(f=this._scale.x*r._renderer.scale.x,h=this._scale.y*r._renderer.scale.y):(f=this._scale*r._renderer.scale.x,h=this._scale*r._renderer.scale.y),this._renderer.scale.x=f<0?-f:f,this._renderer.scale.y=h<0?-h:h,c&&(this._renderer.parent=r)}if(this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const f=St.Utils.getRendererType(this._mask._renderer.type);Se[f].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}if(d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,Se.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;e.current!==s&&(n.useProgram(s),n.bindBuffer(n.ARRAY_BUFFER,e.buffers.position),n.vertexAttribPointer(s.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(s.position),n.bufferData(n.ARRAY_BUFFER,ua,n.STATIC_DRAW),e.resolution.flagged||n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture);const u=this._renderer.rect;return n.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),n.uniform4f(s.rect,u.left,u.top,u.right,u.bottom),n.drawArrays(n.TRIANGLES,0,6),this._mask&&n.disable(n.STENCIL_TEST),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(n,e){let i;const r=this.canvas,o=this.ctx,s=n.renderer.ratio,a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._size*s;let h=f;Se.isHidden.test(a)||(h+=l),r.width=_c(h),r.height=r.width;const p=h/r.width,m=r.width/2,g=r.height/2;if(o.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")o.fillStyle=c;else{const b=St.Utils.getRendererType(c._renderer.type);Se[b].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const b=St.Utils.getRendererType(a._renderer.type);Se[b].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=vn(e)/p)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(m,g),o.scale(Se.precision,Se.precision),o.beginPath(),o.arc(0,0,f/p*.5,0,tt),o.restore(),closed&&o.closePath(),Se.isHidden.test(c)||(i=c._renderer&&c._renderer.offset,i&&(o.save(),o.translate(-c._renderer.offset.x,-c._renderer.offset.y),o.scale(c._renderer.scale.x,c._renderer.scale.y)),o.fill(),i&&o.restore()),Se.isHidden.test(a)||(i=a._renderer&&a._renderer.offset,i&&(o.save(),o.translate(-a._renderer.offset.x,-a._renderer.offset.y),o.scale(a._renderer.scale.x,a._renderer.scale.y),o.lineWidth=l/a._renderer.scale.x),o.stroke(),i&&o.restore())},render:function(n,e,i){if(!this._visible||!this._opacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const o=i||this.parent,s=e[this._renderer.type],a=this._sizeAttenuation,l=this._stroke,c=this._linewidth,d=o._matrix.manual||o._flagMatrix,u=this._matrix.manual||this._flagMatrix,f=this._renderer.parent!==o,h=this._renderer.vertices,p=this._renderer.collection.length,m=this._flagVertices,g=this._flagFill||this._fill instanceof Ge&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ze&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof ze&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ge&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ze&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof ze&&(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||o._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(d||u||f){this._renderer.matrix||(this._renderer.matrix=new Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,o._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let b,y;this._scale instanceof re?(b=this._scale.x*o._renderer.scale.x,y=this._scale.y*o._renderer.scale.y):(b=this._scale*o._renderer.scale.x,y=this._scale*o._renderer.scale.y),this._renderer.scale.x=b<0?-b:b,this._renderer.scale.y=y<0?-y:y,f&&(this._renderer.parent=o)}if(m){const b=this._renderer.positionBuffer;b&&n.deleteBuffer(b),this._renderer.positionBuffer=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,this._renderer.positionBuffer),n.vertexAttribPointer(s.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(s.position),n.bufferData(n.ARRAY_BUFFER,h,n.STATIC_DRAW)}return g?(this._renderer.opacity=this._opacity*o._renderer.opacity,Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture?this:(Se.isHidden.test(l)||(r+=c),r/=Se.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),e.current!==s&&(n.useProgram(s),e.resolution.flagged||n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture),n.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),n.uniform1f(s.size,r*e.resolution.ratio),n.drawArrays(n.POINTS,0,p),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(n,e){const i=this.canvas,r=this.ctx,o=n.renderer.ratio,s=Fd.copy(e._renderer.scale).multiply(o),a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._decoration,h=e._direction;i.width=Math.max(Math.ceil(e._renderer.rect.width*s.x),1),i.height=Math.max(Math.ceil(e._renderer.rect.height*s.y),1);const p=e._renderer.rect.centroid,m=p.x,g=p.y;let b,y,_,k,x,v,B,w,T,C,$;const E=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,i.width,i.height),E||(r.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=h,c)if(typeof c=="string")r.fillStyle=c;else{const I=St.Utils.getRendererType(c._renderer.type);Se[I].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const I=St.Utils.getRendererType(a._renderer.type);Se[I].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=vn(e))}if(typeof d=="number"&&(r.globalAlpha=d),u&&u.length>0&&(r.lineDashOffset=u.offset||0,r.setLineDash(u)),r.save(),r.scale(s.x,s.y),r.translate(m,g),Se.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),b=e._size/c._renderer.scale.y,y=e._leading/c._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=c._renderer.offset.x/c._renderer.scale.x,k=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,k),r.restore()):r.fillText(e.value,0,0)),Se.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),b=e._size/a._renderer.scale.y,y=e._leading/a._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=a._renderer.offset.x/a._renderer.scale.x,k=a._renderer.offset.y/a._renderer.scale.y,x=l/a._renderer.scale.x,r.lineWidth=x,r.strokeText(e.value,_,k),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(f)){const I=r.measureText(e.value);switch(f){case"underline":T=I.actualBoundingBoxDescent,$=I.actualBoundingBoxDescent;break;case"strikethrough":T=0,$=0;break}w=-I.width/2,C=I.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(w,T),r.lineTo(C,$),r.stroke()}r.restore()},getBoundingClientRect:function(n,e){const i=Se.ctx;i.font=[n._style,n._weight,n._size+"px/"+n._leading+"px",n._family].join(" "),i.textAlign="center",i.textBaseline=St.Utils.baselines[n._baseline]||n._baseline;const r=i.measureText(n._value);let o=r.width,s=1.15*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent);this._linewidth&&!Se.isHidden.test(this._stroke)&&(o+=this._linewidth*2,s+=this._linewidth*2);const a=o/2,l=s/2;switch(Se.alignments[n._alignment]||n._alignment){case Se.alignments.left:n.direction==="ltr"?(e.left=0,e.right=o):(e.left=-o,e.right=0);break;case Se.alignments.right:n.direction==="ltr"?(e.left=-o,e.right=0):(e.left=0,e.right=o);break;default:e.left=-a,e.right=a}switch(n._baseline){case"bottom":e.top=-s,e.bottom=0;break;case"top":e.top=0,e.bottom=s;break;case"baseline":e.top=-l*1.5,e.bottom=l*.5;break;default:e.top=-l,e.bottom=l}e.width=o,e.height=s,e.centroid||(e.centroid={}),e.centroid.x=a,e.centroid.y=l},render:function(n,e,i){if(!this._visible||!this._opacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=i||this.parent,o=e[this._renderer.type],s=r._matrix.manual||r._flagMatrix,a=this._matrix.manual||this._flagMatrix,l=this._renderer.parent!==r,c=this._flagVertices||this._flagFill||this._fill instanceof Ge&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ze&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof ze&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ge&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ze&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof ze&&(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(s||a||l){this._renderer.matrix||(this._renderer.matrix=new Cn(9)),this._matrix.toTransformArray(!0,ui),Po(ui,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let u,f;this._scale instanceof re?(u=this._scale.x*r._renderer.scale.x,f=this._scale.y*r._renderer.scale.y):(u=this._scale*r._renderer.scale.x,f=this._scale*r._renderer.scale.y),this._renderer.scale.x=u<0?-u:u,this._renderer.scale.y=f<0?-f:f,l&&(this._renderer.parent=r)}if(this._mask){n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST),n.stencilFunc(n.ALWAYS,1,0),n.stencilOp(n.KEEP,n.KEEP,n.REPLACE),n.colorMask(!1,!1,!1,!1);const u=St.Utils.getRendererType(this._mask._renderer.type);Se[u].render.call(this._mask,n,e,this),n.stencilFunc(n.EQUAL,1,255),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.colorMask(!0,!0,!0,!0)}if(c?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,Se.text.getBoundingClientRect(this,this._renderer.rect),Se.updateTexture.call(Se,n,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;e.current!==o&&(n.useProgram(o),n.bindBuffer(n.ARRAY_BUFFER,e.buffers.position),n.vertexAttribPointer(o.position,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(o.position),n.bufferData(n.ARRAY_BUFFER,ua,n.STATIC_DRAW),e.resolution.flagged||n.uniform2f(n.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&n.uniform2f(n.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),n.bindTexture(n.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return n.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),n.uniform4f(o.rect,d.left,d.top,d.right,d.bottom),n.drawArrays(n.TRIANGLES,0,6),this._mask&&n.disable(n.STENCIL_TEST),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let i,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width,o=(o-.5)*i.height,s=(s-.5)*i.width,a=(a-.5)*i.height),this._renderer.effect=n.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let i,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(i=e.getBoundingClientRect(!0),r=(r-.5)*i.width*.5,o=(o-.5)*i.height*.5,s=(s-.5)*i.width*.5,a=(a-.5)*i.height*.5,l*=Math.min(i.width,i.height)),this._renderer.effect=n.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(n,e){if(!n.canvas.getContext("2d"))return;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const i=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=n.createPattern(i,this._repeat);else if(!this._renderer.effect)return this.flagReset();if((this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof re||(this._renderer.offset=new re),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,i&&(this._renderer.offset.x+=i.width/2,this._renderer.offset.y+=i.height/2,this._scale instanceof re?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),this._flagScale||this._flagLoaded){this._renderer.scale instanceof re||(this._renderer.scale=new re);let r,o;this._scale instanceof re?(r=this._scale.x,o=this._scale.y):(r=this._scale,o=this._scale),this._renderer.scale.x=r<0?-r:r,this._renderer.scale.y=o<0?-o:o}return oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(n,e){const i=St.Utils.getRendererType(e._renderer.type);if(this[i].updateCanvas.call(Se,n,e),this.canvas.width<=0||this.canvas.height<=0){e._renderer.texture&&n.deleteTexture(e._renderer.texture),delete e._renderer.texture;return}e._renderer.texture||(e._renderer.texture=n.createTexture()),n.bindTexture(n.TEXTURE_2D,e._renderer.texture),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,this.canvas),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR)},program:{create:function(n,e){let i,r,o;if(i=n.createProgram(),oe.each(e,function(s){n.attachShader(i,s)}),n.linkProgram(i),r=n.getProgramParameter(i,n.LINK_STATUS),!r)throw o=n.getProgramInfoLog(i),n.deleteProgram(i),new Ht("unable to link program: "+o);return i}},extensions:{init:function(n){const e={},i=["EXT_texture_filter_anisotropic","WEBGL_compressed_texture_s3tc","OES_texture_float_linear","WEBGL_multisampled_render_to_texture"];for(let r=0;r<i.length;r++){const o=i[r];e[o]=Se.extensions.get(n,o)}return e},get:function(n,e){return n.getExtension(e)||n.getExtension(`MOZ_${e}`)||n.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new ho};Se.ctx=Se.canvas.getContext("2d");var Vd=class extends ee{constructor(n){super();let e,i,r,o;if(this.domElement=n.domElement||document.createElement("canvas"),typeof n.offscreenElement<"u"&&(Se.canvas=n.offscreenElement,Se.ctx=Se.canvas.getContext("2d")),this.scene=new yt,this.scene.parent=this,this._renderer={type:"renderer",matrix:new Cn(F0),scale:1,opacity:1},this._flagMatrix=!0,n=oe.defaults(n||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=n.overdraw,e=this.ctx=this.domElement.getContext("webgl",n)||this.domElement.getContext("experimental-webgl",n),!this.ctx)throw new Ht("unable to create a webgl context. Try using another renderer.");r=sn.create(e,sn.path.vertex,sn.types.vertex),o=sn.create(e,sn.path.fragment,sn.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},i=this.programs.path=Se.program.create(e,[r,o]),this.programs.text=this.programs.path,e.extensions=Se.extensions.init(e),e.renderer=this,i.position=e.getAttribLocation(i,"a_position"),i.matrix=e.getUniformLocation(i,"u_matrix"),i.rect=e.getUniformLocation(i,"u_rect");const s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(i.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(i.position),e.bufferData(e.ARRAY_BUFFER,ua,e.STATIC_DRAW),r=sn.create(e,sn.points.vertex,sn.types.vertex),o=sn.create(e,sn.points.fragment,sn.types.fragment),i=this.programs.points=Se.program.create(e,[r,o]),i.position=e.getAttribLocation(i,"a_position"),i.matrix=e.getUniformLocation(i,"u_matrix"),i.size=e.getUniformLocation(i,"u_size"),e.enable(e.BLEND),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}setSize(n,e,i){let r,o;const s=this.ctx;return this.width=n,this.height=e,this.ratio=typeof i>"u"?zs(s):i,this.domElement.width=n*this.ratio,this.domElement.height=e*this.ratio,oe.isObject(this.domElement.style)&&oe.extend(this.domElement.style,{width:n+"px",height:e+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=n*this.ratio,o=e*this.ratio,s.viewport(0,0,r,o),this.programs.resolution.width=r,this.programs.resolution.height=o,this.programs.resolution.ratio=this.ratio,this.programs.resolution.flagged=!0,this.trigger(ee.Types.resize,n,e,i)}render(){const n=this.ctx;return this.overdraw||n.clear(n.COLOR_BUFFER_BIT),Se.group.render.call(this.scene,n,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};S(Vd,"Utils",Se);var M0=oe.extend({Error:Ht,getRatio:zs,read:Ue,xhr:Nd},oe,Ft,pc,gc),Te=class ro{constructor(e){S(this,"_events",new ee),S(this,"type",""),S(this,"renderer",null),S(this,"scene",null),S(this,"width",0),S(this,"height",0),S(this,"frameCount",0),S(this,"timeDelta",0),S(this,"playing",!1);const i=oe.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:ro.Types.svg,autostart:!1});if(oe.each(i,function(r,o){/fullscreen/i.test(o)||/autostart/i.test(o)||(this[o]=r)},this),oe.isElement(i.domElement)){const r=i.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=ro.Types[r])}this.renderer=new ro[this.type](this),this.setPlaying(i.autostart),this.frameCount=0,i.fullscreen?(this.fit=I0.bind(this),this.fit.domElement=window,this.fit.attached=!0,oe.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),oe.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),Gt.bind(this.fit.domElement,"resize",this.fit),this.fit()):i.fitted?(this.fit=A0.bind(this),oe.extend(this.renderer.domElement.style,{display:"block"})):typeof i.width=="number"&&typeof i.height=="number"&&(this.renderer.setSize(i.width,i.height,this.ratio),this.width=i.width,this.height=i.height),this.renderer.bind(ee.Types.resize,O0.bind(this)),this.scene=this.renderer.scene,ro.Instances.push(this),i.autostart&&Fr.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=this._events.listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=this._events.ignore)==null?void 0:e.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,Fr.init(),this.trigger(ee.Types.play)}pause(){return this.playing=!1,this.trigger(ee.Types.pause)}setPlaying(e){this.playing=e}release(e){let i,r,o;if(typeof e>"u")return this.release(this.scene);if(typeof e.unbind=="function"&&e.unbind(),typeof e.fill=="object"&&typeof e.fill.unbind=="function"&&e.fill.unbind(),typeof e.stroke=="object"&&typeof e.stroke.unbind=="function"&&e.stroke.unbind(),e.vertices){if(typeof e.vertices.unbind=="function")try{e.vertices.unbind()}catch{}for(i=0;i<e.vertices.length;i++)r=e.vertices[i],typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}if(e.children){for(i=0;i<e.children.length;i++)o=e.children[i],this.release(o);if(typeof e.children.unbind=="function")try{e.children.unbind()}catch{}}if(e._renderer){if(e._renderer.elem&&e._renderer.elem.parentNode&&(e._renderer.elem.parentNode.removeChild(e._renderer.elem),delete e._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const s=this.renderer.ctx;e._renderer.texture&&(s.deleteTexture(e._renderer.texture),delete e._renderer.texture),e._renderer.positionBuffer&&(s.deleteBuffer(e._renderer.positionBuffer),delete e._renderer.positionBuffer),e._renderer.effect&&(e._renderer.effect=null)}this.type==="CanvasRenderer"&&e._renderer.context&&delete e._renderer.context}return e}getShapesAtPoint(e,i,r){return this.scene&&typeof this.scene.getShapesAtPoint=="function"?this.scene.getShapesAtPoint(e,i,r):[]}update(){const e=!!this._lastFrame,i=oe.performance.now();e&&(this.timeDelta=parseFloat((i-this._lastFrame).toFixed(3))),this._lastFrame=i,this.fit&&this.fit.domElement&&!this.fit.attached&&(Gt.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());const r=this.width,o=this.height,s=this.renderer;return(r!==s.width||o!==s.height)&&s.setSize(r,o,this.ratio),this.trigger(ee.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(ee.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,i,r,o){const s=new No(e,i,r,o);return this.scene.add(s),s}makeArrow(e,i,r,o,s){const a=typeof s=="number"?s:10,l=Math.atan2(o-i,r-e),c=[new Ee(e,i,void 0,void 0,void 0,void 0,ne.move),new Ee(r,o,void 0,void 0,void 0,void 0,ne.line),new Ee(r-a*Math.cos(l-Math.PI/4),o-a*Math.sin(l-Math.PI/4),void 0,void 0,void 0,void 0,ne.line),new Ee(r,o,void 0,void 0,void 0,void 0,ne.move),new Ee(r-a*Math.cos(l+Math.PI/4),o-a*Math.sin(l+Math.PI/4),void 0,void 0,void 0,void 0,ne.line)],d=new Pe(c,!1,!1,!0);return d.noFill(),d.cap="round",d.join="round",this.scene.add(d),d}makeRectangle(e,i,r,o){const s=new di(e,i,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,i,r,o,s){const a=new vo(e,i,r,o,s);return this.scene.add(a),a}makeCircle(e,i,r,o){const s=new ko(e,i,r,o);return this.scene.add(s),s}makeEllipse(e,i,r,o,s){const a=new Co(e,i,r,o,s);return this.scene.add(a),a}makeStar(e,i,r,o,s){const a=new na(e,i,r,o,s);return this.scene.add(a),a}makeCurve(e){const i=arguments.length;if(!Array.isArray(e)){e=[];for(let a=0;a<i;a+=2){const l=arguments[a];if(typeof l!="number")break;const c=arguments[a+1];e.push(new Ee(l,c))}}const r=arguments[i-1],o=new Pe(e,!(typeof r=="boolean"&&r),!0),s=o.getBoundingClientRect();return o.center().translation.set(s.left+s.width/2,s.top+s.height/2),this.scene.add(o),o}makePolygon(e,i,r,o){const s=new ta(e,i,r,o);return this.scene.add(s),s}makeArcSegment(e,i,r,o,s,a,l){const c=new Ks(e,i,r,o,s,a,l);return this.scene.add(c),c}makePoints(e){const i=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let s=0;s<i;s+=2){const a=arguments[s];if(typeof a!="number")break;const l=arguments[s+1];r.push(new re(a,l))}}const o=new ea(r);return this.scene.add(o),o}makePath(e){const i=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let l=0;l<i;l+=2){const c=arguments[l];if(typeof c!="number")break;const d=arguments[l+1];r.push(new Ee(c,d))}}const o=arguments[i-1],s=new Pe(r,!(typeof o=="boolean"&&o)),a=s.getBoundingClientRect();return typeof a.top=="number"&&typeof a.left=="number"&&typeof a.right=="number"&&typeof a.bottom=="number"&&s.center().translation.set(a.left+a.width/2,a.top+a.height/2),this.scene.add(s),s}makeText(e,i,r,o){const s=new Sn(e,i,r,o);return this.add(s),s}makeLinearGradient(e,i,r,o){const s=Array.prototype.slice.call(arguments,4),a=new Ge(e,i,r,o,s);return this.add(a),a}makeRadialGradient(e,i,r){const o=Array.prototype.slice.call(arguments,3),s=new Ze(e,i,r,o);return this.add(s),s}makeSprite(e,i,r,o,s,a,l){const c=new xo(e,i,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,i,r,o,s,a){const l=new Td(e,i,r,o,s,a);return this.add(l),l}makeImageSequence(e,i,r,o,s){const a=new sa(e,i,r,o);return s&&a.play(),this.add(a),a}makeTexture(e,i){return new ze(e,i)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const i=new yt;return this.scene.add(i),i.add(e),i}interpret(e,i,r){const o=e.tagName.toLowerCase();if(r=typeof r<"u"?r:!0,!(o in Ue))return null;const s=Ue[o].call(this,e);return r?this.add(i&&s instanceof yt?s.children:s):s.parent&&s.remove(),s}load(e,i){const r=new yt;let o,s,a;const l=(function(c){for(Gt.temp.innerHTML=c,s=0;s<Gt.temp.children.length;s++)o=Gt.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof i=="function"){const d=Gt.temp.children.length<=1?Gt.temp.children[0]:Gt.temp.children;i(r,d)}}).bind(this);return/\.svg$/i.test(e)?(Nd(e,l),r):(l(e),r)}};S(Te,"NextFrameId",Ct.NextFrameId),S(Te,"Types",Ct.Types),S(Te,"Version",Ct.Version),S(Te,"PublishDate",Ct.PublishDate),S(Te,"Identifier",Ct.Identifier),S(Te,"Resolution",Ct.Resolution),S(Te,"AutoCalculateImportedMatrices",Ct.AutoCalculateImportedMatrices),S(Te,"Instances",Ct.Instances),S(Te,"uniqueId",Ct.uniqueId),S(Te,"Anchor",Ee),S(Te,"Collection",li),S(Te,"Events",ee),S(Te,"Group",yt),S(Te,"Matrix",vi),S(Te,"Path",Pe),S(Te,"Registry",ho),S(Te,"Element",er),S(Te,"Shape",Hn),S(Te,"Text",Sn),S(Te,"Vector",re),S(Te,"Gradient",ut),S(Te,"Image",Td),S(Te,"ImageSequence",sa),S(Te,"LinearGradient",Ge),S(Te,"RadialGradient",Ze),S(Te,"Sprite",xo),S(Te,"Stop",ci),S(Te,"Texture",ze),S(Te,"ArcSegment",Ks),S(Te,"Circle",ko),S(Te,"Ellipse",Co),S(Te,"Line",No),S(Te,"Points",ea),S(Te,"Polygon",ta),S(Te,"Rectangle",di),S(Te,"RoundedRectangle",vo),S(Te,"Star",na),S(Te,"CanvasRenderer",St),S(Te,"SVGRenderer",Pd),S(Te,"WebGLRenderer",Vd),S(Te,"Commands",ne),S(Te,"Utils",M0);var Nn=Te;function I0(){const n=document.body.getBoundingClientRect(),e=this.width=n.width,i=this.height=n.height;this.renderer.setSize(e,i,this.ratio)}function A0(){const n=this.renderer.domElement.parentElement;if(!n){console.warn("Two.js: Attempting to fit to parent, but no parent found.");return}const e=n.getBoundingClientRect(),i=this.width=e.width,r=this.height=e.height;this.renderer.setSize(i,r,this.ratio)}function O0(n,e){this.width=n,this.height=e,this.trigger(ee.Types.resize,n,e)}var Fr=Gt.getRequestAnimationFrame();function Md(){for(let n=0;n<Nn.Instances.length;n++){const e=Nn.Instances[n];e.playing&&e.update()}Nn.NextFrameId=Fr(Md)}Fr.init=function(){Md(),Fr.init=function(){}};let Tn;typeof window<"u"?Tn=window:typeof global<"u"?Tn=global:typeof self<"u"&&(Tn=self);let Id;const Zt=Math.PI*2,bt=Math.PI*.5;function z0(n,e,i,r,o,s){let a;return arguments.length<=1?(a=n.a,e=n.b,i=n.c,r=n.d,o=n.e,s=n.f):a=n,{translateX:o,translateY:s,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(i*i+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function D0(n){Id=n}function L0(n,e){e=e&&e.identity()||new Id;let i=n;const r=[];for(;i&&i._matrix;)r.push(i._matrix),i=i.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function jt(n,e,i){return i*(e-n)+n}function qt(n,e){for(;n<0;)n+=e;return n%e}const Ad=Tn.Float32Array||Array,H0=Math.floor;function $n(n){return H0(n*1e6)/1e6}const fe={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};class te{constructor(){N(this,"_events",{});N(this,"_bound",!1)}addEventListener(e,i){return(this._events[e]||(this._events[e]=[])).push(i),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,i){if(!this._events)return this;if(!e&&!i)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(i)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,i!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const i=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...i);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,i,r){const o=this;e&&(s.obj=e,s.name=i,s.handler=r,e.on(i,s));function s(){r.apply(o,arguments)}return o}ignore(e,i,r){return e.off(i,r),this}}N(te,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),N(te,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Od={x:{enumerable:!0,get:function(){return this._x},set:function(n){this._x!==n&&(this._x=n,this._bound&&this.dispatchEvent(te.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(n){this._y!==n&&(this._y=n,this._bound&&this.dispatchEvent(te.Types.change))}}},wt=class wt extends te{constructor(i=0,r=0){super();N(this,"_x",0);N(this,"_y",0);for(let o in Od)Object.defineProperty(this,o,Od[o]);this.x=i,this.y=r}static add(i,r){return new wt(i.x+r.x,i.y+r.y)}static sub(i,r){return new wt(i.x-r.x,i.y-r.y)}static subtract(i,r){return wt.sub(i,r)}static ratioBetween(i,r){return(i.x*r.x+i.y*r.y)/(i.length()*r.length())}static angleBetween(i,r){if(arguments.length>=4){const a=arguments[0]-arguments[2],l=arguments[1]-arguments[3];return Math.atan2(l,a)}const o=i.x-r.x,s=i.y-r.y;return Math.atan2(s,o)}static distanceBetween(i,r){return Math.sqrt(wt.distanceBetweenSquared(i,r))}static distanceBetweenSquared(i,r){const o=i.x-r.x,s=i.y-r.y;return o*o+s*s}set(i,r){return this.x=i,this.y=r,this}copy(i){return this.x=i.x,this.y=i.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new wt(this.x,this.y)}add(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x+=i,this.y+=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x+=i.x,this.y+=i.y):(this.x+=i,this.y+=r),this)}addSelf(i){return this.add.apply(this,arguments)}sub(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x-=i,this.y-=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x-=i.x,this.y-=i.y):(this.x-=i,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(i){return this.sub.apply(this,arguments)}subtractSelf(i){return this.sub.apply(this,arguments)}multiply(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x*=i,this.y*=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x*=i.x,this.y*=i.y):(this.x*=i,this.y*=r),this)}multiplySelf(i){return this.multiply.apply(this,arguments)}multiplyScalar(i){return this.multiply(i)}divide(i,r){return arguments.length<=0?this:(arguments.length<=1?typeof i=="number"?(this.x/=i,this.y/=i):i&&typeof i.x=="number"&&typeof i.y=="number"&&(this.x/=i.x,this.y/=i.y):(this.x/=i,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(i){return this.divide.apply(this,arguments)}divideScalar(i){return this.divide(i)}negate(){return this.multiply(-1)}dot(i){return this.x*i.x+this.y*i.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(i){return Math.sqrt(this.distanceToSquared(i))}distanceToSquared(i){const r=this.x-i.x,o=this.y-i.y;return r*r+o*o}setLength(i){return this.normalize().multiplyScalar(i)}equals(i,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(i)<r}lerp(i,r){const o=(i.x-this.x)*r+this.x,s=(i.y-this.y)*r+this.y;return this.set(o,s)}isZero(i){return i=typeof i>"u"?1e-4:i,this.length()<i}toString(){return this.x+", "+this.y}toObject(){return{x:$n(this.x),y:$n(this.y)}}rotate(i){const r=this.x,o=this.y,s=Math.cos(i),a=Math.sin(i);return this.x=r*s-o*a,this.y=r*a+o*s,this}};N(wt,"zero",new wt),N(wt,"left",new wt(-1,0)),N(wt,"right",new wt(1,0)),N(wt,"up",new wt(0,-1)),N(wt,"down",new wt(0,1));let ge=wt;class Ie extends ge{constructor(i=0,r=0,o=0,s=0,a=0,l=0,c=fe.move){super(i,r);N(this,"controls",{left:new ge,right:new ge});N(this,"_command",fe.move);N(this,"_relative",!0);N(this,"_rx",0);N(this,"_ry",0);N(this,"_xAxisRotation",0);N(this,"_largeArcFlag",0);N(this,"_sweepFlag",1);for(let u in zd)Object.defineProperty(this,u,zd[u]);this.command=c,this.relative=!0;const d=Ie.makeBroadcast(this);this.controls.left.set(o,s).addEventListener(te.Types.change,d),this.controls.right.set(a,l).addEventListener(te.Types.change,d)}static makeBroadcast(i){return r;function r(){i._bound&&i.dispatchEvent(te.Types.change)}}static fromObject(i){return new Ie().copy(i)}copy(i){return this.x=i.x,this.y=i.y,typeof i.command=="string"&&(this.command=i.command),i.controls&&(i.controls.left&&this.controls.left.copy(i.controls.left),i.controls.right&&this.controls.right.copy(i.controls.right)),typeof i.relative=="boolean"&&(this.relative=i.relative),typeof i.rx=="number"&&(this.rx=i.rx),typeof i.ry=="number"&&(this.ry=i.ry),typeof i.xAxisRotation=="number"&&(this.xAxisRotation=i.xAxisRotation),typeof i.largeArcFlag=="number"&&(this.largeArcFlag=i.largeArcFlag),typeof i.sweepFlag=="number"&&(this.sweepFlag=i.sweepFlag),this}clone(){return new Ie().copy(this)}toObject(){return{x:$n(this.x),y:$n(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:$n(this.rx),ry:$n(this.ry),xAxisRotation:$n(this.xAxisRotation),largeArcFlag:$n(this.largeArcFlag),sweepFlag:$n(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const zd={command:{enumerable:!0,get:function(){return this._command},set:function(n){this._command!==n&&(this._command=n,this._bound&&this.dispatchEvent(te.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(n){this._relative!==!!n&&(this._relative=!!n,this._bound&&this.dispatchEvent(te.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(n){this._rx!==n&&(this._rx=n,this._bound&&this.dispatchEvent(te.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(n){this._ry!==n&&(this._ry=n,this._bound&&this.dispatchEvent(te.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(n){this._xAxisRotation!==n&&(this._xAxisRotation=n,this._bound&&this.dispatchEvent(te.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(n){this._largeArcFlag!==n&&(this._largeArcFlag=n,this._bound&&this.dispatchEvent(te.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(n){this._sweepFlag!==n&&(this._sweepFlag=n,this._bound&&this.dispatchEvent(te.Types.change))}}};let W0=0;const Fo={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return W0++}},Vo={RecursionLimit:16,abscissas:[[.5773502691896],[0,.7745966692415],[.3399810435849,.8611363115941],[0,.5384693101057,.9061798459387],[.2386191860832,.6612093864663,.9324695142032],[0,.4058451513774,.7415311855994,.9491079123428],[.1834346424956,.5255324099163,.7966664774136,.9602898564975],[0,.3242534234038,.6133714327006,.8360311073266,.9681602395076],[.1488743389816,.4333953941292,.679409568299,.865063366689,.9739065285172],[0,.2695431559523,.5190961292068,.730152005574,.8870625997681,.9782286581461],[.1252334085115,.3678314989982,.5873179542866,.7699026741943,.9041172563705,.9815606342467],[0,.2304583159551,.4484927510364,.6423493394403,.8015780907333,.917598399223,.9841830547186],[.1080549487073,.3191123689279,.5152486363582,.6872929048117,.8272013150698,.9284348836636,.9862838086968],[0,.2011940939974,.3941513470776,.5709721726085,.7244177313602,.8482065834104,.9372733924007,.9879925180205],[.0950125098376,.2816035507793,.4580167776572,.6178762444026,.755404408355,.8656312023878,.9445750230732,.9894009349916]],weights:[[1],[.8888888888889,.5555555555556],[.6521451548625,.3478548451375],[.5688888888889,.4786286704994,.2369268850562],[.4679139345727,.3607615730481,.1713244923792],[.4179591836735,.3818300505051,.2797053914893,.1294849661689],[.3626837833784,.3137066458779,.2223810344534,.1012285362904],[.3302393550013,.31234707704,.2606106964029,.1806481606949,.0812743883616],[.2955242247148,.26926671931,.219086362516,.1494513491506,.0666713443087],[.2729250867779,.2628045445102,.233193764592,.1862902109277,.1255803694649,.0556685671162],[.2491470458134,.2334925365384,.2031674267231,.1600783285433,.1069393259953,.0471753363865],[.2325515532309,.2262831802629,.2078160475369,.1781459807619,.1388735102198,.0921214998377,.0404840047653],[.2152638534632,.2051984637213,.1855383974779,.1572031671582,.1215185706879,.0801580871598,.0351194603318],[.2025782419256,.1984314853271,.1861610000156,.166269205817,.1395706779262,.1071592204672,.0703660474881,.0307532419961],[.1894506104551,.1826034150449,.169156519395,.1495959888166,.1246289712555,.0951585116825,.0622535239386,.0271524594118]]};function Mo(n,e,i,r,o){const s=1-n;return s*s*s*e+3*s*s*n*i+3*s*n*n*r+n*n*n*o}function Dd(n,e,i,r,o,s,a,l,c){c=c||Vo.RecursionLimit;const d=c+1;if(Math.abs(n-a)<.001&&Math.abs(e-l)<.001)return[new Ie(a,l)];const u=[];for(let f=0;f<d;f++){const h=f/d,p=Mo(h,n,i,o,a),m=Mo(h,e,r,s,l);u.push(new Ie(p,m))}return u}function j0(n,e,i,r,o,s,a,l,c){if(n===i&&e===r&&o===a&&s===l){const b=a-n,y=l-e;return Math.sqrt(b*b+y*y)}const d=9*(i-o)+3*(a-n),u=6*(n+o)-12*i,f=3*(i-n),h=9*(r-s)+3*(l-e),p=6*(e+s)-12*r,m=3*(r-e);function g(b){const y=(d*b+u)*b+f,_=(h*b+p)*b+m;return Math.sqrt(y*y+_*_)}return X0(g,0,1,c||Vo.RecursionLimit)}function q0(n,e,i,r,o,s,a,l){const c=[],d=[[],[]];let u,f,h,p,m,g,b,y;for(let v=0;v<2;++v){if(v===0?(f=6*n-12*i+6*o,u=-3*n+9*i-9*o+3*a,h=3*i-3*n):(f=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,h=3*r-3*e),Math.abs(u)<.001){if(Math.abs(f)<.001)continue;p=-h/f,0<p&&p<1&&c.push(p);continue}b=f*f-4*h*u,y=Math.sqrt(b),!(b<0)&&(m=(-f+y)/(2*u),0<m&&m<1&&c.push(m),g=(-f-y)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,k=_,x;for(;_--;)p=c[_],x=1-p,d[0][_]=x*x*x*n+3*x*x*p*i+3*x*p*p*o+p*p*p*a,d[1][_]=x*x*x*e+3*x*x*p*r+3*x*p*p*s+p*p*p*l;return d[0][k]=n,d[1][k]=e,d[0][k+1]=a,d[1][k+1]=l,d[0].length=d[1].length=k+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function X0(n,e,i,r){let o=Vo.abscissas[r-2],s=Vo.weights[r-2],a=.5*(i-e),l=a+e,c=0,d=r+1>>1,u=r&1?s[c++]*n(l):0;for(;c<d;){const f=a*o[c];u+=s[c++]*(n(l+f)+n(l-f))}return a*u}function Y0(n,e){const i=n.length,r=i-1;for(let o=0;o<i;o++){const s=n[o],a=e?qt(o-1,i):Math.max(o-1,0),l=e?qt(o+1,i):Math.min(o+1,r),c=n[a],d=s,u=n[l];U0(c,d,u),d.command=o===0?fe.move:fe.curve}}function U0(n,e,i){const r=ge.angleBetween(n,e),o=ge.angleBetween(i,e);let s=ge.distanceBetween(n,e),a=ge.distanceBetween(i,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=bt:l-=bt,e.controls.left.x=Math.cos(l)*s,e.controls.left.y=Math.sin(l)*s,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}let Vr=(Li=class extends te{constructor(){super();N(this,"_flagId",!1);N(this,"_flagClassName",!1);N(this,"_renderer",{});N(this,"_id",Fo.Identifier+Fo.uniqueId());N(this,"_className","");N(this,"classList",[]);for(let i in Ld)Object.defineProperty(this,i,Ld[i])}static fromObject(i){const r=new Li().copy(i);return"id"in i&&(r.id=i.id),r}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(i){return i.renderer&&typeof i.renderer.type=="string"&&(this.renderer.type=i.renderer.type),typeof i.className=="string"&&(this.className=i.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const r=this.renderer.ctx;this._renderer.texture&&(r.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(r.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const i=this._renderer.type;return this._renderer={type:i},this}},N(Li,"Properties",["renderer","id","className"]),Li);const Ld={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(n){const e=this._id;n!==this._id&&(this._id=n,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(n){this._className!==n&&(this._flagClassName=!0,this.classList=n.split(/\s+?/),this._className=n)}}};class Io extends Error{constructor(i){super();N(this,"name","Two.js");N(this,"message");this.message=i}}class K0{constructor(){N(this,"map",{})}add(e,i){return this.map[e]=i,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}}let Ao;const Hd={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Tn.document&&(Ao=document.createElement("a"));const Je=class Je extends Vr{constructor(i,r){super();N(this,"_flagSrc",!1);N(this,"_flagImage",!1);N(this,"_flagVideo",!1);N(this,"_flagLoaded",!1);N(this,"_flagRepeat",!1);N(this,"_flagOffset",!1);N(this,"_flagScale",!1);N(this,"_src","");N(this,"_image",null);N(this,"_loaded",!1);N(this,"_repeat","no-repeat");N(this,"_scale",1);N(this,"_offset",null);for(let o in Wd)Object.defineProperty(this,o,Wd[o]);if(this._renderer.type="texture",this._renderer.flagOffset=G0.bind(this),this._renderer.flagScale=Z0.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new ge,typeof r=="function"){const o=(function(){this.unbind(te.Types.load,o),typeof r=="function"&&r()}).bind(this);this.bind(te.Types.load,o)}if(typeof i=="string")this.src=i;else if(typeof i=="object"){const o=Object.prototype.toString.call(i);(o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]"||o==="[object HTMLVideoElement]"||o==="[object Image]")&&(this.image=i)}this._update()}fromObject(i){const r=new Je().copy(i);return"id"in i&&(r.id=i.id),r}static getAbsoluteURL(i){return Ao?(Ao.href=i,Ao.href):i}static loadHeadlessBuffer(i,r){i.image.onload=r,i.image.src=i.src}static getTag(i){return i&&i.nodeName&&i.nodeName.toLowerCase()||"img"}static getImage(i){const r=Je.getAbsoluteURL(i);if(Je.ImageRegistry.contains(r))return Je.ImageRegistry.get(r);let o;return Tn.document?Hd.video.test(r)?o=document.createElement("video"):o=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),o.crossOrigin="anonymous",o.referrerPolicy="no-referrer",o}static load(i,r){let o=i.image,s=Je.getTag(o);i._flagImage&&(/canvas/i.test(s)?Je.Register.canvas(i,r):(i._src=o.getAttribute("two-src")||o.src,Je.Register[s](i,r))),i._flagSrc&&(o||(o=Je.getImage(i.src),i.image=o),s=Je.getTag(o),Je.Register[s](i,r))}clone(){const i=new Je(this.src);return i.repeat=this.repeat,i.offset.copy(this.offset),i.scale=this.scale,i}copy(i){return this.src=i.src,this.repeat=i.repeat,this.offset=typeof i.offset=="number"||i.offset instanceof ge?i.offset:new ge().copy(i.offset),this.scale=typeof i.scale=="number"||i.scale instanceof ge?i.scale:new ge().copy(i.scale),this}toObject(){const i=super.toObject.call(this);return i.renderer.type="texture",i.src=this.src,i.repeat=this.repeat,i.offset=this.offset.toObject(),i.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),i}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(te.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Je.load(this,(function(){this.loaded=!0,this.trigger(te.Types.change).trigger(te.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const i=this._renderer.elem;i.parentNode.removeChild(i)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};N(Je,"Properties",["src","loaded","repeat","scale","offset","image"]),N(Je,"RegularExpressions",Hd),N(Je,"ImageRegistry",new K0),N(Je,"Register",{canvas:function(i,r){i._src="#"+i.id,Je.ImageRegistry.add(i.src,i.image),typeof r=="function"&&r()},img:function(i,r){const o=i.image,s=function(l){o.removeEventListener&&typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),typeof r=="function"&&r()},a=function(l){throw typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),new Io("unable to load "+i.src)};typeof o.width=="number"&&o.width>0&&typeof o.height=="number"&&o.height>0?s():typeof o.addEventListener=="function"&&(o.addEventListener("load",s,!1),o.addEventListener("error",a,!1)),i._src=Je.getAbsoluteURL(i._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",i.src),Je.ImageRegistry.add(i.src,o),i.image.src=i.src)},video:function(i,r){const o=function(a){i.image.removeEventListener("canplaythrough",o,!1),i.image.removeEventListener("error",s,!1),i.image.width=i.image.videoWidth,i.image.height=i.image.videoHeight,typeof r=="function"&&r()},s=function(a){throw i.image.removeEventListener("canplaythrough",o,!1),i.image.removeEventListener("error",s,!1),new Io("unable to load "+i.src)};i._src=Je.getAbsoluteURL(i._src),i.image.getAttribute("two-src")||(i.image.setAttribute("two-src",i.src),Je.ImageRegistry.add(i.src,i.image)),i.image.readyState>=4?o():(i.image.addEventListener("canplaythrough",o,!1),i.image.addEventListener("error",s,!1),i.image.src=i.src,i.image.load())}});let Qe=Je;const Wd={src:{enumerable:!0,get:function(){return this._src},set:function(n){this._src=n,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(n){this._loaded=n,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(n){this._repeat=n,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(n){const e=Qe.getTag(n);let i;switch(e){case"canvas":i="#"+n.id;break;default:i=n.src}Qe.ImageRegistry.contains(i)?this._image=Qe.ImageRegistry.get(n.src):this._image=n,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset&&this._offset.unbind(te.Types.change,this._renderer.flagOffset),this._offset=n,this._offset.bind(te.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof ge&&this._scale.unbind(te.Types.change,this._renderer.flagScale),this._scale=n,this._scale instanceof ge&&this._scale.bind(te.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function G0(){this._flagOffset=!0}function Z0(){this._flagScale=!0}class Si extends Array{constructor(){super();Il(this,xt,new te);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 Dt(this,xt)}set _events(i){Cm(this,xt,i)}get _bound(){return Dt(this,xt)._bound}set _bound(i){Dt(this,xt)._bound=i}addEventListener(){var i;return(i=Dt(this,xt).addEventListener)==null?void 0:i.apply(this,arguments)}on(){var i;return(i=Dt(this,xt).on)==null?void 0:i.apply(this,arguments)}bind(){var i;return(i=Dt(this,xt).bind)==null?void 0:i.apply(this,arguments)}removeEventListener(){var i;return(i=Dt(this,xt).removeEventListener)==null?void 0:i.apply(this,arguments)}off(){var i;return(i=Dt(this,xt).off)==null?void 0:i.apply(this,arguments)}unbind(){var i;return(i=Dt(this,xt).unbind)==null?void 0:i.apply(this,arguments)}dispatchEvent(){var i;return(i=Dt(this,xt).dispatchEvent)==null?void 0:i.apply(this,arguments)}trigger(){var i;return(i=Dt(this,xt).trigger)==null?void 0:i.apply(this,arguments)}listen(){var i;return(i=Dt(this,xt).listen)==null?void 0:i.apply(this,arguments)}ignore(){var i;return(i=Dt(this,xt).ignore)==null?void 0:i.apply(this,arguments)}pop(){const i=super.pop.apply(this,arguments);return this.trigger(te.Types.remove,[i]),i}shift(){const i=super.shift.apply(this,arguments);return this.trigger(te.Types.remove,[i]),i}push(){const i=super.push.apply(this,arguments);return this.trigger(te.Types.insert,arguments),i}unshift(){const i=super.unshift.apply(this,arguments);return this.trigger(te.Types.insert,arguments),i}splice(){const i=super.splice.apply(this,arguments);if(this.trigger(te.Types.remove,i),arguments.length>2){const r=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(te.Types.insert,r),this.trigger(te.Types.order)}return i}sort(){return super.sort.apply(this,arguments),this.trigger(te.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(te.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(i,r){const o=[];for(let s=0;s<this.length;s++){const a=this[s];let l;r?l=i.call(r,a,s):l=i(a,s),o.push(l)}return o}}xt=new WeakMap;const jd=Array.prototype.slice;function Q0(n){if(n==null)return!1;const e=n.length;return typeof e=="number"&&e>=0&&e<4294967296}const We={isNaN:function(n){return typeof n=="number"&&n!==+n},isElement:function(n){return!!(n&&n.nodeType===1)},isObject:function(n){const e=typeof n;return e==="function"||e==="object"&&!!n},isFunction:function(n){return typeof n=="function"},extend:function(n){const e=jd.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]=r[o]}return n},defaults:function(n){const e=jd.call(arguments,1);for(let i=0;i<e.length;i++){const r=e[i];for(let o in r)n[o]===void 0&&(n[o]=r[o])}return n},each:function(n,e,i){const r=i||this,o=!Q0(n)&&Object.keys(n),s=(o||n).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,n[l],l,n)}return n},performance:Tn.performance&&Tn.performance.now?Tn.performance:Date},Ut=class Ut extends Vr{constructor(i,r,o){super();N(this,"_flagOffset",!0);N(this,"_flagOpacity",!0);N(this,"_flagColor",!0);N(this,"_offset",0);N(this,"_opacity",1);N(this,"_color","#fff");for(let s in qd)Object.defineProperty(this,s,qd[s]);this._renderer.type="stop",this.offset=typeof i=="number"?i:Ut.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:Ut.Index<=0?"#fff":"#000",Ut.Index=(Ut.Index+1)%2}static fromObject(i){const r=new Ut().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Ut.Properties.length;r++){const o=Ut.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Ut;return We.each(Ut.Properties,function(o){r[o]=this[o]},this),i&&i.stops&&i.stops.push(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="stop",We.each(Ut.Properties,r=>{i[r]=this[r]},this),i}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};N(Ut,"Index",0),N(Ut,"Properties",["offset","opacity","color"]);let Bi=Ut;const qd={offset:{enumerable:!0,get:function(){return this._offset},set:function(n){this._offset=n,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(n){this._color=n,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},Mn=class Mn extends Vr{constructor(i){super();N(this,"_flagStops",!1);N(this,"_flagSpread",!1);N(this,"_flagUnits",!1);N(this,"_spread","");N(this,"_units","");for(let r in Xd)Object.defineProperty(this,r,Xd[r]);this._renderer.type="gradient",this._renderer.flagStops=J0.bind(this),this._renderer.bindStops=e1.bind(this),this._renderer.unbindStops=t1.bind(this),this.spread="pad",this.units="objectBoundingBox",i&&(this.stops=i)}static fromObject(i){let r=i.stops;r&&r.length>0&&(r=r.map(s=>s instanceof Bi?s:new Bi().copy(s)));const o=new Mn(r).copy(i);return"id"in i&&(o.id=i.id),o}clone(i){const r=this.stops.map(s=>s.clone()),o=new Mn(r);return We.each(Mn.Properties,s=>{o[s]=this[s]},this),i&&i.add(o),o}copy(i){super.copy.call(this,i);for(let r=0;r<Mn.Properties.length;r++){const o=Mn.Properties[r];o in i&&(this[o]=i[o])}return this}toObject(){const i={stops:this.stops.map(r=>r.toObject())};return We.each(Mn.Properties,r=>{i[r]=this[r]},this),i}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const i=this._renderer.elem;i.parentNode.removeChild(i)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};N(Mn,"Stop",Bi),N(Mn,"Properties",["spread","stops","units"]);let ft=Mn;const Xd={spread:{enumerable:!0,get:function(){return this._spread},set:function(n){this._spread=n,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(n){this._units=n,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(n){const e=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(te.Types.insert,e).unbind(te.Types.remove,i),this._stops=new Si((n||[]).slice(0)),this._stops.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._stops)}}};function J0(){this._flagStops=!0}function e1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagStops),n[e].parent=this;this._renderer.flagStops()}function t1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagStops),delete n[e].parent;this._renderer.flagStops()}const yi=class yi extends ft{constructor(i,r,o,s,a){super(a);N(this,"_flagEndPoints",!1);N(this,"_left",null);N(this,"_right",null);for(let l in Yd)Object.defineProperty(this,l,Yd[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=n1.bind(this),this.left=new ge,this.right=new ge,typeof i=="number"&&(this.left.x=i),typeof r=="number"&&(this.left.y=r),typeof o=="number"&&(this.right.x=o),typeof s=="number"&&(this.right.y=s)}static fromObject(i){const r=new yi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<yi.Properties.length;r++){const o=yi.Properties[r];o in i&&(this[o]=i[o]instanceof ge?i[o]:new ge().copy(i[o]))}return this}clone(i){const r=this.stops.map(function(s){return s.clone()}),o=new yi(this.left._x,this.left._y,this.right._x,this.right._y,r);return We.each(ft.Properties,function(s){o[s]=this[s]},this),i&&i.add(o),o}toObject(){const i=super.toObject.call(this);return i.left=this.left.toObject(),i.right=this.right.toObject(),i}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};N(yi,"Stop",Bi),N(yi,"Properties",["left","right"]);let Mt=yi;const Yd={left:{enumerable:!0,get:function(){return this._left},set:function(n){this._left instanceof ge&&this._left.unbind(te.Types.change,this._renderer.flagEndPoints),this._left=n,this._left.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(n){this._right instanceof ge&&this._right.unbind(te.Types.change,this._renderer.flagEndPoints),this._right=n,this._right.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function n1(){this._flagEndPoints=!0}const In=class In extends ft{constructor(i,r,o,s,a,l){super(s);N(this,"_flagRadius",!1);N(this,"_flagCenter",!1);N(this,"_flagFocal",!1);N(this,"_radius",0);N(this,"_center",null);N(this,"_focal",null);for(let c in Ud)Object.defineProperty(this,c,Ud[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=i1.bind(this),this._renderer.flagFocal=r1.bind(this),this.center=new ge,this.radius=typeof o=="number"?o:1,this.focal=new ge,typeof i=="number"&&(this.center.x=i),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(i){const r=new In().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<In.Properties.length;r++){const o=In.Properties[r];o in i&&(/(center|focal)i/.test(o)?this[o]=i[o]instanceof ge?i[o]:new ge().copy(i[o]):typeof i[o]=="number"&&(this[o]=i[MediaKeySystemAccess]))}return this}clone(i){const r=this.stops.map(function(s){return s.clone()}),o=new In(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return We.each(ft.Properties.concat(In.Properties),function(s){o[s]=this[s]},this),i&&i.add(o),o}toObject(){const i=super.toObject.call(this);return We.each(In.Properties,function(r){i[r]=this[r]},this),i.center=this.center.toObject(),i.focal=this.focal.toObject(),i}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};N(In,"Stop",Bi),N(In,"Properties",["center","radius","focal"]);let It=In;const Ud={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(n){this._center&&this._center.unbind(te.Types.change,this._renderer.flagCenter),this._center=n,this._center.bind(te.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(n){this._focal&&this._focal.unbind(te.Types.change,this._renderer.flagFocal),this._focal=n,this._focal.bind(te.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function i1(){this._flagCenter=!0}function r1(){this._flagFocal=!0}function Kd(n,e){if(e===0||e===1)return!0;const r=n._length*e;let o=0;for(let s=0;s<n._lengths.length;s++){const a=n._lengths[s];if(o>=r)return r-o>=0;o+=a}return!1}function Oo(n,e){const i=n._length;if(e<=0)return 0;if(e>=i)return n._lengths.length-1;for(let r=0,o=0;r<n._lengths.length;r++){if(o+n._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/n._lengths[r];o+=n._lengths[r]}return-1}function Gd(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),j0(r,l,o,c,s,d,a,u,i)}function fa(n,e,i){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,h=n.controls&&n.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(h||n).x,d=(h||n).y,a=n.x,u=n.y,f&&e._relative&&(o+=e.x,c+=e.y),h&&n._relative&&(s+=n.x,d+=n.y),Dd(r,l,o,c,s,d,a,u,i)}function Ni(n){switch(n.renderer.type){case"texture":return Qe.fromObject(n);case"gradient":return ft.fromObject(n);case"linear-gradient":return Mt.fromObject(n);case"radial-gradient":return It.fromObject(n)}return n}const o1=Math.cos,s1=Math.sin,Zd=Math.tan,ha=[],Ot=class Ot extends te{constructor(i,r,o,s,a,l){super();N(this,"elements",new Ad(9));N(this,"manual",!1);let c=i;Array.isArray(c)||(c=Array.prototype.slice.call(arguments)),this.identity(),c.length>0&&this.set(c)}static Multiply(i,r,o){if(r.length<=3){const w=i;let T,C,$;const E=r[0]||0,I=r[1]||0,R=r[2]||0;return T=w[0]*E+w[1]*I+w[2]*R,C=w[3]*E+w[4]*I+w[5]*R,$=w[6]*E+w[7]*I+w[8]*R,[T,C,$]}const s=i[0],a=i[1],l=i[2],c=i[3],d=i[4],u=i[5],f=i[6],h=i[7],p=i[8],m=r[0],g=r[1],b=r[2],y=r[3],_=r[4],k=r[5],x=r[6],v=r[7],B=r[8];return o=o||new Ad(9),o[0]=s*m+a*y+l*x,o[1]=s*g+a*_+l*v,o[2]=s*b+a*k+l*B,o[3]=c*m+d*y+u*x,o[4]=c*g+d*_+u*v,o[5]=c*b+d*k+u*B,o[6]=f*m+h*y+p*x,o[7]=f*g+h*_+p*v,o[8]=f*b+h*k+p*B,o}static fromObject(i){return new Ot().copy(i)}set(i,r,o,s,a,l,c,d,u){if(typeof r>"u"){const f=i;i=f[0],r=f[1],o=f[2],s=f[3],a=f[4],l=f[5],c=f[6],d=f[7],u=f[8]}return this.elements[0]=i,this.elements[1]=r,this.elements[2]=o,this.elements[3]=s,this.elements[4]=a,this.elements[5]=l,this.elements[6]=c,this.elements[7]=d,this.elements[8]=u,this.trigger(te.Types.change)}copy(i){return this.elements[0]=i.elements[0],this.elements[1]=i.elements[1],this.elements[2]=i.elements[2],this.elements[3]=i.elements[3],this.elements[4]=i.elements[4],this.elements[5]=i.elements[5],this.elements[6]=i.elements[6],this.elements[7]=i.elements[7],this.elements[8]=i.elements[8],this.manual=i.manual,this.trigger(te.Types.change)}identity(){return this.elements[0]=Ot.Identity[0],this.elements[1]=Ot.Identity[1],this.elements[2]=Ot.Identity[2],this.elements[3]=Ot.Identity[3],this.elements[4]=Ot.Identity[4],this.elements[5]=Ot.Identity[5],this.elements[6]=Ot.Identity[6],this.elements[7]=Ot.Identity[7],this.elements[8]=Ot.Identity[8],this.trigger(te.Types.change)}multiply(i,r,o,s,a,l,c,d,u){if(typeof r>"u")return this.elements[0]*=i,this.elements[1]*=i,this.elements[2]*=i,this.elements[3]*=i,this.elements[4]*=i,this.elements[5]*=i,this.elements[6]*=i,this.elements[7]*=i,this.elements[8]*=i,this.trigger(te.Types.change);if(typeof o>"u"&&(o=1),typeof s>"u"){i=i||0,r=r||0,o=o||0,a=this.elements;const U=a[0]*i+a[1]*r+a[2]*o,Q=a[3]*i+a[4]*r+a[5]*o,G=a[6]*i+a[7]*r+a[8]*o;return[U,Q,G]}const f=this.elements,h=[i,r,o,s,a,l,c,d,u],p=f[0],m=f[1],g=f[2],b=f[3],y=f[4],_=f[5],k=f[6],x=f[7],v=f[8],B=h[0],w=h[1],T=h[2],C=h[3],$=h[4],E=h[5],I=h[6],R=h[7],O=h[8];return this.elements[0]=p*B+m*C+g*I,this.elements[1]=p*w+m*$+g*R,this.elements[2]=p*T+m*E+g*O,this.elements[3]=b*B+y*C+_*I,this.elements[4]=b*w+y*$+_*R,this.elements[5]=b*T+y*E+_*O,this.elements[6]=k*B+x*C+v*I,this.elements[7]=k*w+x*$+v*R,this.elements[8]=k*T+x*E+v*O,this.trigger(te.Types.change)}inverse(i){const r=this.elements;i=i||new Ot;const o=r[0],s=r[1],a=r[2],l=r[3],c=r[4],d=r[5],u=r[6],f=r[7],h=r[8],p=h*c-d*f,m=-h*l+d*u,g=f*l-c*u;let b=o*p+s*m+a*g;return b?(b=1/b,i.elements[0]=p*b,i.elements[1]=(-h*s+a*f)*b,i.elements[2]=(d*s-a*c)*b,i.elements[3]=m*b,i.elements[4]=(h*o-a*u)*b,i.elements[5]=(-d*o+a*l)*b,i.elements[6]=g*b,i.elements[7]=(-f*o+s*u)*b,i.elements[8]=(c*o-s*l)*b,i):null}scale(i,r){return arguments.length<=1&&(r=i),this.multiply(i,0,0,0,r,0,0,0,1)}rotate(i){const r=o1(i),o=s1(i);return this.multiply(r,-o,0,o,r,0,0,0,1)}translate(i,r){return this.multiply(1,0,i,0,1,r,0,0,1)}skewX(i){const r=Zd(i);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(i){const r=Zd(i);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(i){return ha.length=0,this.toTransformArray(i,ha),ha.map($n).join(" ")}toTransformArray(i,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(i){const h=o[6],p=o[7],m=o[8];if(s){r[0]=a,r[1]=d,r[2]=h,r[3]=l,r[4]=u,r[5]=p,r[6]=c,r[7]=f,r[8]=m;return}return[a,d,h,l,u,p,c,f,m]}if(s){r[0]=a,r[1]=d,r[2]=l,r[3]=u,r[4]=c,r[5]=f;return}return[a,d,l,u,c,f]}toArray(i,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(i){const h=o[6],p=o[7],m=o[8];if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f,r[6]=h,r[7]=p,r[8]=m;return}return[a,l,c,d,u,f,h,p,m]}if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f;return}return[a,l,c,d,u,f]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Ot().copy(this)}};N(Ot,"Identity",[1,0,0,0,1,0,0,0,1]);let or=Ot;D0(or);const eo=class eo extends Vr{constructor(){super();N(this,"_flagMatrix",!0);N(this,"_flagScale",!1);N(this,"_matrix",null);N(this,"_worldMatrix",null);N(this,"_position",null);N(this,"_rotation",0);N(this,"_scale",1);N(this,"_skewX",0);N(this,"_skewY",0);for(let i in zo)Object.defineProperty(this,i,zo[i]);this._renderer.flagMatrix=Qd.bind(this),this.isShape=!0,this.matrix=new or,this.worldMatrix=new or,this.position=new ge,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(i){const r=new eo().copy(i);return"id"in i&&(r.id=i.id),r}get renderer(){return this._renderer}set renderer(i){this._renderer=i}get translation(){return zo.position.get.apply(this,arguments)}set translation(i){zo.position.set.apply(this,arguments)}addTo(i){return i.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(i,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&"visible"in this&&this.visible===!1||!a&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();return c?i>=c.left-l&&i<=c.right+l&&r>=c.top-l&&r<=c.bottom+l:!1}copy(i){return super.copy.call(this,i),"position"in i&&(i.position instanceof ge?this.position=i.position:this.position.copy(i.position)),"rotation"in i&&(this.rotation=i.rotation),"scale"in i&&(this.scale=typeof i.scale=="number"||i.scale instanceof ge?i.scale:new ge(i.scale.x,i.scale.y)),"skewX"in i&&(this.skewX=i.skewX),"skewY"in i&&(this.skewY=i.skewY),"matrix"in i&&i.matrix.manual&&(this.matrix.copy(i.matrix),this.matrix.manual=!0),this}clone(i){const r=new eo;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),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer={type:"shape"},i.isShape=!0,i.translation=this.translation.toObject(),i.rotation=this.translation.rotation,i.scale=this.scale instanceof ge?this.scale.toObject():this.scale,i.skewX=this.skewX,i.skewY=this.skewY,i.matrix=this.matrix.toObject(),i}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(i){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof ge?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),i&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};N(eo,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let En=eo;const zo={position:{enumerable:!0,get:function(){return this._position},set:function(n){this._position&&this._position.unbind(te.Types.change,this._renderer.flagMatrix),this._position=n,this._position.bind(te.Types.change,this._renderer.flagMatrix),Qd.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(n){this._rotation=n,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(n){this._scale instanceof ge&&this._scale.unbind(te.Types.change,this._renderer.flagMatrix),this._scale=n,this._scale instanceof ge&&this._scale.bind(te.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(n){this._skewX=n,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(n){this._skewY=n,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(n){this._matrix=n,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return L0(this,this._worldMatrix),this._worldMatrix},set:function(n){this._worldMatrix=n}}};function Qd(){this._flagMatrix=!0}const Jd=/^(?:none|transparent)$/i,a1=8,ma=Number.EPSILON;function jn(n,e){return{x:n,y:e}}function Do(n,e,i=ma){return Math.abs(n.x-e.x)<=i&&Math.abs(n.y-e.y)<=i}function eu(n,e,i,r){const o=n*i+e*r,s=Math.sqrt(n*n+e*e)*Math.sqrt(i*i+r*r)||1e-12;let a=Math.acos(Math.max(-1,Math.min(1,o/s)));return n*r-e*i<0&&(a=-a),a}function l1(n,e,i){if(!n)return[jn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[jn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,a=e.largeArcFlag?1:0,l=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=n.x,d=n.y,u=e.x,f=e.y,h=(c-u)/2,p=(d-f)/2,m=Math.cos(s),g=Math.sin(s);let b=m*h+g*p,y=-g*h+m*p,_=r*r,k=o*o;const x=b*b/_+y*y/k;if(x>1){const D=Math.sqrt(x);r*=D,o*=D,_=r*r,k=o*o}const v=_*y*y+k*b*b,B=v===0?0:(_*k-v)/v;let w=Math.sqrt(Math.max(0,B));a===l&&(w=-w);const T=w*r*y/o,C=-w*o*b/r,$=m*T-g*C+(c+u)/2,E=g*T+m*C+(d+f)/2,I=eu(1,0,(b-T)/r,(y-C)/o),R=eu((b-T)/r,(y-C)/o,(-b-T)/r,(-y-C)/o)%Zt,O=I+R,U=l===0,Q=(()=>{const D=O-I,L=Math.abs(D)<Number.EPSILON;let z=qt(D,Zt);return z<Number.EPSILON&&(z=L?0:Zt),U&&!L&&(z=z===Zt?-Zt:z-Zt),z})(),G=Math.max(Fo.Resolution,Math.max(i*2,1)),W=[];for(let D=1;D<=G;D++){const L=D/G,z=I+L*Q;let P=$+r*Math.cos(z),q=E+o*Math.sin(z);if(s!==0){const K=P-$,J=q-E,Y=Math.cos(s),V=Math.sin(s);P=K*Y-J*V+$,q=K*V+J*Y+E}W.push(jn(P,q))}return W}function c1(n,e=a1){const i=[],r=[],o=n._renderer&&n._renderer.vertices&&n._renderer.vertices.length>0?n._renderer.vertices:n.vertices;if(!o||o.length===0)return{polygons:i,segments:r};const s=Math.max(1,Math.floor(e));let a=null,l=null,c=null,d=null;const u=(h=!1)=>{if(a){if(h&&l&&c&&!Do(l,c)){const p=jn(l.x,l.y);r.push({a:c,b:p}),a.push(p),c=p}a.length>=3&&l&&c&&Do(l,c)&&i.push(a),a=null,l=null,c=null}},f=h=>{if(!c){c=h,a&&a.push(h);return}Do(c,h)||(r.push({a:c,b:h}),a&&a.push(h),c=h)};for(let h=0;h<o.length;h++){const p=o[h],m=p.command||(h===0?fe.move:fe.line);if(m===fe.move){u(!1);const g=jn(p.x,p.y);a=[g],l=g,c=g,d=p;continue}if(d||(d=o[Math.max(h-1,0)]),m===fe.line)f(jn(p.x,p.y));else if(m===fe.curve){const g=fa(p,d,s);for(let b=1;b<g.length;b++){const y=g[b];f(jn(y.x,y.y))}f(jn(p.x,p.y))}else if(m===fe.arc){const g=l1(d,p,s);for(let b=0;b<g.length;b++)f(g[b])}else if(m===fe.close){u(!0),d=p;continue}else f(jn(p.x,p.y));d=p}if(a){const h=!!n._closed||!!n.closed||l&&c&&!Do(l,c);u(h)}return{polygons:i,segments:r}}function d1(n,e,i){let r=!1;for(let o=0;o<n.length;o++){const s=n[o];if(!s||s.length<3)continue;let a=s.length-1;for(let l=0;l<s.length;l++){const c=s[a],d=s[l];d.y>i!=c.y>i&&e<(c.x-d.x)*(i-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),a=l}}return r}function u1(n,e,i,r){const o=r.x-i.x,s=r.y-i.y;if(Math.abs(o)<ma&&Math.abs(s)<ma){const h=n-i.x,p=e-i.y;return h*h+p*p}const a=((n-i.x)*o+(e-i.y)*s)/(o*o+s*s),l=Math.max(0,Math.min(1,a)),c=i.x+l*o,d=i.y+l*s,u=n-c,f=e-d;return u*u+f*f}function f1(n,e,i){if(!n||n.length===0)return 1/0;let r=1/0;for(let o=0;o<n.length;o++){const s=n[o],a=u1(e,i,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function h1(n,e){if(typeof e=="boolean")return e;const i=n.fill;return!i&&i!==0?!1:typeof i=="string"?!Jd.test(i):!0}function m1(n,e){const i=typeof n.linewidth=="number"?n.linewidth:n._linewidth||0;if(typeof e=="boolean")return e&&i>0;if(!(i>0))return!1;const r=n.stroke;return!r&&r!==0?!1:typeof r=="string"?!Jd.test(r):!0}function p1(n,e,i,r=0){if(!n)return!1;const o=n.left-r,s=n.right+r,a=n.top-r,l=n.bottom+r;return e>=o&&e<=s&&i>=a&&i<=l}const Lo=Number.EPSILON;function Ho(n){return typeof n.relative!="boolean"||!!n.relative}function gn(n,e,i,r){const o=n.controls;if(!(!o||!o[e])){if(Math.abs(i)<Lo&&Math.abs(r)<Lo){Ho(n)?o[e].clear():o[e].set(n.x,n.y);return}Ho(n)?o[e].set(i,r):o[e].set(n.x+i,n.y+r)}}function Xt(n,e){gn(n,e,0,0)}function g1(n,e){const i=n.controls;return!i||!i[e]?{x:0,y:0}:Ho(n)?{x:i[e].x,y:i[e].y}:{x:i[e].x-n.x,y:i[e].y-n.y}}function sr(n,e){const i=g1(n,e);return Math.abs(i.x)>Lo||Math.abs(i.y)>Lo}function Wo(n){n.command===fe.move||n.command===fe.close||(n.command=sr(n,"left")||sr(n,"right")?fe.curve:fe.line)}function tu(n,e){typeof e.relative=="boolean"&&(n.relative=e.relative)}function y1(n,e){return sr(e,"right")||sr(n,"left")||sr(n,"right")||sr(e,"left")||n.command===fe.curve||e.command===fe.curve}function ar(n,e,i){return{x:jt(n.x,e.x,i),y:jt(n.y,e.y,i)}}function nu(n,e){const i=n.controls&&n.controls[e];return i?Ho(n)?{x:n.x+i.x,y:n.y+i.y}:{x:i.x,y:i.y}:{x:n.x,y:n.y}}function b1(n,e,i){const r=n.controls&&n.controls.right,o=e.controls&&e.controls.left,s={x:n.x,y:n.y},a=r?nu(n,"right"):{...s},l={x:e.x,y:e.y},c=o?nu(e,"left"):{...l},d=ar(s,a,i),u=ar(a,c,i),f=ar(c,l,i),h=ar(d,u,i),p=ar(u,f,i),m=ar(h,p,i),g=new Ie(m.x,m.y);return tu(g,n),gn(g,"left",h.x-m.x,h.y-m.y),gn(g,"right",p.x-m.x,p.y-m.y),g.command=fe.curve,{anchor:g,startOut:d,endIn:f}}function _1(n,e,i,r,o,s){const a=n.length,l=i-e+1;let c=l-1,d=o?Math.min(l,4):1,u=d,f=d;if(r||(u=Math.min(1,e),f=Math.min(1,a-i-1)),c+=u+f,c<=1)return;const h=new Array(c+1);for(let w=0,T=e-u;w<=c;w+=1,T+=1){const C=qt(T,a);h[w]=n[C]}let p=h[0].x+2*h[1].x,m=h[0].y+2*h[1].y,g=2;const b=c-1,y=[p],_=[m],k=[g],x=new Array(c+1),v=new Array(c+1);for(let w=1;w<c;w+=1){const T=w<b,C=T||s?1:2,$=T?4:s?2:7,E=T?4:s?3:8,I=T?2:s?0:1,R=C/g;g=k[w]=$-R,p=y[w]=E*h[w].x+I*h[w+1].x-R*p,m=_[w]=E*h[w].y+I*h[w+1].y-R*m}x[b]=y[b]/k[b],v[b]=_[b]/k[b];for(let w=c-2;w>=0;w-=1)x[w]=(y[w]-x[w+1])/k[w],v[w]=(_[w]-v[w+1])/k[w];x[c]=(3*h[c].x-x[b])/2,v[c]=(3*h[c].y-v[b])/2;const B=c-f;for(let w=u,T=e;w<=B;w+=1,T+=1){const C=qt(T,a),$=n[C],E=x[w]-$.x,I=v[w]-$.y;o||w<B?gn($,"right",E,I):Xt($,"right"),o||w>u?gn($,"left",-E,-I):Xt($,"left"),Wo($)}}function w1(n,e,i,r,o,s){const a=e||n,l=n,c=i||n,d=ge.distanceBetween(a,l),u=ge.distanceBetween(l,c),f=r===void 0?.5:r,h=Math.pow(d,f),p=Math.pow(u,f),m=h*h,g=p*p;if(!o&&e){const b=2*g+3*p*h+m,y=3*p*(p+h);if(y!==0){const _=(g*a.x+b*l.x-m*c.x)/y-l.x,k=(g*a.y+b*l.y-m*c.y)/y-l.y;gn(n,"left",_,k)}else Xt(n,"left")}else Xt(n,"left");if(!s&&i){const b=2*m+3*h*p+g,y=3*h*(h+p);if(y!==0){const _=(m*c.x+b*l.x-g*a.x)/y-l.x,k=(m*c.y+b*l.y-g*a.y)/y-l.y;gn(n,"right",_,k)}else Xt(n,"right")}else Xt(n,"right");Wo(n)}function x1(n,e,i,r,o,s){if(!(e&&i)){e||Xt(n,"left"),i||Xt(n,"right"),Wo(n);return}const a=e,l=n,c=i,d=ge.distanceBetween(a,l),u=ge.distanceBetween(l,c),f=d+u,h=r===void 0?.4:r,p={x:a.x-c.x,y:a.y-c.y};if(!o&&f!==0){const m=h*d/f;gn(n,"left",p.x*m,p.y*m)}else Xt(n,"left");if(!s&&f!==0){const m=h*d/f-h;gn(n,"right",p.x*m,p.y*m)}else Xt(n,"right");Wo(n)}function k1(n,e,i,r,o,s){const a=s.type,l=s.factor,c=n.length;for(let d=e;d<=i;d+=1){const u=qt(d,c),f=n[u];if(f.command===fe.move){Xt(f,"left"),Xt(f,"right");continue}const h=d===e&&!o?null:d-1,p=d===i&&!o?null:d+1,m=h===null?null:n[qt(h,c)],g=p===null?null:n[qt(p,c)],b=h===null,y=p===null;a==="geometric"?x1(f,m,g,l,b,y):w1(f,m,g,l,b,y)}}const lr=Math.min,cr=Math.max,C1=Math.ceil,v1=Math.floor,S1=new ge,B1=new or,_n=class _n extends En{constructor(i,r,o,s){super();N(this,"_flagVertices",!0);N(this,"_flagLength",!0);N(this,"_flagFill",!0);N(this,"_flagStroke",!0);N(this,"_flagLinewidth",!0);N(this,"_flagOpacity",!0);N(this,"_flagVisible",!0);N(this,"_flagCap",!0);N(this,"_flagJoin",!0);N(this,"_flagMiter",!0);N(this,"_flagStrokeAttenuation",!0);N(this,"_flagMask",!1);N(this,"_flagClip",!1);N(this,"_length",0);N(this,"_fill","#fff");N(this,"_stroke","#000");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_cap","round");N(this,"_join","round");N(this,"_miter",4);N(this,"_closed",!0);N(this,"_curved",!1);N(this,"_automatic",!0);N(this,"_beginning",0);N(this,"_ending",1);N(this,"_mask",null);N(this,"_clip",!1);N(this,"_dashes",null);N(this,"_strokeAttenuation",!0);for(let a in iu)Object.defineProperty(this,a,iu[a]);this._renderer.type="path",this._renderer.flagVertices=ru.bind(this),this._renderer.bindVertices=ou.bind(this),this._renderer.unbindVertices=su.bind(this),this._renderer.flagFill=au.bind(this),this._renderer.flagStroke=lu.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this.closed=!!r,this.curved=!!o,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=i,this.automatic=!s,this.dashes=[],this.dashes.offset=0}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ni(i.fill),o=typeof i.stroke=="string"?i.stroke:Ni(i.stroke),s=new _n().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){if(super.copy.call(this,i),i.vertices){this.vertices=[];for(let r=0;r<i.vertices.length;r++){const o=i.vertices[r];o instanceof Ie?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ie().copy(o))}}for(let r=0;r<_n.Properties.length;r++){const o=_n.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new _n;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<_n.Properties.length;o++){const s=_n.Properties[o];r[s]=this[s]}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),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="path",i.vertices=this.vertices.map(r=>r.toObject()),We.each(_n.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?i[r]=this[r].toObject():i[r]=this[r])},this),i}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let i=0;i<this.vertices.length;i++){const r=this.vertices[i];typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const i=this.getBoundingClientRect(!0),r=i.width/2,o=i.height/2,s=i.left+i.width/2,a=i.top+i.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=s,c.y-=a,c.x+=r,c.y+=o}return this.mask&&(this.mask.translation.x-=s,this.mask.translation.x+=r,this.mask.translation.y-=a,this.mask.translation.y+=o),this}center(){const i=this.getBoundingClientRect(!0),r=i.left+i.width/2-this.translation.x,o=i.top+i.height/2-this.translation.y;for(let s=0;s<this.vertices.length;s++){const a=this.vertices[s];a.x-=r,a.y-=o}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getBoundingClientRect(i){let r,o,s,a,l,c,d=1/0,u=-1/0,f=1/0,h=-1/0;if(this._update(!0),r=i?this.matrix:this.worldMatrix,o=(this.linewidth||0)/2,s=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:p,scaleY:m}=z0(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof p=="number"&&typeof m=="number"&&(o=Math.max(p,m)*(this.linewidth||0)/2)}else o*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(s<=0)return{width:0,height:0};for(a=0;a<s;a++){c=this._renderer.vertices[a],l=this._renderer.vertices[(a+s-1)%s];const[p,m]=r.multiply(l.x,l.y),[g,b]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let y=l.controls.right.x,_=l.controls.right.y;l.relative&&(y+=l.x,_+=l.y);let[k,x]=r.multiply(y,_),v=c.controls.left.x,B=c.controls.left.y;c.relative&&(v+=c.x,B+=c.y);let[w,T]=r.multiply(v,B);const C=q0(p,m,k,x,w,T,g,b);f=lr(C.min.y-o,f),d=lr(C.min.x-o,d),u=cr(C.max.x+o,u),h=cr(C.max.y+o,h)}else a<=1&&(f=lr(m-o,f),d=lr(p-o,d),u=cr(p+o,u),h=cr(m+o,h)),f=lr(b-o,f),d=lr(g-o,d),u=cr(g+o,u),h=cr(b+o,h)}return{top:f,left:d,right:u,bottom:h,width:u-d,height:h-f}}contains(i,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&this.visible===!1||!a&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();if(!c||i<c.left-l||i>c.right+l||r<c.top-l||r>c.bottom+l)return!1;const d=this.worldMatrix,u=d&&d.inverse(B1);if(!u)return super.contains(i,r,s);const[f,h]=u.multiply(i,r,1),p=typeof s.precision=="number"&&!Number.isNaN(s.precision)?Math.max(1,Math.floor(s.precision)):8,m=h1(this,s.fill),g=m1(this,s.stroke),{polygons:b,segments:y}=c1(this,p);if(m&&b.length>0&&d1(b,f,h))return!0;if(g&&y.length>0){const _=typeof this.linewidth=="number"?this.linewidth:0;if(_>0&&f1(y,f,h)<=_/2+l)return!0}return!m&&!g?super.contains(i,r,s):m&&b.length===0?super.contains(i,r,s):!1}getPointAt(i,r){let o,s,a,l,c,d,u,f,h,p,m,g,b,y,_,k=this.length*Math.min(Math.max(i,0),1);const x=this.vertices.length,v=x-1;let B=null,w=null;for(let W=0,D=this._lengths.length,L=0;W<D;W++){if(L+this._lengths[W]>=k){this._closed?(o=qt(W,x),s=qt(W-1,x),W===0&&(o=s,s=W)):(o=W,s=Math.min(Math.max(W-1,0),v)),B=this.vertices[o],w=this.vertices[s],k-=L,this._lengths[W]!==0?i=k/this._lengths[W]:i=0;break}L+=this._lengths[W]}if(B===null||w===null)return null;if(B){if(!w)return B}else return w;_=w.controls&&w.controls.right,y=B.controls&&B.controls.left,c=w.x,p=w.y,d=(_||w).x,m=(_||w).y,u=(y||B).x,g=(y||B).y,f=B.x,b=B.y,_&&w.relative&&(d+=w.x,m+=w.y),y&&B.relative&&(u+=B.x,g+=B.y),l=Mo(i,c,d,u,f),h=Mo(i,p,m,g,b);const T=jt(c,d,i),C=jt(p,m,i),$=jt(d,u,i),E=jt(m,g,i),I=jt(u,f,i),R=jt(g,b,i),O=jt(T,$,i),U=jt(C,E,i),Q=jt($,I,i),G=jt(E,R,i);return We.isObject(r)?(r.x=l,r.y=h,r instanceof Ie&&(r.controls.left.x=O,r.controls.left.y=U,r.controls.right.x=Q,r.controls.right.y=G,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=h,r.controls.right.x-=l,r.controls.right.y-=h)),r.t=i,r):(a=new Ie(l,h,O-l,U-h,Q-l,G-h,this._curved?fe.curve:fe.line),a.t=i,a)}plot(){if(this.curved)return Y0(this._collection,this.closed),this;for(let i=0;i<this._collection.length;i++)this._collection[i].command=i===0?fe.move:fe.line;return this}smooth(i){const r=i||{},o=r.type||"continuous",s=this._collection,a=s.length;if(a<2)return this;const l=this._closed||a>0&&s[a-1]&&s[a-1].command===fe.close,c=(p,m)=>{if(p==null)return m;if(typeof p=="number"){if(l)return qt(p,a);let b=p;return b<0&&(b+=a),Math.min(Math.max(b,0),a-1)}const g=s.indexOf(p);return g!==-1?g:m},d=l&&r.from===void 0&&r.to===void 0;let u=c(r.from,0),f=c(r.to,a-1);if(u>f)if(l)u-=a;else{const p=u;u=f,f=p}const h=f-u+1;for(let p=0;p<h;p+=1){const m=qt(u+p,a),g=s[m],b=!l&&m===0;g.command===fe.move&&!b&&(g.command=fe.line)}if(o==="continuous"||o==="asymmetric")_1(s,u,f,l,d,o==="asymmetric");else if(o==="catmull-rom"||o==="geometric"){const p={type:o,factor:r.factor};k1(s,u,f,l,d,p)}else throw new Error(`Path.smooth does not support type "${o}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(i){this._update();const r=this.vertices,o=r.length;if(o<2)return this;const s=[];let a=null,l=null;for(let c=0;c<o;c+=1){const d=r[c];if(!a||d.command===fe.move){const f=d.clone();s.push(f),a=d,l=d;continue}if(y1(d,a)){const h=fa(d,a,i).length,p=s[s.length-1];let m=p.clone(),g=d.clone(),b=p,y=0;if(h<=1){const _=d.clone();s.push(_)}else{for(let k=1;k<h;k+=1){const x=k/h,v=1-y,B=v<=Number.EPSILON?x:(x-y)/v,w=b1(m,g,B);gn(b,"right",w.startOut.x-b.x,w.startOut.y-b.y);const T=w.anchor;s.push(T),b=T,m=T.clone(),y=x,gn(g,"left",w.endIn.x-g.x,w.endIn.y-g.y)}const _=d.clone();_.controls.left.copy(g.controls.left),s.push(_)}}else{const f=fa(d,a,i);for(let p=1;p<f.length;p+=1){const m=f[p];tu(m,a),Xt(m,"left"),Xt(m,"right"),m.command=fe.line,s.push(m)}const h=d.clone();s.push(h)}a=d,d.command===fe.close&&(a=l)}return this._automatic=!1,this._curved=!1,this.vertices=s,this}_updateLength(i,r){r||this._update();const s=this.vertices.length-1;let a=this.vertices[s],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),We.each(this.vertices,function(c,d){if(d<=0||c.command===fe.move){a=c,this._lengths[d]=0;return}this._lengths[d]=Gd(c,a,i),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 i=this._collection.length,r=this._closed,o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),a=Oo(this,o*this._length),l=Oo(this,s*this._length),c=C1(a),d=v1(l);let u,f,h,p,m,g;for(this._renderer.vertices.length=0,g=0;g<i;g++)this._renderer.collection.length<=g&&this._renderer.collection.push(new Ie),g>d&&!f?(m=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(s,m),m.command=this._renderer.collection[g].command,this._renderer.vertices.push(m),f=m,h=this._collection[g-1],h&&h.controls&&(m.relative?m.controls.right.clear():m.controls.right.copy(m),h.relative?this._renderer.collection[g-1].controls.right.copy(h.controls.right).lerp(ge.zero,1-m.t):this._renderer.collection[g-1].controls.right.copy(h.controls.right).lerp(h,1-m.t))):g>=c&&g<=d&&(m=this._renderer.collection[g].copy(this._collection[g]),this._renderer.vertices.push(m),g===d&&Kd(this,s)?(f=m,!r&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):g===c&&Kd(this,o)&&(u=m,u.command=fe.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(g=c-1,m=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(o,m),m.command=fe.move,this._renderer.vertices.unshift(m),p=this._collection[g+1],p&&p.controls&&(m.controls.left.clear(),p.relative?this._renderer.collection[g+1].controls.left.copy(p.controls.left).lerp(ge.zero,m.t):(S1.copy(p),this._renderer.collection[g+1].controls.left.copy(p.controls.left).lerp(p,m.t))))}return En.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,En.prototype.flagReset.call(this),this}};N(_n,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),N(_n,"Utils",{getCurveLength:Gd});let Ae=_n;const iu={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.bind(te.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(n){this._closed=!!n,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=!!n,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){if(n===this._automatic)return;this._automatic=!!n;const e=this._automatic?"ignore":"listen";We.each(this.vertices,function(i){i[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,i),n instanceof Si?this._collection=n:this._collection=new Si(n||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,We.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function ru(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function ou(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function su(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function au(){this._flagFill=!0}function lu(){this._flagStroke=!0}const N1=Math.ceil,T1=Math.floor,An=class An extends En{constructor(i){super();N(this,"_flagVertices",!0);N(this,"_flagLength",!0);N(this,"_flagFill",!0);N(this,"_flagStroke",!0);N(this,"_flagLinewidth",!0);N(this,"_flagOpacity",!0);N(this,"_flagVisible",!0);N(this,"_flagSize",!0);N(this,"_flagSizeAttenuation",!0);N(this,"_flagStrokeAttenuation",!0);N(this,"_length",0);N(this,"_fill","#fff");N(this,"_stroke","#000");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_size",1);N(this,"_sizeAttenuation",!1);N(this,"_beginning",0);N(this,"_ending",1);N(this,"_dashes",null);N(this,"_strokeAttenuation",!0);N(this,"noFill",Ae.prototype.noFill);N(this,"noStroke",Ae.prototype.noStroke);N(this,"corner",Ae.prototype.corner);N(this,"center",Ae.prototype.center);N(this,"getBoundingClientRect",Ae.prototype.getBoundingClientRect);N(this,"_updateLength",Ae.prototype._updateLength);for(let r in cu)Object.defineProperty(this,r,cu[r]);this._renderer.type="points",this._renderer.flagVertices=ru.bind(this),this._renderer.bindVertices=ou.bind(this),this._renderer.unbindVertices=su.bind(this),this._renderer.flagFill=au.bind(this),this._renderer.flagStroke=lu.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=i,this.dashes=[],this.dashes.offset=0}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ni(i.fill),o=typeof i.stroke=="string"?i.stroke:Ni(i.stroke),s=new An().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){super.copy.call(this,i);for(let r=0;r<i.vertices.length;r++){const o=i.vertices[r];o instanceof Ie?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ie().copy(o))}for(let r=0;r<An.Properties.length;r++){const o=An.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new An;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<An.Properties.length;o++){const s=An.Properties[o];r[s]=this[s]}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),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="points",i.vertices=this.vertices.map(r=>r.toObject()),We.each(An.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?i[r]=this[r].toObject():i[r]=this[r])},this),i}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let i=0;i<this.vertices.length;i++){const r=this.vertices[i];typeof r.unbind=="function"&&r.unbind()}return typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(i){this._update();let r=[];for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o],a=this.vertices[o-1];if(!a)continue;const l=s.x,c=s.y,d=a.x,u=a.y,f=Dd(l,c,l,c,d,u,d,u,i);r=r.concat(f)}return this.vertices=r,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const i=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),o=Oo(this,i*this._length),s=Oo(this,r*this._length),a=N1(o),l=T1(s);let c=0,d;this._renderer.vertices=[],this._renderer.collection=[];for(let u=0;u<this._collection.length;u++)u>=a&&u<=l&&(d=this._collection[u],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}};N(An,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let jo=An;const cu={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(n){this._sizeAttenuation=n,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.bind(te.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(n){this._beginning=n,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._ending=n,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(n){const e=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,i),n instanceof Si?this._collection=n:this._collection=new Si(n||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};class du extends Si{constructor(i){i=Array.isArray(i)?i:Array.prototype.slice.call(arguments);super(i);Il(this,ys,{});this.attach(i),this.on(te.Types.insert,this.attach),this.on(te.Types.remove,this.detach)}get ids(){return Dt(this,ys)}attach(i){for(let r=0;r<i.length;r++){const o=i[r];o&&o.id&&(this.ids[o.id]=o)}return this}detach(i){for(let r=0;r<i.length;r++)delete this.ids[i[r].id];return this}}ys=new WeakMap;const Kn=class Kn extends Ae{constructor(i,r,o,s,a,l,c){const d=c||Fo.Resolution*3,u=[];for(let f=0;f<d;f++)u.push(new Ie);super(u,!0,!1,!0);N(this,"_flagStartAngle",!1);N(this,"_flagEndAngle",!1);N(this,"_flagInnerRadius",!1);N(this,"_flagOuterRadius",!1);N(this,"_startAngle",0);N(this,"_endAngle",Zt);N(this,"_innerRadius",0);N(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let f in uu)Object.defineProperty(this,f,uu[f]);typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.startAngle=a),typeof l=="number"&&(this.endAngle=l),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Kn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Kn.Properties.length;r++){const o=Kn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const i=this._startAngle,r=this._endAngle,o=this._innerRadius,s=this._outerRadius,a=qt(i,Zt)===qt(r,Zt),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,f=0,h,p,m,g,b,y,_,k,x;for(a?d--:l||(d-=2),h=0,p=d-1;h<d;h++){switch(m=h/p,g=c[f],b=m*(r-i)+i,y=(r-i)/d,_=s*Math.cos(b),k=s*Math.sin(b),h){case 0:u=fe.move;break;default:u=fe.curve}g.command=u,g.x=_,g.y=k,g.controls.left.clear(),g.controls.right.clear(),g.command===fe.curve&&(x=s*y/Math.PI,g.controls.left.x=x*Math.cos(b-bt),g.controls.left.y=x*Math.sin(b-bt),g.controls.right.x=x*Math.cos(b+bt),g.controls.right.y=x*Math.sin(b+bt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++}if(l){for(a?(c[f].command=fe.close,f++):(d--,p=d-1),h=0;h<d;h++)m=h/p,g=c[f],b=(1-m)*(r-i)+i,y=(r-i)/d,_=o*Math.cos(b),k=o*Math.sin(b),u=fe.curve,h<=0&&(u=a?fe.move:fe.line),g.command=u,g.x=_,g.y=k,g.controls.left.clear(),g.controls.right.clear(),g.command===fe.curve&&(x=o*y/Math.PI,g.controls.left.x=x*Math.cos(b+bt),g.controls.left.y=x*Math.sin(b+bt),g.controls.right.x=x*Math.cos(b-bt),g.controls.right.y=x*Math.sin(b-bt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++;c[f].copy(c[0]),c[f].command=fe.line}else a||(c[f].command=fe.line,c[f].x=0,c[f].y=0,f++,c[f].copy(c[0]),c[f].command=fe.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(i){const r=this.innerRadius,o=this.outerRadius,s=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new Kn(0,0,r,o,s,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<Ae.Properties.length;d++){const u=Ae.Properties[d];c[u]=this[u]}return i&&i.add(c),c}toObject(){const i=super.toObject.call(this);i.renderer.type="arc-segment";for(let r=0;r<Kn.Properties.length;r++){const o=Kn.Properties[r];i[o]=this[o]}return i}};N(Kn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let pa=Kn;const uu={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(n){this._startAngle=n,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(n){this._endAngle=n,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}}},ga=Math.cos,ya=Math.sin,Gn=class Gn extends Ae{constructor(i,r,o,s){const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ie(0,0,0,0,0,0));super(l,!0,!0,!0);N(this,"_flagRadius",!1);N(this,"_radius",0);this._renderer.type="circle";for(let c in fu)Object.defineProperty(this,c,fu[c]);typeof o=="number"&&(this.radius=o),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Gn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Gn.Properties.length;r++){const o=Gn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagRadius){let i=this.vertices.length;!this._closed&&i>2&&(i-=1);const r=4/3*Math.tan(Math.PI/(i*2)),o=this._radius,s=o*r;for(let a=0;a<this.vertices.length;a++){const c=a/i*Zt,d=o*ga(c),u=o*ya(c),f=s*ga(c-bt),h=s*ya(c-bt),p=s*ga(c+bt),m=s*ya(c+bt),g=this.vertices[a];g.command=a===0?fe.move:fe.curve,g.set(d,u),g.controls.left.set(f,h),g.controls.right.set(p,m)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(i){const r=new Gn(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 o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);i.renderer.type="circle";for(let r=0;r<Gn.Properties.length;r++){const o=Gn.Properties[r];i[o]=this[o]}return i}};N(Gn,"Properties",["radius"]);let ba=Gn;const fu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}}},_a=Math.cos,wa=Math.sin,Zn=class Zn extends Ae{constructor(i,r,o,s,a){typeof s!="number"&&typeof o=="number"&&(s=o);const l=a?Math.max(a,2):4,c=[];for(let d=0;d<l;d++)c.push(new Ie);super(c,!0,!0,!0);N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_width",0);N(this,"_height",0);this._renderer.type="ellipse";for(let d in hu)Object.defineProperty(this,d,hu[d]);typeof o=="number"&&(this.width=o*2),typeof s=="number"&&(this.height=s*2),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Zn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Zn.Properties.length;r++){const o=Zn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let i=this.vertices.length;!this._closed&&i>2&&(i-=1);const r=4/3*Math.tan(Math.PI/(this.vertices.length*2)),o=this._width/2,s=this._height/2;for(let a=0;a<this.vertices.length;a++){const c=a/i*Zt,d=o*_a(c),u=s*wa(c),f=o*r*_a(c-bt),h=s*r*wa(c-bt),p=o*r*_a(c+bt),m=s*r*wa(c+bt),g=this.vertices[a];g.command=a===0?fe.move:fe.curve,g.set(d,u),g.controls.left.set(f,h),g.controls.right.set(p,m)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(i){const r=this.width/2,o=this.height/2,s=this.vertices.length,a=new Zn(0,0,r,o,s);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<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="ellipse";for(let r=0;r<Zn.Properties.length;r++){const o=Zn.Properties[r];i[o]=this[o]}return i}};N(Zn,"Properties",["width","height"]);let xa=Zn;const hu={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}}},$1=Math.cos,E1=Math.sin,Qn=class Qn extends Ae{constructor(i,r,o,s){s=Math.max(s||0,3);super();N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_flagSides",!1);N(this,"_radius",0);N(this,"_width",0);N(this,"_height",0);N(this,"_sides",0);this._renderer.type="polygon";for(let a in mu)Object.defineProperty(this,a,mu[a]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.radius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Qn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Qn.Properties.length;r++){const o=Qn.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const i=this._sides,r=i+1;let o=this.vertices.length;o>i&&(this.vertices.splice(i-1,o-i),o=i);for(let s=0;s<r;s++){const a=(s+.5)/i,l=Zt*a+Math.PI/2,c=this._width*$1(l)/2,d=this._height*E1(l)/2;s>=o?this.vertices.push(new Ie(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?fe.move:fe.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(i){const r=new Qn(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 o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);i.renderer.type="polygon";for(let r=0;r<Qn.Properties.length;r++){const o=Qn.Properties[r];i[o]=this[o]}return i}};N(Qn,"Properties",["width","height","sides"]);let ka=Qn;const mu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this.width=n*2,this.height=n*2}},width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}},Hi=class Hi extends Ae{constructor(i,r,o,s){const a=[new Ie,new Ie,new Ie,new Ie];super(a,!0,!1,!0);N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_width",0);N(this,"_height",0);N(this,"_origin",null);this._renderer.type="rectangle";for(let l in pu)Object.defineProperty(this,l,pu[l]);this.width=typeof o=="number"?o:1,this.height=typeof s=="number"?s:1,this.origin=new ge,typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(i){const r=new Hi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Hi.Properties.length;r++){const o=Hi.Properties[r];o in i&&(typeof i[o]=="number"?this[o]=i[o]:this[o]instanceof ge&&this[o].copy(i[o]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const i=this._width/2,r=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Ie),this.vertices[0].set(-i,-r).sub(this._origin).command=fe.move,this.vertices[1].set(i,-r).sub(this._origin).command=fe.line,this.vertices[2].set(i,r).sub(this._origin).command=fe.line,this.vertices[3].set(-i,r).sub(this._origin).command=fe.line,this.vertices[4]&&(this.vertices[4].set(-i,-r).sub(this._origin).command=fe.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(i){const r=new Hi(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 o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]instanceof ge?r[s].copy(this[s]):r[s]=this[s]}return i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="rectangle",i.width=this.width,i.height=this.height,i.origin=this.origin.toObject(),i}};N(Hi,"Properties",["width","height","origin"]);let Mr=Hi;const pu={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(n){this._origin&&this._origin.unbind(te.Types.change,this._renderer.flagVertices),this._origin=n,this._origin.bind(te.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},Jn=class Jn extends Ae{constructor(i,r,o,s,a){typeof a>"u"&&typeof o=="number"&&typeof s=="number"&&(a=Math.floor(Math.min(o,s)/12));const l=[];for(let c=0;c<10;c++)l.push(new Ie(0,0,0,0,0,0,c===0?fe.move:fe.curve));super(l);N(this,"_flagWidth",!1);N(this,"_flagHeight",!1);N(this,"_flagRadius",!1);N(this,"_width",0);N(this,"_height",0);N(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in gu)Object.defineProperty(this,c,gu[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=R1.bind(this),typeof o=="number"&&(this.width=o),typeof s=="number"&&(this.height=s),(typeof a=="number"||a instanceof ge)&&(this.radius=a),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new Jn().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Jn.Properties.length;r++){const o=Jn.Properties[r];if(o in i){const s=i[o];/radius/i.test(o)?this[o]=typeof s=="number"||s instanceof ge?s:new ge().copy(s):typeof s=="number"&&(this[o]=s)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const i=this._width,r=this._height;let o,s;this._radius instanceof ge?(o=this._radius.x,s=this._radius.y):(o=this._radius,s=this._radius);let a,l=i/2,c=r/2;a=this.vertices[0],a.x=-(l-o),a.y=-c,a=this.vertices[1],a.x=l-o,a.y=-c,a.controls.left.clear(),a.controls.right.x=o,a.controls.right.y=0,a=this.vertices[2],a.x=l,a.y=-(c-s),a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[3],a.x=l,a.y=c-s,a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=s,a=this.vertices[4],a.x=l-o,a.y=c,a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[5],a.x=-(l-o),a.y=c,a.controls.left.clear(),a.controls.right.x=-o,a.controls.right.y=0,a=this.vertices[6],a.x=-l,a.y=c-s,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[7],a.x=-l,a.y=-(c-s),a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=-s,a=this.vertices[8],a.x=-(l-o),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(i){const r=this.width,o=this.height,s=this.radius,a=new Jn(0,0,r,o,s);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<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="rounded-rectangle";for(let r=0;r<Jn.Properties.length;r++){const o=Jn.Properties[r];i[o]=this[o]}return i.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),i}};N(Jn,"Properties",["width","height","radius"]);let Ca=Jn;const gu={width:{enumerable:!0,get:function(){return this._width},set:function(n){this._width=n,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(n){this._height=n,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius instanceof ge&&this._radius.unbind(te.Types.change,this._renderer.flagRadius),this._radius=n,this._radius instanceof ge&&this._radius.bind(te.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function R1(){this._flagRadius=!0}const P1=Math.cos,F1=Math.sin,ei=class ei extends Ae{constructor(i,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();N(this,"_flagInnerRadius",!1);N(this,"_flagOuterRadius",!1);N(this,"_flagSides",!1);N(this,"_innerRadius",0);N(this,"_outerRadius",0);N(this,"_sides",0);this._renderer.type="star";for(let l in yu)Object.defineProperty(this,l,yu[l]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.sides=a),this._update(),typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r)}static fromObject(i){const r=new ei().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ei.Properties.length;r++){const o=ei.Properties[r];o in i&&typeof i[o]=="number"&&(this[o]=i[o])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const i=this._sides*2,r=i+1;let o=this.vertices.length;o>i&&(this.vertices.splice(i-1,o-i),o=i);for(let s=0;s<r;s++){const a=(s+.5)/i,l=Zt*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*P1(l),u=c*F1(l);s>=o?this.vertices.push(new Ie(d,u)):this.vertices[s].set(d,u),this.vertices[s].command=s===0?fe.move:fe.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(i){const r=this.innerRadius,o=this.outerRadius,s=this.sides,a=new ei(0,0,r,o,s);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<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return i&&i.add(a),a}toObject(){const i=super.toObject.call(this);i.renderer.type="star";for(let r=0;r<ei.Properties.length;r++){const o=ei.Properties[r];i[o]=this[o]}return i}};N(ei,"Properties",["innerRadius","outerRadius","sides"]);let va=ei;const yu={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(n){this._innerRadius=n,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(n){this._outerRadius=n,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(n){this._sides=n,this._flagSides=!0}}};let Sa;const bu=Math.min,_u=Math.max;Tn.document&&(Sa=document.createElement("canvas"));const Rt=class Rt extends En{constructor(i,r,o,s){super();N(this,"_flagValue",!0);N(this,"_flagFamily",!0);N(this,"_flagSize",!0);N(this,"_flagLeading",!0);N(this,"_flagAlignment",!0);N(this,"_flagBaseline",!0);N(this,"_flagStyle",!0);N(this,"_flagWeight",!0);N(this,"_flagDecoration",!0);N(this,"_flagFill",!0);N(this,"_flagStroke",!0);N(this,"_flagLinewidth",!0);N(this,"_flagOpacity",!0);N(this,"_flagVisible",!0);N(this,"_flagMask",!1);N(this,"_flagClip",!1);N(this,"_flagDirection",!0);N(this,"_flagStrokeAttenuation",!0);N(this,"_value","");N(this,"_family","sans-serif");N(this,"_size",13);N(this,"_leading",17);N(this,"_alignment","center");N(this,"_baseline","middle");N(this,"_style","normal");N(this,"_weight",500);N(this,"_decoration","none");N(this,"_direction","ltr");N(this,"_fill","#000");N(this,"_stroke","none");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_mask",null);N(this,"_clip",!1);N(this,"_dashes",null);N(this,"_strokeAttenuation",!0);for(let a in wu)Object.defineProperty(this,a,wu[a]);if(this._renderer.type="text",this._renderer.flagFill=V1.bind(this),this._renderer.flagStroke=M1.bind(this),this.value=i,typeof r=="number"&&(this.translation.x=r),typeof o=="number"&&(this.translation.y=o),this.dashes=[],this.dashes.offset=0,!We.isObject(s))return this;for(let a=0;a<Rt.Properties.length;a++){const l=Rt.Properties[a];l in s&&(this[l]=s[l])}}static Measure(i){if(Sa){const r=Sa.getContext("2d");r.font=[i._style,i._weight,`${i._size}px/${i._leading}px`,i._family].join(" ");const o=r.measureText(i.value,0,0),s=o.actualBoundingBoxDescent+o.actualBoundingBoxAscent;return{width:o.width,height:s}}else{const r=this.value.length*this.size*Rt.Ratio,o=this.leading;return console.warn("Two.Text: unable to accurately measure text, so using an approximation."),{width:r,height:o}}}static fromObject(i){const r=typeof i.fill=="string"?i.fill:Ni(i.fill),o=typeof i.stroke=="string"?i.stroke:Ni(i.stroke),s=new Rt().copy({...i,fill:r,stroke:o});return"id"in i&&(s.id=i.id),s}copy(i){super.copy.call(this,i);for(let r=0;r<Rt.Properties.length;r++){const o=Rt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Rt(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<Rt.Properties.length;o++){const s=Rt.Properties[o];r[s]=this[s]}return this.matrix.manual&&r.matrix.copy(this.matrix),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);i.renderer.type="text";for(let r=0;r<Rt.Properties.length;r++){const o=Rt.Properties[r];i[o]=this[o]}return i}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(i){let r,o,s,a,l;this._update(!0),r=i?this.matrix:this.worldMatrix;const{width:c,height:d}=Rt.Measure(this),u=(this._linewidth||0)/2;switch(this.alignment){case"left":o=-u,s=c+u;break;case"right":o=-(c+u),s=u;break;default:o=-(c/2+u),s=c/2+u}switch(this.baseline){case"middle":a=-(d/2+u),l=d/2+u;break;default:a=-(d+u),l=u}const[f,h]=r.multiply(o,a),[p,m]=r.multiply(o,l),[g,b]=r.multiply(s,a),[y,_]=r.multiply(s,l);return a=bu(h,m,b,_),o=bu(f,p,g,y),s=_u(f,p,g,y),l=_u(h,m,b,_),{top:a,left:o,right:s,bottom:l,width:s-o,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}};N(Rt,"Ratio",.6),N(Rt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let dr=Rt;const wu={value:{enumerable:!0,get:function(){return this._value},set:function(n){this._value=n,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(n){this._family=n,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(n){this._size=n,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(n){this._leading=n,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(n){this._alignment=n,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(n){this._style=n,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(n){this._weight=n,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(n){this._decoration=n,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(n){this._direction=n,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(n){this._baseline=n,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._opacity=n,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._visible=n,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof ft||this._fill instanceof Mt||this._fill instanceof It||this._fill instanceof Qe)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof ft||this._stroke instanceof Mt||this._stroke instanceof It||this._stroke instanceof Qe)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,We.isObject(n)&&!n.clip&&(n.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(n){this._clip=n,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(n){typeof n.offset!="number"&&(n.offset=this.dashes&&this._dashes.offset||0),this._dashes=n}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function V1(){this._flagFill=!0}function M1(){this._flagStroke=!0}const ti=class ti extends Mr{constructor(i,r,o,s){super(r,o,0,0);N(this,"_flagTextures",!1);N(this,"_flagFrameRate",!1);N(this,"_flagIndex",!1);N(this,"_amount",1);N(this,"_duration",0);N(this,"_index",0);N(this,"_startTime",0);N(this,"_playing",!1);N(this,"_firstFrame",0);N(this,"_lastFrame",0);N(this,"_loop",!0);N(this,"_textures",null);N(this,"_frameRate",0);N(this,"_origin",null);this._renderer.type="image-sequence";for(let a in xu)Object.defineProperty(this,a,xu[a]);this._renderer.flagTextures=I1.bind(this),this._renderer.bindTextures=A1.bind(this),this._renderer.unbindTextures=O1.bind(this),this.noStroke(),this.noFill(),Array.isArray(i)?this.textures=i.map(ku.bind(this)):typeof i=="string"&&(this.textures=[ku(i)]),this.origin=new ge,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=ti.DefaultFrameRate,this.index=0}static fromObject(i){const r=new ti().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ti.Properties.length;r++){const o=ti.Properties[r];o in i&&(this[o]=i[o])}return this}play(i,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=We.performance.now(),typeof i=="number"&&(this._firstFrame=i),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o: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(i){const r=new ti(this.textures,this.translation.x,this.translation.y,this.frameRate);return r._loop=this._loop,this._playing&&r.play(),i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="image-sequence",i.textures=this.textures.map(function(r){return r.toObject()}),i.frameRate=this.frameRate,i.index=this.index,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,i.loop=this.loop,i}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let i=0;i<this.textures.length;i++){const r=this.textures[i];typeof r.dispose=="function"?r.dispose():typeof r.unbind=="function"&&r.unbind()}return this}_update(){const i=this._textures;let r,o,s,a,l,c,d,u;return i&&(this._flagTextures&&(this._amount=i.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(a=this._amount,We.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=We.performance.now()-this._startTime,u=this._lastFrame+1,l=1e3*(u-this._firstFrame)/this._frameRate,this._loop?s=s%l:s=Math.min(s,l),d=jt(this._firstFrame,u,s/l),d=Math.floor(d),d!==this._index&&(this._index=d,c=i[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o),this.fill=c,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof Qe))&&(c=i[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o)),this.fill=c)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};N(ti,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),N(ti,"DefaultFrameRate",30);let Ba=ti;const xu={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(n){const e=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(te.Types.insert,e).unbind(te.Types.remove,i),this._textures=new Si((n||[]).slice(0)),this._textures.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}};function I1(){this._flagTextures=!0}function A1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function O1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function ku(n){if(n instanceof Qe)return n;if(typeof n=="string")return new Qe(n)}const Wi=class Wi extends Mr{constructor(i,r,o,s,a,l){super(r,o,0,0);N(this,"_flagTexture",!1);N(this,"_flagColumns",!1);N(this,"_flagRows",!1);N(this,"_flagFrameRate",!1);N(this,"_flagIndex",!1);N(this,"_amount",1);N(this,"_duration",0);N(this,"_startTime",0);N(this,"_playing",!1);N(this,"_firstFrame",0);N(this,"_lastFrame",0);N(this,"_loop",!0);N(this,"_texture",null);N(this,"_columns",1);N(this,"_rows",1);N(this,"_frameRate",0);N(this,"_index",0);N(this,"_origin",null);this._renderer.type="sprite";for(let c in Cu)Object.defineProperty(this,c,Cu[c]);this.noStroke(),this.noFill(),i instanceof Qe?this.texture=i:typeof i=="string"&&(this.texture=new Qe(i)),this.origin=new ge,this._update(),typeof s=="number"&&(this.columns=s),typeof a=="number"&&(this.rows=a),typeof l=="number"&&(this.frameRate=l),this.index=0}static fromObject(i){const r=new Wi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Wi.Properties.length;r++){const o=Wi.Properties[r];o in i&&(this[o]=i[o])}return this}play(i,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=We.performance.now(),typeof i=="number"&&(this._firstFrame=i),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o: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(i){const r=new Wi(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&r.play(this._firstFrame,this._lastFrame),r.loop=this.loop,r.firstFrame=this.firstFrame,r.lastFrame=this.lastFrame,i&&i.add(r),r}toObject(){const i=super.toObject.call(this);return i.renderer.type="sprite",i.texture=this.texture.toObject(),i.columns=this.columns,i.rows=this.rows,i.frameRate=this.frameRate,i.index=this.index,i.firstFrame=this.firstFrame,i.lastFrame=this.lastFrame,i.loop=this.loop,i}dispose(){return super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this._startTime=0,this._texture&&typeof this._texture.dispose=="function"?this._texture.dispose():this._texture&&typeof this._texture.unbind=="function"&&this._texture.unbind(),this}_update(){const i=this._texture,r=this._columns,o=this._rows;let s,a,l,c,d,u,f,h,p;if(i&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=i),i.loaded)){f=i.image.width,h=i.image.height,s=f/r,a=h/o,c=this._amount,this.width!==s&&(this.width=s),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&(We.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=We.performance.now()-this._startTime,p=this._lastFrame+1,d=1e3*(p-this._firstFrame)/this._frameRate,this._loop?l=l%d:l=Math.min(l,d),u=jt(this._firstFrame,p,l/d),u=Math.floor(u),u!==this._index&&(this._index=u,u>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const m=this._index%r,g=Math.floor(this._index/r),b=-s*m+(f-s)/2,y=-a*g+(h-a)/2;b!==i.offset.x&&(i.offset.x=b),y!==i.offset.y&&(i.offset.y=y)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};N(Wi,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let Na=Wi;const Cu={texture:{enumerable:!0,get:function(){return this._texture},set:function(n){this._texture=n,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(n){this._columns=n,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(n){this._rows=n,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(n){this._frameRate=n,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(n){this._index=n,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(n){this._firstFrame=n}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(n){this._lastFrame=n}},loop:{enumerable:!0,get:function(){return this._loop},set:function(n){this._loop=!!n}}},qo=Math.min,Xo=Math.max,z1={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},zt=class zt extends En{constructor(i){super();N(this,"_flagAdditions",!1);N(this,"_flagSubtractions",!1);N(this,"_flagOrder",!1);N(this,"_flagOpacity",!0);N(this,"_flagBeginning",!1);N(this,"_flagEnding",!1);N(this,"_flagLength",!1);N(this,"_flagMask",!1);N(this,"_fill","#fff");N(this,"_stroke","#000");N(this,"_linewidth",1);N(this,"_opacity",1);N(this,"_visible",!0);N(this,"_cap","round");N(this,"_join","round");N(this,"_miter",4);N(this,"_closed",!0);N(this,"_curved",!1);N(this,"_automatic",!0);N(this,"_beginning",0);N(this,"_ending",1);N(this,"_length",0);N(this,"_mask",null);N(this,"_strokeAttenuation",!0);for(let r in vu)Object.defineProperty(this,r,vu[r]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(i)?i:Array.prototype.slice.call(arguments)}static InsertChildren(i){for(let r=0;r<i.length;r++)Su.call(this,i[r],this)}static RemoveChildren(i){for(let r=0;r<i.length;r++)Su.call(this,i[r])}static OrderChildren(i){this._flagOrder=!0}static fromObject(i){const r=new zt;for(let s=0;s<zt.Properties.length;s++){const a=zt.Properties[s];a in i&&(/(fill|stroke)/i.test(a)?r[a]=typeof i[a]=="string"?i[a]:Ni(i[a]):r[a]=i[a])}return"mask"in i&&(r.mask=o(i.mask)),"id"in i&&(r.id=i.id),r.children=i.children.map(o),r;function o(s){if(s&&s.renderer)switch(s.renderer.type){case"arc-segment":return pa.fromObject(s);case"circle":return ba.fromObject(s);case"element":return Vr.fromObject(s);case"ellipse":return xa.fromObject(s);case"group":return zt.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Ba.fromObject(s);case"path":return Ae.fromObject(s);case"points":return jo.fromObject(s);case"polygon":return ka.fromObject(s);case"rectangle":return Mr.fromObject(s);case"rounded-rectangle":return Ca.fromObject(s);case"shape":return En.fromObject(s);case"sprite":return Na.fromObject(s);case"star":return va.fromObject(s);case"text":return dr.fromObject(s)}return s}}static IsVisible(i,r){if(!r)return!0;let o=i;for(;o;){if(typeof o.visible=="boolean"&&!o.visible||typeof o.opacity=="number"&&o.opacity<=0)return!1;o=o.parent}return!0}static VisitForHitTest(i,r,o,s,a,l,c){const d=i&&i.children;if(!d)return!1;const u=r.results;for(let f=d.length-1;f>=0;f--){const h=d[f];if(!h||!zt.IsVisible(h,r.visibleOnly))continue;const p=typeof h.getBoundingClientRect=="function"?h.getBoundingClientRect():null;if(!(p&&!p1(p,r.x,r.y,l))){if(h instanceof zt){if(o&&(!s||s(h))&&typeof h.contains=="function"&&h.contains(r.x,r.y,a)&&(u.push(h),c)||zt.VisitForHitTest(h,r,o,s,a,l,c))return!0;continue}if(h instanceof En&&!(s&&!s(h))&&typeof h.contains=="function"&&h.contains(r.x,r.y,a)&&(u.push(h),c))return!0}}return!1}copy(i){super.copy.call(this,i),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let r=0;r<zt.Properties.length;r++){const o=zt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new zt,o=this.children.map(function(s){return s.clone()});return r.add(o),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),i&&i.add(r),r._update()}toObject(){const i=super.toObject.call(this);return i.renderer.type="group",i.children=[],i.opacity=this.opacity,i.className=this.className,i.mask=this.mask?this.mask.toObject():null,We.each(this.children,(r,o)=>{i.children[o]=r.toObject()},this),i}dispose(){if(super.dispose(),this.children)for(let i=0;i<this.children.length;i++){const r=this.children[i];typeof r.dispose=="function"&&r.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}getShapesAtPoint(i,r,o){const s=o||{},{results:a,hitOptions:l,context:c,single:d,empty:u}=z1.getShapesAtPoint;a.length=0;const f=s.mode==="deepest"||s.deepest?"deepest":"all",h=s.visibleOnly!==!1,p=!!s.includeGroups,m=typeof s.filter=="function"?s.filter:null,g=typeof s.tolerance=="number"?s.tolerance:0;typeof s.precision=="number"?l.precision=s.precision:delete l.precision,typeof s.fill<"u"?l.fill=s.fill:delete l.fill,typeof s.stroke<"u"?l.stroke=s.stroke:delete l.stroke,l.tolerance=g,l.ignoreVisibility=!h;const b=f==="deepest";if(c.x=i,c.y=r,c.visibleOnly=h,c.results=a,zt.VisitForHitTest(this,c,p,m,l,g,b),b){if(a.length>0){const _=a[0];return a.length=0,d[0]=_,d.length=1,d}return u.length=0,u}const y=a.slice();return a.length=0,y}corner(){const i=this.getBoundingClientRect(!0);for(let r=0;r<this.children.length;r++){const o=this.children[r];o.translation.x-=i.left,o.translation.y-=i.top}return this.mask&&(this.mask.translation.x-=i.left,this.mask.translation.y-=i.top),this}center(){const i=this.getBoundingClientRect(!0),r=i.left+i.width/2-this.translation.x,o=i.top+i.height/2-this.translation.y;for(let s=0;s<this.children.length;s++){const a=this.children[s];a.isShape&&(a.translation.x-=r,a.translation.y-=o)}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getById(i){let r=null;function o(s){if(s.id===i)return s;if(s.children){if(s.children.ids[i])return s.children.ids[i];for(let a=0;a<s.children.length;a++)if(r=o(s.children[a]),r)return r}return null}return o(this)}getByClassName(i){const r=[];function o(s){if(Array.prototype.indexOf.call(s.classList,i)>=0&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}getByType(i){const r=[];function o(s){if(s instanceof i&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}add(i){i instanceof Array?i=i.slice():i=Array.prototype.slice.call(arguments);for(let r=0;r<i.length;r++){const o=i[r];if(!(o&&o.id))continue;const s=Array.prototype.indexOf.call(this.children,o);s>=0&&this.children.splice(s,1),this.children.push(o)}return this}remove(i){const r=arguments.length,o=this.parent;if(r<=0&&o)return o.remove(this),this;i instanceof Array?i=i.slice():i=Array.prototype.slice.call(arguments);for(let s=0;s<i.length;s++){const a=i[s];if(!a||!this.children.ids[a.id])continue;const l=this.children.indexOf(a);l>=0&&this.children.splice(l,1)}return this}getBoundingClientRect(i){let r,o,s,a,l,c;this._update(!0);let d=1/0,u=-1/0,f=1/0,h=-1/0;const p=/texture|gradient/i;o=i?this.matrix:this.worldMatrix;for(let m=0;m<this.children.length;m++){const g=this.children[m];if(!(!g.visible||p.test(g._renderer.type))&&(r=g.getBoundingClientRect(i),s=typeof r.top!="number"||We.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||We.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||We.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||We.isNaN(r.bottom)||!isFinite(r.bottom),!(s||a||l||c)))if(i){const[b,y]=o.multiply(r.left,r.top),[_,k]=o.multiply(r.right,r.top),[x,v]=o.multiply(r.left,r.bottom),[B,w]=o.multiply(r.right,r.bottom);f=qo(y,k,v,w,f),d=qo(b,_,x,B,d),u=Xo(b,_,x,B,u),h=Xo(y,k,v,w,h)}else f=qo(r.top,f),d=qo(r.left,d),u=Xo(r.right,u),h=Xo(r.bottom,h)}return{top:f,left:d,right:u,bottom:h,width:u-d,height:h-f}}noFill(){return this.children.forEach(function(i){i.noFill()}),this}noStroke(){return this.children.forEach(function(i){i.noStroke()}),this}subdivide(){const i=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,i)}),this}_update(){let i,r,o;if(this._flagBeginning||this._flagEnding){const s=Math.min(this._beginning,this._ending),a=Math.max(this._beginning,this._ending),l=this.length;let c=0;const d=s*l,u=a*l;for(i=0;i<this.children.length;i++)o=this.children[i],r=o.length,d>c+r?(o.beginning=1,o.ending=1):u<c?(o.beginning=0,o.ending=0):d>c&&d<c+r?(o.beginning=(d-c)/r,o.ending=1):u>c&&u<c+r?(o.beginning=0,o.ending=(u-c)/r):(o.beginning=0,o.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}};N(zt,"Children",du),N(zt,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let qn=zt;const vu={visible:{enumerable:!0,get:function(){return this._visible},set:function(n){this._flagVisible=this._visible!==n||this._flagVisible,this._visible=n}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(n){this._flagOpacity=this._opacity!==n||this._flagOpacity,this._opacity=n}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(n){this._flagBeginning=this._beginning!==n||this._flagBeginning,this._beginning=n}},ending:{enumerable:!0,get:function(){return this._ending},set:function(n){this._flagEnding=this._ending!==n||this._flagEnding,this._ending=n}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let n=0;n<this.children.length;n++){const e=this.children[n];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(n){this._fill=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.fill=n}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){this._stroke=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.stroke=n}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(n){this._linewidth=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.linewidth=n}}},join:{enumerable:!0,get:function(){return this._join},set:function(n){this._join=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.join=n}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(n){this._miter=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.miter=n}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(n){this._cap=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.cap=n}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(n){this._closed=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.closed=n}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(n){this._curved=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.curved=n}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(n){this._automatic=n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.automatic=n}}},children:{enumerable:!0,get:function(){return this._children},set:function(n){const e=qn.InsertChildren.bind(this),i=qn.RemoveChildren.bind(this),r=qn.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&i(this._children)),this._children=new du(n),this._children.bind(te.Types.insert,e),this._children.bind(te.Types.remove,i),this._children.bind(te.Types.order,r),n.length>0&&e(n)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(n){this._mask=n,this._flagMask=!0,We.isObject(n)&&!n.clip&&(n.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(n){this._strokeAttenuation=!!n;for(let e=0;e<this.children.length;e++){const i=this.children[e];i.strokeAttenuation!==void 0&&(i.strokeAttenuation=n)}}}};function Su(n,e){const i=n.parent;let r;if(i===e){o();return}if(i&&i.children.ids[n.id]&&(r=Array.prototype.indexOf.call(i.children,n),i.children.splice(r,1),s()),e){o();return}s(),i._flagAdditions&&i.additions.length===0&&(i._flagAdditions=!1),i._flagSubtractions&&i.subtractions.length===0&&(i._flagSubtractions=!1),delete n.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,n),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,n),r>=0&&e.additions.splice(r,1)),n.parent=e,e.additions.push(n),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(i.additions,n),r>=0&&i.additions.splice(r,1),r=Array.prototype.indexOf.call(i.subtractions,n),r<0&&(i.subtractions.push(n),i._flagSubtractions=!0)}}class Yo extends Ae{constructor(e,i,r,o){const s=[new Ie(e,i),new Ie(r,o)];super(s);for(let a in Bu)Object.defineProperty(this,a,Bu[a]);this.vertices[0].command=fe.move,this.vertices[1].command=fe.line,this.automatic=!1}}N(Yo,"Properties",["left","right"]);const Bu={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(n){if(We.isObject(n))this.vertices.splice(0,1,n),this.vertices[0].command=fe.move;else{const e=new Io("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(n){if(We.isObject(n))this.vertices.splice(1,1,n),this.vertices[1].command=fe.line;else{const e=new Io("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class Ta{constructor(e=0,i=0){this.x=e,this.y=i}}class Rn{constructor(e=10,i=0,r="A"){N(this,"start",new Ta);N(this,"end",new Ta);this.width=e,this.angle=i,this.label=r}}const Ye={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"}},D1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function L1(n,e){return t.openBlock(),t.createElementBlock("svg",D1,[...e[0]||(e[0]=[t.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 Uo=t.markRaw({name:"ion-close",render:L1}),H1={class:"mr-3 flex flex-col gap-2"},W1=["onClick"],j1={class:"h-full p-2"},q1={},X1=t.defineComponent({...q1,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(n,{emit:e}){const i=n,r=t.ref(!1),o=t.useTemplateRef("drawing-template-containers"),s=t.useTemplateRef("drawing-custom-template-containers"),a=e,l=c=>{r.value=!0,a("remove-custom-template",c,()=>{r.value=!1})};return t.onMounted(()=>{var c,d;(c=i.settings.templates)==null||c.forEach((u,f)=>{var p;const h=(p=o.value)==null?void 0:p.at(f);h&&a("init-draw-template",h,u)}),(d=i.settings.customTemplates)==null||d.forEach((u,f)=>{var p;const h=(p=s.value)==null?void 0:p.at(f);h&&a("init-draw-template",h,u)})}),t.watch(()=>[...i.settings.customTemplates],(c,d)=>{t.nextTick(()=>{c.forEach((u,f)=>{var h;if(!(d!=null&&d.includes(u))){const p=(h=s.value)==null?void 0:h.at(f);p&&a("init-draw-template",p,u)}}),d.length>c.length&&d.forEach((u,f)=>{var p;const h=(p=s.value)==null?void 0:p.at(f);h&&(h.innerHTML="",a("init-draw-template",h,u))})})},{deep:!0}),(c,d)=>{const u=Uo;return t.openBlock(),t.createBlock(t.unref(F.NScrollbar),{style:{width:"auto"},trigger:"none",class:"max-h-[19rem] md:max-h-[40rem] w-auto"},{default:t.withCtx(()=>[t.createElementVNode("div",H1,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.settings.allTemplates,(f,h)=>(t.openBlock(),t.createElementBlock("div",{key:`${f.id}-${h}`,class:"group relative"},[t.createVNode(t.unref(F.NPopover),{trigger:"hover",placement:"right"},{trigger:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["relative h-10 w-24 shrink-0 rounded-md border-2 border-solid border-slate-200",{"!border-green-700":h===n.selectTemplateIndex}]),onClick:p=>a("template:select",h)},[t.createElementVNode("div",j1,[t.createElementVNode("div",{ref_for:!0,ref:f.isCustom&&f.id!==-1?"drawing-custom-template-containers":"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,W1)]),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f.label),1)]),_:2},1024),f.isCustom&&!f.isNewRec()?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,size:"tiny",quaternary:"",loading:r.value,disabled:r.value,circle:"",class:"!absolute right-0.5 top-0.5 !hidden group-hover:!flex",onClick:p=>l(h)},{default:t.withCtx(()=>[t.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):t.createCommentVNode("",!0)]))),128))])]),_:1})}}}),Nu=fn(X1,[["__scopeId","data-v-afccb364"]]),Y1={class:"flex gap-3 min-w-[20rem] relative"},U1={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},K1={ref:"drawing-container",class:"size-full"},G1={},Tu=t.defineComponent({...G1,__name:"kozyrek-configurator-preview",props:{settings:{},value:{},selectTemplateIndex:{}},emits:["pointer:move","pointer:up","template:select","remove-custom-template"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("drawing-container");let s=[],a=[],l=[],c=null;const d=.75,u=t.computed(()=>i.value.configuratorParams.linesAngles.map((W,D)=>new Rn(i.value.configuratorParams.linesWidths[D],W,`A-${D+1}`))),f=t.computed(()=>i.value.configuratorParams.colorSide==="bottom"),h=t.computed(()=>{var W,D;return i.value.configuratorParams.startTailType&&((W=i.settings.startTailConfigs)!=null&&W[i.value.configuratorParams.startTailType])?(D=i.settings.startTailConfigs)==null?void 0:D[i.value.configuratorParams.startTailType].points:[]}),p=t.computed(()=>{var D;const W=i.value.configuratorParams.endTailType!==void 0&&((D=i.settings.endTailConfigs)==null?void 0:D[i.value.configuratorParams.endTailType]);return!W||!W.points?[]:W.points.map((L,z)=>Array.isArray(L)?new Rn(L[0],L[1],`A-${z+1}`):new Rn(L.width,L.angle,`A-${z+1}`))}),m=(W,D=!1)=>{W[0].start.x=0,W[0].start.y=0;let L=0;for(let z=0;z<W.length;z++){const P=W[z],q=W[z-1]??new Rn(0,L);L+=!D||z>1?q.angle:0;const K=(!D||z>0?P.angle:0)+L;if(W[z].end.x=P.width*Math.cos(K*Math.PI/180)+W[z].start.x,W[z].end.y=P.width*Math.sin(K*Math.PI/180)+W[z].start.y,z<W.length-1){const J=z+1;W[J].start.x=W[z].end.x,W[J].start.y=W[z].end.y}}return W},g=(W,D,L,z,P=!1)=>{let q=m([...L,...z]);D.length>0&&(q=[...m(D),...q]);let K=0,J=0,Y=0,V=0;q.forEach(pe=>{K=Math.min(K,pe.start.x,pe.end.x),J=Math.min(J,pe.start.y,pe.end.y),Y=Math.max(Y,pe.start.x,pe.end.x),V=Math.max(V,pe.start.y,pe.end.y)});let A,ie;K===0&&J===0&&Y===0&&V===0?(A=1,ie=1):(A=W.width/Math.abs(Y-K),ie=(P?W.height:W.height-Ye.colorSideLabel.size)/Math.abs(V-J));const ce=Math.min(A,ie);return K=K<0?-K*ce:0,J=J<0?-J*ce:0,[ce,K,J]},b=W=>{const D=new jo([W]);return D._size=Ye.anchorPoint.size,D.fill=Ye.anchorPoint.color,D.stroke="transparent",D._linewidth=Ye.anchorPoint.strokeSize,l.push(D),D},y=(W,D)=>{if(l=[],i.settings.allowChangeFirstPoint){const L=W[0],z=new ge(L.vertices[0].x,L.vertices[0].y);z.bind(te.Types.change,()=>{L.vertices[0].copy(z)});const P=b(z);D.add(P)}W.forEach((L,z)=>{const P=W[z+1],q=new ge(L.vertices[1].x,L.vertices[1].y);q.bind(te.Types.change,()=>{L.vertices[1].copy(q),P!==void 0&&P.vertices[0].copy(q)});const K=b(q);D.add(K)})},_=W=>W*(Math.PI/180),k=(W,D,L)=>{const z=D.vertices.length-1;W.position.x=D.vertices[z].x,W.position.y=D.vertices[z].y;const P=Math.atan2(D.vertices[z].y-D.vertices[0].y,D.vertices[z].x-D.vertices[0].x);W.rotation=_(L)+P},x=(W,D,L)=>{if(D.vertices[0]===void 0)return;W.position.x=D.vertices[0].x,W.position.y=D.vertices[0].y;const z=D.vertices.length-1,P=Math.atan2(D.vertices[z].y-D.vertices[0].y,D.vertices[z].x-D.vertices[0].x);W.rotation=_(L)+P},v=(W,D,L)=>{const z=new qn;if(W.length===0)return z;const P=[];return[...W].reverse().forEach((q,K)=>{K!==0&&q.angle>0&&(q.angle*=-1),P.push(q)}),W=m(P,!0),x(z,D,W[0].angle),[D.vertices[0],D.vertices[1]].forEach(q=>{q.bind(te.Types.change,()=>{x(z,D,W[0].angle)})}),W.forEach(q=>{const K=q.start.x*L,J=q.end.x*L,Y=q.start.y*L,V=q.end.y*L,A=new Yo(K,Y,J,V);A.linewidth=Ye.line.size,A.stroke=Ye.line.color,z.add(A)}),z},B=(W,D,L)=>{const z=new qn;return W.length===0||(W=m(W,!0),k(z,D,W[0].angle),[D.vertices[0],D.vertices[1]].forEach(P=>{P.bind(te.Types.change,()=>{k(z,D,W[0].angle)})}),W.forEach(P=>{const q=P.start.x*L,K=P.end.x*L,J=P.start.y*L,Y=P.end.y*L,V=new Yo(q,J,K,Y);V.linewidth=Ye.line.size,V.stroke=Ye.line.color,z.add(V)})),z},w=(W,D,L,z)=>{const P=D.vertices[0].x+(D.vertices[1].x-D.vertices[0].x)/2-8*Math.sin(W.angle*Math.PI/180),q=D.vertices[0].y+(D.vertices[1].y-D.vertices[0].y)/2-8*Math.cos(W.angle*Math.PI/180),K=new dr(W.label,P+10,q-10);let J;K.size=Ye.lineLabel.size,K.weight=600,K.fill=Ye.lineLabel.color,K.id+=1,K.rotation=Ye.lineLabel.rotation,z>0&&(J=new dr(`${W.angle}°`,D.vertices[0].x+25,D.vertices[0].y-25),J.size=Ye.angleLabel.size,J.weight=600,J.fill=Ye.angleLabel.color,J.rotation=Ye.angleLabel.rotation,J.id+=z,s.push(J),L.add(J)),L.add(K),C(K,D,0,J),C(K,D,1)},T=()=>{const{size:W}=Ye.colorSideLabel,D=0,L=0,z=f.value?W/2:W/2-W,P=f.value?W/2-W:W/2,q=new qn;if(!c)return q;const K=5,J=Math.atan2(P-z,L-D),Y=[new Ie(D,z,0,0,0,0,Nn.Commands.move),new Ie(L,P,0,0,0,0,Nn.Commands.line),new Ie(L-K*Math.cos(J-Math.PI/4),P-K*Math.sin(J-Math.PI/4),0,0,0,0,Nn.Commands.line),new Ie(L,P,0,0,0,0,Nn.Commands.move),new Ie(L-K*Math.cos(J+Math.PI/4),P-K*Math.sin(J+Math.PI/4),0,0,0,0,Nn.Commands.line)],V=new Ae(Y,!1,!1,!0);V.noFill(),V.cap="round",V.join="round",V.linewidth=W/7,V.stroke=Ye.colorSideLabel.color,q.add(V);const A=new dr(f.value?"Цвет снизу":"Цвет сверху",10,0);A.size=W,A.weight=600,A.fill=Ye.colorSideLabel.color,A.alignment="left",q.add(A);const ie=q.getBoundingClientRect();return q.position.x=(c.width-ie.width)*d+10,q.position.y=f.value?c.height+ie.height*2:ie.height/2,q},C=(W,D,L,z)=>{D.vertices[L].bind(te.Types.change,()=>{const P=D.vertices.length-1,q=Math.atan2(D.vertices[0].y-D.vertices[P].y,D.vertices[0].x-D.vertices[P].x)*180/Math.PI,K=D.vertices[0].x+(D.vertices[P].x-D.vertices[0].x)/2-8*Math.sin(q*Math.PI/180),J=D.vertices[0].y+(D.vertices[P].y-D.vertices[0].y)/2-8*Math.cos(q*Math.PI/180);W.position.x=K+10,W.position.y=J-10,W.rotation=-.5,z&&(z.position.x=D.vertices[0].x+25,z.position.y=D.vertices[0].y-25)})},$=(W,D,L,z,P=!1)=>{var at;if(W.clear(),L.length===0){W.update();return}const q=m(L),[K,J,Y]=g(W,D,q,z,P),V=new qn,A=new Array,ie=new Array;P||(s=[],a=[]),q.forEach((we,ke)=>{const kt=we.start.x*K+J,Ne=we.end.x*K+J,Jt=we.start.y*K+Y,wn=we.end.y*K+Y,Pt=new Yo(kt,Jt,Ne,wn);Pt.linewidth=P?Ye.previewLine.size:Ye.line.size,Pt.stroke=P?Ye.previewLine.color:Ye.line.color,a.push(Pt),A.push(Pt),V.add(Pt),!P&&we.label!==""&&w(we,Pt,V,ke)});const ce=A.at(-1);let pe=V.getBoundingClientRect();if(!P){const we=T();ie.push(we)}if(D.length>0){const we=v(D,A[0],K);V.add(we)}if(z.length>0&&ce){const we=B(z,ce,K);V.add(we)}if(ie.push(V),W.makeGroup(ie),pe=V.getBoundingClientRect(),V.position.x=0-pe.left+(W.width-pe.width)/(2*(P?1:d)),V.position.y=0-pe.top+(W.height-pe.height)/(2*(P?1:d)),W.update(),!P){const we=((at=i.value.configuratorParams)==null?void 0:at.colorSide)==="top";V.position.y=V.position.y+Ye.colorSideLabel.size*Number(we),y(A,V),W.update()}},E=(W,D)=>{if(W&&!D.isNewRec()){const L=new Nn({width:W.scrollWidth,height:W.scrollHeight});L.appendTo(W),$(L,[],D.points,[],!0)}},I=()=>{c&&$(c,h.value,u.value,p.value,!1)},R=W=>W*(180/Math.PI),O=(W,D)=>{const L=W[1].x-W[0].x,z=W[1].y-W[0].y,P=D[1].x-D[0].x,q=D[1].y-D[0].y;let K=Math.atan2(L*q-z*P,L*P+z*q);return K=R(K),Math.round(K)*-1},U=W=>{const D=a.map((L,z,P)=>{const q=P[z-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let K=Math.ceil(L._length/W/i.settings.lineWidthStep)*i.settings.lineWidthStep;const J=s[z-1];K<(P.length>1?i.settings.minLineWidth:i.settings.stripMinWidth)&&(K=P.length>1?i.settings.minLineWidth:i.settings.stripMinWidth),K>i.settings.maxLineWidth&&(K=i.settings.maxLineWidth);const Y=O(L.vertices,q.vertices);return J&&(J.value=`${Y}°`),new Rn(K,Y,`A-${z+1}`)});r("pointer:move",D)},Q=W=>{let D=null,L;const z=J=>{D=l.find(Y=>{const V=Y.renderer;return(V==null?void 0:V.elem)===J.target}),[L]=g(W,h.value,u.value.map(Y=>Y),p.value)},P=J=>{if(D){const Y=D.renderer,V=Y==null?void 0:Y.elem;if(!V)return;const A=V.getBoundingClientRect();D.vertices[0].x-=A.x-(J instanceof MouseEvent?J.clientX:J.targetTouches[0].clientX)+Ye.anchorPoint.size/2,D.vertices[0].y-=A.y-(J instanceof MouseEvent?J.clientY:J.targetTouches[0].clientY)+Ye.anchorPoint.size/2,U(L),W.update()}},q=()=>{D&&r("pointer:up",u.value),D=null},K=o.value;K&&(K.addEventListener("touchstart",z,{passive:!0}),K.addEventListener("touchend",q,{passive:!0}),K.addEventListener("mousedown",z),K.addEventListener("mouseup",q),K.addEventListener("mousemove",P),K.addEventListener("touchmove",P,{passive:!0}))},G=(W,D)=>{r("remove-custom-template",W,D)};return t.onMounted(()=>{o.value&&(c=new Nn({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),t.watch(()=>i.value,()=>{I()},{deep:!0,immediate:!0}),Q(c))}),t.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(W,D)=>(t.openBlock(),t.createElementBlock("div",Y1,[t.createVNode(Nu,{"select-template-index":n.selectTemplateIndex,settings:n.settings,"onTemplate:select":D[0]||(D[0]=L=>r("template:select",L)),onInitDrawTemplate:E,onRemoveCustomTemplate:G},null,8,["select-template-index","settings"]),t.createElementVNode("div",U1,[t.createElementVNode("div",K1,null,512)])]))}});class ur extends j.Identity{constructor(i,r){super();N(this,"label","");N(this,"points",[]);N(this,"isCustom",!1);N(this,"id",-1);N(this,"guid","");i?(this.label=i.label,this.points=i.points.map((o,s)=>M.isArray(o)?new Rn(o[0],o[1],`A-${s+1}`):new Rn(o.width,o.angle,`A-${s+1}`)),this.isCustom=i.isCustom):(this.label="-- Новая конфигурация --",this.points=[new Rn(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class $a extends ur{constructor(i){super(i);N(this,"isDefault");this.isDefault=i.isDefault??!1}}class $u{constructor(e){N(this,"minLineWidth");N(this,"maxLineWidth");N(this,"lineWidthStep");N(this,"minLineAngle");N(this,"maxLineAngle");N(this,"lineAngleStep");N(this,"stripMinWidth");N(this,"stripMaxWidth");N(this,"stripMinLength");N(this,"stripMaxLength");N(this,"allowShowTable");N(this,"showOnlyTemplates");N(this,"templates");N(this,"customTemplates",[]);N(this,"startTailConfigs");N(this,"endTailConfigs");N(this,"bendCountForExtended");N(this,"extendedProductCatalog");N(this,"allowChangeFirstPoint");N(this,"allowSaveTemplates");N(this,"userTemplatesPrefix");N(this,"lengthStep");N(this,"canSetDopProdaga");var i,r;this.minLineWidth=e.minLineWidth,this.maxLineWidth=e.maxLineWidth,this.lineWidthStep=e.lineWidthStep,this.minLineAngle=e.minLineAngle,this.maxLineAngle=e.maxLineAngle,this.lineAngleStep=e.lineAngleStep,this.stripMinWidth=e.stripMinWidth,this.stripMaxWidth=e.stripMaxWidth,this.stripMinLength=e.stripMinLength,this.stripMaxLength=e.stripMaxLength,this.allowShowTable=e.allowShowTable,this.showOnlyTemplates=e.showOnlyTemplates,this.templates=e.templates.map(o=>new ur(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((i=e.startTailConfigs)==null?void 0:i.map(o=>new $a(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new $a(o)))??[],this.bendCountForExtended=e.bendCountForExtended,this.extendedProductCatalog=e.extendedProductCatalog,this.allowChangeFirstPoint=e.allowChangeFirstPoint,this.allowSaveTemplates=e.allowSaveTemplates,this.userTemplatesPrefix=e.userTemplatesPrefix,this.lengthStep=e.lengthStep,this.canSetDopProdaga=e.canSetDopProdaga,this.showOnlyTemplates||(this.customTemplates=e.customTemplates?Object.entries(e.customTemplates).filter(([,o])=>o.id!==-1).map(([o,s])=>{const a=new ur(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new ur({label:"-- Новая конфигурация --",points:[new Rn(this.stripMinWidth,0,"A-1")],isCustom:!0,id:-1,guid:""})))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(e){if(!this.allowSaveTemplates)return;const i=this.customTemplates.findLast(o=>!o.isNewRec()),r=new ur(e);r.isCustom=!0,r.id=i?i.id+1:0,this.customTemplates.splice(-1,0,r)}removeCustomTemplate(e){if(!this.allowSaveTemplates)return;const i=this.customTemplates.findIndex(r=>r.id===e);i!==-1&&this.customTemplates.splice(i,1)}}const Z1={class:"flex flex-col gap-3"},Q1={class:"grid gap-5 md:grid-cols-5"},J1={},Eu=t.defineComponent({...J1,__name:"kozyrek-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.ref(!1),a=t.ref(!1),l=t.ref(i.cartItem),c=t.ref(new $u(i.settings)),d=t.ref({linesWidths:[...i.cartItem.configuratorParams.linesWidths],linesAngles:[...i.cartItem.configuratorParams.linesAngles]}),u=t.ref({quantity:{},marker:{},length:{}}),f=t.ref(0),h=t.useTemplateRef("kozyrek-configurator-params-form"),p=(C=0)=>{var E;const $=(E=c.value.allTemplates)==null?void 0:E.at(C);$!==void 0&&(f.value=C,l.value.configuratorParams.linesWidths=$.points.map(I=>M.isArray(I)?I[0]:I.width),l.value.configuratorParams.linesAngles=$.points.map(I=>M.isArray(I)?I[1]:I.angle),k()),y(l.value.configuratorParams)},m=async()=>{const C=prompt("Введите название шаблона:");if(!C)return;a.value=!0;const $={label:C,points:l.value.configuratorParams.linesWidths.map((I,R)=>[I,l.value.configuratorParams.linesAngles[R]])},E=I=>{I&&(c.value.addCustomTemplate($),f.value=c.value.allTemplates.length-2),a.value=!1};i.eventEmitter.emit("configurator:create-template",{category:i.cartItem.category,template:$,callback:E})},g=async(C,$)=>{var R;const E=(R=c.value.allTemplates)==null?void 0:R.at(C);if(!E||!E.isCustom)return;const I=O=>{O&&(c.value.removeCustomTemplate(E.id),p()),$==null||$()};i.eventEmitter.emit("configurator:remove-template",{category:i.cartItem.category,templateId:E.id,callback:I})},b=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(f.value=c.value.allTemplates.length-1)},y=async C=>{var $,E;l.value.product=new j.ClientProduct,(E=($=h.value)==null?void 0:$.formReference)==null||E.validate(I=>{I||(k(),o.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:C,validationFieldResultData:u.value,callback:R=>{R?l.value.product=R:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(M.noop)},_=async()=>{var C,$;($=(C=h.value)==null?void 0:C.formReference)==null||$.validate(E=>{var I,R;if(!E){s.value=!0;const O=new j.OrderItemBase(l.value);(I=c.value.startTailConfigs)!=null&&I.length||delete O.configuratorParams.startTailType,(R=c.value.endTailConfigs)!=null&&R.length||delete O.configuratorParams.endTailType,r("submit",O,u.value,()=>{s.value=!1,t.nextTick(()=>{var U,Q;(Q=(U=h.value)==null?void 0:U.formReference)==null||Q.restoreValidation()})})}}).catch(M.noop)},k=()=>{const C={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach(($,E)=>{C[`lines_widths[${E+1}]`]={},C[`lines_angles[${E+1}]`]={}}),u.value=C},x=C=>{d.value.linesWidths=C.map($=>$.width),d.value.linesAngles=C.map($=>$.angle)},v=C=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,k(),b(),y(l.value.configuratorParams)},B=(C,$)=>{d.value.linesWidths=C,d.value.linesAngles=$},w=C=>{const $=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,E=0;l.value.configuratorParams.linesWidths.splice(C+1,0,$),l.value.configuratorParams.linesAngles.splice(C+1,0,E),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],k(),b(),y(l.value.configuratorParams)},T=C=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(C,1),l.value.configuratorParams.linesAngles.splice(C,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],k(),b(),y(l.value.configuratorParams))};return t.onMounted(()=>{i.cartItem.isNewRec()?p():(k(),f.value=-1,y(l.value.configuratorParams))}),t.watch(()=>i.cartItem,C=>{l.value=new j.OrderItemBase(C),C.isNewRec()?p():(k(),f.value=-1,y(l.value.configuratorParams))}),(C,$)=>{const E=F.NButton;return t.openBlock(),t.createElementBlock("div",Z1,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(E,{key:0,type:"tertiary",class:"self-end",onClick:$[0]||($[0]=I=>r("click:view-switch"))},{default:t.withCtx(()=>[...$[3]||($[3]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",Q1,[t.createVNode(Tu,{value:l.value,"select-template-index":f.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":v,"onPointer:move":x,"onTemplate:select":p,onRemoveCustomTemplate:g},null,8,["value","select-template-index","settings"]),t.createVNode(lc,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":$[1]||($[1]=I=>l.value=I),"preview-params":d.value,validation:u.value,settings:c.value,"is-submit-processing":s.value,"is-product-searching":o.value,"select-template-index":f.value,class:"col-span-2","onUpdate:params":$[2]||($[2]=I=>y(I)),"onUpdate:preview":B,onSubmit:_,"onClick:saveTemplate":m,"onClick:addLine":w,"onClick:removeLine":T},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),eb={class:"flex flex-col items-center justify-between rounded-xl"},tb={class:"img-preview relative flex justify-center"},nb={},ib=t.defineComponent({...nb,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(n,{emit:e}){const i=n,r=t.computed(()=>{const{height:s}=i.configuratorParams;return M.keys(i.settings.crossbarCount).reverse().find(a=>s>=i.settings.crossbarCount[Number(a)])}),o=e;return(s,a)=>{const l=F.NButton;return t.openBlock(),t.createElementBlock("div",eb,[t.createElementVNode("div",tb,[a[1]||(a[1]=t.createElementVNode("div",{class:"window"},null,-1)),t.createElementVNode("div",{class:t.normalizeClass(["net",`net-${n.configuratorParams.netType}`])},null,2),t.createElementVNode("div",{class:t.normalizeClass(["frame",`frame-${n.configuratorParams.color}`])},null,2),r.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(["frame-crossbar",`frame-crossbar-${r.value}-${n.configuratorParams.color}`])},null,2)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["mount",`mount-${n.configuratorParams.mountType}-${n.configuratorParams.color}`])},null,2),t.createElementVNode("div",{class:t.normalizeClass(["cut-preview",`cut-preview-${n.configuratorParams.mountType}-${n.configuratorParams.color}`])},null,2)]),t.createVNode(l,{type:"primary",class:"block justify-self-center",onClick:a[0]||(a[0]=c=>o("open-instructions"))},{default:t.withCtx(()=>[...a[2]||(a[2]=[t.createTextVNode(" Руководство по замеру ",-1)])]),_:1})])}}}),Ea=fn(ib,[["__scopeId","data-v-2a790a20"]]),rb={key:0,class:"flex items-baseline gap-1"},ob={key:0,class:"flex items-baseline gap-1"},sb={key:1},ab={class:"text-lg font-semibold"},lb={key:2,class:"text-red-500 text-sm mb-2"},cb={class:"flex gap-3"},db={},Ru=t.defineComponent({...db,__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(n,{expose:e,emit:i}){var w;const r=n,o=i,s=t.computed(()=>Xe.isPhoneDevice()),a=t.useTemplateRef("form-reference"),l=t.useTemplateRef("width-form-item-reference"),c=t.useTemplateRef("height-form-item-reference"),d=t.useTemplateRef("width-input-reference"),u=t.ref(M.cloneDeep(r.value)),f=t.computed(()=>r.settings.widthOverlaps[u.value.configuratorParams.mountType]??0),h=t.computed(()=>r.settings.heightOverlaps[u.value.configuratorParams.mountType]??0),p=t.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),m=t.computed(()=>r.settings.maxHeights[u.value.configuratorParams.netType]),g=t.computed(()=>u.value.configuratorParams.width?u.value.configuratorParams.width+f.value:0),b=t.computed(()=>u.value.configuratorParams.height?u.value.configuratorParams.height+h.value:0),y=t.ref(r.settings.canSetDopProdaga??!1),_=t.computed(()=>({"configuratorParams.width":[le.required,le.min(r.settings.minWidth-f.value),le.max(p.value-f.value),le.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[le.required,le.min(r.settings.minHeight-h.value),le.max(m.value-h.value),le.step(1),He.serverValidation(r.validation.height.feedback)],quantity:[le.required,le.min(1),le.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),k=t.computed(()=>{var R;const T=g.value,C=b.value,{quantity:$}=r.value,E=((R=r.value.product)==null?void 0:R.costRub)||0;if(!T||!C||!$||E===0)return null;const I=T*C/1e6;return(E*$*I).toLocaleString("ru-ru",{minimumFractionDigits:2})}),x=t.computed(()=>{const T=g.value,C=b.value,$=!!(T&&T>=r.settings.minWidth&&T<=r.settings.maxWidths[u.value.configuratorParams.netType]),E=!!(C&&C>=r.settings.minHeight&&C<=r.settings.maxHeights[u.value.configuratorParams.netType]),I=!!(r.value.quantity&&r.value.quantity>0);return $&&E&&I}),v=(T,C)=>{var I,R;const $=u.value.configuratorParams;T&&T in $&&($[T]=C);const E={...$,width:g.value??0,height:b.value??0};T==="width"&&((I=l.value)==null||I.validate().catch(M.noop)),T==="height"&&((R=c.value)==null||R.validate().catch(M.noop)),t.nextTick(()=>{var U,Q;!((U=l.value)!=null&&U.validationErrored)&&!((Q=c.value)!=null&&Q.validationErrored)&&E.height&&E.width&&o("update:params",E),B("configuratorParams",E)})},B=(T,C)=>{const $=new j.OrderItemBase(r.value);$[T]=C,T==="configuratorParams"&&($.product=new j.ClientProduct),o("update:value",$)};return t.watch(()=>r.value,T=>{const C=M.cloneDeep(t.toRaw(T)),$=C.configuratorParams.mountType,E=r.settings.widthOverlaps[$]??0,I=r.settings.heightOverlaps[$]??0;C.configuratorParams.width&&C.configuratorParams.width>0&&(C.configuratorParams.width-=E),C.configuratorParams.height&&C.configuratorParams.height>0&&(C.configuratorParams.height-=I),u.value=C},{deep:!0,immediate:!0}),t.onMounted(()=>{var T;(T=d.value)==null||T.select()}),e({validate:(w=a.value)==null?void 0:w.validate,formReference:a}),(T,C)=>{const $=F.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:u.value,rules:_.value,class:"flex flex-col gap-2 px-4 md:max-w-96 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:u.value.configuratorParams.netType,"onUpdate:value":[C[0]||(C[0]=E=>u.value.configuratorParams.netType=E),C[1]||(C[1]=E=>v("netType",E))],options:n.settings.netType.map(E=>({label:n.settings.descriptions.net_type[E],value:E}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:u.value.configuratorParams.color,"onUpdate:value":[C[2]||(C[2]=E=>u.value.configuratorParams.color=E),C[3]||(C[3]=E=>v("color",E))],options:n.settings.color.map(E=>({label:n.settings.descriptions.color[E],value:E}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:u.value.configuratorParams.mountType,"onUpdate:value":[C[4]||(C[4]=E=>u.value.configuratorParams.mountType=E),C[5]||(C[5]=E=>v("mountType",E))],options:n.settings.mountType.map(E=>({label:n.settings.descriptions.mount_type[E],value:E}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{ref:"width-form-item-reference",path:"configuratorParams.width",label:`Ширина светового проёма от ${n.settings.minWidth-f.value} ${p.value?" до "+(p.value-f.value):""} мм.`},{feedback:t.withCtx(()=>[!n.validation.width.showFeedback&&g.value>=n.settings.minWidth&&g.value<=n.settings.maxWidths[u.value.configuratorParams.netType]?(t.openBlock(),t.createElementBlock("div",rb,[t.createVNode(t.unref(F.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Ширина готового изделия "+t.toDisplayString(g.value),1)]),_:1}),t.createVNode(t.unref(F.NButton),{quaternary:"",type:"info",size:"tiny",onClick:C[10]||(C[10]=E=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...C[25]||(C[25]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref:"width-input-reference",value:u.value.configuratorParams.width,"onUpdate:value":[C[6]||(C[6]=E=>u.value.configuratorParams.width=E),C[9]||(C[9]=E=>v("width",E))],parse:t.unref(ct),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:C[7]||(C[7]=E=>t.unref(lt)(E)),onInput:C[8]||(C[8]=E=>t.unref(ot)(n.validation,"width")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{ref:"height-form-item-reference",path:"configuratorParams.height",label:`Высота светового проёма от ${n.settings.minHeight-h.value} ${m.value?" до "+(m.value-h.value):""} мм.`},{feedback:t.withCtx(()=>[!n.validation.height.showFeedback&&b.value>=n.settings.minHeight&&b.value<=n.settings.maxHeights[u.value.configuratorParams.netType]?(t.openBlock(),t.createElementBlock("div",ob,[t.createVNode(t.unref(F.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Высота готового изделия "+t.toDisplayString(b.value),1)]),_:1}),t.createVNode(t.unref(F.NButton),{quaternary:"",type:"info",size:"tiny",onClick:C[15]||(C[15]=E=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...C[26]||(C[26]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[C[11]||(C[11]=E=>u.value.configuratorParams.height=E),C[14]||(C[14]=E=>v("height",E))],parse:t.unref(ct),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:C[12]||(C[12]=E=>t.unref(lt)(E)),onInput:C[13]||(C[13]=E=>t.unref(ot)(n.validation,"height")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:u.value.quantity,"onUpdate:value":[C[16]||(C[16]=E=>u.value.quantity=E),C[19]||(C[19]=E=>B("quantity",E??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:C[17]||(C[17]=E=>t.unref(lt)(E,!1)),onInput:C[18]||(C[18]=E=>t.unref(ot)(n.validation,"quantity")),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:C[20]||(C[20]=E=>t.unref(ot)(n.validation,"marker")),"onUpdate:value":C[21]||(C[21]=E=>{u.value.marker=E??null,B("marker",E??null)}),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),y.value?(t.openBlock(),t.createBlock($,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":C[22]||(C[22]=E=>{u.value.isAdditionalSale=E??!1,B("isAdditionalSale",E??!1)})},{default:t.withCtx(()=>[...C[27]||(C[27]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode($r,{"is-product-searching":n.isProductSearching,product:u.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),k.value?(t.openBlock(),t.createElementBlock("div",sb,[C[28]||(C[28]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",ab,t.toDisplayString(k.value)+" ₽",1)])):t.createCommentVNode("",!0),x.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",lb," Пожалуйста, заполните все обязательные поля корректно. ")),t.createElementVNode("div",cb,[t.createVNode(t.unref(F.NButton),{loading:n.isSubmitProcessing,disabled:!x.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:C[23]||(C[23]=E=>o("submit",n.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"]),s.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,type:"default",onClick:C[24]||(C[24]=E=>o("click:show-preview-drawer"))},{default:t.withCtx(()=>[...C[29]||(C[29]=[t.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):t.createCommentVNode("",!0)])]),_:1},8,["model","rules"])),[[t.unref(oi),()=>o("submit",u.value)]])}}}),ub="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",fb="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",hb="/img/configurators/mosquitto/measurement-instructions/mount.png",mb="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",pb="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",gb={class:"flex flex-col gap-6"},yb={class:"flex gap-4"},bb={class:"flex flex-col gap-2"},_b={class:"flex gap-4"},wb={class:"flex flex-col gap-2"},xb={class:"flex gap-4"},kb={class:"flex flex-col gap-2"},Cb={},Pu=t.defineComponent({...Cb,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(n,{emit:e}){const i=Xe.initRefDependingOnDeviceResolution("small","small","medium"),r=Xe.initRefDependingOnDeviceResolution(.98,.95,.8),o=t.computed(()=>window.innerWidth*r.value),s=e;return(a,l)=>{const c=F.NText;return t.openBlock(),t.createBlock(t.unref(F.NModal),{show:n.show,"show-icon":!1,size:t.unref(i),style:t.normalizeStyle(`width: ${o.value}px`),title:"Руководство по замеру","action-class":"grid grid-cols-2 !justify-between",preset:"dialog",onClose:l[0]||(l[0]=d=>s("update:show",!1)),onEsc:l[1]||(l[1]=d=>s("update:show",!1)),onMaskClick:l[2]||(l[2]=d=>s("update:show",!1))},{default:t.withCtx(()=>[t.createElementVNode("div",gb,[t.createVNode(c,{type:"error",class:"text-base font-medium"},{default:t.withCtx(()=>[...l[3]||(l[3]=[t.createTextVNode(" Важно! Для того,что бы произвести замер, необходимо открыть оконную створку. ",-1)])]),_:1}),l[22]||(l[22]=t.createElementVNode("div",{class:"grid gap-6 md:grid-cols-2"},[t.createElementVNode("div",{class:"flex items-start gap-4"},[t.createElementVNode("img",{src:ub,alt:"measurement-height",class:"w-[7.5rem]"}),t.createElementVNode("div",{class:"flex flex-col gap-2"},[t.createElementVNode("span",{class:"text-lg font-bold"},"Замер ширины"),t.createElementVNode("span",null,"Замерить по ширине световой проем оконной рамы. Размер учитывать c точностью до 1 мм")])]),t.createElementVNode("div",{class:"flex items-start gap-4"},[t.createElementVNode("img",{src:fb,alt:"measurement-height",class:"w-[7.5rem]"}),t.createElementVNode("div",{class:"flex flex-col gap-2"},[t.createElementVNode("span",{class:"text-lg font-bold"},"Замер высоты"),t.createElementVNode("span",null,"Замерить по высоте световой проем оконной рамы. Размер учитывать с точностью до 1 мм")])])],-1)),t.createElementVNode("div",yb,[l[9]||(l[9]=t.createElementVNode("img",{src:hb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",bb,[l[8]||(l[8]=t.createElementVNode("span",{class:"text-lg font-bold"},"Крепление на раме сетки",-1)),t.createElementVNode("span",null,[l[4]||(l[4]=t.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[5]||(l[5]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.frame)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.frame)+" мм. ",1),l[6]||(l[6]=t.createElementVNode("br",null,null,-1)),l[7]||(l[7]=t.createTextVNode(" Крепления находятся на раме сетки. ",-1))])])]),t.createElementVNode("div",_b,[l[15]||(l[15]=t.createElementVNode("img",{src:mb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",wb,[l[14]||(l[14]=t.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление пластик (верх+низ)",-1)),t.createElementVNode("span",null,[l[10]||(l[10]=t.createTextVNode(" Расчетные размеры москитной сетки:",-1)),l[11]||(l[11]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.external_plastic)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.external_plastic)+" мм. ",1),l[12]||(l[12]=t.createElementVNode("br",null,null,-1)),l[13]||(l[13]=t.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])]),t.createElementVNode("div",xb,[l[21]||(l[21]=t.createElementVNode("img",{src:pb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",kb,[l[20]||(l[20]=t.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление металл (верх+низ)",-1)),t.createElementVNode("span",null,[l[16]||(l[16]=t.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[17]||(l[17]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина светового проема +"+t.toDisplayString(n.widthOverlaps.external_metal)+" мм. Высота светового проема +"+t.toDisplayString(n.heightOverlaps.external_metal)+" мм. ",1),l[18]||(l[18]=t.createElementVNode("br",null,null,-1)),l[19]||(l[19]=t.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])])])]),_:1},8,["show","size","style"])}}}),vb={class:"grid md:grid-cols-2"},Sb={},Fu=t.defineComponent({...Sb,__name:"mosquito-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.computed(()=>Xe.isPhoneDevice()),s=t.ref(!1),a=t.ref(!1),l=t.ref(i.cartItem),c=t.useTemplateRef("mosquito-configurator-form"),d=t.ref({width:{},height:{},quantity:{},marker:{}}),u=t.ref(!1),f=t.ref(!1),h=t.computed(()=>t.inject("debounce-input-time",300)),p=M.debounce(async g=>{var b,y;l.value.product=new j.ClientProduct,(y=(b=c.value)==null?void 0:b.formReference)==null||y.validate(_=>{_||(u.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:g,validationFieldResultData:d.value,callback:k=>{k?l.value.product=k:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(M.noop)},h.value),m=()=>{f.value=!0,r("submit",l.value,d.value,()=>{f.value=!1})};return t.watch(()=>i.cartItem,g=>{l.value=g},{deep:!0}),(g,b)=>{const y=Uo;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(Pu,{show:a.value,"onUpdate:show":b[0]||(b[0]=_=>a.value=_),"height-overlaps":n.settings.heightOverlaps,"width-overlaps":n.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),t.createElementVNode("div",vb,[o.value?(t.openBlock(),t.createBlock(t.unref(F.NDrawer),{key:1,show:s.value,"onUpdate:show":b[4]||(b[4]=_=>s.value=_),"default-width":375,resizable:""},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NDrawerContent),null,{header:t.withCtx(()=>[t.createVNode(t.unref(F.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:b[2]||(b[2]=_=>s.value=!1)},{default:t.withCtx(()=>[t.createVNode(y)]),_:1})]),default:t.withCtx(()=>[t.createVNode(Ea,{"configurator-params":l.value.configuratorParams,settings:n.settings,onOpenInstructions:b[3]||(b[3]=_=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(t.openBlock(),t.createBlock(Ea,{key:0,"configurator-params":l.value.configuratorParams,settings:n.settings,onOpenInstructions:b[1]||(b[1]=_=>a.value=!0)},null,8,["configurator-params","settings"])),t.createVNode(Ru,{ref:"mosquito-configurator-form",value:l.value,"onUpdate:value":b[5]||(b[5]=_=>l.value=_),validation:d.value,settings:n.settings,"is-product-searching":u.value,"is-submit-processing":f.value,"onUpdate:params":b[6]||(b[6]=_=>t.unref(p)(_)),onSubmit:b[7]||(b[7]=_=>m()),"onClick:instructionsToggle":b[8]||(b[8]=_=>a.value=!a.value),"onClick:showPreviewDrawer":b[9]||(b[9]=_=>s.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),Bb={},Vu=t.defineComponent({...Bb,__name:"strip-configurator-line-item",props:{value:{},index:{},path:{},settings:{},product:{default:void 0},addLineButtonDisabled:{type:Boolean,default:!1},removeLineButtonDisabled:{type:Boolean,default:!1},suggestionOption:{default:void 0},autoFocus:{type:Boolean,default:!1},isLastLine:{type:Boolean,default:!1},validation:{}},emits:["update:value","click:add-line","click:remove-line"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.useTemplateRef("width-input-element"),a=t.ref(!1),l=t.ref(r.value),c=t.useTemplateRef("form-item-reference"),d=t.computed(()=>{var p;return!((p=c.value)!=null&&p.validationErrored)}),u=p=>{l.value=p,o("update:value",p,r.index,a)},f=p=>{lt(p),(p.key==="Enter"||p.code==="Enter")&&!r.isLastLine&&(p.preventDefault(),p.stopPropagation())},h=()=>{var p;(p=s.value)==null||p.select()};return t.watch(()=>r.value,p=>{l.value=p}),t.onMounted(()=>{r.autoFocus&&t.nextTick(()=>{h()})}),e({isValid:d,formItemReference:c}),(p,m)=>{const g=ac,b=fo;return t.openBlock(),t.createBlock(t.unref(F.NFormItem),{ref:"form-item-reference",path:n.path,label:`Полоса №${n.index+1}, мм`,class:"sc-hide-empty-feedback-message"},{feedback:t.withCtx(()=>[d.value?(t.openBlock(),t.createBlock($r,{key:0,"is-product-searching":a.value,product:n.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(F.NDropdown),{trigger:"click",options:n.suggestionOption,placement:"bottom-start",size:"large",onSelect:u},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref:"width-input-element",value:l.value??null,class:"w-full","show-button":!1,parse:t.unref(ct),placeholder:"Введите ширину",onKeydown:f,onInput:m[0]||(m[0]=y=>t.unref(ot)(n.validation,`linesWidths.${n.index}`)),onFocus:t.unref(Le),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),t.createVNode(t.unref(F.NButton),{disabled:n.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:m[1]||(m[1]=y=>o("click:add-line",n.index))},{default:t.withCtx(()=>[t.createVNode(g)]),_:1},8,["disabled"]),t.createVNode(t.unref(F.NButton),{disabled:n.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:m[2]||(m[2]=y=>o("click:remove-line",n.index))},{default:t.withCtx(()=>[t.createVNode(b)]),_:1},8,["disabled"])]),_:1},8,["path","label"])}}}),Nb={class:"my-2 flex w-full flex-col"},Tb={key:1},$b={class:"text-lg font-semibold"},Eb={class:"flex gap-3"},Rb={},Mu=t.defineComponent({...Rb,__name:"strip-configurator-form",props:{value:{},settings:{},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:add-line","click:remove-line"],setup(n,{expose:e,emit:i}){var _;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("line-items-reference"),l=t.ref(M.cloneDeep(r.value)),c=t.computed(()=>{const k={length:[le.required,le.min(r.settings.minLength),le.max(r.settings.maxLength),le.step(r.settings.lengthStep),He.serverValidation(r.validation.length.feedback)],quantity:[le.required,le.min(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]};return M.forEach(l.value,(x,v)=>{var B;k[`configuratorParams.linesWidths.${v}`]=[le.required,le.min(r.settings.minLineWidth),le.step(r.settings.lineWidthStep),He.serverValidation((B=r.validation[`linesWidths.${v}`])==null?void 0:B.feedback)]}),k}),d=t.ref(r.settings.canSetDopProdaga??!1),u=t.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((k,x)=>(k??0)+(x??0),0)),f=t.computed(()=>r.settings.width-u.value),h=t.computed(()=>!r.value.some(({product:k})=>!k||k.isNewRec())),p=t.computed(()=>r.isSubmitProcessing||!h.value||f.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(k=>k.product.isNewRec())),m=t.computed(()=>k=>f.value===0?void 0:[{label:`${(f.value>0?"Остаток +":"Излишек ")+f.value} мм.`,key:f.value+k}]),g=t.computed(()=>{const{length:k}=r.value[0];return!k||u.value!==r.settings.width?null:(M.reduce(r.value,(v,B)=>{var T;const w=((T=B.product)==null?void 0:T.costRub)||0;return v+w},0)*r.value[0].quantity*k).toLocaleString("ru-ru",{minimumFractionDigits:2})}),b=(k,x,v)=>{var w,T,C;l.value[x].product.id=-1;const{configuratorParams:B}=l.value[x];B.linesWidths[x]=k,y("configuratorParams",B),(C=(T=(w=a.value)==null?void 0:w.at(x))==null?void 0:T.formItemReference)==null||C.validate().catch(M.noop),t.nextTick(()=>{var $,E;(E=($=a.value)==null?void 0:$.at(x))!=null&&E.isValid&&o("update:params",B,x,v)})},y=(k,x)=>{l.value.forEach(v=>{v[k]=x}),o("update:value",l.value)};return t.watch(()=>r.value,k=>{l.value=M.cloneDeep(k)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(k,x)=>{const v=F.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:l.value[0],rules:c.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var B;return[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,(w,T)=>{var C,$,E;return t.openBlock(),t.createBlock(Vu,{key:T,ref_for:!0,ref:"line-items-reference",value:((C=w.configuratorParams)==null?void 0:C.linesWidths.at(T))??null,"auto-focus":((($=w.configuratorParams)==null?void 0:$.linesWidths.at(T))??0)===0,index:T,path:`configuratorParams.linesWidths.${T}`,product:w.product,settings:n.settings,validation:n.validation,"suggestion-option":m.value(((E=w.configuratorParams)==null?void 0:E.linesWidths.at(T))??0),"add-line-button-disabled":f.value<=0||n.value.length>=n.settings.maxLinesCount||n.value.some(I=>I.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"is-last-line":T===l.value.length-1&&f.value===0,"onUpdate:value":b,"onClick:addLine":x[0]||(x[0]=I=>o("click:add-line",I)),"onClick:removeLine":x[1]||(x[1]=I=>o("click:remove-line",I))},null,8,["value","auto-focus","index","path","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled","is-last-line"])}),128)),t.createElementVNode("div",Nb,[f.value<0?(t.openBlock(),t.createBlock(t.unref(F.NText),{key:0,type:"error"},{default:t.withCtx(()=>[t.createTextVNode(" Сумма ширин всех полос должна быть равна "+t.toDisplayString(n.settings.width),1)]),_:1})):t.createCommentVNode("",!0),h.value&&l.value.length===n.settings.maxLinesCount&&f.value>0?(t.openBlock(),t.createBlock(t.unref(F.NText),{key:1,type:"error"},{default:t.withCtx(()=>[...x[15]||(x[15]=[t.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",null,[x[16]||(x[16]=t.createTextVNode(" Остаток для резки: ",-1)),t.createVNode(t.unref(F.NText),{type:f.value>=0?"Success":"error"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f.value),1)]),_:1},8,["type"]),t.createTextVNode(" из "+t.toDisplayString(n.settings.width)+" мм ",1)])]),t.createVNode(t.unref(F.NButton),{disabled:p.value,type:"primary",class:"self-center",onClick:x[2]||(x[2]=w=>o("click:add-line",l.value.length))},{default:t.withCtx(()=>[...x[17]||(x[17]=[t.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["disabled"]),t.createVNode(t.unref(F.NFormItem),{path:"length",label:`Метраж ${n.settings.minLength?" от "+n.settings.minLength:""} ${n.settings.maxLength?" до "+n.settings.maxLength:""} м.`},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value[0].length,"onUpdate:value":[x[3]||(x[3]=w=>l.value[0].length=w),x[6]||(x[6]=w=>y("length",w))],parse:t.unref(ct),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:x[4]||(x[4]=w=>t.unref(lt)(w,!1)),onInput:x[5]||(x[5]=w=>t.unref(ot)(n.validation,"length")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value[0].quantity,"onUpdate:value":[x[7]||(x[7]=w=>l.value[0].quantity=w),x[10]||(x[10]=w=>y("quantity",w))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:x[8]||(x[8]=w=>t.unref(lt)(w,!1)),onInput:x[9]||(x[9]=w=>t.unref(ot)(n.validation,"quantity")),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:l.value[0].marker??null,placeholder:"Введите маркировку",onInput:x[11]||(x[11]=w=>t.unref(ot)(n.validation,"marker")),"onUpdate:value":x[12]||(x[12]=w=>{l.value[0].marker=w??null,y("marker",w??null)}),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(v,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":x[13]||(x[13]=w=>{l.value[0].isAdditionalSale=w??!1,y("isAdditionalSale",w??!1)})},{default:t.withCtx(()=>[...x[18]||(x[18]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),g.value?(t.openBlock(),t.createElementBlock("div",Tb,[x[19]||(x[19]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",$b,t.toDisplayString(g.value)+" ₽",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Eb,[t.createVNode(t.unref(F.NButton),{loading:n.isSubmitProcessing,disabled:!h.value||f.value!=0||!((B=l.value[0])!=null&&B.length)||l.value[0].length>n.settings.maxLength||l.value[0].length<n.settings.minLength||l.value[0].quantity===0,type:"primary",class:"self-start",onClick:x[14]||(x[14]=w=>o("submit",l.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(l.value[0].isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[t.unref(oi),()=>o("submit",l.value)]])}}}),Pb={class:"flex grow flex-col"},Fb=["src"],Vb={class:"w-full"},Mb={},Iu=t.defineComponent({...Mb,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",Pb,[t.createElementVNode("img",{src:"/img/configurators/strip/strip-"+n.value.length+".png",class:"w-full max-w-96 self-center py-5",alt:"Штрипс"},null,8,Fb),t.createElementVNode("div",Vb,[t.createTextVNode(" Число полос можно указать от "+t.toDisplayString(n.settings.minLinesCount)+" до "+t.toDisplayString(n.settings.maxLinesCount)+". ",1),i[0]||(i[0]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Минимальная ширина полосы "+t.toDisplayString(n.settings.minLineWidth)+" мм. ",1),i[1]||(i[1]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Ширина всех полос "+t.toDisplayString(n.settings.width)+" мм. ",1),i[2]||(i[2]=t.createElementVNode("br",null,null,-1)),t.createTextVNode(" Шаг ширины полосы - "+t.toDisplayString(n.settings.lineWidthStep)+" мм. ",1)])]))}}),Ib={class:"flex flex-col gap-2"},Ab={class:"flex grow flex-col px-5 md:w-104"},Ob={},Au=t.defineComponent({...Ob,__name:"strip-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("strip-configurator-form"),s=t.ref(i.cartItems),a=t.ref({width:{},length:{},quantity:{},marker:{}}),l=t.ref(!1),c=t.computed(()=>t.inject("debounce-input-time",300)),d=t.computed(()=>{var m;return(m=s.value[0].configuratorParams)==null?void 0:m.linesWidths.reduce((g,b)=>(g??0)+(b??0),0)}),u=m=>{m===void 0&&(m=s.value.length-1);const g=s.value.at(0);if(!g)return;g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m+1,0,null),s.value.forEach(y=>{y.configuratorParams.linesWidths=g.configuratorParams.linesWidths});const b=new j.OrderItemBase({quantity:(g==null?void 0:g.quantity)??1,category:g==null?void 0:g.category,length:(g==null?void 0:g.length)??i.settings.minLength,marker:g==null?void 0:g.marker,configuratorParams:{linesWidths:g==null?void 0:g.configuratorParams.linesWidths}});s.value=s.value.toSpliced(m+1,0,b)},f=m=>{const g=s.value.at(0);g&&(g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(m,1),s.value.forEach(b=>{b.configuratorParams.linesWidths=g.configuratorParams.linesWidths}),s.value=s.value.toSpliced(m,1),delete a[`linesWidths.${m}`],delete a[`linesWidths.${m}`])},h=M.debounce(async(m,g,b)=>{const y={linesWidths:m.linesWidths.at(g)};b.value=!0,a.value[`linesWidths.${g}`]={},s.value[g].product=new j.ClientProduct,i.eventEmitter.emit("configurator:search-product",{category:s.value[g].category,params:y,validationFieldResultData:a.value,callback:_=>{_?(s.value[g].product=_,g===s.value.length-1&&s.value.length<i.settings.maxLinesCount&&d.value&&d.value<i.settings.width&&u()):(s.value[g].product=new j.ClientProduct,a.value[`linesWidths.${g}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},b.value=!1),b.value=!1}})},c.value),p=async()=>{var m,g;(g=(m=o.value)==null?void 0:m.formReference)==null||g.validate(b=>{if(!b){l.value=!0;const y=s.value.at(0);if(!y)return;r("submit",y,a.value,()=>{l.value=!1,t.nextTick(()=>{var _,k;(k=(_=o.value)==null?void 0:_.formReference)==null||k.restoreValidation()})})}}).catch(M.noop)};return t.watch(()=>i.cartItems,m=>{s.value=m.map(g=>new j.OrderItemBase(g))}),(m,g)=>{const b=F.NButton;return t.openBlock(),t.createElementBlock("div",Ib,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(b,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=y=>r("click:view-switch"))},{default:t.withCtx(()=>[...g[3]||(g[3]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",Ab,[t.createVNode(Iu,{value:s.value,"onUpdate:value":g[1]||(g[1]=y=>s.value=y),settings:n.settings},null,8,["value","settings"]),t.createVNode(Mu,{ref:"strip-configurator-form",value:s.value,"onUpdate:value":g[2]||(g[2]=y=>s.value=y),validation:a.value,settings:n.settings,"is-submit-processing":l.value,"onUpdate:params":t.unref(h),onSubmit:p,"onClick:addLine":u,"onClick:removeLine":f},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),zb={class:"flex flex-col gap-3"},Db={},Ou=t.defineComponent({...Db,__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","submit"],setup(n,{expose:e,emit:i}){var p;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("first-input-element"),l=t.ref(M.cloneDeep(r.value)),c=t.computed(()=>({"configuratorParams.width":[le.required,le.min(r.settings.minWidth),...r.settings.maxWidth?[le.max(r.settings.maxWidth)]:[],le.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[le.required,le.min(r.settings.minLength),le.max(r.settings.maxLength),le.step(1),He.serverValidation(r.validation.length.feedback)],quantity:[le.required,le.min(1),le.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),d=t.ref(r.settings.canSetDopProdaga??!1),u=()=>{o("update:params",l.value.configuratorParams),f("configuratorParams",l.value.configuratorParams)},f=(m,g)=>{const b=new j.OrderItemBase(r.value);b[m]=g,m==="configuratorParams"&&(b.product=new j.ClientProduct),o("update:value",b)},h=()=>{var m;(m=a.value)==null||m.select()};return t.watch(()=>r.value,m=>{l.value=M.cloneDeep(m)},{deep:!0}),t.onMounted(()=>{r.value.isNewRec()&&t.nextTick(()=>{h()})}),e({validate:(p=s.value)==null?void 0:p.validate,formReference:s}),(m,g)=>{const b=F.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:l.value,rules:c.value,disabled:n.isSubmitProcessing,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NFormItem),{path:"configuratorParams.width",label:`Ширина, ${n.settings.minWidth?" от "+n.settings.minWidth:""}${n.settings.maxWidth?" до "+n.settings.maxWidth:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref:"first-input-element",value:l.value.configuratorParams.width,"onUpdate:value":[g[0]||(g[0]=y=>l.value.configuratorParams.width=y),u],class:"w-full",parse:t.unref(ct),"show-button":!1,placeholder:"Введите ширину",onKeydown:g[1]||(g[1]=y=>t.unref(lt)(y)),onInput:g[2]||(g[2]=y=>t.unref(ot)(n.validation,"width")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"configuratorParams.length",label:`Длина, ${n.settings.minLength?" от "+n.settings.minLength:""}${n.settings.maxLength?" до "+n.settings.maxLength:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[g[3]||(g[3]=y=>l.value.configuratorParams.length=y),u],placeholder:"Введите длину",parse:t.unref(ct),"show-button":!1,class:"w-full",onKeydown:g[4]||(g[4]=y=>t.unref(lt)(y)),onInput:g[5]||(g[5]=y=>t.unref(ot)(n.validation,"length")),onFocus:t.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(F.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:n.value.quantity,placeholder:"Введите количество",min:1,"show-button":!1,class:"w-full",onKeydown:g[6]||(g[6]=y=>t.unref(lt)(y,!1)),onInput:g[7]||(g[7]=y=>t.unref(ot)(n.validation,"quantity")),"onUpdate:value":g[8]||(g[8]=y=>f("quantity",y??0)),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:n.value.marker??null,placeholder:"Введите маркировку",onInput:g[9]||(g[9]=y=>t.unref(ot)(n.validation,"marker")),"onUpdate:value":g[10]||(g[10]=y=>f("marker",y??null)),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(b,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":g[11]||(g[11]=y=>{l.value.isAdditionalSale=y??!1,f("isAdditionalSale",y??!1)})},{default:t.withCtx(()=>[...g[13]||(g[13]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode($r,{"is-product-searching":n.isProductSearching,product:n.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),t.createElementVNode("div",zb,[t.createVNode(t.unref(F.NButton),{disabled:n.value.product.isNewRec()||n.isProductSearching||n.isSubmitProcessing||n.value.length===0||n.value.width===0||n.value.quantity===0,type:"primary",class:"self-start",onClick:g[12]||(g[12]=y=>o("submit",n.value))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["model","rules","disabled"])),[[t.unref(oi),()=>o("submit",l.value)]])}}}),Lb={class:"flex flex-col gap-2 w-72"},Hb={},zu=t.defineComponent({...Hb,__name:"metal-for-doors-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("metal-for-doors-configurator-form"),s=t.ref(i.cartItem),a=t.ref({width:{},length:{},quantity:{},marker:{}}),l=t.ref(!1),c=t.ref(!1),d=t.computed(()=>t.inject("debounce-input-time",300)),u=M.debounce(async h=>{var p,m;s.value.product=new j.ClientProduct,(m=(p=o.value)==null?void 0:p.formReference)==null||m.validate(g=>{g||(l.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:h,validationFieldResultData:a.value,callback:b=>{b?s.value.product=b:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(M.noop)},d.value),f=async()=>{var h,p;(p=(h=o.value)==null?void 0:h.formReference)==null||p.validate(m=>{m||(c.value=!0,r("submit",s.value,a.value,()=>{c.value=!1,t.nextTick(()=>{var g,b;(b=(g=o.value)==null?void 0:g.formReference)==null||b.restoreValidation()})}))}).catch(M.noop)};return t.watch(()=>i.cartItem,h=>{s.value=new j.OrderItemBase(h)},{deep:!0}),(h,p)=>{const m=F.NButton;return t.openBlock(),t.createElementBlock("div",Lb,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(m,{key:0,type:"tertiary",class:"self-center",onClick:p[0]||(p[0]=g=>r("click:view-switch"))},{default:t.withCtx(()=>[...p[4]||(p[4]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createVNode(Ou,{ref:"metal-for-doors-configurator-form",value:s.value,"onUpdate:value":p[1]||(p[1]=g=>s.value=g),validation:a.value,settings:n.settings,"is-submit-processing":c.value,"is-product-searching":l.value,"onUpdate:params":p[2]||(p[2]=g=>t.unref(u)(g)),onSubmit:p[3]||(p[3]=g=>f())},null,8,["value","validation","settings","is-submit-processing","is-product-searching"])])}}}),Wb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function jb(n,e){return t.openBlock(),t.createElementBlock("svg",Wb,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 112v288m144-144H112"},null,-1)])])}const Du=t.markRaw({name:"ion-add",render:jb}),qb={key:0,class:"-mt-1 text-sm text-gray-500"},Xb={class:"font-bold"},Yb={class:"flex flex-col gap-3"},Ub={key:0,class:"mt-4 flex flex-col gap-1.5"},Kb={class:"flex flex-col gap-1 text-sm text-gray-700"},Gb={key:0},Zb={key:1},Qb={"form-array-name":"items",class:"flex flex-col gap-3"},Jb={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},e_={key:0,class:"flex flex-wrap items-end gap-2"},t_={class:"whitespace-nowrap text-xl font-bold"},n_={key:0,class:"whitespace-nowrap text-lg text-gray-500"},i_={class:"font-bold"},r_={class:"font-bold"},o_={class:"flex gap-3"},s_={},Lu=t.defineComponent({...s_,__name:"sandwich-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","add-item","remove-item"],setup(n,{expose:e,emit:i}){var D;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.ref(M.cloneDeep(r.value)),l=t.ref({...r.validation}),c=L=>{var z;delete l.value[L],(z=s.value)==null||z.restoreValidation()};t.watch(()=>r.validation,L=>{l.value={...L},Object.values(L).some(P=>P==null?void 0:P.feedback)&&t.nextTick(()=>{var P;return(P=s.value)==null?void 0:P.validate(M.noop).catch(M.noop)})},{deep:!0});const d=t.computed(()=>r.value.category),u=t.ref(null),f=t.ref(null),h=t.computed(()=>d.value.products??[]),p=t.computed(()=>h.value.map(L=>({label:L.name,value:L.id}))),m=(L,z,P)=>{const q=L!=null&&L>0,K=z!=null&&z>0;return!q&&!K?null:q&&K?`от ${L} ${P} до ${z} ${P}`:q?`от ${L} ${P}`:`до ${z} ${P}`},g=t.computed(()=>{var L,z;return m(r.settings.minWidth,(z=(L=u.value)==null?void 0:L.properties)==null?void 0:z.width,"мм")}),b=t.computed(()=>{var L,z;return m(r.settings.minLength,(z=(L=u.value)==null?void 0:L.properties)==null?void 0:z.length,"мм")}),y=t.ref(null),_=t.ref(!1),k=t.computed(()=>{var z;const L={marker:[He.serverValidation((z=l.value.marker)==null?void 0:z.feedback)]};return a.value.configuratorParams.items.forEach((P,q)=>{var K,J,Y,V,A,ie,ce;L[`configuratorParams.items.${q}.width`]=[le.required,le.min(r.settings.minWidth),...(J=(K=u.value)==null?void 0:K.properties)!=null&&J.width?[le.max(u.value.properties.width)]:[],le.step(1),He.serverValidation((Y=l.value[`items.${q}.width`])==null?void 0:Y.feedback)],L[`configuratorParams.items.${q}.length`]=[le.required,le.min(r.settings.minLength),...(A=(V=u.value)==null?void 0:V.properties)!=null&&A.length?[le.max(u.value.properties.length)]:[],le.step(1),He.serverValidation((ie=l.value[`items.${q}.length`])==null?void 0:ie.feedback)],L[`configuratorParams.items.${q}.count`]=[le.required,le.min(1),le.step(1),He.serverValidation((ce=l.value[`items.${q}.count`])==null?void 0:ce.feedback)]}),L}),x=t.ref(r.settings.canSetDopProdaga??!1),v=t.computed(()=>a.value.configuratorParams.items.some(L=>{var z,P;return!u.value||!L.width||L.width<r.settings.minWidth||L.width>(((z=u.value.properties)==null?void 0:z.width)??0)||L.length===0||L.length<r.settings.minLength||L.length>(((P=u.value.properties)==null?void 0:P.length)??0)||!L.count||L.count<1})),B=t.computed(()=>!u.value||v.value||a.value.configuratorParams.items.length===0),w=t.ref(null),T=L=>{if(!L){u.value=null,f.value=null,a.value.product=new j.ClientProduct,y.value=null;return}const z=h.value.find(P=>P.id===L);z&&(u.value=z,f.value=L,a.value.product=z,G("product",a.value.product),a.value.configuratorParams.items.forEach(P=>{var q,K;(q=z.properties)!=null&&q.width&&P.width>z.properties.width&&(P.width=z.properties.width),(K=z.properties)!=null&&K.length&&P.length>z.properties.length&&(P.length=z.properties.length)}),$())};let C=!1;const $=()=>{C=!0,y.value=null,w.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},E=async()=>{var L;if(!u.value||a.value.configuratorParams.items.length===0||v.value){$();return}(L=s.value)==null||L.validate(z=>{if(z){$();return}if(_.value=!0,!u.value||!d.value){$(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:P=>{P?(y.value=P,a.value.configuratorParams.calculationId=P.id,a.value.quantity=P.quantity,t.nextTick(()=>{G("quantity",P.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,$()),G("configuratorParams",a.value.configuratorParams),I(),_.value=!1}})}).catch(()=>{$(),_.value=!1})},I=()=>{var z;if(!((z=u.value)!=null&&z.costRub)||!y.value){w.value=null;return}const L=y.value.quantity*u.value.costRub;w.value=Math.round(L*100)/100},R=L=>{var P,q;const z=a.value.configuratorParams.items[L];u.value&&((P=u.value.properties)!=null&&P.width&&z.width>u.value.properties.width&&(z.width=u.value.properties.width),(q=u.value.properties)!=null&&q.length&&z.length>u.value.properties.length&&(z.length=u.value.properties.length)),G("configuratorParams",a.value.configuratorParams),$()},O=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),G("configuratorParams",a.value.configuratorParams),$(),o("add-item",a.value.configuratorParams.items.length)},U=L=>{a.value.configuratorParams.items.splice(L,1),G("configuratorParams",a.value.configuratorParams),$(),o("remove-item",L)},Q=()=>{if(!(B.value||_.value||r.isSubmitProcessing)){if(!y.value){E();return}o("submit",a.value)}},G=(L,z)=>{const P=new j.OrderItemBase(r.value);P[L]=z,o("update:value",P)};t.watch(()=>r.value,L=>{const z=M.cloneDeep(t.toRaw(L));(!z.configuratorParams.items||z.configuratorParams.items.length===0)&&(z.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=z,r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),r.value.product.isNewRec()&&(u.value=null,f.value=null),C?C=!1:W()},{deep:!0});const W=()=>{const{calculationId:L}=a.value.configuratorParams,z=a.value.quantity??0;L&&z>0&&a.value.product&&!a.value.product.isNewRec()&&(y.value={id:L,quantity:z,sheets:[]},I())};return t.onMounted(()=>{r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),W()}),e({validate:(D=s.value)==null?void 0:D.validate,formReference:s}),(L,z)=>{const P=fo,q=Du;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:a.value,rules:k.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var K;return[t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:f.value,"onUpdate:value":[z[0]||(z[0]=J=>f.value=J),T],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((K=u.value)==null?void 0:K.costRub)!=null?(t.openBlock(),t.createElementBlock("div",qb,[t.createElementVNode("span",Xb,t.toDisplayString(u.value.code),1),t.createTextVNode(" — "+t.toDisplayString(u.value.costRub.toLocaleString())+" "+t.toDisplayString(u.value.currency.symbol)+"/шт. ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Yb,[u.value?(t.openBlock(),t.createElementBlock("div",Ub,[z[7]||(z[7]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",Kb,[g.value?(t.openBlock(),t.createElementBlock("div",Gb,"Ширина "+t.toDisplayString(g.value)+".",1)):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock("div",Zb,"Длина "+t.toDisplayString(b.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",Qb,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value.configuratorParams.items,(J,Y)=>(t.openBlock(),t.createElementBlock("div",{key:Y,class:"flex grow gap-2"},[t.createElementVNode("div",Jb,[t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.items.${Y}.width`,label:"Ширина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:a.value.configuratorParams.items[Y].width,"onUpdate:value":[V=>a.value.configuratorParams.items[Y].width=V,V=>R(Y)],parse:t.unref(ct),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:z[1]||(z[1]=V=>t.unref(lt)(V)),onInput:V=>c(`items.${Y}.width`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.items.${Y}.length`,label:"Длина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:a.value.configuratorParams.items[Y].length,"onUpdate:value":[V=>a.value.configuratorParams.items[Y].length=V,V=>R(Y)],parse:t.unref(ct),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:z[2]||(z[2]=V=>t.unref(lt)(V)),onInput:V=>c(`items.${Y}.length`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`configuratorParams.items.${Y}.count`,label:"Количество, шт"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:a.value.configuratorParams.items[Y].count,"onUpdate:value":[V=>a.value.configuratorParams.items[Y].count=V,V=>R(Y)],parse:t.unref(ct),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:z[3]||(z[3]=V=>t.unref(lt)(V,!1)),onInput:V=>c(`items.${Y}.count`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createVNode(t.unref(F.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:V=>U(Y)},{default:t.withCtx(()=>[t.createVNode(P)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:1,disabled:v.value,type:"default",class:"self-center",onClick:O},{default:t.withCtx(()=>[t.createVNode(q),z[8]||(z[8]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0)]),t.createVNode(t.unref(F.NFormItem),{path:"marker",label:"Маркировка распила"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:a.value.marker??null,disabled:!u.value,placeholder:"Введите маркировку распила",onInput:z[4]||(z[4]=J=>c("marker")),"onUpdate:value":z[5]||(z[5]=J=>G("marker",J??null)),onFocus:t.unref(Le)},null,8,["value","disabled","onFocus"])]),_:1}),x.value?(t.openBlock(),t.createBlock(t.unref(F.NCheckbox),{key:1,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":z[6]||(z[6]=J=>{a.value.isAdditionalSale=J??!1,G("isAdditionalSale",J??!1)})},{default:t.withCtx(()=>[...z[9]||(z[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode(t.unref(F.NSpin),{show:_.value,size:"small",class:"grow"},{default:t.withCtx(()=>{var J;return[y.value&&u.value&&w.value?(t.openBlock(),t.createElementBlock("div",e_,[t.createElementVNode("div",null,[z[10]||(z[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",t_,t.toDisplayString(w.value.toLocaleString())+" "+t.toDisplayString(u.value.currency.symbol),1)]),y.value.quantity&&u.value?(t.openBlock(),t.createElementBlock("div",n_,[t.createElementVNode("span",i_,"("+t.toDisplayString(y.value.quantity)+" шт.",1),z[11]||(z[11]=t.createTextVNode(" x ",-1)),t.createElementVNode("span",r_,t.toDisplayString((J=u.value.costRub)==null?void 0:J.toLocaleString())+" "+t.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]}),_:1},8,["show"]),t.createElementVNode("div",o_,[y.value&&!_.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,loading:n.isSubmitProcessing,disabled:B.value||_.value,type:"primary",class:"self-start",onClick:Q},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])):(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:1,loading:_.value,disabled:B.value||_.value,type:"info",class:"self-start",onClick:E},{default:t.withCtx(()=>[...z[12]||(z[12]=[t.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules"])),[[t.unref(oi),Q]])}}}),a_={class:"flex flex-col gap-2"},l_={class:"w-104 flex grow flex-col px-5"},c_={},Hu=t.defineComponent({...c_,__name:"sandwich-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("sandwich-configurator-form"),s=t.ref(i.cartItem),a=t.ref({width:{},length:{},quantity:{},marker:{},product:{}}),l=t.ref(!1),c=async()=>{var f,h;(h=(f=o.value)==null?void 0:f.formReference)==null||h.validate(p=>{if(!p){l.value=!0;const m=M.cloneDeep(s.value);"items"in m.configuratorParams&&delete m.configuratorParams.items,r("submit",m,a.value,()=>{l.value=!1,t.nextTick(()=>{var g,b;(b=(g=o.value)==null?void 0:g.formReference)==null||b.restoreValidation()})})}}).catch(M.noop)},d=f=>{a.value[`items.${f}.width`]={},a.value[`items.${f}.length`]={},a.value[`items.${f}.count`]={}},u=f=>{delete a.value[`items.${f}.width`],delete a.value[`items.${f}.length`],delete a.value[`items.${f}.count`]};return t.onMounted(()=>{i.cartItem.configuratorParams.items.forEach((f,h)=>{a.value[`items.${h}.width`]={},a.value[`items.${h}.length`]={},a.value[`items.${h}.count`]={}})}),t.watch(()=>i.cartItem,f=>{s.value=new j.OrderItemBase(f)},{deep:!0}),(f,h)=>{const p=F.NButton;return t.openBlock(),t.createElementBlock("div",a_,[n.settings.allowShowTable&&s.value.isNewRec()?(t.openBlock(),t.createBlock(p,{key:0,type:"tertiary",class:"self-center",onClick:h[0]||(h[0]=m=>r("click:view-switch"))},{default:t.withCtx(()=>[...h[2]||(h[2]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",l_,[t.createVNode(Lu,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":h[1]||(h[1]=m=>s.value=m),validation:a.value,settings:n.settings,"event-emitter":n.eventEmitter,"is-submit-processing":l.value,onSubmit:c,onAddItem:d,onRemoveItem:u},null,8,["value","validation","settings","event-emitter","is-submit-processing"])])])}}}),d_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function u_(n,e){return t.openBlock(),t.createElementBlock("svg",d_,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"},null,-1)])])}const f_=t.markRaw({name:"ion-checkmark",render:u_}),h_={key:0,class:"-mt-1 text-sm text-gray-500"},m_={class:"font-bold"},p_={class:"flex flex-col gap-3"},g_={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},y_={class:"flex flex-col gap-1 text-sm text-gray-700"},b_={key:0},__={key:1},w_={"form-array-name":"items",class:"flex flex-col gap-3"},x_={class:"min-w-0 flex-1"},k_={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},C_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},v_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},S_={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},B_={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},N_={key:0,class:"lg:!flex-[2]"},T_={class:"font-bold"},$_={key:1,class:"lg:!flex-[3]"},E_={class:"font-bold"},R_={key:1,class:"min-w-0 flex flex-col items-end gap-1 text-right text-sm text-gray-700 border-t border-gray-200 pt-2"},P_={key:0},F_={class:"font-bold"},V_={key:1},M_={class:"font-bold"},I_={class:"flex flex-wrap items-center gap-3"},A_={},Wu=t.defineComponent({...A_,__name:"sandwich-m2-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},itemStates:{default:()=>[]}},emits:["submit","update:value","add-item","remove-item","item-reset"],setup(n,{expose:e,emit:i}){var J;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.useTemplateRef("widthInputs"),l=r.value==null?[]:M.cloneDeep(t.toRaw(r.value)),c=t.ref(l.map(Y=>new j.OrderItemBase(Y))),d=t.computed(()=>({items:c.value})),u=t.ref({...r.validation}),f=Y=>{var V;delete u.value[Y],(V=s.value)==null||V.restoreValidation()},h=t.ref(null),p=t.ref(null),m=t.computed(()=>{var Y,V;return((V=(Y=c.value[0])==null?void 0:Y.category)==null?void 0:V.products)??[]}),g=t.computed(()=>m.value.map(Y=>({label:Y.name,value:Y.id}))),b=(Y,V,A)=>{const ie=Y!=null&&Y>0,ce=V!=null&&V>0;return!ie&&!ce?null:ie&&ce?`от ${Y} ${A} до ${V} ${A}`:ie?`от ${Y} ${A}`:`до ${V} ${A}`},y=t.computed(()=>{var Y,V;return b(r.settings.minWidth,(V=(Y=h.value)==null?void 0:Y.properties)==null?void 0:V.width,"мм")}),_=t.computed(()=>{var Y,V;return b(r.settings.minLength,(V=(Y=h.value)==null?void 0:Y.properties)==null?void 0:V.length,"мм")}),k=t.computed(()=>{const Y={};return c.value.forEach((V,A)=>{var ie,ce,pe,at,we,ke,kt,Ne;Y[`items.${A}.configuratorParams.width`]=[le.required,le.min(r.settings.minWidth),...(ce=(ie=h.value)==null?void 0:ie.properties)!=null&&ce.width?[le.max(h.value.properties.width)]:[],le.step(1),He.serverValidation((pe=u.value[`items.${A}.width`])==null?void 0:pe.feedback)],Y[`items.${A}.configuratorParams.length`]=[le.required,le.min(r.settings.minLength),...(we=(at=h.value)==null?void 0:at.properties)!=null&&we.length?[le.max(h.value.properties.length)]:[],le.step(1),He.serverValidation((ke=u.value[`items.${A}.length`])==null?void 0:ke.feedback)],Y[`items.${A}.quantity`]=[le.required,le.min(1),le.step(1),He.serverValidation((kt=u.value[`items.${A}.quantity`])==null?void 0:kt.feedback)],Y[`items.${A}.marker`]=[He.serverValidation((Ne=u.value[`items.${A}.marker`])==null?void 0:Ne.feedback)]}),Y});t.watch(()=>r.validation,Y=>{u.value={...Y},Object.values(Y).some(A=>A==null?void 0:A.feedback)&&t.nextTick(()=>{var A;return(A=s.value)==null?void 0:A.validate(M.noop).catch(M.noop)})},{deep:!0});const x=t.ref(r.settings.canSetDopProdaga??!1),v=t.computed(()=>{const Y=h.value;return Y?c.value.some(V=>{var pe,at;const A=V.configuratorParams,ie=(pe=Y.properties)==null?void 0:pe.width,ce=(at=Y.properties)==null?void 0:at.length;return A.width===0||A.width<r.settings.minWidth||ie!=null&&A.width>ie||A.length===0||A.length<r.settings.minLength||ce!=null&&A.length>ce||V.quantity===0||V.quantity<1}):!0}),B=t.computed(()=>!h.value||v.value||c.value.length===0),w=t.computed(()=>{const Y=c.value[0];return Y!=null&&!Y.isNewRec()}),T=Y=>r.itemStates[Y]??"idle",C=Y=>T(Y)==="success",$=Y=>T(Y)==="loading",E=t.computed(()=>c.value.length===0?!0:c.value.every((Y,V)=>{const A=T(V);return A==="success"||A==="loading"})),I=Y=>Y.width===0||Y.length===0?0:Y.width*Y.length/1e6,R=Y=>I(Y).toLocaleString(void 0,{maximumFractionDigits:4}),O=Y=>{var pe;const V=Y.configuratorParams,A=I(V),ie=((pe=h.value)==null?void 0:pe.costRub)??0,ce=Y.quantity??0;return!A||!ce?0:Math.round(A*ie*ce*100)/100},U=t.computed(()=>M.sum(c.value.map(Y=>{const V=Y.configuratorParams;return!V.width||V.length===0||!Y.quantity?0:V.width*V.length*Y.quantity/1e6}))),Q=t.computed(()=>Math.round(M.sum(c.value.map(Y=>O(Y)))*100)/100),G=()=>{var Y,V,A;return new j.OrderItemBase({category:(Y=c.value[0])==null?void 0:Y.category,configurator:(V=c.value[0])==null?void 0:V.configurator,product:h.value??new j.ClientProduct,quantity:1,isAdditionalSale:(A=c.value[0])==null?void 0:A.isAdditionalSale,configuratorParams:{width:0,length:0}})},W=Y=>{if(!Y){h.value=null,p.value=null,c.value.forEach(A=>{A.product=new j.ClientProduct}),o("update:value",c.value);return}const V=m.value.find(A=>A.id===Y);V&&(h.value=V,p.value=Y,c.value.forEach((A,ie)=>{var ce,pe;A.product=V,(ce=V.properties)!=null&&ce.width&&A.configuratorParams.width>V.properties.width&&(A.configuratorParams.width=V.properties.width),(pe=V.properties)!=null&&pe.length&&A.configuratorParams.length>V.properties.length&&(A.configuratorParams.length=V.properties.length),o("item-reset",ie)}),o("update:value",c.value))},D=Y=>{var ie,ce;const V=c.value[Y],A=h.value;A&&((ie=A.properties)!=null&&ie.width&&V.configuratorParams.width>A.properties.width&&(V.configuratorParams.width=A.properties.width),(ce=A.properties)!=null&&ce.length&&V.configuratorParams.length>A.properties.length&&(V.configuratorParams.length=A.properties.length)),o("item-reset",Y),o("update:value",c.value)},L=(Y,V)=>{c.value[Y].marker=V===null||V===""?void 0:V,o("item-reset",Y),o("update:value",c.value)},z=Y=>{c.value.forEach(V=>{V.isAdditionalSale=Y}),o("update:value",c.value)},P=()=>{c.value.push(G()),o("update:value",c.value),o("add-item",c.value.length),t.nextTick(()=>{var V,A,ie,ce;const Y=c.value.length-1;(A=(V=a.value)==null?void 0:V[Y])==null||A.focus(),(ce=(ie=a.value)==null?void 0:ie[Y])==null||ce.select()})},q=Y=>{c.value.splice(Y,1),o("update:value",c.value),o("remove-item",Y)};t.watch(()=>r.value,Y=>{var ce;const A=(Y==null?[]:M.cloneDeep(t.toRaw(Y))).map(pe=>new j.OrderItemBase(pe));c.value=A.length>0?A:[G()];const ie=(ce=c.value[0])==null?void 0:ce.product;ie&&!ie.isNewRec()?(h.value=ie,p.value=ie.id):(h.value=null,p.value=null)},{deep:!0});const K=()=>{var V;if(h.value!==null)return;const Y=(V=m.value[0])==null?void 0:V.id;Y!=null&&W(Y)};return t.watch(m,()=>{K()}),t.onMounted(()=>{var V;c.value.length===0&&(c.value=[G()]);const Y=(V=c.value[0])==null?void 0:V.product;Y&&!Y.isNewRec()&&(h.value=Y,p.value=Y.id),K()}),e({validate:(J=s.value)==null?void 0:J.validate,formReference:s}),(Y,V)=>{const A=f_,ie=fo,ce=Du;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{ref:"form-reference",model:d.value,rules:k.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var pe,at;return[t.createVNode(t.unref(F.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NSelect),{value:p.value,"onUpdate:value":[V[0]||(V[0]=we=>p.value=we),W],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((pe=h.value)==null?void 0:pe.costRub)!=null?(t.openBlock(),t.createElementBlock("div",h_,[t.createElementVNode("span",m_,t.toDisplayString(h.value.code),1),t.createTextVNode(" — "+t.toDisplayString(h.value.costRub.toLocaleString())+" "+t.toDisplayString(h.value.currency.symbol)+"/м² ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",p_,[h.value?(t.openBlock(),t.createElementBlock("div",g_,[V[6]||(V[6]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",y_,[y.value?(t.openBlock(),t.createElementBlock("div",b_,"Ширина "+t.toDisplayString(y.value)+".",1)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock("div",__,"Длина "+t.toDisplayString(_.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",w_,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value.items,(we,ke)=>{var kt;return t.openBlock(),t.createElementBlock("div",{key:ke,class:t.normalizeClass(["flex min-w-0 items-start gap-2 border-b border-gray-100 last:border-0",C(ke)?"opacity-70":""])},[t.createElementVNode("div",x_,[t.createElementVNode("div",k_,[t.createElementVNode("div",C_,[t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.configuratorParams.width`,label:"Ширина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{ref_for:!0,ref:"widthInputs",value:d.value.items[ke].configuratorParams.width,"onUpdate:value":[Ne=>d.value.items[ke].configuratorParams.width=Ne,Ne=>D(ke)],parse:t.unref(ct),"show-button":!1,disabled:!h.value||C(ke)||$(ke),placeholder:"Ширина",class:"w-full",onKeydown:V[1]||(V[1]=Ne=>t.unref(lt)(Ne)),onInput:Ne=>f(`items.${ke}.width`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:d.value.items[ke].configuratorParams.length,"onUpdate:value":[Ne=>d.value.items[ke].configuratorParams.length=Ne,Ne=>D(ke)],parse:t.unref(ct),"show-button":!1,disabled:!h.value||C(ke)||$(ke),placeholder:"Длина",class:"w-full",onKeydown:V[2]||(V[2]=Ne=>t.unref(lt)(Ne)),onInput:Ne=>f(`items.${ke}.length`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createElementVNode("div",v_,[t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:d.value.items[ke].quantity,"onUpdate:value":[Ne=>d.value.items[ke].quantity=Ne,Ne=>D(ke)],parse:t.unref(ct),"show-button":!1,disabled:!h.value||C(ke)||$(ke),placeholder:"Кол-во",class:"w-full",onKeydown:V[3]||(V[3]=Ne=>t.unref(lt)(Ne,!1)),onInput:Ne=>f(`items.${ke}.quantity`),onFocus:t.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(F.NFormItem),{path:`items.${ke}.marker`,label:"Маркировка",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:d.value.items[ke].marker??null,disabled:!h.value||C(ke)||$(ke),placeholder:"Маркировка",class:"w-full",onInput:Ne=>f(`items.${ke}.marker`),"onUpdate:value":Ne=>L(ke,Ne??null),onFocus:t.unref(Le)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),$(ke)||C(ke)?(t.openBlock(),t.createElementBlock("div",S_,[$(ke)?(t.openBlock(),t.createBlock(t.unref(F.NSpin),{key:0,size:14})):C(ke)?(t.openBlock(),t.createBlock(A,{key:1,class:"text-green-600 text-xl"})):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("div",B_,[we.configuratorParams.width>0&&we.configuratorParams.length>0?(t.openBlock(),t.createElementBlock("div",N_,[V[7]||(V[7]=t.createTextVNode(" Площадь (S) = ",-1)),t.createElementVNode("span",T_,t.toDisplayString(R(we.configuratorParams))+" м²",1)])):t.createCommentVNode("",!0),O(we)>0?(t.openBlock(),t.createElementBlock("div",$_,[V[8]||(V[8]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",E_,t.toDisplayString(O(we).toLocaleString())+" "+t.toDisplayString((kt=h.value)==null?void 0:kt.currency.symbol),1)])):t.createCommentVNode("",!0)])]),w.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,disabled:$(ke)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:Ne=>q(ke)},{default:t.withCtx(()=>[t.createVNode(ie)]),_:1},8,["disabled","onClick"]))],2)}),128))]),h.value?(t.openBlock(),t.createElementBlock("div",R_,[U.value>0?(t.openBlock(),t.createElementBlock("div",P_,[V[9]||(V[9]=t.createTextVNode(" Общая площадь: ",-1)),t.createElementVNode("span",F_,t.toDisplayString(U.value.toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):t.createCommentVNode("",!0),Q.value>0?(t.openBlock(),t.createElementBlock("div",V_,[V[10]||(V[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",M_,t.toDisplayString(Q.value.toLocaleString())+" "+t.toDisplayString(h.value.currency.symbol),1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),x.value?(t.openBlock(),t.createBlock(t.unref(F.NCheckbox),{key:1,checked:((at=c.value[0])==null?void 0:at.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":V[4]||(V[4]=we=>z(we??!1))},{default:t.withCtx(()=>[...V[11]||(V[11]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createElementVNode("div",I_,[h.value&&!w.value?(t.openBlock(),t.createBlock(t.unref(F.NButton),{key:0,disabled:v.value,type:"default",onClick:P},{default:t.withCtx(()=>[t.createVNode(ce),V[12]||(V[12]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),t.createVNode(t.unref(F.NButton),{loading:n.isSubmitProcessing,disabled:B.value||E.value,type:"primary",class:"ml-auto",onClick:V[5]||(V[5]=we=>o("submit",c.value))},{default:t.withCtx(()=>{var we;return[t.createTextVNode(t.toDisplayString((we=c.value[0])!=null&&we.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[t.unref(oi),()=>o("submit",c.value)]])}}}),O_={class:"flex flex-col gap-2"},z_={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},D_={},ju=t.defineComponent({...D_,__name:"sandwich-m2-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showProductInfoButton:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["click:view-switch","submit"],setup(n,{emit:e}){const i=n,r=e,o=t.useTemplateRef("sandwich-m2-configurator-form"),s=t.ref((i.cartItems??[]).map(k=>new j.OrderItemBase(k))),a=t.ref([]),l=t.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=k=>{c.forEach(x=>{l.value[`items.${k}.${x}`]={}})},u=k=>{c.forEach(x=>{delete l.value[`items.${k}.${x}`]})},f=t.computed(()=>a.value.includes("loading")),h=()=>({width:{},length:{},quantity:{},marker:{}}),p=(k,x)=>{let v=!1;return c.forEach(B=>{var I,R;const w=`items.0.${B}`,T=(I=k[B])==null?void 0:I.feedback,$=((R=k[w])==null?void 0:R.feedback)??T,E=`items.${x}.${B}`;$?(l.value[E]=k[w]??k[B],v=!0):l.value[E]={}}),v},m=(k,x,v)=>new Promise(B=>{const w=h();let T=!1;const C=$=>{if(T)return;T=!0;const E=p(w,x),I=($===void 0?!E:$)&&!E;a.value[x]=I?"success":"error",t.nextTick(()=>{var R,O;(O=(R=o.value)==null?void 0:R.formReference)==null||O.restoreValidation()}),B(I)};a.value[x]="loading",r("submit",[M.cloneDeep(k)],w,C,{isFinalSuccessfulCompletion:v})}),g=async()=>{var v,B;try{await((B=(v=o.value)==null?void 0:v.formReference)==null?void 0:B.validate())}catch{return}const k=s.value.map((w,T)=>T).filter(w=>{const T=a.value[w]??"idle";return T!=="success"&&T!=="loading"});let x=!0;for(let w=0;w<k.length;w+=1){const T=k[w],C=s.value[T];if(!C)break;const E=w===k.length-1&&x;await m(C,T,E)||(x=!1)}},b=k=>{const x=k-1;a.value[x]="idle",d(x)},y=k=>{a.value.splice(k,1),u(k);for(let x=k;x<s.value.length;x+=1)d(x)},_=k=>{const x=a.value[k];(x==="success"||x==="error")&&(a.value[k]="idle")};return t.onMounted(()=>{(i.cartItems??[]).forEach((k,x)=>{a.value[x]="idle",d(x)})}),t.watch(()=>i.cartItems,k=>{const x=(k??[]).map(v=>new j.OrderItemBase(v));s.value=x,a.value=x.map(()=>"idle"),x.forEach((v,B)=>{d(B)})},{deep:!0}),(k,x)=>{var B;const v=F.NButton;return t.openBlock(),t.createElementBlock("div",O_,[n.settings.allowShowTable&&((B=s.value[0])!=null&&B.isNewRec())?(t.openBlock(),t.createBlock(v,{key:0,type:"tertiary",class:"self-center",onClick:x[0]||(x[0]=w=>r("click:view-switch"))},{default:t.withCtx(()=>[...x[2]||(x[2]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",z_,[t.createVNode(Wu,{ref:"sandwich-m2-configurator-form",value:s.value,"onUpdate:value":x[1]||(x[1]=w=>s.value=w),validation:l.value,settings:n.settings,"event-emitter":n.eventEmitter,"is-submit-processing":f.value,"item-states":a.value,onSubmit:g,onAddItem:b,onRemoveItem:y,onItemReset:_},null,8,["value","validation","settings","event-emitter","is-submit-processing","item-states"])])])}}}),L_={key:0,class:"flex justify-center p-4"},H_={key:1,class:"p-4 text-center text-red-500"},W_={key:2,class:"flex justify-center"},j_={class:"!bg-white p-4 m-2 rounded-md w-max"},q_={key:3,class:"p-4 text-center text-gray-500"},X_={},qu=t.defineComponent({...X_,__name:"dynamic-configurator",props:{eventEmitter:{},settings:{},editor:{},cartItem:{},cartItems:{},category:{}},setup(n){const e=n,i=t.ref(!1),r=t.ref(null),o=t.ref(e.cartItem??null),s=t.ref(e.cartItems??null),a=h=>{const p=h.configuratorParams;return[new j.OrderItemBase({...h,quantity:h.quantity??1,marker:h.marker,configuratorParams:{width:(p==null?void 0:p.width)??h.width??0,length:(p==null?void 0:p.length)??h.length??0}})]},l=t.ref(e.editor===j.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var p,m,g;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const h={category:((p=e.cartItem)==null?void 0:p.category)??e.category,configurator:e.editor,quantity:1};switch(e.editor){case"kozyrek":{const b=e.settings;o.value=new j.OrderItemBase({...h,configuratorParams:{length:b.stripMinLength,linesAngles:[],linesWidths:[],startTailType:M.some(b.startTailConfigs,y=>y.isDefault)?(m=b.startTailConfigs)==null?void 0:m.findIndex(y=>y.isDefault):void 0,endTailType:M.some(b.endTailConfigs,y=>y.isDefault)?(g=b.endTailConfigs)==null?void 0:g.findIndex(y=>y.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const b=e.settings;o.value=new j.OrderItemBase({...h,configuratorParams:{width:0,height:0,netType:b.netType[0]||"",color:b.color[0]||"",mountType:b.mountType[0]||""}});break}case"strip":{const b=e.settings;s.value=[new j.OrderItemBase({...h,length:b.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const b=e.settings;o.value=new j.OrderItemBase({...h,configuratorParams:{width:b.minWidth,length:b.minLength}});break}case"sandwich":{o.value=new j.OrderItemBase({...h,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new j.OrderItemBase({...h,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(h,p,m)=>{const g=b=>{m==null||m(),b&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:h,callback:g,validation:p})},u=(h,p,m,g)=>{const b=h[0];if(!b){m==null||m();return}const y=(g==null?void 0:g.isFinalSuccessfulCompletion)===!0,_=k=>{m==null||m(k),y&&k&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:b,callback:_,validation:p,additionalParams:g})},f=()=>{e.category&&e.eventEmitter.emit("configurator:click-view-switch",{category:e.category})};return t.onMounted(()=>{!e.cartItem&&!e.cartItems&&c()}),(h,p)=>{const m=F.NSpin;return t.openBlock(),t.createElementBlock(t.Fragment,null,[i.value?(t.openBlock(),t.createElementBlock("div",L_,[t.createVNode(m,{size:"large"})])):r.value?(t.openBlock(),t.createElementBlock("div",H_,t.toDisplayString(r.value),1)):t.createCommentVNode("",!0),n.settings!==null&&(o.value!==null||s.value!==null||l.value!==null)?(t.openBlock(),t.createElementBlock("div",W_,[t.createElementVNode("div",j_,[n.editor==="kozyrek"?(t.openBlock(),t.createBlock(Eu,{key:0,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="mosquitto"?(t.openBlock(),t.createBlock(Fu,{key:1,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="strip"?(t.openBlock(),t.createBlock(Au,{key:2,"event-emitter":n.eventEmitter,settings:n.settings,"cart-items":s.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-items"])):n.editor==="metal_for_doors"?(t.openBlock(),t.createBlock(zu,{key:3,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="sandwich"?(t.openBlock(),t.createBlock(Hu,{key:4,"event-emitter":n.eventEmitter,settings:n.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):n.editor==="sandwich_m2"?(t.openBlock(),t.createBlock(ju,{key:5,"event-emitter":n.eventEmitter,settings:n.settings,"cart-items":l.value,"onClick:viewSwitch":f,onSubmit:u},null,8,["event-emitter","settings","cart-items"])):t.createCommentVNode("",!0)])])):(t.openBlock(),t.createElementBlock("div",q_,' Конфигуратор "'+t.toDisplayString(n.editor)+'" не поддерживается. ',1))],64)}}});function Xu(n){return Object.values(j.ConfiguratorsEnum).includes(n)}function Yu(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.Sandwich?!0:n.properties.configuratorSettings!==void 0&&M.isArray(n.products)&&n.products.length>0}const Y_={key:0,class:"pt-0.5"},U_={key:0},K_={class:"line-through"},G_={key:0},Z_={key:1},Q_={class:"flex flex-row gap-1"},J_={key:0},ew={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},tw={class:"flex flex-col gap-2.5 sm:flex-row"},nw={key:0,class:"header-extra"},iw={class:"inline-flex"},rw={class:"inline-flex"},ow={class:"inline-flex"},sw={class:"mt-2"},aw={key:1,class:"flex flex-col"},lw={},cw=t.defineComponent({...lw,__name:"category-collapse-item",props:{categoryItem:{},filteredItems:{},isCategoryItemSelected:{type:[Boolean,String,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},showConfigurator:{type:[Boolean,Function],default:!1},canShowConfigurator:{type:[Boolean,Function],default:!1},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},showProductInfoButton:{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(n){const e=n,i=t.inject(Br,"medium"),r=t.computed(()=>{var V;return(V=e==null?void 0:e.filteredItems)==null?void 0:V[e.categoryItem.id]}),o=t.computed(()=>{var V,A;return M.isArray((V=e.categoryItem)==null?void 0:V.categories)&&((A=e.categoryItem.categories)==null?void 0:A.length)>0}),s=t.computed(()=>{var V;return M.isArray((V=e.categoryItem)==null?void 0:V.products)?e.categoryItem.products:[]}),a=t.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([V,A])=>`${A} руб./${O(V)}`).join(", ")),l=t.computed(()=>M.isUndefined(e.filteredItems)||r.value==="*"?s.value:s.value.filter(V=>{var ie;const A=(ie=r.value)==null?void 0:ie.products;return M.isArray(A)&&A.includes(V.id)})),c=t.computed(()=>l.value.length>0),d=t.computed(()=>M.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),u=t.computed(()=>M.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),f=t.computed(()=>M.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),h=t.computed(()=>{var ie,ce;const V=(ie=k.value)==null?void 0:ie.hidingComment,A=(ce=k.value)!=null&&ce.isDisabled?`Скрыто для клиента${V?`. Причина: '${V}'`:""}`:"Видимо клиенту";return d.value==="disabled"?`${A}. ${kr}`:A}),p=t.computed(()=>{var ie;const V=(ie=k.value)==null?void 0:ie.manager,A=V?`Категория закреплена за "${V.name??"-"}"`:"Закрепить";return u.value==="disabled"?`${A}. ${kr}`:A}),m=t.computed(()=>f.value==="disabled"?`${Cs}. ${kr}`:Cs),g=t.computed(()=>M.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),b=t.computed(()=>{var V,A,ie;return((V=e.categoryItem.properties)==null?void 0:V.configurator)!==void 0&&Xu((A=e.categoryItem.properties)==null?void 0:A.configurator)&&Yu(e.categoryItem)&&((ie=e.categoryItem.properties)==null?void 0:ie.configuratorSettings)!==void 0&&(M.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),y=t.computed(()=>b.value&&(M.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),_=t.computed(()=>M.isNil(e.categoryContextButtonsConfig)?[]:M.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),k=t.computed(()=>new j.ClientCategory(e.categoryItem)),x=t.ref(!1),v=t.ref(!1),B=t.computed(()=>!M.isUndefined(e.isCategoryItemSelected)),w=t.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),T=t.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),C=t.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),$=t.computed(()=>K.value&&Xe.getDeviceTypeByResolution()===je.laptop?"auto":"fixed"),E=t.useTemplateRef("collapse-item-reference"),I=t.computed(()=>{var V,A;return(A=(V=e.categoryItem.properties)==null?void 0:V.templateCost)==null?void 0:A.priceCoefficient}),R=t.computed(()=>{var V,A;return(A=(V=e.categoryItem.properties)==null?void 0:V.templateCost)==null?void 0:A.increasePercent}),O=(V,A="ru-RU")=>0 .toLocaleString(A,{style:"currency",currency:V,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),U=V=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:V,target:E.value})},Q=(V,A)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:A,isLoadingState:x,target:E.value})},G=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:E.value})},W=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:E.value})},D=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:E.value})},L=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:E.value})},z=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:E.value})},P=V=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:V,target:E.value})},q=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},K=t.ref(0),J=t.computed(()=>K.value&&s.value.length>0?Qg(s.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductInfoButton:e.showProductInfoButton,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),Y=M.debounce(()=>{K.value=window.innerWidth},20);return t.onUnmounted(()=>{window.removeEventListener("resize",Y),Y.cancel()}),window.addEventListener("resize",Y),Y(),(V,A)=>{const ie=F.NCheckbox,ce=up,pe=F.NTooltip,at=lp,we=F.NTag,ke=op,kt=np,Ne=F.NButton,Jt=Jm,wn=Ql,Pt=Zl,ni=Gl,On=$s,cn=F.NDropdown,pt=F.NDataTable,se=F.NAlert,de=F.NSpin;return t.openBlock(),t.createBlock(Jl,{ref:"collapse-item-reference",name:n.categoryItem.id,"data-id":n.categoryItem.id,"onHeader:click":Q},{"pre-arrow":t.withCtx(()=>{var Re,qe;return[B.value?(t.openBlock(),t.createElementBlock("div",Y_,[t.createVNode(ie,{checked:w.value,indeterminate:C.value,disabled:T.value,"onUpdate:checked":U},null,8,["checked","indeterminate","disabled"])])):t.createCommentVNode("",!0),!d.value&&((Re=k.value)!=null&&Re.isDisabled)?(t.openBlock(),t.createBlock(pe,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(ce,{class:"pt-1.5"})]),default:t.withCtx(()=>[A[1]||(A[1]=t.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):t.createCommentVNode("",!0),((qe=k.value)==null?void 0:qe.isFavorite)??!1?(t.openBlock(),t.createBlock(pe,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(at,{class:"pt-1.5"})]),default:t.withCtx(()=>[A[2]||(A[2]=t.createTextVNode(" Избранная категория ",-1))]),_:1})):t.createCommentVNode("",!0)]}),header:t.withCtx(()=>{var Re,qe,dn,Kt,ii;return[t.createElementVNode("div",{class:t.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":n.categoryItem.isHidden,"text-gray-400":(Re=k.value)==null?void 0:Re.isDisabled})},[t.createVNode(pe,{disabled:!n.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",null,t.toDisplayString(n.categoryItem.name),1)]),default:t.withCtx(()=>[A[3]||(A[3]=t.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),t.createElementVNode("div",{class:"w-fit",onClick:A[0]||(A[0]=t.withModifiers((...it)=>t.unref(M.noop)&&t.unref(M.noop)(...it),["prevent","stop"]))},[(qe=n.categoryItem.properties)!=null&&qe.m2Price?(t.openBlock(),t.createBlock(we,{key:0,size:t.unref(i),class:t.normalizeClass({"!pr-0":((dn=n.categoryItem.properties)==null?void 0:dn.templateCost)&&n.categoryItem.properties.m2PriceRetail&&R.value}),round:""},{default:t.withCtx(()=>{var it;return[t.createTextVNode(" Установленная стоимость: "+t.toDisplayString(n.categoryItem.properties.m2Price)+" руб./м2 ",1),(it=n.categoryItem.properties)!=null&&it.templateCost&&n.categoryItem.properties.m2PriceRetail&&R.value?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[R.value?(t.openBlock(),t.createBlock(we,{key:0,type:"success",bordered:!1,size:t.unref(i),class:"ml-2 !pr-0",round:""},{default:t.withCtx(()=>[R.value?(t.openBlock(),t.createElementBlock("span",U_,t.toDisplayString(R.value.toFixed(2))+"%",1)):t.createCommentVNode("",!0),t.createVNode(we,{size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createElementVNode("span",K_,t.toDisplayString(n.categoryItem.properties.m2PriceRetail)+" руб./м2",1)]),_:1},8,["size"])]),_:1},8,["size"])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0)]}),_:1},8,["size","class"])):(Kt=n.categoryItem.properties)!=null&&Kt.templateCost?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[I.value||R.value?(t.openBlock(),t.createBlock(we,{key:0,size:t.unref(i),round:""},{default:t.withCtx(()=>{var it;return[I.value?(t.openBlock(),t.createElementBlock("span",G_,t.toDisplayString((it=I.value)==null?void 0:it.name),1)):t.createCommentVNode("",!0),R.value?(t.openBlock(),t.createElementBlock("span",Z_,t.toDisplayString(R.value>0?"+":"")+t.toDisplayString(R.value.toFixed(2))+"%",1)):t.createCommentVNode("",!0)]}),_:1},8,["size"])):t.createCommentVNode("",!0)],64)):t.createCommentVNode("",!0),a.value?(t.openBlock(),t.createBlock(we,{key:2,size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createTextVNode(" Фиксированный курс: "+t.toDisplayString(a.value),1)]),_:1},8,["size"])):t.createCommentVNode("",!0),u.value&&((ii=k.value)!=null&&ii.manager)?(t.openBlock(),t.createBlock(we,{key:3,size:t.unref(i),closable:u.value!=="disabled",round:"",class:"align-bottom",onClose:L},{default:t.withCtx(()=>[t.createVNode(pe,{placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>{var it,en;return[t.createElementVNode("span",Q_,[t.createVNode(ke),t.createTextVNode(" "+t.toDisplayString((en=(it=k.value)==null?void 0:it.manager)==null?void 0:en.name),1)])]}),default:t.withCtx(()=>{var it,en;return[t.createTextVNode(' Категория закреплена за "'+t.toDisplayString((en=(it=k.value)==null?void 0:it.manager)==null?void 0:en.name)+'" ',1)]}),_:1})]),_:1},8,["size","closable"])):t.createCommentVNode("",!0)])]}),"sub-header":t.withCtx(()=>[n.showSlugs||n.showProperties?(t.openBlock(),t.createElementBlock("div",J_,[t.createElementVNode("ul",ew,[n.showSlugs?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList({id:n.categoryItem.id,slug:n.categoryItem.slug},(Re,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(Re),1))),128)):t.createCommentVNode("",!0),n.showProperties?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.categoryItem.properties,(Re,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(Re),1))),128)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)]),"header-extra":t.withCtx(()=>{var Re;return[t.createElementVNode("div",tw,[V.$slots["header-extra"]?(t.openBlock(),t.createElementBlock("div",nw,[t.renderSlot(V.$slots,"header-extra",{categoryItem:n.categoryItem},void 0,!0)])):t.createCommentVNode("",!0),d.value?(t.openBlock(),t.createBlock(pe,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",iw,[t.createVNode(Ne,{ghost:!0,disabled:d.value==="disabled",size:t.unref(i),onClick:G},{default:t.withCtx(()=>{var qe;return[(qe=k.value)!=null&&qe.isDisabled?(t.openBlock(),t.createBlock(ce,{key:1})):(t.openBlock(),t.createBlock(kt,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(h.value),1)]),_:1})):t.createCommentVNode("",!0),u.value&&!((Re=k.value)!=null&&Re.manager)?(t.openBlock(),t.createBlock(pe,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",rw,[t.createVNode(Ne,{ghost:!0,disabled:u.value==="disabled",size:t.unref(i),onClick:D},{default:t.withCtx(()=>[t.createVNode(Jt)]),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(p.value),1)]),_:1})):t.createCommentVNode("",!0),f.value?(t.openBlock(),t.createBlock(pe,{key:3,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",ow,[t.createVNode(Ne,{ghost:!0,disabled:f.value==="disabled",size:t.unref(i),onClick:W},{default:t.withCtx(()=>{var qe;return[(qe=k.value)!=null&&qe.isRequired?(t.openBlock(),t.createBlock(Pt,{key:1})):(t.openBlock(),t.createBlock(wn,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(m.value),1)]),_:1})):t.createCommentVNode("",!0),g.value?(t.openBlock(),t.createBlock(pe,{key:4,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(Ne,{ghost:!0,size:t.unref(i),type:"primary",onClick:z},{default:t.withCtx(()=>[t.createVNode(ni)]),_:1},8,["size"])]),default:t.withCtx(()=>[A[4]||(A[4]=t.createTextVNode(" Редактировать ",-1))]),_:1})):t.createCommentVNode("",!0),_.value.length>0?(t.openBlock(),t.createBlock(cn,{key:5,options:_.value,size:t.unref(i),trigger:"click",onSelect:P},{default:t.withCtx(()=>[t.createVNode(Ne,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(On)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)])]}),default:t.withCtx(()=>[t.renderSlot(V.$slots,"default",{},()=>{var Re,qe,dn;return[t.createElementVNode("div",sw,[o.value?(t.openBlock(),t.createBlock(Ku,{key:0,"categories-items":n.categoryItem.categories??[],"has-products":c.value||x.value,"event-emitter":n.eventEmitter,"filtered-items":r.value?((Re=r.value)==null?void 0:Re.categories)??{}:void 0,"is-category-item-selected":n.isCategoryItemSelected,"show-slugs":n.showSlugs,"show-properties":n.showProperties,"allow-name-click":n.allowNameClick,"allow-price-click":n.allowPriceClick,"show-price-history":n.showPriceHistory,"show-cost-date":n.showCostDate,"show-product-info-button":n.showProductInfoButton,"show-category-required-button":n.showCategoryRequiredButton,"show-category-hide-for-client-button":n.showCategoryHideForClientButton,"show-category-pin-button":n.showCategoryPinButton,"show-category-edit-button":n.showCategoryEditButton,"category-context-buttons-config":n.categoryContextButtonsConfig,"is-product-item-selected":n.isProductItemSelected,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-costs":n.showProductCosts,"show-product-required-button":n.showProductRequiredButton,"show-product-edit-button":n.showProductEditButton,"product-context-buttons-config":n.productContextButtonsConfig,"show-configurator":n.showConfigurator,"can-show-configurator":n.canShowConfigurator},t.createSlots({_:2},[V.$slots["header-extra"]?{name:"header-extra",fn:t.withCtx(({categoryItem:Kt})=>[t.renderSlot(V.$slots,"header-extra",{categoryItem:Kt},void 0,!0)]),key:"0"}:void 0]),1032,["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-product-info-button","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","show-configurator","can-show-configurator"])):t.createCommentVNode("",!0)]),b.value&&y.value?(t.openBlock(),t.createBlock(qu,{key:0,"event-emitter":n.eventEmitter,settings:(qe=n.categoryItem.properties)==null?void 0:qe.configuratorSettings,editor:(dn=n.categoryItem.properties)==null?void 0:dn.configurator,category:n.categoryItem},null,8,["event-emitter","settings","editor","category"])):c.value?(t.openBlock(),t.createElementBlock("div",aw,[b.value?(t.openBlock(),t.createBlock(Ne,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:q},{default:t.withCtx(()=>[...A[5]||(A[5]=[t.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createVNode(pt,{columns:J.value,data:l.value,bordered:!0,loading:x.value,remote:!0,"row-key":Kt=>Kt.id,"table-layout":$.value,class:"mt-2"},null,8,["columns","data","loading","row-key","table-layout"])])):t.createCommentVNode("",!0),!x.value&&!v.value&&!o.value&&!c.value?(t.openBlock(),t.createBlock(se,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):t.createCommentVNode("",!0),v.value?(t.openBlock(),t.createBlock(se,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):t.createCommentVNode("",!0),x.value?(t.openBlock(),t.createBlock(de,{key:4,size:t.unref(i),class:"w-full"},{description:t.withCtx(()=>[...A[6]||(A[6]=[t.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):t.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),dw=fn(cw,[["__scopeId","data-v-a02c9f27"]]),uw={class:"sc-collapse flex w-full flex-col"},fw={},Uu=t.defineComponent({...fw,__name:"collapse",props:{defaultExpandedNames:{default:()=>[]},expandedNames:{default:()=>[]}},emits:["on-item-header-click"],setup(n,{emit:e}){const i=n,r=e,o=(s,a)=>{r("on-item-header-click",s,a)};return t.provide("itemHeaderClickHandler",o),t.provide("defaultExpandedNames",i.defaultExpandedNames),t.provide("expandedNames",i.expandedNames),(s,a)=>(t.openBlock(),t.createElementBlock("div",uw,[t.renderSlot(s.$slots,"default")]))}}),hw={},Ku=t.defineComponent({...hw,__name:"category-collapse",props:{categoriesItems:{},hasProducts:{type:Boolean},loading:{type:Boolean,default:!1},client:{default:void 0},filteredItems:{default:void 0},isCategoryItemSelected:{type:[Boolean,String,Function],default:void 0},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},showConfigurator:{type:[Boolean,Function]},canShowConfigurator:{type:[Boolean,Function]},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},showProductInfoButton:{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(n){const e=n,i=t.inject(Br,"medium"),r=t.computed(()=>M.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(M.isUndefined(a))return;const l=a[s.id];if(l==="*")return;const c={};return c[s.id]=structuredClone(t.toRaw(l)),c};return(s,a)=>{const l=F.NSpin,c=F.NAlert;return t.openBlock(),t.createElementBlock(t.Fragment,null,[r.value.length>0?(t.openBlock(),t.createBlock(Uu,{key:0},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,d=>(t.openBlock(),t.createBlock(dw,{key:d.id,"category-item":d,"event-emitter":n.eventEmitter,"filtered-items":o(d,n.filteredItems),"is-category-item-selected":n.isCategoryItemSelected,"show-slugs":n.showSlugs,"show-properties":n.showProperties,"allow-name-click":n.allowNameClick,"allow-price-click":n.allowPriceClick,"show-price-history":n.showPriceHistory,"show-cost-date":n.showCostDate,"show-product-info-button":n.showProductInfoButton,"show-category-required-button":n.showCategoryRequiredButton,"show-category-hide-for-client-button":n.showCategoryHideForClientButton,"show-category-pin-button":n.showCategoryPinButton,"show-category-edit-button":n.showCategoryEditButton,"category-context-buttons-config":n.categoryContextButtonsConfig,"is-product-item-selected":n.isProductItemSelected,"show-product-add-to-cart-button":n.showProductAddToCartButton,"show-product-costs":n.showProductCosts,"show-product-required-button":n.showProductRequiredButton,"show-product-edit-button":n.showProductEditButton,"product-context-buttons-config":n.productContextButtonsConfig,"show-configurator":n.showConfigurator,"can-show-configurator":n.canShowConfigurator},t.createSlots({_:2},[s.$slots["header-extra"]?{name:"header-extra",fn:t.withCtx(({categoryItem:u})=>[t.renderSlot(s.$slots,"header-extra",{categoryItem:u})]),key:"0"}:void 0]),1032,["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-product-info-button","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","show-configurator","can-show-configurator"]))),128))]),_:3})):n.loading?(t.openBlock(),t.createBlock(l,{key:1,size:t.unref(i),class:"w-full"},{description:t.withCtx(()=>[...a[0]||(a[0]=[t.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):t.createCommentVNode("",!0),!n.hasProducts&&!n.loading&&n.categoriesItems.length>0&&r.value.length===0?(t.openBlock(),t.createBlock(c,{key:2,"show-icon":!0,type:"warning",title:"Товары не найдены",class:"mx-10"})):t.createCommentVNode("",!0)],64)}}}),mw={},Gu=t.defineComponent({...mw,__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,default:!1},referenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1},sortOptionsByLabel:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},maxTagCount:{default:void 0},disabledItem:{type:Function,default:void 0}},emits:["update:value"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.computed(()=>M.isArray(r.value)),a=new j.Reference,l=t.computed(()=>M.isNil(r.value)?s.value?[]:null:M.isArray(r.value)?r.value.filter(m=>!M.isNil(m)).map(m=>m.id):r.value.id),c=t.computed(()=>gt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue,void 0,r.disabledItem)),d=t.computed(()=>c.value.map(m=>({...m,class:r.wrapContent?`${m.class} consistent-menu-width`:m.class}))),u=m=>{var g;if(M.isArray(m)){const b=m.length>0?m.map(y=>{var _;return(_=c.value.find(k=>k.value===y))==null?void 0:_.item}).filter(y=>!M.isNil(y)):[];o("update:value",b)}else{const b=m===a.id||M.isNil(m)||(g=c.value.find(y=>y.value===m))==null?void 0:g.item;o("update:value",b)}},f=t.useTemplateRef("select-component");return e({focus:()=>{var m;return(m=f.value)==null?void 0:m.focus()},blur:()=>{var m;return(m=f.value)==null?void 0:m.blur()}}),(m,g)=>(t.openBlock(),t.createBlock(t.unref(F.NSelect),{ref:"select-component",value:l.value,clearable:r.clearable,"consistent-menu-width":n.consistentMenuWidth,disabled:n.disabled||c.value.length===0,filterable:n.filterable,"max-tag-count":n.maxTagCount,multiple:s.value,options:d.value,placeholder:"",class:"w-full","onUpdate:value":u},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),pw={},gw=t.defineComponent({...pw,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{},disabledCoefficient:{type:Function},visibleCoefficient:{type:Function}},emits:["update:value"],setup(n,{emit:e}){var x,v;const i=n,r=e,o=()=>{const B=j.PriceCoefficient.getRetailPriceCoefficient();return M.unset(B,"isNewRec"),B},s=B=>!B||B.id===o().id,a=t.computed(()=>{var B;return((B=i.catalogItem)==null?void 0:B.type)==="product"}),l=t.computed(()=>a.value?i.catalogItem:void 0),c=B=>{var w,T,C,$;return B.id===o().id?(w=l.value)==null?void 0:w.getRetailCost():($=(C=(T=l.value)==null?void 0:T.priceCoefficients)==null?void 0:C.find(E=>E.coefficient.id===B.id))==null?void 0:$.cost},d=t.computed(()=>{var T;const w=[...((T=j.useReferencesStore().priceCoefficientsReference)==null?void 0:T.map(C=>structuredClone(t.toRaw(C))))??[],o()].filter(C=>{var $;return(($=i.visibleCoefficient)==null?void 0:$.call(i,C))??!0});return a.value&&w.forEach(C=>{var E;const $=c(C);$?C.name+=` (${$} ${(E=l.value)==null?void 0:E.currency.symbol})`:C.name=""}),w.filter(C=>C.name!=="")}),u=t.ref(i.value.coefficient),f=t.ref(((v=(x=i.value)==null?void 0:x.value)==null?void 0:v.toString())??null),h=t.ref(null),p=t.computed(()=>{var B,w;return(w=(B=l.value)==null?void 0:B.priceCoefficients)==null?void 0:w.find(T=>T.coefficient.slug===j.PriceCoefficientEnum.K0)}),m=t.ref(void 0),g=B=>Number.parseFloat((B??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),b=()=>{var w,T;m.value=void 0;let B=g(f.value);if(B=Number.isNaN(B)?void 0:B,a.value)if(u.value||f.value){const C=o(),$=c(u.value??C)??0,E=$+$*((B??0)/100);h.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(E),E>(((w=l.value)==null?void 0:w.getRetailCost())??E)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),p.value&&E<(((T=p.value)==null?void 0:T.cost)??0)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else h.value=null;r("update:value",{value:Number.isNaN(B)?void 0:B,coefficient:s(u.value)?void 0:structuredClone(t.toRaw(u.value))})},y=B=>{M.isArray(B)||M.isNull(B)||(u.value=B,f.value=null,!u.value&&f.value&&(u.value=o()),b())},_=()=>{u.value||(u.value=o()),b()},k=B=>{var T,C,$,E,I;const w=g(B);if(a.value){if(Number.isNaN(w)){u.value=void 0,f.value=null,r("update:value",{value:void 0,coefficient:void 0});return}let R=0;if(w<=0)u.value=void 0,f.value=null;else if(p.value&&w<(((T=p.value)==null?void 0:T.cost)??0))u.value=(C=p.value)==null?void 0:C.coefficient,R=(w-p.value.cost)*100/p.value.cost,m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(w>((($=l.value)==null?void 0:$.getRetailCost())??w)){u.value=o();const O=((E=l.value)==null?void 0:E.getRetailCost())??0;R=(w-O)*100/O,m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const O=((I=l.value)==null?void 0:I.priceCoefficients)??[],U=M.sortBy(O,[W=>W.cost]),G=U.filter(W=>W.cost<=w).at(-1)??U.at(0);G&&(u.value=G.coefficient,R=(w-G.cost)*100/G.cost),m.value={validationStatus:void 0,feedback:void 0}}f.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:5}).format(R),r("update:value",{value:Number.isNaN(R)?void 0:R,coefficient:s(u.value)?void 0:structuredClone(t.toRaw(u.value))})}else r("update:value",{value:Number.isNaN(w)?void 0:w,coefficient:void 0})};return t.onMounted(()=>{var B,w,T,C;i.calculationType===j.CalculationTypeEnum.m2Cost?h.value=((w=(B=i.value)==null?void 0:B.value)==null?void 0:w.toString())??null:!((T=i.value)!=null&&T.coefficient)&&((C=i.value)!=null&&C.value)&&(u.value=o()),b()}),(B,w)=>{var $,E,I;const T=F.NInput,C=F.NInputGroup;return t.openBlock(),t.createBlock(t.unref(F.NFormItem),{"show-label":!t.unref(M.isNil)(n.label),label:n.label,"show-feedback":!t.unref(M.isNil)((($=m.value)==null?void 0:$.feedback)??n.feedback),feedback:((E=m.value)==null?void 0:E.feedback)??n.feedback,"validation-status":((I=m.value)==null?void 0:I.validationStatus)??n.validationStatus},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass([{"sm:grid-cols-3":a.value&&n.calculationType!==t.unref(j.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[n.calculationType!==t.unref(j.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(C,{key:0,class:t.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:t.withCtx(()=>[t.createVNode(Gu,{class:"w-full min-w-0 flex-1",value:u.value,"reference-list":d.value,clearable:n.clearable,disabled:n.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"disabled-item":n.disabledCoefficient,"onUpdate:value":y},null,8,["value","reference-list","clearable","disabled","disabled-item"]),t.createVNode(T,{value:f.value,"onUpdate:value":[w[0]||(w[0]=R=>f.value=R),_],clearable:n.clearable,disabled:n.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},t.createSlots({suffix:t.withCtx(()=>[w[3]||(w[3]=t.createTextVNode("%",-1))]),_:2},[f.value&&!f.value.startsWith("-")?{name:"prefix",fn:t.withCtx(()=>[w[2]||(w[2]=t.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):t.createCommentVNode("",!0),a.value||n.calculationType===t.unref(j.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(T,{key:1,value:h.value,"onUpdate:value":[w[1]||(w[1]=R=>h.value=R),k],clearable:n.clearable,disabled:n.disabled,placeholder:"Стоимость",class:"w-full"},t.createSlots({_:2},[a.value?{name:"suffix",fn:t.withCtx(()=>{var R;return[t.createTextVNode(t.toDisplayString((R=l.value)==null?void 0:R.currency.symbol),1)]}),key:"0"}:void 0]),1032,["value","clearable","disabled"])):t.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),yw={class:"text-sm"},bw={class:"text-sm"},_w={},ww=t.defineComponent({..._w,__name:"add-product-to-cart-dialog",emits:["submit"],setup(n,{expose:e,emit:i}){const r=t.useTemplateRef("form-reference"),o=t.useTemplateRef("base-dialog-reference"),s=t.ref(!1),a=t.ref(null),l=t.computed(()=>{var R,O,U;return((R=a.value)==null?void 0:R.unit.isLinear)&&((U=(O=a.value)==null?void 0:O.properties)==null?void 0:U.isLengthConfigurator)}),c=t.computed(()=>a.value?j.UnitsHelper.productIsMeasurable(a.value)||l.value?"шт.":a.value.unit.name:"шт."),d=t.ref(void 0),u=t.ref(void 0),f=t.ref(!0),h=t.ref(null),p=t.computed({get:()=>{var R;return((R=h.value)==null?void 0:R.quantity)??null},set:R=>{h.value&&(h.value.quantity=R??0)}}),m=t.computed({get:()=>{var R;return((R=h.value)==null?void 0:R.length)??null},set:R=>{h.value&&(h.value.length=R??void 0)}}),g=R=>{h.value&&(h.value.marker=R??void 0)},b=i,y=()=>({length:{},quantity:{},marker:{}}),_=t.ref(y()),k=t.ref(!1),x=t.computed(()=>{var G,W,D,L;if(!a.value)return{};const R=j.UnitsHelper.getProductLengthMultiplicity(a.value),O=j.UnitsHelper.getProductMultiplicity(a.value),U=((W=(G=a.value)==null?void 0:G.properties)==null?void 0:W.minLength)||R,Q=(L=(D=a.value)==null?void 0:D.properties)==null?void 0:L.maxLength;return{length:[le.required,le.min(U??.1),le.max(Q),le.step(R),He.serverValidation(_.value.length.feedback)],quantity:[le.required,le.min(O),le.step(O),He.serverValidation(_.value.quantity.feedback)],marker:[He.serverValidation(_.value.marker.feedback)]}}),v=t.computed(()=>{var R,O,U;return a.value?((R=a.value.properties)==null?void 0:R.lengthStep)??((O=a.value.properties)!=null&&O.ignoreMinCountCheck?0:((U=a.value.properties)==null?void 0:U.minCount)??0):0}),B=t.computed(()=>{var U,Q,G,W,D,L,z,P,q;if(!a.value)return"";const R=((Q=(U=a.value)==null?void 0:U.properties)==null?void 0:Q.minLength)??((W=(G=a.value)==null?void 0:G.properties)!=null&&W.ignoreMinCountCheck?0:(L=(D=a.value)==null?void 0:D.properties)==null?void 0:L.minCount),O=(P=(z=a.value)==null?void 0:z.properties)==null?void 0:P.maxLength;return R||O?`(${R?`от ${R}`:""}${R&&O?" ":""}${O?`до ${O}`:""} ${(q=a.value)==null?void 0:q.unit.name})`:""}),w=R=>{var W,D;if(!((D=(W=a.value)==null?void 0:W.properties)!=null&&D.isLengthConfigurator)||!h.value||M.isNil(R)||v.value===0)return;const O=R/v.value,U=Math.round(O),Q=j.UnitsHelper.getProductMultiplicity(a.value),G=Math.max(U,Q);h.value.quantity=G},T=R=>{var G,W,D,L;if(!((W=(G=a.value)==null?void 0:G.properties)!=null&&W.isLengthConfigurator)||!h.value||M.isNil(R)||v.value===0)return;const O=R*v.value,U=((D=a.value.properties)==null?void 0:D.minLength)||j.UnitsHelper.getProductLengthMultiplicity(a.value),Q=(L=a.value.properties)==null?void 0:L.maxLength;U!==void 0&&O<U?h.value.length=U:Q!==void 0&&O>Q?h.value.length=Q:h.value.length=O},C=async R=>{var U;const O=M.cloneDeep(h.value);try{await((U=r.value)==null?void 0:U.validate(Q=>{if(!Q){if(!a.value||!O)return;j.UnitsHelper.productIsMeasurable(a.value)||delete O.length,l.value&&v.value&&(O.length=v.value),k.value=!0,b("submit",O,_.value,()=>{k.value=!1,R(!1),t.nextTick(()=>{var G;(G=r.value)==null||G.validate(M.noop).catch(M.noop)})})}}))}catch{}},$=()=>{a.value=null,d.value=void 0,h.value=null,_.value=y()},E=()=>{s.value=!1};return e({show:(R,O)=>{var U,Q,G,W,D;if($(),s.value=!0,a.value=R,d.value=O==null?void 0:O.cartItemData,u.value=O==null?void 0:O.orderId,f.value=(O==null?void 0:O.canSetDopProdaga)??!1,h.value=new j.OrderItemBase((O==null?void 0:O.cartItemData)??new j.OrderItemBase({product:R,quantity:j.UnitsHelper.productIsMeasurable(a.value)?1:((U=R==null?void 0:R.properties)==null?void 0:U.minCount)??1,length:((Q=R==null?void 0:R.properties)==null?void 0:Q.minLength)||((G=R==null?void 0:R.properties)!=null&&G.ignoreMinCountCheck?0:(W=R==null?void 0:R.properties)==null?void 0:W.minCount)||0})),(D=R==null?void 0:R.properties)!=null&&D.isLengthConfigurator&&h.value&&v.value>0){const L=v.value,z=h.value.quantity||1;h.value.length=z*L}},closeDialog:E}),(R,O)=>{var D;const U=F.NFormItem,Q=F.NInputGroupLabel,G=F.NInputGroup,W=F.NCheckbox;return t.openBlock(),t.createBlock(Ps,{ref:"base-dialog-reference",show:s.value,title:`${d.value?"Изменение":"Добавление"} товара ${(D=a.value)==null?void 0:D.name} в ${u.value?` заказ №${u.value}`:"корзину"}`,"accept-button":{show:!0,text:d.value?"Изменить":"Добавить"},processing:k.value,"modal-width":500,onAccept:C,onClosing:E},{default:t.withCtx(()=>[a.value&&h.value?t.withDirectives((t.openBlock(),t.createBlock(t.unref(F.NForm),{key:0,ref:"form-reference",model:h.value,rules:x.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.unref(j.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(U,{key:0,path:"length",label:`Метраж, ${B.value+a.value.unit.name}`},t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:m.value,"onUpdate:value":[O[0]||(O[0]=L=>m.value=L),w],parse:t.unref(ct),step:t.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:O[1]||(O[1]=L=>t.unref(ao)(L,".",!1)),onInput:O[2]||(O[2]=L=>t.unref(ot)(_.value,"length")),onFocus:t.unref(Le)},null,8,["value","parse","step","onFocus"])]),_:2},[!_.value.length.feedback&&t.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",yw,"Метраж должно быть кратно "+t.toDisplayString(t.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)),1)]),key:"0"}:void 0]),1032,["label"])):t.createCommentVNode("",!0),t.createVNode(U,{path:"quantity",label:`Количество, ${c.value}`},{default:t.withCtx(()=>[t.createVNode(G,null,t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(F.NInputNumber),{value:p.value,"onUpdate:value":[O[3]||(O[3]=L=>p.value=L),T],parse:t.unref(ct),step:t.unref(j.UnitsHelper).getProductMultiplicity(a.value),"show-button":t.unref(j.UnitsHelper).getProductMultiplicity(a.value)>1,"button-placement":"both",placeholder:"Введите количество",class:"w-full",onKeydown:O[4]||(O[4]=L=>t.unref(ao)(L,".",!1)),onInput:O[5]||(O[5]=L=>t.unref(ot)(_.value,"quantity")),onFocus:t.unref(Le)},null,8,["value","parse","step","show-button","onFocus"]),l.value?(t.openBlock(),t.createBlock(Q,{key:0,class:"bg-orange-100 font-bold"},{default:t.withCtx(()=>[t.createTextVNode(" x "+t.toDisplayString(v.value)+" "+t.toDisplayString(a.value.unit.name),1)]),_:1})):t.createCommentVNode("",!0)]),_:2},[!_.value.quantity.feedback&&t.unref(j.UnitsHelper).getProductMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",bw,"Количество должно быть кратно "+t.toDisplayString(t.unref(j.UnitsHelper).getProductMultiplicity(a.value)),1)]),key:"0"}:void 0]),1024)]),_:1},8,["label"]),t.unref(j.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(U,{key:1,path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NInput),{value:h.value.marker??null,placeholder:"Введите маркировку",onInput:O[6]||(O[6]=L=>t.unref(ot)(_.value,"marker")),"onUpdate:value":O[7]||(O[7]=L=>g(L)),onFocus:t.unref(Le)},null,8,["value","onFocus"])]),_:1})):t.createCommentVNode("",!0),f.value?(t.openBlock(),t.createBlock(W,{key:2,checked:h.value.isAdditionalSale,"onUpdate:checked":O[8]||(O[8]=L=>h.value.isAdditionalSale=L),"true-value":!0,"false-value":!1},{default:t.withCtx(()=>[...O[9]||(O[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0)]),_:1},8,["model","rules"])),[[t.unref(oi),()=>{var L,z;return(z=(L=o.value)==null?void 0:L.acceptHandler)==null?void 0:z.call(L)}]]):t.createCommentVNode("",!0)]),_:1},8,["show","title","accept-button","processing"])}}}),xw={class:"flex flex-row gap-1"},kw={class:"sc-client-name flex flex-col gap-1 text-base"},Cw=["href"],vw={key:1,class:"text-sc-grey"},Sw={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Bw={key:0},Nw={key:1,class:"text-sm"},Tw={},Ir=t.defineComponent({...Tw,__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(n,{emit:e}){const i=n,r=e,o=t.computed(()=>i.client.lastLoginAt?xe.format(i.client.lastLoginAt,j.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{M.isNil(i.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",i.client,a)};return(a,l)=>{const c=lo,d=F.NButton,u=F.NPopover;return t.openBlock(),t.createElementBlock("div",xw,[n.showClientInfoIcon?(t.openBlock(),t.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=f=>a.$emit("click:client-info",n.client))},{default:t.withCtx(()=>[t.createVNode(c)]),_:1})):t.createCommentVNode("",!0),t.createVNode(u,{disabled:t.unref(M.isNil)(n.popoverPosition),placement:n.popoverPosition},{trigger:t.withCtx(()=>[t.createElementVNode("div",kw,[t.createElementVNode("a",{href:n.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=f=>s(f))},[t.createElementVNode("span",{class:t.normalizeClass({"line-through":!n.client.isActive})},t.toDisplayString(n.client.name),3),n.showSalesDirection&&n.client.salesDirection?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass({"line-through":!n.client.isActive})}," ("+t.toDisplayString(n.client.salesDirection.name)+") ",3)):t.createCommentVNode("",!0),n.client.isActive?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",vw," [ Деактивирован ] "))],8,Cw),n.showCityAndRegion&&n.client.city?(t.openBlock(),t.createElementBlock("span",Sw," г. "+t.toDisplayString(n.client.city.name)+", "+t.toDisplayString(n.client.city.region.name),1)):t.createCommentVNode("",!0)])]),default:t.withCtx(()=>[n.client.alternativeName?(t.openBlock(),t.createElementBlock("div",Bw,t.toDisplayString(n.client.alternativeName),1)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("span",Nw," Последний вход: "+t.toDisplayString(o.value),1)):t.createCommentVNode("",!0),t.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),$w={class:"text-base"},Ew={},Zu=t.defineComponent({...Ew,__name:"contragent-with-short-info",props:{contragent:{}},setup(n){const e=n,i=t.computed(()=>si.getFormatEntityName(e.contragent));return(r,o)=>(t.openBlock(),t.createElementBlock("span",$w,t.toDisplayString(i.value),1))}}),Rw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Pw(n,e){return t.openBlock(),t.createElementBlock("svg",Rw,[...e[0]||(e[0]=[t.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t.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"}),t.createElementVNode("path",{d:"m3 7l9 6l9-6"})],-1)])])}const Fw=t.markRaw({name:"tabler-mail",render:Pw}),Vw=["href"],Mw={},Iw=t.defineComponent({...Mw,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(n){return(e,i)=>{const r=Fw;return t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass({"flex flex-row items-center gap-1":n.showEmailIcon})},[n.showEmailIcon?(t.openBlock(),t.createBlock(r,{key:0})):t.createCommentVNode("",!0),t.createElementVNode("a",{href:`mailto:${n.email}`,class:"no-underline"},t.toDisplayString(n.email),9,Vw)],2)}}}),Aw={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Ow(n,e){return t.openBlock(),t.createElementBlock("svg",Aw,[...e[0]||(e[0]=[t.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 Qu=t.markRaw({name:"fa6-brands-viber",render:Ow}),zw={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},Dw=["id"],Lw=["id"],Hw=["fill"],Ww=["fill"];function jw(n,e){return t.openBlock(),t.createElementBlock("svg",zw,[t.createElementVNode("defs",null,[t.createElementVNode("linearGradient",{id:n.idMap.SVGBRLHCcSy,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[0]||(e[0]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#1FAF38"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#60D669"},null,-1)])],8,Dw),t.createElementVNode("linearGradient",{id:n.idMap.SVGHW6lecxh,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[1]||(e[1]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#F9F9F9"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#FFF"},null,-1)])],8,Lw)]),t.createElementVNode("path",{fill:"url(#"+n.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,Hw),t.createElementVNode("path",{fill:"url(#"+n.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,Ww),e[2]||(e[2]=t.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 Ju=t.markRaw({name:"logos-whatsapp-icon",render:jw,setup(){const n=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+n(),SVGHW6lecxh:"uicons-"+n()}}}}),qw={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},Xw=["id"],Yw=["fill"];function Uw(n,e){return t.openBlock(),t.createElementBlock("svg",qw,[t.createElementVNode("defs",null,[t.createElementVNode("linearGradient",{id:n.idMap.SVGuySfwdaH,x1:"50%",x2:"50%",y1:"0%",y2:"100%"},[...e[0]||(e[0]=[t.createElementVNode("stop",{offset:"0%","stop-color":"#2AABEE"},null,-1),t.createElementVNode("stop",{offset:"100%","stop-color":"#229ED9"},null,-1)])],8,Xw)]),t.createElementVNode("path",{fill:"url(#"+n.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,Yw),e[1]||(e[1]=t.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 ef=t.markRaw({name:"logos-telegram",render:Uw,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),Kw={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Gw(n,e){return t.openBlock(),t.createElementBlock("svg",Kw,[...e[0]||(e[0]=[t.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 tf=t.markRaw({name:"ion-call",render:Gw}),Zw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Qw(n,e){return t.openBlock(),t.createElementBlock("svg",Zw,[...e[0]||(e[0]=[t.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 Jw=t.markRaw({name:"tabler-phone-call",render:Qw}),ex={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},tx=["href"],nx=["href"],ix=["href"],rx=["href"],ox={},sx=t.defineComponent({...ox,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>{try{return e.phone?xr.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=t.computed(()=>{var l;return M.isString(i.value)?!1:((l=i.value)==null?void 0:l.isValid())??!1}),o=t.computed(()=>{var l;return M.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=t.computed(()=>{var l;return M.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("E.164"))??""}),a=t.ref(!1);return(l,c)=>{const d=Jw,u=tf,f=ef,h=Ju,p=Qu;return t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",{class:t.normalizeClass({"border-xl relative inline-flex items-center rounded px-2":r.value&&a.value,"min-w-10":!0}),onClick:c[0]||(c[0]=m=>a.value=!a.value),onFocusout:c[1]||(c[1]=m=>a.value=!1),onMouseleave:c[2]||(c[2]=m=>a.value=!1)},[t.createElementVNode("div",{class:t.normalizeClass({"flex flex-row items-center gap-1":n.showPhoneIcon})},[n.showPhoneIcon?(t.openBlock(),t.createBlock(d,{key:0})):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(o.value),1)],2),r.value&&a.value?(t.openBlock(),t.createElementBlock("div",ex,[r.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:`tel:${s.value}`,class:"text-blue-600 hover:animate-pulse hover:text-blue-600"},[t.createVNode(u)],8,tx)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:1,href:`https://t.me/${s.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[t.createVNode(f)],8,nx)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:2,href:`https://wa.me/${s.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[t.createVNode(h)],8,ix)):t.createCommentVNode("",!0),r.value?(t.openBlock(),t.createElementBlock("a",{key:3,href:`viber://chat?number=${s.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[t.createVNode(p)],8,rx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],34)])}}}),ax={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function lx(n,e){return t.openBlock(),t.createElementBlock("svg",ax,[...e[0]||(e[0]=[t.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 cx=t.markRaw({name:"mdi-envelope",render:lx}),dx={class:"flex flex-col gap-1"},ux={key:0,class:"mb-2 flex flex-col text-base"},fx={key:0,class:"text-sc-dark-grey text-sm"},hx={key:1,class:"whitespace-nowrap text-sm"},mx={key:2,class:"whitespace-nowrap text-sm"},px={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},gx=["href"],yx=["href"],bx=["href"],_x=["href"],wx=["href"],xx={key:0,class:"flex flex-col text-base"},kx={key:0,class:"text-sc-dark-grey text-sm"},Cx={key:1,class:"mt-2 text-sm"},vx={key:0,class:"-mt-1"},Sx={},Bx=t.defineComponent({...Sx,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(n){const e=n,i=t.computed(()=>si.getFormatEntityName(e.contact)),r=t.computed(()=>{try{return e.contact.phone?xr.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),o=t.computed(()=>{var d;return M.isString(r.value)?!1:((d=r.value)==null?void 0:d.isValid())??!1}),s=t.computed(()=>{var d;return M.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("INTERNATIONAL"))??""}),a=t.computed(()=>{var d;return M.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("E.164"))??""}),l=t.computed(()=>o.value||e.contact.email),c=t.ref(!1);return(d,u)=>{var y,_;const f=tf,h=ef,p=Ju,m=Qu,g=cx,b=F.NPopover;return t.openBlock(),t.createElementBlock("div",dx,[t.createVNode(b,{disabled:n.fullView,placement:"bottom"},{trigger:t.withCtx(()=>{var k,x,v,B;return[t.createElementVNode("div",{class:t.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(k=n.contact)!=null&&k.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${n.classes}`),style:t.normalizeStyle(n.styles),onMouseenter:u[0]||(u[0]=w=>c.value=!0),onFocusin:u[1]||(u[1]=w=>c.value=!0),onMouseleave:u[2]||(u[2]=w=>c.value=!1),onFocusout:u[3]||(u[3]=w=>c.value=!1)},[t.createElementVNode("div",null,[n.fullView&&(n.contact.name||(x=n.contact)!=null&&x.position)?(t.openBlock(),t.createElementBlock("div",ux,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(v=n.contact)!=null&&v.position?(t.openBlock(),t.createElementBlock("span",fx,t.toDisplayString((B=n.contact)==null?void 0:B.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),n.contact.phone?(t.openBlock(),t.createElementBlock("div",hx,t.toDisplayString(s.value),1)):t.createCommentVNode("",!0),n.contact.email?(t.openBlock(),t.createElementBlock("div",mx,t.toDisplayString(n.contact.email),1)):t.createCommentVNode("",!0),l.value&&c.value?(t.openBlock(),t.createElementBlock("div",px,[o.value?(t.openBlock(),t.createElementBlock("a",{key:0,href:`tel:${a.value}`,class:"text-blue-600 hover:text-3xl hover:text-blue-600"},[t.createVNode(f)],8,gx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:1,href:`https://t.me/${a.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[t.createVNode(h)],8,yx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:2,href:`https://wa.me/${a.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[t.createVNode(p)],8,bx)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("a",{key:3,href:`viber://chat?number=${a.value}`,class:"text-purple-600 hover:text-3xl hover:text-purple-600"},[t.createVNode(m)],8,_x)):t.createCommentVNode("",!0),n.contact.email?(t.openBlock(),t.createElementBlock("a",{key:4,href:`mailto:${n.contact.email}`,class:"hover:text-3xl"},[t.createVNode(g)],8,wx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)])],38)]}),default:t.withCtx(()=>{var k,x,v,B;return[n.contact.name?(t.openBlock(),t.createElementBlock("div",xx,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(k=n.contact)!=null&&k.position?(t.openBlock(),t.createElementBlock("span",kx,t.toDisplayString((x=n.contact)==null?void 0:x.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),(v=n.contact)!=null&&v.comment?(t.openBlock(),t.createElementBlock("div",Cx,[u[4]||(u[4]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((B=n.contact)==null?void 0:B.comment),1)])):t.createCommentVNode("",!0)]}),_:1},8,["disabled"]),n.fullView&&((y=n.contact)!=null&&y.comment)?(t.openBlock(),t.createElementBlock("div",vx,[u[5]||(u[5]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((_=n.contact)==null?void 0:_.comment),1)])):t.createCommentVNode("",!0)])}}});class Nx{constructor(e){N(this,"minHeight");N(this,"maxHeights");N(this,"minWidth");N(this,"maxWidths");N(this,"netType");N(this,"color");N(this,"mountType");N(this,"descriptions");N(this,"crossbarCount");N(this,"heightOverlaps");N(this,"widthOverlaps");N(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=xs.objectToSnake(e.descriptions),this.maxHeights=e.maxHeights,this.maxWidths=e.maxWidths,this.minHeight=e.minHeight,this.minWidth=e.minWidth,this.mountType=e.mountType,this.netType=e.netType,this.heightOverlaps=xs.objectToSnake(e.heightOverlaps),this.widthOverlaps=xs.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function Tx(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.SandwichM2?!0:n.properties.configuratorSettings!==void 0&&M.isArray(n.products)&&n.products.length>0}const $x={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ex(n,e){return t.openBlock(),t.createElementBlock("svg",$x,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M16 12a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2"},null,-1)])])}const Rx=t.markRaw({name:"mdi-dots-horizontal",render:Ex}),Px={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fx(n,e){return t.openBlock(),t.createElementBlock("svg",Px,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5A6.5 6.5 0 0 0 9.5 3A6.5 6.5 0 0 0 3 9.5A6.5 6.5 0 0 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 5l1.5-1.5zm-6 0C7 14 5 12 5 9.5S7 5 9.5 5S14 7 14 9.5S12 14 9.5 14M7 9h5v1H7z"},null,-1)])])}const Vx=t.markRaw({name:"mdi-magnify-minus-outline",render:Fx}),Mx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ix(n,e){return t.openBlock(),t.createElementBlock("svg",Mx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m15.5 14l5 5l-1.5 1.5l-5-5v-.79l-.27-.28A6.47 6.47 0 0 1 9.5 16A6.5 6.5 0 0 1 3 9.5A6.5 6.5 0 0 1 9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.57 4.23l.28.27zm-6 0C12 14 14 12 14 9.5S12 5 9.5 5S5 7 5 9.5S7 14 9.5 14m2.5-4h-2v2H9v-2H7V9h2V7h1v2h2z"},null,-1)])])}const Ax=t.markRaw({name:"mdi-magnify-plus-outline",render:Ix}),Ox={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function zx(n,e){return t.openBlock(),t.createElementBlock("svg",Ox,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6z"},null,-1)])])}const nf=t.markRaw({name:"mdi-chevron-right",render:zx}),Dx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Lx(n,e){return t.openBlock(),t.createElementBlock("svg",Dx,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M15.41 16.58L10.83 12l4.58-4.59L14 6l-6 6l6 6z"},null,-1)])])}const rf=t.markRaw({name:"mdi-chevron-left",render:Lx}),Hx={heightMedium:"40px",paddingMedium:"0 16px",borderRadiusMedium:"10px",fontSizeMedium:"14px",iconSizeMedium:"18px",iconMarginMedium:"8px",border:"1px solid #d1d5db",borderHover:"1px solid #9ca3af",borderPressed:"1px solid #9ca3af",borderFocus:"1px solid #9ca3af"},Ar={heightSmall:"36px",paddingSmall:"0 10px",borderRadiusSmall:"8px",iconSizeSmall:"18px",border:"1px solid #d1d5db",borderHover:"1px solid #9ca3af",borderPressed:"1px solid #9ca3af",borderFocus:"1px solid #9ca3af"},of="date-range.dialog.mode",sf="date-range.dialog.scale",af="date-range.quick-periods",lf=["thisMonth","lastMonth","thisQuarter","lastQuarter","thisYear","lastYear","fromBeginningOfThisYear"],cf=["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],Wx=["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],jx=["Пн","Вт","Ср","Чт","Пт","Сб","Вс"],df=new Date(2e3,0,1),Ti=n=>xe.differenceInCalendarDays(n,df),uf=n=>xe.addDays(df,n),ff=(n,e,i)=>{let r=n??void 0,o=e??void 0;return r&&o&&r>o&&(i!=null&&i.from?o=r:i!=null&&i.to?r=o:[r,o]=[o,r]),{from:r?xe.startOfDay(r):void 0,to:o?xe.endOfDay(o):void 0}},Ra=n=>Object.entries(n).map(([e,i])=>({value:e,label:i.label,item:i})),hf=(n,e)=>{const i=Object.entries(n).filter(([,r])=>r.group===e);return e!=="other"?[{type:"group",key:e,children:Ra(Object.fromEntries(i))}]:j.STANDARD_PERIOD_SECTIONS.map(r=>{const o=i.filter(([,s])=>s.section===r.key);return{type:"group",key:r.key,label:r.label,children:Ra(Object.fromEntries(o))}}).filter(r=>r.children.length>0)},mf=(n,e)=>{const i=t.ref(null),r=t.ref(null),o=t.ref(!1),s=t.ref(null),a=(g,b)=>g<=b?[g,b]:[b,g],l=t.computed(()=>o.value&&r.value!==null&&s.value!==null?a(r.value,s.value):i.value!==null?s.value===null?[i.value,i.value]:a(i.value,s.value):n.value),c=(g,b)=>{i.value=null,e(...a(g,b))},d=g=>{i.value===null?(i.value=g,e(g,g)):c(i.value,g)},u=()=>{globalThis.removeEventListener("pointerup",u);const g=r.value;if(g!==null){if(r.value=null,o.value){o.value=!1,s.value!==null&&c(g,s.value);return}d(g)}},f=g=>{r.value=g,o.value=!1,globalThis.addEventListener("pointerup",u)},h=g=>{s.value=g,r.value!==null&&g!==r.value&&(o.value=!0)},p=()=>{s.value=null},m=g=>{const b=l.value;return!b||g<b[0]||g>b[1]?null:g===b[0]||g===b[1]?"bound":"in-range"};return t.onBeforeUnmount(()=>{globalThis.removeEventListener("pointerup",u)}),{activeRange:l,cellPosition:m,pointerDownHandler:f,pointerEnterHandler:h,pointerLeaveHandler:p,selectHandler:d}},qx={class:"flex items-center justify-between gap-2"},Xx={class:"flex items-center gap-2"},Yx={class:"text-center font-semibold"},Ux={class:"grid grid-cols-7 gap-0.5 text-center text-xs text-gray-500"},Kx={class:"grid grid-cols-7 gap-0.5"},Gx=["disabled","onPointerdown","onPointerenter","onKeydown"],Zx={},Qx=t.defineComponent({...Zx,__name:"day-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=42,s=F.useThemeVars(),a=t.computed(()=>({"--sc-primary-color":s.value.primaryColor,"--sc-primary-color-hover":s.value.primaryColorHover,"--sc-primary-color-suppl":s.value.primaryColorSuppl,"--sc-hover-color":s.value.hoverColor})),l=Xe.initRefDependingOnDeviceResolution(1,2,3),c=t.computed(()=>["grid-cols-1","grid-cols-2","grid-cols-3"][l.value-1]),d=y=>xe.subMonths(xe.startOfMonth(y),l.value===3?1:0),u=y=>y&&xe.isValid(y)?y:new Date,f=t.ref(d(u(i.from??i.to))),h=t.computed(()=>{const{from:y,to:_}=i;return!y||!_||!xe.isValid(y)||!xe.isValid(_)?null:[Ti(y),Ti(_)]}),p=mf(h,(y,_)=>{r("select",{from:xe.startOfDay(uf(y)),to:xe.endOfDay(uf(_))})}),m=y=>{const _=xe.subDays(y,(xe.getDay(y)+6)%7);return M.times(o,k=>{const x=xe.addDays(_,k);return{index:Ti(x),day:x.getDate(),isCurrentMonth:xe.isSameMonth(x,y),isToday:xe.isToday(x)}})},g=t.computed(()=>M.times(l.value,y=>{const _=xe.addMonths(f.value,y);return{key:`${_.getFullYear()}-${_.getMonth()}`,title:`${Wx[_.getMonth()]} ${_.getFullYear()}`,cells:m(_)}})),b=y=>{if(!y.isCurrentMonth)return["sc-day--outside"];const _=y.isToday?["sc-day--today"]:[],k=p.cellPosition(y.index);return k&&_.push(`sc-day--${k}`),_};return t.watch(()=>[i.from,i.to],()=>{const y=i.from??i.to;if(!y||!xe.isValid(y))return;const _=`${y.getFullYear()}-${y.getMonth()}`;M.some(g.value,["key",_])||(f.value=d(y))}),(y,_)=>{const k=rf,x=F.NButton,v=nf;return t.openBlock(),t.createElementBlock("div",{class:"flex select-none flex-col gap-3",style:t.normalizeStyle(a.value),onPointerleave:_[2]||(_[2]=(...B)=>t.unref(p).pointerLeaveHandler&&t.unref(p).pointerLeaveHandler(...B))},[t.createElementVNode("div",qx,[t.createVNode(x,{size:"small","aria-label":"Предыдущий месяц","theme-overrides":t.unref(Ar),onClick:_[0]||(_[0]=B=>f.value=t.unref(xe.subMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(k)]),_:1},8,["theme-overrides"]),_[3]||(_[3]=t.createElementVNode("span",{class:"text-sm text-gray-600"},"Выберите диапазон на календаре",-1)),t.createElementVNode("div",Xx,[t.renderSlot(y.$slots,"actions",{},void 0,!0),t.createVNode(x,{size:"small","aria-label":"Следующий месяц","theme-overrides":t.unref(Ar),onClick:_[1]||(_[1]=B=>f.value=t.unref(xe.addMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(v)]),_:1},8,["theme-overrides"])])]),t.createElementVNode("div",{class:t.normalizeClass(["grid gap-3",c.value])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(g.value,B=>(t.openBlock(),t.createElementBlock("div",{key:B.key,class:"flex flex-col gap-1"},[t.createElementVNode("div",Yx,t.toDisplayString(B.title),1),t.createElementVNode("div",Ux,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(jx),w=>(t.openBlock(),t.createElementBlock("span",{key:w},t.toDisplayString(w),1))),128))]),t.createElementVNode("div",Kx,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(B.cells,w=>(t.openBlock(),t.createElementBlock("button",{key:w.index,type:"button",class:t.normalizeClass(["sc-day h-7 rounded border-0 p-0 text-xs",b(w)]),disabled:!w.isCurrentMonth,onPointerdown:t.withModifiers(T=>t.unref(p).pointerDownHandler(w.index),["prevent"]),onPointerenter:T=>t.unref(p).pointerEnterHandler(w.index),onKeydown:[t.withKeys(t.withModifiers(T=>t.unref(p).selectHandler(w.index),["prevent"]),["enter"]),t.withKeys(t.withModifiers(T=>t.unref(p).selectHandler(w.index),["prevent"]),["space"])]},t.toDisplayString(w.day),43,Gx))),128))])]))),128))],2),_[4]||(_[4]=t.createStaticVNode('<div class="flex flex-wrap items-center gap-x-6 gap-y-1 text-xs text-gray-700" data-v-a41e813d><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--bound" data-v-a41e813d></i>Дата начала</span><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--in-range" data-v-a41e813d></i>Выбранный период</span><span class="flex items-center gap-2" data-v-a41e813d><i class="sc-legend sc-legend--bound" data-v-a41e813d></i>Дата окончания</span></div>',1))],36)}}}),Jx=fn(Qx,[["__scopeId","data-v-a41e813d"]]),ek={class:"flex items-center justify-between gap-2"},tk={class:"flex items-center gap-2"},nk={class:"text-center font-semibold"},ik={class:"grid grid-cols-3 gap-2"},rk=["onPointerdown","onPointerenter","onKeydown"],ok={},sk=t.defineComponent({...ok,__name:"month-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=F.useThemeVars(),s=t.computed(()=>({"--sc-primary-color":o.value.primaryColor,"--sc-primary-color-hover":o.value.primaryColorHover,"--sc-primary-color-suppl":o.value.primaryColorSuppl,"--sc-hover-color":o.value.hoverColor})),a=p=>{const m=new Date().getFullYear();return p&&xe.isValid(p)?p.getFullYear():m},l=t.ref(a(i.from??i.to)),c=Xe.initRefDependingOnDeviceResolution(1,3,3),d=t.computed(()=>c.value===1?[l.value]:[l.value-1,l.value,l.value+1]),u=t.computed(()=>{const{from:p,to:m}=i;return!p||!m||!xe.isValid(p)||!xe.isValid(m)?null:[p.getFullYear()*12+p.getMonth(),m.getFullYear()*12+m.getMonth()]}),f=mf(u,(p,m)=>{r("select",{from:new Date(Math.floor(p/12),p%12,1),to:xe.endOfMonth(new Date(Math.floor(m/12),m%12,1))})}),h=(p,m)=>{const g=f.cellPosition(p*12+m);return g?[`sc-month--${g}`]:[]};return t.watch(()=>[i.from,i.to],()=>{const p=i.from??i.to;if(!p||!xe.isValid(p))return;const m=p.getFullYear();(m<l.value-1||m>l.value+1)&&(l.value=m)}),(p,m)=>{const g=rf,b=F.NButton,y=nf;return t.openBlock(),t.createElementBlock("div",{class:"flex select-none flex-col gap-3",style:t.normalizeStyle(s.value),onPointerleave:m[2]||(m[2]=(..._)=>t.unref(f).pointerLeaveHandler&&t.unref(f).pointerLeaveHandler(..._))},[t.createElementVNode("div",ek,[t.createVNode(b,{size:"small","aria-label":"Предыдущий год","theme-overrides":t.unref(Ar),onClick:m[0]||(m[0]=_=>l.value-=1)},{icon:t.withCtx(()=>[t.createVNode(g)]),_:1},8,["theme-overrides"]),m[3]||(m[3]=t.createElementVNode("span",{class:"text-sm text-gray-600"},"Выберите диапазон месяцев",-1)),t.createElementVNode("div",tk,[t.renderSlot(p.$slots,"actions",{},void 0,!0),t.createVNode(b,{size:"small","aria-label":"Следующий год","theme-overrides":t.unref(Ar),onClick:m[1]||(m[1]=_=>l.value+=1)},{icon:t.withCtx(()=>[t.createVNode(y)]),_:1},8,["theme-overrides"])])]),t.createElementVNode("div",{class:t.normalizeClass(["grid gap-4 sm:gap-6",d.value.length===1?"grid-cols-1":"grid-cols-3"])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,_=>(t.openBlock(),t.createElementBlock("div",{key:_,class:"flex flex-col gap-2"},[t.createElementVNode("div",nk,t.toDisplayString(_),1),t.createElementVNode("div",ik,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(cf),(k,x)=>(t.openBlock(),t.createElementBlock("button",{key:k,type:"button",class:t.normalizeClass(["sc-month cursor-pointer rounded-lg px-1 py-2.5 text-sm",h(_,x)]),onPointerdown:t.withModifiers(v=>t.unref(f).pointerDownHandler(_*12+x),["prevent"]),onPointerenter:v=>t.unref(f).pointerEnterHandler(_*12+x),onKeydown:[t.withKeys(t.withModifiers(v=>t.unref(f).selectHandler(_*12+x),["prevent"]),["enter"]),t.withKeys(t.withModifiers(v=>t.unref(f).selectHandler(_*12+x),["prevent"]),["space"])]},t.toDisplayString(k),43,rk))),128))])]))),128))],2)],36)}}}),ak=fn(sk,[["__scopeId","data-v-dd09a19d"]]),lk={class:"sc-date-range-sidebar flex flex-col gap-1"},ck={class:"flex items-center justify-center gap-1"},dk={class:"min-w-12 text-center font-semibold"},uk={class:"grid grid-flow-col grid-cols-2 grid-rows-6 gap-1"},fk={},hk=t.defineComponent({...fk,__name:"month-year-sidebar",props:{year:{},month:{}},emits:["update:year","select-month","today"],setup(n,{emit:e}){const i=e;return(r,o)=>{const s=F.NButton;return t.openBlock(),t.createElementBlock("div",lk,[t.createElementVNode("div",ck,[t.createVNode(s,{size:"small",quaternary:"",onClick:o[0]||(o[0]=a=>i("update:year",n.year-1))},{default:t.withCtx(()=>[...o[3]||(o[3]=[t.createTextVNode(" ‹ ",-1)])]),_:1}),t.createElementVNode("span",dk,t.toDisplayString(n.year),1),t.createVNode(s,{size:"small",quaternary:"",onClick:o[1]||(o[1]=a=>i("update:year",n.year+1))},{default:t.withCtx(()=>[...o[4]||(o[4]=[t.createTextVNode(" › ",-1)])]),_:1})]),t.createElementVNode("div",uk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(cf),(a,l)=>(t.openBlock(),t.createBlock(s,{key:a,size:"small",quaternary:"",type:l===n.month?"primary":"default",onClick:c=>i("select-month",l)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a),1)]),_:2},1032,["type","onClick"]))),128))]),t.createVNode(s,{size:"small",text:"",type:"info",onClick:o[2]||(o[2]=a=>i("today"))},{default:t.withCtx(()=>[...o[5]||(o[5]=[t.createTextVNode(" Сегодня ",-1)])]),_:1})])}}}),mk={},pf=t.defineComponent({...mk,__name:"date-range-input",props:{clearable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{default:void 0},value:{default:null},dateFormat:{default:()=>j.useBaseConfigStateStore().config.dateFormats.uiDate}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=Xe.initRefDependingOnDeviceResolution(!0,!1,!1),s=t.ref(null),a=t.ref(!1),l=t.ref(0),c=t.ref(i.value&&xe.isValid(i.value)?i.value:new Date),d=t.computed(()=>{const k=i.value&&xe.isValid(i.value)?i.value:c.value;return k.getFullYear()===c.value.getFullYear()?k.getMonth():null});let u=0;const f=k=>{var x,v;(v=(x=k.target)==null?void 0:x.closest)!=null&&v.call(x,".n-base-clear__clear")&&(u=performance.now())},h=k=>{k&&performance.now()-u<300||(a.value=k,k&&(c.value=i.value&&xe.isValid(i.value)?i.value:new Date))},p=k=>{r("update:value",k===null?null:new Date(k))},m=(k,x)=>{const v=new Date(k,x,1);if(c.value=v,i.value&&xe.isValid(i.value)){const B=Math.min(xe.getDate(i.value),xe.getDaysInMonth(v));r("update:value",new Date(k,x,B));return}l.value+=1,t.nextTick().then(()=>{var B;return(B=s.value)==null?void 0:B.focus()})},g=(k,x)=>{c.value=xe.addYears(xe.addMonths(c.value,k),x)},b=k=>{m(k,c.value.getMonth())},y=k=>{m(c.value.getFullYear(),k)},_=()=>{a.value=!1,r("update:value",new Date)};return(k,x)=>{const v=F.NButton,B=F.NDatePicker;return t.openBlock(),t.createBlock(B,{ref_key:"pickerReference",ref:s,key:l.value,value:i.value?i.value.getTime():null,show:a.value,clearable:n.clearable,disabled:n.disabled,placeholder:n.placeholder,format:n.dateFormat,actions:[],"default-calendar-start-time":c.value.getTime(),type:"date",class:"w-full min-w-0",onMousedownCapture:f,"onUpdate:show":h,"onUpdate:value":p,onNextMonth:x[0]||(x[0]=w=>g(1,0)),onPrevMonth:x[1]||(x[1]=w=>g(-1,0)),onNextYear:x[2]||(x[2]=w=>g(0,1)),onPrevYear:x[3]||(x[3]=w=>g(0,-1))},{footer:t.withCtx(()=>[t.unref(o)?(t.openBlock(),t.createBlock(v,{key:1,size:"small",text:"",type:"info",onClick:_},{default:t.withCtx(()=>[...x[4]||(x[4]=[t.createTextVNode(" Сегодня ",-1)])]),_:1})):(t.openBlock(),t.createBlock(hk,{key:0,year:c.value.getFullYear(),month:d.value,"onUpdate:year":b,onSelectMonth:y,onToday:_},null,8,["year","month"]))]),_:1},8,["value","show","clearable","disabled","placeholder","format","default-calendar-start-time"])}}}),pk={key:0,class:"text-gray-400"},gk={},gf=t.defineComponent({...gk,__name:"date-range-fields",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},from:{default:null},to:{default:null},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:from","update:to"],setup(n,{emit:e}){const i=Xe.initRefDependingOnDeviceResolution(!0,!1,!1),r=e;return(o,s)=>{var a,l;return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["flex w-full min-w-0 gap-1",t.unref(i)?"flex-col":"flex-row items-center"])},[t.createVNode(pf,{value:n.from,clearable:n.clearable,disabled:(a=n.disabled)==null?void 0:a.from,placeholder:n.placeholderFrom,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:value":s[0]||(s[0]=c=>r("update:from",c))},null,8,["value","clearable","disabled","placeholder","date-format"]),t.unref(i)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",pk," – ")),t.createVNode(pf,{value:n.to,clearable:n.clearable,disabled:(l=n.disabled)==null?void 0:l.to,placeholder:n.placeholderTo,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:value":s[1]||(s[1]=c=>r("update:to",c))},null,8,["value","clearable","disabled","placeholder","date-format"])],2)}}}),yk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function bk(n,e){return t.openBlock(),t.createElementBlock("svg",yk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M7 11h2v2H7zm14-6v14c0 1.11-.89 2-2 2H5a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h1V1h2v2h8V1h2v2h1a2 2 0 0 1 2 2M5 7h14V5H5zm14 12V9H5v10zm-4-6v-2h2v2zm-4 0v-2h2v2zm-4 2h2v2H7zm8 2v-2h2v2zm-4 0v-2h2v2z"},null,-1)])])}const _k=t.markRaw({name:"mdi-calendar-month-outline",render:bk}),wk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function xk(n,e){return t.openBlock(),t.createElementBlock("svg",wk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"m16 11.78l4.24-7.33l1.73 1l-5.23 9.05l-6.51-3.75L5.46 19H22v2H2V3h2v14.54L9.5 8z"},null,-1)])])}const kk=t.markRaw({name:"mdi-chart-line",render:xk}),Ck={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function vk(n,e){return t.openBlock(),t.createElementBlock("svg",Ck,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M22 21H2V3h2v16h2v-9h4v9h2V6h4v13h2v-5h4z"},null,-1)])])}const Sk=t.markRaw({name:"mdi-chart-bar",render:vk}),Bk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Nk(n,e){return t.openBlock(),t.createElementBlock("svg",Bk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M5 3h1V1h2v2h8V1h2v2h1c1.11 0 2 .89 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m0 16h14V9H5zM5 7h14V5H5zm12 4v2H7v-2z"},null,-1)])])}const Tk=t.markRaw({name:"mdi-calendar-week-outline",render:Nk}),$k={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ek(n,e){return t.openBlock(),t.createElementBlock("svg",$k,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M19 3h-1V1h-2v2H8V1H6v2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.11 0 2-.89 2-2V5c0-1.11-.89-2-2-2m0 16H5V9h14zm0-12H5V5h14M7 11h5v5H7"},null,-1)])])}const Rk=t.markRaw({name:"mdi-calendar-today-outline",render:Ek}),Pk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fk(n,e){return t.openBlock(),t.createElementBlock("svg",Pk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M12 8a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m0 2a2 2 0 0 0-2 2a2 2 0 0 0 2 2a2 2 0 0 0 2-2a2 2 0 0 0-2-2m-2 12c-.25 0-.46-.18-.5-.42l-.37-2.65c-.63-.25-1.17-.59-1.69-.99l-2.49 1.01c-.22.08-.49 0-.61-.22l-2-3.46a.493.493 0 0 1 .12-.64l2.11-1.66L4.5 12l.07-1l-2.11-1.63a.493.493 0 0 1-.12-.64l2-3.46c.12-.22.39-.31.61-.22l2.49 1c.52-.39 1.06-.73 1.69-.98l.37-2.65c.04-.24.25-.42.5-.42h4c.25 0 .46.18.5.42l.37 2.65c.63.25 1.17.59 1.69.98l2.49-1c.22-.09.49 0 .61.22l2 3.46c.13.22.07.49-.12.64L19.43 11l.07 1l-.07 1l2.11 1.63c.19.15.25.42.12.64l-2 3.46c-.12.22-.39.31-.61.22l-2.49-1c-.52.39-1.06.73-1.69.98l-.37 2.65c-.04.24-.25.42-.5.42zm1.25-18l-.37 2.61c-1.2.25-2.26.89-3.03 1.78L5.44 7.35l-.75 1.3L6.8 10.2a5.55 5.55 0 0 0 0 3.6l-2.12 1.56l.75 1.3l2.43-1.04c.77.88 1.82 1.52 3.01 1.76l.37 2.62h1.52l.37-2.61c1.19-.25 2.24-.89 3.01-1.77l2.43 1.04l.75-1.3l-2.12-1.55c.4-1.17.4-2.44 0-3.61l2.11-1.55l-.75-1.3l-2.41 1.04a5.42 5.42 0 0 0-3.03-1.77L12.75 4z"},null,-1)])])}const Vk=t.markRaw({name:"mdi-cog-outline",render:Fk}),Mk={class:"grid gap-x-6 gap-y-4 pr-3 sm:grid-cols-2"},Ik={class:"font-medium"},Ak={key:0,class:"pt-1 text-xs text-gray-500"},Ok={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},zk={class:"flex items-center gap-3"},Dk={class:"text-sm text-gray-600"},Lk={class:"flex gap-2"},Hk={},Wk=t.defineComponent({...Hk,__name:"quick-periods-settings",props:{show:{type:Boolean},selectedKeys:{}},emits:["update:show","save"],setup(n,{emit:e}){const i=n,r=e,o=Xe.initRefDependingOnDeviceResolution("100%","90%","40rem"),s=j.DateTimeProvider.standardPeriods(),a=j.STANDARD_PERIOD_GROUPS.map(u=>({key:u.key,label:u.label,sections:hf(s,u.key)})),l=t.ref([]),c=t.computed(()=>{const u=l.value.length;return`Выбрано: ${u} ${j.pluralize(u,["период","периода","периодов"])}`}),d=()=>{r("save",[...l.value]),r("update:show",!1)};return t.watch(()=>i.show,u=>{u&&(l.value=[...i.selectedKeys])}),(u,f)=>{const h=F.NCheckbox,p=F.NCheckboxGroup,m=F.NScrollbar,g=F.NButton,b=F.NModal;return t.openBlock(),t.createBlock(b,{show:n.show,preset:"card",title:"Настройка быстрого выбора",closable:"",style:t.normalizeStyle({width:t.unref(o),maxWidth:"calc(100vw - 1rem)"}),class:"sc-date-range-dialog","onUpdate:show":f[4]||(f[4]=y=>r("update:show",y))},{footer:t.withCtx(()=>[t.createElementVNode("div",Ok,[t.createElementVNode("div",zk,[t.createElementVNode("span",Dk,t.toDisplayString(c.value),1),t.createVNode(g,{text:"",type:"info",onClick:f[1]||(f[1]=y=>l.value=[...t.unref(lf)])},{default:t.withCtx(()=>[...f[5]||(f[5]=[t.createTextVNode(" По умолчанию ",-1)])]),_:1}),t.createVNode(g,{text:"",type:"info",disabled:l.value.length===0,onClick:f[2]||(f[2]=y=>l.value=[])},{default:t.withCtx(()=>[...f[6]||(f[6]=[t.createTextVNode(" Снять все ",-1)])]),_:1},8,["disabled"])]),t.createElementVNode("div",Lk,[t.createVNode(g,{type:"primary",onClick:d},{default:t.withCtx(()=>[...f[7]||(f[7]=[t.createTextVNode(" Сохранить ",-1)])]),_:1}),t.createVNode(g,{onClick:f[3]||(f[3]=y=>r("update:show",!1))},{default:t.withCtx(()=>[...f[8]||(f[8]=[t.createTextVNode("Отмена",-1)])]),_:1})])])]),default:t.withCtx(()=>[t.createVNode(m,{class:"max-h-[60vh]"},{default:t.withCtx(()=>[t.createVNode(p,{value:l.value,"onUpdate:value":f[0]||(f[0]=y=>l.value=y)},{default:t.withCtx(()=>[t.createElementVNode("div",Mk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(a),y=>(t.openBlock(),t.createElementBlock("div",{key:y.key,class:"flex flex-col gap-1.5"},[t.createElementVNode("div",Ik,t.toDisplayString(y.label),1),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.sections,_=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:_.key},[_.label?(t.openBlock(),t.createElementBlock("div",Ak,t.toDisplayString(_.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.children,k=>(t.openBlock(),t.createBlock(h,{key:k.value,value:k.value,label:k.label},null,8,["value","label"]))),128))],64))),128))]))),128))])]),_:1},8,["value"])]),_:1})]),_:1},8,["show","style"])}}}),jk={class:"flex flex-col gap-2"},qk={class:"flex items-center gap-2"},Xk={class:"flex gap-2 px-px pb-4 pt-px"},Yk={key:0,class:"text-sm text-gray-500"},Uk={},Kk=t.defineComponent({...Uk,__name:"quick-periods",props:{from:{},to:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o=j.DateTimeProvider.standardPeriods(),s=()=>{const f=af,h=j.PreferencesStorageProvider.getActualDataFromStorage(f);return(M.isArray(h)?h:lf).filter(m=>M.isString(m)&&m in o)},a=t.ref(s()),l=t.ref(!1),c=t.computed(()=>Object.entries(o).filter(([f])=>a.value.includes(f)).map(([f,h])=>({value:f,label:h.label,item:h,group:h.group}))),d=t.computed(()=>{const f=i.from?Ti(i.from):null,h=i.to?Ti(i.to):null;if(f===null||h===null)return null;const p=c.value.find(m=>{const{from:g,to:b}=m.item;return!g||!b?!1:Ti(g)===f&&Ti(b)===h});return p?String(p.value):null}),u=f=>{a.value=f;const h=af;j.PreferencesStorageProvider.saveActualDataToStorage(h,f,xe.addYears(xe.startOfToday(),1))};return(f,h)=>{const p=Vk,m=F.NButton,g=Rk,b=Tk,y=Sk,_=kk,k=_k,x=F.NScrollbar;return t.openBlock(),t.createElementBlock("div",jk,[t.createElementVNode("div",qk,[h[3]||(h[3]=t.createElementVNode("span",{class:"text-sm font-medium text-gray-700"},"Быстрый выбор",-1)),t.createVNode(m,{size:"tiny",quaternary:"",circle:"","aria-label":"Настроить быстрый выбор",onClick:h[0]||(h[0]=v=>l.value=!0)},{icon:t.withCtx(()=>[t.createVNode(p)]),_:1})]),t.createVNode(x,{"x-scrollable":""},{default:t.withCtx(()=>[t.createElementVNode("div",Xk,[c.value.length===0?(t.openBlock(),t.createElementBlock("span",Yk," Периоды не выбраны ")):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,v=>(t.openBlock(),t.createBlock(m,{key:v.value,type:v.value===d.value?"primary":"default",ghost:v.value===d.value,"theme-overrides":t.unref(Hx),class:"shrink-0",onClick:B=>r("apply",v),onMouseenter:B=>r("preview",v),onMouseleave:h[1]||(h[1]=B=>r("preview"))},{icon:t.withCtx(()=>[v.group==="day"?(t.openBlock(),t.createBlock(g,{key:0})):v.group==="week"||v.group==="decade"?(t.openBlock(),t.createBlock(b,{key:1})):v.group==="quarter"||v.group==="halfYear"?(t.openBlock(),t.createBlock(y,{key:2})):v.group==="other"?(t.openBlock(),t.createBlock(_,{key:3})):(t.openBlock(),t.createBlock(k,{key:4}))]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(v.label),1)]),_:2},1032,["type","ghost","theme-overrides","onClick","onMouseenter"]))),128))])]),_:1}),t.createVNode(Wk,{show:l.value,"onUpdate:show":h[2]||(h[2]=v=>l.value=v),"selected-keys":a.value,onSave:u},null,8,["show","selected-keys"])])}}}),Gk={class:"flex flex-col items-stretch gap-3 sm:flex-row"},Zk={class:"order-2 flex-1 rounded-lg border border-solid border-gray-200 p-2 shadow-sm"},Qk={class:"flex flex-col items-stretch pr-3"},Jk={key:0,class:"px-2 pb-0.5 pt-2 text-xs text-gray-400"},e2={key:1,class:"order-2 w-44 shrink-0 rounded-lg border border-solid border-gray-200 p-1 shadow-sm"},t2={},n2=t.defineComponent({...t2,__name:"standard-periods",props:{activeKey:{},customPeriods:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o="custom",s=Xe.initRefDependingOnDeviceResolution(!0,!1,!1),a=j.DateTimeProvider.standardPeriods(),l=t.ref(j.STANDARD_PERIOD_GROUPS[0].key),c=t.computed(()=>{const u=j.STANDARD_PERIOD_GROUPS.map(f=>({key:f.key,value:f.key,label:f.label}));return M.isEmpty(i.customPeriods)||u.push({key:o,value:o,label:"Пользовательские"}),u}),d=t.computed(()=>l.value===o?[{type:"group",key:o,children:Ra(i.customPeriods??{})}]:hf(a,l.value));return(u,f)=>{const h=F.NButton,p=F.NScrollbar,m=F.NSelect,g=F.NMenu;return t.openBlock(),t.createElementBlock("div",Gk,[t.createElementVNode("div",Zk,[t.createVNode(p,{class:"max-h-96"},{default:t.withCtx(()=>[t.createElementVNode("div",Qk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,b=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:b.key},[b.label?(t.openBlock(),t.createElementBlock("div",Jk,t.toDisplayString(b.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(b.children,y=>(t.openBlock(),t.createBlock(h,{key:y.value,size:"small",quaternary:"",type:y.value===n.activeKey?"primary":"default",class:"justify-start",onClick:_=>r("apply",y),onMouseenter:_=>r("preview",y),onMouseleave:f[0]||(f[0]=_=>r("preview"))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(y.label),1)]),_:2},1032,["type","onClick","onMouseenter"]))),128))],64))),128))])]),_:1})]),t.unref(s)?(t.openBlock(),t.createBlock(m,{key:0,value:l.value,options:c.value,class:"order-1","onUpdate:value":f[1]||(f[1]=b=>l.value=b)},null,8,["value","options"])):(t.openBlock(),t.createElementBlock("div",e2,[t.createVNode(g,{value:l.value,options:c.value,mode:"vertical","onUpdate:value":f[2]||(f[2]=b=>l.value=b)},null,8,["value","options"])]))])}}}),i2={class:"flex flex-col gap-3"},r2={class:"flex flex-col gap-1 sm:flex-row sm:items-center"},o2={key:1,class:"overflow-x-auto rounded-lg border border-solid border-gray-200 p-2 shadow-sm sm:p-3"},s2={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},a2={class:"flex gap-2"},l2={},c2=t.defineComponent({...l2,__name:"date-range-dialog",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},show:{type:Boolean},dateRange:{default:void 0},customPeriods:{default:void 0},dateFormat:{default:void 0}},emits:["update:show","select"],setup(n,{emit:e}){const i=n,r=e,o=Xe.initRefDependingOnDeviceResolution("100%","90%","48rem"),s=t.ref("custom"),a=t.ref("months"),l=t.computed(()=>a.value==="months"?"Показать по дням":"Показать по месяцам"),c=()=>j.PreferencesStorageProvider.getActualDataFromStorage(of)==="standard"?"standard":"custom",d=()=>j.PreferencesStorageProvider.getActualDataFromStorage(sf)==="days"?"days":"months",u=(C,$)=>{j.PreferencesStorageProvider.saveActualDataToStorage(C,$,xe.addYears(xe.startOfToday(),1))},f=t.ref({}),h=t.ref(null),p=t.ref(null),m=t.computed(()=>h.value??f.value),g=(C,$)=>{var R,O;const E=(R=i.disabled)!=null&&R.from?f.value.from:C,I=(O=i.disabled)!=null&&O.to?f.value.to:$;h.value=null,f.value=ff(E,I,i.disabled)},b=C=>{p.value=null,g(C,f.value.to)},y=C=>{p.value=null,g(f.value.from,C)},_=()=>{p.value=null,g(null,null)},k=C=>{p.value=null,g(C.from,C.to)},x=C=>{const $=C.item;g($.from,$.to),p.value=String(C.value)},v=C=>{const $=C==null?void 0:C.item;h.value=$?{from:$.from,to:$.to}:null},B=()=>{h.value=null,s.value=s.value==="custom"?"standard":"custom",u(of,s.value)},w=()=>{a.value=a.value==="months"?"days":"months",u(sf,a.value)},T=()=>{r("select",f.value),r("update:show",!1)};return t.watch(()=>i.show,C=>{C&&(s.value=c(),a.value=d(),p.value=null,h.value=null,f.value={...i.dateRange})}),(C,$)=>{const E=F.NButton,I=Ax,R=Vx,O=F.NTooltip,U=F.NModal;return t.openBlock(),t.createBlock(U,{show:n.show,preset:"card",title:"Выберите период",closable:"",style:t.normalizeStyle({width:t.unref(o),maxWidth:"calc(100vw - 1rem)"}),class:"sc-date-range-dialog","onUpdate:show":$[1]||($[1]=Q=>r("update:show",Q))},{footer:t.withCtx(()=>[t.createElementVNode("div",s2,[t.createVNode(E,{text:"",type:"info",onClick:B},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.value==="custom"?"Показать стандартные периоды":"Показать произвольный период"),1)]),_:1}),t.createElementVNode("div",a2,[t.createVNode(E,{type:"primary",onClick:T},{default:t.withCtx(()=>[...$[3]||($[3]=[t.createTextVNode(" Выбрать ",-1)])]),_:1}),t.createVNode(E,{onClick:$[0]||($[0]=Q=>r("update:show",!1))},{default:t.withCtx(()=>[...$[4]||($[4]=[t.createTextVNode("Отмена",-1)])]),_:1})])])]),default:t.withCtx(()=>[t.createElementVNode("div",i2,[s.value==="custom"?(t.openBlock(),t.createBlock(Kk,{key:0,from:f.value.from,to:f.value.to,onApply:x,onPreview:v},null,8,["from","to"])):t.createCommentVNode("",!0),t.createElementVNode("div",r2,[t.createVNode(gf,{from:m.value.from,to:m.value.to,clearable:n.clearable,disabled:n.disabled,"date-format":n.dateFormat,class:"flex-1","onUpdate:from":b,"onUpdate:to":y},null,8,["from","to","clearable","disabled","date-format"]),n.clearable?(t.openBlock(),t.createBlock(E,{key:0,text:"",type:"info",class:"sm:ml-2",onClick:_},{default:t.withCtx(()=>[...$[2]||($[2]=[t.createTextVNode(" Очистить период ",-1)])]),_:1})):t.createCommentVNode("",!0)]),s.value==="custom"?(t.openBlock(),t.createElementBlock("div",o2,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.value==="months"?ak:Jx),{from:f.value.from,to:f.value.to,onSelect:k},{actions:t.withCtx(()=>[t.createVNode(O,{placement:"top",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(E,{size:"small","aria-label":l.value,"theme-overrides":t.unref(Ar),onClick:w},{icon:t.withCtx(()=>[a.value==="months"?(t.openBlock(),t.createBlock(I,{key:0})):(t.openBlock(),t.createBlock(R,{key:1}))]),_:1},8,["aria-label","theme-overrides"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(l.value),1)]),_:1})]),_:1},40,["from","to"]))])):(t.openBlock(),t.createBlock(n2,{key:2,"active-key":p.value,"custom-periods":n.customPeriods,onApply:x,onPreview:v},null,8,["active-key","custom-periods"]))])]),_:1},8,["show","style"])}}}),d2={class:"flex w-full min-w-0 items-center gap-1"},u2={},f2=t.defineComponent({...u2,__name:"date-range",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},dateRange:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:date-range"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(!1),s=t.computed(()=>{const u={...i.useDefaultPredefinedDateRanges?j.DateTimeProvider.defaultDateRanges():{},...i.predefinedDateRanges};return M.isEmpty(u)?void 0:u}),a=(u,f)=>{r("update:date-range",ff(u,f,i.disabled))},l=u=>{var f;a(u,(f=i.dateRange)==null?void 0:f.to)},c=u=>{var f;a((f=i.dateRange)==null?void 0:f.from,u)},d=u=>{a(u.from,u.to)};return(u,f)=>{var m,g,b,y;const h=Rx,p=F.NButton;return t.openBlock(),t.createElementBlock("div",d2,[t.createVNode(gf,{from:(m=n.dateRange)==null?void 0:m.from,to:(g=n.dateRange)==null?void 0:g.to,clearable:n.clearable,disabled:n.disabled,"placeholder-from":n.placeholderFrom,"placeholder-to":n.placeholderTo,"date-format":n.dateFormat,class:"min-w-0 flex-1","onUpdate:from":l,"onUpdate:to":c},null,8,["from","to","clearable","disabled","placeholder-from","placeholder-to","date-format"]),t.createVNode(p,{disabled:!!((b=n.disabled)!=null&&b.from&&((y=n.disabled)!=null&&y.to)),title:"Выбрать период","aria-label":"Выбрать период",onClick:f[0]||(f[0]=_=>o.value=!0)},{default:t.withCtx(()=>[t.createVNode(h)]),_:1},8,["disabled"]),t.createVNode(c2,{show:o.value,"onUpdate:show":f[1]||(f[1]=_=>o.value=_),"date-range":n.dateRange,clearable:n.clearable,disabled:n.disabled,"custom-periods":s.value,"date-format":n.dateFormat,onSelect:d},null,8,["show","date-range","clearable","disabled","custom-periods","date-format"])])}}}),h2={class:"sc-lbl-date text-nowrap"},m2={},Ko=t.defineComponent({...m2,__name:"date-time-label",props:{date:{},isTimeSecondary:{type:Boolean},isTimeOnSecondLine:{type:Boolean},isShowTime:{type:Boolean,default:!0}},setup(n){const e=n,i=t.computed(()=>xe.format(e.date,j.useBaseConfigStateStore().config.dateFormats.uiDate)),r=t.computed(()=>xe.format(e.date,"HH:mm"));return(o,s)=>(t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass({"flex flex-col":n.isTimeOnSecondLine})},[t.createElementVNode("span",h2,t.toDisplayString(i.value),1),n.isShowTime?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass([{"text-sc-grey":n.isTimeSecondary,"ml-1":!n.isTimeOnSecondLine},"sc-lbl-time"])},t.toDisplayString(r.value),3)):t.createCommentVNode("",!0)],2))}}),p2={},g2=t.defineComponent({...p2,__name:"debt",props:{debt:{default:0},showLabel:{type:Boolean,default:!1},wrapAsSmall:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>{let r="";return(e.showLabel??!1)&&(e.debt>0?r="Переплата: ":e.debt<0&&(r="Задолженность: ")),r});return(r,o)=>n.debt!==0?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass({"text-sm":n.wrapAsSmall})},[t.createTextVNode(t.toDisplayString(i.value)+" ",1),t.createElementVNode("span",{class:t.normalizeClass({"text-green-700":n.debt>0,"text-red-700":n.debt<0})},t.toDisplayString(n.debt)+" ₽ ",3)],2)):t.createCommentVNode("",!0)}}),y2={class:"flex flex-row gap-2.5"},b2={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},_2={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},w2={class:"mb-0.5 sm:mb-0 sm:ml-3"},x2={},k2=t.defineComponent({...x2,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(n){return(e,i)=>{const r=Uo,o=F.NButton,s=F.NPopover;return t.openBlock(),t.createElementBlock("div",y2,[t.createElementVNode("div",b2,[t.renderSlot(e.$slots,"main")]),t.createElementVNode("div",null,[t.createElementVNode("div",_2,[t.renderSlot(e.$slots,"extra-buttons"),t.createElementVNode("div",w2,[n.showCloseButton?(t.openBlock(),t.createBlock(s,{key:0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(o,{size:"small",type:"error",onClick:i[0]||(i[0]=a=>e.$emit("close"))},{default:t.withCtx(()=>[t.createVNode(r)]),_:1})]),default:t.withCtx(()=>[i[1]||(i[1]=t.createTextVNode(" Закрыть ",-1))]),_:1})):t.createCommentVNode("",!0)])])])])}}}),C2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function v2(n,e){return t.openBlock(),t.createElementBlock("svg",C2,[...e[0]||(e[0]=[t.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 S2=t.markRaw({name:"ion-checkmark-done-sharp",render:v2}),B2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function N2(n,e){return t.openBlock(),t.createElementBlock("svg",B2,[...e[0]||(e[0]=[t.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),t.createElementVNode("circle",{cx:"336",cy:"128",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"176",cy:"256",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),t.createElementVNode("circle",{cx:"336",cy:"384",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1)])])}const T2=t.markRaw({name:"ion-options-outline",render:N2}),$2={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},E2={class:"flex-auto"},R2={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"},P2={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"},F2={},Pa=t.defineComponent({...F2,__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(n,{emit:e}){const i=e,r=t.ref(!1),o=()=>{i("edit")},s=()=>{r.value=!1},a=()=>{r.value=!0,i("apply",s)},l=()=>{i("cancel",s)};return(c,d)=>{const u=T2,f=F.NButton,h=F.NPopover,p=S2,m=Uo;return t.openBlock(),t.createElementBlock("div",$2,[t.createElementVNode("div",E2,[t.renderSlot(c.$slots,"default")]),t.createElementVNode("div",null,[t.createElementVNode("div",R2,[t.createElementVNode("div",P2,[n.showEditButton?(t.openBlock(),t.createBlock(h,{key:0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"info",ghost:"",size:"small",onClick:o},{default:t.withCtx(()=>[t.createVNode(u)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[0]||(d[0]=t.createTextVNode(" Редактировать данные ",-1))]),_:1})):t.createCommentVNode("",!0),n.showApplyButton?(t.openBlock(),t.createBlock(h,{key:1,disabled:r.value,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"primary",size:"small",onClick:a},{default:t.withCtx(()=>[t.createVNode(p)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[1]||(d[1]=t.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),n.showCancelButton?(t.openBlock(),t.createBlock(h,{key:2,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(f,{disabled:n.disabled||r.value,type:"error",size:"small",onClick:l},{default:t.withCtx(()=>[t.createVNode(m)]),_:1},8,["disabled"])]),default:t.withCtx(()=>[d[2]||(d[2]=t.createTextVNode(" Отменить изменения ",-1))]),_:1})):t.createCommentVNode("",!0)]),t.renderSlot(c.$slots,"extra-buttons")])])])}}}),V2={},yf=t.defineComponent({...V2,__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(n,{emit:e}){const i=n,r=e,o=t.ref(i.showEditor),s=l=>{r("editor:apply",d=>{o.value=!d,l()})},a=l=>{o.value=!1,l(),r("editor:cancel")};return t.onMounted(()=>{t.watch(()=>i.showEditor,l=>{o.value=l})}),(l,c)=>(t.openBlock(),t.createElementBlock("div",null,[o.value?(t.openBlock(),t.createBlock(Pa,{key:1,disabled:n.disabled,"show-apply-button":!0,"show-cancel-button":!0,onApply:s,onCancel:a},{"extra-buttons":t.withCtx(()=>[t.renderSlot(l.$slots,"extra-editor-buttons")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"editor")]),_:3},8,["disabled"])):(t.openBlock(),t.createBlock(Pa,{key:0,disabled:n.disabled,"show-edit-button":n.showEditButton,onEdit:c[0]||(c[0]=d=>o.value=!0)},{"extra-buttons":t.withCtx(()=>[t.renderSlot(l.$slots,"extra-viewer-buttons")]),default:t.withCtx(()=>[t.renderSlot(l.$slots,"viewer")]),_:3},8,["disabled","show-edit-button"]))]))}}),M2={key:0,class:"whitespace-pre-line"},I2={key:1,class:"text-sc-dark-grey"},A2={},O2=t.defineComponent({...A2,__name:"comment-editor",props:{disabled:{type:Boolean,default:!1},comment:{default:""}},emits:["update:comment"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.comment);t.watch(()=>o.value,l=>{o.value=l});const s=l=>{r("update:comment",o.value,l)},a=()=>{o.value=i.comment};return(l,c)=>{const d=F.NInput;return t.openBlock(),t.createBlock(yf,{disabled:n.disabled,"onEditor:apply":s,"onEditor:cancel":a},{viewer:t.withCtx(()=>[t.createElementVNode("div",null,[n.comment?(t.openBlock(),t.createElementBlock("span",M2,t.toDisplayString(n.comment),1)):(t.openBlock(),t.createElementBlock("span",I2," - Комментарий отсутствует - "))])]),editor:t.withCtx(()=>[t.createVNode(d,{value:o.value,"onUpdate:value":c[0]||(c[0]=u=>o.value=u),clearable:!0,type:"textarea"},null,8,["value"])]),_:1},8,["disabled"])}}}),z2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function D2(n,e){return t.openBlock(),t.createElementBlock("svg",z2,[...e[0]||(e[0]=[t.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),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m176 272l80 80l80-80M256 48v288"},null,-1)])])}const L2=t.markRaw({name:"ion-download-outline",render:D2}),H2={},W2=t.defineComponent({...H2,__name:"single-file-upload-selector",props:{draggedAreaText:{},accept:{},isError:{type:Boolean}},emits:["update:file"],setup(n,{emit:e}){const i=n,r=e,o=t.ref([]),s=t.computed(()=>o.value.map(l=>(l.status=i.isError?"error":"finished",l))),a=l=>{o.value=l;const c={name:"",content:""};if(l.length===0){r("update:file",null);return}const d=l[0];c.name=d.name;const u=new FileReader;u.addEventListener("load",()=>{c.content=u.result??"",r("update:file",c)}),u.readAsDataURL(d.file)};return(l,c)=>{const d=L2;return t.openBlock(),t.createBlock(t.unref(F.NUpload),{"file-list":s.value,"default-upload":!1,max:1,"show-retry-button":!1,action:"",accept:n.accept,"directory-dnd":"",class:"content-center","onUpdate:fileList":a},{default:t.withCtx(()=>[t.createVNode(t.unref(F.NUploadDragger),null,{default:t.withCtx(()=>[t.renderSlot(l.$slots,"dragged-area",{},()=>[t.createElementVNode("div",null,[t.createVNode(d,{class:"text-2xl"}),t.createElementVNode("div",null,t.toDisplayString(n.draggedAreaText??"Перетащите в эту область файл, который необходимо загрузить."),1)])])]),_:3})]),_:3},8,["file-list","accept"])}}}),j2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function q2(n,e){return t.openBlock(),t.createElementBlock("svg",j2,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0 0 80 446.25h340.89a32 32 0 0 0 28.18-47.17m-198.6-1.83a20 20 0 1 1 20-20a20 20 0 0 1-20 20m21.72-201.15l-5.74 122a16 16 0 0 1-32 0l-5.74-121.95a21.73 21.73 0 0 1 21.5-22.69h.21a21.74 21.74 0 0 1 21.73 22.7Z"},null,-1)])])}const X2=t.markRaw({name:"ion-warning",render:q2}),Y2={},U2=t.defineComponent({...Y2,__name:"warning-icon",props:{popoverText:{default:""},iconClass:{default:"text-sc-warning"}},setup(n){return(e,i)=>{const r=X2,o=F.NPopover;return t.openBlock(),t.createBlock(o,{disabled:n.popoverText.length===0,placement:"bottom"},{trigger:t.withCtx(()=>[t.createVNode(r,{class:t.normalizeClass(`ml-0.5 ${n.iconClass}`)},null,8,["class"])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.popoverText),1)]),_:1},8,["disabled"])}}}),K2={},G2=t.defineComponent({...K2,__name:"debounced-input",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:800},placeholder:{default:""}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref(i.value),s=t.computed(()=>t.inject("debounce-input-time",i.debounceTime)),a=M.debounce(()=>r("update:value",o.value),s.value),l=c=>{o.value=c,a()};return t.watch(()=>i.value,c=>{o.value=c}),(c,d)=>(t.openBlock(),t.createBlock(t.unref(F.NInput),{value:o.value,"onUpdate:value":[d[0]||(d[0]=u=>o.value=u),l],clearable:n.clearable,placeholder:n.placeholder},{prefix:t.withCtx(()=>[t.renderSlot(c.$slots,"prefix")]),_:3},8,["value","clearable","placeholder"]))}}),Z2={},Q2=t.defineComponent({...Z2,__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},parse:{type:Function,default:void 0},showButton:{type:Boolean,default:!0}},emits:["update:value","keydown","input","focus"],setup(n,{expose:e,emit:i}){const r=n,o=i,s=t.ref(r.value),a=t.computed(()=>t.inject("debounce-input-time",r.debounceTime)),l=M.debounce(()=>o("update:value",s.value),a.value),c=p=>{s.value=p,l()};t.watch(()=>r.value,p=>{s.value=p});const d=t.ref(null);return e({focus:()=>{var p;return(p=d.value)==null?void 0:p.focus()},blur:()=>{var p;return(p=d.value)==null?void 0:p.blur()},select:()=>{var p;return(p=d.value)==null?void 0:p.select()}}),(p,m)=>(t.openBlock(),t.createBlock(t.unref(F.NInputNumber),{ref_key:"inputReference",ref:d,value:s.value??null,clearable:n.clearable,parse:n.parse,"show-button":n.showButton,placeholder:n.placeholder,min:n.min,max:n.max,step:n.step,validator:n.validator,"onUpdate:value":c,onKeydown:m[0]||(m[0]=g=>o("keydown",g)),onInput:m[1]||(m[1]=g=>o("input",g)),onFocus:m[2]||(m[2]=g=>o("focus",g))},{prefix:t.withCtx(()=>[t.renderSlot(p.$slots,"prefix")]),_:3},8,["value","clearable","parse","show-button","placeholder","min","max","step","validator"]))}}),J2={},eC=t.defineComponent({...J2,__name:"phone-input",props:{value:{},debounceTime:{},disabled:{type:Boolean},placeholder:{},defaultCountry:{},preferredCountries:{},onlyCountries:{}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=t.ref((i.value??"").replaceAll(/\D*/g,"")),s=M.debounce(c=>r("update:value",c),i.debounceTime??0),a=c=>{let d="";if(M.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(M.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof xr.PhoneNumber?c.format("E.164"):`+${c.countryCallingCode}${c.nationalNumber}`}i.debounceTime?s(d):r("update:value",d)},l=c=>{const d=c.replaceAll(/\D*/g,"");try{const u=xr.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof xr.ParseError)o.value=d;else throw u}};return t.watch(()=>i.value,c=>{var d;(c==null?void 0:c.replaceAll(/\D*/g,""))!==((d=o.value)==null?void 0:d.replaceAll(/\D*/g,""))&&l(c)},{immediate:!0}),t.onBeforeMount(()=>l(o.value??"")),(c,d)=>(t.openBlock(),t.createBlock(t.unref(Sm.VueTelInput),{modelValue:o.value,"onUpdate:modelValue":[d[0]||(d[0]=u=>o.value=u),a],"auto-default-country":!1,"auto-format":!0,"default-country":n.defaultCountry,disabled:n.disabled,"input-options":{placeholder:n.placeholder},"preferred-countries":n.preferredCountries,"only-countries":n.onlyCountries,mode:"international",class:"tel-input"},null,8,["modelValue","default-country","disabled","input-options","preferred-countries","only-countries"]))}}),tC=fn(eC,[["__scopeId","data-v-751dbb0e"]]),nC={class:"mb-7 grid grid-cols-2 gap-3.5 lg:grid-cols-4"},iC={class:"mb-2 text-[11.5px] font-semibold uppercase text-gray-500"},rC={},oC=t.defineComponent({...rC,__name:"kpi-grid",props:{items:{},isLoading:{type:Boolean}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",nC,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.items,r=>(t.openBlock(),t.createElementBlock("div",{key:r.label,class:"rounded-lg border border-solid border-gray-200 px-4 py-4"},[t.createElementVNode("div",iC,t.toDisplayString(r.label),1),t.createElementVNode("div",{class:t.normalizeClass(["text-[25px] font-bold",r.valueClass])},t.toDisplayString(n.isLoading?"…":r.value),3),t.createElementVNode("div",{class:t.normalizeClass(["mt-1.5 text-xs font-medium",r.noteClass])},t.toDisplayString(r.note),3)]))),128))]))}}),sC={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function aC(n,e){return t.openBlock(),t.createElementBlock("svg",sC,[...e[0]||(e[0]=[t.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 lC=t.markRaw({name:"tabler-external-link",render:aC}),cC={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},dC=["href"],uC={},fC=t.defineComponent({...uC,__name:"external-link",props:{text:{},url:{},description:{}},setup(n){return(e,i)=>{const r=lC,o=F.NTooltip;return t.openBlock(),t.createBlock(o,{disabled:t.unref(M.isUndefined)(n.description),placement:"top-start"},{trigger:t.withCtx(()=>[t.createElementVNode("span",cC,[t.createElementVNode("a",{href:n.url,target:"_blank",class:"no-underline"},t.toDisplayString(n.text),9,dC),t.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.description),1)]),_:1},8,["disabled"])}}}),hC={key:1,class:"h-24"},mC={key:2,class:"flex flex-col gap-3"},pC={},gC=t.defineComponent({...pC,__name:"compact-card-list",props:{isLoading:{type:Boolean},isEmpty:{type:Boolean},emptyDescription:{},pagination:{}},emits:["update:page","update:pageSize"],setup(n,{emit:e}){const i=e,r=[20,50,100];return(o,s)=>(t.openBlock(),t.createBlock(t.unref(F.NSpin),{show:n.isLoading},{default:t.withCtx(()=>[!n.isLoading&&n.isEmpty?(t.openBlock(),t.createBlock(t.unref(F.NEmpty),{key:0,description:n.emptyDescription},null,8,["description"])):n.isLoading&&n.isEmpty?(t.openBlock(),t.createElementBlock("div",hC)):(t.openBlock(),t.createElementBlock("div",mC,[t.renderSlot(o.$slots,"default")])),n.pagination&&n.pagination.itemCount>0?(t.openBlock(),t.createBlock(t.unref(F.NPagination),{key:3,class:"mt-4 flex-wrap justify-center gap-y-2",size:"small",page:n.pagination.page,"page-size":n.pagination.pageSize,"item-count":n.pagination.itemCount,"page-slot":n.pagination.pageSlot,"page-sizes":r,"show-size-picker":!0,prefix:t.unref(Ul),"onUpdate:page":s[0]||(s[0]=a=>i("update:page",a)),"onUpdate:pageSize":s[1]||(s[1]=a=>i("update:pageSize",a))},null,8,["page","page-size","item-count","page-slot","prefix"])):t.createCommentVNode("",!0)]),_:3},8,["show"]))}}),yC={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function bC(n,e){return t.openBlock(),t.createElementBlock("svg",yC,[...e[0]||(e[0]=[t.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),t.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 256H176"},null,-1)])])}const _C=t.markRaw({name:"ion-remove-circle-outline",render:bC});let Go=[];const bf=new WeakMap;function wC(){Go.forEach(n=>n(...bf.get(n))),Go=[]}function _f(n,...e){bf.set(n,e),!Go.includes(n)&&Go.push(n)===1&&requestAnimationFrame(wC)}function Or(n,e){let{target:i}=n;for(;i;){if(i.dataset&&i.dataset[e]!==void 0)return!0;i=i.parentElement}return!1}function zr(n){return n.composedPath()[0]||null}function Dr(n){return typeof n=="string"?n.endsWith("px")?Number(n.slice(0,n.length-2)):Number(n):n}function Lr(n){if(n!=null)return typeof n=="number"?`${n}px`:n.endsWith("px")?n:`${n}px`}function yn(n,e){const i=n.trim().split(/\s+/g),r={top:i[0]};switch(i.length){case 1:r.right=i[0],r.bottom=i[0],r.left=i[0];break;case 2:r.right=i[1],r.left=i[1],r.bottom=i[0];break;case 3:r.right=i[1],r.bottom=i[2],r.left=i[1];break;case 4:r.right=i[1],r.bottom=i[2],r.left=i[3];break;default:throw new Error("[seemly/getMargin]:"+n+" is not a valid value.")}return e===void 0?r:r[e]}const wf={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 xC(n,e,i){e/=100,i/=100;let r=(o,s=(o+n/60)%6)=>i-i*e*Math.max(Math.min(s,4-s,1),0);return[r(5)*255,r(3)*255,r(1)*255]}function kC(n,e,i){e/=100,i/=100;let r=e*Math.min(i,1-i),o=(s,a=(s+n/30)%12)=>i-r*Math.max(Math.min(a-3,9-a,1),-1);return[o(0)*255,o(8)*255,o(4)*255]}const Pn="^\\s*",Fn="\\s*$",fi="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Qt="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",$i="([0-9A-Fa-f])",Ei="([0-9A-Fa-f]{2})",xf=new RegExp(`${Pn}hsl\\s*\\(${Qt},${fi},${fi}\\)${Fn}`),kf=new RegExp(`${Pn}hsv\\s*\\(${Qt},${fi},${fi}\\)${Fn}`),Cf=new RegExp(`${Pn}hsla\\s*\\(${Qt},${fi},${fi},${Qt}\\)${Fn}`),vf=new RegExp(`${Pn}hsva\\s*\\(${Qt},${fi},${fi},${Qt}\\)${Fn}`),CC=new RegExp(`${Pn}rgb\\s*\\(${Qt},${Qt},${Qt}\\)${Fn}`),vC=new RegExp(`${Pn}rgba\\s*\\(${Qt},${Qt},${Qt},${Qt}\\)${Fn}`),SC=new RegExp(`${Pn}#${$i}${$i}${$i}${Fn}`),BC=new RegExp(`${Pn}#${Ei}${Ei}${Ei}${Fn}`),NC=new RegExp(`${Pn}#${$i}${$i}${$i}${$i}${Fn}`),TC=new RegExp(`${Pn}#${Ei}${Ei}${Ei}${Ei}${Fn}`);function Yt(n){return parseInt(n,16)}function $C(n){try{let e;if(e=Cf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),Pi(e[13])];if(e=xf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${n}.`)}catch(e){throw e}}function EC(n){try{let e;if(e=vf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),Pi(e[13])];if(e=kf.exec(n))return[Qo(e[1]),hi(e[5]),hi(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${n}.`)}catch(e){throw e}}function Ri(n){try{let e;if(e=BC.exec(n))return[Yt(e[1]),Yt(e[2]),Yt(e[3]),1];if(e=CC.exec(n))return[Bt(e[1]),Bt(e[5]),Bt(e[9]),1];if(e=vC.exec(n))return[Bt(e[1]),Bt(e[5]),Bt(e[9]),Pi(e[13])];if(e=SC.exec(n))return[Yt(e[1]+e[1]),Yt(e[2]+e[2]),Yt(e[3]+e[3]),1];if(e=TC.exec(n))return[Yt(e[1]),Yt(e[2]),Yt(e[3]),Pi(Yt(e[4])/255)];if(e=NC.exec(n))return[Yt(e[1]+e[1]),Yt(e[2]+e[2]),Yt(e[3]+e[3]),Pi(Yt(e[4]+e[4])/255)];if(n in wf)return Ri(wf[n]);if(xf.test(n)||Cf.test(n)){const[i,r,o,s]=$C(n);return[...kC(i,r,o),s]}else if(kf.test(n)||vf.test(n)){const[i,r,o,s]=EC(n);return[...xC(i,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${n}.`)}catch(e){throw e}}function RC(n){return n>1?1:n<0?0:n}function Fa(n,e,i,r){return`rgba(${Bt(n)}, ${Bt(e)}, ${Bt(i)}, ${RC(r)})`}function Va(n,e,i,r,o){return Bt((n*e*(1-r)+i*r)/o)}function PC(n,e){Array.isArray(n)||(n=Ri(n)),Array.isArray(e)||(e=Ri(e));const i=n[3],r=e[3],o=Pi(i+r-i*r);return Fa(Va(n[0],i,e[0],r,o),Va(n[1],i,e[1],r,o),Va(n[2],i,e[2],r,o),o)}function De(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Ri(n);return typeof e.alpha=="number"?Fa(i,r,o,e.alpha):Fa(i,r,o,s)}function Zo(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Ri(n),{lightness:a=1,alpha:l=1}=e;return FC([i*a,r*a,o*a,s*l])}function Pi(n){const e=Math.round(Number(n)*100)/100;return e>1?1:e<0?0:e}function Qo(n){const e=Math.round(Number(n));return e>=360||e<0?0:e}function Bt(n){const e=Math.round(Number(n));return e>255?255:e<0?0:e}function hi(n){const e=Math.round(Number(n));return e>100?100:e<0?0:e}function FC(n){const[e,i,r]=n;return 3 in n?`rgba(${Bt(e)}, ${Bt(i)}, ${Bt(r)}, ${Pi(n[3])})`:`rgba(${Bt(e)}, ${Bt(i)}, ${Bt(r)}, 1)`}function VC(n=8){return Math.random().toString(16).slice(2,2+n)}function Sf(n){return Array.isArray(n)?n:[n]}const Ma={STOP:"STOP"};function Bf(n,e){const i=e(n);n.children!==void 0&&i!==Ma.STOP&&n.children.forEach(r=>Bf(r,e))}function MC(n,e={}){const{preserveGroup:i=!1}=e,r=[],o=i?a=>{a.isLeaf||(r.push(a.key),s(a.children))}:a=>{a.isLeaf||(a.isGroup||r.push(a.key),s(a.children))};function s(a){a.forEach(o)}return s(n),r}function IC(n,e){const{isLeaf:i}=n;return i!==void 0?i:!e(n)}function AC(n){return n.children}function OC(n){return n.key}function zC(){return!1}function DC(n,e){const{isLeaf:i}=n;return!(i===!1&&!Array.isArray(e(n)))}function LC(n){return n.disabled===!0}function HC(n,e){return n.isLeaf===!1&&!Array.isArray(e(n))}function WC(n,e){if(n.isLeaf===!0){const i=e(n);if(Array.isArray(i)&&i.length>0)return!0}return!1}function Ia(n){var e;return n==null?[]:Array.isArray(n)?n:(e=n.checkedKeys)!==null&&e!==void 0?e:[]}function Aa(n){var e;return n==null||Array.isArray(n)?[]:(e=n.indeterminateKeys)!==null&&e!==void 0?e:[]}function jC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)||i.add(r)}),Array.from(i)}function qC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)&&i.delete(r)}),Array.from(i)}function XC(n){return(n==null?void 0:n.type)==="group"}function YC(n){const e=new Map;return n.forEach((i,r)=>{e.set(i.key,r)}),i=>{var r;return(r=e.get(i))!==null&&r!==void 0?r:null}}class UC extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function KC(n,e,i,r){return Jo(e.concat(n),i,r,!1)}function GC(n,e){const i=new Set;return n.forEach(r=>{const o=e.treeNodeMap.get(r);if(o!==void 0){let s=o.parent;for(;s!==null&&!(s.disabled||i.has(s.key));)i.add(s.key),s=s.parent}}),i}function ZC(n,e,i,r){const o=Jo(e,i,r,!1),s=Jo(n,i,r,!0),a=GC(n,i),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function Oa(n,e){const{checkedKeys:i,keysToCheck:r,keysToUncheck:o,indeterminateKeys:s,cascade:a,leafOnly:l,checkStrategy:c,allowNotLoaded:d}=n;if(!a)return r!==void 0?{checkedKeys:jC(i,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:qC(i,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(i),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let f;o!==void 0?f=ZC(o,i,e,d):r!==void 0?f=KC(r,i,e,d):f=Jo(i,e,d,!1);const h=c==="parent",p=c==="child"||l,m=f,g=new Set,b=Math.max.apply(null,Array.from(u.keys()));for(let y=b;y>=0;y-=1){const _=y===0,k=u.get(y);for(const x of k){if(x.isLeaf)continue;const{key:v,shallowLoaded:B}=x;if(p&&B&&x.children.forEach($=>{!$.disabled&&!$.isLeaf&&$.shallowLoaded&&m.has($.key)&&m.delete($.key)}),x.disabled||!B)continue;let w=!0,T=!1,C=!0;for(const $ of x.children){const E=$.key;if(!$.disabled){if(C&&(C=!1),m.has(E))T=!0;else if(g.has(E)){T=!0,w=!1;break}else if(w=!1,T)break}}w&&!C?(h&&x.children.forEach($=>{!$.disabled&&m.has($.key)&&m.delete($.key)}),m.add(v)):T&&g.add(v),_&&p&&m.has(v)&&m.delete(v)}}return{checkedKeys:Array.from(m),indeterminateKeys:Array.from(g)}}function Jo(n,e,i,r){const{treeNodeMap:o,getChildren:s}=e,a=new Set,l=new Set(n);return n.forEach(c=>{const d=o.get(c);d!==void 0&&Bf(d,u=>{if(u.disabled)return Ma.STOP;const{key:f}=u;if(!a.has(f)&&(a.add(f),l.add(f),HC(u.rawNode,s))){if(r)return Ma.STOP;if(!i)throw new UC}})}),l}function QC(n,{includeGroup:e=!1,includeSelf:i=!0},r){var o;const s=r.treeNodeMap;let a=n==null?null:(o=s.get(n))!==null&&o!==void 0?o:null;const l={keyPath:[],treeNodePath:[],treeNode:a};if(a!=null&&a.ignored)return l.treeNode=null,l;for(;a;)!a.ignored&&(e||!a.isGroup)&&l.treeNodePath.push(a),a=a.parent;return l.treeNodePath.reverse(),i||l.treeNodePath.pop(),l.keyPath=l.treeNodePath.map(c=>c.key),l}function JC(n){if(n.length===0)return null;const e=n[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function ev(n,e){const i=n.siblings,r=i.length,{index:o}=n;return e?i[(o+1)%r]:o===i.length-1?null:i[o+1]}function Nf(n,e,{loop:i=!1,includeDisabled:r=!1}={}){const o=e==="prev"?tv:ev,s={reverse:e==="prev"};let a=!1,l=null;function c(d){if(d!==null){if(d===n){if(!a)a=!0;else if(!n.disabled&&!n.isGroup){l=n;return}}else if((!d.disabled||r)&&!d.ignored&&!d.isGroup){l=d;return}if(d.isGroup){const u=za(d,s);u!==null?l=u:c(o(d,i))}else{const u=o(d,!1);if(u!==null)c(u);else{const f=nv(d);f!=null&&f.isGroup?c(o(f,i)):i&&c(o(d,!0))}}}}return c(n),l}function tv(n,e){const i=n.siblings,r=i.length,{index:o}=n;return e?i[(o-1+r)%r]:o===0?null:i[o-1]}function nv(n){return n.parent}function za(n,e={}){const{reverse:i=!1}=e,{children:r}=n;if(r){const{length:o}=r,s=i?o-1:0,a=i?-1:o,l=i?-1:1;for(let c=s;c!==a;c+=l){const d=r[c];if(!d.disabled&&!d.ignored)if(d.isGroup){const u=za(d,e);if(u!==null)return u}else return d}}return null}const iv={getChild(){return this.ignored?null:za(this)},getParent(){const{parent:n}=this;return n!=null&&n.isGroup?n.getParent():n},getNext(n={}){return Nf(this,"next",n)},getPrev(n={}){return Nf(this,"prev",n)}};function rv(n,e){const i=e?new Set(e):void 0,r=[];function o(s){s.forEach(a=>{r.push(a),!(a.isLeaf||!a.children||a.ignored)&&(a.isGroup||i===void 0||i.has(a.key))&&o(a.children)})}return o(n),r}function ov(n,e){const i=n.key;for(;e;){if(e.key===i)return!0;e=e.parent}return!1}var sv={};function Tf(n,e,i,r,o,s=null,a=0){const l=[];return n.forEach((c,d)=>{var u;sv.NODE_ENV!=="production"&&WC(c,o)&&console.error("[treemate]: node",c,"is invalid");const f=Object.create(r);if(f.rawNode=c,f.siblings=l,f.level=a,f.index=d,f.isFirstChild=d===0,f.isLastChild=d+1===n.length,f.parent=s,!f.ignored){const h=o(c);Array.isArray(h)&&(f.children=Tf(h,e,i,r,o,f,a+1))}l.push(f),e.set(f.key,f),i.has(a)||i.set(a,[]),(u=i.get(a))===null||u===void 0||u.push(f)}),l}function av(n,e={}){var i;const r=new Map,o=new Map,{getDisabled:s=LC,getIgnored:a=zC,getIsGroup:l=XC,getKey:c=OC}=e,d=(i=e.getChildren)!==null&&i!==void 0?i:AC,u=e.ignoreEmptyChildren?x=>{const v=d(x);return Array.isArray(v)?v.length?v:null:v}:d,f=Object.assign({get key(){return c(this.rawNode)},get disabled(){return s(this.rawNode)},get isGroup(){return l(this.rawNode)},get isLeaf(){return IC(this.rawNode,u)},get shallowLoaded(){return DC(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(x){return ov(this,x)}},iv),h=Tf(n,r,o,f,u);function p(x){if(x==null)return null;const v=r.get(x);return v&&!v.isGroup&&!v.ignored?v:null}function m(x){if(x==null)return null;const v=r.get(x);return v&&!v.ignored?v:null}function g(x,v){const B=m(x);return B?B.getPrev(v):null}function b(x,v){const B=m(x);return B?B.getNext(v):null}function y(x){const v=m(x);return v?v.getParent():null}function _(x){const v=m(x);return v?v.getChild():null}const k={treeNodes:h,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(x){return rv(h,x)},getNode:p,getPrev:g,getNext:b,getParent:y,getChild:_,getFirstAvailableNode(){return JC(h)},getPath(x,v={}){return QC(x,v,k)},getCheckedKeys(x,v={}){const{cascade:B=!0,leafOnly:w=!1,checkStrategy:T="all",allowNotLoaded:C=!1}=v;return Oa({checkedKeys:Ia(x),indeterminateKeys:Aa(x),cascade:B,leafOnly:w,checkStrategy:T,allowNotLoaded:C},k)},check(x,v,B={}){const{cascade:w=!0,leafOnly:T=!1,checkStrategy:C="all",allowNotLoaded:$=!1}=B;return Oa({checkedKeys:Ia(v),indeterminateKeys:Aa(v),keysToCheck:x==null?[]:Sf(x),cascade:w,leafOnly:T,checkStrategy:C,allowNotLoaded:$},k)},uncheck(x,v,B={}){const{cascade:w=!0,leafOnly:T=!1,checkStrategy:C="all",allowNotLoaded:$=!1}=B;return Oa({checkedKeys:Ia(v),indeterminateKeys:Aa(v),keysToUncheck:x==null?[]:Sf(x),cascade:w,leafOnly:T,checkStrategy:C,allowNotLoaded:$},k)},getNonLeafKeys(x={}){return MC(h,x)}};return k}function es(n){return n.composedPath()[0]}const lv={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function cv(n,e,i){if(n==="mousemoveoutside"){const r=o=>{e.contains(es(o))||i(o)};return{mousemove:r,touchstart:r}}else if(n==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(es(a))},s=a=>{r&&(e.contains(es(a))||i(a))};return{mousedown:o,mouseup:s,touchstart:o,touchend:s}}return console.error(`[evtd/create-trap-handler]: name \`${n}\` is invalid. This could be a bug of evtd.`),{}}function $f(n,e,i){const r=lv[n];let o=r.get(e);o===void 0&&r.set(e,o=new WeakMap);let s=o.get(i);return s===void 0&&o.set(i,s=cv(n,e,i)),s}function dv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=$f(n,e,i);return Object.keys(o).forEach(s=>{At(s,document,o[s],r)}),!0}return!1}function uv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=$f(n,e,i);return Object.keys(o).forEach(s=>{ht(s,document,o[s],r)}),!0}return!1}function fv(){if(typeof window>"u")return{on:()=>{},off:()=>{}};const n=new WeakMap,e=new WeakMap;function i(){n.set(this,!0)}function r(){n.set(this,!0),e.set(this,!0)}function o(w,T,C){const $=w[T];return w[T]=function(){return C.apply(w,arguments),$.apply(w,arguments)},w}function s(w,T){w[T]=Event.prototype[T]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var w;return(w=a.get(this))!==null&&w!==void 0?w:null}function d(w,T){l!==void 0&&Object.defineProperty(w,"currentTarget",{configurable:!0,enumerable:!0,get:T??l.get})}const u={bubble:{},capture:{}},f={};function h(){const w=function(T){const{type:C,eventPhase:$,bubbles:E}=T,I=es(T);if($===2)return;const R=$===1?"capture":"bubble";let O=I;const U=[];for(;O===null&&(O=window),U.push(O),O!==window;)O=O.parentNode||null;const Q=u.capture[C],G=u.bubble[C];if(o(T,"stopPropagation",i),o(T,"stopImmediatePropagation",r),d(T,c),R==="capture"){if(Q===void 0)return;for(let W=U.length-1;W>=0&&!n.has(T);--W){const D=U[W],L=Q.get(D);if(L!==void 0){a.set(T,D);for(const z of L){if(e.has(T))break;z(T)}}if(W===0&&!E&&G!==void 0){const z=G.get(D);if(z!==void 0)for(const P of z){if(e.has(T))break;P(T)}}}}else if(R==="bubble"){if(G===void 0)return;for(let W=0;W<U.length&&!n.has(T);++W){const D=U[W],L=G.get(D);if(L!==void 0){a.set(T,D);for(const z of L){if(e.has(T))break;z(T)}}}}s(T,"stopPropagation"),s(T,"stopImmediatePropagation"),d(T)};return w.displayName="evtdUnifiedHandler",w}function p(){const w=function(T){const{type:C,eventPhase:$}=T;if($!==2)return;const E=f[C];E!==void 0&&E.forEach(I=>I(T))};return w.displayName="evtdUnifiedWindowEventHandler",w}const m=h(),g=p();function b(w,T){const C=u[w];return C[T]===void 0&&(C[T]=new Map,window.addEventListener(T,m,w==="capture")),C[T]}function y(w){return f[w]===void 0&&(f[w]=new Set,window.addEventListener(w,g)),f[w]}function _(w,T){let C=w.get(T);return C===void 0&&w.set(T,C=new Set),C}function k(w,T,C,$){const E=u[T][C];if(E!==void 0){const I=E.get(w);if(I!==void 0&&I.has($))return!0}return!1}function x(w,T){const C=f[w];return!!(C!==void 0&&C.has(T))}function v(w,T,C,$){let E;if(typeof $=="object"&&$.once===!0?E=Q=>{B(w,T,E,$),C(Q)}:E=C,dv(w,T,E,$))return;const R=$===!0||typeof $=="object"&&$.capture===!0?"capture":"bubble",O=b(R,w),U=_(O,T);if(U.has(E)||U.add(E),T===window){const Q=y(w);Q.has(E)||Q.add(E)}}function B(w,T,C,$){if(uv(w,T,C,$))return;const I=$===!0||typeof $=="object"&&$.capture===!0,R=I?"capture":"bubble",O=b(R,w),U=_(O,T);if(T===window&&!k(T,I?"bubble":"capture",w,C)&&x(w,C)){const G=f[w];G.delete(C),G.size===0&&(window.removeEventListener(w,g),f[w]=void 0)}U.has(C)&&U.delete(C),U.size===0&&O.delete(T),O.size===0&&(window.removeEventListener(w,m,R==="capture"),u[R][w]=void 0)}return{on:v,off:B}}const{on:At,off:ht}=fv(),fr="@@mmoContext",hv={mounted(n,{value:e}){n[fr]={handler:void 0},typeof e=="function"&&(n[fr].handler=e,At("mousemoveoutside",n,e))},updated(n,{value:e}){const i=n[fr];typeof e=="function"?i.handler?i.handler!==e&&(ht("mousemoveoutside",n,i.handler),i.handler=e,At("mousemoveoutside",n,e)):(n[fr].handler=e,At("mousemoveoutside",n,e)):i.handler&&(ht("mousemoveoutside",n,i.handler),i.handler=void 0)},unmounted(n){const{handler:e}=n[fr];e&&ht("mousemoveoutside",n,e),n[fr].handler=void 0}},hr="@@coContext",ts={mounted(n,{value:e,modifiers:i}){n[hr]={handler:void 0},typeof e=="function"&&(n[hr].handler=e,At("clickoutside",n,e,{capture:i.capture}))},updated(n,{value:e,modifiers:i}){const r=n[hr];typeof e=="function"?r.handler?r.handler!==e&&(ht("clickoutside",n,r.handler,{capture:i.capture}),r.handler=e,At("clickoutside",n,e,{capture:i.capture})):(n[hr].handler=e,At("clickoutside",n,e,{capture:i.capture})):r.handler&&(ht("clickoutside",n,r.handler,{capture:i.capture}),r.handler=void 0)},unmounted(n,{modifiers:e}){const{handler:i}=n[hr];i&&ht("clickoutside",n,i,{capture:e.capture}),n[hr].handler=void 0}};function mv(n,e){console.error(`[vdirs/${n}]: ${e}`)}class pv{constructor(){this.elementZIndex=new Map,this.nextZIndex=2e3}get elementCount(){return this.elementZIndex.size}ensureZIndex(e,i){const{elementZIndex:r}=this;if(i!==void 0){e.style.zIndex=`${i}`,r.delete(e);return}const{nextZIndex:o}=this;r.has(e)&&r.get(e)+1===this.nextZIndex||(e.style.zIndex=`${o}`,r.set(e,o),this.nextZIndex=o+1,this.squashState())}unregister(e,i){const{elementZIndex:r}=this;r.has(e)?r.delete(e):i===void 0&&mv("z-index-manager/unregister-element","Element not found when unregistering."),this.squashState()}squashState(){const{elementCount:e}=this;e||(this.nextZIndex=2e3),this.nextZIndex-e>2500&&this.rearrange()}rearrange(){const e=Array.from(this.elementZIndex.entries());e.sort((i,r)=>i[1]-r[1]),this.nextZIndex=2e3,e.forEach(i=>{const r=i[0],o=this.nextZIndex++;`${o}`!==r.style.zIndex&&(r.style.zIndex=`${o}`)})}}const Da=new pv,mr="@@ziContext",Ef={mounted(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i;n[mr]={enabled:!!o,initialized:!1},o&&(Da.ensureZIndex(n,r),n[mr].initialized=!0)},updated(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i,s=n[mr].enabled;o&&!s&&(Da.ensureZIndex(n,r),n[mr].initialized=!0),n[mr].enabled=!!o},unmounted(n,e){if(!n[mr].initialized)return;const{value:i={}}=e,{zIndex:r}=i;Da.unregister(n,r)}};function gv(n){const e=t.ref(!!n.value);if(e.value)return t.readonly(e);const i=t.watch(n,r=>{r&&(e.value=!0,i())});return t.readonly(e)}function an(n){const e=t.computed(n),i=t.ref(e.value);return t.watch(e,r=>{i.value=r}),typeof n=="function"?i:{__v_isRef:!0,get value(){return i.value},set value(r){n.set(r)}}}const yv=typeof window<"u";let pr,Hr;(()=>{var n,e;pr=yv?(e=(n=document)===null||n===void 0?void 0:n.fonts)===null||e===void 0?void 0:e.ready:void 0,Hr=!1,pr!==void 0?pr.then(()=>{Hr=!0}):Hr=!0})();function bv(n){if(Hr)return;let e=!1;t.onMounted(()=>{Hr||pr==null||pr.then(()=>{e||n()})}),t.onBeforeUnmount(()=>{e=!0})}function La(n,e){return t.watch(n,i=>{i!==void 0&&(e.value=i)}),t.computed(()=>n.value===void 0?e.value:n.value)}function ns(){const n=t.ref(!1);return t.onMounted(()=>{n.value=!0}),t.readonly(n)}function Rf(n,e){return t.computed(()=>{for(const i of e)if(n[i]!==void 0)return n[i];return n[e[e.length-1]]})}const _v=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function wv(){return _v}function Ha(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);return r()}function Wa(n,e=!0,i=[]){return n.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&i.push(t.createTextVNode(String(r)));return}if(Array.isArray(r)){Wa(r,e,i);return}if(r.type===t.Fragment){if(r.children===null)return;Array.isArray(r.children)&&Wa(r.children,e,i)}else r.type!==t.Comment&&i.push(r)}}),i}function Pf(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);const o=Wa(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${n}]: slot[${i}] should have exactly one child.`)}let mi=null;function Ff(){if(mi===null&&(mi=document.getElementById("v-binder-view-measurer"),mi===null)){mi=document.createElement("div"),mi.id="v-binder-view-measurer";const{style:n}=mi;n.position="fixed",n.left="0",n.right="0",n.top="0",n.bottom="0",n.pointerEvents="none",n.visibility="hidden",document.body.appendChild(mi)}return mi.getBoundingClientRect()}function xv(n,e){const i=Ff();return{top:e,left:n,height:0,width:0,right:i.width-n,bottom:i.height-e}}function ja(n){const e=n.getBoundingClientRect(),i=Ff();return{left:e.left-i.left,top:e.top-i.top,bottom:i.height+i.top-e.bottom,right:i.width+i.left-e.right,width:e.width,height:e.height}}function kv(n){return n.nodeType===9?null:n.parentNode}function Vf(n){if(n===null)return null;const e=kv(n);if(e===null)return null;if(e.nodeType===9)return document;if(e.nodeType===1){const{overflow:i,overflowX:r,overflowY:o}=getComputedStyle(e);if(/(auto|scroll|overlay)/.test(i+o+r))return e}return Vf(e)}const Mf=t.defineComponent({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(n){var e;t.provide("VBinder",(e=t.getCurrentInstance())===null||e===void 0?void 0:e.proxy);const i=t.inject("VBinder",null),r=t.ref(null),o=y=>{r.value=y,i&&n.syncTargetWithParent&&i.setTargetRef(y)};let s=[];const a=()=>{let y=r.value;for(;y=Vf(y),y!==null;)s.push(y);for(const _ of s)At("scroll",_,f,!0)},l=()=>{for(const y of s)ht("scroll",y,f,!0);s=[]},c=new Set,d=y=>{c.size===0&&a(),c.has(y)||c.add(y)},u=y=>{c.has(y)&&c.delete(y),c.size===0&&l()},f=()=>{_f(h)},h=()=>{c.forEach(y=>y())},p=new Set,m=y=>{p.size===0&&At("resize",window,b),p.has(y)||p.add(y)},g=y=>{p.has(y)&&p.delete(y),p.size===0&&ht("resize",window,b)},b=()=>{p.forEach(y=>y())};return t.onBeforeUnmount(()=>{ht("resize",window,b),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:m,removeResizeListener:g}},render(){return Ha("binder",this.$slots)}}),If=t.defineComponent({name:"Target",setup(){const{setTargetRef:n,syncTarget:e}=t.inject("VBinder");return{syncTarget:e,setTargetDirective:{mounted:n,updated:n}}},render(){const{syncTarget:n,setTargetDirective:e}=this;return n?t.withDirectives(Pf("follower",this.$slots),[[e]]):Pf("follower",this.$slots)}}),Cv="@css-render/vue3-ssr";function vv(n,e){return`<style cssr-id="${n}">
104
104
  ${e}
105
105
  </style>`}function Sv(n,e,i){const{styles:r,ids:o}=i;o.has(n)||r!==null&&(o.add(n),r.push(vv(n,e)))}const Bv=typeof document<"u";function Fi(){if(Bv)return;const n=t.inject(Cv,null);if(n!==null)return{adapter:(e,i)=>Sv(e,i,n),context:n}}function Af(n,e){console.error(`[vueuc/${n}]: ${e}`)}function Nv(n){let e=0;for(let i=0;i<n.length;++i)n[i]==="&"&&++e;return e}const Of=/\s*,(?![^(]*\))\s*/g,Tv=/\s+/g;function $v(n,e){const i=[];return e.split(Of).forEach(r=>{let o=Nv(r);if(o){if(o===1){n.forEach(a=>{i.push(r.replace("&",a))});return}}else{n.forEach(a=>{i.push((a&&a+" ")+r)});return}let s=[r];for(;o--;){const a=[];s.forEach(l=>{n.forEach(c=>{a.push(l.replace("&",c))})}),s=a}s.forEach(a=>i.push(a))}),i}function Ev(n,e){const i=[];return e.split(Of).forEach(r=>{n.forEach(o=>{i.push((o&&o+" ")+r)})}),i}function Rv(n){let e=[""];return n.forEach(i=>{i=i&&i.trim(),i&&(i.includes("&")?e=$v(e,i):e=Ev(e,i))}),e.join(", ").replace(Tv," ")}function zf(n){if(!n)return;const e=n.parentElement;e&&e.removeChild(n)}function is(n,e){return(e??document.head).querySelector(`style[cssr-id="${n}"]`)}function Pv(n){const e=document.createElement("style");return e.setAttribute("cssr-id",n),e}function rs(n){return n?/^\s*@(s|m)/.test(n):!1}const Fv=/[A-Z]/g;function Df(n){return n.replace(Fv,e=>"-"+e.toLowerCase())}function Vv(n,e=" "){return typeof n=="object"&&n!==null?` {
106
106
  `+Object.entries(n).map(i=>e+` ${Df(i[0])}: ${i[1]};`).join(`