@snabcentr/vue-ui-lib 5.7.4 → 5.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
}
|
|
101
101
|
gl_FragColor = texel;
|
|
102
102
|
}
|
|
103
|
-
`}},Ao=Ni.Multiply,D0=[1,0,0,0,1,0,0,0,1],hi=new Bn(9),L0=Tt.Utils,Od=new ie,ya=new Bn([0,0,1,0,0,1,0,1,1,0,1,1]),Be={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Je.document?Je.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new Ni,group:{removeChild:function(n,e){if(n.children)for(let i=0;i<n.children.length;i++)Be.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;re.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 Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,i._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie),this._scale instanceof ie?(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=Tt.Utils.getRendererType(this._mask._renderer.type);Be[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++)Be.group.removeChild(this.subtractions[s],n);for(s=0;s<this.children.length;s++){const a=this.children[s],l=Tt.Utils.getRendererType(a._renderer.type);Be[l].render.call(a,n,e)}return this._mask&&n.disable(n.STENCIL_TEST),re.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,x=n.renderer.ratio,w=Od.copy(e._renderer.scale).multiply(x),C=e._stroke,N=e._linewidth,k=e._fill,$=e._renderer.opacity||e._opacity,v=e._cap,E=e._join,P=e._miter,F=e._closed,R=e.dashes,M=b.length,X=M-1;y.width=Math.max(Math.ceil(e._renderer.rect.width*w.x),1),y.height=Math.max(Math.ceil(e._renderer.rect.height*w.y),1);const G=e._renderer.rect.centroid,Z=G.x,O=G.y;if(_.clearRect(0,0,y.width,y.height),k)if(typeof k=="string")_.fillStyle=k;else{const q=Tt.Utils.getRendererType(k._renderer.type);Be[q].render.call(k,_,e),_.fillStyle=k._renderer.effect}if(C){if(typeof C=="string")_.strokeStyle=C;else{const q=Tt.Utils.getRendererType(C._renderer.type);Be[q].render.call(C,_,e),_.strokeStyle=C._renderer.effect}N&&(_.lineWidth=Nn(e)),P&&(_.miterLimit=P),E&&(_.lineJoin=E),!F&&v&&(_.lineCap=v)}typeof $=="number"&&(_.globalAlpha=$),R&&R.length>0&&(_.lineDashOffset=R.offset||0,_.setLineDash(R));let A,Y,H,T,D,K,J,U;_.save(),_.scale(w.x,w.y),_.translate(Z,O),_.beginPath();for(let q=0;q<b.length;q++){const L=b[q];switch(p=L.x,m=L.y,L.command){case ne.close:_.closePath();break;case ne.arc:Y=L.rx,H=L.ry,T=L.xAxisRotation,D=L.largeArcFlag,K=L.sweepFlag,i=F?ut(q-1,M):Math.max(q-1,0),r=b[i],J=r.x,U=r.y,L0.renderSvgArcCommand(_,J,U,Y,H,D,K,T,p,m);break;case ne.curve:i=F?ut(q-1,M):Math.max(q-1,0),r=b[i],d=r.controls&&r.controls.right||ie.zero,u=L.controls&&L.controls.left||ie.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),L._relative?(s=u.x+L.x,a=u.y+L.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,p,m),q>=X&&F&&(o=A,f=L.controls&&L.controls.right||ie.zero,h=o.controls&&o.controls.left||ie.zero,L._relative?(l=f.x+L.x,c=f.y+L.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:A=L,_.moveTo(p,m);break}}F&&_.closePath(),Be.isHidden.test(k)||(g=k._renderer&&k._renderer.offset,g&&(_.save(),_.translate(-k._renderer.offset.x,-k._renderer.offset.y),_.scale(k._renderer.scale.x,k._renderer.scale.y)),_.fill(),g&&_.restore()),Be.isHidden.test(C)||(g=C._renderer&&C._renderer.offset,g&&(_.save(),_.translate(-C._renderer.offset.x,-C._renderer.offset.y),_.scale(C._renderer.scale.x,C._renderer.scale.y),_.lineWidth=N/C._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;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=i||this.parent,o=Tt.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 et&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof tt&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof De&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof et&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof tt&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof De&&(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 Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie);let f,h;this._scale instanceof ie?(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=Tt.Utils.getRendererType(this._mask._renderer.type);Be[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,Be.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),Be.updateTexture.call(Be,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,ya,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),re.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;Be.isHidden.test(a)||(h+=l),r.width=vc(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=Tt.Utils.getRendererType(c._renderer.type);Be[b].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const b=Tt.Utils.getRendererType(a._renderer.type);Be[b].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=Nn(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(Be.precision,Be.precision),o.beginPath(),o.arc(0,0,f/p*.5,0,ot),o.restore(),closed&&o.closePath(),Be.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()),Be.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;re.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 et&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof tt&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof De&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof et&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof tt&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof De&&(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 Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,o._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie);let b,y;this._scale instanceof ie?(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,Be.updateTexture.call(Be,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:(Be.isHidden.test(l)||(r+=c),r/=Be.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),re.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=Od.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,_,x,w,C,N,k,$,v,E;const P=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,i.width,i.height),P||(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 F=Tt.Utils.getRendererType(c._renderer.type);Be[F].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const F=Tt.Utils.getRendererType(a._renderer.type);Be[F].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=Nn(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),Be.isHidden.test(c)||(c._renderer&&c._renderer.offset?(C=c._renderer.scale.x,N=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(C,N),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,x=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,x),r.restore()):r.fillText(e.value,0,0)),Be.isHidden.test(a)||(a._renderer&&a._renderer.offset?(C=a._renderer.scale.x,N=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(C,N),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,x=a._renderer.offset.y/a._renderer.scale.y,w=l/a._renderer.scale.x,r.lineWidth=w,r.strokeText(e.value,_,x),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(f)){const F=r.measureText(e.value);switch(f){case"underline":$=F.actualBoundingBoxDescent,E=F.actualBoundingBoxDescent;break;case"strikethrough":$=0,E=0;break}k=-F.width/2,v=F.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(k,$),r.lineTo(v,E),r.stroke()}r.restore()},getBoundingClientRect:function(n,e){const i=Be.ctx;i.font=[n._style,n._weight,n._size+"px/"+n._leading+"px",n._family].join(" "),i.textAlign="center",i.textBaseline=Tt.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&&!Be.isHidden.test(this._stroke)&&(o+=this._linewidth*2,s+=this._linewidth*2);const a=o/2,l=s/2;switch(Be.alignments[n._alignment]||n._alignment){case Be.alignments.left:n.direction==="ltr"?(e.left=0,e.right=o):(e.left=-o,e.right=0);break;case Be.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;re.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 et&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof tt&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof De&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof et&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof tt&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof De&&(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 Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie);let u,f;this._scale instanceof ie?(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=Tt.Utils.getRendererType(this._mask._renderer.type);Be[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,Be.text.getBoundingClientRect(this,this._renderer.rect),Be.updateTexture.call(Be,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,ya,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),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(re.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 re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(re.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 re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(n,e){if(!n.canvas.getContext("2d"))return;re.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 ie||(this._renderer.offset=new ie),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 ie?(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 ie||(this._renderer.scale=new ie);let r,o;this._scale instanceof ie?(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 re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(n,e){const i=Tt.Utils.getRendererType(e._renderer.type);if(this[i].updateCanvas.call(Be,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(),re.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 Yt("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]=Be.extensions.get(n,o)}return e},get:function(n,e){return n.getExtension(e)||n.getExtension(`MOZ_${e}`)||n.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new bo};Be.ctx=Be.canvas.getContext("2d");var zd=class extends ee{constructor(n){super();let e,i,r,o;if(this.domElement=n.domElement||document.createElement("canvas"),typeof n.offscreenElement<"u"&&(Be.canvas=n.offscreenElement,Be.ctx=Be.canvas.getContext("2d")),this.scene=new xt,this.scene.parent=this,this._renderer={type:"renderer",matrix:new Bn(D0),scale:1,opacity:1},this._flagMatrix=!0,n=re.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 Yt("unable to create a webgl context. Try using another renderer.");r=un.create(e,un.path.vertex,un.types.vertex),o=un.create(e,un.path.fragment,un.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},i=this.programs.path=Be.program.create(e,[r,o]),this.programs.text=this.programs.path,e.extensions=Be.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,ya,e.STATIC_DRAW),r=un.create(e,un.points.vertex,un.types.vertex),o=un.create(e,un.points.fragment,un.types.fragment),i=this.programs.points=Be.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"?qs(s):i,this.domElement.width=n*this.ratio,this.domElement.height=e*this.ratio,re.isObject(this.domElement.style)&&re.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),Be.group.render.call(this.scene,n,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};S(zd,"Utils",Be);var H0=re.extend({Error:Yt,getRatio:qs,read:Ze,xhr:Pd},re,At,wc,xc),Te=class ao{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=re.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:ao.Types.svg,autostart:!1});if(re.each(i,function(r,o){/fullscreen/i.test(o)||/autostart/i.test(o)||(this[o]=r)},this),re.isElement(i.domElement)){const r=i.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=ao.Types[r])}this.renderer=new ao[this.type](this),this.setPlaying(i.autostart),this.frameCount=0,i.fullscreen?(this.fit=W0.bind(this),this.fit.domElement=window,this.fit.attached=!0,re.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),re.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),tn.bind(this.fit.domElement,"resize",this.fit),this.fit()):i.fitted?(this.fit=j0.bind(this),re.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,q0.bind(this)),this.scene=this.renderer.scene,ao.Instances.push(this),i.autostart&&Ar.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,Ar.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=re.performance.now();e&&(this.timeDelta=parseFloat((i-this._lastFrame).toFixed(3))),this._lastFrame=i,this.fit&&this.fit.domElement&&!this.fit.attached&&(tn.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 Po(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 fi(e,i,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,i,r,o,s){const a=new $o(e,i,r,o,s);return this.scene.add(a),a}makeCircle(e,i,r,o){const s=new No(e,i,r,o);return this.scene.add(s),s}makeEllipse(e,i,r,o,s){const a=new To(e,i,r,o,s);return this.scene.add(a),a}makeStar(e,i,r,o,s){const a=new la(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 aa(e,i,r,o);return this.scene.add(s),s}makeArcSegment(e,i,r,o,s,a,l){const c=new ta(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 ie(a,l))}}const o=new sa(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 Tn(e,i,r,o);return this.add(s),s}makeLinearGradient(e,i,r,o){const s=Array.prototype.slice.call(arguments,4),a=new et(e,i,r,o,s);return this.add(a),a}makeRadialGradient(e,i,r){const o=Array.prototype.slice.call(arguments,3),s=new tt(e,i,r,o);return this.add(s),s}makeSprite(e,i,r,o,s,a,l){const c=new Bo(e,i,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,i,r,o,s,a){const l=new Fd(e,i,r,o,s,a);return this.add(l),l}makeImageSequence(e,i,r,o,s){const a=new fa(e,i,r,o);return s&&a.play(),this.add(a),a}makeTexture(e,i){return new De(e,i)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const i=new xt;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 Ze))return null;const s=Ze[o].call(this,e);return r?this.add(i&&s instanceof xt?s.children:s):s.parent&&s.remove(),s}load(e,i){const r=new xt;let o,s,a;const l=(function(c){for(tn.temp.innerHTML=c,s=0;s<tn.temp.children.length;s++)o=tn.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof i=="function"){const d=tn.temp.children.length<=1?tn.temp.children[0]:tn.temp.children;i(r,d)}}).bind(this);return/\.svg$/i.test(e)?(Pd(e,l),r):(l(e),r)}};S(Te,"NextFrameId",Bt.NextFrameId),S(Te,"Types",Bt.Types),S(Te,"Version",Bt.Version),S(Te,"PublishDate",Bt.PublishDate),S(Te,"Identifier",Bt.Identifier),S(Te,"Resolution",Bt.Resolution),S(Te,"AutoCalculateImportedMatrices",Bt.AutoCalculateImportedMatrices),S(Te,"Instances",Bt.Instances),S(Te,"uniqueId",Bt.uniqueId),S(Te,"Anchor",Ee),S(Te,"Collection",di),S(Te,"Events",ee),S(Te,"Group",xt),S(Te,"Matrix",Ni),S(Te,"Path",Pe),S(Te,"Registry",bo),S(Te,"Element",sr),S(Te,"Shape",qn),S(Te,"Text",Tn),S(Te,"Vector",ie),S(Te,"Gradient",pt),S(Te,"Image",Fd),S(Te,"ImageSequence",fa),S(Te,"LinearGradient",et),S(Te,"RadialGradient",tt),S(Te,"Sprite",Bo),S(Te,"Stop",ui),S(Te,"Texture",De),S(Te,"ArcSegment",ta),S(Te,"Circle",No),S(Te,"Ellipse",To),S(Te,"Line",Po),S(Te,"Points",sa),S(Te,"Polygon",aa),S(Te,"Rectangle",fi),S(Te,"RoundedRectangle",$o),S(Te,"Star",la),S(Te,"CanvasRenderer",Tt),S(Te,"SVGRenderer",Ad),S(Te,"WebGLRenderer",zd),S(Te,"Commands",ne),S(Te,"Utils",H0);var En=Te;function W0(){const n=document.body.getBoundingClientRect(),e=this.width=n.width,i=this.height=n.height;this.renderer.setSize(e,i,this.ratio)}function j0(){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 q0(n,e){this.width=n,this.height=e,this.trigger(ee.Types.resize,n,e)}var Ar=tn.getRequestAnimationFrame();function Dd(){for(let n=0;n<En.Instances.length;n++){const e=En.Instances[n];e.playing&&e.update()}En.NextFrameId=Ar(Dd)}Ar.init=function(){Dd(),Ar.init=function(){}};let Rn;typeof window<"u"?Rn=window:typeof global<"u"?Rn=global:typeof self<"u"&&(Rn=self);let Ld;const nn=Math.PI*2,kt=Math.PI*.5;function X0(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 Y0(n){Ld=n}function U0(n,e){e=e&&e.identity()||new Ld;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 Kt(n,e,i){return i*(e-n)+n}function Gt(n,e){for(;n<0;)n+=e;return n%e}const Hd=Rn.Float32Array||Array,K0=Math.floor;function Pn(n){return K0(n*1e6)/1e6}const me={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};class te{constructor(){B(this,"_events",{});B(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}}B(te,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),B(te,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Wd={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))}}},vt=class vt extends te{constructor(i=0,r=0){super();B(this,"_x",0);B(this,"_y",0);for(let o in Wd)Object.defineProperty(this,o,Wd[o]);this.x=i,this.y=r}static add(i,r){return new vt(i.x+r.x,i.y+r.y)}static sub(i,r){return new vt(i.x-r.x,i.y-r.y)}static subtract(i,r){return vt.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(vt.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 vt(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:Pn(this.x),y:Pn(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}};B(vt,"zero",new vt),B(vt,"left",new vt(-1,0)),B(vt,"right",new vt(1,0)),B(vt,"up",new vt(0,-1)),B(vt,"down",new vt(0,1));let be=vt;class Ae extends be{constructor(i=0,r=0,o=0,s=0,a=0,l=0,c=me.move){super(i,r);B(this,"controls",{left:new be,right:new be});B(this,"_command",me.move);B(this,"_relative",!0);B(this,"_rx",0);B(this,"_ry",0);B(this,"_xAxisRotation",0);B(this,"_largeArcFlag",0);B(this,"_sweepFlag",1);for(let u in jd)Object.defineProperty(this,u,jd[u]);this.command=c,this.relative=!0;const d=Ae.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 Ae().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 Ae().copy(this)}toObject(){return{x:Pn(this.x),y:Pn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Pn(this.rx),ry:Pn(this.ry),xAxisRotation:Pn(this.xAxisRotation),largeArcFlag:Pn(this.largeArcFlag),sweepFlag:Pn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const jd={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 G0=0;const Oo={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return G0++}},zo={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 Do(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 qd(n,e,i,r,o,s,a,l,c){c=c||zo.RecursionLimit;const d=c+1;if(Math.abs(n-a)<.001&&Math.abs(e-l)<.001)return[new Ae(a,l)];const u=[];for(let f=0;f<d;f++){const h=f/d,p=Do(h,n,i,o,a),m=Do(h,e,r,s,l);u.push(new Ae(p,m))}return u}function Z0(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 J0(g,0,1,c||zo.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 C=0;C<2;++C){if(C===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,x=_,w;for(;_--;)p=c[_],w=1-p,d[0][_]=w*w*w*n+3*w*w*p*i+3*w*p*p*o+p*p*p*a,d[1][_]=w*w*w*e+3*w*w*p*r+3*w*p*p*s+p*p*p*l;return d[0][x]=n,d[1][x]=e,d[0][x+1]=a,d[1][x+1]=l,d[0].length=d[1].length=x+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 J0(n,e,i,r){let o=zo.abscissas[r-2],s=zo.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 e1(n,e){const i=n.length,r=i-1;for(let o=0;o<i;o++){const s=n[o],a=e?Gt(o-1,i):Math.max(o-1,0),l=e?Gt(o+1,i):Math.min(o+1,r),c=n[a],d=s,u=n[l];t1(c,d,u),d.command=o===0?me.move:me.curve}}function t1(n,e,i){const r=be.angleBetween(n,e),o=be.angleBetween(i,e);let s=be.distanceBetween(n,e),a=be.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+=kt:l-=kt,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 Or=(qi=class extends te{constructor(){super();B(this,"_flagId",!1);B(this,"_flagClassName",!1);B(this,"_renderer",{});B(this,"_id",Oo.Identifier+Oo.uniqueId());B(this,"_className","");B(this,"classList",[]);for(let i in Xd)Object.defineProperty(this,i,Xd[i])}static fromObject(i){const r=new qi().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}},B(qi,"Properties",["renderer","id","className"]),qi);const Xd={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 Lo extends Error{constructor(i){super();B(this,"name","Two.js");B(this,"message");this.message=i}}class n1{constructor(){B(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 Ho;const Yd={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Rn.document&&(Ho=document.createElement("a"));const it=class it extends Or{constructor(i,r){super();B(this,"_flagSrc",!1);B(this,"_flagImage",!1);B(this,"_flagVideo",!1);B(this,"_flagLoaded",!1);B(this,"_flagRepeat",!1);B(this,"_flagOffset",!1);B(this,"_flagScale",!1);B(this,"_src","");B(this,"_image",null);B(this,"_loaded",!1);B(this,"_repeat","no-repeat");B(this,"_scale",1);B(this,"_offset",null);for(let o in Ud)Object.defineProperty(this,o,Ud[o]);if(this._renderer.type="texture",this._renderer.flagOffset=i1.bind(this),this._renderer.flagScale=r1.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new be,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 it().copy(i);return"id"in i&&(r.id=i.id),r}static getAbsoluteURL(i){return Ho?(Ho.href=i,Ho.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=it.getAbsoluteURL(i);if(it.ImageRegistry.contains(r))return it.ImageRegistry.get(r);let o;return Rn.document?Yd.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=it.getTag(o);i._flagImage&&(/canvas/i.test(s)?it.Register.canvas(i,r):(i._src=o.getAttribute("two-src")||o.src,it.Register[s](i,r))),i._flagSrc&&(o||(o=it.getImage(i.src),i.image=o),s=it.getTag(o),it.Register[s](i,r))}clone(){const i=new it(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 be?i.offset:new be().copy(i.offset),this.scale=typeof i.scale=="number"||i.scale instanceof be?i.scale:new be().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,it.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}};B(it,"Properties",["src","loaded","repeat","scale","offset","image"]),B(it,"RegularExpressions",Yd),B(it,"ImageRegistry",new n1),B(it,"Register",{canvas:function(i,r){i._src="#"+i.id,it.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 Lo("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=it.getAbsoluteURL(i._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",i.src),it.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 Lo("unable to load "+i.src)};i._src=it.getAbsoluteURL(i._src),i.image.getAttribute("two-src")||(i.image.setAttribute("two-src",i.src),it.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 nt=it;const Ud={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=nt.getTag(n);let i;switch(e){case"canvas":i="#"+n.id;break;default:i=n.src}nt.ImageRegistry.contains(i)?this._image=nt.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 be&&this._scale.unbind(te.Types.change,this._renderer.flagScale),this._scale=n,this._scale instanceof be&&this._scale.bind(te.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function i1(){this._flagOffset=!0}function r1(){this._flagScale=!0}class Ti extends Array{constructor(){super();Hl(this,St,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 qt(this,St)}set _events(i){$m(this,St,i)}get _bound(){return qt(this,St)._bound}set _bound(i){qt(this,St)._bound=i}addEventListener(){var i;return(i=qt(this,St).addEventListener)==null?void 0:i.apply(this,arguments)}on(){var i;return(i=qt(this,St).on)==null?void 0:i.apply(this,arguments)}bind(){var i;return(i=qt(this,St).bind)==null?void 0:i.apply(this,arguments)}removeEventListener(){var i;return(i=qt(this,St).removeEventListener)==null?void 0:i.apply(this,arguments)}off(){var i;return(i=qt(this,St).off)==null?void 0:i.apply(this,arguments)}unbind(){var i;return(i=qt(this,St).unbind)==null?void 0:i.apply(this,arguments)}dispatchEvent(){var i;return(i=qt(this,St).dispatchEvent)==null?void 0:i.apply(this,arguments)}trigger(){var i;return(i=qt(this,St).trigger)==null?void 0:i.apply(this,arguments)}listen(){var i;return(i=qt(this,St).listen)==null?void 0:i.apply(this,arguments)}ignore(){var i;return(i=qt(this,St).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}}St=new WeakMap;const Kd=Array.prototype.slice;function o1(n){if(n==null)return!1;const e=n.length;return typeof e=="number"&&e>=0&&e<4294967296}const je={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=Kd.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=Kd.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=!o1(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:Rn.performance&&Rn.performance.now?Rn.performance:Date},Jt=class Jt extends Or{constructor(i,r,o){super();B(this,"_flagOffset",!0);B(this,"_flagOpacity",!0);B(this,"_flagColor",!0);B(this,"_offset",0);B(this,"_opacity",1);B(this,"_color","#fff");for(let s in Gd)Object.defineProperty(this,s,Gd[s]);this._renderer.type="stop",this.offset=typeof i=="number"?i:Jt.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:Jt.Index<=0?"#fff":"#000",Jt.Index=(Jt.Index+1)%2}static fromObject(i){const r=new Jt().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Jt.Properties.length;r++){const o=Jt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Jt;return je.each(Jt.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",je.each(Jt.Properties,r=>{i[r]=this[r]},this),i}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};B(Jt,"Index",0),B(Jt,"Properties",["offset","opacity","color"]);let $i=Jt;const Gd={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)}}},On=class On extends Or{constructor(i){super();B(this,"_flagStops",!1);B(this,"_flagSpread",!1);B(this,"_flagUnits",!1);B(this,"_spread","");B(this,"_units","");for(let r in Zd)Object.defineProperty(this,r,Zd[r]);this._renderer.type="gradient",this._renderer.flagStops=s1.bind(this),this._renderer.bindStops=a1.bind(this),this._renderer.unbindStops=l1.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 $i?s:new $i().copy(s)));const o=new On(r).copy(i);return"id"in i&&(o.id=i.id),o}clone(i){const r=this.stops.map(s=>s.clone()),o=new On(r);return je.each(On.Properties,s=>{o[s]=this[s]},this),i&&i.add(o),o}copy(i){super.copy.call(this,i);for(let r=0;r<On.Properties.length;r++){const o=On.Properties[r];o in i&&(this[o]=i[o])}return this}toObject(){const i={stops:this.stops.map(r=>r.toObject())};return je.each(On.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}};B(On,"Stop",$i),B(On,"Properties",["spread","stops","units"]);let gt=On;const Zd={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 Ti((n||[]).slice(0)),this._stops.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._stops)}}};function s1(){this._flagStops=!0}function a1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagStops),n[e].parent=this;this._renderer.flagStops()}function l1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagStops),delete n[e].parent;this._renderer.flagStops()}const _i=class _i extends gt{constructor(i,r,o,s,a){super(a);B(this,"_flagEndPoints",!1);B(this,"_left",null);B(this,"_right",null);for(let l in Qd)Object.defineProperty(this,l,Qd[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=c1.bind(this),this.left=new be,this.right=new be,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 _i().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<_i.Properties.length;r++){const o=_i.Properties[r];o in i&&(this[o]=i[o]instanceof be?i[o]:new be().copy(i[o]))}return this}clone(i){const r=this.stops.map(function(s){return s.clone()}),o=new _i(this.left._x,this.left._y,this.right._x,this.right._y,r);return je.each(gt.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}};B(_i,"Stop",$i),B(_i,"Properties",["left","right"]);let zt=_i;const Qd={left:{enumerable:!0,get:function(){return this._left},set:function(n){this._left instanceof be&&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 be&&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 c1(){this._flagEndPoints=!0}const zn=class zn extends gt{constructor(i,r,o,s,a,l){super(s);B(this,"_flagRadius",!1);B(this,"_flagCenter",!1);B(this,"_flagFocal",!1);B(this,"_radius",0);B(this,"_center",null);B(this,"_focal",null);for(let c in Jd)Object.defineProperty(this,c,Jd[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=d1.bind(this),this._renderer.flagFocal=u1.bind(this),this.center=new be,this.radius=typeof o=="number"?o:1,this.focal=new be,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 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&&(/(center|focal)i/.test(o)?this[o]=i[o]instanceof be?i[o]:new be().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 zn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return je.each(gt.Properties.concat(zn.Properties),function(s){o[s]=this[s]},this),i&&i.add(o),o}toObject(){const i=super.toObject.call(this);return je.each(zn.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}};B(zn,"Stop",$i),B(zn,"Properties",["center","radius","focal"]);let Dt=zn;const Jd={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 d1(){this._flagCenter=!0}function u1(){this._flagFocal=!0}function eu(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 Wo(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 tu(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),Z0(r,l,o,c,s,d,a,u,i)}function ba(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),qd(r,l,o,c,s,d,a,u,i)}function Ei(n){switch(n.renderer.type){case"texture":return nt.fromObject(n);case"gradient":return gt.fromObject(n);case"linear-gradient":return zt.fromObject(n);case"radial-gradient":return Dt.fromObject(n)}return n}const f1=Math.cos,h1=Math.sin,nu=Math.tan,_a=[],Ht=class Ht extends te{constructor(i,r,o,s,a,l){super();B(this,"elements",new Hd(9));B(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 k=i;let $,v,E;const P=r[0]||0,F=r[1]||0,R=r[2]||0;return $=k[0]*P+k[1]*F+k[2]*R,v=k[3]*P+k[4]*F+k[5]*R,E=k[6]*P+k[7]*F+k[8]*R,[$,v,E]}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],x=r[5],w=r[6],C=r[7],N=r[8];return o=o||new Hd(9),o[0]=s*m+a*y+l*w,o[1]=s*g+a*_+l*C,o[2]=s*b+a*x+l*N,o[3]=c*m+d*y+u*w,o[4]=c*g+d*_+u*C,o[5]=c*b+d*x+u*N,o[6]=f*m+h*y+p*w,o[7]=f*g+h*_+p*C,o[8]=f*b+h*x+p*N,o}static fromObject(i){return new Ht().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]=Ht.Identity[0],this.elements[1]=Ht.Identity[1],this.elements[2]=Ht.Identity[2],this.elements[3]=Ht.Identity[3],this.elements[4]=Ht.Identity[4],this.elements[5]=Ht.Identity[5],this.elements[6]=Ht.Identity[6],this.elements[7]=Ht.Identity[7],this.elements[8]=Ht.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 X=a[0]*i+a[1]*r+a[2]*o,G=a[3]*i+a[4]*r+a[5]*o,Z=a[6]*i+a[7]*r+a[8]*o;return[X,G,Z]}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],x=f[6],w=f[7],C=f[8],N=h[0],k=h[1],$=h[2],v=h[3],E=h[4],P=h[5],F=h[6],R=h[7],M=h[8];return this.elements[0]=p*N+m*v+g*F,this.elements[1]=p*k+m*E+g*R,this.elements[2]=p*$+m*P+g*M,this.elements[3]=b*N+y*v+_*F,this.elements[4]=b*k+y*E+_*R,this.elements[5]=b*$+y*P+_*M,this.elements[6]=x*N+w*v+C*F,this.elements[7]=x*k+w*E+C*R,this.elements[8]=x*$+w*P+C*M,this.trigger(te.Types.change)}inverse(i){const r=this.elements;i=i||new Ht;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=f1(i),o=h1(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=nu(i);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(i){const r=nu(i);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(i){return _a.length=0,this.toTransformArray(i,_a),_a.map(Pn).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 Ht().copy(this)}};B(Ht,"Identity",[1,0,0,0,1,0,0,0,1]);let ur=Ht;Y0(ur);const io=class io extends Or{constructor(){super();B(this,"_flagMatrix",!0);B(this,"_flagScale",!1);B(this,"_matrix",null);B(this,"_worldMatrix",null);B(this,"_position",null);B(this,"_rotation",0);B(this,"_scale",1);B(this,"_skewX",0);B(this,"_skewY",0);for(let i in jo)Object.defineProperty(this,i,jo[i]);this._renderer.flagMatrix=iu.bind(this),this.isShape=!0,this.matrix=new ur,this.worldMatrix=new ur,this.position=new be,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(i){const r=new io().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 jo.position.get.apply(this,arguments)}set translation(i){jo.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 be?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 be?i.scale:new be(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 io;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 be?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 be?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}};B(io,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let Fn=io;const jo={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),iu.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 be&&this._scale.unbind(te.Types.change,this._renderer.flagMatrix),this._scale=n,this._scale instanceof be&&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 U0(this,this._worldMatrix),this._worldMatrix},set:function(n){this._worldMatrix=n}}};function iu(){this._flagMatrix=!0}const ru=/^(?:none|transparent)$/i,m1=8,wa=Number.EPSILON;function Yn(n,e){return{x:n,y:e}}function qo(n,e,i=wa){return Math.abs(n.x-e.x)<=i&&Math.abs(n.y-e.y)<=i}function ou(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 p1(n,e,i){if(!n)return[Yn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[Yn(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,x=o*o;const w=b*b/_+y*y/x;if(w>1){const A=Math.sqrt(w);r*=A,o*=A,_=r*r,x=o*o}const C=_*y*y+x*b*b,N=C===0?0:(_*x-C)/C;let k=Math.sqrt(Math.max(0,N));a===l&&(k=-k);const $=k*r*y/o,v=-k*o*b/r,E=m*$-g*v+(c+u)/2,P=g*$+m*v+(d+f)/2,F=ou(1,0,(b-$)/r,(y-v)/o),R=ou((b-$)/r,(y-v)/o,(-b-$)/r,(-y-v)/o)%nn,M=F+R,X=l===0,G=(()=>{const A=M-F,Y=Math.abs(A)<Number.EPSILON;let H=Gt(A,nn);return H<Number.EPSILON&&(H=Y?0:nn),X&&!Y&&(H=H===nn?-nn:H-nn),H})(),Z=Math.max(Oo.Resolution,Math.max(i*2,1)),O=[];for(let A=1;A<=Z;A++){const Y=A/Z,H=F+Y*G;let T=E+r*Math.cos(H),D=P+o*Math.sin(H);if(s!==0){const K=T-E,J=D-P,U=Math.cos(s),q=Math.sin(s);T=K*U-J*q+E,D=K*q+J*U+P}O.push(Yn(T,D))}return O}function g1(n,e=m1){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&&!qo(l,c)){const p=Yn(l.x,l.y);r.push({a:c,b:p}),a.push(p),c=p}a.length>=3&&l&&c&&qo(l,c)&&i.push(a),a=null,l=null,c=null}},f=h=>{if(!c){c=h,a&&a.push(h);return}qo(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?me.move:me.line);if(m===me.move){u(!1);const g=Yn(p.x,p.y);a=[g],l=g,c=g,d=p;continue}if(d||(d=o[Math.max(h-1,0)]),m===me.line)f(Yn(p.x,p.y));else if(m===me.curve){const g=ba(p,d,s);for(let b=1;b<g.length;b++){const y=g[b];f(Yn(y.x,y.y))}f(Yn(p.x,p.y))}else if(m===me.arc){const g=p1(d,p,s);for(let b=0;b<g.length;b++)f(g[b])}else if(m===me.close){u(!0),d=p;continue}else f(Yn(p.x,p.y));d=p}if(a){const h=!!n._closed||!!n.closed||l&&c&&!qo(l,c);u(h)}return{polygons:i,segments:r}}function y1(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 b1(n,e,i,r){const o=r.x-i.x,s=r.y-i.y;if(Math.abs(o)<wa&&Math.abs(s)<wa){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 _1(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=b1(e,i,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function w1(n,e){if(typeof e=="boolean")return e;const i=n.fill;return!i&&i!==0?!1:typeof i=="string"?!ru.test(i):!0}function x1(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"?!ru.test(r):!0}function k1(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 Xo=Number.EPSILON;function Yo(n){return typeof n.relative!="boolean"||!!n.relative}function wn(n,e,i,r){const o=n.controls;if(!(!o||!o[e])){if(Math.abs(i)<Xo&&Math.abs(r)<Xo){Yo(n)?o[e].clear():o[e].set(n.x,n.y);return}Yo(n)?o[e].set(i,r):o[e].set(n.x+i,n.y+r)}}function Zt(n,e){wn(n,e,0,0)}function C1(n,e){const i=n.controls;return!i||!i[e]?{x:0,y:0}:Yo(n)?{x:i[e].x,y:i[e].y}:{x:i[e].x-n.x,y:i[e].y-n.y}}function fr(n,e){const i=C1(n,e);return Math.abs(i.x)>Xo||Math.abs(i.y)>Xo}function Uo(n){n.command===me.move||n.command===me.close||(n.command=fr(n,"left")||fr(n,"right")?me.curve:me.line)}function su(n,e){typeof e.relative=="boolean"&&(n.relative=e.relative)}function v1(n,e){return fr(e,"right")||fr(n,"left")||fr(n,"right")||fr(e,"left")||n.command===me.curve||e.command===me.curve}function hr(n,e,i){return{x:Kt(n.x,e.x,i),y:Kt(n.y,e.y,i)}}function au(n,e){const i=n.controls&&n.controls[e];return i?Yo(n)?{x:n.x+i.x,y:n.y+i.y}:{x:i.x,y:i.y}:{x:n.x,y:n.y}}function S1(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?au(n,"right"):{...s},l={x:e.x,y:e.y},c=o?au(e,"left"):{...l},d=hr(s,a,i),u=hr(a,c,i),f=hr(c,l,i),h=hr(d,u,i),p=hr(u,f,i),m=hr(h,p,i),g=new Ae(m.x,m.y);return su(g,n),wn(g,"left",h.x-m.x,h.y-m.y),wn(g,"right",p.x-m.x,p.y-m.y),g.command=me.curve,{anchor:g,startOut:d,endIn:f}}function B1(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 k=0,$=e-u;k<=c;k+=1,$+=1){const v=Gt($,a);h[k]=n[v]}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],x=[g],w=new Array(c+1),C=new Array(c+1);for(let k=1;k<c;k+=1){const $=k<b,v=$||s?1:2,E=$?4:s?2:7,P=$?4:s?3:8,F=$?2:s?0:1,R=v/g;g=x[k]=E-R,p=y[k]=P*h[k].x+F*h[k+1].x-R*p,m=_[k]=P*h[k].y+F*h[k+1].y-R*m}w[b]=y[b]/x[b],C[b]=_[b]/x[b];for(let k=c-2;k>=0;k-=1)w[k]=(y[k]-w[k+1])/x[k],C[k]=(_[k]-C[k+1])/x[k];w[c]=(3*h[c].x-w[b])/2,C[c]=(3*h[c].y-C[b])/2;const N=c-f;for(let k=u,$=e;k<=N;k+=1,$+=1){const v=Gt($,a),E=n[v],P=w[k]-E.x,F=C[k]-E.y;o||k<N?wn(E,"right",P,F):Zt(E,"right"),o||k>u?wn(E,"left",-P,-F):Zt(E,"left"),Uo(E)}}function N1(n,e,i,r,o,s){const a=e||n,l=n,c=i||n,d=be.distanceBetween(a,l),u=be.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,x=(g*a.y+b*l.y-m*c.y)/y-l.y;wn(n,"left",_,x)}else Zt(n,"left")}else Zt(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,x=(m*c.y+b*l.y-g*a.y)/y-l.y;wn(n,"right",_,x)}else Zt(n,"right")}else Zt(n,"right");Uo(n)}function T1(n,e,i,r,o,s){if(!(e&&i)){e||Zt(n,"left"),i||Zt(n,"right"),Uo(n);return}const a=e,l=n,c=i,d=be.distanceBetween(a,l),u=be.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;wn(n,"left",p.x*m,p.y*m)}else Zt(n,"left");if(!s&&f!==0){const m=h*d/f-h;wn(n,"right",p.x*m,p.y*m)}else Zt(n,"right");Uo(n)}function $1(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=Gt(d,c),f=n[u];if(f.command===me.move){Zt(f,"left"),Zt(f,"right");continue}const h=d===e&&!o?null:d-1,p=d===i&&!o?null:d+1,m=h===null?null:n[Gt(h,c)],g=p===null?null:n[Gt(p,c)],b=h===null,y=p===null;a==="geometric"?T1(f,m,g,l,b,y):N1(f,m,g,l,b,y)}}const mr=Math.min,pr=Math.max,E1=Math.ceil,R1=Math.floor,P1=new be,F1=new ur,Cn=class Cn extends Fn{constructor(i,r,o,s){super();B(this,"_flagVertices",!0);B(this,"_flagLength",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagCap",!0);B(this,"_flagJoin",!0);B(this,"_flagMiter",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_flagMask",!1);B(this,"_flagClip",!1);B(this,"_length",0);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_cap","round");B(this,"_join","round");B(this,"_miter",4);B(this,"_closed",!0);B(this,"_curved",!1);B(this,"_automatic",!0);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_mask",null);B(this,"_clip",!1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);for(let a in lu)Object.defineProperty(this,a,lu[a]);this._renderer.type="path",this._renderer.flagVertices=cu.bind(this),this._renderer.bindVertices=du.bind(this),this._renderer.unbindVertices=uu.bind(this),this._renderer.flagFill=fu.bind(this),this._renderer.flagStroke=hu.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:Ei(i.fill),o=typeof i.stroke=="string"?i.stroke:Ei(i.stroke),s=new Cn().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 Ae?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ae().copy(o))}}for(let r=0;r<Cn.Properties.length;r++){const o=Cn.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Cn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Cn.Properties.length;o++){const s=Cn.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()),je.each(Cn.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}=X0(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[x,w]=r.multiply(y,_),C=c.controls.left.x,N=c.controls.left.y;c.relative&&(C+=c.x,N+=c.y);let[k,$]=r.multiply(C,N);const v=Q0(p,m,x,w,k,$,g,b);f=mr(v.min.y-o,f),d=mr(v.min.x-o,d),u=pr(v.max.x+o,u),h=pr(v.max.y+o,h)}else a<=1&&(f=mr(m-o,f),d=mr(p-o,d),u=pr(p+o,u),h=pr(m+o,h)),f=mr(b-o,f),d=mr(g-o,d),u=pr(g+o,u),h=pr(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(F1);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=w1(this,s.fill),g=x1(this,s.stroke),{polygons:b,segments:y}=g1(this,p);if(m&&b.length>0&&y1(b,f,h))return!0;if(g&&y.length>0){const _=typeof this.linewidth=="number"?this.linewidth:0;if(_>0&&_1(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,_,x=this.length*Math.min(Math.max(i,0),1);const w=this.vertices.length,C=w-1;let N=null,k=null;for(let O=0,A=this._lengths.length,Y=0;O<A;O++){if(Y+this._lengths[O]>=x){this._closed?(o=Gt(O,w),s=Gt(O-1,w),O===0&&(o=s,s=O)):(o=O,s=Math.min(Math.max(O-1,0),C)),N=this.vertices[o],k=this.vertices[s],x-=Y,this._lengths[O]!==0?i=x/this._lengths[O]:i=0;break}Y+=this._lengths[O]}if(N===null||k===null)return null;if(N){if(!k)return N}else return k;_=k.controls&&k.controls.right,y=N.controls&&N.controls.left,c=k.x,p=k.y,d=(_||k).x,m=(_||k).y,u=(y||N).x,g=(y||N).y,f=N.x,b=N.y,_&&k.relative&&(d+=k.x,m+=k.y),y&&N.relative&&(u+=N.x,g+=N.y),l=Do(i,c,d,u,f),h=Do(i,p,m,g,b);const $=Kt(c,d,i),v=Kt(p,m,i),E=Kt(d,u,i),P=Kt(m,g,i),F=Kt(u,f,i),R=Kt(g,b,i),M=Kt($,E,i),X=Kt(v,P,i),G=Kt(E,F,i),Z=Kt(P,R,i);return je.isObject(r)?(r.x=l,r.y=h,r instanceof Ae&&(r.controls.left.x=M,r.controls.left.y=X,r.controls.right.x=G,r.controls.right.y=Z,(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 Ae(l,h,M-l,X-h,G-l,Z-h,this._curved?me.curve:me.line),a.t=i,a)}plot(){if(this.curved)return e1(this._collection,this.closed),this;for(let i=0;i<this._collection.length;i++)this._collection[i].command=i===0?me.move:me.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===me.close,c=(p,m)=>{if(p==null)return m;if(typeof p=="number"){if(l)return Gt(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=Gt(u+p,a),g=s[m],b=!l&&m===0;g.command===me.move&&!b&&(g.command=me.line)}if(o==="continuous"||o==="asymmetric")B1(s,u,f,l,d,o==="asymmetric");else if(o==="catmull-rom"||o==="geometric"){const p={type:o,factor:r.factor};$1(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===me.move){const f=d.clone();s.push(f),a=d,l=d;continue}if(v1(d,a)){const h=ba(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 x=1;x<h;x+=1){const w=x/h,C=1-y,N=C<=Number.EPSILON?w:(w-y)/C,k=S1(m,g,N);wn(b,"right",k.startOut.x-b.x,k.startOut.y-b.y);const $=k.anchor;s.push($),b=$,m=$.clone(),y=w,wn(g,"left",k.endIn.x-g.x,k.endIn.y-g.y)}const _=d.clone();_.controls.left.copy(g.controls.left),s.push(_)}}else{const f=ba(d,a,i);for(let p=1;p<f.length;p+=1){const m=f[p];su(m,a),Zt(m,"left"),Zt(m,"right"),m.command=me.line,s.push(m)}const h=d.clone();s.push(h)}a=d,d.command===me.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=[]),je.each(this.vertices,function(c,d){if(d<=0||c.command===me.move){a=c,this._lengths[d]=0;return}this._lengths[d]=tu(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=Wo(this,o*this._length),l=Wo(this,s*this._length),c=E1(a),d=R1(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 Ae),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(be.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&&eu(this,s)?(f=m,!r&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):g===c&&eu(this,o)&&(u=m,u.command=me.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=me.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(be.zero,m.t):(P1.copy(p),this._renderer.collection[g+1].controls.left.copy(p.controls.left).lerp(p,m.t))))}return Fn.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,Fn.prototype.flagReset.call(this),this}};B(Cn,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),B(Cn,"Utils",{getCurveLength:tu});let Oe=Cn;const lu={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 gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&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";je.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 Ti?this._collection=n:this._collection=new Ti(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,je.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 cu(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function du(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function uu(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function fu(){this._flagFill=!0}function hu(){this._flagStroke=!0}const V1=Math.ceil,M1=Math.floor,Dn=class Dn extends Fn{constructor(i){super();B(this,"_flagVertices",!0);B(this,"_flagLength",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagSize",!0);B(this,"_flagSizeAttenuation",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_length",0);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_size",1);B(this,"_sizeAttenuation",!1);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);B(this,"noFill",Oe.prototype.noFill);B(this,"noStroke",Oe.prototype.noStroke);B(this,"corner",Oe.prototype.corner);B(this,"center",Oe.prototype.center);B(this,"getBoundingClientRect",Oe.prototype.getBoundingClientRect);B(this,"_updateLength",Oe.prototype._updateLength);for(let r in mu)Object.defineProperty(this,r,mu[r]);this._renderer.type="points",this._renderer.flagVertices=cu.bind(this),this._renderer.bindVertices=du.bind(this),this._renderer.unbindVertices=uu.bind(this),this._renderer.flagFill=fu.bind(this),this._renderer.flagStroke=hu.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:Ei(i.fill),o=typeof i.stroke=="string"?i.stroke:Ei(i.stroke),s=new Dn().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 Ae?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ae().copy(o))}for(let r=0;r<Dn.Properties.length;r++){const o=Dn.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Dn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Dn.Properties.length;o++){const s=Dn.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()),je.each(Dn.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=qd(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=Wo(this,i*this._length),s=Wo(this,r*this._length),a=V1(o),l=M1(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}};B(Dn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let Ko=Dn;const mu={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 gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&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 Ti?this._collection=n:this._collection=new Ti(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 pu extends Ti{constructor(i){i=Array.isArray(i)?i:Array.prototype.slice.call(arguments);super(i);Hl(this,Cs,{});this.attach(i),this.on(te.Types.insert,this.attach),this.on(te.Types.remove,this.detach)}get ids(){return qt(this,Cs)}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}}Cs=new WeakMap;const Qn=class Qn extends Oe{constructor(i,r,o,s,a,l,c){const d=c||Oo.Resolution*3,u=[];for(let f=0;f<d;f++)u.push(new Ae);super(u,!0,!1,!0);B(this,"_flagStartAngle",!1);B(this,"_flagEndAngle",!1);B(this,"_flagInnerRadius",!1);B(this,"_flagOuterRadius",!1);B(this,"_startAngle",0);B(this,"_endAngle",nn);B(this,"_innerRadius",0);B(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let f in gu)Object.defineProperty(this,f,gu[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 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._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const i=this._startAngle,r=this._endAngle,o=this._innerRadius,s=this._outerRadius,a=Gt(i,nn)===Gt(r,nn),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,f=0,h,p,m,g,b,y,_,x,w;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),x=s*Math.sin(b),h){case 0:u=me.move;break;default:u=me.curve}g.command=u,g.x=_,g.y=x,g.controls.left.clear(),g.controls.right.clear(),g.command===me.curve&&(w=s*y/Math.PI,g.controls.left.x=w*Math.cos(b-kt),g.controls.left.y=w*Math.sin(b-kt),g.controls.right.x=w*Math.cos(b+kt),g.controls.right.y=w*Math.sin(b+kt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++}if(l){for(a?(c[f].command=me.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),x=o*Math.sin(b),u=me.curve,h<=0&&(u=a?me.move:me.line),g.command=u,g.x=_,g.y=x,g.controls.left.clear(),g.controls.right.clear(),g.command===me.curve&&(w=o*y/Math.PI,g.controls.left.x=w*Math.cos(b+kt),g.controls.left.y=w*Math.sin(b+kt),g.controls.right.x=w*Math.cos(b-kt),g.controls.right.y=w*Math.sin(b-kt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++;c[f].copy(c[0]),c[f].command=me.line}else a||(c[f].command=me.line,c[f].x=0,c[f].y=0,f++,c[f].copy(c[0]),c[f].command=me.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 Qn(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<Oe.Properties.length;d++){const u=Oe.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<Qn.Properties.length;r++){const o=Qn.Properties[r];i[o]=this[o]}return i}};B(Qn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let xa=Qn;const gu={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}}},ka=Math.cos,Ca=Math.sin,Jn=class Jn extends Oe{constructor(i,r,o,s){const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ae(0,0,0,0,0,0));super(l,!0,!0,!0);B(this,"_flagRadius",!1);B(this,"_radius",0);this._renderer.type="circle";for(let c in yu)Object.defineProperty(this,c,yu[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 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];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*nn,d=o*ka(c),u=o*Ca(c),f=s*ka(c-kt),h=s*Ca(c-kt),p=s*ka(c+kt),m=s*Ca(c+kt),g=this.vertices[a];g.command=a===0?me.move:me.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 Jn(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<Oe.Properties.length;o++){const s=Oe.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<Jn.Properties.length;r++){const o=Jn.Properties[r];i[o]=this[o]}return i}};B(Jn,"Properties",["radius"]);let va=Jn;const yu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}}},Sa=Math.cos,Ba=Math.sin,ei=class ei extends Oe{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 Ae);super(c,!0,!0,!0);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_width",0);B(this,"_height",0);this._renderer.type="ellipse";for(let d in bu)Object.defineProperty(this,d,bu[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 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._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*nn,d=o*Sa(c),u=s*Ba(c),f=o*r*Sa(c-kt),h=s*r*Ba(c-kt),p=o*r*Sa(c+kt),m=s*r*Ba(c+kt),g=this.vertices[a];g.command=a===0?me.move:me.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 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<Oe.Properties.length;l++){const c=Oe.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<ei.Properties.length;r++){const o=ei.Properties[r];i[o]=this[o]}return i}};B(ei,"Properties",["width","height"]);let Na=ei;const bu={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}}},I1=Math.cos,A1=Math.sin,ti=class ti extends Oe{constructor(i,r,o,s){s=Math.max(s||0,3);super();B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_flagSides",!1);B(this,"_radius",0);B(this,"_width",0);B(this,"_height",0);B(this,"_sides",0);this._renderer.type="polygon";for(let a in _u)Object.defineProperty(this,a,_u[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 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&&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=nn*a+Math.PI/2,c=this._width*I1(l)/2,d=this._height*A1(l)/2;s>=o?this.vertices.push(new Ae(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?me.move:me.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 ti(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<Oe.Properties.length;o++){const s=Oe.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<ti.Properties.length;r++){const o=ti.Properties[r];i[o]=this[o]}return i}};B(ti,"Properties",["width","height","sides"]);let Ta=ti;const _u={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}}},Xi=class Xi extends Oe{constructor(i,r,o,s){const a=[new Ae,new Ae,new Ae,new Ae];super(a,!0,!1,!0);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_width",0);B(this,"_height",0);B(this,"_origin",null);this._renderer.type="rectangle";for(let l in wu)Object.defineProperty(this,l,wu[l]);this.width=typeof o=="number"?o:1,this.height=typeof s=="number"?s:1,this.origin=new be,typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(i){const r=new Xi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Xi.Properties.length;r++){const o=Xi.Properties[r];o in i&&(typeof i[o]=="number"?this[o]=i[o]:this[o]instanceof be&&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 Ae),this.vertices[0].set(-i,-r).sub(this._origin).command=me.move,this.vertices[1].set(i,-r).sub(this._origin).command=me.line,this.vertices[2].set(i,r).sub(this._origin).command=me.line,this.vertices[3].set(-i,r).sub(this._origin).command=me.line,this.vertices[4]&&(this.vertices[4].set(-i,-r).sub(this._origin).command=me.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(i){const r=new Xi(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<Oe.Properties.length;o++){const s=Oe.Properties[o];r[s]instanceof be?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}};B(Xi,"Properties",["width","height","origin"]);let zr=Xi;const wu={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()}}},ni=class ni extends Oe{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 Ae(0,0,0,0,0,0,c===0?me.move:me.curve));super(l);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_flagRadius",!1);B(this,"_width",0);B(this,"_height",0);B(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in xu)Object.defineProperty(this,c,xu[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=O1.bind(this),typeof o=="number"&&(this.width=o),typeof s=="number"&&(this.height=s),(typeof a=="number"||a instanceof be)&&(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 ni().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ni.Properties.length;r++){const o=ni.Properties[r];if(o in i){const s=i[o];/radius/i.test(o)?this[o]=typeof s=="number"||s instanceof be?s:new be().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 be?(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 ni(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<Oe.Properties.length;l++){const c=Oe.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<ni.Properties.length;r++){const o=ni.Properties[r];i[o]=this[o]}return i.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),i}};B(ni,"Properties",["width","height","radius"]);let $a=ni;const xu={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 be&&this._radius.unbind(te.Types.change,this._renderer.flagRadius),this._radius=n,this._radius instanceof be&&this._radius.bind(te.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function O1(){this._flagRadius=!0}const z1=Math.cos,D1=Math.sin,ii=class ii extends Oe{constructor(i,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();B(this,"_flagInnerRadius",!1);B(this,"_flagOuterRadius",!1);B(this,"_flagSides",!1);B(this,"_innerRadius",0);B(this,"_outerRadius",0);B(this,"_sides",0);this._renderer.type="star";for(let l in ku)Object.defineProperty(this,l,ku[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 ii().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ii.Properties.length;r++){const o=ii.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=nn*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*z1(l),u=c*D1(l);s>=o?this.vertices.push(new Ae(d,u)):this.vertices[s].set(d,u),this.vertices[s].command=s===0?me.move:me.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 ii(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<Oe.Properties.length;l++){const c=Oe.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<ii.Properties.length;r++){const o=ii.Properties[r];i[o]=this[o]}return i}};B(ii,"Properties",["innerRadius","outerRadius","sides"]);let Ea=ii;const ku={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 Ra;const Cu=Math.min,vu=Math.max;Rn.document&&(Ra=document.createElement("canvas"));const Vt=class Vt extends Fn{constructor(i,r,o,s){super();B(this,"_flagValue",!0);B(this,"_flagFamily",!0);B(this,"_flagSize",!0);B(this,"_flagLeading",!0);B(this,"_flagAlignment",!0);B(this,"_flagBaseline",!0);B(this,"_flagStyle",!0);B(this,"_flagWeight",!0);B(this,"_flagDecoration",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagMask",!1);B(this,"_flagClip",!1);B(this,"_flagDirection",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_value","");B(this,"_family","sans-serif");B(this,"_size",13);B(this,"_leading",17);B(this,"_alignment","center");B(this,"_baseline","middle");B(this,"_style","normal");B(this,"_weight",500);B(this,"_decoration","none");B(this,"_direction","ltr");B(this,"_fill","#000");B(this,"_stroke","none");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_mask",null);B(this,"_clip",!1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);for(let a in Su)Object.defineProperty(this,a,Su[a]);if(this._renderer.type="text",this._renderer.flagFill=L1.bind(this),this._renderer.flagStroke=H1.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,!je.isObject(s))return this;for(let a=0;a<Vt.Properties.length;a++){const l=Vt.Properties[a];l in s&&(this[l]=s[l])}}static Measure(i){if(Ra){const r=Ra.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*Vt.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:Ei(i.fill),o=typeof i.stroke=="string"?i.stroke:Ei(i.stroke),s=new Vt().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<Vt.Properties.length;r++){const o=Vt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Vt(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<Vt.Properties.length;o++){const s=Vt.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<Vt.Properties.length;r++){const o=Vt.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}=Vt.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=Cu(h,m,b,_),o=Cu(f,p,g,y),s=vu(f,p,g,y),l=vu(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}};B(Vt,"Ratio",.6),B(Vt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let gr=Vt;const Su={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 gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&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,je.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 L1(){this._flagFill=!0}function H1(){this._flagStroke=!0}const ri=class ri extends zr{constructor(i,r,o,s){super(r,o,0,0);B(this,"_flagTextures",!1);B(this,"_flagFrameRate",!1);B(this,"_flagIndex",!1);B(this,"_amount",1);B(this,"_duration",0);B(this,"_index",0);B(this,"_startTime",0);B(this,"_playing",!1);B(this,"_firstFrame",0);B(this,"_lastFrame",0);B(this,"_loop",!0);B(this,"_textures",null);B(this,"_frameRate",0);B(this,"_origin",null);this._renderer.type="image-sequence";for(let a in Bu)Object.defineProperty(this,a,Bu[a]);this._renderer.flagTextures=W1.bind(this),this._renderer.bindTextures=j1.bind(this),this._renderer.unbindTextures=q1.bind(this),this.noStroke(),this.noFill(),Array.isArray(i)?this.textures=i.map(Nu.bind(this)):typeof i=="string"&&(this.textures=[Nu(i)]),this.origin=new be,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=ri.DefaultFrameRate,this.index=0}static fromObject(i){const r=new ri().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ri.Properties.length;r++){const o=ri.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=je.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 ri(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,je.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=je.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=Kt(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 nt))&&(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}};B(ri,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),B(ri,"DefaultFrameRate",30);let Pa=ri;const Bu={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 Ti((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 W1(){this._flagTextures=!0}function j1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function q1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Nu(n){if(n instanceof nt)return n;if(typeof n=="string")return new nt(n)}const Yi=class Yi extends zr{constructor(i,r,o,s,a,l){super(r,o,0,0);B(this,"_flagTexture",!1);B(this,"_flagColumns",!1);B(this,"_flagRows",!1);B(this,"_flagFrameRate",!1);B(this,"_flagIndex",!1);B(this,"_amount",1);B(this,"_duration",0);B(this,"_startTime",0);B(this,"_playing",!1);B(this,"_firstFrame",0);B(this,"_lastFrame",0);B(this,"_loop",!0);B(this,"_texture",null);B(this,"_columns",1);B(this,"_rows",1);B(this,"_frameRate",0);B(this,"_index",0);B(this,"_origin",null);this._renderer.type="sprite";for(let c in Tu)Object.defineProperty(this,c,Tu[c]);this.noStroke(),this.noFill(),i instanceof nt?this.texture=i:typeof i=="string"&&(this.texture=new nt(i)),this.origin=new be,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 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])}return this}play(i,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=je.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 Yi(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&&(je.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=je.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=Kt(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}};B(Yi,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let Fa=Yi;const Tu={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}}},Go=Math.min,Zo=Math.max,X1={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},Wt=class Wt extends Fn{constructor(i){super();B(this,"_flagAdditions",!1);B(this,"_flagSubtractions",!1);B(this,"_flagOrder",!1);B(this,"_flagOpacity",!0);B(this,"_flagBeginning",!1);B(this,"_flagEnding",!1);B(this,"_flagLength",!1);B(this,"_flagMask",!1);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_cap","round");B(this,"_join","round");B(this,"_miter",4);B(this,"_closed",!0);B(this,"_curved",!1);B(this,"_automatic",!0);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_length",0);B(this,"_mask",null);B(this,"_strokeAttenuation",!0);for(let r in $u)Object.defineProperty(this,r,$u[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++)Eu.call(this,i[r],this)}static RemoveChildren(i){for(let r=0;r<i.length;r++)Eu.call(this,i[r])}static OrderChildren(i){this._flagOrder=!0}static fromObject(i){const r=new Wt;for(let s=0;s<Wt.Properties.length;s++){const a=Wt.Properties[s];a in i&&(/(fill|stroke)/i.test(a)?r[a]=typeof i[a]=="string"?i[a]:Ei(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 xa.fromObject(s);case"circle":return va.fromObject(s);case"element":return Or.fromObject(s);case"ellipse":return Na.fromObject(s);case"group":return Wt.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Pa.fromObject(s);case"path":return Oe.fromObject(s);case"points":return Ko.fromObject(s);case"polygon":return Ta.fromObject(s);case"rectangle":return zr.fromObject(s);case"rounded-rectangle":return $a.fromObject(s);case"shape":return Fn.fromObject(s);case"sprite":return Fa.fromObject(s);case"star":return Ea.fromObject(s);case"text":return gr.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||!Wt.IsVisible(h,r.visibleOnly))continue;const p=typeof h.getBoundingClientRect=="function"?h.getBoundingClientRect():null;if(!(p&&!k1(p,r.x,r.y,l))){if(h instanceof Wt){if(o&&(!s||s(h))&&typeof h.contains=="function"&&h.contains(r.x,r.y,a)&&(u.push(h),c)||Wt.VisitForHitTest(h,r,o,s,a,l,c))return!0;continue}if(h instanceof Fn&&!(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<Wt.Properties.length;r++){const o=Wt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Wt,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,je.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}=X1.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,Wt.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"||je.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||je.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||je.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||je.isNaN(r.bottom)||!isFinite(r.bottom),!(s||a||l||c)))if(i){const[b,y]=o.multiply(r.left,r.top),[_,x]=o.multiply(r.right,r.top),[w,C]=o.multiply(r.left,r.bottom),[N,k]=o.multiply(r.right,r.bottom);f=Go(y,x,C,k,f),d=Go(b,_,w,N,d),u=Zo(b,_,w,N,u),h=Zo(y,x,C,k,h)}else f=Go(r.top,f),d=Go(r.left,d),u=Zo(r.right,u),h=Zo(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}};B(Wt,"Children",pu),B(Wt,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let Un=Wt;const $u={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=Un.InsertChildren.bind(this),i=Un.RemoveChildren.bind(this),r=Un.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&i(this._children)),this._children=new pu(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,je.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 Eu(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 Qo extends Oe{constructor(e,i,r,o){const s=[new Ae(e,i),new Ae(r,o)];super(s);for(let a in Ru)Object.defineProperty(this,a,Ru[a]);this.vertices[0].command=me.move,this.vertices[1].command=me.line,this.automatic=!1}}B(Qo,"Properties",["left","right"]);const Ru={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(n){if(je.isObject(n))this.vertices.splice(0,1,n),this.vertices[0].command=me.move;else{const e=new Lo("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(je.isObject(n))this.vertices.splice(1,1,n),this.vertices[1].command=me.line;else{const e=new Lo("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class Va{constructor(e=0,i=0){this.x=e,this.y=i}}class Vn{constructor(e=10,i=0,r="A"){B(this,"start",new Va);B(this,"end",new Va);this.width=e,this.angle=i,this.label=r}}const Ke={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"}},Y1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function U1(n,e){return t.openBlock(),t.createElementBlock("svg",Y1,[...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 Jo=t.markRaw({name:"ion-close",render:U1}),K1={class:"mr-3 flex flex-col gap-2"},G1=["onClick"],Z1={class:"h-full p-2"},Q1={},J1=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=Jo;return t.openBlock(),t.createBlock(t.unref(I.NScrollbar),{style:{width:"auto"},trigger:"none",class:"max-h-[19rem] md:max-h-[40rem] w-auto"},{default:t.withCtx(()=>[t.createElementVNode("div",K1,[(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(I.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",Z1,[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,G1)]),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f.label),1)]),_:2},1024),f.isCustom&&!f.isNewRec()?(t.openBlock(),t.createBlock(t.unref(I.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})}}}),Pu=gn(J1,[["__scopeId","data-v-afccb364"]]),eb={class:"flex gap-3 min-w-[20rem] relative"},tb={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},nb={ref:"drawing-container",class:"size-full"},ib={},Fu=t.defineComponent({...ib,__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((O,A)=>new Vn(i.value.configuratorParams.linesWidths[A],O,`A-${A+1}`))),f=t.computed(()=>i.value.configuratorParams.colorSide==="bottom"),h=t.computed(()=>{var O,A;return i.value.configuratorParams.startTailType&&((O=i.settings.startTailConfigs)!=null&&O[i.value.configuratorParams.startTailType])?(A=i.settings.startTailConfigs)==null?void 0:A[i.value.configuratorParams.startTailType].points:[]}),p=t.computed(()=>{var A;const O=i.value.configuratorParams.endTailType!==void 0&&((A=i.settings.endTailConfigs)==null?void 0:A[i.value.configuratorParams.endTailType]);return!O||!O.points?[]:O.points.map((Y,H)=>Array.isArray(Y)?new Vn(Y[0],Y[1],`A-${H+1}`):new Vn(Y.width,Y.angle,`A-${H+1}`))}),m=(O,A=!1)=>{O[0].start.x=0,O[0].start.y=0;let Y=0;for(let H=0;H<O.length;H++){const T=O[H],D=O[H-1]??new Vn(0,Y);Y+=!A||H>1?D.angle:0;const K=(!A||H>0?T.angle:0)+Y;if(O[H].end.x=T.width*Math.cos(K*Math.PI/180)+O[H].start.x,O[H].end.y=T.width*Math.sin(K*Math.PI/180)+O[H].start.y,H<O.length-1){const J=H+1;O[J].start.x=O[H].end.x,O[J].start.y=O[H].end.y}}return O},g=(O,A,Y,H,T=!1)=>{let D=m([...Y,...H]);A.length>0&&(D=[...m(A),...D]);let K=0,J=0,U=0,q=0;D.forEach(oe=>{K=Math.min(K,oe.start.x,oe.end.x),J=Math.min(J,oe.start.y,oe.end.y),U=Math.max(U,oe.start.x,oe.end.x),q=Math.max(q,oe.start.y,oe.end.y)});let L,le;K===0&&J===0&&U===0&&q===0?(L=1,le=1):(L=O.width/Math.abs(U-K),le=(T?O.height:O.height-Ke.colorSideLabel.size)/Math.abs(q-J));const ue=Math.min(L,le);return K=K<0?-K*ue:0,J=J<0?-J*ue:0,[ue,K,J]},b=O=>{const A=new Ko([O]);return A._size=Ke.anchorPoint.size,A.fill=Ke.anchorPoint.color,A.stroke="transparent",A._linewidth=Ke.anchorPoint.strokeSize,l.push(A),A},y=(O,A)=>{if(l=[],i.settings.allowChangeFirstPoint){const Y=O[0],H=new be(Y.vertices[0].x,Y.vertices[0].y);H.bind(te.Types.change,()=>{Y.vertices[0].copy(H)});const T=b(H);A.add(T)}O.forEach((Y,H)=>{const T=O[H+1],D=new be(Y.vertices[1].x,Y.vertices[1].y);D.bind(te.Types.change,()=>{Y.vertices[1].copy(D),T!==void 0&&T.vertices[0].copy(D)});const K=b(D);A.add(K)})},_=O=>O*(Math.PI/180),x=(O,A,Y)=>{const H=A.vertices.length-1;O.position.x=A.vertices[H].x,O.position.y=A.vertices[H].y;const T=Math.atan2(A.vertices[H].y-A.vertices[0].y,A.vertices[H].x-A.vertices[0].x);O.rotation=_(Y)+T},w=(O,A,Y)=>{if(A.vertices[0]===void 0)return;O.position.x=A.vertices[0].x,O.position.y=A.vertices[0].y;const H=A.vertices.length-1,T=Math.atan2(A.vertices[H].y-A.vertices[0].y,A.vertices[H].x-A.vertices[0].x);O.rotation=_(Y)+T},C=(O,A,Y)=>{const H=new Un;if(O.length===0)return H;const T=[];return[...O].reverse().forEach((D,K)=>{K!==0&&D.angle>0&&(D.angle*=-1),T.push(D)}),O=m(T,!0),w(H,A,O[0].angle),[A.vertices[0],A.vertices[1]].forEach(D=>{D.bind(te.Types.change,()=>{w(H,A,O[0].angle)})}),O.forEach(D=>{const K=D.start.x*Y,J=D.end.x*Y,U=D.start.y*Y,q=D.end.y*Y,L=new Qo(K,U,J,q);L.linewidth=Ke.line.size,L.stroke=Ke.line.color,H.add(L)}),H},N=(O,A,Y)=>{const H=new Un;return O.length===0||(O=m(O,!0),x(H,A,O[0].angle),[A.vertices[0],A.vertices[1]].forEach(T=>{T.bind(te.Types.change,()=>{x(H,A,O[0].angle)})}),O.forEach(T=>{const D=T.start.x*Y,K=T.end.x*Y,J=T.start.y*Y,U=T.end.y*Y,q=new Qo(D,J,K,U);q.linewidth=Ke.line.size,q.stroke=Ke.line.color,H.add(q)})),H},k=(O,A,Y,H)=>{const T=A.vertices[0].x+(A.vertices[1].x-A.vertices[0].x)/2-8*Math.sin(O.angle*Math.PI/180),D=A.vertices[0].y+(A.vertices[1].y-A.vertices[0].y)/2-8*Math.cos(O.angle*Math.PI/180),K=new gr(O.label,T+10,D-10);let J;K.size=Ke.lineLabel.size,K.weight=600,K.fill=Ke.lineLabel.color,K.id+=1,K.rotation=Ke.lineLabel.rotation,H>0&&(J=new gr(`${O.angle}°`,A.vertices[0].x+25,A.vertices[0].y-25),J.size=Ke.angleLabel.size,J.weight=600,J.fill=Ke.angleLabel.color,J.rotation=Ke.angleLabel.rotation,J.id+=H,s.push(J),Y.add(J)),Y.add(K),v(K,A,0,J),v(K,A,1)},$=()=>{const{size:O}=Ke.colorSideLabel,A=0,Y=0,H=f.value?O/2:O/2-O,T=f.value?O/2-O:O/2,D=new Un;if(!c)return D;const K=5,J=Math.atan2(T-H,Y-A),U=[new Ae(A,H,0,0,0,0,En.Commands.move),new Ae(Y,T,0,0,0,0,En.Commands.line),new Ae(Y-K*Math.cos(J-Math.PI/4),T-K*Math.sin(J-Math.PI/4),0,0,0,0,En.Commands.line),new Ae(Y,T,0,0,0,0,En.Commands.move),new Ae(Y-K*Math.cos(J+Math.PI/4),T-K*Math.sin(J+Math.PI/4),0,0,0,0,En.Commands.line)],q=new Oe(U,!1,!1,!0);q.noFill(),q.cap="round",q.join="round",q.linewidth=O/7,q.stroke=Ke.colorSideLabel.color,D.add(q);const L=new gr(f.value?"Цвет снизу":"Цвет сверху",10,0);L.size=O,L.weight=600,L.fill=Ke.colorSideLabel.color,L.alignment="left",D.add(L);const le=D.getBoundingClientRect();return D.position.x=(c.width-le.width)*d+10,D.position.y=f.value?c.height+le.height*2:le.height/2,D},v=(O,A,Y,H)=>{A.vertices[Y].bind(te.Types.change,()=>{const T=A.vertices.length-1,D=Math.atan2(A.vertices[0].y-A.vertices[T].y,A.vertices[0].x-A.vertices[T].x)*180/Math.PI,K=A.vertices[0].x+(A.vertices[T].x-A.vertices[0].x)/2-8*Math.sin(D*Math.PI/180),J=A.vertices[0].y+(A.vertices[T].y-A.vertices[0].y)/2-8*Math.cos(D*Math.PI/180);O.position.x=K+10,O.position.y=J-10,O.rotation=-.5,H&&(H.position.x=A.vertices[0].x+25,H.position.y=A.vertices[0].y-25)})},E=(O,A,Y,H,T=!1)=>{var fe;if(O.clear(),Y.length===0){O.update();return}const D=m(Y),[K,J,U]=g(O,A,D,H,T),q=new Un,L=new Array,le=new Array;T||(s=[],a=[]),D.forEach((ge,_e)=>{const Qe=ge.start.x*K+J,Re=ge.end.x*K+J,Mt=ge.start.y*K+U,vn=ge.end.y*K+U,It=new Qo(Qe,Mt,Re,vn);It.linewidth=T?Ke.previewLine.size:Ke.line.size,It.stroke=T?Ke.previewLine.color:Ke.line.color,a.push(It),L.push(It),q.add(It),!T&&ge.label!==""&&k(ge,It,q,_e)});const ue=L.at(-1);let oe=q.getBoundingClientRect();if(!T){const ge=$();le.push(ge)}if(A.length>0){const ge=C(A,L[0],K);q.add(ge)}if(H.length>0&&ue){const ge=N(H,ue,K);q.add(ge)}if(le.push(q),O.makeGroup(le),oe=q.getBoundingClientRect(),q.position.x=0-oe.left+(O.width-oe.width)/(2*(T?1:d)),q.position.y=0-oe.top+(O.height-oe.height)/(2*(T?1:d)),O.update(),!T){const ge=((fe=i.value.configuratorParams)==null?void 0:fe.colorSide)==="top";q.position.y=q.position.y+Ke.colorSideLabel.size*Number(ge),y(L,q),O.update()}},P=(O,A)=>{if(O&&!A.isNewRec()){const Y=new En({width:O.scrollWidth,height:O.scrollHeight});Y.appendTo(O),E(Y,[],A.points,[],!0)}},F=()=>{c&&E(c,h.value,u.value,p.value,!1)},R=O=>O*(180/Math.PI),M=(O,A)=>{const Y=O[1].x-O[0].x,H=O[1].y-O[0].y,T=A[1].x-A[0].x,D=A[1].y-A[0].y;let K=Math.atan2(Y*D-H*T,Y*T+H*D);return K=R(K),Math.round(K)*-1},X=O=>{const A=a.map((Y,H,T)=>{const D=T[H-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let K=Ve.multiplyByStep(Math.ceil(Ve.divideByStep(Y._length/O,i.settings.lineWidthStep)),i.settings.lineWidthStep);const J=s[H-1];K<(T.length>1?i.settings.minLineWidth:i.settings.stripMinWidth)&&(K=T.length>1?i.settings.minLineWidth:i.settings.stripMinWidth),K>i.settings.maxLineWidth&&(K=i.settings.maxLineWidth);const U=M(Y.vertices,D.vertices);return J&&(J.value=`${U}°`),new Vn(K,U,`A-${H+1}`)});r("pointer:move",A)},G=O=>{let A=null,Y;const H=J=>{A=l.find(U=>{const q=U.renderer;return(q==null?void 0:q.elem)===J.target}),[Y]=g(O,h.value,u.value.map(U=>U),p.value)},T=J=>{if(A){const U=A.renderer,q=U==null?void 0:U.elem;if(!q)return;const L=q.getBoundingClientRect();A.vertices[0].x-=L.x-(J instanceof MouseEvent?J.clientX:J.targetTouches[0].clientX)+Ke.anchorPoint.size/2,A.vertices[0].y-=L.y-(J instanceof MouseEvent?J.clientY:J.targetTouches[0].clientY)+Ke.anchorPoint.size/2,X(Y),O.update()}},D=()=>{A&&r("pointer:up",u.value),A=null},K=o.value;K&&(K.addEventListener("touchstart",H,{passive:!0}),K.addEventListener("touchend",D,{passive:!0}),K.addEventListener("mousedown",H),K.addEventListener("mouseup",D),K.addEventListener("mousemove",T),K.addEventListener("touchmove",T,{passive:!0}))},Z=(O,A)=>{r("remove-custom-template",O,A)};return t.onMounted(()=>{o.value&&(c=new En({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),t.watch(()=>i.value,()=>{F()},{deep:!0,immediate:!0}),G(c))}),t.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(O,A)=>(t.openBlock(),t.createElementBlock("div",eb,[t.createVNode(Pu,{"select-template-index":n.selectTemplateIndex,settings:n.settings,"onTemplate:select":A[0]||(A[0]=Y=>r("template:select",Y)),onInitDrawTemplate:P,onRemoveCustomTemplate:Z},null,8,["select-template-index","settings"]),t.createElementVNode("div",tb,[t.createElementVNode("div",nb,null,512)])]))}});class yr extends W.Identity{constructor(i,r){super();B(this,"label","");B(this,"points",[]);B(this,"isCustom",!1);B(this,"id",-1);B(this,"guid","");i?(this.label=i.label,this.points=i.points.map((o,s)=>V.isArray(o)?new Vn(o[0],o[1],`A-${s+1}`):new Vn(o.width,o.angle,`A-${s+1}`)),this.isCustom=i.isCustom):(this.label="-- Новая конфигурация --",this.points=[new Vn(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class Ma extends yr{constructor(i){super(i);B(this,"isDefault");this.isDefault=i.isDefault??!1}}class Vu{constructor(e){B(this,"minLineWidth");B(this,"maxLineWidth");B(this,"lineWidthStep");B(this,"minLineAngle");B(this,"maxLineAngle");B(this,"lineAngleStep");B(this,"stripMinWidth");B(this,"stripMaxWidth");B(this,"stripMinLength");B(this,"stripMaxLength");B(this,"allowShowTable");B(this,"showOnlyTemplates");B(this,"templates");B(this,"customTemplates",[]);B(this,"startTailConfigs");B(this,"endTailConfigs");B(this,"bendCountForExtended");B(this,"extendedProductCatalog");B(this,"allowChangeFirstPoint");B(this,"allowSaveTemplates");B(this,"userTemplatesPrefix");B(this,"lengthStep");B(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 yr(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((i=e.startTailConfigs)==null?void 0:i.map(o=>new Ma(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new Ma(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 yr(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new yr({label:"-- Новая конфигурация --",points:[new Vn(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 yr(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 rb={class:"flex flex-col gap-3"},ob={class:"grid gap-5 md:grid-cols-5"},sb={},Mu=t.defineComponent({...sb,__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 Vu(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=(v=0)=>{var P;const E=(P=c.value.allTemplates)==null?void 0:P.at(v);E!==void 0&&(f.value=v,l.value.configuratorParams.linesWidths=E.points.map(F=>V.isArray(F)?F[0]:F.width),l.value.configuratorParams.linesAngles=E.points.map(F=>V.isArray(F)?F[1]:F.angle),x()),y(l.value.configuratorParams)},m=async()=>{const v=prompt("Введите название шаблона:");if(!v)return;a.value=!0;const E={label:v,points:l.value.configuratorParams.linesWidths.map((F,R)=>[F,l.value.configuratorParams.linesAngles[R]])},P=F=>{F&&(c.value.addCustomTemplate(E),f.value=c.value.allTemplates.length-2),a.value=!1};i.eventEmitter.emit("configurator:create-template",{category:i.cartItem.category,template:E,callback:P})},g=async(v,E)=>{var R;const P=(R=c.value.allTemplates)==null?void 0:R.at(v);if(!P||!P.isCustom)return;const F=M=>{M&&(c.value.removeCustomTemplate(P.id),p()),E==null||E()};i.eventEmitter.emit("configurator:remove-template",{category:i.cartItem.category,templateId:P.id,callback:F})},b=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(f.value=c.value.allTemplates.length-1)},y=async v=>{var E,P;l.value.product=new W.ClientProduct,(P=(E=h.value)==null?void 0:E.formReference)==null||P.validate(F=>{F||(x(),o.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:v,validationFieldResultData:u.value,callback:R=>{R?l.value.product=R:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(V.noop)},_=async()=>{var v,E;(E=(v=h.value)==null?void 0:v.formReference)==null||E.validate(P=>{var F,R;if(!P){s.value=!0;const M=new W.OrderItemBase(l.value);(F=c.value.startTailConfigs)!=null&&F.length||delete M.configuratorParams.startTailType,(R=c.value.endTailConfigs)!=null&&R.length||delete M.configuratorParams.endTailType,r("submit",M,u.value,()=>{s.value=!1,t.nextTick(()=>{var X,G;(G=(X=h.value)==null?void 0:X.formReference)==null||G.restoreValidation()})})}}).catch(V.noop)},x=()=>{const v={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach((E,P)=>{v[`lines_widths[${P+1}]`]={},v[`lines_angles[${P+1}]`]={}}),u.value=v},w=v=>{d.value.linesWidths=v.map(E=>E.width),d.value.linesAngles=v.map(E=>E.angle)},C=v=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,x(),b(),y(l.value.configuratorParams)},N=(v,E)=>{d.value.linesWidths=v,d.value.linesAngles=E},k=v=>{const E=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,P=0;l.value.configuratorParams.linesWidths.splice(v+1,0,E),l.value.configuratorParams.linesAngles.splice(v+1,0,P),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],x(),b(),y(l.value.configuratorParams)},$=v=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(v,1),l.value.configuratorParams.linesAngles.splice(v,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],x(),b(),y(l.value.configuratorParams))};return t.onMounted(()=>{i.cartItem.isNewRec()?p():(x(),f.value=-1,y(l.value.configuratorParams))}),t.watch(()=>i.cartItem,v=>{l.value=new W.OrderItemBase(v),v.isNewRec()?p():(x(),f.value=-1,y(l.value.configuratorParams))}),(v,E)=>{const P=I.NButton;return t.openBlock(),t.createElementBlock("div",rb,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(P,{key:0,type:"tertiary",class:"self-end",onClick:E[0]||(E[0]=F=>r("click:view-switch"))},{default:t.withCtx(()=>[...E[3]||(E[3]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",ob,[t.createVNode(Fu,{value:l.value,"select-template-index":f.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":C,"onPointer:move":w,"onTemplate:select":p,onRemoveCustomTemplate:g},null,8,["value","select-template-index","settings"]),t.createVNode(hc,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":E[1]||(E[1]=F=>l.value=F),"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":E[2]||(E[2]=F=>y(F)),"onUpdate:preview":N,onSubmit:_,"onClick:saveTemplate":m,"onClick:addLine":k,"onClick:removeLine":$},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),ab={class:"flex flex-col items-center justify-between rounded-xl"},lb={class:"img-preview relative flex justify-center"},cb={},db=t.defineComponent({...cb,__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 V.keys(i.settings.crossbarCount).reverse().find(a=>s>=i.settings.crossbarCount[Number(a)])}),o=e;return(s,a)=>{const l=I.NButton;return t.openBlock(),t.createElementBlock("div",ab,[t.createElementVNode("div",lb,[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})])}}}),Ia=gn(db,[["__scopeId","data-v-2a790a20"]]),ub={key:0,class:"flex items-baseline gap-1"},fb={key:0,class:"flex items-baseline gap-1"},hb={key:1},mb={class:"text-lg font-semibold"},pb={key:2,class:"text-red-500 text-sm mb-2"},gb={class:"flex gap-3"},yb={},Iu=t.defineComponent({...yb,__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 k;const r=n,o=i,s=t.computed(()=>Ue.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(V.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":[ce.required,ce.min(r.settings.minWidth-f.value),ce.max(p.value-f.value),ce.step(1),We.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[ce.required,ce.min(r.settings.minHeight-h.value),ce.max(m.value-h.value),ce.step(1),We.serverValidation(r.validation.height.feedback)],quantity:[ce.required,ce.min(1),ce.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]})),x=t.computed(()=>{var R;const $=g.value,v=b.value,{quantity:E}=r.value,P=((R=r.value.product)==null?void 0:R.costRub)||0;if(!$||!v||!E||P===0)return null;const F=$*v/1e6;return Ve.formatMoney(P*E*F)}),w=t.computed(()=>{const $=g.value,v=b.value,E=!!($&&$>=r.settings.minWidth&&$<=r.settings.maxWidths[u.value.configuratorParams.netType]),P=!!(v&&v>=r.settings.minHeight&&v<=r.settings.maxHeights[u.value.configuratorParams.netType]),F=!!(r.value.quantity&&r.value.quantity>0);return E&&P&&F}),C=($,v)=>{var F,R;const E=u.value.configuratorParams;$&&$ in E&&(E[$]=v);const P={...E,width:g.value??0,height:b.value??0};$==="width"&&((F=l.value)==null||F.validate().catch(V.noop)),$==="height"&&((R=c.value)==null||R.validate().catch(V.noop)),t.nextTick(()=>{var X,G;!((X=l.value)!=null&&X.validationErrored)&&!((G=c.value)!=null&&G.validationErrored)&&P.height&&P.width&&o("update:params",P),N("configuratorParams",P)})},N=($,v)=>{const E=new W.OrderItemBase(r.value);E[$]=v,$==="configuratorParams"&&(E.product=new W.ClientProduct),o("update:value",E)};return t.watch(()=>r.value,$=>{const v=V.cloneDeep(t.toRaw($)),E=v.configuratorParams.mountType,P=r.settings.widthOverlaps[E]??0,F=r.settings.heightOverlaps[E]??0;v.configuratorParams.width&&v.configuratorParams.width>0&&(v.configuratorParams.width-=P),v.configuratorParams.height&&v.configuratorParams.height>0&&(v.configuratorParams.height-=F),u.value=v},{deep:!0,immediate:!0}),t.onMounted(()=>{var $;($=d.value)==null||$.select()}),e({validate:(k=a.value)==null?void 0:k.validate,formReference:a}),($,v)=>{const E=I.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.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(I.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:u.value.configuratorParams.netType,"onUpdate:value":[v[0]||(v[0]=P=>u.value.configuratorParams.netType=P),v[1]||(v[1]=P=>C("netType",P))],options:n.settings.netType.map(P=>({label:n.settings.descriptions.net_type[P],value:P}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:u.value.configuratorParams.color,"onUpdate:value":[v[2]||(v[2]=P=>u.value.configuratorParams.color=P),v[3]||(v[3]=P=>C("color",P))],options:n.settings.color.map(P=>({label:n.settings.descriptions.color[P],value:P}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:u.value.configuratorParams.mountType,"onUpdate:value":[v[4]||(v[4]=P=>u.value.configuratorParams.mountType=P),v[5]||(v[5]=P=>C("mountType",P))],options:n.settings.mountType.map(P=>({label:n.settings.descriptions.mount_type[P],value:P}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(I.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",ub,[t.createVNode(t.unref(I.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Ширина готового изделия "+t.toDisplayString(g.value),1)]),_:1}),t.createVNode(t.unref(I.NButton),{quaternary:"",type:"info",size:"tiny",onClick:v[10]||(v[10]=P=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...v[25]||(v[25]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{ref:"width-input-reference",value:u.value.configuratorParams.width,"onUpdate:value":[v[6]||(v[6]=P=>u.value.configuratorParams.width=P),v[9]||(v[9]=P=>C("width",P))],parse:t.unref(ht),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:v[7]||(v[7]=P=>t.unref(ft)(P)),onInput:v[8]||(v[8]=P=>t.unref(dt)(n.validation,"width")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.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",fb,[t.createVNode(t.unref(I.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Высота готового изделия "+t.toDisplayString(b.value),1)]),_:1}),t.createVNode(t.unref(I.NButton),{quaternary:"",type:"info",size:"tiny",onClick:v[15]||(v[15]=P=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...v[26]||(v[26]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[v[11]||(v[11]=P=>u.value.configuratorParams.height=P),v[14]||(v[14]=P=>C("height",P))],parse:t.unref(ht),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:v[12]||(v[12]=P=>t.unref(ft)(P)),onInput:v[13]||(v[13]=P=>t.unref(dt)(n.validation,"height")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:u.value.quantity,"onUpdate:value":[v[16]||(v[16]=P=>u.value.quantity=P),v[19]||(v[19]=P=>N("quantity",P??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:v[17]||(v[17]=P=>t.unref(ft)(P,!1)),onInput:v[18]||(v[18]=P=>t.unref(dt)(n.validation,"quantity")),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:v[20]||(v[20]=P=>t.unref(dt)(n.validation,"marker")),"onUpdate:value":v[21]||(v[21]=P=>{u.value.marker=P??null,N("marker",P??null)}),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),y.value?(t.openBlock(),t.createBlock(E,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":v[22]||(v[22]=P=>{u.value.isAdditionalSale=P??!1,N("isAdditionalSale",P??!1)})},{default:t.withCtx(()=>[...v[27]||(v[27]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode(Fr,{"is-product-searching":n.isProductSearching,product:u.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),x.value?(t.openBlock(),t.createElementBlock("div",hb,[v[28]||(v[28]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",mb,t.toDisplayString(x.value)+" ₽",1)])):t.createCommentVNode("",!0),w.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",pb," Пожалуйста, заполните все обязательные поля корректно. ")),t.createElementVNode("div",gb,[t.createVNode(t.unref(I.NButton),{loading:n.isSubmitProcessing,disabled:!w.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:v[23]||(v[23]=P=>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(I.NButton),{key:0,type:"default",onClick:v[24]||(v[24]=P=>o("click:show-preview-drawer"))},{default:t.withCtx(()=>[...v[29]||(v[29]=[t.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):t.createCommentVNode("",!0)])]),_:1},8,["model","rules"])),[[t.unref(ai),()=>o("submit",u.value)]])}}}),bb="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",_b="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",wb="/img/configurators/mosquitto/measurement-instructions/mount.png",xb="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",kb="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",Cb={class:"flex flex-col gap-6"},vb={class:"flex gap-4"},Sb={class:"flex flex-col gap-2"},Bb={class:"flex gap-4"},Nb={class:"flex flex-col gap-2"},Tb={class:"flex gap-4"},$b={class:"flex flex-col gap-2"},Eb={},Au=t.defineComponent({...Eb,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(n,{emit:e}){const i=Ue.initRefDependingOnDeviceResolution("small","small","medium"),r=Ue.initRefDependingOnDeviceResolution(.98,.95,.8),o=t.computed(()=>window.innerWidth*r.value),s=e;return(a,l)=>{const c=I.NText;return t.openBlock(),t.createBlock(t.unref(I.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",Cb,[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:bb,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:_b,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",vb,[l[9]||(l[9]=t.createElementVNode("img",{src:wb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",Sb,[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",Bb,[l[15]||(l[15]=t.createElementVNode("img",{src:xb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",Nb,[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",Tb,[l[21]||(l[21]=t.createElementVNode("img",{src:kb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",$b,[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"])}}}),Rb={class:"grid md:grid-cols-2"},Pb={},Ou=t.defineComponent({...Pb,__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(()=>Ue.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=V.debounce(async g=>{var b,y;l.value.product=new W.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:x=>{x?l.value.product=x:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(V.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=Jo;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(Au,{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",Rb,[o.value?(t.openBlock(),t.createBlock(t.unref(I.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(I.NDrawerContent),null,{header:t.withCtx(()=>[t.createVNode(t.unref(I.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(Ia,{"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(Ia,{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(Iu,{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)}}}),Fb={},zu=t.defineComponent({...Fb,__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=>{ft(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=fc,b=yo;return t.openBlock(),t.createBlock(t.unref(I.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(Fr,{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(I.NDropdown),{trigger:"click",options:n.suggestionOption,placement:"bottom-start",size:"large",onSelect:u},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{ref:"width-input-element",value:l.value??null,class:"w-full","show-button":!1,parse:t.unref(ht),placeholder:"Введите ширину",onKeydown:f,onInput:m[0]||(m[0]=y=>t.unref(dt)(n.validation,`linesWidths.${n.index}`)),onFocus:t.unref(He),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),t.createVNode(t.unref(I.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(I.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"])}}}),Vb={class:"my-2 flex w-full flex-col"},Mb={key:1},Ib={class:"text-lg font-semibold"},Ab={class:"flex gap-3"},Ob={},Du=t.defineComponent({...Ob,__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(V.cloneDeep(r.value)),c=t.computed(()=>{const x={length:[ce.required,ce.min(r.settings.minLength),ce.max(r.settings.maxLength),ce.step(r.settings.lengthStep),We.serverValidation(r.validation.length.feedback)],quantity:[ce.required,ce.min(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]};return V.forEach(l.value,(w,C)=>{var N;x[`configuratorParams.linesWidths.${C}`]=[ce.required,ce.min(r.settings.minLineWidth),ce.step(r.settings.lineWidthStep),We.serverValidation((N=r.validation[`linesWidths.${C}`])==null?void 0:N.feedback)]}),x}),d=t.ref(r.settings.canSetDopProdaga??!1),u=t.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((x,w)=>(x??0)+(w??0),0)),f=t.computed(()=>r.settings.width-u.value),h=t.computed(()=>!r.value.some(({product:x})=>!x||x.isNewRec())),p=t.computed(()=>r.isSubmitProcessing||!h.value||f.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(x=>x.product.isNewRec())),m=t.computed(()=>x=>f.value===0?void 0:[{label:`${(f.value>0?"Остаток +":"Излишек ")+f.value} мм.`,key:f.value+x}]),g=t.computed(()=>{const{length:x}=r.value[0];if(!x||u.value!==r.settings.width)return null;const w=V.reduce(r.value,(C,N)=>{var $;const k=(($=N.product)==null?void 0:$.costRub)||0;return C+k},0);return Ve.formatMoney(w*r.value[0].quantity*x)}),b=(x,w,C)=>{var k,$,v;l.value[w].product.id=-1;const{configuratorParams:N}=l.value[w];N.linesWidths[w]=x,y("configuratorParams",N),(v=($=(k=a.value)==null?void 0:k.at(w))==null?void 0:$.formItemReference)==null||v.validate().catch(V.noop),t.nextTick(()=>{var E,P;(P=(E=a.value)==null?void 0:E.at(w))!=null&&P.isValid&&o("update:params",N,w,C)})},y=(x,w)=>{l.value.forEach(C=>{C[x]=w}),o("update:value",l.value)};return t.watch(()=>r.value,x=>{l.value=V.cloneDeep(x)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(x,w)=>{const C=I.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.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 N;return[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,(k,$)=>{var v,E,P;return t.openBlock(),t.createBlock(zu,{key:$,ref_for:!0,ref:"line-items-reference",value:((v=k.configuratorParams)==null?void 0:v.linesWidths.at($))??null,"auto-focus":(((E=k.configuratorParams)==null?void 0:E.linesWidths.at($))??0)===0,index:$,path:`configuratorParams.linesWidths.${$}`,product:k.product,settings:n.settings,validation:n.validation,"suggestion-option":m.value(((P=k.configuratorParams)==null?void 0:P.linesWidths.at($))??0),"add-line-button-disabled":f.value<=0||n.value.length>=n.settings.maxLinesCount||n.value.some(F=>F.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"is-last-line":$===l.value.length-1&&f.value===0,"onUpdate:value":b,"onClick:addLine":w[0]||(w[0]=F=>o("click:add-line",F)),"onClick:removeLine":w[1]||(w[1]=F=>o("click:remove-line",F))},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",Vb,[f.value<0?(t.openBlock(),t.createBlock(t.unref(I.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(I.NText),{key:1,type:"error"},{default:t.withCtx(()=>[...w[15]||(w[15]=[t.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",null,[w[16]||(w[16]=t.createTextVNode(" Остаток для резки: ",-1)),t.createVNode(t.unref(I.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(I.NButton),{disabled:p.value,type:"primary",class:"self-center",onClick:w[2]||(w[2]=k=>o("click:add-line",l.value.length))},{default:t.withCtx(()=>[...w[17]||(w[17]=[t.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["disabled"]),t.createVNode(t.unref(I.NFormItem),{path:"length",label:`Метраж ${n.settings.minLength?" от "+n.settings.minLength:""} ${n.settings.maxLength?" до "+n.settings.maxLength:""} м.`},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value[0].length,"onUpdate:value":[w[3]||(w[3]=k=>l.value[0].length=k),w[6]||(w[6]=k=>y("length",k))],parse:t.unref(ht),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:w[4]||(w[4]=k=>t.unref(ft)(k,!1)),onInput:w[5]||(w[5]=k=>t.unref(dt)(n.validation,"length")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value[0].quantity,"onUpdate:value":[w[7]||(w[7]=k=>l.value[0].quantity=k),w[10]||(w[10]=k=>y("quantity",k))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:w[8]||(w[8]=k=>t.unref(ft)(k,!1)),onInput:w[9]||(w[9]=k=>t.unref(dt)(n.validation,"quantity")),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:l.value[0].marker??null,placeholder:"Введите маркировку",onInput:w[11]||(w[11]=k=>t.unref(dt)(n.validation,"marker")),"onUpdate:value":w[12]||(w[12]=k=>{l.value[0].marker=k??null,y("marker",k??null)}),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(C,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":w[13]||(w[13]=k=>{l.value[0].isAdditionalSale=k??!1,y("isAdditionalSale",k??!1)})},{default:t.withCtx(()=>[...w[18]||(w[18]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),g.value?(t.openBlock(),t.createElementBlock("div",Mb,[w[19]||(w[19]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",Ib,t.toDisplayString(g.value)+" ₽",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Ab,[t.createVNode(t.unref(I.NButton),{loading:n.isSubmitProcessing,disabled:!h.value||f.value!=0||!((N=l.value[0])!=null&&N.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:w[14]||(w[14]=k=>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(ai),()=>o("submit",l.value)]])}}}),zb={class:"flex grow flex-col"},Db=["src"],Lb={class:"w-full"},Hb={},Lu=t.defineComponent({...Hb,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",zb,[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,Db),t.createElementVNode("div",Lb,[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)])]))}}),Wb={class:"flex flex-col gap-2"},jb={class:"flex grow flex-col px-5 md:w-104"},qb={},Hu=t.defineComponent({...qb,__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 W.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=V.debounce(async(m,g,b)=>{const y={linesWidths:m.linesWidths.at(g)};b.value=!0,a.value[`linesWidths.${g}`]={},s.value[g].product=new W.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 W.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 _,x;(x=(_=o.value)==null?void 0:_.formReference)==null||x.restoreValidation()})})}}).catch(V.noop)};return t.watch(()=>i.cartItems,m=>{s.value=m.map(g=>new W.OrderItemBase(g))}),(m,g)=>{const b=I.NButton;return t.openBlock(),t.createElementBlock("div",Wb,[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",jb,[t.createVNode(Lu,{value:s.value,"onUpdate:value":g[1]||(g[1]=y=>s.value=y),settings:n.settings},null,8,["value","settings"]),t.createVNode(Du,{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"])])])}}}),Xb={class:"flex flex-col gap-3"},Yb={},Wu=t.defineComponent({...Yb,__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(V.cloneDeep(r.value)),c=t.computed(()=>({"configuratorParams.width":[ce.required,ce.min(r.settings.minWidth),...r.settings.maxWidth?[ce.max(r.settings.maxWidth)]:[],ce.step(1),We.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[ce.required,ce.min(r.settings.minLength),ce.max(r.settings.maxLength),ce.step(1),We.serverValidation(r.validation.length.feedback)],quantity:[ce.required,ce.min(1),ce.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.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 W.OrderItemBase(r.value);b[m]=g,m==="configuratorParams"&&(b.product=new W.ClientProduct),o("update:value",b)},h=()=>{var m;(m=a.value)==null||m.select()};return t.watch(()=>r.value,m=>{l.value=V.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=I.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.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(I.NFormItem),{path:"configuratorParams.width",label:`Ширина, ${n.settings.minWidth?" от "+n.settings.minWidth:""}${n.settings.maxWidth?" до "+n.settings.maxWidth:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(I.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(ht),"show-button":!1,placeholder:"Введите ширину",onKeydown:g[1]||(g[1]=y=>t.unref(ft)(y)),onInput:g[2]||(g[2]=y=>t.unref(dt)(n.validation,"width")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"configuratorParams.length",label:`Длина, ${n.settings.minLength?" от "+n.settings.minLength:""}${n.settings.maxLength?" до "+n.settings.maxLength:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[g[3]||(g[3]=y=>l.value.configuratorParams.length=y),u],placeholder:"Введите длину",parse:t.unref(ht),"show-button":!1,class:"w-full",onKeydown:g[4]||(g[4]=y=>t.unref(ft)(y)),onInput:g[5]||(g[5]=y=>t.unref(dt)(n.validation,"length")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:n.value.quantity,placeholder:"Введите количество",min:1,"show-button":!1,class:"w-full",onKeydown:g[6]||(g[6]=y=>t.unref(ft)(y,!1)),onInput:g[7]||(g[7]=y=>t.unref(dt)(n.validation,"quantity")),"onUpdate:value":g[8]||(g[8]=y=>f("quantity",y??0)),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:n.value.marker??null,placeholder:"Введите маркировку",onInput:g[9]||(g[9]=y=>t.unref(dt)(n.validation,"marker")),"onUpdate:value":g[10]||(g[10]=y=>f("marker",y??null)),onFocus:t.unref(He)},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(Fr,{"is-product-searching":n.isProductSearching,product:n.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),t.createElementVNode("div",Xb,[t.createVNode(t.unref(I.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(ai),()=>o("submit",l.value)]])}}}),Ub={class:"flex flex-col gap-2 w-72"},Kb={},ju=t.defineComponent({...Kb,__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=V.debounce(async h=>{var p,m;s.value.product=new W.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(V.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(V.noop)};return t.watch(()=>i.cartItem,h=>{s.value=new W.OrderItemBase(h)},{deep:!0}),(h,p)=>{const m=I.NButton;return t.openBlock(),t.createElementBlock("div",Ub,[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(Wu,{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"])])}}}),Gb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Zb(n,e){return t.openBlock(),t.createElementBlock("svg",Gb,[...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 qu=t.markRaw({name:"ion-add",render:Zb}),Qb={key:0,class:"-mt-1 text-sm text-gray-500"},Jb={class:"font-bold"},e_={class:"flex flex-col gap-3"},t_={key:0,class:"mt-4 flex flex-col gap-1.5"},n_={class:"flex flex-col gap-1 text-sm text-gray-700"},i_={key:0},r_={key:1},o_={"form-array-name":"items",class:"flex flex-col gap-3"},s_={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},a_={key:0,class:"flex flex-wrap items-end gap-2"},l_={class:"whitespace-nowrap text-xl font-bold"},c_={key:0,class:"whitespace-nowrap text-lg text-gray-500"},d_={class:"font-bold"},u_={class:"font-bold"},f_={class:"flex gap-3"},h_={},Xu=t.defineComponent({...h_,__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 Y;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.ref(V.cloneDeep(r.value)),l=t.ref({...r.validation}),c=H=>{var T;delete l.value[H],(T=s.value)==null||T.restoreValidation()};t.watch(()=>r.validation,H=>{l.value={...H},Object.values(H).some(D=>D==null?void 0:D.feedback)&&t.nextTick(()=>{var D;return(D=s.value)==null?void 0:D.validate(V.noop).catch(V.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(H=>({label:H.name,value:H.id}))),m=(H,T,D)=>{const K=H!=null&&H>0,J=T!=null&&T>0;return!K&&!J?null:K&&J?`от ${H} ${D} до ${T} ${D}`:K?`от ${H} ${D}`:`до ${T} ${D}`},g=t.computed(()=>{var H,T;return m(r.settings.minWidth,(T=(H=u.value)==null?void 0:H.properties)==null?void 0:T.width,"мм")}),b=t.computed(()=>{var H,T;return m(r.settings.minLength,(T=(H=u.value)==null?void 0:H.properties)==null?void 0:T.length,"мм")}),y=t.ref(null),_=t.ref(!1),x=t.computed(()=>{var T;const H={marker:[We.serverValidation((T=l.value.marker)==null?void 0:T.feedback)]};return a.value.configuratorParams.items.forEach((D,K)=>{var J,U,q,L,le,ue,oe;H[`configuratorParams.items.${K}.width`]=[ce.required,ce.min(r.settings.minWidth),...(U=(J=u.value)==null?void 0:J.properties)!=null&&U.width?[ce.max(u.value.properties.width)]:[],ce.step(1),We.serverValidation((q=l.value[`items.${K}.width`])==null?void 0:q.feedback)],H[`configuratorParams.items.${K}.length`]=[ce.required,ce.min(r.settings.minLength),...(le=(L=u.value)==null?void 0:L.properties)!=null&&le.length?[ce.max(u.value.properties.length)]:[],ce.step(1),We.serverValidation((ue=l.value[`items.${K}.length`])==null?void 0:ue.feedback)],H[`configuratorParams.items.${K}.count`]=[ce.required,ce.min(1),ce.step(1),We.serverValidation((oe=l.value[`items.${K}.count`])==null?void 0:oe.feedback)]}),H}),w=t.ref(r.settings.canSetDopProdaga??!1),C=t.computed(()=>a.value.configuratorParams.items.some(H=>{var T,D;return!u.value||!H.width||H.width<r.settings.minWidth||H.width>(((T=u.value.properties)==null?void 0:T.width)??0)||H.length===0||H.length<r.settings.minLength||H.length>(((D=u.value.properties)==null?void 0:D.length)??0)||!H.count||H.count<1})),N=t.computed(()=>!u.value||C.value||a.value.configuratorParams.items.length===0),k=t.ref(null),$=t.computed(()=>k.value===null?"":Ve.formatMoney(k.value)),v=H=>{if(!H){u.value=null,f.value=null,a.value.product=new W.ClientProduct,y.value=null;return}const T=h.value.find(D=>D.id===H);T&&(u.value=T,f.value=H,a.value.product=T,O("product",a.value.product),a.value.configuratorParams.items.forEach(D=>{var K,J;(K=T.properties)!=null&&K.width&&D.width>T.properties.width&&(D.width=T.properties.width),(J=T.properties)!=null&&J.length&&D.length>T.properties.length&&(D.length=T.properties.length)}),P())};let E=!1;const P=()=>{E=!0,y.value=null,k.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},F=async()=>{var H;if(!u.value||a.value.configuratorParams.items.length===0||C.value){P();return}(H=s.value)==null||H.validate(T=>{if(T){P();return}if(_.value=!0,!u.value||!d.value){P(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:D=>{D?(y.value=D,a.value.configuratorParams.calculationId=D.id,a.value.quantity=D.quantity,t.nextTick(()=>{O("quantity",D.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,P()),O("configuratorParams",a.value.configuratorParams),R(),_.value=!1}})}).catch(()=>{P(),_.value=!1})},R=()=>{var T;if(!((T=u.value)!=null&&T.costRub)||!y.value){k.value=null;return}const H=y.value.quantity*u.value.costRub;k.value=Ve.roundMoney(H)},M=H=>{var D,K;const T=a.value.configuratorParams.items[H];u.value&&((D=u.value.properties)!=null&&D.width&&T.width>u.value.properties.width&&(T.width=u.value.properties.width),(K=u.value.properties)!=null&&K.length&&T.length>u.value.properties.length&&(T.length=u.value.properties.length)),O("configuratorParams",a.value.configuratorParams),P()},X=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),O("configuratorParams",a.value.configuratorParams),P(),o("add-item",a.value.configuratorParams.items.length)},G=H=>{a.value.configuratorParams.items.splice(H,1),O("configuratorParams",a.value.configuratorParams),P(),o("remove-item",H)},Z=()=>{if(!(N.value||_.value||r.isSubmitProcessing)){if(!y.value){F();return}o("submit",a.value)}},O=(H,T)=>{const D=new W.OrderItemBase(r.value);D[H]=T,o("update:value",D)};t.watch(()=>r.value,H=>{const T=V.cloneDeep(t.toRaw(H));(!T.configuratorParams.items||T.configuratorParams.items.length===0)&&(T.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=T,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),E?E=!1:A()},{deep:!0});const A=()=>{const{calculationId:H}=a.value.configuratorParams,T=a.value.quantity??0;H&&T>0&&a.value.product&&!a.value.product.isNewRec()&&(y.value={id:H,quantity:T,sheets:[]},R())};return t.onMounted(()=>{r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),A()}),e({validate:(Y=s.value)==null?void 0:Y.validate,formReference:s}),(H,T)=>{const D=yo,K=qu;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:a.value,rules:x.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var J;return[t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:f.value,"onUpdate:value":[T[0]||(T[0]=U=>f.value=U),v],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((J=u.value)==null?void 0:J.costRub)!=null?(t.openBlock(),t.createElementBlock("div",Qb,[t.createElementVNode("span",Jb,t.toDisplayString(u.value.code),1),t.createTextVNode(" — "+t.toDisplayString(t.unref(Ve).formatMoney(u.value.costRub))+" "+t.toDisplayString(u.value.currency.symbol)+"/шт. ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",e_,[u.value?(t.openBlock(),t.createElementBlock("div",t_,[T[7]||(T[7]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",n_,[g.value?(t.openBlock(),t.createElementBlock("div",i_,"Ширина "+t.toDisplayString(g.value)+".",1)):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock("div",r_,"Длина "+t.toDisplayString(b.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",o_,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value.configuratorParams.items,(U,q)=>(t.openBlock(),t.createElementBlock("div",{key:q,class:"flex grow gap-2"},[t.createElementVNode("div",s_,[t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.items.${q}.width`,label:"Ширина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:a.value.configuratorParams.items[q].width,"onUpdate:value":[L=>a.value.configuratorParams.items[q].width=L,L=>M(q)],parse:t.unref(ht),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:T[1]||(T[1]=L=>t.unref(ft)(L)),onInput:L=>c(`items.${q}.width`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.items.${q}.length`,label:"Длина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:a.value.configuratorParams.items[q].length,"onUpdate:value":[L=>a.value.configuratorParams.items[q].length=L,L=>M(q)],parse:t.unref(ht),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:T[2]||(T[2]=L=>t.unref(ft)(L)),onInput:L=>c(`items.${q}.length`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.items.${q}.count`,label:"Количество, шт"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:a.value.configuratorParams.items[q].count,"onUpdate:value":[L=>a.value.configuratorParams.items[q].count=L,L=>M(q)],parse:t.unref(ht),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:T[3]||(T[3]=L=>t.unref(ft)(L,!1)),onInput:L=>c(`items.${q}.count`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createVNode(t.unref(I.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:L=>G(q)},{default:t.withCtx(()=>[t.createVNode(D)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:1,disabled:C.value,type:"default",class:"self-center",onClick:X},{default:t.withCtx(()=>[t.createVNode(K),T[8]||(T[8]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0)]),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка распила"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:a.value.marker??null,disabled:!u.value,placeholder:"Введите маркировку распила",onInput:T[4]||(T[4]=U=>c("marker")),"onUpdate:value":T[5]||(T[5]=U=>O("marker",U??null)),onFocus:t.unref(He)},null,8,["value","disabled","onFocus"])]),_:1}),w.value?(t.openBlock(),t.createBlock(t.unref(I.NCheckbox),{key:1,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":T[6]||(T[6]=U=>{a.value.isAdditionalSale=U??!1,O("isAdditionalSale",U??!1)})},{default:t.withCtx(()=>[...T[9]||(T[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode(t.unref(I.NSpin),{show:_.value,size:"small",class:"grow"},{default:t.withCtx(()=>[y.value&&u.value&&k.value?(t.openBlock(),t.createElementBlock("div",a_,[t.createElementVNode("div",null,[T[10]||(T[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",l_,t.toDisplayString($.value)+" "+t.toDisplayString(u.value.currency.symbol),1)]),y.value.quantity&&u.value?(t.openBlock(),t.createElementBlock("div",c_,[t.createElementVNode("span",d_,"("+t.toDisplayString(y.value.quantity)+" шт.",1),T[11]||(T[11]=t.createTextVNode(" x ",-1)),t.createElementVNode("span",u_,t.toDisplayString(t.unref(Ve).formatMoney(u.value.costRub))+" "+t.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),_:1},8,["show"]),t.createElementVNode("div",f_,[y.value&&!_.value?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,loading:n.isSubmitProcessing,disabled:N.value||_.value,type:"primary",class:"self-start",onClick:Z},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])):(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:1,loading:_.value,disabled:N.value||_.value,type:"info",class:"self-start",onClick:F},{default:t.withCtx(()=>[...T[12]||(T[12]=[t.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules"])),[[t.unref(ai),Z]])}}}),m_={class:"flex flex-col gap-2"},p_={class:"w-104 flex grow flex-col px-5"},g_={},Yu=t.defineComponent({...g_,__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=V.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(V.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 W.OrderItemBase(f)},{deep:!0}),(f,h)=>{const p=I.NButton;return t.openBlock(),t.createElementBlock("div",m_,[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",p_,[t.createVNode(Xu,{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"])])])}}}),y_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function b_(n,e){return t.openBlock(),t.createElementBlock("svg",y_,[...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 __=t.markRaw({name:"ion-checkmark",render:b_}),w_={key:0,class:"-mt-1 text-sm text-gray-500"},x_={class:"font-bold"},k_={class:"flex flex-col gap-3"},C_={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},v_={class:"flex flex-col gap-1 text-sm text-gray-700"},S_={key:0},B_={key:1},N_={"form-array-name":"items",class:"flex flex-col gap-3"},T_={class:"min-w-0 flex-1"},$_={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},E_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},R_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},P_={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},F_={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},V_={key:0,class:"lg:!flex-[2]"},M_={class:"font-bold"},I_={key:1,class:"lg:!flex-[3]"},A_={class:"font-bold"},O_={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"},z_={key:0},D_={class:"font-bold"},L_={key:1},H_={class:"font-bold"},W_={class:"flex flex-wrap items-center gap-3"},j_={},Uu=t.defineComponent({...j_,__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?[]:V.cloneDeep(t.toRaw(r.value)),c=t.ref(l.map(U=>new W.OrderItemBase(U))),d=t.computed(()=>({items:c.value})),u=t.ref({...r.validation}),f=U=>{var q;delete u.value[U],(q=s.value)==null||q.restoreValidation()},h=t.ref(null),p=t.ref(null),m=t.computed(()=>{var U,q;return((q=(U=c.value[0])==null?void 0:U.category)==null?void 0:q.products)??[]}),g=t.computed(()=>m.value.map(U=>({label:U.name,value:U.id}))),b=(U,q,L)=>{const le=U!=null&&U>0,ue=q!=null&&q>0;return!le&&!ue?null:le&&ue?`от ${U} ${L} до ${q} ${L}`:le?`от ${U} ${L}`:`до ${q} ${L}`},y=t.computed(()=>{var U,q;return b(r.settings.minWidth,(q=(U=h.value)==null?void 0:U.properties)==null?void 0:q.width,"мм")}),_=t.computed(()=>{var U,q;return b(r.settings.minLength,(q=(U=h.value)==null?void 0:U.properties)==null?void 0:q.length,"мм")}),x=t.computed(()=>{const U={};return c.value.forEach((q,L)=>{var le,ue,oe,fe,ge,_e,Qe,Re;U[`items.${L}.configuratorParams.width`]=[ce.required,ce.min(r.settings.minWidth),...(ue=(le=h.value)==null?void 0:le.properties)!=null&&ue.width?[ce.max(h.value.properties.width)]:[],ce.step(1),We.serverValidation((oe=u.value[`items.${L}.width`])==null?void 0:oe.feedback)],U[`items.${L}.configuratorParams.length`]=[ce.required,ce.min(r.settings.minLength),...(ge=(fe=h.value)==null?void 0:fe.properties)!=null&&ge.length?[ce.max(h.value.properties.length)]:[],ce.step(1),We.serverValidation((_e=u.value[`items.${L}.length`])==null?void 0:_e.feedback)],U[`items.${L}.quantity`]=[ce.required,ce.min(1),ce.step(1),We.serverValidation((Qe=u.value[`items.${L}.quantity`])==null?void 0:Qe.feedback)],U[`items.${L}.marker`]=[We.serverValidation((Re=u.value[`items.${L}.marker`])==null?void 0:Re.feedback)]}),U});t.watch(()=>r.validation,U=>{u.value={...U},Object.values(U).some(L=>L==null?void 0:L.feedback)&&t.nextTick(()=>{var L;return(L=s.value)==null?void 0:L.validate(V.noop).catch(V.noop)})},{deep:!0});const w=t.ref(r.settings.canSetDopProdaga??!1),C=t.computed(()=>{const U=h.value;return U?c.value.some(q=>{var oe,fe;const L=q.configuratorParams,le=(oe=U.properties)==null?void 0:oe.width,ue=(fe=U.properties)==null?void 0:fe.length;return L.width===0||L.width<r.settings.minWidth||le!=null&&L.width>le||L.length===0||L.length<r.settings.minLength||ue!=null&&L.length>ue||q.quantity===0||q.quantity<1}):!0}),N=t.computed(()=>!h.value||C.value||c.value.length===0),k=t.computed(()=>{const U=c.value[0];return U!=null&&!U.isNewRec()}),$=U=>r.itemStates[U]??"idle",v=U=>$(U)==="success",E=U=>$(U)==="loading",P=t.computed(()=>c.value.length===0?!0:c.value.every((U,q)=>{const L=$(q);return L==="success"||L==="loading"})),F=U=>U.width===0||U.length===0?0:U.width*U.length/1e6,R=U=>Ve.formatArea(F(U)),M=U=>{var oe;const q=U.configuratorParams,L=F(q),le=((oe=h.value)==null?void 0:oe.costRub)??0,ue=U.quantity??0;return!L||!ue?0:Ve.roundMoney(L*le*ue)},X=t.computed(()=>V.sum(c.value.map(U=>{const q=U.configuratorParams;return!q.width||q.length===0||!U.quantity?0:q.width*q.length*U.quantity/1e6}))),G=t.computed(()=>Ve.roundMoney(V.sum(c.value.map(U=>M(U))))),Z=()=>{var U,q,L;return new W.OrderItemBase({category:(U=c.value[0])==null?void 0:U.category,configurator:(q=c.value[0])==null?void 0:q.configurator,product:h.value??new W.ClientProduct,quantity:1,isAdditionalSale:(L=c.value[0])==null?void 0:L.isAdditionalSale,configuratorParams:{width:0,length:0}})},O=U=>{if(!U){h.value=null,p.value=null,c.value.forEach(L=>{L.product=new W.ClientProduct}),o("update:value",c.value);return}const q=m.value.find(L=>L.id===U);q&&(h.value=q,p.value=U,c.value.forEach((L,le)=>{var ue,oe;L.product=q,(ue=q.properties)!=null&&ue.width&&L.configuratorParams.width>q.properties.width&&(L.configuratorParams.width=q.properties.width),(oe=q.properties)!=null&&oe.length&&L.configuratorParams.length>q.properties.length&&(L.configuratorParams.length=q.properties.length),o("item-reset",le)}),o("update:value",c.value))},A=U=>{var le,ue;const q=c.value[U],L=h.value;L&&((le=L.properties)!=null&&le.width&&q.configuratorParams.width>L.properties.width&&(q.configuratorParams.width=L.properties.width),(ue=L.properties)!=null&&ue.length&&q.configuratorParams.length>L.properties.length&&(q.configuratorParams.length=L.properties.length)),o("item-reset",U),o("update:value",c.value)},Y=(U,q)=>{c.value[U].marker=q===null||q===""?void 0:q,o("item-reset",U),o("update:value",c.value)},H=U=>{c.value.forEach(q=>{q.isAdditionalSale=U}),o("update:value",c.value)},T=()=>{c.value.push(Z()),o("update:value",c.value),o("add-item",c.value.length),t.nextTick(()=>{var q,L,le,ue;const U=c.value.length-1;(L=(q=a.value)==null?void 0:q[U])==null||L.focus(),(ue=(le=a.value)==null?void 0:le[U])==null||ue.select()})},D=U=>{c.value.splice(U,1),o("update:value",c.value),o("remove-item",U)};t.watch(()=>r.value,U=>{var ue;const L=(U==null?[]:V.cloneDeep(t.toRaw(U))).map(oe=>new W.OrderItemBase(oe));c.value=L.length>0?L:[Z()];const le=(ue=c.value[0])==null?void 0:ue.product;le&&!le.isNewRec()?(h.value=le,p.value=le.id):(h.value=null,p.value=null)},{deep:!0});const K=()=>{var q;if(h.value!==null)return;const U=(q=m.value[0])==null?void 0:q.id;U!=null&&O(U)};return t.watch(m,()=>{K()}),t.onMounted(()=>{var q;c.value.length===0&&(c.value=[Z()]);const U=(q=c.value[0])==null?void 0:q.product;U&&!U.isNewRec()&&(h.value=U,p.value=U.id),K()}),e({validate:(J=s.value)==null?void 0:J.validate,formReference:s}),(U,q)=>{const L=__,le=yo,ue=qu;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:d.value,rules:x.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var oe,fe;return[t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:p.value,"onUpdate:value":[q[0]||(q[0]=ge=>p.value=ge),O],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((oe=h.value)==null?void 0:oe.costRub)!=null?(t.openBlock(),t.createElementBlock("div",w_,[t.createElementVNode("span",x_,t.toDisplayString(h.value.code),1),t.createTextVNode(" — "+t.toDisplayString(t.unref(Ve).formatMoney(h.value.costRub))+" "+t.toDisplayString(h.value.currency.symbol)+"/м² ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",k_,[h.value?(t.openBlock(),t.createElementBlock("div",C_,[q[6]||(q[6]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",v_,[y.value?(t.openBlock(),t.createElementBlock("div",S_,"Ширина "+t.toDisplayString(y.value)+".",1)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock("div",B_,"Длина "+t.toDisplayString(_.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",N_,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value.items,(ge,_e)=>{var Qe;return t.openBlock(),t.createElementBlock("div",{key:_e,class:t.normalizeClass(["flex min-w-0 items-start gap-2 border-b border-gray-100 last:border-0",v(_e)?"opacity-70":""])},[t.createElementVNode("div",T_,[t.createElementVNode("div",$_,[t.createElementVNode("div",E_,[t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.configuratorParams.width`,label:"Ширина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{ref_for:!0,ref:"widthInputs",value:d.value.items[_e].configuratorParams.width,"onUpdate:value":[Re=>d.value.items[_e].configuratorParams.width=Re,Re=>A(_e)],parse:t.unref(ht),"show-button":!1,disabled:!h.value||v(_e)||E(_e),placeholder:"Ширина",class:"w-full",onKeydown:q[1]||(q[1]=Re=>t.unref(ft)(Re)),onInput:Re=>f(`items.${_e}.width`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:d.value.items[_e].configuratorParams.length,"onUpdate:value":[Re=>d.value.items[_e].configuratorParams.length=Re,Re=>A(_e)],parse:t.unref(ht),"show-button":!1,disabled:!h.value||v(_e)||E(_e),placeholder:"Длина",class:"w-full",onKeydown:q[2]||(q[2]=Re=>t.unref(ft)(Re)),onInput:Re=>f(`items.${_e}.length`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createElementVNode("div",R_,[t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:d.value.items[_e].quantity,"onUpdate:value":[Re=>d.value.items[_e].quantity=Re,Re=>A(_e)],parse:t.unref(ht),"show-button":!1,disabled:!h.value||v(_e)||E(_e),placeholder:"Кол-во",class:"w-full",onKeydown:q[3]||(q[3]=Re=>t.unref(ft)(Re,!1)),onInput:Re=>f(`items.${_e}.quantity`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.marker`,label:"Маркировка",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:d.value.items[_e].marker??null,disabled:!h.value||v(_e)||E(_e),placeholder:"Маркировка",class:"w-full",onInput:Re=>f(`items.${_e}.marker`),"onUpdate:value":Re=>Y(_e,Re??null),onFocus:t.unref(He)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),E(_e)||v(_e)?(t.openBlock(),t.createElementBlock("div",P_,[E(_e)?(t.openBlock(),t.createBlock(t.unref(I.NSpin),{key:0,size:14})):v(_e)?(t.openBlock(),t.createBlock(L,{key:1,class:"text-green-600 text-xl"})):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("div",F_,[ge.configuratorParams.width>0&&ge.configuratorParams.length>0?(t.openBlock(),t.createElementBlock("div",V_,[q[7]||(q[7]=t.createTextVNode(" Площадь (S) = ",-1)),t.createElementVNode("span",M_,t.toDisplayString(R(ge.configuratorParams))+" м²",1)])):t.createCommentVNode("",!0),M(ge)>0?(t.openBlock(),t.createElementBlock("div",I_,[q[8]||(q[8]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",A_,t.toDisplayString(t.unref(Ve).formatMoney(M(ge)))+" "+t.toDisplayString((Qe=h.value)==null?void 0:Qe.currency.symbol),1)])):t.createCommentVNode("",!0)])]),k.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,disabled:E(_e)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:Re=>D(_e)},{default:t.withCtx(()=>[t.createVNode(le)]),_:1},8,["disabled","onClick"]))],2)}),128))]),h.value?(t.openBlock(),t.createElementBlock("div",O_,[X.value>0?(t.openBlock(),t.createElementBlock("div",z_,[q[9]||(q[9]=t.createTextVNode(" Общая площадь: ",-1)),t.createElementVNode("span",D_,t.toDisplayString(t.unref(Ve).formatArea(X.value))+" м²",1)])):t.createCommentVNode("",!0),G.value>0?(t.openBlock(),t.createElementBlock("div",L_,[q[10]||(q[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",H_,t.toDisplayString(t.unref(Ve).formatMoney(G.value))+" "+t.toDisplayString(h.value.currency.symbol),1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),w.value?(t.openBlock(),t.createBlock(t.unref(I.NCheckbox),{key:1,checked:((fe=c.value[0])==null?void 0:fe.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":q[4]||(q[4]=ge=>H(ge??!1))},{default:t.withCtx(()=>[...q[11]||(q[11]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createElementVNode("div",W_,[h.value&&!k.value?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,disabled:C.value,type:"default",onClick:T},{default:t.withCtx(()=>[t.createVNode(ue),q[12]||(q[12]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),t.createVNode(t.unref(I.NButton),{loading:n.isSubmitProcessing,disabled:N.value||P.value,type:"primary",class:"ml-auto",onClick:q[5]||(q[5]=ge=>o("submit",c.value))},{default:t.withCtx(()=>{var ge;return[t.createTextVNode(t.toDisplayString((ge=c.value[0])!=null&&ge.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[t.unref(ai),()=>o("submit",c.value)]])}}}),q_={class:"flex flex-col gap-2"},X_={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},Y_={},Ku=t.defineComponent({...Y_,__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(x=>new W.OrderItemBase(x))),a=t.ref([]),l=t.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=x=>{c.forEach(w=>{l.value[`items.${x}.${w}`]={}})},u=x=>{c.forEach(w=>{delete l.value[`items.${x}.${w}`]})},f=t.computed(()=>a.value.includes("loading")),h=()=>({width:{},length:{},quantity:{},marker:{}}),p=(x,w)=>{let C=!1;return c.forEach(N=>{var F,R;const k=`items.0.${N}`,$=(F=x[N])==null?void 0:F.feedback,E=((R=x[k])==null?void 0:R.feedback)??$,P=`items.${w}.${N}`;E?(l.value[P]=x[k]??x[N],C=!0):l.value[P]={}}),C},m=(x,w,C)=>new Promise(N=>{const k=h();let $=!1;const v=E=>{if($)return;$=!0;const P=p(k,w),F=(E===void 0?!P:E)&&!P;a.value[w]=F?"success":"error",t.nextTick(()=>{var R,M;(M=(R=o.value)==null?void 0:R.formReference)==null||M.restoreValidation()}),N(F)};a.value[w]="loading",r("submit",[V.cloneDeep(x)],k,v,{isFinalSuccessfulCompletion:C})}),g=async()=>{var C,N;try{await((N=(C=o.value)==null?void 0:C.formReference)==null?void 0:N.validate())}catch{return}const x=s.value.map((k,$)=>$).filter(k=>{const $=a.value[k]??"idle";return $!=="success"&&$!=="loading"});let w=!0;for(let k=0;k<x.length;k+=1){const $=x[k],v=s.value[$];if(!v)break;const P=k===x.length-1&&w;await m(v,$,P)||(w=!1)}},b=x=>{const w=x-1;a.value[w]="idle",d(w)},y=x=>{a.value.splice(x,1),u(x);for(let w=x;w<s.value.length;w+=1)d(w)},_=x=>{const w=a.value[x];(w==="success"||w==="error")&&(a.value[x]="idle")};return t.onMounted(()=>{(i.cartItems??[]).forEach((x,w)=>{a.value[w]="idle",d(w)})}),t.watch(()=>i.cartItems,x=>{const w=(x??[]).map(C=>new W.OrderItemBase(C));s.value=w,a.value=w.map(()=>"idle"),w.forEach((C,N)=>{d(N)})},{deep:!0}),(x,w)=>{var N;const C=I.NButton;return t.openBlock(),t.createElementBlock("div",q_,[n.settings.allowShowTable&&((N=s.value[0])!=null&&N.isNewRec())?(t.openBlock(),t.createBlock(C,{key:0,type:"tertiary",class:"self-center",onClick:w[0]||(w[0]=k=>r("click:view-switch"))},{default:t.withCtx(()=>[...w[2]||(w[2]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",X_,[t.createVNode(Uu,{ref:"sandwich-m2-configurator-form",value:s.value,"onUpdate:value":w[1]||(w[1]=k=>s.value=k),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"])])])}}}),U_={key:0,class:"flex justify-center p-4"},K_={key:1,class:"p-4 text-center text-red-500"},G_={key:2,class:"flex justify-center"},Z_={class:"!bg-white p-4 m-2 rounded-md w-max"},Q_={key:3,class:"p-4 text-center text-gray-500"},J_={},Gu=t.defineComponent({...J_,__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 W.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===W.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 W.OrderItemBase({...h,configuratorParams:{length:b.stripMinLength,linesAngles:[],linesWidths:[],startTailType:V.some(b.startTailConfigs,y=>y.isDefault)?(m=b.startTailConfigs)==null?void 0:m.findIndex(y=>y.isDefault):void 0,endTailType:V.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 W.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 W.OrderItemBase({...h,length:b.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const b=e.settings;o.value=new W.OrderItemBase({...h,configuratorParams:{width:b.minWidth,length:b.minLength}});break}case"sandwich":{o.value=new W.OrderItemBase({...h,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new W.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,_=x=>{m==null||m(x),y&&x&&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=I.NSpin;return t.openBlock(),t.createElementBlock(t.Fragment,null,[i.value?(t.openBlock(),t.createElementBlock("div",U_,[t.createVNode(m,{size:"large"})])):r.value?(t.openBlock(),t.createElementBlock("div",K_,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",G_,[t.createElementVNode("div",Z_,[n.editor==="kozyrek"?(t.openBlock(),t.createBlock(Mu,{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(Ou,{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(Hu,{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(ju,{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(Yu,{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(Ku,{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 Zu(n){return Object.values(W.ConfiguratorsEnum).includes(n)}function Qu(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==W.ConfiguratorsEnum.Sandwich?!0:n.properties.configuratorSettings!==void 0&&V.isArray(n.products)&&n.products.length>0}const ew={key:0,class:"pt-0.5"},tw={key:0},nw={key:1},iw={class:"flex flex-row gap-1"},rw={key:0},ow={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},sw={class:"flex flex-col gap-2.5 sm:flex-row"},aw={key:0,class:"header-extra"},lw={class:"inline-flex"},cw={class:"inline-flex"},dw={class:"inline-flex"},uw={class:"mt-2"},fw={key:1,class:"flex flex-col"},hw={},mw=t.defineComponent({...hw,__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(Rr,"medium"),r=uo(),o=t.computed(()=>{var oe;return(oe=e==null?void 0:e.filteredItems)==null?void 0:oe[e.categoryItem.id]}),s=t.computed(()=>{var oe,fe;return V.isArray((oe=e.categoryItem)==null?void 0:oe.categories)&&((fe=e.categoryItem.categories)==null?void 0:fe.length)>0}),a=t.computed(()=>{var oe;return V.isArray((oe=e.categoryItem)==null?void 0:oe.products)?e.categoryItem.products:[]}),l=t.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([oe,fe])=>`${fe} руб./${O(oe)}`).join(", ")),c=t.computed(()=>V.isUndefined(e.filteredItems)||o.value==="*"?a.value:a.value.filter(oe=>{var ge;const fe=(ge=o.value)==null?void 0:ge.products;return V.isArray(fe)&&fe.includes(oe.id)})),d=t.computed(()=>c.value.length>0),u=t.computed(()=>V.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),f=t.computed(()=>V.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),h=t.computed(()=>V.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),p=t.computed(()=>{var ge,_e;const oe=(ge=w.value)==null?void 0:ge.hidingComment,fe=(_e=w.value)!=null&&_e.isDisabled?`Скрыто для клиента${oe?`. Причина: '${oe}'`:""}`:"Видимо клиенту";return u.value==="disabled"?`${fe}. ${Nr}`:fe}),m=t.computed(()=>{var ge;const oe=(ge=w.value)==null?void 0:ge.manager,fe=oe?`Категория закреплена за "${oe.name??"-"}"`:"Закрепить";return f.value==="disabled"?`${fe}. ${Nr}`:fe}),g=t.computed(()=>h.value==="disabled"?`${$s}. ${Nr}`:$s),b=t.computed(()=>V.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),y=t.computed(()=>{var oe,fe,ge;return((oe=e.categoryItem.properties)==null?void 0:oe.configurator)!==void 0&&Zu((fe=e.categoryItem.properties)==null?void 0:fe.configurator)&&Qu(e.categoryItem)&&((ge=e.categoryItem.properties)==null?void 0:ge.configuratorSettings)!==void 0&&(V.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),_=t.computed(()=>y.value&&(V.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),x=t.computed(()=>V.isNil(e.categoryContextButtonsConfig)?[]:V.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),w=t.computed(()=>new W.ClientCategory(e.categoryItem)),C=t.ref(!1),N=t.ref(!1),k=t.computed(()=>!V.isUndefined(e.isCategoryItemSelected)),$=t.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),v=t.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),E=t.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),P=t.computed(()=>L.value&&Ue.getDeviceTypeByResolution()===Xe.laptop?"auto":"fixed"),F=t.useTemplateRef("collapse-item-reference"),R=t.computed(()=>{var oe,fe;return(fe=(oe=e.categoryItem.properties)==null?void 0:oe.templateCost)==null?void 0:fe.priceCoefficient}),M=t.computed(()=>{var oe,fe;return(fe=(oe=e.categoryItem.properties)==null?void 0:oe.templateCost)==null?void 0:fe.increasePercent}),X=t.computed(()=>vi.isM2Category(e.categoryItem)?vi.findReferenceProduct(e.categoryItem):void 0),G=t.computed(()=>X.value?vi.calculateM2Cost(X.value,R.value,M.value):void 0),Z=t.computed(()=>{var oe,fe;return`${((fe=(oe=X.value)==null?void 0:oe.currency)==null?void 0:fe.symbol)??""}/м²`}),O=(oe,fe="ru-RU")=>0 .toLocaleString(fe,{style:"currency",currency:oe,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),A=oe=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:oe,target:F.value})},Y=(oe,fe)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:fe,isLoadingState:C,target:F.value})},H=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:F.value})},T=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:F.value})},D=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:F.value})},K=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:F.value})},J=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:F.value})},U=oe=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:oe,target:F.value})},q=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},L=t.ref(0),le=t.computed(()=>L.value&&a.value.length>0?oy(a.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}):[]),ue=V.debounce(()=>{L.value=window.innerWidth},20);return t.onUnmounted(()=>{window.removeEventListener("resize",ue),ue.cancel()}),window.addEventListener("resize",ue),ue(),(oe,fe)=>{const ge=I.NCheckbox,_e=bp,Qe=I.NTooltip,Re=pp,Mt=I.NTag,vn=fp,It=cp,en=I.NButton,Ln=sp,mn=ic,_t=nc,ae=tc,de=Ms,Ge=I.NDropdown,Ui=I.NDataTable,oi=I.NAlert,si=I.NSpin;return t.openBlock(),t.createBlock(rc,{ref:"collapse-item-reference",name:n.categoryItem.id,"data-id":n.categoryItem.id,"onHeader:click":Y},{"pre-arrow":t.withCtx(()=>{var at,qe;return[k.value?(t.openBlock(),t.createElementBlock("div",ew,[t.createVNode(ge,{checked:$.value,indeterminate:E.value,disabled:v.value,"onUpdate:checked":A},null,8,["checked","indeterminate","disabled"])])):t.createCommentVNode("",!0),!u.value&&((at=w.value)!=null&&at.isDisabled)?(t.openBlock(),t.createBlock(Qe,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(_e,{class:"pt-1.5"})]),default:t.withCtx(()=>[fe[1]||(fe[1]=t.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):t.createCommentVNode("",!0),((qe=w.value)==null?void 0:qe.isFavorite)??!1?(t.openBlock(),t.createBlock(Qe,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(Re,{class:"pt-1.5"})]),default:t.withCtx(()=>[fe[2]||(fe[2]=t.createTextVNode(" Избранная категория ",-1))]),_:1})):t.createCommentVNode("",!0)]}),header:t.withCtx(()=>{var at,qe,on,sn;return[t.createElementVNode("div",{class:t.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":n.categoryItem.isHidden,"text-gray-400":(at=w.value)==null?void 0:at.isDisabled})},[t.createVNode(Qe,{disabled:!n.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",null,t.toDisplayString(n.categoryItem.name),1)]),default:t.withCtx(()=>[fe[3]||(fe[3]=t.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),t.createElementVNode("div",{class:"w-fit",onClick:fe[0]||(fe[0]=t.withModifiers((...lt)=>t.unref(V.noop)&&t.unref(V.noop)(...lt),["prevent","stop"]))},[(qe=n.categoryItem.properties)!=null&&qe.templateCost?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[R.value||M.value||!t.unref(V.isNil)(G.value)?(t.openBlock(),t.createBlock(Mt,{key:0,size:t.unref(i),round:""},{default:t.withCtx(()=>{var lt;return[R.value?(t.openBlock(),t.createElementBlock("span",tw,t.toDisplayString((lt=R.value)==null?void 0:lt.name),1)):t.createCommentVNode("",!0),M.value?(t.openBlock(),t.createElementBlock("span",nw,t.toDisplayString(M.value>0?"+":"")+t.toDisplayString(t.unref(Ve).formatPercent(M.value))+"%",1)):t.createCommentVNode("",!0),t.unref(V.isNil)(G.value)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",{key:2,class:t.normalizeClass({"ml-1":R.value||M.value})},t.toDisplayString(G.value.toFixed(2))+" "+t.toDisplayString(Z.value),3))]}),_:1},8,["size"])):t.createCommentVNode("",!0)],64)):(on=n.categoryItem.properties)!=null&&on.m2Price?(t.openBlock(),t.createBlock(Mt,{key:1,size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createTextVNode(" Установленная стоимость: "+t.toDisplayString(n.categoryItem.properties.m2Price)+" руб./м2 ",1)]),_:1},8,["size"])):t.createCommentVNode("",!0),l.value?(t.openBlock(),t.createBlock(Mt,{key:2,size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createTextVNode(" Фиксированный курс: "+t.toDisplayString(l.value),1)]),_:1},8,["size"])):t.createCommentVNode("",!0),f.value&&((sn=w.value)!=null&&sn.manager)?(t.openBlock(),t.createBlock(Mt,{key:3,size:t.unref(i),closable:f.value!=="disabled",round:"",class:"align-bottom",onClose:K},{default:t.withCtx(()=>[t.createVNode(Qe,{placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>{var lt,jt;return[t.createElementVNode("span",iw,[t.createVNode(vn),t.createTextVNode(" "+t.toDisplayString((jt=(lt=w.value)==null?void 0:lt.manager)==null?void 0:jt.name),1)])]}),default:t.withCtx(()=>{var lt,jt;return[t.createTextVNode(' Категория закреплена за "'+t.toDisplayString((jt=(lt=w.value)==null?void 0:lt.manager)==null?void 0:jt.name)+'" ',1)]}),_:1})]),_:1},8,["size","closable"])):t.createCommentVNode("",!0)])]}),"sub-header":t.withCtx(()=>[n.showSlugs||n.showProperties?(t.openBlock(),t.createElementBlock("div",rw,[t.createElementVNode("ul",ow,[n.showSlugs?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList({id:n.categoryItem.id,slug:n.categoryItem.slug},(at,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(at),1))),128)):t.createCommentVNode("",!0),n.showProperties?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.categoryItem.properties,(at,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(at),1))),128)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)]),"header-extra":t.withCtx(()=>{var at;return[t.createElementVNode("div",sw,[oe.$slots["header-extra"]?(t.openBlock(),t.createElementBlock("div",aw,[t.renderSlot(oe.$slots,"header-extra",{categoryItem:n.categoryItem},void 0,!0)])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createBlock(Qe,{key:1,placement:"bottom",trigger:"hover",disabled:!t.unref(r)&&u.value!=="disabled"},{trigger:t.withCtx(()=>[t.createElementVNode("span",lw,[t.createVNode(en,{ghost:!0,disabled:u.value==="disabled",size:t.unref(i),onClick:H},{default:t.withCtx(()=>{var qe;return[(qe=w.value)!=null&&qe.isDisabled?(t.openBlock(),t.createBlock(_e,{key:1})):(t.openBlock(),t.createBlock(It,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(p.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),f.value&&!((at=w.value)!=null&&at.manager)?(t.openBlock(),t.createBlock(Qe,{key:2,placement:"bottom",trigger:"hover",disabled:!t.unref(r)&&f.value!=="disabled"},{trigger:t.withCtx(()=>[t.createElementVNode("span",cw,[t.createVNode(en,{ghost:!0,disabled:f.value==="disabled",size:t.unref(i),onClick:D},{default:t.withCtx(()=>[t.createVNode(Ln)]),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(m.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),h.value?(t.openBlock(),t.createBlock(Qe,{key:3,placement:"bottom",trigger:"hover",disabled:!t.unref(r)&&h.value!=="disabled"},{trigger:t.withCtx(()=>[t.createElementVNode("span",dw,[t.createVNode(en,{ghost:!0,disabled:h.value==="disabled",size:t.unref(i),onClick:T},{default:t.withCtx(()=>{var qe;return[(qe=w.value)!=null&&qe.isRequired?(t.openBlock(),t.createBlock(_t,{key:1})):(t.openBlock(),t.createBlock(mn,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(g.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createBlock(Qe,{key:4,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createVNode(en,{ghost:!0,size:t.unref(i),type:"primary",onClick:J},{default:t.withCtx(()=>[t.createVNode(ae)]),_:1},8,["size"])]),default:t.withCtx(()=>[fe[4]||(fe[4]=t.createTextVNode(" Редактировать ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),x.value.length>0?(t.openBlock(),t.createBlock(Ge,{key:5,options:x.value,size:t.unref(i),trigger:"click",onSelect:U},{default:t.withCtx(()=>[t.createVNode(en,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(de)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)])]}),default:t.withCtx(()=>[t.renderSlot(oe.$slots,"default",{},()=>{var at,qe,on;return[t.createElementVNode("div",uw,[s.value?(t.openBlock(),t.createBlock(ef,{key:0,"categories-items":n.categoryItem.categories??[],"has-products":d.value||C.value,"event-emitter":n.eventEmitter,"filtered-items":o.value?((at=o.value)==null?void 0:at.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},[oe.$slots["header-extra"]?{name:"header-extra",fn:t.withCtx(({categoryItem:sn})=>[t.renderSlot(oe.$slots,"header-extra",{categoryItem:sn},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)]),y.value&&_.value?(t.openBlock(),t.createBlock(Gu,{key:0,"event-emitter":n.eventEmitter,settings:(qe=n.categoryItem.properties)==null?void 0:qe.configuratorSettings,editor:(on=n.categoryItem.properties)==null?void 0:on.configurator,category:n.categoryItem},null,8,["event-emitter","settings","editor","category"])):d.value?(t.openBlock(),t.createElementBlock("div",fw,[y.value?(t.openBlock(),t.createBlock(en,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:q},{default:t.withCtx(()=>[...fe[5]||(fe[5]=[t.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createVNode(Ui,{columns:le.value,data:c.value,bordered:!0,loading:C.value,remote:!0,"row-key":sn=>sn.id,"table-layout":P.value,class:"mt-2"},null,8,["columns","data","loading","row-key","table-layout"])])):t.createCommentVNode("",!0),!C.value&&!N.value&&!s.value&&!d.value?(t.openBlock(),t.createBlock(oi,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):t.createCommentVNode("",!0),N.value?(t.openBlock(),t.createBlock(oi,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):t.createCommentVNode("",!0),C.value?(t.openBlock(),t.createBlock(si,{key:4,size:t.unref(i),class:"w-full"},{description:t.withCtx(()=>[...fe[6]||(fe[6]=[t.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):t.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),pw=gn(mw,[["__scopeId","data-v-9ed22ab1"]]),gw={class:"sc-collapse flex w-full flex-col"},yw={},Ju=t.defineComponent({...yw,__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",gw,[t.renderSlot(s.$slots,"default")]))}}),bw={},ef=t.defineComponent({...bw,__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(Rr,"medium"),r=t.computed(()=>V.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(V.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=I.NSpin,c=I.NAlert;return t.openBlock(),t.createElementBlock(t.Fragment,null,[r.value.length>0?(t.openBlock(),t.createBlock(Ju,{key:0},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,d=>(t.openBlock(),t.createBlock(pw,{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)}}}),_w={},tf=t.defineComponent({..._w,__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(()=>V.isArray(r.value)),a=new W.Reference,l=t.computed(()=>V.isNil(r.value)?s.value?[]:null:V.isArray(r.value)?r.value.filter(m=>!V.isNil(m)).map(m=>m.id):r.value.id),c=t.computed(()=>wt.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(V.isArray(m)){const b=m.length>0?m.map(y=>{var _;return(_=c.value.find(x=>x.value===y))==null?void 0:_.item}).filter(y=>!V.isNil(y)):[];o("update:value",b)}else{const b=m===a.id||V.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(I.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"]))}}),ww={},xw=t.defineComponent({...ww,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{},m2ReferenceProduct:{},disabledCoefficient:{type:Function},visibleCoefficient:{type:Function}},emits:["update:value"],setup(n,{emit:e}){var E,P;const i=n,r=e,o=()=>{const F=W.PriceCoefficient.getRetailPriceCoefficient();return V.unset(F,"isNewRec"),F},s=F=>!F||F.id===o().id,a=t.computed(()=>{var F;return((F=i.catalogItem)==null?void 0:F.type)==="product"}),l=t.computed(()=>!a.value&&!V.isNil(i.m2ReferenceProduct)),c=t.computed(()=>a.value?i.catalogItem:i.m2ReferenceProduct),d=t.computed(()=>!V.isNil(c.value)),u=t.computed(()=>{var F;return`${((F=c.value)==null?void 0:F.currency.symbol)??""}${l.value?"/м²":""}`}),f=F=>l.value&&i.m2ReferenceProduct?vi.toM2Cost(F,i.m2ReferenceProduct):F,h=t.computed(()=>c.value?f(c.value.retailCost??c.value.cost):void 0),p=t.computed(()=>{var F;return(((F=c.value)==null?void 0:F.priceCoefficients)??[]).map(R=>({...R,cost:f(R.cost)}))}),m=F=>{var R;return F.id===o().id?h.value:(R=p.value.find(M=>M.coefficient.id===F.id))==null?void 0:R.cost},g=t.computed(()=>{var M;const R=[...((M=W.useReferencesStore().priceCoefficientsReference)==null?void 0:M.map(X=>structuredClone(t.toRaw(X))))??[],o()].filter(X=>{var G;return((G=i.visibleCoefficient)==null?void 0:G.call(i,X))??!0});return d.value&&R.forEach(X=>{const G=m(X);G?X.name+=` (${V.round(G,2)} ${u.value})`:X.name=""}),R.filter(X=>X.name!=="")}),b=t.ref(i.value.coefficient),y=t.ref(((P=(E=i.value)==null?void 0:E.value)==null?void 0:P.toString())??null),_=t.ref(null),x=t.computed(()=>p.value.find(F=>F.coefficient.slug===W.PriceCoefficientEnum.K0)),w=t.ref(void 0),C=F=>Number.parseFloat((F??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),N=()=>{var R,M;w.value=void 0;let F=C(y.value);if(F=Number.isNaN(F)?void 0:F,d.value)if(b.value||y.value){const X=o(),G=m(b.value??X)??0,Z=G+G*((F??0)/100);_.value=Ve.formatMoney(Z,(R=productData.value)==null?void 0:R.currency.precision),Z>(h.value??Z)&&(w.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),x.value&&Z<(((M=x.value)==null?void 0:M.cost)??0)&&(w.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else _.value=null;r("update:value",{value:Number.isNaN(F)?void 0:F,coefficient:s(b.value)?void 0:structuredClone(t.toRaw(b.value))})},k=F=>{V.isArray(F)||V.isNull(F)||(b.value=F,y.value=null,!b.value&&y.value&&(b.value=o()),N())},$=()=>{b.value||(b.value=o()),N()},v=F=>{var M,X;const R=C(F);if(d.value){if(Number.isNaN(R)){b.value=void 0,y.value=null,r("update:value",{value:void 0,coefficient:void 0});return}let G=0;if(R<=0)b.value=void 0,y.value=null;else if(x.value&&R<(((M=x.value)==null?void 0:M.cost)??0))b.value=(X=x.value)==null?void 0:X.coefficient,G=(R-x.value.cost)*100/x.value.cost,w.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(R>(h.value??R)){b.value=o();const Z=h.value??0;G=(R-Z)*100/Z,w.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const Z=p.value,O=V.sortBy(Z,[H=>H.cost]),Y=O.filter(H=>H.cost<=R).at(-1)??O.at(0);Y&&(b.value=Y.coefficient,G=(R-Y.cost)*100/Y.cost),w.value={validationStatus:void 0,feedback:void 0}}G=Ve.roundPercent(G),y.value=Ve.formatPercent(G,Ve.percentFractionDigits),r("update:value",{value:Number.isNaN(G)?void 0:G,coefficient:s(b.value)?void 0:structuredClone(t.toRaw(b.value))})}else r("update:value",{value:Number.isNaN(R)?void 0:R,coefficient:void 0})};return t.onMounted(()=>{var F,R,M,X;i.calculationType===W.CalculationTypeEnum.m2Cost?_.value=((R=(F=i.value)==null?void 0:F.value)==null?void 0:R.toString())??null:!((M=i.value)!=null&&M.coefficient)&&((X=i.value)!=null&&X.value)&&(b.value=o()),N()}),(F,R)=>{var G,Z,O;const M=I.NInput,X=I.NInputGroup;return t.openBlock(),t.createBlock(t.unref(I.NFormItem),{"show-label":!t.unref(V.isNil)(n.label),label:n.label,"show-feedback":!t.unref(V.isNil)(((G=w.value)==null?void 0:G.feedback)??n.feedback),feedback:((Z=w.value)==null?void 0:Z.feedback)??n.feedback,"validation-status":((O=w.value)==null?void 0:O.validationStatus)??n.validationStatus},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass([{"sm:grid-cols-3":d.value},"grid w-full grid-cols-1 gap-2"])},[n.calculationType!==t.unref(W.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(X,{key:0,class:t.normalizeClass(["w-full flex-row",{"sm:col-span-2":d.value}])},{default:t.withCtx(()=>[t.createVNode(tf,{class:"w-full min-w-0 flex-1",value:b.value,"reference-list":g.value,clearable:n.clearable,disabled:n.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"disabled-item":n.disabledCoefficient,"onUpdate:value":k},null,8,["value","reference-list","clearable","disabled","disabled-item"]),t.createVNode(M,{value:y.value,"onUpdate:value":[R[0]||(R[0]=A=>y.value=A),$],clearable:n.clearable,disabled:n.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},t.createSlots({suffix:t.withCtx(()=>[R[3]||(R[3]=t.createTextVNode("%",-1))]),_:2},[y.value&&!y.value.startsWith("-")?{name:"prefix",fn:t.withCtx(()=>[R[2]||(R[2]=t.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):t.createCommentVNode("",!0),d.value||n.calculationType===t.unref(W.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(M,{key:1,value:_.value,"onUpdate:value":[R[1]||(R[1]=A=>_.value=A),v],clearable:n.clearable,disabled:n.disabled,placeholder:l.value?"Стоимость за м²":"Стоимость",class:"w-full"},t.createSlots({_:2},[d.value?{name:"suffix",fn:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(u.value),1)]),key:"0"}:void 0]),1032,["value","clearable","disabled","placeholder"])):t.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),kw={class:"text-sm"},Cw={class:"text-sm"},vw={},Sw=t.defineComponent({...vw,__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,M,X;return((R=a.value)==null?void 0:R.unit.isLinear)&&((X=(M=a.value)==null?void 0:M.properties)==null?void 0:X.isLengthConfigurator)}),c=t.computed(()=>a.value?W.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()),x=t.ref(!1),w=t.computed(()=>{var Z,O,A,Y;if(!a.value)return{};const R=W.UnitsHelper.getProductLengthMultiplicity(a.value),M=W.UnitsHelper.getProductMultiplicity(a.value),X=((O=(Z=a.value)==null?void 0:Z.properties)==null?void 0:O.minLength)||R,G=(Y=(A=a.value)==null?void 0:A.properties)==null?void 0:Y.maxLength;return{length:[ce.required,ce.min(X??.1),ce.max(G),ce.step(R),We.serverValidation(_.value.length.feedback)],quantity:[ce.required,ce.min(M),ce.step(M),We.serverValidation(_.value.quantity.feedback)],marker:[We.serverValidation(_.value.marker.feedback)]}}),C=t.computed(()=>{var R,M,X;return a.value?((R=a.value.properties)==null?void 0:R.lengthStep)??((M=a.value.properties)!=null&&M.ignoreMinCountCheck?0:((X=a.value.properties)==null?void 0:X.minCount)??0):0}),N=t.computed(()=>{var X,G,Z,O,A,Y,H,T,D;if(!a.value)return"";const R=((G=(X=a.value)==null?void 0:X.properties)==null?void 0:G.minLength)??((O=(Z=a.value)==null?void 0:Z.properties)!=null&&O.ignoreMinCountCheck?0:(Y=(A=a.value)==null?void 0:A.properties)==null?void 0:Y.minCount),M=(T=(H=a.value)==null?void 0:H.properties)==null?void 0:T.maxLength;return R||M?`(${R?`от ${R}`:""}${R&&M?" ":""}${M?`до ${M}`:""} ${(D=a.value)==null?void 0:D.unit.name})`:""}),k=R=>{var O,A;if(!((A=(O=a.value)==null?void 0:O.properties)!=null&&A.isLengthConfigurator)||!h.value||V.isNil(R)||C.value===0)return;const M=R/C.value,X=Math.round(M),G=W.UnitsHelper.getProductMultiplicity(a.value),Z=Math.max(X,G);h.value.quantity=Z},$=R=>{var Z,O,A,Y;if(!((O=(Z=a.value)==null?void 0:Z.properties)!=null&&O.isLengthConfigurator)||!h.value||V.isNil(R)||C.value===0)return;const M=Ve.multiplyByStep(R,C.value),X=((A=a.value.properties)==null?void 0:A.minLength)||W.UnitsHelper.getProductLengthMultiplicity(a.value),G=(Y=a.value.properties)==null?void 0:Y.maxLength;X!==void 0&&M<X?h.value.length=X:G!==void 0&&M>G?h.value.length=G:h.value.length=M},v=async R=>{var X;const M=V.cloneDeep(h.value);try{await((X=r.value)==null?void 0:X.validate(G=>{if(!G){if(!a.value||!M)return;W.UnitsHelper.productIsMeasurable(a.value)||delete M.length,l.value&&C.value&&(M.length=C.value),x.value=!0,b("submit",M,_.value,()=>{x.value=!1,R(!1),t.nextTick(()=>{var Z;(Z=r.value)==null||Z.validate(V.noop).catch(V.noop)})})}}))}catch{}},E=()=>{a.value=null,d.value=void 0,h.value=null,_.value=y()},P=()=>{s.value=!1};return e({show:(R,M)=>{var X,G,Z,O,A;if(E(),s.value=!0,a.value=R,d.value=M==null?void 0:M.cartItemData,u.value=M==null?void 0:M.orderId,f.value=(M==null?void 0:M.canSetDopProdaga)??!1,h.value=new W.OrderItemBase((M==null?void 0:M.cartItemData)??new W.OrderItemBase({product:R,quantity:W.UnitsHelper.productIsMeasurable(a.value)?1:((X=R==null?void 0:R.properties)==null?void 0:X.minCount)??1,length:((G=R==null?void 0:R.properties)==null?void 0:G.minLength)||((Z=R==null?void 0:R.properties)!=null&&Z.ignoreMinCountCheck?0:(O=R==null?void 0:R.properties)==null?void 0:O.minCount)||0})),(A=R==null?void 0:R.properties)!=null&&A.isLengthConfigurator&&h.value&&C.value>0){const Y=C.value,H=h.value.quantity||1;h.value.length=Ve.multiplyByStep(H,Y)}},closeDialog:P}),(R,M)=>{var A;const X=I.NFormItem,G=I.NInputGroupLabel,Z=I.NInputGroup,O=I.NCheckbox;return t.openBlock(),t.createBlock(Os,{ref:"base-dialog-reference",show:s.value,title:`${d.value?"Изменение":"Добавление"} товара ${(A=a.value)==null?void 0:A.name} в ${u.value?` заказ №${u.value}`:"корзину"}`,"accept-button":{show:!0,text:d.value?"Изменить":"Добавить"},processing:x.value,"modal-width":500,onAccept:v,onClosing:P},{default:t.withCtx(()=>[a.value&&h.value?t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{key:0,ref:"form-reference",model:h.value,rules:w.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.unref(W.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(X,{key:0,path:"length",label:`Метраж, ${N.value+a.value.unit.name}`},t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:m.value,"onUpdate:value":[M[0]||(M[0]=Y=>m.value=Y),k],parse:t.unref(ht),step:t.unref(W.UnitsHelper).getProductLengthMultiplicity(a.value),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:M[1]||(M[1]=Y=>t.unref(fo)(Y,".",!1)),onInput:M[2]||(M[2]=Y=>t.unref(dt)(_.value,"length")),onFocus:t.unref(He)},null,8,["value","parse","step","onFocus"])]),_:2},[!_.value.length.feedback&&t.unref(W.UnitsHelper).getProductLengthMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",kw,"Метраж должно быть кратно "+t.toDisplayString(t.unref(W.UnitsHelper).getProductLengthMultiplicity(a.value)),1)]),key:"0"}:void 0]),1032,["label"])):t.createCommentVNode("",!0),t.createVNode(X,{path:"quantity",label:`Количество, ${c.value}`},{default:t.withCtx(()=>[t.createVNode(Z,null,t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:p.value,"onUpdate:value":[M[3]||(M[3]=Y=>p.value=Y),$],parse:t.unref(ht),step:t.unref(W.UnitsHelper).getProductMultiplicity(a.value),"show-button":t.unref(W.UnitsHelper).getProductMultiplicity(a.value)>1,"button-placement":"both",placeholder:"Введите количество",class:"w-full",onKeydown:M[4]||(M[4]=Y=>t.unref(fo)(Y,".",!1)),onInput:M[5]||(M[5]=Y=>t.unref(dt)(_.value,"quantity")),onFocus:t.unref(He)},null,8,["value","parse","step","show-button","onFocus"]),l.value?(t.openBlock(),t.createBlock(G,{key:0,class:"bg-orange-100 font-bold"},{default:t.withCtx(()=>[t.createTextVNode(" x "+t.toDisplayString(C.value)+" "+t.toDisplayString(a.value.unit.name),1)]),_:1})):t.createCommentVNode("",!0)]),_:2},[!_.value.quantity.feedback&&t.unref(W.UnitsHelper).getProductMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",Cw,"Количество должно быть кратно "+t.toDisplayString(t.unref(W.UnitsHelper).getProductMultiplicity(a.value)),1)]),key:"0"}:void 0]),1024)]),_:1},8,["label"]),t.unref(W.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(X,{key:1,path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:h.value.marker??null,placeholder:"Введите маркировку",onInput:M[6]||(M[6]=Y=>t.unref(dt)(_.value,"marker")),"onUpdate:value":M[7]||(M[7]=Y=>g(Y)),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1})):t.createCommentVNode("",!0),f.value?(t.openBlock(),t.createBlock(O,{key:2,checked:h.value.isAdditionalSale,"onUpdate:checked":M[8]||(M[8]=Y=>h.value.isAdditionalSale=Y),"true-value":!0,"false-value":!1},{default:t.withCtx(()=>[...M[9]||(M[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0)]),_:1},8,["model","rules"])),[[t.unref(ai),()=>{var Y,H;return(H=(Y=o.value)==null?void 0:Y.acceptHandler)==null?void 0:H.call(Y)}]]):t.createCommentVNode("",!0)]),_:1},8,["show","title","accept-button","processing"])}}}),Bw={class:"flex flex-row gap-1"},Nw={class:"sc-client-name flex flex-col gap-1 text-base"},Tw=["href"],$w={key:1,class:"text-sc-grey"},Ew={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Rw={key:0},Pw={key:1,class:"text-sm"},Fw={},Dr=t.defineComponent({...Fw,__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?Ce.format(i.client.lastLoginAt,W.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{V.isNil(i.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",i.client,a)};return(a,l)=>{const c=ho,d=I.NButton,u=I.NPopover;return t.openBlock(),t.createElementBlock("div",Bw,[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(V.isNil)(n.popoverPosition),placement:n.popoverPosition},{trigger:t.withCtx(()=>[t.createElementVNode("div",Nw,[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",$w," [ Деактивирован ] "))],8,Tw),n.showCityAndRegion&&n.client.city?(t.openBlock(),t.createElementBlock("span",Ew," г. "+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",Rw,t.toDisplayString(n.client.alternativeName),1)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("span",Pw," Последний вход: "+t.toDisplayString(o.value),1)):t.createCommentVNode("",!0),t.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),Vw={class:"text-base"},Mw={},nf=t.defineComponent({...Mw,__name:"contragent-with-short-info",props:{contragent:{}},setup(n){const e=n,i=t.computed(()=>li.getFormatEntityName(e.contragent));return(r,o)=>(t.openBlock(),t.createElementBlock("span",Vw,t.toDisplayString(i.value),1))}}),Iw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Aw(n,e){return t.openBlock(),t.createElementBlock("svg",Iw,[...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 Ow=t.markRaw({name:"tabler-mail",render:Aw}),zw=["href"],Dw={},Lw=t.defineComponent({...Dw,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(n){return(e,i)=>{const r=Ow;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,zw)],2)}}}),Hw={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Ww(n,e){return t.openBlock(),t.createElementBlock("svg",Hw,[...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 rf=t.markRaw({name:"fa6-brands-viber",render:Ww}),jw={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},qw=["id"],Xw=["id"],Yw=["fill"],Uw=["fill"];function Kw(n,e){return t.openBlock(),t.createElementBlock("svg",jw,[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,qw),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,Xw)]),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,Yw),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,Uw),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 of=t.markRaw({name:"logos-whatsapp-icon",render:Kw,setup(){const n=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+n(),SVGHW6lecxh:"uicons-"+n()}}}}),Gw={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},Zw=["id"],Qw=["fill"];function Jw(n,e){return t.openBlock(),t.createElementBlock("svg",Gw,[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,Zw)]),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,Qw),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 sf=t.markRaw({name:"logos-telegram",render:Jw,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),ex={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function tx(n,e){return t.openBlock(),t.createElementBlock("svg",ex,[...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 af=t.markRaw({name:"ion-call",render:tx}),nx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ix(n,e){return t.openBlock(),t.createElementBlock("svg",nx,[...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 rx=t.markRaw({name:"tabler-phone-call",render:ix}),ox={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},sx=["href"],ax=["href"],lx=["href"],cx=["href"],dx={},ux=t.defineComponent({...dx,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>{try{return e.phone?Br.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=t.computed(()=>{var l;return V.isString(i.value)?!1:((l=i.value)==null?void 0:l.isValid())??!1}),o=t.computed(()=>{var l;return V.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=t.computed(()=>{var l;return V.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("E.164"))??""}),a=t.ref(!1);return(l,c)=>{const d=rx,u=af,f=sf,h=of,p=rf;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",ox,[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,sx)):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,ax)):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,lx)):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,cx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],34)])}}}),fx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function hx(n,e){return t.openBlock(),t.createElementBlock("svg",fx,[...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 mx=t.markRaw({name:"mdi-envelope",render:hx}),px={class:"flex flex-col gap-1"},gx={key:0,class:"mb-2 flex flex-col text-base"},yx={key:0,class:"text-sc-dark-grey text-sm"},bx={key:1,class:"whitespace-nowrap text-sm"},_x={key:2,class:"whitespace-nowrap text-sm"},wx={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},xx=["href"],kx=["href"],Cx=["href"],vx=["href"],Sx=["href"],Bx={key:0,class:"flex flex-col text-base"},Nx={key:0,class:"text-sc-dark-grey text-sm"},Tx={key:1,class:"mt-2 text-sm"},$x={key:0,class:"-mt-1"},Ex={},Rx=t.defineComponent({...Ex,__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(()=>li.getFormatEntityName(e.contact)),r=t.computed(()=>{try{return e.contact.phone?Br.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),o=t.computed(()=>{var d;return V.isString(r.value)?!1:((d=r.value)==null?void 0:d.isValid())??!1}),s=t.computed(()=>{var d;return V.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("INTERNATIONAL"))??""}),a=t.computed(()=>{var d;return V.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=af,h=sf,p=of,m=rf,g=mx,b=I.NPopover;return t.openBlock(),t.createElementBlock("div",px,[t.createVNode(b,{disabled:n.fullView,placement:"bottom"},{trigger:t.withCtx(()=>{var x,w,C,N;return[t.createElementVNode("div",{class:t.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(x=n.contact)!=null&&x.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${n.classes}`),style:t.normalizeStyle(n.styles),onMouseenter:u[0]||(u[0]=k=>c.value=!0),onFocusin:u[1]||(u[1]=k=>c.value=!0),onMouseleave:u[2]||(u[2]=k=>c.value=!1),onFocusout:u[3]||(u[3]=k=>c.value=!1)},[t.createElementVNode("div",null,[n.fullView&&(n.contact.name||(w=n.contact)!=null&&w.position)?(t.openBlock(),t.createElementBlock("div",gx,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(C=n.contact)!=null&&C.position?(t.openBlock(),t.createElementBlock("span",yx,t.toDisplayString((N=n.contact)==null?void 0:N.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),n.contact.phone?(t.openBlock(),t.createElementBlock("div",bx,t.toDisplayString(s.value),1)):t.createCommentVNode("",!0),n.contact.email?(t.openBlock(),t.createElementBlock("div",_x,t.toDisplayString(n.contact.email),1)):t.createCommentVNode("",!0),l.value&&c.value?(t.openBlock(),t.createElementBlock("div",wx,[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,xx)):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,kx)):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,Cx)):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,vx)):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,Sx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)])],38)]}),default:t.withCtx(()=>{var x,w,C,N;return[n.contact.name?(t.openBlock(),t.createElementBlock("div",Bx,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(x=n.contact)!=null&&x.position?(t.openBlock(),t.createElementBlock("span",Nx,t.toDisplayString((w=n.contact)==null?void 0:w.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),(C=n.contact)!=null&&C.comment?(t.openBlock(),t.createElementBlock("div",Tx,[u[4]||(u[4]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((N=n.contact)==null?void 0:N.comment),1)])):t.createCommentVNode("",!0)]}),_:1},8,["disabled"]),n.fullView&&((y=n.contact)!=null&&y.comment)?(t.openBlock(),t.createElementBlock("div",$x,[u[5]||(u[5]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((_=n.contact)==null?void 0:_.comment),1)])):t.createCommentVNode("",!0)])}}});class Px{constructor(e){B(this,"minHeight");B(this,"maxHeights");B(this,"minWidth");B(this,"maxWidths");B(this,"netType");B(this,"color");B(this,"mountType");B(this,"descriptions");B(this,"crossbarCount");B(this,"heightOverlaps");B(this,"widthOverlaps");B(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=Ns.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=Ns.objectToSnake(e.heightOverlaps),this.widthOverlaps=Ns.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function Fx(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==W.ConfiguratorsEnum.SandwichM2?!0:n.properties.configuratorSettings!==void 0&&V.isArray(n.products)&&n.products.length>0}const Vx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Mx(n,e){return t.openBlock(),t.createElementBlock("svg",Vx,[...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 Ix=t.markRaw({name:"mdi-dots-horizontal",render:Mx}),Ax={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ox(n,e){return t.openBlock(),t.createElementBlock("svg",Ax,[...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 zx=t.markRaw({name:"mdi-magnify-minus-outline",render:Ox}),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.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 Hx=t.markRaw({name:"mdi-magnify-plus-outline",render:Lx}),Wx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function jx(n,e){return t.openBlock(),t.createElementBlock("svg",Wx,[...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 lf=t.markRaw({name:"mdi-chevron-right",render:jx}),qx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Xx(n,e){return t.openBlock(),t.createElementBlock("svg",qx,[...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 cf=t.markRaw({name:"mdi-chevron-left",render:Xx}),Yx={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"},Lr={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"},df="date-range.dialog.mode",uf="date-range.dialog.scale",ff="date-range.quick-periods",hf=["thisMonth","lastMonth","thisQuarter","lastQuarter","thisYear","lastYear","fromBeginningOfThisYear"],mf=["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],Ux=["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],Kx=["Пн","Вт","Ср","Чт","Пт","Сб","Вс"],pf=new Date(2e3,0,1),Ri=n=>Ce.differenceInCalendarDays(n,pf),gf=n=>Ce.addDays(pf,n),yf=(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?Ce.startOfDay(r):void 0,to:o?Ce.endOfDay(o):void 0}},Aa=n=>Object.entries(n).map(([e,i])=>({value:e,label:i.label,item:i})),bf=(n,e)=>{const i=Object.entries(n).filter(([,r])=>r.group===e);return e!=="other"?[{type:"group",key:e,children:Aa(Object.fromEntries(i))}]:W.STANDARD_PERIOD_SECTIONS.map(r=>{const o=i.filter(([,s])=>s.section===r.key);return{type:"group",key:r.key,label:r.label,children:Aa(Object.fromEntries(o))}}).filter(r=>r.children.length>0)},_f=(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}},Gx={class:"flex items-center justify-between gap-2"},Zx={class:"flex items-center gap-2"},Qx={class:"text-center font-semibold"},Jx={class:"grid grid-cols-7 gap-0.5 text-center text-xs text-gray-500"},ek={class:"grid grid-cols-7 gap-0.5"},tk=["disabled","onPointerdown","onPointerenter","onKeydown"],nk={},ik=t.defineComponent({...nk,__name:"day-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=42,s=I.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=Ue.initRefDependingOnDeviceResolution(1,2,3),c=t.computed(()=>["grid-cols-1","grid-cols-2","grid-cols-3"][l.value-1]),d=y=>Ce.subMonths(Ce.startOfMonth(y),l.value===3?1:0),u=y=>y&&Ce.isValid(y)?y:new Date,f=t.ref(d(u(i.from??i.to))),h=t.computed(()=>{const{from:y,to:_}=i;return!y||!_||!Ce.isValid(y)||!Ce.isValid(_)?null:[Ri(y),Ri(_)]}),p=_f(h,(y,_)=>{r("select",{from:Ce.startOfDay(gf(y)),to:Ce.endOfDay(gf(_))})}),m=y=>{const _=Ce.subDays(y,(Ce.getDay(y)+6)%7);return V.times(o,x=>{const w=Ce.addDays(_,x);return{index:Ri(w),day:w.getDate(),isCurrentMonth:Ce.isSameMonth(w,y),isToday:Ce.isToday(w)}})},g=t.computed(()=>V.times(l.value,y=>{const _=Ce.addMonths(f.value,y);return{key:`${_.getFullYear()}-${_.getMonth()}`,title:`${Ux[_.getMonth()]} ${_.getFullYear()}`,cells:m(_)}})),b=y=>{if(!y.isCurrentMonth)return["sc-day--outside"];const _=y.isToday?["sc-day--today"]:[],x=p.cellPosition(y.index);return x&&_.push(`sc-day--${x}`),_};return t.watch(()=>[i.from,i.to],()=>{const y=i.from??i.to;if(!y||!Ce.isValid(y))return;const _=`${y.getFullYear()}-${y.getMonth()}`;V.some(g.value,["key",_])||(f.value=d(y))}),(y,_)=>{const x=cf,w=I.NButton,C=lf;return t.openBlock(),t.createElementBlock("div",{class:"flex select-none flex-col gap-3",style:t.normalizeStyle(a.value),onPointerleave:_[2]||(_[2]=(...N)=>t.unref(p).pointerLeaveHandler&&t.unref(p).pointerLeaveHandler(...N))},[t.createElementVNode("div",Gx,[t.createVNode(w,{size:"small","aria-label":"Предыдущий месяц","theme-overrides":t.unref(Lr),onClick:_[0]||(_[0]=N=>f.value=t.unref(Ce.subMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(x)]),_:1},8,["theme-overrides"]),_[3]||(_[3]=t.createElementVNode("span",{class:"text-sm text-gray-600"},"Выберите диапазон на календаре",-1)),t.createElementVNode("div",Zx,[t.renderSlot(y.$slots,"actions",{},void 0,!0),t.createVNode(w,{size:"small","aria-label":"Следующий месяц","theme-overrides":t.unref(Lr),onClick:_[1]||(_[1]=N=>f.value=t.unref(Ce.addMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(C)]),_: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,N=>(t.openBlock(),t.createElementBlock("div",{key:N.key,class:"flex flex-col gap-1"},[t.createElementVNode("div",Qx,t.toDisplayString(N.title),1),t.createElementVNode("div",Jx,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Kx),k=>(t.openBlock(),t.createElementBlock("span",{key:k},t.toDisplayString(k),1))),128))]),t.createElementVNode("div",ek,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.cells,k=>(t.openBlock(),t.createElementBlock("button",{key:k.index,type:"button",class:t.normalizeClass(["sc-day h-7 rounded border-0 p-0 text-xs",b(k)]),disabled:!k.isCurrentMonth,onPointerdown:t.withModifiers($=>t.unref(p).pointerDownHandler(k.index),["prevent"]),onPointerenter:$=>t.unref(p).pointerEnterHandler(k.index),onKeydown:[t.withKeys(t.withModifiers($=>t.unref(p).selectHandler(k.index),["prevent"]),["enter"]),t.withKeys(t.withModifiers($=>t.unref(p).selectHandler(k.index),["prevent"]),["space"])]},t.toDisplayString(k.day),43,tk))),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)}}}),rk=gn(ik,[["__scopeId","data-v-a41e813d"]]),ok={class:"flex items-center justify-between gap-2"},sk={class:"flex items-center gap-2"},ak={class:"text-center font-semibold"},lk={class:"grid grid-cols-3 gap-2"},ck=["onPointerdown","onPointerenter","onKeydown"],dk={},uk=t.defineComponent({...dk,__name:"month-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=I.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&&Ce.isValid(p)?p.getFullYear():m},l=t.ref(a(i.from??i.to)),c=Ue.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||!Ce.isValid(p)||!Ce.isValid(m)?null:[p.getFullYear()*12+p.getMonth(),m.getFullYear()*12+m.getMonth()]}),f=_f(u,(p,m)=>{r("select",{from:new Date(Math.floor(p/12),p%12,1),to:Ce.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||!Ce.isValid(p))return;const m=p.getFullYear();(m<l.value-1||m>l.value+1)&&(l.value=m)}),(p,m)=>{const g=cf,b=I.NButton,y=lf;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",ok,[t.createVNode(b,{size:"small","aria-label":"Предыдущий год","theme-overrides":t.unref(Lr),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",sk,[t.renderSlot(p.$slots,"actions",{},void 0,!0),t.createVNode(b,{size:"small","aria-label":"Следующий год","theme-overrides":t.unref(Lr),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",ak,t.toDisplayString(_),1),t.createElementVNode("div",lk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(mf),(x,w)=>(t.openBlock(),t.createElementBlock("button",{key:x,type:"button",class:t.normalizeClass(["sc-month cursor-pointer rounded-lg px-1 py-2.5 text-sm",h(_,w)]),onPointerdown:t.withModifiers(C=>t.unref(f).pointerDownHandler(_*12+w),["prevent"]),onPointerenter:C=>t.unref(f).pointerEnterHandler(_*12+w),onKeydown:[t.withKeys(t.withModifiers(C=>t.unref(f).selectHandler(_*12+w),["prevent"]),["enter"]),t.withKeys(t.withModifiers(C=>t.unref(f).selectHandler(_*12+w),["prevent"]),["space"])]},t.toDisplayString(x),43,ck))),128))])]))),128))],2)],36)}}}),fk=gn(uk,[["__scopeId","data-v-dd09a19d"]]),hk={class:"sc-date-range-sidebar flex flex-col gap-1"},mk={class:"flex items-center justify-center gap-1"},pk={class:"min-w-12 text-center font-semibold"},gk={class:"grid grid-flow-col grid-cols-2 grid-rows-6 gap-1"},yk={},bk=t.defineComponent({...yk,__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=I.NButton;return t.openBlock(),t.createElementBlock("div",hk,[t.createElementVNode("div",mk,[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",pk,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",gk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(mf),(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})])}}}),_k={},wf=t.defineComponent({..._k,__name:"date-range-input",props:{clearable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{default:void 0},value:{default:null},dateFormat:{default:()=>W.useBaseConfigStateStore().config.dateFormats.uiDate}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=Ue.initRefDependingOnDeviceResolution(!0,!1,!1),s=t.ref(null),a=t.ref(!1),l=t.ref(0),c=t.ref(i.value&&Ce.isValid(i.value)?i.value:new Date),d=t.computed(()=>{const x=i.value&&Ce.isValid(i.value)?i.value:c.value;return x.getFullYear()===c.value.getFullYear()?x.getMonth():null});let u=0;const f=x=>{var w,C;(C=(w=x.target)==null?void 0:w.closest)!=null&&C.call(w,".n-base-clear__clear")&&(u=performance.now())},h=x=>{x&&performance.now()-u<300||(a.value=x,x&&(c.value=i.value&&Ce.isValid(i.value)?i.value:new Date))},p=x=>{r("update:value",x===null?null:new Date(x))},m=(x,w)=>{const C=new Date(x,w,1);if(c.value=C,i.value&&Ce.isValid(i.value)){const N=Math.min(Ce.getDate(i.value),Ce.getDaysInMonth(C));r("update:value",new Date(x,w,N));return}l.value+=1,t.nextTick().then(()=>{var N;return(N=s.value)==null?void 0:N.focus()})},g=(x,w)=>{c.value=Ce.addYears(Ce.addMonths(c.value,x),w)},b=x=>{m(x,c.value.getMonth())},y=x=>{m(c.value.getFullYear(),x)},_=()=>{a.value=!1,r("update:value",new Date)};return(x,w)=>{const C=I.NButton,N=I.NDatePicker;return t.openBlock(),t.createBlock(N,{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:w[0]||(w[0]=k=>g(1,0)),onPrevMonth:w[1]||(w[1]=k=>g(-1,0)),onNextYear:w[2]||(w[2]=k=>g(0,1)),onPrevYear:w[3]||(w[3]=k=>g(0,-1))},{footer:t.withCtx(()=>[t.unref(o)?(t.openBlock(),t.createBlock(C,{key:1,size:"small",text:"",type:"info",onClick:_},{default:t.withCtx(()=>[...w[4]||(w[4]=[t.createTextVNode(" Сегодня ",-1)])]),_:1})):(t.openBlock(),t.createBlock(bk,{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"])}}}),wk={key:0,class:"text-gray-400"},xk={},xf=t.defineComponent({...xk,__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=Ue.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(wf,{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",wk," – ")),t.createVNode(wf,{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)}}}),kk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ck(n,e){return t.openBlock(),t.createElementBlock("svg",kk,[...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 vk=t.markRaw({name:"mdi-calendar-month-outline",render:Ck}),Sk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Bk(n,e){return t.openBlock(),t.createElementBlock("svg",Sk,[...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 Nk=t.markRaw({name:"mdi-chart-line",render:Bk}),Tk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function $k(n,e){return t.openBlock(),t.createElementBlock("svg",Tk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M22 21H2V3h2v16h2v-9h4v9h2V6h4v13h2v-5h4z"},null,-1)])])}const Ek=t.markRaw({name:"mdi-chart-bar",render:$k}),Rk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Pk(n,e){return t.openBlock(),t.createElementBlock("svg",Rk,[...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 Fk=t.markRaw({name:"mdi-calendar-week-outline",render:Pk}),Vk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Mk(n,e){return t.openBlock(),t.createElementBlock("svg",Vk,[...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 Ik=t.markRaw({name:"mdi-calendar-today-outline",render:Mk}),Ak={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ok(n,e){return t.openBlock(),t.createElementBlock("svg",Ak,[...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 zk=t.markRaw({name:"mdi-cog-outline",render:Ok}),Dk={class:"grid gap-x-6 gap-y-4 pr-3 sm:grid-cols-2"},Lk={class:"font-medium"},Hk={key:0,class:"pt-1 text-xs text-gray-500"},Wk={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},jk={class:"flex items-center gap-3"},qk={class:"text-sm text-gray-600"},Xk={class:"flex gap-2"},Yk={},Uk=t.defineComponent({...Yk,__name:"quick-periods-settings",props:{show:{type:Boolean},selectedKeys:{}},emits:["update:show","save"],setup(n,{emit:e}){const i=n,r=e,o=Ue.initRefDependingOnDeviceResolution("100%","90%","40rem"),s=W.DateTimeProvider.standardPeriods(),a=W.STANDARD_PERIOD_GROUPS.map(u=>({key:u.key,label:u.label,sections:bf(s,u.key)})),l=t.ref([]),c=t.computed(()=>{const u=l.value.length;return`Выбрано: ${u} ${W.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=I.NCheckbox,p=I.NCheckboxGroup,m=I.NScrollbar,g=I.NButton,b=I.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",Wk,[t.createElementVNode("div",jk,[t.createElementVNode("span",qk,t.toDisplayString(c.value),1),t.createVNode(g,{text:"",type:"info",onClick:f[1]||(f[1]=y=>l.value=[...t.unref(hf)])},{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",Xk,[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",Dk,[(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",Lk,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",Hk,t.toDisplayString(_.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.children,x=>(t.openBlock(),t.createBlock(h,{key:x.value,value:x.value,label:x.label},null,8,["value","label"]))),128))],64))),128))]))),128))])]),_:1},8,["value"])]),_:1})]),_:1},8,["show","style"])}}}),Kk={class:"flex flex-col gap-2"},Gk={class:"flex items-center gap-2"},Zk={class:"flex gap-2 px-px pb-4 pt-px"},Qk={key:0,class:"text-sm text-gray-500"},Jk={},e2=t.defineComponent({...Jk,__name:"quick-periods",props:{from:{},to:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o=W.DateTimeProvider.standardPeriods(),s=()=>{const f=ff,h=W.PreferencesStorageProvider.getActualDataFromStorage(f);return(V.isArray(h)?h:hf).filter(m=>V.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?Ri(i.from):null,h=i.to?Ri(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:Ri(g)===f&&Ri(b)===h});return p?String(p.value):null}),u=f=>{a.value=f;const h=ff;W.PreferencesStorageProvider.saveActualDataToStorage(h,f,Ce.addYears(Ce.startOfToday(),1))};return(f,h)=>{const p=zk,m=I.NButton,g=Ik,b=Fk,y=Ek,_=Nk,x=vk,w=I.NScrollbar;return t.openBlock(),t.createElementBlock("div",Kk,[t.createElementVNode("div",Gk,[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]=C=>l.value=!0)},{icon:t.withCtx(()=>[t.createVNode(p)]),_:1})]),t.createVNode(w,{"x-scrollable":""},{default:t.withCtx(()=>[t.createElementVNode("div",Zk,[c.value.length===0?(t.openBlock(),t.createElementBlock("span",Qk," Периоды не выбраны ")):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,C=>(t.openBlock(),t.createBlock(m,{key:C.value,type:C.value===d.value?"primary":"default",ghost:C.value===d.value,"theme-overrides":t.unref(Yx),class:"shrink-0",onClick:N=>r("apply",C),onMouseenter:N=>r("preview",C),onMouseleave:h[1]||(h[1]=N=>r("preview"))},{icon:t.withCtx(()=>[C.group==="day"?(t.openBlock(),t.createBlock(g,{key:0})):C.group==="week"||C.group==="decade"?(t.openBlock(),t.createBlock(b,{key:1})):C.group==="quarter"||C.group==="halfYear"?(t.openBlock(),t.createBlock(y,{key:2})):C.group==="other"?(t.openBlock(),t.createBlock(_,{key:3})):(t.openBlock(),t.createBlock(x,{key:4}))]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(C.label),1)]),_:2},1032,["type","ghost","theme-overrides","onClick","onMouseenter"]))),128))])]),_:1}),t.createVNode(Uk,{show:l.value,"onUpdate:show":h[2]||(h[2]=C=>l.value=C),"selected-keys":a.value,onSave:u},null,8,["show","selected-keys"])])}}}),t2={class:"flex flex-col items-stretch gap-3 sm:flex-row"},n2={class:"order-2 flex-1 rounded-lg border border-solid border-gray-200 p-2 shadow-sm"},i2={class:"flex flex-col items-stretch pr-3"},r2={key:0,class:"px-2 pb-0.5 pt-2 text-xs text-gray-400"},o2={key:1,class:"order-2 w-44 shrink-0 rounded-lg border border-solid border-gray-200 p-1 shadow-sm"},s2={},a2=t.defineComponent({...s2,__name:"standard-periods",props:{activeKey:{},customPeriods:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o="custom",s=Ue.initRefDependingOnDeviceResolution(!0,!1,!1),a=W.DateTimeProvider.standardPeriods(),l=t.ref(W.STANDARD_PERIOD_GROUPS[0].key),c=t.computed(()=>{const u=W.STANDARD_PERIOD_GROUPS.map(f=>({key:f.key,value:f.key,label:f.label}));return V.isEmpty(i.customPeriods)||u.push({key:o,value:o,label:"Пользовательские"}),u}),d=t.computed(()=>l.value===o?[{type:"group",key:o,children:Aa(i.customPeriods??{})}]:bf(a,l.value));return(u,f)=>{const h=I.NButton,p=I.NScrollbar,m=I.NSelect,g=I.NMenu;return t.openBlock(),t.createElementBlock("div",t2,[t.createElementVNode("div",n2,[t.createVNode(p,{class:"max-h-96"},{default:t.withCtx(()=>[t.createElementVNode("div",i2,[(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",r2,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",o2,[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"])]))])}}}),l2={class:"flex flex-col gap-3"},c2={class:"flex flex-col gap-1 sm:flex-row sm:items-center"},d2={key:1,class:"overflow-x-auto rounded-lg border border-solid border-gray-200 p-2 shadow-sm sm:p-3"},u2={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},f2={class:"flex gap-2"},h2={},m2=t.defineComponent({...h2,__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=Ue.initRefDependingOnDeviceResolution("100%","90%","48rem"),s=t.ref("custom"),a=t.ref("months"),l=t.computed(()=>a.value==="months"?"Показать по дням":"Показать по месяцам"),c=()=>W.PreferencesStorageProvider.getActualDataFromStorage(df)==="standard"?"standard":"custom",d=()=>W.PreferencesStorageProvider.getActualDataFromStorage(uf)==="days"?"days":"months",u=(v,E)=>{W.PreferencesStorageProvider.saveActualDataToStorage(v,E,Ce.addYears(Ce.startOfToday(),1))},f=t.ref({}),h=t.ref(null),p=t.ref(null),m=t.computed(()=>h.value??f.value),g=(v,E)=>{var R,M;const P=(R=i.disabled)!=null&&R.from?f.value.from:v,F=(M=i.disabled)!=null&&M.to?f.value.to:E;h.value=null,f.value=yf(P,F,i.disabled)},b=v=>{p.value=null,g(v,f.value.to)},y=v=>{p.value=null,g(f.value.from,v)},_=()=>{p.value=null,g(null,null)},x=v=>{p.value=null,g(v.from,v.to)},w=v=>{const E=v.item;g(E.from,E.to),p.value=String(v.value)},C=v=>{const E=v==null?void 0:v.item;h.value=E?{from:E.from,to:E.to}:null},N=()=>{h.value=null,s.value=s.value==="custom"?"standard":"custom",u(df,s.value)},k=()=>{a.value=a.value==="months"?"days":"months",u(uf,a.value)},$=()=>{r("select",f.value),r("update:show",!1)};return t.watch(()=>i.show,v=>{v&&(s.value=c(),a.value=d(),p.value=null,h.value=null,f.value={...i.dateRange})}),(v,E)=>{const P=I.NButton,F=Hx,R=zx,M=I.NTooltip,X=I.NModal;return t.openBlock(),t.createBlock(X,{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":E[1]||(E[1]=G=>r("update:show",G))},{footer:t.withCtx(()=>[t.createElementVNode("div",u2,[t.createVNode(P,{text:"",type:"info",onClick:N},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.value==="custom"?"Показать стандартные периоды":"Показать произвольный период"),1)]),_:1}),t.createElementVNode("div",f2,[t.createVNode(P,{type:"primary",onClick:$},{default:t.withCtx(()=>[...E[3]||(E[3]=[t.createTextVNode(" Выбрать ",-1)])]),_:1}),t.createVNode(P,{onClick:E[0]||(E[0]=G=>r("update:show",!1))},{default:t.withCtx(()=>[...E[4]||(E[4]=[t.createTextVNode("Отмена",-1)])]),_:1})])])]),default:t.withCtx(()=>[t.createElementVNode("div",l2,[s.value==="custom"?(t.openBlock(),t.createBlock(e2,{key:0,from:f.value.from,to:f.value.to,onApply:w,onPreview:C},null,8,["from","to"])):t.createCommentVNode("",!0),t.createElementVNode("div",c2,[t.createVNode(xf,{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(P,{key:0,text:"",type:"info",class:"sm:ml-2",onClick:_},{default:t.withCtx(()=>[...E[2]||(E[2]=[t.createTextVNode(" Очистить период ",-1)])]),_:1})):t.createCommentVNode("",!0)]),s.value==="custom"?(t.openBlock(),t.createElementBlock("div",d2,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.value==="months"?fk:rk),{from:f.value.from,to:f.value.to,onSelect:x},{actions:t.withCtx(()=>[t.createVNode(M,{placement:"top",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(P,{size:"small","aria-label":l.value,"theme-overrides":t.unref(Lr),onClick:k},{icon:t.withCtx(()=>[a.value==="months"?(t.openBlock(),t.createBlock(F,{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(a2,{key:2,"active-key":p.value,"custom-periods":n.customPeriods,onApply:w,onPreview:C},null,8,["active-key","custom-periods"]))])]),_:1},8,["show","style"])}}}),p2={class:"flex w-full min-w-0 items-center gap-1"},g2={},y2=t.defineComponent({...g2,__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?W.DateTimeProvider.defaultDateRanges():{},...i.predefinedDateRanges};return V.isEmpty(u)?void 0:u}),a=(u,f)=>{r("update:date-range",yf(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=Ix,p=I.NButton;return t.openBlock(),t.createElementBlock("div",p2,[t.createVNode(xf,{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(m2,{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"])])}}}),b2={class:"sc-lbl-date text-nowrap"},_2={},es=t.defineComponent({..._2,__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(()=>Ce.format(e.date,W.useBaseConfigStateStore().config.dateFormats.uiDate)),r=t.computed(()=>Ce.format(e.date,"HH:mm"));return(o,s)=>(t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass({"flex flex-col":n.isTimeOnSecondLine})},[t.createElementVNode("span",b2,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))}}),w2={},x2=t.defineComponent({...w2,__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)}}),k2={class:"flex flex-row gap-2.5"},C2={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},v2={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},S2={class:"mb-0.5 sm:mb-0 sm:ml-3"},B2={},N2=t.defineComponent({...B2,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(n){return(e,i)=>{const r=Jo,o=I.NButton,s=I.NPopover;return t.openBlock(),t.createElementBlock("div",k2,[t.createElementVNode("div",C2,[t.renderSlot(e.$slots,"main")]),t.createElementVNode("div",null,[t.createElementVNode("div",v2,[t.renderSlot(e.$slots,"extra-buttons"),t.createElementVNode("div",S2,[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)])])])])}}}),T2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function $2(n,e){return t.openBlock(),t.createElementBlock("svg",T2,[...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 E2=t.markRaw({name:"ion-checkmark-done-sharp",render:$2}),R2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function P2(n,e){return t.openBlock(),t.createElementBlock("svg",R2,[...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 F2=t.markRaw({name:"ion-options-outline",render:P2}),V2={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},M2={class:"flex-auto"},I2={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"},A2={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"},O2={},Oa=t.defineComponent({...O2,__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=F2,f=I.NButton,h=I.NPopover,p=E2,m=Jo;return t.openBlock(),t.createElementBlock("div",V2,[t.createElementVNode("div",M2,[t.renderSlot(c.$slots,"default")]),t.createElementVNode("div",null,[t.createElementVNode("div",I2,[t.createElementVNode("div",A2,[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")])])])}}}),z2={},kf=t.defineComponent({...z2,__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(Oa,{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(Oa,{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"]))]))}}),D2={key:0,class:"whitespace-pre-line"},L2={key:1,class:"text-sc-dark-grey"},H2={},W2=t.defineComponent({...H2,__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=I.NInput;return t.openBlock(),t.createBlock(kf,{disabled:n.disabled,"onEditor:apply":s,"onEditor:cancel":a},{viewer:t.withCtx(()=>[t.createElementVNode("div",null,[n.comment?(t.openBlock(),t.createElementBlock("span",D2,t.toDisplayString(n.comment),1)):(t.openBlock(),t.createElementBlock("span",L2," - Комментарий отсутствует - "))])]),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"])}}}),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:"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 X2=t.markRaw({name:"ion-download-outline",render:q2}),Y2={},U2=t.defineComponent({...Y2,__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=X2;return t.openBlock(),t.createBlock(t.unref(I.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(I.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"])}}}),K2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function G2(n,e){return t.openBlock(),t.createElementBlock("svg",K2,[...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 Z2=t.markRaw({name:"ion-warning",render:G2}),Q2={},J2=t.defineComponent({...Q2,__name:"warning-icon",props:{popoverText:{default:""},iconClass:{default:"text-sc-warning"}},setup(n){return(e,i)=>{const r=Z2,o=I.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"])}}}),eC={},tC=t.defineComponent({...eC,__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=V.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(I.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"]))}}),nC={},iC=t.defineComponent({...nC,__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=V.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(I.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"]))}}),rC={},oC=t.defineComponent({...rC,__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=V.debounce(c=>r("update:value",c),i.debounceTime??0),a=c=>{let d="";if(V.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(V.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof Br.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=Br.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof Br.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(Pm.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"]))}}),sC=gn(oC,[["__scopeId","data-v-751dbb0e"]]),aC={class:"mb-7 grid grid-cols-2 gap-3.5 lg:grid-cols-4"},lC={class:"mb-2 text-[11.5px] font-semibold uppercase text-gray-500"},cC={},dC=t.defineComponent({...cC,__name:"kpi-grid",props:{items:{},isLoading:{type:Boolean}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",aC,[(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",lC,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))]))}}),uC={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function fC(n,e){return t.openBlock(),t.createElementBlock("svg",uC,[...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 hC=t.markRaw({name:"tabler-external-link",render:fC}),mC={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},pC=["href"],gC={},yC=t.defineComponent({...gC,__name:"external-link",props:{text:{},url:{},description:{}},setup(n){return(e,i)=>{const r=hC,o=I.NTooltip;return t.openBlock(),t.createBlock(o,{disabled:t.unref(V.isUndefined)(n.description),placement:"top-start"},{trigger:t.withCtx(()=>[t.createElementVNode("span",mC,[t.createElementVNode("a",{href:n.url,target:"_blank",class:"no-underline"},t.toDisplayString(n.text),9,pC),t.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.description),1)]),_:1},8,["disabled"])}}}),bC={key:1,class:"h-24"},_C={key:2,class:"flex flex-col gap-3"},wC={},xC=t.defineComponent({...wC,__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(I.NSpin),{show:n.isLoading},{default:t.withCtx(()=>[!n.isLoading&&n.isEmpty?(t.openBlock(),t.createBlock(t.unref(I.NEmpty),{key:0,description:n.emptyDescription},null,8,["description"])):n.isLoading&&n.isEmpty?(t.openBlock(),t.createElementBlock("div",bC)):(t.openBlock(),t.createElementBlock("div",_C,[t.renderSlot(o.$slots,"default")])),n.pagination&&n.pagination.itemCount>0?(t.openBlock(),t.createBlock(t.unref(I.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(Jl),"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"]))}}),kC={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function CC(n,e){return t.openBlock(),t.createElementBlock("svg",kC,[...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 vC=t.markRaw({name:"ion-remove-circle-outline",render:CC});let ts=[];const Cf=new WeakMap;function SC(){ts.forEach(n=>n(...Cf.get(n))),ts=[]}function vf(n,...e){Cf.set(n,e),!ts.includes(n)&&ts.push(n)===1&&requestAnimationFrame(SC)}function Hr(n,e){let{target:i}=n;for(;i;){if(i.dataset&&i.dataset[e]!==void 0)return!0;i=i.parentElement}return!1}function Wr(n){return n.composedPath()[0]||null}function jr(n){return typeof n=="string"?n.endsWith("px")?Number(n.slice(0,n.length-2)):Number(n):n}function qr(n){if(n!=null)return typeof n=="number"?`${n}px`:n.endsWith("px")?n:`${n}px`}function xn(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 Sf={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 BC(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 NC(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 Mn="^\\s*",In="\\s*$",mi="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",rn="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",Pi="([0-9A-Fa-f])",Fi="([0-9A-Fa-f]{2})",Bf=new RegExp(`${Mn}hsl\\s*\\(${rn},${mi},${mi}\\)${In}`),Nf=new RegExp(`${Mn}hsv\\s*\\(${rn},${mi},${mi}\\)${In}`),Tf=new RegExp(`${Mn}hsla\\s*\\(${rn},${mi},${mi},${rn}\\)${In}`),$f=new RegExp(`${Mn}hsva\\s*\\(${rn},${mi},${mi},${rn}\\)${In}`),TC=new RegExp(`${Mn}rgb\\s*\\(${rn},${rn},${rn}\\)${In}`),$C=new RegExp(`${Mn}rgba\\s*\\(${rn},${rn},${rn},${rn}\\)${In}`),EC=new RegExp(`${Mn}#${Pi}${Pi}${Pi}${In}`),RC=new RegExp(`${Mn}#${Fi}${Fi}${Fi}${In}`),PC=new RegExp(`${Mn}#${Pi}${Pi}${Pi}${Pi}${In}`),FC=new RegExp(`${Mn}#${Fi}${Fi}${Fi}${Fi}${In}`);function Qt(n){return parseInt(n,16)}function VC(n){try{let e;if(e=Tf.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),Mi(e[13])];if(e=Bf.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${n}.`)}catch(e){throw e}}function MC(n){try{let e;if(e=$f.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),Mi(e[13])];if(e=Nf.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${n}.`)}catch(e){throw e}}function Vi(n){try{let e;if(e=RC.exec(n))return[Qt(e[1]),Qt(e[2]),Qt(e[3]),1];if(e=TC.exec(n))return[$t(e[1]),$t(e[5]),$t(e[9]),1];if(e=$C.exec(n))return[$t(e[1]),$t(e[5]),$t(e[9]),Mi(e[13])];if(e=EC.exec(n))return[Qt(e[1]+e[1]),Qt(e[2]+e[2]),Qt(e[3]+e[3]),1];if(e=FC.exec(n))return[Qt(e[1]),Qt(e[2]),Qt(e[3]),Mi(Qt(e[4])/255)];if(e=PC.exec(n))return[Qt(e[1]+e[1]),Qt(e[2]+e[2]),Qt(e[3]+e[3]),Mi(Qt(e[4]+e[4])/255)];if(n in Sf)return Vi(Sf[n]);if(Bf.test(n)||Tf.test(n)){const[i,r,o,s]=VC(n);return[...NC(i,r,o),s]}else if(Nf.test(n)||$f.test(n)){const[i,r,o,s]=MC(n);return[...BC(i,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${n}.`)}catch(e){throw e}}function IC(n){return n>1?1:n<0?0:n}function za(n,e,i,r){return`rgba(${$t(n)}, ${$t(e)}, ${$t(i)}, ${IC(r)})`}function Da(n,e,i,r,o){return $t((n*e*(1-r)+i*r)/o)}function AC(n,e){Array.isArray(n)||(n=Vi(n)),Array.isArray(e)||(e=Vi(e));const i=n[3],r=e[3],o=Mi(i+r-i*r);return za(Da(n[0],i,e[0],r,o),Da(n[1],i,e[1],r,o),Da(n[2],i,e[2],r,o),o)}function Le(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Vi(n);return typeof e.alpha=="number"?za(i,r,o,e.alpha):za(i,r,o,s)}function ns(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Vi(n),{lightness:a=1,alpha:l=1}=e;return OC([i*a,r*a,o*a,s*l])}function Mi(n){const e=Math.round(Number(n)*100)/100;return e>1?1:e<0?0:e}function is(n){const e=Math.round(Number(n));return e>=360||e<0?0:e}function $t(n){const e=Math.round(Number(n));return e>255?255:e<0?0:e}function pi(n){const e=Math.round(Number(n));return e>100?100:e<0?0:e}function OC(n){const[e,i,r]=n;return 3 in n?`rgba(${$t(e)}, ${$t(i)}, ${$t(r)}, ${Mi(n[3])})`:`rgba(${$t(e)}, ${$t(i)}, ${$t(r)}, 1)`}function zC(n=8){return Math.random().toString(16).slice(2,2+n)}function Ef(n){return Array.isArray(n)?n:[n]}const La={STOP:"STOP"};function Rf(n,e){const i=e(n);n.children!==void 0&&i!==La.STOP&&n.children.forEach(r=>Rf(r,e))}function DC(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 LC(n,e){const{isLeaf:i}=n;return i!==void 0?i:!e(n)}function HC(n){return n.children}function WC(n){return n.key}function jC(){return!1}function qC(n,e){const{isLeaf:i}=n;return!(i===!1&&!Array.isArray(e(n)))}function XC(n){return n.disabled===!0}function YC(n,e){return n.isLeaf===!1&&!Array.isArray(e(n))}function UC(n,e){if(n.isLeaf===!0){const i=e(n);if(Array.isArray(i)&&i.length>0)return!0}return!1}function Ha(n){var e;return n==null?[]:Array.isArray(n)?n:(e=n.checkedKeys)!==null&&e!==void 0?e:[]}function Wa(n){var e;return n==null||Array.isArray(n)?[]:(e=n.indeterminateKeys)!==null&&e!==void 0?e:[]}function KC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)||i.add(r)}),Array.from(i)}function GC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)&&i.delete(r)}),Array.from(i)}function ZC(n){return(n==null?void 0:n.type)==="group"}function QC(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 JC extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function ev(n,e,i,r){return rs(e.concat(n),i,r,!1)}function tv(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 nv(n,e,i,r){const o=rs(e,i,r,!1),s=rs(n,i,r,!0),a=tv(n,i),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function ja(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:KC(i,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:GC(i,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(i),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let f;o!==void 0?f=nv(o,i,e,d):r!==void 0?f=ev(r,i,e,d):f=rs(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,x=u.get(y);for(const w of x){if(w.isLeaf)continue;const{key:C,shallowLoaded:N}=w;if(p&&N&&w.children.forEach(E=>{!E.disabled&&!E.isLeaf&&E.shallowLoaded&&m.has(E.key)&&m.delete(E.key)}),w.disabled||!N)continue;let k=!0,$=!1,v=!0;for(const E of w.children){const P=E.key;if(!E.disabled){if(v&&(v=!1),m.has(P))$=!0;else if(g.has(P)){$=!0,k=!1;break}else if(k=!1,$)break}}k&&!v?(h&&w.children.forEach(E=>{!E.disabled&&m.has(E.key)&&m.delete(E.key)}),m.add(C)):$&&g.add(C),_&&p&&m.has(C)&&m.delete(C)}}return{checkedKeys:Array.from(m),indeterminateKeys:Array.from(g)}}function rs(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&&Rf(d,u=>{if(u.disabled)return La.STOP;const{key:f}=u;if(!a.has(f)&&(a.add(f),l.add(f),YC(u.rawNode,s))){if(r)return La.STOP;if(!i)throw new JC}})}),l}function iv(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 rv(n){if(n.length===0)return null;const e=n[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function ov(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 Pf(n,e,{loop:i=!1,includeDisabled:r=!1}={}){const o=e==="prev"?sv:ov,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=qa(d,s);u!==null?l=u:c(o(d,i))}else{const u=o(d,!1);if(u!==null)c(u);else{const f=av(d);f!=null&&f.isGroup?c(o(f,i)):i&&c(o(d,!0))}}}}return c(n),l}function sv(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 av(n){return n.parent}function qa(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=qa(d,e);if(u!==null)return u}else return d}}return null}const lv={getChild(){return this.ignored?null:qa(this)},getParent(){const{parent:n}=this;return n!=null&&n.isGroup?n.getParent():n},getNext(n={}){return Pf(this,"next",n)},getPrev(n={}){return Pf(this,"prev",n)}};function cv(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 dv(n,e){const i=n.key;for(;e;){if(e.key===i)return!0;e=e.parent}return!1}var uv={};function Ff(n,e,i,r,o,s=null,a=0){const l=[];return n.forEach((c,d)=>{var u;uv.NODE_ENV!=="production"&&UC(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=Ff(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 fv(n,e={}){var i;const r=new Map,o=new Map,{getDisabled:s=XC,getIgnored:a=jC,getIsGroup:l=ZC,getKey:c=WC}=e,d=(i=e.getChildren)!==null&&i!==void 0?i:HC,u=e.ignoreEmptyChildren?w=>{const C=d(w);return Array.isArray(C)?C.length?C:null:C}: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 LC(this.rawNode,u)},get shallowLoaded(){return qC(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(w){return dv(this,w)}},lv),h=Ff(n,r,o,f,u);function p(w){if(w==null)return null;const C=r.get(w);return C&&!C.isGroup&&!C.ignored?C:null}function m(w){if(w==null)return null;const C=r.get(w);return C&&!C.ignored?C:null}function g(w,C){const N=m(w);return N?N.getPrev(C):null}function b(w,C){const N=m(w);return N?N.getNext(C):null}function y(w){const C=m(w);return C?C.getParent():null}function _(w){const C=m(w);return C?C.getChild():null}const x={treeNodes:h,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(w){return cv(h,w)},getNode:p,getPrev:g,getNext:b,getParent:y,getChild:_,getFirstAvailableNode(){return rv(h)},getPath(w,C={}){return iv(w,C,x)},getCheckedKeys(w,C={}){const{cascade:N=!0,leafOnly:k=!1,checkStrategy:$="all",allowNotLoaded:v=!1}=C;return ja({checkedKeys:Ha(w),indeterminateKeys:Wa(w),cascade:N,leafOnly:k,checkStrategy:$,allowNotLoaded:v},x)},check(w,C,N={}){const{cascade:k=!0,leafOnly:$=!1,checkStrategy:v="all",allowNotLoaded:E=!1}=N;return ja({checkedKeys:Ha(C),indeterminateKeys:Wa(C),keysToCheck:w==null?[]:Ef(w),cascade:k,leafOnly:$,checkStrategy:v,allowNotLoaded:E},x)},uncheck(w,C,N={}){const{cascade:k=!0,leafOnly:$=!1,checkStrategy:v="all",allowNotLoaded:E=!1}=N;return ja({checkedKeys:Ha(C),indeterminateKeys:Wa(C),keysToUncheck:w==null?[]:Ef(w),cascade:k,leafOnly:$,checkStrategy:v,allowNotLoaded:E},x)},getNonLeafKeys(w={}){return DC(h,w)}};return x}function os(n){return n.composedPath()[0]}const hv={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function mv(n,e,i){if(n==="mousemoveoutside"){const r=o=>{e.contains(os(o))||i(o)};return{mousemove:r,touchstart:r}}else if(n==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(os(a))},s=a=>{r&&(e.contains(os(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 Vf(n,e,i){const r=hv[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=mv(n,e,i)),s}function pv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=Vf(n,e,i);return Object.keys(o).forEach(s=>{Lt(s,document,o[s],r)}),!0}return!1}function gv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=Vf(n,e,i);return Object.keys(o).forEach(s=>{yt(s,document,o[s],r)}),!0}return!1}function yv(){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(k,$,v){const E=k[$];return k[$]=function(){return v.apply(k,arguments),E.apply(k,arguments)},k}function s(k,$){k[$]=Event.prototype[$]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var k;return(k=a.get(this))!==null&&k!==void 0?k:null}function d(k,$){l!==void 0&&Object.defineProperty(k,"currentTarget",{configurable:!0,enumerable:!0,get:$??l.get})}const u={bubble:{},capture:{}},f={};function h(){const k=function($){const{type:v,eventPhase:E,bubbles:P}=$,F=os($);if(E===2)return;const R=E===1?"capture":"bubble";let M=F;const X=[];for(;M===null&&(M=window),X.push(M),M!==window;)M=M.parentNode||null;const G=u.capture[v],Z=u.bubble[v];if(o($,"stopPropagation",i),o($,"stopImmediatePropagation",r),d($,c),R==="capture"){if(G===void 0)return;for(let O=X.length-1;O>=0&&!n.has($);--O){const A=X[O],Y=G.get(A);if(Y!==void 0){a.set($,A);for(const H of Y){if(e.has($))break;H($)}}if(O===0&&!P&&Z!==void 0){const H=Z.get(A);if(H!==void 0)for(const T of H){if(e.has($))break;T($)}}}}else if(R==="bubble"){if(Z===void 0)return;for(let O=0;O<X.length&&!n.has($);++O){const A=X[O],Y=Z.get(A);if(Y!==void 0){a.set($,A);for(const H of Y){if(e.has($))break;H($)}}}}s($,"stopPropagation"),s($,"stopImmediatePropagation"),d($)};return k.displayName="evtdUnifiedHandler",k}function p(){const k=function($){const{type:v,eventPhase:E}=$;if(E!==2)return;const P=f[v];P!==void 0&&P.forEach(F=>F($))};return k.displayName="evtdUnifiedWindowEventHandler",k}const m=h(),g=p();function b(k,$){const v=u[k];return v[$]===void 0&&(v[$]=new Map,window.addEventListener($,m,k==="capture")),v[$]}function y(k){return f[k]===void 0&&(f[k]=new Set,window.addEventListener(k,g)),f[k]}function _(k,$){let v=k.get($);return v===void 0&&k.set($,v=new Set),v}function x(k,$,v,E){const P=u[$][v];if(P!==void 0){const F=P.get(k);if(F!==void 0&&F.has(E))return!0}return!1}function w(k,$){const v=f[k];return!!(v!==void 0&&v.has($))}function C(k,$,v,E){let P;if(typeof E=="object"&&E.once===!0?P=G=>{N(k,$,P,E),v(G)}:P=v,pv(k,$,P,E))return;const R=E===!0||typeof E=="object"&&E.capture===!0?"capture":"bubble",M=b(R,k),X=_(M,$);if(X.has(P)||X.add(P),$===window){const G=y(k);G.has(P)||G.add(P)}}function N(k,$,v,E){if(gv(k,$,v,E))return;const F=E===!0||typeof E=="object"&&E.capture===!0,R=F?"capture":"bubble",M=b(R,k),X=_(M,$);if($===window&&!x($,F?"bubble":"capture",k,v)&&w(k,v)){const Z=f[k];Z.delete(v),Z.size===0&&(window.removeEventListener(k,g),f[k]=void 0)}X.has(v)&&X.delete(v),X.size===0&&M.delete($),M.size===0&&(window.removeEventListener(k,m,R==="capture"),u[R][k]=void 0)}return{on:C,off:N}}const{on:Lt,off:yt}=yv(),br="@@mmoContext",bv={mounted(n,{value:e}){n[br]={handler:void 0},typeof e=="function"&&(n[br].handler=e,Lt("mousemoveoutside",n,e))},updated(n,{value:e}){const i=n[br];typeof e=="function"?i.handler?i.handler!==e&&(yt("mousemoveoutside",n,i.handler),i.handler=e,Lt("mousemoveoutside",n,e)):(n[br].handler=e,Lt("mousemoveoutside",n,e)):i.handler&&(yt("mousemoveoutside",n,i.handler),i.handler=void 0)},unmounted(n){const{handler:e}=n[br];e&&yt("mousemoveoutside",n,e),n[br].handler=void 0}},_r="@@coContext",ss={mounted(n,{value:e,modifiers:i}){n[_r]={handler:void 0},typeof e=="function"&&(n[_r].handler=e,Lt("clickoutside",n,e,{capture:i.capture}))},updated(n,{value:e,modifiers:i}){const r=n[_r];typeof e=="function"?r.handler?r.handler!==e&&(yt("clickoutside",n,r.handler,{capture:i.capture}),r.handler=e,Lt("clickoutside",n,e,{capture:i.capture})):(n[_r].handler=e,Lt("clickoutside",n,e,{capture:i.capture})):r.handler&&(yt("clickoutside",n,r.handler,{capture:i.capture}),r.handler=void 0)},unmounted(n,{modifiers:e}){const{handler:i}=n[_r];i&&yt("clickoutside",n,i,{capture:e.capture}),n[_r].handler=void 0}};function _v(n,e){console.error(`[vdirs/${n}]: ${e}`)}class wv{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&&_v("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 Xa=new wv,wr="@@ziContext",Mf={mounted(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i;n[wr]={enabled:!!o,initialized:!1},o&&(Xa.ensureZIndex(n,r),n[wr].initialized=!0)},updated(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i,s=n[wr].enabled;o&&!s&&(Xa.ensureZIndex(n,r),n[wr].initialized=!0),n[wr].enabled=!!o},unmounted(n,e){if(!n[wr].initialized)return;const{value:i={}}=e,{zIndex:r}=i;Xa.unregister(n,r)}};function xv(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 fn(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 kv=typeof window<"u";let xr,Xr;(()=>{var n,e;xr=kv?(e=(n=document)===null||n===void 0?void 0:n.fonts)===null||e===void 0?void 0:e.ready:void 0,Xr=!1,xr!==void 0?xr.then(()=>{Xr=!0}):Xr=!0})();function Cv(n){if(Xr)return;let e=!1;t.onMounted(()=>{Xr||xr==null||xr.then(()=>{e||n()})}),t.onBeforeUnmount(()=>{e=!0})}function Ya(n,e){return t.watch(n,i=>{i!==void 0&&(e.value=i)}),t.computed(()=>n.value===void 0?e.value:n.value)}function as(){const n=t.ref(!1);return t.onMounted(()=>{n.value=!0}),t.readonly(n)}function If(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 vv=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function Sv(){return vv}function Ua(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);return r()}function Ka(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)){Ka(r,e,i);return}if(r.type===t.Fragment){if(r.children===null)return;Array.isArray(r.children)&&Ka(r.children,e,i)}else r.type!==t.Comment&&i.push(r)}}),i}function Af(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);const o=Ka(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${n}]: slot[${i}] should have exactly one child.`)}let gi=null;function Of(){if(gi===null&&(gi=document.getElementById("v-binder-view-measurer"),gi===null)){gi=document.createElement("div"),gi.id="v-binder-view-measurer";const{style:n}=gi;n.position="fixed",n.left="0",n.right="0",n.top="0",n.bottom="0",n.pointerEvents="none",n.visibility="hidden",document.body.appendChild(gi)}return gi.getBoundingClientRect()}function Bv(n,e){const i=Of();return{top:e,left:n,height:0,width:0,right:i.width-n,bottom:i.height-e}}function Ga(n){const e=n.getBoundingClientRect(),i=Of();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 Nv(n){return n.nodeType===9?null:n.parentNode}function zf(n){if(n===null)return null;const e=Nv(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 zf(e)}const Df=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=zf(y),y!==null;)s.push(y);for(const _ of s)Lt("scroll",_,f,!0)},l=()=>{for(const y of s)yt("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=()=>{vf(h)},h=()=>{c.forEach(y=>y())},p=new Set,m=y=>{p.size===0&&Lt("resize",window,b),p.has(y)||p.add(y)},g=y=>{p.has(y)&&p.delete(y),p.size===0&&yt("resize",window,b)},b=()=>{p.forEach(y=>y())};return t.onBeforeUnmount(()=>{yt("resize",window,b),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:m,removeResizeListener:g}},render(){return Ua("binder",this.$slots)}}),Lf=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(Af("follower",this.$slots),[[e]]):Af("follower",this.$slots)}}),Tv="@css-render/vue3-ssr";function $v(n,e){return`<style cssr-id="${n}">
|
|
103
|
+
`}},Ao=Ni.Multiply,D0=[1,0,0,0,1,0,0,0,1],hi=new Bn(9),L0=Tt.Utils,Od=new ie,ya=new Bn([0,0,1,0,0,1,0,1,1,0,1,1]),Be={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Je.document?Je.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new Ni,group:{removeChild:function(n,e){if(n.children)for(let i=0;i<n.children.length;i++)Be.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;re.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 Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,i._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie),this._scale instanceof ie?(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=Tt.Utils.getRendererType(this._mask._renderer.type);Be[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++)Be.group.removeChild(this.subtractions[s],n);for(s=0;s<this.children.length;s++){const a=this.children[s],l=Tt.Utils.getRendererType(a._renderer.type);Be[l].render.call(a,n,e)}return this._mask&&n.disable(n.STENCIL_TEST),re.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,x=n.renderer.ratio,w=Od.copy(e._renderer.scale).multiply(x),C=e._stroke,N=e._linewidth,k=e._fill,$=e._renderer.opacity||e._opacity,v=e._cap,E=e._join,P=e._miter,F=e._closed,R=e.dashes,M=b.length,X=M-1;y.width=Math.max(Math.ceil(e._renderer.rect.width*w.x),1),y.height=Math.max(Math.ceil(e._renderer.rect.height*w.y),1);const G=e._renderer.rect.centroid,Z=G.x,O=G.y;if(_.clearRect(0,0,y.width,y.height),k)if(typeof k=="string")_.fillStyle=k;else{const q=Tt.Utils.getRendererType(k._renderer.type);Be[q].render.call(k,_,e),_.fillStyle=k._renderer.effect}if(C){if(typeof C=="string")_.strokeStyle=C;else{const q=Tt.Utils.getRendererType(C._renderer.type);Be[q].render.call(C,_,e),_.strokeStyle=C._renderer.effect}N&&(_.lineWidth=Nn(e)),P&&(_.miterLimit=P),E&&(_.lineJoin=E),!F&&v&&(_.lineCap=v)}typeof $=="number"&&(_.globalAlpha=$),R&&R.length>0&&(_.lineDashOffset=R.offset||0,_.setLineDash(R));let A,Y,H,T,D,K,J,U;_.save(),_.scale(w.x,w.y),_.translate(Z,O),_.beginPath();for(let q=0;q<b.length;q++){const L=b[q];switch(p=L.x,m=L.y,L.command){case ne.close:_.closePath();break;case ne.arc:Y=L.rx,H=L.ry,T=L.xAxisRotation,D=L.largeArcFlag,K=L.sweepFlag,i=F?ut(q-1,M):Math.max(q-1,0),r=b[i],J=r.x,U=r.y,L0.renderSvgArcCommand(_,J,U,Y,H,D,K,T,p,m);break;case ne.curve:i=F?ut(q-1,M):Math.max(q-1,0),r=b[i],d=r.controls&&r.controls.right||ie.zero,u=L.controls&&L.controls.left||ie.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),L._relative?(s=u.x+L.x,a=u.y+L.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,p,m),q>=X&&F&&(o=A,f=L.controls&&L.controls.right||ie.zero,h=o.controls&&o.controls.left||ie.zero,L._relative?(l=f.x+L.x,c=f.y+L.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:A=L,_.moveTo(p,m);break}}F&&_.closePath(),Be.isHidden.test(k)||(g=k._renderer&&k._renderer.offset,g&&(_.save(),_.translate(-k._renderer.offset.x,-k._renderer.offset.y),_.scale(k._renderer.scale.x,k._renderer.scale.y)),_.fill(),g&&_.restore()),Be.isHidden.test(C)||(g=C._renderer&&C._renderer.offset,g&&(_.save(),_.translate(-C._renderer.offset.x,-C._renderer.offset.y),_.scale(C._renderer.scale.x,C._renderer.scale.y),_.lineWidth=N/C._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;re.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=i||this.parent,o=Tt.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 et&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof tt&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof De&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof et&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof tt&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof De&&(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 Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie);let f,h;this._scale instanceof ie?(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=Tt.Utils.getRendererType(this._mask._renderer.type);Be[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,Be.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),Be.updateTexture.call(Be,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,ya,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),re.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;Be.isHidden.test(a)||(h+=l),r.width=vc(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=Tt.Utils.getRendererType(c._renderer.type);Be[b].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const b=Tt.Utils.getRendererType(a._renderer.type);Be[b].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=Nn(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(Be.precision,Be.precision),o.beginPath(),o.arc(0,0,f/p*.5,0,ot),o.restore(),closed&&o.closePath(),Be.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()),Be.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;re.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 et&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof tt&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof De&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof et&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof tt&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof De&&(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 Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,o._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie);let b,y;this._scale instanceof ie?(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,Be.updateTexture.call(Be,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:(Be.isHidden.test(l)||(r+=c),r/=Be.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),re.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=Od.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,_,x,w,C,N,k,$,v,E;const P=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,i.width,i.height),P||(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 F=Tt.Utils.getRendererType(c._renderer.type);Be[F].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const F=Tt.Utils.getRendererType(a._renderer.type);Be[F].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=Nn(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),Be.isHidden.test(c)||(c._renderer&&c._renderer.offset?(C=c._renderer.scale.x,N=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(C,N),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,x=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,x),r.restore()):r.fillText(e.value,0,0)),Be.isHidden.test(a)||(a._renderer&&a._renderer.offset?(C=a._renderer.scale.x,N=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(C,N),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,x=a._renderer.offset.y/a._renderer.scale.y,w=l/a._renderer.scale.x,r.lineWidth=w,r.strokeText(e.value,_,x),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(f)){const F=r.measureText(e.value);switch(f){case"underline":$=F.actualBoundingBoxDescent,E=F.actualBoundingBoxDescent;break;case"strikethrough":$=0,E=0;break}k=-F.width/2,v=F.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(k,$),r.lineTo(v,E),r.stroke()}r.restore()},getBoundingClientRect:function(n,e){const i=Be.ctx;i.font=[n._style,n._weight,n._size+"px/"+n._leading+"px",n._family].join(" "),i.textAlign="center",i.textBaseline=Tt.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&&!Be.isHidden.test(this._stroke)&&(o+=this._linewidth*2,s+=this._linewidth*2);const a=o/2,l=s/2;switch(Be.alignments[n._alignment]||n._alignment){case Be.alignments.left:n.direction==="ltr"?(e.left=0,e.right=o):(e.left=-o,e.right=0);break;case Be.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;re.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 et&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof tt&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof De&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof et&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof tt&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof De&&(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 Bn(9)),this._matrix.toTransformArray(!0,hi),Ao(hi,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof ie||(this._renderer.scale=new ie);let u,f;this._scale instanceof ie?(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=Tt.Utils.getRendererType(this._mask._renderer.type);Be[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,Be.text.getBoundingClientRect(this,this._renderer.rect),Be.updateTexture.call(Be,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,ya,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),re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(re.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 re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(n,e){if(!(!n.canvas.getContext("2d")||!e)){if(re.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 re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(n,e){if(!n.canvas.getContext("2d"))return;re.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 ie||(this._renderer.offset=new ie),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 ie?(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 ie||(this._renderer.scale=new ie);let r,o;this._scale instanceof ie?(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 re.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(n,e){const i=Tt.Utils.getRendererType(e._renderer.type);if(this[i].updateCanvas.call(Be,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(),re.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 Yt("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]=Be.extensions.get(n,o)}return e},get:function(n,e){return n.getExtension(e)||n.getExtension(`MOZ_${e}`)||n.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new bo};Be.ctx=Be.canvas.getContext("2d");var zd=class extends ee{constructor(n){super();let e,i,r,o;if(this.domElement=n.domElement||document.createElement("canvas"),typeof n.offscreenElement<"u"&&(Be.canvas=n.offscreenElement,Be.ctx=Be.canvas.getContext("2d")),this.scene=new xt,this.scene.parent=this,this._renderer={type:"renderer",matrix:new Bn(D0),scale:1,opacity:1},this._flagMatrix=!0,n=re.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 Yt("unable to create a webgl context. Try using another renderer.");r=un.create(e,un.path.vertex,un.types.vertex),o=un.create(e,un.path.fragment,un.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},i=this.programs.path=Be.program.create(e,[r,o]),this.programs.text=this.programs.path,e.extensions=Be.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,ya,e.STATIC_DRAW),r=un.create(e,un.points.vertex,un.types.vertex),o=un.create(e,un.points.fragment,un.types.fragment),i=this.programs.points=Be.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"?qs(s):i,this.domElement.width=n*this.ratio,this.domElement.height=e*this.ratio,re.isObject(this.domElement.style)&&re.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),Be.group.render.call(this.scene,n,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};S(zd,"Utils",Be);var H0=re.extend({Error:Yt,getRatio:qs,read:Ze,xhr:Pd},re,At,wc,xc),Te=class ao{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=re.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:ao.Types.svg,autostart:!1});if(re.each(i,function(r,o){/fullscreen/i.test(o)||/autostart/i.test(o)||(this[o]=r)},this),re.isElement(i.domElement)){const r=i.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=ao.Types[r])}this.renderer=new ao[this.type](this),this.setPlaying(i.autostart),this.frameCount=0,i.fullscreen?(this.fit=W0.bind(this),this.fit.domElement=window,this.fit.attached=!0,re.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),re.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),tn.bind(this.fit.domElement,"resize",this.fit),this.fit()):i.fitted?(this.fit=j0.bind(this),re.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,q0.bind(this)),this.scene=this.renderer.scene,ao.Instances.push(this),i.autostart&&Ar.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,Ar.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=re.performance.now();e&&(this.timeDelta=parseFloat((i-this._lastFrame).toFixed(3))),this._lastFrame=i,this.fit&&this.fit.domElement&&!this.fit.attached&&(tn.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 Po(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 fi(e,i,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,i,r,o,s){const a=new $o(e,i,r,o,s);return this.scene.add(a),a}makeCircle(e,i,r,o){const s=new No(e,i,r,o);return this.scene.add(s),s}makeEllipse(e,i,r,o,s){const a=new To(e,i,r,o,s);return this.scene.add(a),a}makeStar(e,i,r,o,s){const a=new la(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 aa(e,i,r,o);return this.scene.add(s),s}makeArcSegment(e,i,r,o,s,a,l){const c=new ta(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 ie(a,l))}}const o=new sa(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 Tn(e,i,r,o);return this.add(s),s}makeLinearGradient(e,i,r,o){const s=Array.prototype.slice.call(arguments,4),a=new et(e,i,r,o,s);return this.add(a),a}makeRadialGradient(e,i,r){const o=Array.prototype.slice.call(arguments,3),s=new tt(e,i,r,o);return this.add(s),s}makeSprite(e,i,r,o,s,a,l){const c=new Bo(e,i,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,i,r,o,s,a){const l=new Fd(e,i,r,o,s,a);return this.add(l),l}makeImageSequence(e,i,r,o,s){const a=new fa(e,i,r,o);return s&&a.play(),this.add(a),a}makeTexture(e,i){return new De(e,i)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const i=new xt;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 Ze))return null;const s=Ze[o].call(this,e);return r?this.add(i&&s instanceof xt?s.children:s):s.parent&&s.remove(),s}load(e,i){const r=new xt;let o,s,a;const l=(function(c){for(tn.temp.innerHTML=c,s=0;s<tn.temp.children.length;s++)o=tn.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof i=="function"){const d=tn.temp.children.length<=1?tn.temp.children[0]:tn.temp.children;i(r,d)}}).bind(this);return/\.svg$/i.test(e)?(Pd(e,l),r):(l(e),r)}};S(Te,"NextFrameId",Bt.NextFrameId),S(Te,"Types",Bt.Types),S(Te,"Version",Bt.Version),S(Te,"PublishDate",Bt.PublishDate),S(Te,"Identifier",Bt.Identifier),S(Te,"Resolution",Bt.Resolution),S(Te,"AutoCalculateImportedMatrices",Bt.AutoCalculateImportedMatrices),S(Te,"Instances",Bt.Instances),S(Te,"uniqueId",Bt.uniqueId),S(Te,"Anchor",Ee),S(Te,"Collection",di),S(Te,"Events",ee),S(Te,"Group",xt),S(Te,"Matrix",Ni),S(Te,"Path",Pe),S(Te,"Registry",bo),S(Te,"Element",sr),S(Te,"Shape",qn),S(Te,"Text",Tn),S(Te,"Vector",ie),S(Te,"Gradient",pt),S(Te,"Image",Fd),S(Te,"ImageSequence",fa),S(Te,"LinearGradient",et),S(Te,"RadialGradient",tt),S(Te,"Sprite",Bo),S(Te,"Stop",ui),S(Te,"Texture",De),S(Te,"ArcSegment",ta),S(Te,"Circle",No),S(Te,"Ellipse",To),S(Te,"Line",Po),S(Te,"Points",sa),S(Te,"Polygon",aa),S(Te,"Rectangle",fi),S(Te,"RoundedRectangle",$o),S(Te,"Star",la),S(Te,"CanvasRenderer",Tt),S(Te,"SVGRenderer",Ad),S(Te,"WebGLRenderer",zd),S(Te,"Commands",ne),S(Te,"Utils",H0);var En=Te;function W0(){const n=document.body.getBoundingClientRect(),e=this.width=n.width,i=this.height=n.height;this.renderer.setSize(e,i,this.ratio)}function j0(){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 q0(n,e){this.width=n,this.height=e,this.trigger(ee.Types.resize,n,e)}var Ar=tn.getRequestAnimationFrame();function Dd(){for(let n=0;n<En.Instances.length;n++){const e=En.Instances[n];e.playing&&e.update()}En.NextFrameId=Ar(Dd)}Ar.init=function(){Dd(),Ar.init=function(){}};let Rn;typeof window<"u"?Rn=window:typeof global<"u"?Rn=global:typeof self<"u"&&(Rn=self);let Ld;const nn=Math.PI*2,kt=Math.PI*.5;function X0(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 Y0(n){Ld=n}function U0(n,e){e=e&&e.identity()||new Ld;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 Kt(n,e,i){return i*(e-n)+n}function Gt(n,e){for(;n<0;)n+=e;return n%e}const Hd=Rn.Float32Array||Array,K0=Math.floor;function Pn(n){return K0(n*1e6)/1e6}const me={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};class te{constructor(){B(this,"_events",{});B(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}}B(te,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),B(te,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Wd={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))}}},vt=class vt extends te{constructor(i=0,r=0){super();B(this,"_x",0);B(this,"_y",0);for(let o in Wd)Object.defineProperty(this,o,Wd[o]);this.x=i,this.y=r}static add(i,r){return new vt(i.x+r.x,i.y+r.y)}static sub(i,r){return new vt(i.x-r.x,i.y-r.y)}static subtract(i,r){return vt.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(vt.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 vt(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:Pn(this.x),y:Pn(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}};B(vt,"zero",new vt),B(vt,"left",new vt(-1,0)),B(vt,"right",new vt(1,0)),B(vt,"up",new vt(0,-1)),B(vt,"down",new vt(0,1));let be=vt;class Ae extends be{constructor(i=0,r=0,o=0,s=0,a=0,l=0,c=me.move){super(i,r);B(this,"controls",{left:new be,right:new be});B(this,"_command",me.move);B(this,"_relative",!0);B(this,"_rx",0);B(this,"_ry",0);B(this,"_xAxisRotation",0);B(this,"_largeArcFlag",0);B(this,"_sweepFlag",1);for(let u in jd)Object.defineProperty(this,u,jd[u]);this.command=c,this.relative=!0;const d=Ae.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 Ae().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 Ae().copy(this)}toObject(){return{x:Pn(this.x),y:Pn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Pn(this.rx),ry:Pn(this.ry),xAxisRotation:Pn(this.xAxisRotation),largeArcFlag:Pn(this.largeArcFlag),sweepFlag:Pn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const jd={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 G0=0;const Oo={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return G0++}},zo={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 Do(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 qd(n,e,i,r,o,s,a,l,c){c=c||zo.RecursionLimit;const d=c+1;if(Math.abs(n-a)<.001&&Math.abs(e-l)<.001)return[new Ae(a,l)];const u=[];for(let f=0;f<d;f++){const h=f/d,p=Do(h,n,i,o,a),m=Do(h,e,r,s,l);u.push(new Ae(p,m))}return u}function Z0(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 J0(g,0,1,c||zo.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 C=0;C<2;++C){if(C===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,x=_,w;for(;_--;)p=c[_],w=1-p,d[0][_]=w*w*w*n+3*w*w*p*i+3*w*p*p*o+p*p*p*a,d[1][_]=w*w*w*e+3*w*w*p*r+3*w*p*p*s+p*p*p*l;return d[0][x]=n,d[1][x]=e,d[0][x+1]=a,d[1][x+1]=l,d[0].length=d[1].length=x+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 J0(n,e,i,r){let o=zo.abscissas[r-2],s=zo.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 e1(n,e){const i=n.length,r=i-1;for(let o=0;o<i;o++){const s=n[o],a=e?Gt(o-1,i):Math.max(o-1,0),l=e?Gt(o+1,i):Math.min(o+1,r),c=n[a],d=s,u=n[l];t1(c,d,u),d.command=o===0?me.move:me.curve}}function t1(n,e,i){const r=be.angleBetween(n,e),o=be.angleBetween(i,e);let s=be.distanceBetween(n,e),a=be.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+=kt:l-=kt,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 Or=(qi=class extends te{constructor(){super();B(this,"_flagId",!1);B(this,"_flagClassName",!1);B(this,"_renderer",{});B(this,"_id",Oo.Identifier+Oo.uniqueId());B(this,"_className","");B(this,"classList",[]);for(let i in Xd)Object.defineProperty(this,i,Xd[i])}static fromObject(i){const r=new qi().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}},B(qi,"Properties",["renderer","id","className"]),qi);const Xd={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 Lo extends Error{constructor(i){super();B(this,"name","Two.js");B(this,"message");this.message=i}}class n1{constructor(){B(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 Ho;const Yd={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Rn.document&&(Ho=document.createElement("a"));const it=class it extends Or{constructor(i,r){super();B(this,"_flagSrc",!1);B(this,"_flagImage",!1);B(this,"_flagVideo",!1);B(this,"_flagLoaded",!1);B(this,"_flagRepeat",!1);B(this,"_flagOffset",!1);B(this,"_flagScale",!1);B(this,"_src","");B(this,"_image",null);B(this,"_loaded",!1);B(this,"_repeat","no-repeat");B(this,"_scale",1);B(this,"_offset",null);for(let o in Ud)Object.defineProperty(this,o,Ud[o]);if(this._renderer.type="texture",this._renderer.flagOffset=i1.bind(this),this._renderer.flagScale=r1.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new be,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 it().copy(i);return"id"in i&&(r.id=i.id),r}static getAbsoluteURL(i){return Ho?(Ho.href=i,Ho.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=it.getAbsoluteURL(i);if(it.ImageRegistry.contains(r))return it.ImageRegistry.get(r);let o;return Rn.document?Yd.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=it.getTag(o);i._flagImage&&(/canvas/i.test(s)?it.Register.canvas(i,r):(i._src=o.getAttribute("two-src")||o.src,it.Register[s](i,r))),i._flagSrc&&(o||(o=it.getImage(i.src),i.image=o),s=it.getTag(o),it.Register[s](i,r))}clone(){const i=new it(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 be?i.offset:new be().copy(i.offset),this.scale=typeof i.scale=="number"||i.scale instanceof be?i.scale:new be().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,it.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}};B(it,"Properties",["src","loaded","repeat","scale","offset","image"]),B(it,"RegularExpressions",Yd),B(it,"ImageRegistry",new n1),B(it,"Register",{canvas:function(i,r){i._src="#"+i.id,it.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 Lo("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=it.getAbsoluteURL(i._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",i.src),it.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 Lo("unable to load "+i.src)};i._src=it.getAbsoluteURL(i._src),i.image.getAttribute("two-src")||(i.image.setAttribute("two-src",i.src),it.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 nt=it;const Ud={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=nt.getTag(n);let i;switch(e){case"canvas":i="#"+n.id;break;default:i=n.src}nt.ImageRegistry.contains(i)?this._image=nt.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 be&&this._scale.unbind(te.Types.change,this._renderer.flagScale),this._scale=n,this._scale instanceof be&&this._scale.bind(te.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function i1(){this._flagOffset=!0}function r1(){this._flagScale=!0}class Ti extends Array{constructor(){super();Hl(this,St,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 qt(this,St)}set _events(i){$m(this,St,i)}get _bound(){return qt(this,St)._bound}set _bound(i){qt(this,St)._bound=i}addEventListener(){var i;return(i=qt(this,St).addEventListener)==null?void 0:i.apply(this,arguments)}on(){var i;return(i=qt(this,St).on)==null?void 0:i.apply(this,arguments)}bind(){var i;return(i=qt(this,St).bind)==null?void 0:i.apply(this,arguments)}removeEventListener(){var i;return(i=qt(this,St).removeEventListener)==null?void 0:i.apply(this,arguments)}off(){var i;return(i=qt(this,St).off)==null?void 0:i.apply(this,arguments)}unbind(){var i;return(i=qt(this,St).unbind)==null?void 0:i.apply(this,arguments)}dispatchEvent(){var i;return(i=qt(this,St).dispatchEvent)==null?void 0:i.apply(this,arguments)}trigger(){var i;return(i=qt(this,St).trigger)==null?void 0:i.apply(this,arguments)}listen(){var i;return(i=qt(this,St).listen)==null?void 0:i.apply(this,arguments)}ignore(){var i;return(i=qt(this,St).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}}St=new WeakMap;const Kd=Array.prototype.slice;function o1(n){if(n==null)return!1;const e=n.length;return typeof e=="number"&&e>=0&&e<4294967296}const je={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=Kd.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=Kd.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=!o1(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:Rn.performance&&Rn.performance.now?Rn.performance:Date},Jt=class Jt extends Or{constructor(i,r,o){super();B(this,"_flagOffset",!0);B(this,"_flagOpacity",!0);B(this,"_flagColor",!0);B(this,"_offset",0);B(this,"_opacity",1);B(this,"_color","#fff");for(let s in Gd)Object.defineProperty(this,s,Gd[s]);this._renderer.type="stop",this.offset=typeof i=="number"?i:Jt.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:Jt.Index<=0?"#fff":"#000",Jt.Index=(Jt.Index+1)%2}static fromObject(i){const r=new Jt().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Jt.Properties.length;r++){const o=Jt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Jt;return je.each(Jt.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",je.each(Jt.Properties,r=>{i[r]=this[r]},this),i}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};B(Jt,"Index",0),B(Jt,"Properties",["offset","opacity","color"]);let $i=Jt;const Gd={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)}}},On=class On extends Or{constructor(i){super();B(this,"_flagStops",!1);B(this,"_flagSpread",!1);B(this,"_flagUnits",!1);B(this,"_spread","");B(this,"_units","");for(let r in Zd)Object.defineProperty(this,r,Zd[r]);this._renderer.type="gradient",this._renderer.flagStops=s1.bind(this),this._renderer.bindStops=a1.bind(this),this._renderer.unbindStops=l1.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 $i?s:new $i().copy(s)));const o=new On(r).copy(i);return"id"in i&&(o.id=i.id),o}clone(i){const r=this.stops.map(s=>s.clone()),o=new On(r);return je.each(On.Properties,s=>{o[s]=this[s]},this),i&&i.add(o),o}copy(i){super.copy.call(this,i);for(let r=0;r<On.Properties.length;r++){const o=On.Properties[r];o in i&&(this[o]=i[o])}return this}toObject(){const i={stops:this.stops.map(r=>r.toObject())};return je.each(On.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}};B(On,"Stop",$i),B(On,"Properties",["spread","stops","units"]);let gt=On;const Zd={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 Ti((n||[]).slice(0)),this._stops.bind(te.Types.insert,e).bind(te.Types.remove,i),e(this._stops)}}};function s1(){this._flagStops=!0}function a1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagStops),n[e].parent=this;this._renderer.flagStops()}function l1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagStops),delete n[e].parent;this._renderer.flagStops()}const _i=class _i extends gt{constructor(i,r,o,s,a){super(a);B(this,"_flagEndPoints",!1);B(this,"_left",null);B(this,"_right",null);for(let l in Qd)Object.defineProperty(this,l,Qd[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=c1.bind(this),this.left=new be,this.right=new be,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 _i().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<_i.Properties.length;r++){const o=_i.Properties[r];o in i&&(this[o]=i[o]instanceof be?i[o]:new be().copy(i[o]))}return this}clone(i){const r=this.stops.map(function(s){return s.clone()}),o=new _i(this.left._x,this.left._y,this.right._x,this.right._y,r);return je.each(gt.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}};B(_i,"Stop",$i),B(_i,"Properties",["left","right"]);let zt=_i;const Qd={left:{enumerable:!0,get:function(){return this._left},set:function(n){this._left instanceof be&&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 be&&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 c1(){this._flagEndPoints=!0}const zn=class zn extends gt{constructor(i,r,o,s,a,l){super(s);B(this,"_flagRadius",!1);B(this,"_flagCenter",!1);B(this,"_flagFocal",!1);B(this,"_radius",0);B(this,"_center",null);B(this,"_focal",null);for(let c in Jd)Object.defineProperty(this,c,Jd[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=d1.bind(this),this._renderer.flagFocal=u1.bind(this),this.center=new be,this.radius=typeof o=="number"?o:1,this.focal=new be,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 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&&(/(center|focal)i/.test(o)?this[o]=i[o]instanceof be?i[o]:new be().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 zn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return je.each(gt.Properties.concat(zn.Properties),function(s){o[s]=this[s]},this),i&&i.add(o),o}toObject(){const i=super.toObject.call(this);return je.each(zn.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}};B(zn,"Stop",$i),B(zn,"Properties",["center","radius","focal"]);let Dt=zn;const Jd={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 d1(){this._flagCenter=!0}function u1(){this._flagFocal=!0}function eu(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 Wo(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 tu(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),Z0(r,l,o,c,s,d,a,u,i)}function ba(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),qd(r,l,o,c,s,d,a,u,i)}function Ei(n){switch(n.renderer.type){case"texture":return nt.fromObject(n);case"gradient":return gt.fromObject(n);case"linear-gradient":return zt.fromObject(n);case"radial-gradient":return Dt.fromObject(n)}return n}const f1=Math.cos,h1=Math.sin,nu=Math.tan,_a=[],Ht=class Ht extends te{constructor(i,r,o,s,a,l){super();B(this,"elements",new Hd(9));B(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 k=i;let $,v,E;const P=r[0]||0,F=r[1]||0,R=r[2]||0;return $=k[0]*P+k[1]*F+k[2]*R,v=k[3]*P+k[4]*F+k[5]*R,E=k[6]*P+k[7]*F+k[8]*R,[$,v,E]}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],x=r[5],w=r[6],C=r[7],N=r[8];return o=o||new Hd(9),o[0]=s*m+a*y+l*w,o[1]=s*g+a*_+l*C,o[2]=s*b+a*x+l*N,o[3]=c*m+d*y+u*w,o[4]=c*g+d*_+u*C,o[5]=c*b+d*x+u*N,o[6]=f*m+h*y+p*w,o[7]=f*g+h*_+p*C,o[8]=f*b+h*x+p*N,o}static fromObject(i){return new Ht().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]=Ht.Identity[0],this.elements[1]=Ht.Identity[1],this.elements[2]=Ht.Identity[2],this.elements[3]=Ht.Identity[3],this.elements[4]=Ht.Identity[4],this.elements[5]=Ht.Identity[5],this.elements[6]=Ht.Identity[6],this.elements[7]=Ht.Identity[7],this.elements[8]=Ht.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 X=a[0]*i+a[1]*r+a[2]*o,G=a[3]*i+a[4]*r+a[5]*o,Z=a[6]*i+a[7]*r+a[8]*o;return[X,G,Z]}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],x=f[6],w=f[7],C=f[8],N=h[0],k=h[1],$=h[2],v=h[3],E=h[4],P=h[5],F=h[6],R=h[7],M=h[8];return this.elements[0]=p*N+m*v+g*F,this.elements[1]=p*k+m*E+g*R,this.elements[2]=p*$+m*P+g*M,this.elements[3]=b*N+y*v+_*F,this.elements[4]=b*k+y*E+_*R,this.elements[5]=b*$+y*P+_*M,this.elements[6]=x*N+w*v+C*F,this.elements[7]=x*k+w*E+C*R,this.elements[8]=x*$+w*P+C*M,this.trigger(te.Types.change)}inverse(i){const r=this.elements;i=i||new Ht;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=f1(i),o=h1(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=nu(i);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(i){const r=nu(i);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(i){return _a.length=0,this.toTransformArray(i,_a),_a.map(Pn).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 Ht().copy(this)}};B(Ht,"Identity",[1,0,0,0,1,0,0,0,1]);let ur=Ht;Y0(ur);const io=class io extends Or{constructor(){super();B(this,"_flagMatrix",!0);B(this,"_flagScale",!1);B(this,"_matrix",null);B(this,"_worldMatrix",null);B(this,"_position",null);B(this,"_rotation",0);B(this,"_scale",1);B(this,"_skewX",0);B(this,"_skewY",0);for(let i in jo)Object.defineProperty(this,i,jo[i]);this._renderer.flagMatrix=iu.bind(this),this.isShape=!0,this.matrix=new ur,this.worldMatrix=new ur,this.position=new be,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(i){const r=new io().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 jo.position.get.apply(this,arguments)}set translation(i){jo.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 be?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 be?i.scale:new be(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 io;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 be?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 be?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}};B(io,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let Fn=io;const jo={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),iu.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 be&&this._scale.unbind(te.Types.change,this._renderer.flagMatrix),this._scale=n,this._scale instanceof be&&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 U0(this,this._worldMatrix),this._worldMatrix},set:function(n){this._worldMatrix=n}}};function iu(){this._flagMatrix=!0}const ru=/^(?:none|transparent)$/i,m1=8,wa=Number.EPSILON;function Yn(n,e){return{x:n,y:e}}function qo(n,e,i=wa){return Math.abs(n.x-e.x)<=i&&Math.abs(n.y-e.y)<=i}function ou(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 p1(n,e,i){if(!n)return[Yn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[Yn(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,x=o*o;const w=b*b/_+y*y/x;if(w>1){const A=Math.sqrt(w);r*=A,o*=A,_=r*r,x=o*o}const C=_*y*y+x*b*b,N=C===0?0:(_*x-C)/C;let k=Math.sqrt(Math.max(0,N));a===l&&(k=-k);const $=k*r*y/o,v=-k*o*b/r,E=m*$-g*v+(c+u)/2,P=g*$+m*v+(d+f)/2,F=ou(1,0,(b-$)/r,(y-v)/o),R=ou((b-$)/r,(y-v)/o,(-b-$)/r,(-y-v)/o)%nn,M=F+R,X=l===0,G=(()=>{const A=M-F,Y=Math.abs(A)<Number.EPSILON;let H=Gt(A,nn);return H<Number.EPSILON&&(H=Y?0:nn),X&&!Y&&(H=H===nn?-nn:H-nn),H})(),Z=Math.max(Oo.Resolution,Math.max(i*2,1)),O=[];for(let A=1;A<=Z;A++){const Y=A/Z,H=F+Y*G;let T=E+r*Math.cos(H),D=P+o*Math.sin(H);if(s!==0){const K=T-E,J=D-P,U=Math.cos(s),q=Math.sin(s);T=K*U-J*q+E,D=K*q+J*U+P}O.push(Yn(T,D))}return O}function g1(n,e=m1){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&&!qo(l,c)){const p=Yn(l.x,l.y);r.push({a:c,b:p}),a.push(p),c=p}a.length>=3&&l&&c&&qo(l,c)&&i.push(a),a=null,l=null,c=null}},f=h=>{if(!c){c=h,a&&a.push(h);return}qo(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?me.move:me.line);if(m===me.move){u(!1);const g=Yn(p.x,p.y);a=[g],l=g,c=g,d=p;continue}if(d||(d=o[Math.max(h-1,0)]),m===me.line)f(Yn(p.x,p.y));else if(m===me.curve){const g=ba(p,d,s);for(let b=1;b<g.length;b++){const y=g[b];f(Yn(y.x,y.y))}f(Yn(p.x,p.y))}else if(m===me.arc){const g=p1(d,p,s);for(let b=0;b<g.length;b++)f(g[b])}else if(m===me.close){u(!0),d=p;continue}else f(Yn(p.x,p.y));d=p}if(a){const h=!!n._closed||!!n.closed||l&&c&&!qo(l,c);u(h)}return{polygons:i,segments:r}}function y1(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 b1(n,e,i,r){const o=r.x-i.x,s=r.y-i.y;if(Math.abs(o)<wa&&Math.abs(s)<wa){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 _1(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=b1(e,i,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function w1(n,e){if(typeof e=="boolean")return e;const i=n.fill;return!i&&i!==0?!1:typeof i=="string"?!ru.test(i):!0}function x1(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"?!ru.test(r):!0}function k1(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 Xo=Number.EPSILON;function Yo(n){return typeof n.relative!="boolean"||!!n.relative}function wn(n,e,i,r){const o=n.controls;if(!(!o||!o[e])){if(Math.abs(i)<Xo&&Math.abs(r)<Xo){Yo(n)?o[e].clear():o[e].set(n.x,n.y);return}Yo(n)?o[e].set(i,r):o[e].set(n.x+i,n.y+r)}}function Zt(n,e){wn(n,e,0,0)}function C1(n,e){const i=n.controls;return!i||!i[e]?{x:0,y:0}:Yo(n)?{x:i[e].x,y:i[e].y}:{x:i[e].x-n.x,y:i[e].y-n.y}}function fr(n,e){const i=C1(n,e);return Math.abs(i.x)>Xo||Math.abs(i.y)>Xo}function Uo(n){n.command===me.move||n.command===me.close||(n.command=fr(n,"left")||fr(n,"right")?me.curve:me.line)}function su(n,e){typeof e.relative=="boolean"&&(n.relative=e.relative)}function v1(n,e){return fr(e,"right")||fr(n,"left")||fr(n,"right")||fr(e,"left")||n.command===me.curve||e.command===me.curve}function hr(n,e,i){return{x:Kt(n.x,e.x,i),y:Kt(n.y,e.y,i)}}function au(n,e){const i=n.controls&&n.controls[e];return i?Yo(n)?{x:n.x+i.x,y:n.y+i.y}:{x:i.x,y:i.y}:{x:n.x,y:n.y}}function S1(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?au(n,"right"):{...s},l={x:e.x,y:e.y},c=o?au(e,"left"):{...l},d=hr(s,a,i),u=hr(a,c,i),f=hr(c,l,i),h=hr(d,u,i),p=hr(u,f,i),m=hr(h,p,i),g=new Ae(m.x,m.y);return su(g,n),wn(g,"left",h.x-m.x,h.y-m.y),wn(g,"right",p.x-m.x,p.y-m.y),g.command=me.curve,{anchor:g,startOut:d,endIn:f}}function B1(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 k=0,$=e-u;k<=c;k+=1,$+=1){const v=Gt($,a);h[k]=n[v]}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],x=[g],w=new Array(c+1),C=new Array(c+1);for(let k=1;k<c;k+=1){const $=k<b,v=$||s?1:2,E=$?4:s?2:7,P=$?4:s?3:8,F=$?2:s?0:1,R=v/g;g=x[k]=E-R,p=y[k]=P*h[k].x+F*h[k+1].x-R*p,m=_[k]=P*h[k].y+F*h[k+1].y-R*m}w[b]=y[b]/x[b],C[b]=_[b]/x[b];for(let k=c-2;k>=0;k-=1)w[k]=(y[k]-w[k+1])/x[k],C[k]=(_[k]-C[k+1])/x[k];w[c]=(3*h[c].x-w[b])/2,C[c]=(3*h[c].y-C[b])/2;const N=c-f;for(let k=u,$=e;k<=N;k+=1,$+=1){const v=Gt($,a),E=n[v],P=w[k]-E.x,F=C[k]-E.y;o||k<N?wn(E,"right",P,F):Zt(E,"right"),o||k>u?wn(E,"left",-P,-F):Zt(E,"left"),Uo(E)}}function N1(n,e,i,r,o,s){const a=e||n,l=n,c=i||n,d=be.distanceBetween(a,l),u=be.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,x=(g*a.y+b*l.y-m*c.y)/y-l.y;wn(n,"left",_,x)}else Zt(n,"left")}else Zt(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,x=(m*c.y+b*l.y-g*a.y)/y-l.y;wn(n,"right",_,x)}else Zt(n,"right")}else Zt(n,"right");Uo(n)}function T1(n,e,i,r,o,s){if(!(e&&i)){e||Zt(n,"left"),i||Zt(n,"right"),Uo(n);return}const a=e,l=n,c=i,d=be.distanceBetween(a,l),u=be.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;wn(n,"left",p.x*m,p.y*m)}else Zt(n,"left");if(!s&&f!==0){const m=h*d/f-h;wn(n,"right",p.x*m,p.y*m)}else Zt(n,"right");Uo(n)}function $1(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=Gt(d,c),f=n[u];if(f.command===me.move){Zt(f,"left"),Zt(f,"right");continue}const h=d===e&&!o?null:d-1,p=d===i&&!o?null:d+1,m=h===null?null:n[Gt(h,c)],g=p===null?null:n[Gt(p,c)],b=h===null,y=p===null;a==="geometric"?T1(f,m,g,l,b,y):N1(f,m,g,l,b,y)}}const mr=Math.min,pr=Math.max,E1=Math.ceil,R1=Math.floor,P1=new be,F1=new ur,Cn=class Cn extends Fn{constructor(i,r,o,s){super();B(this,"_flagVertices",!0);B(this,"_flagLength",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagCap",!0);B(this,"_flagJoin",!0);B(this,"_flagMiter",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_flagMask",!1);B(this,"_flagClip",!1);B(this,"_length",0);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_cap","round");B(this,"_join","round");B(this,"_miter",4);B(this,"_closed",!0);B(this,"_curved",!1);B(this,"_automatic",!0);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_mask",null);B(this,"_clip",!1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);for(let a in lu)Object.defineProperty(this,a,lu[a]);this._renderer.type="path",this._renderer.flagVertices=cu.bind(this),this._renderer.bindVertices=du.bind(this),this._renderer.unbindVertices=uu.bind(this),this._renderer.flagFill=fu.bind(this),this._renderer.flagStroke=hu.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:Ei(i.fill),o=typeof i.stroke=="string"?i.stroke:Ei(i.stroke),s=new Cn().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 Ae?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ae().copy(o))}}for(let r=0;r<Cn.Properties.length;r++){const o=Cn.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Cn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Cn.Properties.length;o++){const s=Cn.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()),je.each(Cn.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}=X0(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[x,w]=r.multiply(y,_),C=c.controls.left.x,N=c.controls.left.y;c.relative&&(C+=c.x,N+=c.y);let[k,$]=r.multiply(C,N);const v=Q0(p,m,x,w,k,$,g,b);f=mr(v.min.y-o,f),d=mr(v.min.x-o,d),u=pr(v.max.x+o,u),h=pr(v.max.y+o,h)}else a<=1&&(f=mr(m-o,f),d=mr(p-o,d),u=pr(p+o,u),h=pr(m+o,h)),f=mr(b-o,f),d=mr(g-o,d),u=pr(g+o,u),h=pr(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(F1);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=w1(this,s.fill),g=x1(this,s.stroke),{polygons:b,segments:y}=g1(this,p);if(m&&b.length>0&&y1(b,f,h))return!0;if(g&&y.length>0){const _=typeof this.linewidth=="number"?this.linewidth:0;if(_>0&&_1(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,_,x=this.length*Math.min(Math.max(i,0),1);const w=this.vertices.length,C=w-1;let N=null,k=null;for(let O=0,A=this._lengths.length,Y=0;O<A;O++){if(Y+this._lengths[O]>=x){this._closed?(o=Gt(O,w),s=Gt(O-1,w),O===0&&(o=s,s=O)):(o=O,s=Math.min(Math.max(O-1,0),C)),N=this.vertices[o],k=this.vertices[s],x-=Y,this._lengths[O]!==0?i=x/this._lengths[O]:i=0;break}Y+=this._lengths[O]}if(N===null||k===null)return null;if(N){if(!k)return N}else return k;_=k.controls&&k.controls.right,y=N.controls&&N.controls.left,c=k.x,p=k.y,d=(_||k).x,m=(_||k).y,u=(y||N).x,g=(y||N).y,f=N.x,b=N.y,_&&k.relative&&(d+=k.x,m+=k.y),y&&N.relative&&(u+=N.x,g+=N.y),l=Do(i,c,d,u,f),h=Do(i,p,m,g,b);const $=Kt(c,d,i),v=Kt(p,m,i),E=Kt(d,u,i),P=Kt(m,g,i),F=Kt(u,f,i),R=Kt(g,b,i),M=Kt($,E,i),X=Kt(v,P,i),G=Kt(E,F,i),Z=Kt(P,R,i);return je.isObject(r)?(r.x=l,r.y=h,r instanceof Ae&&(r.controls.left.x=M,r.controls.left.y=X,r.controls.right.x=G,r.controls.right.y=Z,(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 Ae(l,h,M-l,X-h,G-l,Z-h,this._curved?me.curve:me.line),a.t=i,a)}plot(){if(this.curved)return e1(this._collection,this.closed),this;for(let i=0;i<this._collection.length;i++)this._collection[i].command=i===0?me.move:me.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===me.close,c=(p,m)=>{if(p==null)return m;if(typeof p=="number"){if(l)return Gt(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=Gt(u+p,a),g=s[m],b=!l&&m===0;g.command===me.move&&!b&&(g.command=me.line)}if(o==="continuous"||o==="asymmetric")B1(s,u,f,l,d,o==="asymmetric");else if(o==="catmull-rom"||o==="geometric"){const p={type:o,factor:r.factor};$1(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===me.move){const f=d.clone();s.push(f),a=d,l=d;continue}if(v1(d,a)){const h=ba(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 x=1;x<h;x+=1){const w=x/h,C=1-y,N=C<=Number.EPSILON?w:(w-y)/C,k=S1(m,g,N);wn(b,"right",k.startOut.x-b.x,k.startOut.y-b.y);const $=k.anchor;s.push($),b=$,m=$.clone(),y=w,wn(g,"left",k.endIn.x-g.x,k.endIn.y-g.y)}const _=d.clone();_.controls.left.copy(g.controls.left),s.push(_)}}else{const f=ba(d,a,i);for(let p=1;p<f.length;p+=1){const m=f[p];su(m,a),Zt(m,"left"),Zt(m,"right"),m.command=me.line,s.push(m)}const h=d.clone();s.push(h)}a=d,d.command===me.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=[]),je.each(this.vertices,function(c,d){if(d<=0||c.command===me.move){a=c,this._lengths[d]=0;return}this._lengths[d]=tu(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=Wo(this,o*this._length),l=Wo(this,s*this._length),c=E1(a),d=R1(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 Ae),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(be.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&&eu(this,s)?(f=m,!r&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):g===c&&eu(this,o)&&(u=m,u.command=me.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=me.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(be.zero,m.t):(P1.copy(p),this._renderer.collection[g+1].controls.left.copy(p.controls.left).lerp(p,m.t))))}return Fn.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,Fn.prototype.flagReset.call(this),this}};B(Cn,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),B(Cn,"Utils",{getCurveLength:tu});let Oe=Cn;const lu={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 gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&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";je.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 Ti?this._collection=n:this._collection=new Ti(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,je.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 cu(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function du(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function uu(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function fu(){this._flagFill=!0}function hu(){this._flagStroke=!0}const V1=Math.ceil,M1=Math.floor,Dn=class Dn extends Fn{constructor(i){super();B(this,"_flagVertices",!0);B(this,"_flagLength",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagSize",!0);B(this,"_flagSizeAttenuation",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_length",0);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_size",1);B(this,"_sizeAttenuation",!1);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);B(this,"noFill",Oe.prototype.noFill);B(this,"noStroke",Oe.prototype.noStroke);B(this,"corner",Oe.prototype.corner);B(this,"center",Oe.prototype.center);B(this,"getBoundingClientRect",Oe.prototype.getBoundingClientRect);B(this,"_updateLength",Oe.prototype._updateLength);for(let r in mu)Object.defineProperty(this,r,mu[r]);this._renderer.type="points",this._renderer.flagVertices=cu.bind(this),this._renderer.bindVertices=du.bind(this),this._renderer.unbindVertices=uu.bind(this),this._renderer.flagFill=fu.bind(this),this._renderer.flagStroke=hu.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:Ei(i.fill),o=typeof i.stroke=="string"?i.stroke:Ei(i.stroke),s=new Dn().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 Ae?this.vertices.push(i.vertices[r].clone()):this.vertices.push(new Ae().copy(o))}for(let r=0;r<Dn.Properties.length;r++){const o=Dn.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Dn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Dn.Properties.length;o++){const s=Dn.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()),je.each(Dn.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=qd(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=Wo(this,i*this._length),s=Wo(this,r*this._length),a=V1(o),l=M1(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}};B(Dn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let Ko=Dn;const mu={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 gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&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 Ti?this._collection=n:this._collection=new Ti(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 pu extends Ti{constructor(i){i=Array.isArray(i)?i:Array.prototype.slice.call(arguments);super(i);Hl(this,Cs,{});this.attach(i),this.on(te.Types.insert,this.attach),this.on(te.Types.remove,this.detach)}get ids(){return qt(this,Cs)}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}}Cs=new WeakMap;const Qn=class Qn extends Oe{constructor(i,r,o,s,a,l,c){const d=c||Oo.Resolution*3,u=[];for(let f=0;f<d;f++)u.push(new Ae);super(u,!0,!1,!0);B(this,"_flagStartAngle",!1);B(this,"_flagEndAngle",!1);B(this,"_flagInnerRadius",!1);B(this,"_flagOuterRadius",!1);B(this,"_startAngle",0);B(this,"_endAngle",nn);B(this,"_innerRadius",0);B(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let f in gu)Object.defineProperty(this,f,gu[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 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._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const i=this._startAngle,r=this._endAngle,o=this._innerRadius,s=this._outerRadius,a=Gt(i,nn)===Gt(r,nn),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,f=0,h,p,m,g,b,y,_,x,w;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),x=s*Math.sin(b),h){case 0:u=me.move;break;default:u=me.curve}g.command=u,g.x=_,g.y=x,g.controls.left.clear(),g.controls.right.clear(),g.command===me.curve&&(w=s*y/Math.PI,g.controls.left.x=w*Math.cos(b-kt),g.controls.left.y=w*Math.sin(b-kt),g.controls.right.x=w*Math.cos(b+kt),g.controls.right.y=w*Math.sin(b+kt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++}if(l){for(a?(c[f].command=me.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),x=o*Math.sin(b),u=me.curve,h<=0&&(u=a?me.move:me.line),g.command=u,g.x=_,g.y=x,g.controls.left.clear(),g.controls.right.clear(),g.command===me.curve&&(w=o*y/Math.PI,g.controls.left.x=w*Math.cos(b+kt),g.controls.left.y=w*Math.sin(b+kt),g.controls.right.x=w*Math.cos(b-kt),g.controls.right.y=w*Math.sin(b-kt),h===1&&g.controls.left.multiplyScalar(2),h===p&&g.controls.right.multiplyScalar(2)),f++;c[f].copy(c[0]),c[f].command=me.line}else a||(c[f].command=me.line,c[f].x=0,c[f].y=0,f++,c[f].copy(c[0]),c[f].command=me.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 Qn(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<Oe.Properties.length;d++){const u=Oe.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<Qn.Properties.length;r++){const o=Qn.Properties[r];i[o]=this[o]}return i}};B(Qn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let xa=Qn;const gu={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}}},ka=Math.cos,Ca=Math.sin,Jn=class Jn extends Oe{constructor(i,r,o,s){const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Ae(0,0,0,0,0,0));super(l,!0,!0,!0);B(this,"_flagRadius",!1);B(this,"_radius",0);this._renderer.type="circle";for(let c in yu)Object.defineProperty(this,c,yu[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 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];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*nn,d=o*ka(c),u=o*Ca(c),f=s*ka(c-kt),h=s*Ca(c-kt),p=s*ka(c+kt),m=s*Ca(c+kt),g=this.vertices[a];g.command=a===0?me.move:me.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 Jn(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<Oe.Properties.length;o++){const s=Oe.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<Jn.Properties.length;r++){const o=Jn.Properties[r];i[o]=this[o]}return i}};B(Jn,"Properties",["radius"]);let va=Jn;const yu={radius:{enumerable:!0,get:function(){return this._radius},set:function(n){this._radius=n,this._flagRadius=!0}}},Sa=Math.cos,Ba=Math.sin,ei=class ei extends Oe{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 Ae);super(c,!0,!0,!0);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_width",0);B(this,"_height",0);this._renderer.type="ellipse";for(let d in bu)Object.defineProperty(this,d,bu[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 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._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*nn,d=o*Sa(c),u=s*Ba(c),f=o*r*Sa(c-kt),h=s*r*Ba(c-kt),p=o*r*Sa(c+kt),m=s*r*Ba(c+kt),g=this.vertices[a];g.command=a===0?me.move:me.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 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<Oe.Properties.length;l++){const c=Oe.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<ei.Properties.length;r++){const o=ei.Properties[r];i[o]=this[o]}return i}};B(ei,"Properties",["width","height"]);let Na=ei;const bu={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}}},I1=Math.cos,A1=Math.sin,ti=class ti extends Oe{constructor(i,r,o,s){s=Math.max(s||0,3);super();B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_flagSides",!1);B(this,"_radius",0);B(this,"_width",0);B(this,"_height",0);B(this,"_sides",0);this._renderer.type="polygon";for(let a in _u)Object.defineProperty(this,a,_u[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 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&&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=nn*a+Math.PI/2,c=this._width*I1(l)/2,d=this._height*A1(l)/2;s>=o?this.vertices.push(new Ae(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?me.move:me.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 ti(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<Oe.Properties.length;o++){const s=Oe.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<ti.Properties.length;r++){const o=ti.Properties[r];i[o]=this[o]}return i}};B(ti,"Properties",["width","height","sides"]);let Ta=ti;const _u={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}}},Xi=class Xi extends Oe{constructor(i,r,o,s){const a=[new Ae,new Ae,new Ae,new Ae];super(a,!0,!1,!0);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_width",0);B(this,"_height",0);B(this,"_origin",null);this._renderer.type="rectangle";for(let l in wu)Object.defineProperty(this,l,wu[l]);this.width=typeof o=="number"?o:1,this.height=typeof s=="number"?s:1,this.origin=new be,typeof i=="number"&&(this.translation.x=i),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(i){const r=new Xi().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<Xi.Properties.length;r++){const o=Xi.Properties[r];o in i&&(typeof i[o]=="number"?this[o]=i[o]:this[o]instanceof be&&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 Ae),this.vertices[0].set(-i,-r).sub(this._origin).command=me.move,this.vertices[1].set(i,-r).sub(this._origin).command=me.line,this.vertices[2].set(i,r).sub(this._origin).command=me.line,this.vertices[3].set(-i,r).sub(this._origin).command=me.line,this.vertices[4]&&(this.vertices[4].set(-i,-r).sub(this._origin).command=me.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(i){const r=new Xi(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<Oe.Properties.length;o++){const s=Oe.Properties[o];r[s]instanceof be?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}};B(Xi,"Properties",["width","height","origin"]);let zr=Xi;const wu={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()}}},ni=class ni extends Oe{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 Ae(0,0,0,0,0,0,c===0?me.move:me.curve));super(l);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_flagRadius",!1);B(this,"_width",0);B(this,"_height",0);B(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in xu)Object.defineProperty(this,c,xu[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=O1.bind(this),typeof o=="number"&&(this.width=o),typeof s=="number"&&(this.height=s),(typeof a=="number"||a instanceof be)&&(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 ni().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ni.Properties.length;r++){const o=ni.Properties[r];if(o in i){const s=i[o];/radius/i.test(o)?this[o]=typeof s=="number"||s instanceof be?s:new be().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 be?(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 ni(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<Oe.Properties.length;l++){const c=Oe.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<ni.Properties.length;r++){const o=ni.Properties[r];i[o]=this[o]}return i.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),i}};B(ni,"Properties",["width","height","radius"]);let $a=ni;const xu={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 be&&this._radius.unbind(te.Types.change,this._renderer.flagRadius),this._radius=n,this._radius instanceof be&&this._radius.bind(te.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function O1(){this._flagRadius=!0}const z1=Math.cos,D1=Math.sin,ii=class ii extends Oe{constructor(i,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();B(this,"_flagInnerRadius",!1);B(this,"_flagOuterRadius",!1);B(this,"_flagSides",!1);B(this,"_innerRadius",0);B(this,"_outerRadius",0);B(this,"_sides",0);this._renderer.type="star";for(let l in ku)Object.defineProperty(this,l,ku[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 ii().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ii.Properties.length;r++){const o=ii.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=nn*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*z1(l),u=c*D1(l);s>=o?this.vertices.push(new Ae(d,u)):this.vertices[s].set(d,u),this.vertices[s].command=s===0?me.move:me.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 ii(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<Oe.Properties.length;l++){const c=Oe.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<ii.Properties.length;r++){const o=ii.Properties[r];i[o]=this[o]}return i}};B(ii,"Properties",["innerRadius","outerRadius","sides"]);let Ea=ii;const ku={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 Ra;const Cu=Math.min,vu=Math.max;Rn.document&&(Ra=document.createElement("canvas"));const Vt=class Vt extends Fn{constructor(i,r,o,s){super();B(this,"_flagValue",!0);B(this,"_flagFamily",!0);B(this,"_flagSize",!0);B(this,"_flagLeading",!0);B(this,"_flagAlignment",!0);B(this,"_flagBaseline",!0);B(this,"_flagStyle",!0);B(this,"_flagWeight",!0);B(this,"_flagDecoration",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagMask",!1);B(this,"_flagClip",!1);B(this,"_flagDirection",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_value","");B(this,"_family","sans-serif");B(this,"_size",13);B(this,"_leading",17);B(this,"_alignment","center");B(this,"_baseline","middle");B(this,"_style","normal");B(this,"_weight",500);B(this,"_decoration","none");B(this,"_direction","ltr");B(this,"_fill","#000");B(this,"_stroke","none");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_mask",null);B(this,"_clip",!1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);for(let a in Su)Object.defineProperty(this,a,Su[a]);if(this._renderer.type="text",this._renderer.flagFill=L1.bind(this),this._renderer.flagStroke=H1.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,!je.isObject(s))return this;for(let a=0;a<Vt.Properties.length;a++){const l=Vt.Properties[a];l in s&&(this[l]=s[l])}}static Measure(i){if(Ra){const r=Ra.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*Vt.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:Ei(i.fill),o=typeof i.stroke=="string"?i.stroke:Ei(i.stroke),s=new Vt().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<Vt.Properties.length;r++){const o=Vt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Vt(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<Vt.Properties.length;o++){const s=Vt.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<Vt.Properties.length;r++){const o=Vt.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}=Vt.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=Cu(h,m,b,_),o=Cu(f,p,g,y),s=vu(f,p,g,y),l=vu(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}};B(Vt,"Ratio",.6),B(Vt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let gr=Vt;const Su={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 gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=n,this._flagFill=!0,(this._fill instanceof gt||this._fill instanceof zt||this._fill instanceof Dt||this._fill instanceof nt)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(n){(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=n,this._flagStroke=!0,(this._stroke instanceof gt||this._stroke instanceof zt||this._stroke instanceof Dt||this._stroke instanceof nt)&&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,je.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 L1(){this._flagFill=!0}function H1(){this._flagStroke=!0}const ri=class ri extends zr{constructor(i,r,o,s){super(r,o,0,0);B(this,"_flagTextures",!1);B(this,"_flagFrameRate",!1);B(this,"_flagIndex",!1);B(this,"_amount",1);B(this,"_duration",0);B(this,"_index",0);B(this,"_startTime",0);B(this,"_playing",!1);B(this,"_firstFrame",0);B(this,"_lastFrame",0);B(this,"_loop",!0);B(this,"_textures",null);B(this,"_frameRate",0);B(this,"_origin",null);this._renderer.type="image-sequence";for(let a in Bu)Object.defineProperty(this,a,Bu[a]);this._renderer.flagTextures=W1.bind(this),this._renderer.bindTextures=j1.bind(this),this._renderer.unbindTextures=q1.bind(this),this.noStroke(),this.noFill(),Array.isArray(i)?this.textures=i.map(Nu.bind(this)):typeof i=="string"&&(this.textures=[Nu(i)]),this.origin=new be,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=ri.DefaultFrameRate,this.index=0}static fromObject(i){const r=new ri().copy(i);return"id"in i&&(r.id=i.id),r}copy(i){super.copy.call(this,i);for(let r=0;r<ri.Properties.length;r++){const o=ri.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=je.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 ri(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,je.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=je.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=Kt(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 nt))&&(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}};B(ri,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),B(ri,"DefaultFrameRate",30);let Pa=ri;const Bu={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 Ti((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 W1(){this._flagTextures=!0}function j1(n){let e=n.length;for(;e--;)n[e].bind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function q1(n){let e=n.length;for(;e--;)n[e].unbind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Nu(n){if(n instanceof nt)return n;if(typeof n=="string")return new nt(n)}const Yi=class Yi extends zr{constructor(i,r,o,s,a,l){super(r,o,0,0);B(this,"_flagTexture",!1);B(this,"_flagColumns",!1);B(this,"_flagRows",!1);B(this,"_flagFrameRate",!1);B(this,"_flagIndex",!1);B(this,"_amount",1);B(this,"_duration",0);B(this,"_startTime",0);B(this,"_playing",!1);B(this,"_firstFrame",0);B(this,"_lastFrame",0);B(this,"_loop",!0);B(this,"_texture",null);B(this,"_columns",1);B(this,"_rows",1);B(this,"_frameRate",0);B(this,"_index",0);B(this,"_origin",null);this._renderer.type="sprite";for(let c in Tu)Object.defineProperty(this,c,Tu[c]);this.noStroke(),this.noFill(),i instanceof nt?this.texture=i:typeof i=="string"&&(this.texture=new nt(i)),this.origin=new be,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 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])}return this}play(i,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=je.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 Yi(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&&(je.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=je.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=Kt(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}};B(Yi,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let Fa=Yi;const Tu={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}}},Go=Math.min,Zo=Math.max,X1={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},Wt=class Wt extends Fn{constructor(i){super();B(this,"_flagAdditions",!1);B(this,"_flagSubtractions",!1);B(this,"_flagOrder",!1);B(this,"_flagOpacity",!0);B(this,"_flagBeginning",!1);B(this,"_flagEnding",!1);B(this,"_flagLength",!1);B(this,"_flagMask",!1);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_cap","round");B(this,"_join","round");B(this,"_miter",4);B(this,"_closed",!0);B(this,"_curved",!1);B(this,"_automatic",!0);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_length",0);B(this,"_mask",null);B(this,"_strokeAttenuation",!0);for(let r in $u)Object.defineProperty(this,r,$u[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++)Eu.call(this,i[r],this)}static RemoveChildren(i){for(let r=0;r<i.length;r++)Eu.call(this,i[r])}static OrderChildren(i){this._flagOrder=!0}static fromObject(i){const r=new Wt;for(let s=0;s<Wt.Properties.length;s++){const a=Wt.Properties[s];a in i&&(/(fill|stroke)/i.test(a)?r[a]=typeof i[a]=="string"?i[a]:Ei(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 xa.fromObject(s);case"circle":return va.fromObject(s);case"element":return Or.fromObject(s);case"ellipse":return Na.fromObject(s);case"group":return Wt.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Pa.fromObject(s);case"path":return Oe.fromObject(s);case"points":return Ko.fromObject(s);case"polygon":return Ta.fromObject(s);case"rectangle":return zr.fromObject(s);case"rounded-rectangle":return $a.fromObject(s);case"shape":return Fn.fromObject(s);case"sprite":return Fa.fromObject(s);case"star":return Ea.fromObject(s);case"text":return gr.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||!Wt.IsVisible(h,r.visibleOnly))continue;const p=typeof h.getBoundingClientRect=="function"?h.getBoundingClientRect():null;if(!(p&&!k1(p,r.x,r.y,l))){if(h instanceof Wt){if(o&&(!s||s(h))&&typeof h.contains=="function"&&h.contains(r.x,r.y,a)&&(u.push(h),c)||Wt.VisitForHitTest(h,r,o,s,a,l,c))return!0;continue}if(h instanceof Fn&&!(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<Wt.Properties.length;r++){const o=Wt.Properties[r];o in i&&(this[o]=i[o])}return this}clone(i){const r=new Wt,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,je.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}=X1.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,Wt.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"||je.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||je.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||je.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||je.isNaN(r.bottom)||!isFinite(r.bottom),!(s||a||l||c)))if(i){const[b,y]=o.multiply(r.left,r.top),[_,x]=o.multiply(r.right,r.top),[w,C]=o.multiply(r.left,r.bottom),[N,k]=o.multiply(r.right,r.bottom);f=Go(y,x,C,k,f),d=Go(b,_,w,N,d),u=Zo(b,_,w,N,u),h=Zo(y,x,C,k,h)}else f=Go(r.top,f),d=Go(r.left,d),u=Zo(r.right,u),h=Zo(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}};B(Wt,"Children",pu),B(Wt,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let Un=Wt;const $u={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=Un.InsertChildren.bind(this),i=Un.RemoveChildren.bind(this),r=Un.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&i(this._children)),this._children=new pu(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,je.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 Eu(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 Qo extends Oe{constructor(e,i,r,o){const s=[new Ae(e,i),new Ae(r,o)];super(s);for(let a in Ru)Object.defineProperty(this,a,Ru[a]);this.vertices[0].command=me.move,this.vertices[1].command=me.line,this.automatic=!1}}B(Qo,"Properties",["left","right"]);const Ru={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(n){if(je.isObject(n))this.vertices.splice(0,1,n),this.vertices[0].command=me.move;else{const e=new Lo("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(je.isObject(n))this.vertices.splice(1,1,n),this.vertices[1].command=me.line;else{const e=new Lo("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class Va{constructor(e=0,i=0){this.x=e,this.y=i}}class Vn{constructor(e=10,i=0,r="A"){B(this,"start",new Va);B(this,"end",new Va);this.width=e,this.angle=i,this.label=r}}const Ke={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"}},Y1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function U1(n,e){return t.openBlock(),t.createElementBlock("svg",Y1,[...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 Jo=t.markRaw({name:"ion-close",render:U1}),K1={class:"mr-3 flex flex-col gap-2"},G1=["onClick"],Z1={class:"h-full p-2"},Q1={},J1=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=Jo;return t.openBlock(),t.createBlock(t.unref(I.NScrollbar),{style:{width:"auto"},trigger:"none",class:"max-h-[19rem] md:max-h-[40rem] w-auto"},{default:t.withCtx(()=>[t.createElementVNode("div",K1,[(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(I.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",Z1,[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,G1)]),default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f.label),1)]),_:2},1024),f.isCustom&&!f.isNewRec()?(t.openBlock(),t.createBlock(t.unref(I.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})}}}),Pu=gn(J1,[["__scopeId","data-v-afccb364"]]),eb={class:"flex gap-3 min-w-[20rem] relative"},tb={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},nb={ref:"drawing-container",class:"size-full"},ib={},Fu=t.defineComponent({...ib,__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((O,A)=>new Vn(i.value.configuratorParams.linesWidths[A],O,`A-${A+1}`))),f=t.computed(()=>i.value.configuratorParams.colorSide==="bottom"),h=t.computed(()=>{var O,A;return i.value.configuratorParams.startTailType&&((O=i.settings.startTailConfigs)!=null&&O[i.value.configuratorParams.startTailType])?(A=i.settings.startTailConfigs)==null?void 0:A[i.value.configuratorParams.startTailType].points:[]}),p=t.computed(()=>{var A;const O=i.value.configuratorParams.endTailType!==void 0&&((A=i.settings.endTailConfigs)==null?void 0:A[i.value.configuratorParams.endTailType]);return!O||!O.points?[]:O.points.map((Y,H)=>Array.isArray(Y)?new Vn(Y[0],Y[1],`A-${H+1}`):new Vn(Y.width,Y.angle,`A-${H+1}`))}),m=(O,A=!1)=>{O[0].start.x=0,O[0].start.y=0;let Y=0;for(let H=0;H<O.length;H++){const T=O[H],D=O[H-1]??new Vn(0,Y);Y+=!A||H>1?D.angle:0;const K=(!A||H>0?T.angle:0)+Y;if(O[H].end.x=T.width*Math.cos(K*Math.PI/180)+O[H].start.x,O[H].end.y=T.width*Math.sin(K*Math.PI/180)+O[H].start.y,H<O.length-1){const J=H+1;O[J].start.x=O[H].end.x,O[J].start.y=O[H].end.y}}return O},g=(O,A,Y,H,T=!1)=>{let D=m([...Y,...H]);A.length>0&&(D=[...m(A),...D]);let K=0,J=0,U=0,q=0;D.forEach(oe=>{K=Math.min(K,oe.start.x,oe.end.x),J=Math.min(J,oe.start.y,oe.end.y),U=Math.max(U,oe.start.x,oe.end.x),q=Math.max(q,oe.start.y,oe.end.y)});let L,le;K===0&&J===0&&U===0&&q===0?(L=1,le=1):(L=O.width/Math.abs(U-K),le=(T?O.height:O.height-Ke.colorSideLabel.size)/Math.abs(q-J));const ue=Math.min(L,le);return K=K<0?-K*ue:0,J=J<0?-J*ue:0,[ue,K,J]},b=O=>{const A=new Ko([O]);return A._size=Ke.anchorPoint.size,A.fill=Ke.anchorPoint.color,A.stroke="transparent",A._linewidth=Ke.anchorPoint.strokeSize,l.push(A),A},y=(O,A)=>{if(l=[],i.settings.allowChangeFirstPoint){const Y=O[0],H=new be(Y.vertices[0].x,Y.vertices[0].y);H.bind(te.Types.change,()=>{Y.vertices[0].copy(H)});const T=b(H);A.add(T)}O.forEach((Y,H)=>{const T=O[H+1],D=new be(Y.vertices[1].x,Y.vertices[1].y);D.bind(te.Types.change,()=>{Y.vertices[1].copy(D),T!==void 0&&T.vertices[0].copy(D)});const K=b(D);A.add(K)})},_=O=>O*(Math.PI/180),x=(O,A,Y)=>{const H=A.vertices.length-1;O.position.x=A.vertices[H].x,O.position.y=A.vertices[H].y;const T=Math.atan2(A.vertices[H].y-A.vertices[0].y,A.vertices[H].x-A.vertices[0].x);O.rotation=_(Y)+T},w=(O,A,Y)=>{if(A.vertices[0]===void 0)return;O.position.x=A.vertices[0].x,O.position.y=A.vertices[0].y;const H=A.vertices.length-1,T=Math.atan2(A.vertices[H].y-A.vertices[0].y,A.vertices[H].x-A.vertices[0].x);O.rotation=_(Y)+T},C=(O,A,Y)=>{const H=new Un;if(O.length===0)return H;const T=[];return[...O].reverse().forEach((D,K)=>{K!==0&&D.angle>0&&(D.angle*=-1),T.push(D)}),O=m(T,!0),w(H,A,O[0].angle),[A.vertices[0],A.vertices[1]].forEach(D=>{D.bind(te.Types.change,()=>{w(H,A,O[0].angle)})}),O.forEach(D=>{const K=D.start.x*Y,J=D.end.x*Y,U=D.start.y*Y,q=D.end.y*Y,L=new Qo(K,U,J,q);L.linewidth=Ke.line.size,L.stroke=Ke.line.color,H.add(L)}),H},N=(O,A,Y)=>{const H=new Un;return O.length===0||(O=m(O,!0),x(H,A,O[0].angle),[A.vertices[0],A.vertices[1]].forEach(T=>{T.bind(te.Types.change,()=>{x(H,A,O[0].angle)})}),O.forEach(T=>{const D=T.start.x*Y,K=T.end.x*Y,J=T.start.y*Y,U=T.end.y*Y,q=new Qo(D,J,K,U);q.linewidth=Ke.line.size,q.stroke=Ke.line.color,H.add(q)})),H},k=(O,A,Y,H)=>{const T=A.vertices[0].x+(A.vertices[1].x-A.vertices[0].x)/2-8*Math.sin(O.angle*Math.PI/180),D=A.vertices[0].y+(A.vertices[1].y-A.vertices[0].y)/2-8*Math.cos(O.angle*Math.PI/180),K=new gr(O.label,T+10,D-10);let J;K.size=Ke.lineLabel.size,K.weight=600,K.fill=Ke.lineLabel.color,K.id+=1,K.rotation=Ke.lineLabel.rotation,H>0&&(J=new gr(`${O.angle}°`,A.vertices[0].x+25,A.vertices[0].y-25),J.size=Ke.angleLabel.size,J.weight=600,J.fill=Ke.angleLabel.color,J.rotation=Ke.angleLabel.rotation,J.id+=H,s.push(J),Y.add(J)),Y.add(K),v(K,A,0,J),v(K,A,1)},$=()=>{const{size:O}=Ke.colorSideLabel,A=0,Y=0,H=f.value?O/2:O/2-O,T=f.value?O/2-O:O/2,D=new Un;if(!c)return D;const K=5,J=Math.atan2(T-H,Y-A),U=[new Ae(A,H,0,0,0,0,En.Commands.move),new Ae(Y,T,0,0,0,0,En.Commands.line),new Ae(Y-K*Math.cos(J-Math.PI/4),T-K*Math.sin(J-Math.PI/4),0,0,0,0,En.Commands.line),new Ae(Y,T,0,0,0,0,En.Commands.move),new Ae(Y-K*Math.cos(J+Math.PI/4),T-K*Math.sin(J+Math.PI/4),0,0,0,0,En.Commands.line)],q=new Oe(U,!1,!1,!0);q.noFill(),q.cap="round",q.join="round",q.linewidth=O/7,q.stroke=Ke.colorSideLabel.color,D.add(q);const L=new gr(f.value?"Цвет снизу":"Цвет сверху",10,0);L.size=O,L.weight=600,L.fill=Ke.colorSideLabel.color,L.alignment="left",D.add(L);const le=D.getBoundingClientRect();return D.position.x=(c.width-le.width)*d+10,D.position.y=f.value?c.height+le.height*2:le.height/2,D},v=(O,A,Y,H)=>{A.vertices[Y].bind(te.Types.change,()=>{const T=A.vertices.length-1,D=Math.atan2(A.vertices[0].y-A.vertices[T].y,A.vertices[0].x-A.vertices[T].x)*180/Math.PI,K=A.vertices[0].x+(A.vertices[T].x-A.vertices[0].x)/2-8*Math.sin(D*Math.PI/180),J=A.vertices[0].y+(A.vertices[T].y-A.vertices[0].y)/2-8*Math.cos(D*Math.PI/180);O.position.x=K+10,O.position.y=J-10,O.rotation=-.5,H&&(H.position.x=A.vertices[0].x+25,H.position.y=A.vertices[0].y-25)})},E=(O,A,Y,H,T=!1)=>{var fe;if(O.clear(),Y.length===0){O.update();return}const D=m(Y),[K,J,U]=g(O,A,D,H,T),q=new Un,L=new Array,le=new Array;T||(s=[],a=[]),D.forEach((ge,_e)=>{const Qe=ge.start.x*K+J,Re=ge.end.x*K+J,Mt=ge.start.y*K+U,vn=ge.end.y*K+U,It=new Qo(Qe,Mt,Re,vn);It.linewidth=T?Ke.previewLine.size:Ke.line.size,It.stroke=T?Ke.previewLine.color:Ke.line.color,a.push(It),L.push(It),q.add(It),!T&&ge.label!==""&&k(ge,It,q,_e)});const ue=L.at(-1);let oe=q.getBoundingClientRect();if(!T){const ge=$();le.push(ge)}if(A.length>0){const ge=C(A,L[0],K);q.add(ge)}if(H.length>0&&ue){const ge=N(H,ue,K);q.add(ge)}if(le.push(q),O.makeGroup(le),oe=q.getBoundingClientRect(),q.position.x=0-oe.left+(O.width-oe.width)/(2*(T?1:d)),q.position.y=0-oe.top+(O.height-oe.height)/(2*(T?1:d)),O.update(),!T){const ge=((fe=i.value.configuratorParams)==null?void 0:fe.colorSide)==="top";q.position.y=q.position.y+Ke.colorSideLabel.size*Number(ge),y(L,q),O.update()}},P=(O,A)=>{if(O&&!A.isNewRec()){const Y=new En({width:O.scrollWidth,height:O.scrollHeight});Y.appendTo(O),E(Y,[],A.points,[],!0)}},F=()=>{c&&E(c,h.value,u.value,p.value,!1)},R=O=>O*(180/Math.PI),M=(O,A)=>{const Y=O[1].x-O[0].x,H=O[1].y-O[0].y,T=A[1].x-A[0].x,D=A[1].y-A[0].y;let K=Math.atan2(Y*D-H*T,Y*T+H*D);return K=R(K),Math.round(K)*-1},X=O=>{const A=a.map((Y,H,T)=>{const D=T[H-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let K=Ve.multiplyByStep(Math.ceil(Ve.divideByStep(Y._length/O,i.settings.lineWidthStep)),i.settings.lineWidthStep);const J=s[H-1];K<(T.length>1?i.settings.minLineWidth:i.settings.stripMinWidth)&&(K=T.length>1?i.settings.minLineWidth:i.settings.stripMinWidth),K>i.settings.maxLineWidth&&(K=i.settings.maxLineWidth);const U=M(Y.vertices,D.vertices);return J&&(J.value=`${U}°`),new Vn(K,U,`A-${H+1}`)});r("pointer:move",A)},G=O=>{let A=null,Y;const H=J=>{A=l.find(U=>{const q=U.renderer;return(q==null?void 0:q.elem)===J.target}),[Y]=g(O,h.value,u.value.map(U=>U),p.value)},T=J=>{if(A){const U=A.renderer,q=U==null?void 0:U.elem;if(!q)return;const L=q.getBoundingClientRect();A.vertices[0].x-=L.x-(J instanceof MouseEvent?J.clientX:J.targetTouches[0].clientX)+Ke.anchorPoint.size/2,A.vertices[0].y-=L.y-(J instanceof MouseEvent?J.clientY:J.targetTouches[0].clientY)+Ke.anchorPoint.size/2,X(Y),O.update()}},D=()=>{A&&r("pointer:up",u.value),A=null},K=o.value;K&&(K.addEventListener("touchstart",H,{passive:!0}),K.addEventListener("touchend",D,{passive:!0}),K.addEventListener("mousedown",H),K.addEventListener("mouseup",D),K.addEventListener("mousemove",T),K.addEventListener("touchmove",T,{passive:!0}))},Z=(O,A)=>{r("remove-custom-template",O,A)};return t.onMounted(()=>{o.value&&(c=new En({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),t.watch(()=>i.value,()=>{F()},{deep:!0,immediate:!0}),G(c))}),t.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(O,A)=>(t.openBlock(),t.createElementBlock("div",eb,[t.createVNode(Pu,{"select-template-index":n.selectTemplateIndex,settings:n.settings,"onTemplate:select":A[0]||(A[0]=Y=>r("template:select",Y)),onInitDrawTemplate:P,onRemoveCustomTemplate:Z},null,8,["select-template-index","settings"]),t.createElementVNode("div",tb,[t.createElementVNode("div",nb,null,512)])]))}});class yr extends W.Identity{constructor(i,r){super();B(this,"label","");B(this,"points",[]);B(this,"isCustom",!1);B(this,"id",-1);B(this,"guid","");i?(this.label=i.label,this.points=i.points.map((o,s)=>V.isArray(o)?new Vn(o[0],o[1],`A-${s+1}`):new Vn(o.width,o.angle,`A-${s+1}`)),this.isCustom=i.isCustom):(this.label="-- Новая конфигурация --",this.points=[new Vn(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class Ma extends yr{constructor(i){super(i);B(this,"isDefault");this.isDefault=i.isDefault??!1}}class Vu{constructor(e){B(this,"minLineWidth");B(this,"maxLineWidth");B(this,"lineWidthStep");B(this,"minLineAngle");B(this,"maxLineAngle");B(this,"lineAngleStep");B(this,"stripMinWidth");B(this,"stripMaxWidth");B(this,"stripMinLength");B(this,"stripMaxLength");B(this,"allowShowTable");B(this,"showOnlyTemplates");B(this,"templates");B(this,"customTemplates",[]);B(this,"startTailConfigs");B(this,"endTailConfigs");B(this,"bendCountForExtended");B(this,"extendedProductCatalog");B(this,"allowChangeFirstPoint");B(this,"allowSaveTemplates");B(this,"userTemplatesPrefix");B(this,"lengthStep");B(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 yr(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((i=e.startTailConfigs)==null?void 0:i.map(o=>new Ma(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new Ma(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 yr(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new yr({label:"-- Новая конфигурация --",points:[new Vn(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 yr(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 rb={class:"flex flex-col gap-3"},ob={class:"grid gap-5 md:grid-cols-5"},sb={},Mu=t.defineComponent({...sb,__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 Vu(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=(v=0)=>{var P;const E=(P=c.value.allTemplates)==null?void 0:P.at(v);E!==void 0&&(f.value=v,l.value.configuratorParams.linesWidths=E.points.map(F=>V.isArray(F)?F[0]:F.width),l.value.configuratorParams.linesAngles=E.points.map(F=>V.isArray(F)?F[1]:F.angle),x()),y(l.value.configuratorParams)},m=async()=>{const v=prompt("Введите название шаблона:");if(!v)return;a.value=!0;const E={label:v,points:l.value.configuratorParams.linesWidths.map((F,R)=>[F,l.value.configuratorParams.linesAngles[R]])},P=F=>{F&&(c.value.addCustomTemplate(E),f.value=c.value.allTemplates.length-2),a.value=!1};i.eventEmitter.emit("configurator:create-template",{category:i.cartItem.category,template:E,callback:P})},g=async(v,E)=>{var R;const P=(R=c.value.allTemplates)==null?void 0:R.at(v);if(!P||!P.isCustom)return;const F=M=>{M&&(c.value.removeCustomTemplate(P.id),p()),E==null||E()};i.eventEmitter.emit("configurator:remove-template",{category:i.cartItem.category,templateId:P.id,callback:F})},b=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(f.value=c.value.allTemplates.length-1)},y=async v=>{var E,P;l.value.product=new W.ClientProduct,(P=(E=h.value)==null?void 0:E.formReference)==null||P.validate(F=>{F||(x(),o.value=!0,i.eventEmitter.emit("configurator:search-product",{category:i.cartItem.category,params:v,validationFieldResultData:u.value,callback:R=>{R?l.value.product=R:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(V.noop)},_=async()=>{var v,E;(E=(v=h.value)==null?void 0:v.formReference)==null||E.validate(P=>{var F,R;if(!P){s.value=!0;const M=new W.OrderItemBase(l.value);(F=c.value.startTailConfigs)!=null&&F.length||delete M.configuratorParams.startTailType,(R=c.value.endTailConfigs)!=null&&R.length||delete M.configuratorParams.endTailType,r("submit",M,u.value,()=>{s.value=!1,t.nextTick(()=>{var X,G;(G=(X=h.value)==null?void 0:X.formReference)==null||G.restoreValidation()})})}}).catch(V.noop)},x=()=>{const v={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach((E,P)=>{v[`lines_widths[${P+1}]`]={},v[`lines_angles[${P+1}]`]={}}),u.value=v},w=v=>{d.value.linesWidths=v.map(E=>E.width),d.value.linesAngles=v.map(E=>E.angle)},C=v=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,x(),b(),y(l.value.configuratorParams)},N=(v,E)=>{d.value.linesWidths=v,d.value.linesAngles=E},k=v=>{const E=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,P=0;l.value.configuratorParams.linesWidths.splice(v+1,0,E),l.value.configuratorParams.linesAngles.splice(v+1,0,P),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],x(),b(),y(l.value.configuratorParams)},$=v=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(v,1),l.value.configuratorParams.linesAngles.splice(v,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],x(),b(),y(l.value.configuratorParams))};return t.onMounted(()=>{i.cartItem.isNewRec()?p():(x(),f.value=-1,y(l.value.configuratorParams))}),t.watch(()=>i.cartItem,v=>{l.value=new W.OrderItemBase(v),v.isNewRec()?p():(x(),f.value=-1,y(l.value.configuratorParams))}),(v,E)=>{const P=I.NButton;return t.openBlock(),t.createElementBlock("div",rb,[n.settings.allowShowTable?(t.openBlock(),t.createBlock(P,{key:0,type:"tertiary",class:"self-end",onClick:E[0]||(E[0]=F=>r("click:view-switch"))},{default:t.withCtx(()=>[...E[3]||(E[3]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",ob,[t.createVNode(Fu,{value:l.value,"select-template-index":f.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":C,"onPointer:move":w,"onTemplate:select":p,onRemoveCustomTemplate:g},null,8,["value","select-template-index","settings"]),t.createVNode(hc,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":E[1]||(E[1]=F=>l.value=F),"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":E[2]||(E[2]=F=>y(F)),"onUpdate:preview":N,onSubmit:_,"onClick:saveTemplate":m,"onClick:addLine":k,"onClick:removeLine":$},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),ab={class:"flex flex-col items-center justify-between rounded-xl"},lb={class:"img-preview relative flex justify-center"},cb={},db=t.defineComponent({...cb,__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 V.keys(i.settings.crossbarCount).reverse().find(a=>s>=i.settings.crossbarCount[Number(a)])}),o=e;return(s,a)=>{const l=I.NButton;return t.openBlock(),t.createElementBlock("div",ab,[t.createElementVNode("div",lb,[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})])}}}),Ia=gn(db,[["__scopeId","data-v-2a790a20"]]),ub={key:0,class:"flex items-baseline gap-1"},fb={key:0,class:"flex items-baseline gap-1"},hb={key:1},mb={class:"text-lg font-semibold"},pb={key:2,class:"text-red-500 text-sm mb-2"},gb={class:"flex gap-3"},yb={},Iu=t.defineComponent({...yb,__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 k;const r=n,o=i,s=t.computed(()=>Ue.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(V.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":[ce.required,ce.min(r.settings.minWidth-f.value),ce.max(p.value-f.value),ce.step(1),We.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[ce.required,ce.min(r.settings.minHeight-h.value),ce.max(m.value-h.value),ce.step(1),We.serverValidation(r.validation.height.feedback)],quantity:[ce.required,ce.min(1),ce.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]})),x=t.computed(()=>{var R;const $=g.value,v=b.value,{quantity:E}=r.value,P=((R=r.value.product)==null?void 0:R.costRub)||0;if(!$||!v||!E||P===0)return null;const F=$*v/1e6;return Ve.formatMoney(P*E*F)}),w=t.computed(()=>{const $=g.value,v=b.value,E=!!($&&$>=r.settings.minWidth&&$<=r.settings.maxWidths[u.value.configuratorParams.netType]),P=!!(v&&v>=r.settings.minHeight&&v<=r.settings.maxHeights[u.value.configuratorParams.netType]),F=!!(r.value.quantity&&r.value.quantity>0);return E&&P&&F}),C=($,v)=>{var F,R;const E=u.value.configuratorParams;$&&$ in E&&(E[$]=v);const P={...E,width:g.value??0,height:b.value??0};$==="width"&&((F=l.value)==null||F.validate().catch(V.noop)),$==="height"&&((R=c.value)==null||R.validate().catch(V.noop)),t.nextTick(()=>{var X,G;!((X=l.value)!=null&&X.validationErrored)&&!((G=c.value)!=null&&G.validationErrored)&&P.height&&P.width&&o("update:params",P),N("configuratorParams",P)})},N=($,v)=>{const E=new W.OrderItemBase(r.value);E[$]=v,$==="configuratorParams"&&(E.product=new W.ClientProduct),o("update:value",E)};return t.watch(()=>r.value,$=>{const v=V.cloneDeep(t.toRaw($)),E=v.configuratorParams.mountType,P=r.settings.widthOverlaps[E]??0,F=r.settings.heightOverlaps[E]??0;v.configuratorParams.width&&v.configuratorParams.width>0&&(v.configuratorParams.width-=P),v.configuratorParams.height&&v.configuratorParams.height>0&&(v.configuratorParams.height-=F),u.value=v},{deep:!0,immediate:!0}),t.onMounted(()=>{var $;($=d.value)==null||$.select()}),e({validate:(k=a.value)==null?void 0:k.validate,formReference:a}),($,v)=>{const E=I.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.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(I.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:u.value.configuratorParams.netType,"onUpdate:value":[v[0]||(v[0]=P=>u.value.configuratorParams.netType=P),v[1]||(v[1]=P=>C("netType",P))],options:n.settings.netType.map(P=>({label:n.settings.descriptions.net_type[P],value:P}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:u.value.configuratorParams.color,"onUpdate:value":[v[2]||(v[2]=P=>u.value.configuratorParams.color=P),v[3]||(v[3]=P=>C("color",P))],options:n.settings.color.map(P=>({label:n.settings.descriptions.color[P],value:P}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:u.value.configuratorParams.mountType,"onUpdate:value":[v[4]||(v[4]=P=>u.value.configuratorParams.mountType=P),v[5]||(v[5]=P=>C("mountType",P))],options:n.settings.mountType.map(P=>({label:n.settings.descriptions.mount_type[P],value:P}))},null,8,["value","options"])]),_:1}),t.createVNode(t.unref(I.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",ub,[t.createVNode(t.unref(I.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Ширина готового изделия "+t.toDisplayString(g.value),1)]),_:1}),t.createVNode(t.unref(I.NButton),{quaternary:"",type:"info",size:"tiny",onClick:v[10]||(v[10]=P=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...v[25]||(v[25]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{ref:"width-input-reference",value:u.value.configuratorParams.width,"onUpdate:value":[v[6]||(v[6]=P=>u.value.configuratorParams.width=P),v[9]||(v[9]=P=>C("width",P))],parse:t.unref(ht),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:v[7]||(v[7]=P=>t.unref(ft)(P)),onInput:v[8]||(v[8]=P=>t.unref(dt)(n.validation,"width")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.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",fb,[t.createVNode(t.unref(I.NText),{type:"success"},{default:t.withCtx(()=>[t.createTextVNode("Высота готового изделия "+t.toDisplayString(b.value),1)]),_:1}),t.createVNode(t.unref(I.NButton),{quaternary:"",type:"info",size:"tiny",onClick:v[15]||(v[15]=P=>o("click:instructions-toggle"))},{default:t.withCtx(()=>[...v[26]||(v[26]=[t.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):t.createCommentVNode("",!0)]),default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[v[11]||(v[11]=P=>u.value.configuratorParams.height=P),v[14]||(v[14]=P=>C("height",P))],parse:t.unref(ht),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:v[12]||(v[12]=P=>t.unref(ft)(P)),onInput:v[13]||(v[13]=P=>t.unref(dt)(n.validation,"height")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:u.value.quantity,"onUpdate:value":[v[16]||(v[16]=P=>u.value.quantity=P),v[19]||(v[19]=P=>N("quantity",P??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:v[17]||(v[17]=P=>t.unref(ft)(P,!1)),onInput:v[18]||(v[18]=P=>t.unref(dt)(n.validation,"quantity")),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:v[20]||(v[20]=P=>t.unref(dt)(n.validation,"marker")),"onUpdate:value":v[21]||(v[21]=P=>{u.value.marker=P??null,N("marker",P??null)}),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),y.value?(t.openBlock(),t.createBlock(E,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":v[22]||(v[22]=P=>{u.value.isAdditionalSale=P??!1,N("isAdditionalSale",P??!1)})},{default:t.withCtx(()=>[...v[27]||(v[27]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode(Fr,{"is-product-searching":n.isProductSearching,product:u.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),x.value?(t.openBlock(),t.createElementBlock("div",hb,[v[28]||(v[28]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",mb,t.toDisplayString(x.value)+" ₽",1)])):t.createCommentVNode("",!0),w.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",pb," Пожалуйста, заполните все обязательные поля корректно. ")),t.createElementVNode("div",gb,[t.createVNode(t.unref(I.NButton),{loading:n.isSubmitProcessing,disabled:!w.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:v[23]||(v[23]=P=>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(I.NButton),{key:0,type:"default",onClick:v[24]||(v[24]=P=>o("click:show-preview-drawer"))},{default:t.withCtx(()=>[...v[29]||(v[29]=[t.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):t.createCommentVNode("",!0)])]),_:1},8,["model","rules"])),[[t.unref(ai),()=>o("submit",u.value)]])}}}),bb="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",_b="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",wb="/img/configurators/mosquitto/measurement-instructions/mount.png",xb="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",kb="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",Cb={class:"flex flex-col gap-6"},vb={class:"flex gap-4"},Sb={class:"flex flex-col gap-2"},Bb={class:"flex gap-4"},Nb={class:"flex flex-col gap-2"},Tb={class:"flex gap-4"},$b={class:"flex flex-col gap-2"},Eb={},Au=t.defineComponent({...Eb,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(n,{emit:e}){const i=Ue.initRefDependingOnDeviceResolution("small","small","medium"),r=Ue.initRefDependingOnDeviceResolution(.98,.95,.8),o=t.computed(()=>window.innerWidth*r.value),s=e;return(a,l)=>{const c=I.NText;return t.openBlock(),t.createBlock(t.unref(I.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",Cb,[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:bb,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:_b,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",vb,[l[9]||(l[9]=t.createElementVNode("img",{src:wb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",Sb,[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",Bb,[l[15]||(l[15]=t.createElementVNode("img",{src:xb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",Nb,[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",Tb,[l[21]||(l[21]=t.createElementVNode("img",{src:kb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),t.createElementVNode("div",$b,[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"])}}}),Rb={class:"grid md:grid-cols-2"},Pb={},Ou=t.defineComponent({...Pb,__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(()=>Ue.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=V.debounce(async g=>{var b,y;l.value.product=new W.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:x=>{x?l.value.product=x:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(V.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=Jo;return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(Au,{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",Rb,[o.value?(t.openBlock(),t.createBlock(t.unref(I.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(I.NDrawerContent),null,{header:t.withCtx(()=>[t.createVNode(t.unref(I.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(Ia,{"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(Ia,{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(Iu,{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)}}}),Fb={},zu=t.defineComponent({...Fb,__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=>{ft(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=fc,b=yo;return t.openBlock(),t.createBlock(t.unref(I.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(Fr,{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(I.NDropdown),{trigger:"click",options:n.suggestionOption,placement:"bottom-start",size:"large",onSelect:u},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{ref:"width-input-element",value:l.value??null,class:"w-full","show-button":!1,parse:t.unref(ht),placeholder:"Введите ширину",onKeydown:f,onInput:m[0]||(m[0]=y=>t.unref(dt)(n.validation,`linesWidths.${n.index}`)),onFocus:t.unref(He),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),t.createVNode(t.unref(I.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(I.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"])}}}),Vb={class:"my-2 flex w-full flex-col"},Mb={key:1},Ib={class:"text-lg font-semibold"},Ab={class:"flex gap-3"},Ob={},Du=t.defineComponent({...Ob,__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(V.cloneDeep(r.value)),c=t.computed(()=>{const x={length:[ce.required,ce.min(r.settings.minLength),ce.max(r.settings.maxLength),ce.step(r.settings.lengthStep),We.serverValidation(r.validation.length.feedback)],quantity:[ce.required,ce.min(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]};return V.forEach(l.value,(w,C)=>{var N;x[`configuratorParams.linesWidths.${C}`]=[ce.required,ce.min(r.settings.minLineWidth),ce.step(r.settings.lineWidthStep),We.serverValidation((N=r.validation[`linesWidths.${C}`])==null?void 0:N.feedback)]}),x}),d=t.ref(r.settings.canSetDopProdaga??!1),u=t.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((x,w)=>(x??0)+(w??0),0)),f=t.computed(()=>r.settings.width-u.value),h=t.computed(()=>!r.value.some(({product:x})=>!x||x.isNewRec())),p=t.computed(()=>r.isSubmitProcessing||!h.value||f.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(x=>x.product.isNewRec())),m=t.computed(()=>x=>f.value===0?void 0:[{label:`${(f.value>0?"Остаток +":"Излишек ")+f.value} мм.`,key:f.value+x}]),g=t.computed(()=>{const{length:x}=r.value[0];if(!x||u.value!==r.settings.width)return null;const w=V.reduce(r.value,(C,N)=>{var $;const k=(($=N.product)==null?void 0:$.costRub)||0;return C+k},0);return Ve.formatMoney(w*r.value[0].quantity*x)}),b=(x,w,C)=>{var k,$,v;l.value[w].product.id=-1;const{configuratorParams:N}=l.value[w];N.linesWidths[w]=x,y("configuratorParams",N),(v=($=(k=a.value)==null?void 0:k.at(w))==null?void 0:$.formItemReference)==null||v.validate().catch(V.noop),t.nextTick(()=>{var E,P;(P=(E=a.value)==null?void 0:E.at(w))!=null&&P.isValid&&o("update:params",N,w,C)})},y=(x,w)=>{l.value.forEach(C=>{C[x]=w}),o("update:value",l.value)};return t.watch(()=>r.value,x=>{l.value=V.cloneDeep(x)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(x,w)=>{const C=I.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.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 N;return[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,(k,$)=>{var v,E,P;return t.openBlock(),t.createBlock(zu,{key:$,ref_for:!0,ref:"line-items-reference",value:((v=k.configuratorParams)==null?void 0:v.linesWidths.at($))??null,"auto-focus":(((E=k.configuratorParams)==null?void 0:E.linesWidths.at($))??0)===0,index:$,path:`configuratorParams.linesWidths.${$}`,product:k.product,settings:n.settings,validation:n.validation,"suggestion-option":m.value(((P=k.configuratorParams)==null?void 0:P.linesWidths.at($))??0),"add-line-button-disabled":f.value<=0||n.value.length>=n.settings.maxLinesCount||n.value.some(F=>F.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"is-last-line":$===l.value.length-1&&f.value===0,"onUpdate:value":b,"onClick:addLine":w[0]||(w[0]=F=>o("click:add-line",F)),"onClick:removeLine":w[1]||(w[1]=F=>o("click:remove-line",F))},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",Vb,[f.value<0?(t.openBlock(),t.createBlock(t.unref(I.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(I.NText),{key:1,type:"error"},{default:t.withCtx(()=>[...w[15]||(w[15]=[t.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",null,[w[16]||(w[16]=t.createTextVNode(" Остаток для резки: ",-1)),t.createVNode(t.unref(I.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(I.NButton),{disabled:p.value,type:"primary",class:"self-center",onClick:w[2]||(w[2]=k=>o("click:add-line",l.value.length))},{default:t.withCtx(()=>[...w[17]||(w[17]=[t.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["disabled"]),t.createVNode(t.unref(I.NFormItem),{path:"length",label:`Метраж ${n.settings.minLength?" от "+n.settings.minLength:""} ${n.settings.maxLength?" до "+n.settings.maxLength:""} м.`},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value[0].length,"onUpdate:value":[w[3]||(w[3]=k=>l.value[0].length=k),w[6]||(w[6]=k=>y("length",k))],parse:t.unref(ht),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:w[4]||(w[4]=k=>t.unref(ft)(k,!1)),onInput:w[5]||(w[5]=k=>t.unref(dt)(n.validation,"length")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value[0].quantity,"onUpdate:value":[w[7]||(w[7]=k=>l.value[0].quantity=k),w[10]||(w[10]=k=>y("quantity",k))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:w[8]||(w[8]=k=>t.unref(ft)(k,!1)),onInput:w[9]||(w[9]=k=>t.unref(dt)(n.validation,"quantity")),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:l.value[0].marker??null,placeholder:"Введите маркировку",onInput:w[11]||(w[11]=k=>t.unref(dt)(n.validation,"marker")),"onUpdate:value":w[12]||(w[12]=k=>{l.value[0].marker=k??null,y("marker",k??null)}),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),d.value?(t.openBlock(),t.createBlock(C,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":w[13]||(w[13]=k=>{l.value[0].isAdditionalSale=k??!1,y("isAdditionalSale",k??!1)})},{default:t.withCtx(()=>[...w[18]||(w[18]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),g.value?(t.openBlock(),t.createElementBlock("div",Mb,[w[19]||(w[19]=t.createTextVNode(" ИТОГО: ",-1)),t.createElementVNode("span",Ib,t.toDisplayString(g.value)+" ₽",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",Ab,[t.createVNode(t.unref(I.NButton),{loading:n.isSubmitProcessing,disabled:!h.value||f.value!=0||!((N=l.value[0])!=null&&N.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:w[14]||(w[14]=k=>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(ai),()=>o("submit",l.value)]])}}}),zb={class:"flex grow flex-col"},Db=["src"],Lb={class:"w-full"},Hb={},Lu=t.defineComponent({...Hb,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",zb,[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,Db),t.createElementVNode("div",Lb,[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)])]))}}),Wb={class:"flex flex-col gap-2"},jb={class:"flex grow flex-col px-5 md:w-104"},qb={},Hu=t.defineComponent({...qb,__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 W.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=V.debounce(async(m,g,b)=>{const y={linesWidths:m.linesWidths.at(g)};b.value=!0,a.value[`linesWidths.${g}`]={},s.value[g].product=new W.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 W.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 _,x;(x=(_=o.value)==null?void 0:_.formReference)==null||x.restoreValidation()})})}}).catch(V.noop)};return t.watch(()=>i.cartItems,m=>{s.value=m.map(g=>new W.OrderItemBase(g))}),(m,g)=>{const b=I.NButton;return t.openBlock(),t.createElementBlock("div",Wb,[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",jb,[t.createVNode(Lu,{value:s.value,"onUpdate:value":g[1]||(g[1]=y=>s.value=y),settings:n.settings},null,8,["value","settings"]),t.createVNode(Du,{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"])])])}}}),Xb={class:"flex flex-col gap-3"},Yb={},Wu=t.defineComponent({...Yb,__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(V.cloneDeep(r.value)),c=t.computed(()=>({"configuratorParams.width":[ce.required,ce.min(r.settings.minWidth),...r.settings.maxWidth?[ce.max(r.settings.maxWidth)]:[],ce.step(1),We.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[ce.required,ce.min(r.settings.minLength),ce.max(r.settings.maxLength),ce.step(1),We.serverValidation(r.validation.length.feedback)],quantity:[ce.required,ce.min(1),ce.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.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 W.OrderItemBase(r.value);b[m]=g,m==="configuratorParams"&&(b.product=new W.ClientProduct),o("update:value",b)},h=()=>{var m;(m=a.value)==null||m.select()};return t.watch(()=>r.value,m=>{l.value=V.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=I.NCheckbox;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.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(I.NFormItem),{path:"configuratorParams.width",label:`Ширина, ${n.settings.minWidth?" от "+n.settings.minWidth:""}${n.settings.maxWidth?" до "+n.settings.maxWidth:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(I.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(ht),"show-button":!1,placeholder:"Введите ширину",onKeydown:g[1]||(g[1]=y=>t.unref(ft)(y)),onInput:g[2]||(g[2]=y=>t.unref(dt)(n.validation,"width")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"configuratorParams.length",label:`Длина, ${n.settings.minLength?" от "+n.settings.minLength:""}${n.settings.maxLength?" до "+n.settings.maxLength:""} мм`},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[g[3]||(g[3]=y=>l.value.configuratorParams.length=y),u],placeholder:"Введите длину",parse:t.unref(ht),"show-button":!1,class:"w-full",onKeydown:g[4]||(g[4]=y=>t.unref(ft)(y)),onInput:g[5]||(g[5]=y=>t.unref(dt)(n.validation,"length")),onFocus:t.unref(He)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),t.createVNode(t.unref(I.NFormItem),{path:"quantity",label:"Количество"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:n.value.quantity,placeholder:"Введите количество",min:1,"show-button":!1,class:"w-full",onKeydown:g[6]||(g[6]=y=>t.unref(ft)(y,!1)),onInput:g[7]||(g[7]=y=>t.unref(dt)(n.validation,"quantity")),"onUpdate:value":g[8]||(g[8]=y=>f("quantity",y??0)),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1}),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:n.value.marker??null,placeholder:"Введите маркировку",onInput:g[9]||(g[9]=y=>t.unref(dt)(n.validation,"marker")),"onUpdate:value":g[10]||(g[10]=y=>f("marker",y??null)),onFocus:t.unref(He)},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(Fr,{"is-product-searching":n.isProductSearching,product:n.value.product,validation:n.validation.product},null,8,["is-product-searching","product","validation"]),t.createElementVNode("div",Xb,[t.createVNode(t.unref(I.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(ai),()=>o("submit",l.value)]])}}}),Ub={class:"flex flex-col gap-2 w-72"},Kb={},ju=t.defineComponent({...Kb,__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=V.debounce(async h=>{var p,m;s.value.product=new W.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(V.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(V.noop)};return t.watch(()=>i.cartItem,h=>{s.value=new W.OrderItemBase(h)},{deep:!0}),(h,p)=>{const m=I.NButton;return t.openBlock(),t.createElementBlock("div",Ub,[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(Wu,{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"])])}}}),Gb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Zb(n,e){return t.openBlock(),t.createElementBlock("svg",Gb,[...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 qu=t.markRaw({name:"ion-add",render:Zb}),Qb={key:0,class:"-mt-1 text-sm text-gray-500"},Jb={class:"font-bold"},e_={class:"flex flex-col gap-3"},t_={key:0,class:"mt-4 flex flex-col gap-1.5"},n_={class:"flex flex-col gap-1 text-sm text-gray-700"},i_={key:0},r_={key:1},o_={"form-array-name":"items",class:"flex flex-col gap-3"},s_={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},a_={key:0,class:"flex flex-wrap items-end gap-2"},l_={class:"whitespace-nowrap text-xl font-bold"},c_={key:0,class:"whitespace-nowrap text-lg text-gray-500"},d_={class:"font-bold"},u_={class:"font-bold"},f_={class:"flex gap-3"},h_={},Xu=t.defineComponent({...h_,__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 Y;const r=n,o=i,s=t.useTemplateRef("form-reference"),a=t.ref(V.cloneDeep(r.value)),l=t.ref({...r.validation}),c=H=>{var T;delete l.value[H],(T=s.value)==null||T.restoreValidation()};t.watch(()=>r.validation,H=>{l.value={...H},Object.values(H).some(D=>D==null?void 0:D.feedback)&&t.nextTick(()=>{var D;return(D=s.value)==null?void 0:D.validate(V.noop).catch(V.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(H=>({label:H.name,value:H.id}))),m=(H,T,D)=>{const K=H!=null&&H>0,J=T!=null&&T>0;return!K&&!J?null:K&&J?`от ${H} ${D} до ${T} ${D}`:K?`от ${H} ${D}`:`до ${T} ${D}`},g=t.computed(()=>{var H,T;return m(r.settings.minWidth,(T=(H=u.value)==null?void 0:H.properties)==null?void 0:T.width,"мм")}),b=t.computed(()=>{var H,T;return m(r.settings.minLength,(T=(H=u.value)==null?void 0:H.properties)==null?void 0:T.length,"мм")}),y=t.ref(null),_=t.ref(!1),x=t.computed(()=>{var T;const H={marker:[We.serverValidation((T=l.value.marker)==null?void 0:T.feedback)]};return a.value.configuratorParams.items.forEach((D,K)=>{var J,U,q,L,le,ue,oe;H[`configuratorParams.items.${K}.width`]=[ce.required,ce.min(r.settings.minWidth),...(U=(J=u.value)==null?void 0:J.properties)!=null&&U.width?[ce.max(u.value.properties.width)]:[],ce.step(1),We.serverValidation((q=l.value[`items.${K}.width`])==null?void 0:q.feedback)],H[`configuratorParams.items.${K}.length`]=[ce.required,ce.min(r.settings.minLength),...(le=(L=u.value)==null?void 0:L.properties)!=null&&le.length?[ce.max(u.value.properties.length)]:[],ce.step(1),We.serverValidation((ue=l.value[`items.${K}.length`])==null?void 0:ue.feedback)],H[`configuratorParams.items.${K}.count`]=[ce.required,ce.min(1),ce.step(1),We.serverValidation((oe=l.value[`items.${K}.count`])==null?void 0:oe.feedback)]}),H}),w=t.ref(r.settings.canSetDopProdaga??!1),C=t.computed(()=>a.value.configuratorParams.items.some(H=>{var T,D;return!u.value||!H.width||H.width<r.settings.minWidth||H.width>(((T=u.value.properties)==null?void 0:T.width)??0)||H.length===0||H.length<r.settings.minLength||H.length>(((D=u.value.properties)==null?void 0:D.length)??0)||!H.count||H.count<1})),N=t.computed(()=>!u.value||C.value||a.value.configuratorParams.items.length===0),k=t.ref(null),$=t.computed(()=>k.value===null?"":Ve.formatMoney(k.value)),v=H=>{if(!H){u.value=null,f.value=null,a.value.product=new W.ClientProduct,y.value=null;return}const T=h.value.find(D=>D.id===H);T&&(u.value=T,f.value=H,a.value.product=T,O("product",a.value.product),a.value.configuratorParams.items.forEach(D=>{var K,J;(K=T.properties)!=null&&K.width&&D.width>T.properties.width&&(D.width=T.properties.width),(J=T.properties)!=null&&J.length&&D.length>T.properties.length&&(D.length=T.properties.length)}),P())};let E=!1;const P=()=>{E=!0,y.value=null,k.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},F=async()=>{var H;if(!u.value||a.value.configuratorParams.items.length===0||C.value){P();return}(H=s.value)==null||H.validate(T=>{if(T){P();return}if(_.value=!0,!u.value||!d.value){P(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:D=>{D?(y.value=D,a.value.configuratorParams.calculationId=D.id,a.value.quantity=D.quantity,t.nextTick(()=>{O("quantity",D.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,P()),O("configuratorParams",a.value.configuratorParams),R(),_.value=!1}})}).catch(()=>{P(),_.value=!1})},R=()=>{var T;if(!((T=u.value)!=null&&T.costRub)||!y.value){k.value=null;return}const H=y.value.quantity*u.value.costRub;k.value=Ve.roundMoney(H)},M=H=>{var D,K;const T=a.value.configuratorParams.items[H];u.value&&((D=u.value.properties)!=null&&D.width&&T.width>u.value.properties.width&&(T.width=u.value.properties.width),(K=u.value.properties)!=null&&K.length&&T.length>u.value.properties.length&&(T.length=u.value.properties.length)),O("configuratorParams",a.value.configuratorParams),P()},X=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),O("configuratorParams",a.value.configuratorParams),P(),o("add-item",a.value.configuratorParams.items.length)},G=H=>{a.value.configuratorParams.items.splice(H,1),O("configuratorParams",a.value.configuratorParams),P(),o("remove-item",H)},Z=()=>{if(!(N.value||_.value||r.isSubmitProcessing)){if(!y.value){F();return}o("submit",a.value)}},O=(H,T)=>{const D=new W.OrderItemBase(r.value);D[H]=T,o("update:value",D)};t.watch(()=>r.value,H=>{const T=V.cloneDeep(t.toRaw(H));(!T.configuratorParams.items||T.configuratorParams.items.length===0)&&(T.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=T,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),E?E=!1:A()},{deep:!0});const A=()=>{const{calculationId:H}=a.value.configuratorParams,T=a.value.quantity??0;H&&T>0&&a.value.product&&!a.value.product.isNewRec()&&(y.value={id:H,quantity:T,sheets:[]},R())};return t.onMounted(()=>{r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),A()}),e({validate:(Y=s.value)==null?void 0:Y.validate,formReference:s}),(H,T)=>{const D=yo,K=qu;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:a.value,rules:x.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var J;return[t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:f.value,"onUpdate:value":[T[0]||(T[0]=U=>f.value=U),v],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((J=u.value)==null?void 0:J.costRub)!=null?(t.openBlock(),t.createElementBlock("div",Qb,[t.createElementVNode("span",Jb,t.toDisplayString(u.value.code),1),t.createTextVNode(" — "+t.toDisplayString(t.unref(Ve).formatMoney(u.value.costRub))+" "+t.toDisplayString(u.value.currency.symbol)+"/шт. ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",e_,[u.value?(t.openBlock(),t.createElementBlock("div",t_,[T[7]||(T[7]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",n_,[g.value?(t.openBlock(),t.createElementBlock("div",i_,"Ширина "+t.toDisplayString(g.value)+".",1)):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createElementBlock("div",r_,"Длина "+t.toDisplayString(b.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",o_,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value.configuratorParams.items,(U,q)=>(t.openBlock(),t.createElementBlock("div",{key:q,class:"flex grow gap-2"},[t.createElementVNode("div",s_,[t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.items.${q}.width`,label:"Ширина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:a.value.configuratorParams.items[q].width,"onUpdate:value":[L=>a.value.configuratorParams.items[q].width=L,L=>M(q)],parse:t.unref(ht),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:T[1]||(T[1]=L=>t.unref(ft)(L)),onInput:L=>c(`items.${q}.width`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.items.${q}.length`,label:"Длина, мм"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:a.value.configuratorParams.items[q].length,"onUpdate:value":[L=>a.value.configuratorParams.items[q].length=L,L=>M(q)],parse:t.unref(ht),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:T[2]||(T[2]=L=>t.unref(ft)(L)),onInput:L=>c(`items.${q}.length`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`configuratorParams.items.${q}.count`,label:"Количество, шт"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:a.value.configuratorParams.items[q].count,"onUpdate:value":[L=>a.value.configuratorParams.items[q].count=L,L=>M(q)],parse:t.unref(ht),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:T[3]||(T[3]=L=>t.unref(ft)(L,!1)),onInput:L=>c(`items.${q}.count`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createVNode(t.unref(I.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:L=>G(q)},{default:t.withCtx(()=>[t.createVNode(D)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:1,disabled:C.value,type:"default",class:"self-center",onClick:X},{default:t.withCtx(()=>[t.createVNode(K),T[8]||(T[8]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0)]),t.createVNode(t.unref(I.NFormItem),{path:"marker",label:"Маркировка распила"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:a.value.marker??null,disabled:!u.value,placeholder:"Введите маркировку распила",onInput:T[4]||(T[4]=U=>c("marker")),"onUpdate:value":T[5]||(T[5]=U=>O("marker",U??null)),onFocus:t.unref(He)},null,8,["value","disabled","onFocus"])]),_:1}),w.value?(t.openBlock(),t.createBlock(t.unref(I.NCheckbox),{key:1,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":T[6]||(T[6]=U=>{a.value.isAdditionalSale=U??!1,O("isAdditionalSale",U??!1)})},{default:t.withCtx(()=>[...T[9]||(T[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createVNode(t.unref(I.NSpin),{show:_.value,size:"small",class:"grow"},{default:t.withCtx(()=>[y.value&&u.value&&k.value?(t.openBlock(),t.createElementBlock("div",a_,[t.createElementVNode("div",null,[T[10]||(T[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",l_,t.toDisplayString($.value)+" "+t.toDisplayString(u.value.currency.symbol),1)]),y.value.quantity&&u.value?(t.openBlock(),t.createElementBlock("div",c_,[t.createElementVNode("span",d_,"("+t.toDisplayString(y.value.quantity)+" шт.",1),T[11]||(T[11]=t.createTextVNode(" x ",-1)),t.createElementVNode("span",u_,t.toDisplayString(t.unref(Ve).formatMoney(u.value.costRub))+" "+t.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),_:1},8,["show"]),t.createElementVNode("div",f_,[y.value&&!_.value?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,loading:n.isSubmitProcessing,disabled:N.value||_.value,type:"primary",class:"self-start",onClick:Z},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(a.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])):(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:1,loading:_.value,disabled:N.value||_.value,type:"info",class:"self-start",onClick:F},{default:t.withCtx(()=>[...T[12]||(T[12]=[t.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules"])),[[t.unref(ai),Z]])}}}),m_={class:"flex flex-col gap-2"},p_={class:"w-104 flex grow flex-col px-5"},g_={},Yu=t.defineComponent({...g_,__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=V.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(V.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 W.OrderItemBase(f)},{deep:!0}),(f,h)=>{const p=I.NButton;return t.openBlock(),t.createElementBlock("div",m_,[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",p_,[t.createVNode(Xu,{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"])])])}}}),y_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function b_(n,e){return t.openBlock(),t.createElementBlock("svg",y_,[...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 __=t.markRaw({name:"ion-checkmark",render:b_}),w_={key:0,class:"-mt-1 text-sm text-gray-500"},x_={class:"font-bold"},k_={class:"flex flex-col gap-3"},C_={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},v_={class:"flex flex-col gap-1 text-sm text-gray-700"},S_={key:0},B_={key:1},N_={"form-array-name":"items",class:"flex flex-col gap-3"},T_={class:"min-w-0 flex-1"},$_={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},E_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},R_={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},P_={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},F_={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},V_={key:0,class:"lg:!flex-[2]"},M_={class:"font-bold"},I_={key:1,class:"lg:!flex-[3]"},A_={class:"font-bold"},O_={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"},z_={key:0},D_={class:"font-bold"},L_={key:1},H_={class:"font-bold"},W_={class:"flex flex-wrap items-center gap-3"},j_={},Uu=t.defineComponent({...j_,__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?[]:V.cloneDeep(t.toRaw(r.value)),c=t.ref(l.map(U=>new W.OrderItemBase(U))),d=t.computed(()=>({items:c.value})),u=t.ref({...r.validation}),f=U=>{var q;delete u.value[U],(q=s.value)==null||q.restoreValidation()},h=t.ref(null),p=t.ref(null),m=t.computed(()=>{var U,q;return((q=(U=c.value[0])==null?void 0:U.category)==null?void 0:q.products)??[]}),g=t.computed(()=>m.value.map(U=>({label:U.name,value:U.id}))),b=(U,q,L)=>{const le=U!=null&&U>0,ue=q!=null&&q>0;return!le&&!ue?null:le&&ue?`от ${U} ${L} до ${q} ${L}`:le?`от ${U} ${L}`:`до ${q} ${L}`},y=t.computed(()=>{var U,q;return b(r.settings.minWidth,(q=(U=h.value)==null?void 0:U.properties)==null?void 0:q.width,"мм")}),_=t.computed(()=>{var U,q;return b(r.settings.minLength,(q=(U=h.value)==null?void 0:U.properties)==null?void 0:q.length,"мм")}),x=t.computed(()=>{const U={};return c.value.forEach((q,L)=>{var le,ue,oe,fe,ge,_e,Qe,Re;U[`items.${L}.configuratorParams.width`]=[ce.required,ce.min(r.settings.minWidth),...(ue=(le=h.value)==null?void 0:le.properties)!=null&&ue.width?[ce.max(h.value.properties.width)]:[],ce.step(1),We.serverValidation((oe=u.value[`items.${L}.width`])==null?void 0:oe.feedback)],U[`items.${L}.configuratorParams.length`]=[ce.required,ce.min(r.settings.minLength),...(ge=(fe=h.value)==null?void 0:fe.properties)!=null&&ge.length?[ce.max(h.value.properties.length)]:[],ce.step(1),We.serverValidation((_e=u.value[`items.${L}.length`])==null?void 0:_e.feedback)],U[`items.${L}.quantity`]=[ce.required,ce.min(1),ce.step(1),We.serverValidation((Qe=u.value[`items.${L}.quantity`])==null?void 0:Qe.feedback)],U[`items.${L}.marker`]=[We.serverValidation((Re=u.value[`items.${L}.marker`])==null?void 0:Re.feedback)]}),U});t.watch(()=>r.validation,U=>{u.value={...U},Object.values(U).some(L=>L==null?void 0:L.feedback)&&t.nextTick(()=>{var L;return(L=s.value)==null?void 0:L.validate(V.noop).catch(V.noop)})},{deep:!0});const w=t.ref(r.settings.canSetDopProdaga??!1),C=t.computed(()=>{const U=h.value;return U?c.value.some(q=>{var oe,fe;const L=q.configuratorParams,le=(oe=U.properties)==null?void 0:oe.width,ue=(fe=U.properties)==null?void 0:fe.length;return L.width===0||L.width<r.settings.minWidth||le!=null&&L.width>le||L.length===0||L.length<r.settings.minLength||ue!=null&&L.length>ue||q.quantity===0||q.quantity<1}):!0}),N=t.computed(()=>!h.value||C.value||c.value.length===0),k=t.computed(()=>{const U=c.value[0];return U!=null&&!U.isNewRec()}),$=U=>r.itemStates[U]??"idle",v=U=>$(U)==="success",E=U=>$(U)==="loading",P=t.computed(()=>c.value.length===0?!0:c.value.every((U,q)=>{const L=$(q);return L==="success"||L==="loading"})),F=U=>U.width===0||U.length===0?0:U.width*U.length/1e6,R=U=>Ve.formatArea(F(U)),M=U=>{var oe;const q=U.configuratorParams,L=F(q),le=((oe=h.value)==null?void 0:oe.costRub)??0,ue=U.quantity??0;return!L||!ue?0:Ve.roundMoney(L*le*ue)},X=t.computed(()=>V.sum(c.value.map(U=>{const q=U.configuratorParams;return!q.width||q.length===0||!U.quantity?0:q.width*q.length*U.quantity/1e6}))),G=t.computed(()=>Ve.roundMoney(V.sum(c.value.map(U=>M(U))))),Z=()=>{var U,q,L;return new W.OrderItemBase({category:(U=c.value[0])==null?void 0:U.category,configurator:(q=c.value[0])==null?void 0:q.configurator,product:h.value??new W.ClientProduct,quantity:1,isAdditionalSale:(L=c.value[0])==null?void 0:L.isAdditionalSale,configuratorParams:{width:0,length:0}})},O=U=>{if(!U){h.value=null,p.value=null,c.value.forEach(L=>{L.product=new W.ClientProduct}),o("update:value",c.value);return}const q=m.value.find(L=>L.id===U);q&&(h.value=q,p.value=U,c.value.forEach((L,le)=>{var ue,oe;L.product=q,(ue=q.properties)!=null&&ue.width&&L.configuratorParams.width>q.properties.width&&(L.configuratorParams.width=q.properties.width),(oe=q.properties)!=null&&oe.length&&L.configuratorParams.length>q.properties.length&&(L.configuratorParams.length=q.properties.length),o("item-reset",le)}),o("update:value",c.value))},A=U=>{var le,ue;const q=c.value[U],L=h.value;L&&((le=L.properties)!=null&&le.width&&q.configuratorParams.width>L.properties.width&&(q.configuratorParams.width=L.properties.width),(ue=L.properties)!=null&&ue.length&&q.configuratorParams.length>L.properties.length&&(q.configuratorParams.length=L.properties.length)),o("item-reset",U),o("update:value",c.value)},Y=(U,q)=>{c.value[U].marker=q===null||q===""?void 0:q,o("item-reset",U),o("update:value",c.value)},H=U=>{c.value.forEach(q=>{q.isAdditionalSale=U}),o("update:value",c.value)},T=()=>{c.value.push(Z()),o("update:value",c.value),o("add-item",c.value.length),t.nextTick(()=>{var q,L,le,ue;const U=c.value.length-1;(L=(q=a.value)==null?void 0:q[U])==null||L.focus(),(ue=(le=a.value)==null?void 0:le[U])==null||ue.select()})},D=U=>{c.value.splice(U,1),o("update:value",c.value),o("remove-item",U)};t.watch(()=>r.value,U=>{var ue;const L=(U==null?[]:V.cloneDeep(t.toRaw(U))).map(oe=>new W.OrderItemBase(oe));c.value=L.length>0?L:[Z()];const le=(ue=c.value[0])==null?void 0:ue.product;le&&!le.isNewRec()?(h.value=le,p.value=le.id):(h.value=null,p.value=null)},{deep:!0});const K=()=>{var q;if(h.value!==null)return;const U=(q=m.value[0])==null?void 0:q.id;U!=null&&O(U)};return t.watch(m,()=>{K()}),t.onMounted(()=>{var q;c.value.length===0&&(c.value=[Z()]);const U=(q=c.value[0])==null?void 0:q.product;U&&!U.isNewRec()&&(h.value=U,p.value=U.id),K()}),e({validate:(J=s.value)==null?void 0:J.validate,formReference:s}),(U,q)=>{const L=__,le=yo,ue=qu;return t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{ref:"form-reference",model:d.value,rules:x.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>{var oe,fe;return[t.createVNode(t.unref(I.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NSelect),{value:p.value,"onUpdate:value":[q[0]||(q[0]=ge=>p.value=ge),O],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((oe=h.value)==null?void 0:oe.costRub)!=null?(t.openBlock(),t.createElementBlock("div",w_,[t.createElementVNode("span",x_,t.toDisplayString(h.value.code),1),t.createTextVNode(" — "+t.toDisplayString(t.unref(Ve).formatMoney(h.value.costRub))+" "+t.toDisplayString(h.value.currency.symbol)+"/м² ",1)])):t.createCommentVNode("",!0),t.createElementVNode("div",k_,[h.value?(t.openBlock(),t.createElementBlock("div",C_,[q[6]||(q[6]=t.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),t.createElementVNode("div",v_,[y.value?(t.openBlock(),t.createElementBlock("div",S_,"Ширина "+t.toDisplayString(y.value)+".",1)):t.createCommentVNode("",!0),_.value?(t.openBlock(),t.createElementBlock("div",B_,"Длина "+t.toDisplayString(_.value)+".",1)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0),t.createElementVNode("div",N_,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value.items,(ge,_e)=>{var Qe;return t.openBlock(),t.createElementBlock("div",{key:_e,class:t.normalizeClass(["flex min-w-0 items-start gap-2 border-b border-gray-100 last:border-0",v(_e)?"opacity-70":""])},[t.createElementVNode("div",T_,[t.createElementVNode("div",$_,[t.createElementVNode("div",E_,[t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.configuratorParams.width`,label:"Ширина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{ref_for:!0,ref:"widthInputs",value:d.value.items[_e].configuratorParams.width,"onUpdate:value":[Re=>d.value.items[_e].configuratorParams.width=Re,Re=>A(_e)],parse:t.unref(ht),"show-button":!1,disabled:!h.value||v(_e)||E(_e),placeholder:"Ширина",class:"w-full",onKeydown:q[1]||(q[1]=Re=>t.unref(ft)(Re)),onInput:Re=>f(`items.${_e}.width`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:d.value.items[_e].configuratorParams.length,"onUpdate:value":[Re=>d.value.items[_e].configuratorParams.length=Re,Re=>A(_e)],parse:t.unref(ht),"show-button":!1,disabled:!h.value||v(_e)||E(_e),placeholder:"Длина",class:"w-full",onKeydown:q[2]||(q[2]=Re=>t.unref(ft)(Re)),onInput:Re=>f(`items.${_e}.length`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),t.createElementVNode("div",R_,[t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:d.value.items[_e].quantity,"onUpdate:value":[Re=>d.value.items[_e].quantity=Re,Re=>A(_e)],parse:t.unref(ht),"show-button":!1,disabled:!h.value||v(_e)||E(_e),placeholder:"Кол-во",class:"w-full",onKeydown:q[3]||(q[3]=Re=>t.unref(ft)(Re,!1)),onInput:Re=>f(`items.${_e}.quantity`),onFocus:t.unref(He)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),t.createVNode(t.unref(I.NFormItem),{path:`items.${_e}.marker`,label:"Маркировка",class:"min-w-0"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:d.value.items[_e].marker??null,disabled:!h.value||v(_e)||E(_e),placeholder:"Маркировка",class:"w-full",onInput:Re=>f(`items.${_e}.marker`),"onUpdate:value":Re=>Y(_e,Re??null),onFocus:t.unref(He)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),E(_e)||v(_e)?(t.openBlock(),t.createElementBlock("div",P_,[E(_e)?(t.openBlock(),t.createBlock(t.unref(I.NSpin),{key:0,size:14})):v(_e)?(t.openBlock(),t.createBlock(L,{key:1,class:"text-green-600 text-xl"})):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),t.createElementVNode("div",F_,[ge.configuratorParams.width>0&&ge.configuratorParams.length>0?(t.openBlock(),t.createElementBlock("div",V_,[q[7]||(q[7]=t.createTextVNode(" Площадь (S) = ",-1)),t.createElementVNode("span",M_,t.toDisplayString(R(ge.configuratorParams))+" м²",1)])):t.createCommentVNode("",!0),M(ge)>0?(t.openBlock(),t.createElementBlock("div",I_,[q[8]||(q[8]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",A_,t.toDisplayString(t.unref(Ve).formatMoney(M(ge)))+" "+t.toDisplayString((Qe=h.value)==null?void 0:Qe.currency.symbol),1)])):t.createCommentVNode("",!0)])]),k.value?t.createCommentVNode("",!0):(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,disabled:E(_e)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:Re=>D(_e)},{default:t.withCtx(()=>[t.createVNode(le)]),_:1},8,["disabled","onClick"]))],2)}),128))]),h.value?(t.openBlock(),t.createElementBlock("div",O_,[X.value>0?(t.openBlock(),t.createElementBlock("div",z_,[q[9]||(q[9]=t.createTextVNode(" Общая площадь: ",-1)),t.createElementVNode("span",D_,t.toDisplayString(t.unref(Ve).formatArea(X.value))+" м²",1)])):t.createCommentVNode("",!0),G.value>0?(t.openBlock(),t.createElementBlock("div",L_,[q[10]||(q[10]=t.createTextVNode(" Итого: ",-1)),t.createElementVNode("span",H_,t.toDisplayString(t.unref(Ve).formatMoney(G.value))+" "+t.toDisplayString(h.value.currency.symbol),1)])):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)]),w.value?(t.openBlock(),t.createBlock(t.unref(I.NCheckbox),{key:1,checked:((fe=c.value[0])==null?void 0:fe.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":q[4]||(q[4]=ge=>H(ge??!1))},{default:t.withCtx(()=>[...q[11]||(q[11]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0),t.createElementVNode("div",W_,[h.value&&!k.value?(t.openBlock(),t.createBlock(t.unref(I.NButton),{key:0,disabled:C.value,type:"default",onClick:T},{default:t.withCtx(()=>[t.createVNode(ue),q[12]||(q[12]=t.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),t.createVNode(t.unref(I.NButton),{loading:n.isSubmitProcessing,disabled:N.value||P.value,type:"primary",class:"ml-auto",onClick:q[5]||(q[5]=ge=>o("submit",c.value))},{default:t.withCtx(()=>{var ge;return[t.createTextVNode(t.toDisplayString((ge=c.value[0])!=null&&ge.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[t.unref(ai),()=>o("submit",c.value)]])}}}),q_={class:"flex flex-col gap-2"},X_={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},Y_={},Ku=t.defineComponent({...Y_,__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(x=>new W.OrderItemBase(x))),a=t.ref([]),l=t.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=x=>{c.forEach(w=>{l.value[`items.${x}.${w}`]={}})},u=x=>{c.forEach(w=>{delete l.value[`items.${x}.${w}`]})},f=t.computed(()=>a.value.includes("loading")),h=()=>({width:{},length:{},quantity:{},marker:{}}),p=(x,w)=>{let C=!1;return c.forEach(N=>{var F,R;const k=`items.0.${N}`,$=(F=x[N])==null?void 0:F.feedback,E=((R=x[k])==null?void 0:R.feedback)??$,P=`items.${w}.${N}`;E?(l.value[P]=x[k]??x[N],C=!0):l.value[P]={}}),C},m=(x,w,C)=>new Promise(N=>{const k=h();let $=!1;const v=E=>{if($)return;$=!0;const P=p(k,w),F=(E===void 0?!P:E)&&!P;a.value[w]=F?"success":"error",t.nextTick(()=>{var R,M;(M=(R=o.value)==null?void 0:R.formReference)==null||M.restoreValidation()}),N(F)};a.value[w]="loading",r("submit",[V.cloneDeep(x)],k,v,{isFinalSuccessfulCompletion:C})}),g=async()=>{var C,N;try{await((N=(C=o.value)==null?void 0:C.formReference)==null?void 0:N.validate())}catch{return}const x=s.value.map((k,$)=>$).filter(k=>{const $=a.value[k]??"idle";return $!=="success"&&$!=="loading"});let w=!0;for(let k=0;k<x.length;k+=1){const $=x[k],v=s.value[$];if(!v)break;const P=k===x.length-1&&w;await m(v,$,P)||(w=!1)}},b=x=>{const w=x-1;a.value[w]="idle",d(w)},y=x=>{a.value.splice(x,1),u(x);for(let w=x;w<s.value.length;w+=1)d(w)},_=x=>{const w=a.value[x];(w==="success"||w==="error")&&(a.value[x]="idle")};return t.onMounted(()=>{(i.cartItems??[]).forEach((x,w)=>{a.value[w]="idle",d(w)})}),t.watch(()=>i.cartItems,x=>{const w=(x??[]).map(C=>new W.OrderItemBase(C));s.value=w,a.value=w.map(()=>"idle"),w.forEach((C,N)=>{d(N)})},{deep:!0}),(x,w)=>{var N;const C=I.NButton;return t.openBlock(),t.createElementBlock("div",q_,[n.settings.allowShowTable&&((N=s.value[0])!=null&&N.isNewRec())?(t.openBlock(),t.createBlock(C,{key:0,type:"tertiary",class:"self-center",onClick:w[0]||(w[0]=k=>r("click:view-switch"))},{default:t.withCtx(()=>[...w[2]||(w[2]=[t.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createElementVNode("div",X_,[t.createVNode(Uu,{ref:"sandwich-m2-configurator-form",value:s.value,"onUpdate:value":w[1]||(w[1]=k=>s.value=k),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"])])])}}}),U_={key:0,class:"flex justify-center p-4"},K_={key:1,class:"p-4 text-center text-red-500"},G_={key:2,class:"flex justify-center"},Z_={class:"!bg-white p-4 m-2 rounded-md w-max"},Q_={key:3,class:"p-4 text-center text-gray-500"},J_={},Gu=t.defineComponent({...J_,__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 W.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===W.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 W.OrderItemBase({...h,configuratorParams:{length:b.stripMinLength,linesAngles:[],linesWidths:[],startTailType:V.some(b.startTailConfigs,y=>y.isDefault)?(m=b.startTailConfigs)==null?void 0:m.findIndex(y=>y.isDefault):void 0,endTailType:V.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 W.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 W.OrderItemBase({...h,length:b.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const b=e.settings;o.value=new W.OrderItemBase({...h,configuratorParams:{width:b.minWidth,length:b.minLength}});break}case"sandwich":{o.value=new W.OrderItemBase({...h,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new W.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,_=x=>{m==null||m(x),y&&x&&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=I.NSpin;return t.openBlock(),t.createElementBlock(t.Fragment,null,[i.value?(t.openBlock(),t.createElementBlock("div",U_,[t.createVNode(m,{size:"large"})])):r.value?(t.openBlock(),t.createElementBlock("div",K_,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",G_,[t.createElementVNode("div",Z_,[n.editor==="kozyrek"?(t.openBlock(),t.createBlock(Mu,{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(Ou,{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(Hu,{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(ju,{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(Yu,{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(Ku,{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 Zu(n){return Object.values(W.ConfiguratorsEnum).includes(n)}function Qu(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==W.ConfiguratorsEnum.Sandwich?!0:n.properties.configuratorSettings!==void 0&&V.isArray(n.products)&&n.products.length>0}const ew={key:0,class:"pt-0.5"},tw={key:0},nw={key:1},iw={class:"flex flex-row gap-1"},rw={key:0},ow={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},sw={class:"flex flex-col gap-2.5 sm:flex-row"},aw={key:0,class:"header-extra"},lw={class:"inline-flex"},cw={class:"inline-flex"},dw={class:"inline-flex"},uw={class:"mt-2"},fw={key:1,class:"flex flex-col"},hw={},mw=t.defineComponent({...hw,__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(Rr,"medium"),r=uo(),o=t.computed(()=>{var oe;return(oe=e==null?void 0:e.filteredItems)==null?void 0:oe[e.categoryItem.id]}),s=t.computed(()=>{var oe,fe;return V.isArray((oe=e.categoryItem)==null?void 0:oe.categories)&&((fe=e.categoryItem.categories)==null?void 0:fe.length)>0}),a=t.computed(()=>{var oe;return V.isArray((oe=e.categoryItem)==null?void 0:oe.products)?e.categoryItem.products:[]}),l=t.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([oe,fe])=>`${fe} руб./${O(oe)}`).join(", ")),c=t.computed(()=>V.isUndefined(e.filteredItems)||o.value==="*"?a.value:a.value.filter(oe=>{var ge;const fe=(ge=o.value)==null?void 0:ge.products;return V.isArray(fe)&&fe.includes(oe.id)})),d=t.computed(()=>c.value.length>0),u=t.computed(()=>V.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),f=t.computed(()=>V.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),h=t.computed(()=>V.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),p=t.computed(()=>{var ge,_e;const oe=(ge=w.value)==null?void 0:ge.hidingComment,fe=(_e=w.value)!=null&&_e.isDisabled?`Скрыто для клиента${oe?`. Причина: '${oe}'`:""}`:"Видимо клиенту";return u.value==="disabled"?`${fe}. ${Nr}`:fe}),m=t.computed(()=>{var ge;const oe=(ge=w.value)==null?void 0:ge.manager,fe=oe?`Категория закреплена за "${oe.name??"-"}"`:"Закрепить";return f.value==="disabled"?`${fe}. ${Nr}`:fe}),g=t.computed(()=>h.value==="disabled"?`${$s}. ${Nr}`:$s),b=t.computed(()=>V.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),y=t.computed(()=>{var oe,fe,ge;return((oe=e.categoryItem.properties)==null?void 0:oe.configurator)!==void 0&&Zu((fe=e.categoryItem.properties)==null?void 0:fe.configurator)&&Qu(e.categoryItem)&&((ge=e.categoryItem.properties)==null?void 0:ge.configuratorSettings)!==void 0&&(V.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),_=t.computed(()=>y.value&&(V.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),x=t.computed(()=>V.isNil(e.categoryContextButtonsConfig)?[]:V.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),w=t.computed(()=>new W.ClientCategory(e.categoryItem)),C=t.ref(!1),N=t.ref(!1),k=t.computed(()=>!V.isUndefined(e.isCategoryItemSelected)),$=t.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),v=t.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),E=t.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),P=t.computed(()=>L.value&&Ue.getDeviceTypeByResolution()===Xe.laptop?"auto":"fixed"),F=t.useTemplateRef("collapse-item-reference"),R=t.computed(()=>{var oe,fe;return(fe=(oe=e.categoryItem.properties)==null?void 0:oe.templateCost)==null?void 0:fe.priceCoefficient}),M=t.computed(()=>{var oe,fe;return(fe=(oe=e.categoryItem.properties)==null?void 0:oe.templateCost)==null?void 0:fe.increasePercent}),X=t.computed(()=>vi.isM2Category(e.categoryItem)?vi.findReferenceProduct(e.categoryItem):void 0),G=t.computed(()=>X.value?vi.calculateM2Cost(X.value,R.value,M.value):void 0),Z=t.computed(()=>{var oe,fe;return`${((fe=(oe=X.value)==null?void 0:oe.currency)==null?void 0:fe.symbol)??""}/м²`}),O=(oe,fe="ru-RU")=>0 .toLocaleString(fe,{style:"currency",currency:oe,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),A=oe=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:oe,target:F.value})},Y=(oe,fe)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:fe,isLoadingState:C,target:F.value})},H=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:F.value})},T=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:F.value})},D=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:F.value})},K=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:F.value})},J=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:F.value})},U=oe=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:oe,target:F.value})},q=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},L=t.ref(0),le=t.computed(()=>L.value&&a.value.length>0?oy(a.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}):[]),ue=V.debounce(()=>{L.value=window.innerWidth},20);return t.onUnmounted(()=>{window.removeEventListener("resize",ue),ue.cancel()}),window.addEventListener("resize",ue),ue(),(oe,fe)=>{const ge=I.NCheckbox,_e=bp,Qe=I.NTooltip,Re=pp,Mt=I.NTag,vn=fp,It=cp,en=I.NButton,Ln=sp,mn=ic,_t=nc,ae=tc,de=Ms,Ge=I.NDropdown,Ui=I.NDataTable,oi=I.NAlert,si=I.NSpin;return t.openBlock(),t.createBlock(rc,{ref:"collapse-item-reference",name:n.categoryItem.id,"data-id":n.categoryItem.id,"onHeader:click":Y},{"pre-arrow":t.withCtx(()=>{var at,qe;return[k.value?(t.openBlock(),t.createElementBlock("div",ew,[t.createVNode(ge,{checked:$.value,indeterminate:E.value,disabled:v.value,"onUpdate:checked":A},null,8,["checked","indeterminate","disabled"])])):t.createCommentVNode("",!0),!u.value&&((at=w.value)!=null&&at.isDisabled)?(t.openBlock(),t.createBlock(Qe,{key:1,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(_e,{class:"pt-1.5"})]),default:t.withCtx(()=>[fe[1]||(fe[1]=t.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):t.createCommentVNode("",!0),((qe=w.value)==null?void 0:qe.isFavorite)??!1?(t.openBlock(),t.createBlock(Qe,{key:2,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(Re,{class:"pt-1.5"})]),default:t.withCtx(()=>[fe[2]||(fe[2]=t.createTextVNode(" Избранная категория ",-1))]),_:1})):t.createCommentVNode("",!0)]}),header:t.withCtx(()=>{var at,qe,on,sn;return[t.createElementVNode("div",{class:t.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":n.categoryItem.isHidden,"text-gray-400":(at=w.value)==null?void 0:at.isDisabled})},[t.createVNode(Qe,{disabled:!n.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>[t.createElementVNode("span",null,t.toDisplayString(n.categoryItem.name),1)]),default:t.withCtx(()=>[fe[3]||(fe[3]=t.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),t.createElementVNode("div",{class:"w-fit",onClick:fe[0]||(fe[0]=t.withModifiers((...lt)=>t.unref(V.noop)&&t.unref(V.noop)(...lt),["prevent","stop"]))},[(qe=n.categoryItem.properties)!=null&&qe.templateCost?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[R.value||M.value||!t.unref(V.isNil)(G.value)?(t.openBlock(),t.createBlock(Mt,{key:0,size:t.unref(i),round:""},{default:t.withCtx(()=>{var lt;return[R.value?(t.openBlock(),t.createElementBlock("span",tw,t.toDisplayString((lt=R.value)==null?void 0:lt.name),1)):t.createCommentVNode("",!0),M.value?(t.openBlock(),t.createElementBlock("span",nw,t.toDisplayString(M.value>0?"+":"")+t.toDisplayString(t.unref(Ve).formatPercent(M.value))+"%",1)):t.createCommentVNode("",!0),t.unref(V.isNil)(G.value)?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",{key:2,class:t.normalizeClass({"ml-1":R.value||M.value})},t.toDisplayString(G.value.toFixed(2))+" "+t.toDisplayString(Z.value),3))]}),_:1},8,["size"])):t.createCommentVNode("",!0)],64)):(on=n.categoryItem.properties)!=null&&on.m2Price?(t.openBlock(),t.createBlock(Mt,{key:1,size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createTextVNode(" Установленная стоимость: "+t.toDisplayString(n.categoryItem.properties.m2Price)+" руб./м2 ",1)]),_:1},8,["size"])):t.createCommentVNode("",!0),l.value?(t.openBlock(),t.createBlock(Mt,{key:2,size:t.unref(i),round:""},{default:t.withCtx(()=>[t.createTextVNode(" Фиксированный курс: "+t.toDisplayString(l.value),1)]),_:1},8,["size"])):t.createCommentVNode("",!0),f.value&&((sn=w.value)!=null&&sn.manager)?(t.openBlock(),t.createBlock(Mt,{key:3,size:t.unref(i),closable:f.value!=="disabled",round:"",class:"align-bottom",onClose:K},{default:t.withCtx(()=>[t.createVNode(Qe,{placement:"bottom",trigger:"hover"},{trigger:t.withCtx(()=>{var lt,jt;return[t.createElementVNode("span",iw,[t.createVNode(vn),t.createTextVNode(" "+t.toDisplayString((jt=(lt=w.value)==null?void 0:lt.manager)==null?void 0:jt.name),1)])]}),default:t.withCtx(()=>{var lt,jt;return[t.createTextVNode(' Категория закреплена за "'+t.toDisplayString((jt=(lt=w.value)==null?void 0:lt.manager)==null?void 0:jt.name)+'" ',1)]}),_:1})]),_:1},8,["size","closable"])):t.createCommentVNode("",!0)])]}),"sub-header":t.withCtx(()=>[n.showSlugs||n.showProperties?(t.openBlock(),t.createElementBlock("div",rw,[t.createElementVNode("ul",ow,[n.showSlugs?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList({id:n.categoryItem.id,slug:n.categoryItem.slug},(at,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(at),1))),128)):t.createCommentVNode("",!0),n.showProperties?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:1},t.renderList(n.categoryItem.properties,(at,qe)=>(t.openBlock(),t.createElementBlock("li",{key:qe}," ("+t.toDisplayString(qe)+"): "+t.toDisplayString(at),1))),128)):t.createCommentVNode("",!0)])])):t.createCommentVNode("",!0)]),"header-extra":t.withCtx(()=>{var at;return[t.createElementVNode("div",sw,[oe.$slots["header-extra"]?(t.openBlock(),t.createElementBlock("div",aw,[t.renderSlot(oe.$slots,"header-extra",{categoryItem:n.categoryItem},void 0,!0)])):t.createCommentVNode("",!0),u.value?(t.openBlock(),t.createBlock(Qe,{key:1,placement:"bottom",trigger:"hover",disabled:!t.unref(r)&&u.value!=="disabled"},{trigger:t.withCtx(()=>[t.createElementVNode("span",lw,[t.createVNode(en,{ghost:!0,disabled:u.value==="disabled",size:t.unref(i),onClick:H},{default:t.withCtx(()=>{var qe;return[(qe=w.value)!=null&&qe.isDisabled?(t.openBlock(),t.createBlock(_e,{key:1})):(t.openBlock(),t.createBlock(It,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(p.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),f.value&&!((at=w.value)!=null&&at.manager)?(t.openBlock(),t.createBlock(Qe,{key:2,placement:"bottom",trigger:"hover",disabled:!t.unref(r)&&f.value!=="disabled"},{trigger:t.withCtx(()=>[t.createElementVNode("span",cw,[t.createVNode(en,{ghost:!0,disabled:f.value==="disabled",size:t.unref(i),onClick:D},{default:t.withCtx(()=>[t.createVNode(Ln)]),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(m.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),h.value?(t.openBlock(),t.createBlock(Qe,{key:3,placement:"bottom",trigger:"hover",disabled:!t.unref(r)&&h.value!=="disabled"},{trigger:t.withCtx(()=>[t.createElementVNode("span",dw,[t.createVNode(en,{ghost:!0,disabled:h.value==="disabled",size:t.unref(i),onClick:T},{default:t.withCtx(()=>{var qe;return[(qe=w.value)!=null&&qe.isRequired?(t.openBlock(),t.createBlock(_t,{key:1})):(t.openBlock(),t.createBlock(mn,{key:0}))]}),_:1},8,["disabled","size"])])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(g.value),1)]),_:1},8,["disabled"])):t.createCommentVNode("",!0),b.value?(t.openBlock(),t.createBlock(Qe,{key:4,placement:"bottom",trigger:"hover",disabled:!t.unref(r)},{trigger:t.withCtx(()=>[t.createVNode(en,{ghost:!0,size:t.unref(i),type:"primary",onClick:J},{default:t.withCtx(()=>[t.createVNode(ae)]),_:1},8,["size"])]),default:t.withCtx(()=>[fe[4]||(fe[4]=t.createTextVNode(" Редактировать ",-1))]),_:1},8,["disabled"])):t.createCommentVNode("",!0),x.value.length>0?(t.openBlock(),t.createBlock(Ge,{key:5,options:x.value,size:t.unref(i),trigger:"click",onSelect:U},{default:t.withCtx(()=>[t.createVNode(en,{ghost:!0,size:t.unref(i),type:"primary"},{default:t.withCtx(()=>[t.createVNode(de)]),_:1},8,["size"])]),_:1},8,["options","size"])):t.createCommentVNode("",!0)])]}),default:t.withCtx(()=>[t.renderSlot(oe.$slots,"default",{},()=>{var at,qe,on;return[t.createElementVNode("div",uw,[s.value?(t.openBlock(),t.createBlock(ef,{key:0,"categories-items":n.categoryItem.categories??[],"has-products":d.value||C.value,"event-emitter":n.eventEmitter,"filtered-items":o.value?((at=o.value)==null?void 0:at.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},[oe.$slots["header-extra"]?{name:"header-extra",fn:t.withCtx(({categoryItem:sn})=>[t.renderSlot(oe.$slots,"header-extra",{categoryItem:sn},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)]),y.value&&_.value?(t.openBlock(),t.createBlock(Gu,{key:0,"event-emitter":n.eventEmitter,settings:(qe=n.categoryItem.properties)==null?void 0:qe.configuratorSettings,editor:(on=n.categoryItem.properties)==null?void 0:on.configurator,category:n.categoryItem},null,8,["event-emitter","settings","editor","category"])):d.value?(t.openBlock(),t.createElementBlock("div",fw,[y.value?(t.openBlock(),t.createBlock(en,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:q},{default:t.withCtx(()=>[...fe[5]||(fe[5]=[t.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):t.createCommentVNode("",!0),t.createVNode(Ui,{columns:le.value,data:c.value,bordered:!0,loading:C.value,remote:!0,"row-key":sn=>sn.id,"table-layout":P.value,class:"mt-2"},null,8,["columns","data","loading","row-key","table-layout"])])):t.createCommentVNode("",!0),!C.value&&!N.value&&!s.value&&!d.value?(t.openBlock(),t.createBlock(oi,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):t.createCommentVNode("",!0),N.value?(t.openBlock(),t.createBlock(oi,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):t.createCommentVNode("",!0),C.value?(t.openBlock(),t.createBlock(si,{key:4,size:t.unref(i),class:"w-full"},{description:t.withCtx(()=>[...fe[6]||(fe[6]=[t.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):t.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),pw=gn(mw,[["__scopeId","data-v-9ed22ab1"]]),gw={class:"sc-collapse flex w-full flex-col"},yw={},Ju=t.defineComponent({...yw,__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",gw,[t.renderSlot(s.$slots,"default")]))}}),bw={},ef=t.defineComponent({...bw,__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(Rr,"medium"),r=t.computed(()=>V.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(V.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=I.NSpin,c=I.NAlert;return t.openBlock(),t.createElementBlock(t.Fragment,null,[r.value.length>0?(t.openBlock(),t.createBlock(Ju,{key:0},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,d=>(t.openBlock(),t.createBlock(pw,{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)}}}),_w={},tf=t.defineComponent({..._w,__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(()=>V.isArray(r.value)),a=new W.Reference,l=t.computed(()=>V.isNil(r.value)?s.value?[]:null:V.isArray(r.value)?r.value.filter(m=>!V.isNil(m)).map(m=>m.id):r.value.id),c=t.computed(()=>wt.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(V.isArray(m)){const b=m.length>0?m.map(y=>{var _;return(_=c.value.find(x=>x.value===y))==null?void 0:_.item}).filter(y=>!V.isNil(y)):[];o("update:value",b)}else{const b=m===a.id||V.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(I.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"]))}}),ww={},xw=t.defineComponent({...ww,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{},m2ReferenceProduct:{},disabledCoefficient:{type:Function},visibleCoefficient:{type:Function}},emits:["update:value"],setup(n,{emit:e}){var E,P;const i=n,r=e,o=()=>{const F=W.PriceCoefficient.getRetailPriceCoefficient();return V.unset(F,"isNewRec"),F},s=F=>!F||F.id===o().id,a=t.computed(()=>{var F;return((F=i.catalogItem)==null?void 0:F.type)==="product"}),l=t.computed(()=>!a.value&&!V.isNil(i.m2ReferenceProduct)),c=t.computed(()=>a.value?i.catalogItem:i.m2ReferenceProduct),d=t.computed(()=>!V.isNil(c.value)),u=t.computed(()=>{var F;return`${((F=c.value)==null?void 0:F.currency.symbol)??""}${l.value?"/м²":""}`}),f=F=>l.value&&i.m2ReferenceProduct?vi.toM2Cost(F,i.m2ReferenceProduct):F,h=t.computed(()=>c.value?f(c.value.retailCost??c.value.cost):void 0),p=t.computed(()=>{var F;return(((F=c.value)==null?void 0:F.priceCoefficients)??[]).map(R=>({...R,cost:f(R.cost)}))}),m=F=>{var R;return F.id===o().id?h.value:(R=p.value.find(M=>M.coefficient.id===F.id))==null?void 0:R.cost},g=t.computed(()=>{var M;const R=[...((M=W.useReferencesStore().priceCoefficientsReference)==null?void 0:M.map(X=>structuredClone(t.toRaw(X))))??[],o()].filter(X=>{var G;return((G=i.visibleCoefficient)==null?void 0:G.call(i,X))??!0});return d.value&&R.forEach(X=>{const G=m(X);G?X.name+=` (${V.round(G,2)} ${u.value})`:X.name=""}),R.filter(X=>X.name!=="")}),b=t.ref(i.value.coefficient),y=t.ref(((P=(E=i.value)==null?void 0:E.value)==null?void 0:P.toString())??null),_=t.ref(null),x=t.computed(()=>p.value.find(F=>F.coefficient.slug===W.PriceCoefficientEnum.K0)),w=t.ref(void 0),C=F=>Number.parseFloat((F??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),N=()=>{var R,M;w.value=void 0;let F=C(y.value);if(F=Number.isNaN(F)?void 0:F,d.value)if(b.value||y.value){const X=o(),G=m(b.value??X)??0,Z=G+G*((F??0)/100);_.value=Ve.formatMoney(Z,(R=c.value)==null?void 0:R.currency.precision),Z>(h.value??Z)&&(w.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),x.value&&Z<(((M=x.value)==null?void 0:M.cost)??0)&&(w.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else _.value=null;r("update:value",{value:Number.isNaN(F)?void 0:F,coefficient:s(b.value)?void 0:structuredClone(t.toRaw(b.value))})},k=F=>{V.isArray(F)||V.isNull(F)||(b.value=F,y.value=null,!b.value&&y.value&&(b.value=o()),N())},$=()=>{b.value||(b.value=o()),N()},v=F=>{var M,X;const R=C(F);if(d.value){if(Number.isNaN(R)){b.value=void 0,y.value=null,r("update:value",{value:void 0,coefficient:void 0});return}let G=0;if(R<=0)b.value=void 0,y.value=null;else if(x.value&&R<(((M=x.value)==null?void 0:M.cost)??0))b.value=(X=x.value)==null?void 0:X.coefficient,G=(R-x.value.cost)*100/x.value.cost,w.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(R>(h.value??R)){b.value=o();const Z=h.value??0;G=(R-Z)*100/Z,w.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const Z=p.value,O=V.sortBy(Z,[H=>H.cost]),Y=O.filter(H=>H.cost<=R).at(-1)??O.at(0);Y&&(b.value=Y.coefficient,G=(R-Y.cost)*100/Y.cost),w.value={validationStatus:void 0,feedback:void 0}}G=Ve.roundPercent(G),y.value=Ve.formatPercent(G,Ve.percentFractionDigits),r("update:value",{value:Number.isNaN(G)?void 0:G,coefficient:s(b.value)?void 0:structuredClone(t.toRaw(b.value))})}else r("update:value",{value:Number.isNaN(R)?void 0:R,coefficient:void 0})};return t.onMounted(()=>{var F,R,M,X;i.calculationType===W.CalculationTypeEnum.m2Cost?_.value=((R=(F=i.value)==null?void 0:F.value)==null?void 0:R.toString())??null:!((M=i.value)!=null&&M.coefficient)&&((X=i.value)!=null&&X.value)&&(b.value=o()),N()}),(F,R)=>{var G,Z,O;const M=I.NInput,X=I.NInputGroup;return t.openBlock(),t.createBlock(t.unref(I.NFormItem),{"show-label":!t.unref(V.isNil)(n.label),label:n.label,"show-feedback":!t.unref(V.isNil)(((G=w.value)==null?void 0:G.feedback)??n.feedback),feedback:((Z=w.value)==null?void 0:Z.feedback)??n.feedback,"validation-status":((O=w.value)==null?void 0:O.validationStatus)??n.validationStatus},{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass([{"sm:grid-cols-3":d.value},"grid w-full grid-cols-1 gap-2"])},[n.calculationType!==t.unref(W.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(X,{key:0,class:t.normalizeClass(["w-full flex-row",{"sm:col-span-2":d.value}])},{default:t.withCtx(()=>[t.createVNode(tf,{class:"w-full min-w-0 flex-1",value:b.value,"reference-list":g.value,clearable:n.clearable,disabled:n.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"disabled-item":n.disabledCoefficient,"onUpdate:value":k},null,8,["value","reference-list","clearable","disabled","disabled-item"]),t.createVNode(M,{value:y.value,"onUpdate:value":[R[0]||(R[0]=A=>y.value=A),$],clearable:n.clearable,disabled:n.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},t.createSlots({suffix:t.withCtx(()=>[R[3]||(R[3]=t.createTextVNode("%",-1))]),_:2},[y.value&&!y.value.startsWith("-")?{name:"prefix",fn:t.withCtx(()=>[R[2]||(R[2]=t.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):t.createCommentVNode("",!0),d.value||n.calculationType===t.unref(W.CalculationTypeEnum).m2Cost?(t.openBlock(),t.createBlock(M,{key:1,value:_.value,"onUpdate:value":[R[1]||(R[1]=A=>_.value=A),v],clearable:n.clearable,disabled:n.disabled,placeholder:l.value?"Стоимость за м²":"Стоимость",class:"w-full"},t.createSlots({_:2},[d.value?{name:"suffix",fn:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(u.value),1)]),key:"0"}:void 0]),1032,["value","clearable","disabled","placeholder"])):t.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),kw={class:"text-sm"},Cw={class:"text-sm"},vw={},Sw=t.defineComponent({...vw,__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,M,X;return((R=a.value)==null?void 0:R.unit.isLinear)&&((X=(M=a.value)==null?void 0:M.properties)==null?void 0:X.isLengthConfigurator)}),c=t.computed(()=>a.value?W.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()),x=t.ref(!1),w=t.computed(()=>{var Z,O,A,Y;if(!a.value)return{};const R=W.UnitsHelper.getProductLengthMultiplicity(a.value),M=W.UnitsHelper.getProductMultiplicity(a.value),X=((O=(Z=a.value)==null?void 0:Z.properties)==null?void 0:O.minLength)||R,G=(Y=(A=a.value)==null?void 0:A.properties)==null?void 0:Y.maxLength;return{length:[ce.required,ce.min(X??.1),ce.max(G),ce.step(R),We.serverValidation(_.value.length.feedback)],quantity:[ce.required,ce.min(M),ce.step(M),We.serverValidation(_.value.quantity.feedback)],marker:[We.serverValidation(_.value.marker.feedback)]}}),C=t.computed(()=>{var R,M,X;return a.value?((R=a.value.properties)==null?void 0:R.lengthStep)??((M=a.value.properties)!=null&&M.ignoreMinCountCheck?0:((X=a.value.properties)==null?void 0:X.minCount)??0):0}),N=t.computed(()=>{var X,G,Z,O,A,Y,H,T,D;if(!a.value)return"";const R=((G=(X=a.value)==null?void 0:X.properties)==null?void 0:G.minLength)??((O=(Z=a.value)==null?void 0:Z.properties)!=null&&O.ignoreMinCountCheck?0:(Y=(A=a.value)==null?void 0:A.properties)==null?void 0:Y.minCount),M=(T=(H=a.value)==null?void 0:H.properties)==null?void 0:T.maxLength;return R||M?`(${R?`от ${R}`:""}${R&&M?" ":""}${M?`до ${M}`:""} ${(D=a.value)==null?void 0:D.unit.name})`:""}),k=R=>{var O,A;if(!((A=(O=a.value)==null?void 0:O.properties)!=null&&A.isLengthConfigurator)||!h.value||V.isNil(R)||C.value===0)return;const M=R/C.value,X=Math.round(M),G=W.UnitsHelper.getProductMultiplicity(a.value),Z=Math.max(X,G);h.value.quantity=Z},$=R=>{var Z,O,A,Y;if(!((O=(Z=a.value)==null?void 0:Z.properties)!=null&&O.isLengthConfigurator)||!h.value||V.isNil(R)||C.value===0)return;const M=Ve.multiplyByStep(R,C.value),X=((A=a.value.properties)==null?void 0:A.minLength)||W.UnitsHelper.getProductLengthMultiplicity(a.value),G=(Y=a.value.properties)==null?void 0:Y.maxLength;X!==void 0&&M<X?h.value.length=X:G!==void 0&&M>G?h.value.length=G:h.value.length=M},v=async R=>{var X;const M=V.cloneDeep(h.value);try{await((X=r.value)==null?void 0:X.validate(G=>{if(!G){if(!a.value||!M)return;W.UnitsHelper.productIsMeasurable(a.value)||delete M.length,l.value&&C.value&&(M.length=C.value),x.value=!0,b("submit",M,_.value,()=>{x.value=!1,R(!1),t.nextTick(()=>{var Z;(Z=r.value)==null||Z.validate(V.noop).catch(V.noop)})})}}))}catch{}},E=()=>{a.value=null,d.value=void 0,h.value=null,_.value=y()},P=()=>{s.value=!1};return e({show:(R,M)=>{var X,G,Z,O,A;if(E(),s.value=!0,a.value=R,d.value=M==null?void 0:M.cartItemData,u.value=M==null?void 0:M.orderId,f.value=(M==null?void 0:M.canSetDopProdaga)??!1,h.value=new W.OrderItemBase((M==null?void 0:M.cartItemData)??new W.OrderItemBase({product:R,quantity:W.UnitsHelper.productIsMeasurable(a.value)?1:((X=R==null?void 0:R.properties)==null?void 0:X.minCount)??1,length:((G=R==null?void 0:R.properties)==null?void 0:G.minLength)||((Z=R==null?void 0:R.properties)!=null&&Z.ignoreMinCountCheck?0:(O=R==null?void 0:R.properties)==null?void 0:O.minCount)||0})),(A=R==null?void 0:R.properties)!=null&&A.isLengthConfigurator&&h.value&&C.value>0){const Y=C.value,H=h.value.quantity||1;h.value.length=Ve.multiplyByStep(H,Y)}},closeDialog:P}),(R,M)=>{var A;const X=I.NFormItem,G=I.NInputGroupLabel,Z=I.NInputGroup,O=I.NCheckbox;return t.openBlock(),t.createBlock(Os,{ref:"base-dialog-reference",show:s.value,title:`${d.value?"Изменение":"Добавление"} товара ${(A=a.value)==null?void 0:A.name} в ${u.value?` заказ №${u.value}`:"корзину"}`,"accept-button":{show:!0,text:d.value?"Изменить":"Добавить"},processing:x.value,"modal-width":500,onAccept:v,onClosing:P},{default:t.withCtx(()=>[a.value&&h.value?t.withDirectives((t.openBlock(),t.createBlock(t.unref(I.NForm),{key:0,ref:"form-reference",model:h.value,rules:w.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:t.withCtx(()=>[t.unref(W.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(X,{key:0,path:"length",label:`Метраж, ${N.value+a.value.unit.name}`},t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:m.value,"onUpdate:value":[M[0]||(M[0]=Y=>m.value=Y),k],parse:t.unref(ht),step:t.unref(W.UnitsHelper).getProductLengthMultiplicity(a.value),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:M[1]||(M[1]=Y=>t.unref(fo)(Y,".",!1)),onInput:M[2]||(M[2]=Y=>t.unref(dt)(_.value,"length")),onFocus:t.unref(He)},null,8,["value","parse","step","onFocus"])]),_:2},[!_.value.length.feedback&&t.unref(W.UnitsHelper).getProductLengthMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",kw,"Метраж должно быть кратно "+t.toDisplayString(t.unref(W.UnitsHelper).getProductLengthMultiplicity(a.value)),1)]),key:"0"}:void 0]),1032,["label"])):t.createCommentVNode("",!0),t.createVNode(X,{path:"quantity",label:`Количество, ${c.value}`},{default:t.withCtx(()=>[t.createVNode(Z,null,t.createSlots({default:t.withCtx(()=>[t.createVNode(t.unref(I.NInputNumber),{value:p.value,"onUpdate:value":[M[3]||(M[3]=Y=>p.value=Y),$],parse:t.unref(ht),step:t.unref(W.UnitsHelper).getProductMultiplicity(a.value),"show-button":t.unref(W.UnitsHelper).getProductMultiplicity(a.value)>1,"button-placement":"both",placeholder:"Введите количество",class:"w-full",onKeydown:M[4]||(M[4]=Y=>t.unref(fo)(Y,".",!1)),onInput:M[5]||(M[5]=Y=>t.unref(dt)(_.value,"quantity")),onFocus:t.unref(He)},null,8,["value","parse","step","show-button","onFocus"]),l.value?(t.openBlock(),t.createBlock(G,{key:0,class:"bg-orange-100 font-bold"},{default:t.withCtx(()=>[t.createTextVNode(" x "+t.toDisplayString(C.value)+" "+t.toDisplayString(a.value.unit.name),1)]),_:1})):t.createCommentVNode("",!0)]),_:2},[!_.value.quantity.feedback&&t.unref(W.UnitsHelper).getProductMultiplicity(a.value)!==1?{name:"feedback",fn:t.withCtx(()=>[t.createElementVNode("span",Cw,"Количество должно быть кратно "+t.toDisplayString(t.unref(W.UnitsHelper).getProductMultiplicity(a.value)),1)]),key:"0"}:void 0]),1024)]),_:1},8,["label"]),t.unref(W.UnitsHelper).productIsMeasurable(a.value)?(t.openBlock(),t.createBlock(X,{key:1,path:"marker",label:"Маркировка"},{default:t.withCtx(()=>[t.createVNode(t.unref(I.NInput),{value:h.value.marker??null,placeholder:"Введите маркировку",onInput:M[6]||(M[6]=Y=>t.unref(dt)(_.value,"marker")),"onUpdate:value":M[7]||(M[7]=Y=>g(Y)),onFocus:t.unref(He)},null,8,["value","onFocus"])]),_:1})):t.createCommentVNode("",!0),f.value?(t.openBlock(),t.createBlock(O,{key:2,checked:h.value.isAdditionalSale,"onUpdate:checked":M[8]||(M[8]=Y=>h.value.isAdditionalSale=Y),"true-value":!0,"false-value":!1},{default:t.withCtx(()=>[...M[9]||(M[9]=[t.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):t.createCommentVNode("",!0)]),_:1},8,["model","rules"])),[[t.unref(ai),()=>{var Y,H;return(H=(Y=o.value)==null?void 0:Y.acceptHandler)==null?void 0:H.call(Y)}]]):t.createCommentVNode("",!0)]),_:1},8,["show","title","accept-button","processing"])}}}),Bw={class:"flex flex-row gap-1"},Nw={class:"sc-client-name flex flex-col gap-1 text-base"},Tw=["href"],$w={key:1,class:"text-sc-grey"},Ew={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Rw={key:0},Pw={key:1,class:"text-sm"},Fw={},Dr=t.defineComponent({...Fw,__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?Ce.format(i.client.lastLoginAt,W.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{V.isNil(i.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",i.client,a)};return(a,l)=>{const c=ho,d=I.NButton,u=I.NPopover;return t.openBlock(),t.createElementBlock("div",Bw,[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(V.isNil)(n.popoverPosition),placement:n.popoverPosition},{trigger:t.withCtx(()=>[t.createElementVNode("div",Nw,[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",$w," [ Деактивирован ] "))],8,Tw),n.showCityAndRegion&&n.client.city?(t.openBlock(),t.createElementBlock("span",Ew," г. "+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",Rw,t.toDisplayString(n.client.alternativeName),1)):t.createCommentVNode("",!0),o.value?(t.openBlock(),t.createElementBlock("span",Pw," Последний вход: "+t.toDisplayString(o.value),1)):t.createCommentVNode("",!0),t.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),Vw={class:"text-base"},Mw={},nf=t.defineComponent({...Mw,__name:"contragent-with-short-info",props:{contragent:{}},setup(n){const e=n,i=t.computed(()=>li.getFormatEntityName(e.contragent));return(r,o)=>(t.openBlock(),t.createElementBlock("span",Vw,t.toDisplayString(i.value),1))}}),Iw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Aw(n,e){return t.openBlock(),t.createElementBlock("svg",Iw,[...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 Ow=t.markRaw({name:"tabler-mail",render:Aw}),zw=["href"],Dw={},Lw=t.defineComponent({...Dw,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(n){return(e,i)=>{const r=Ow;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,zw)],2)}}}),Hw={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Ww(n,e){return t.openBlock(),t.createElementBlock("svg",Hw,[...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 rf=t.markRaw({name:"fa6-brands-viber",render:Ww}),jw={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},qw=["id"],Xw=["id"],Yw=["fill"],Uw=["fill"];function Kw(n,e){return t.openBlock(),t.createElementBlock("svg",jw,[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,qw),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,Xw)]),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,Yw),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,Uw),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 of=t.markRaw({name:"logos-whatsapp-icon",render:Kw,setup(){const n=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+n(),SVGHW6lecxh:"uicons-"+n()}}}}),Gw={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},Zw=["id"],Qw=["fill"];function Jw(n,e){return t.openBlock(),t.createElementBlock("svg",Gw,[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,Zw)]),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,Qw),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 sf=t.markRaw({name:"logos-telegram",render:Jw,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),ex={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function tx(n,e){return t.openBlock(),t.createElementBlock("svg",ex,[...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 af=t.markRaw({name:"ion-call",render:tx}),nx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ix(n,e){return t.openBlock(),t.createElementBlock("svg",nx,[...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 rx=t.markRaw({name:"tabler-phone-call",render:ix}),ox={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},sx=["href"],ax=["href"],lx=["href"],cx=["href"],dx={},ux=t.defineComponent({...dx,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(n){const e=n,i=t.computed(()=>{try{return e.phone?Br.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=t.computed(()=>{var l;return V.isString(i.value)?!1:((l=i.value)==null?void 0:l.isValid())??!1}),o=t.computed(()=>{var l;return V.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=t.computed(()=>{var l;return V.isString(i.value)?i.value:((l=i.value)==null?void 0:l.format("E.164"))??""}),a=t.ref(!1);return(l,c)=>{const d=rx,u=af,f=sf,h=of,p=rf;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",ox,[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,sx)):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,ax)):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,lx)):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,cx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],34)])}}}),fx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function hx(n,e){return t.openBlock(),t.createElementBlock("svg",fx,[...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 mx=t.markRaw({name:"mdi-envelope",render:hx}),px={class:"flex flex-col gap-1"},gx={key:0,class:"mb-2 flex flex-col text-base"},yx={key:0,class:"text-sc-dark-grey text-sm"},bx={key:1,class:"whitespace-nowrap text-sm"},_x={key:2,class:"whitespace-nowrap text-sm"},wx={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},xx=["href"],kx=["href"],Cx=["href"],vx=["href"],Sx=["href"],Bx={key:0,class:"flex flex-col text-base"},Nx={key:0,class:"text-sc-dark-grey text-sm"},Tx={key:1,class:"mt-2 text-sm"},$x={key:0,class:"-mt-1"},Ex={},Rx=t.defineComponent({...Ex,__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(()=>li.getFormatEntityName(e.contact)),r=t.computed(()=>{try{return e.contact.phone?Br.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),o=t.computed(()=>{var d;return V.isString(r.value)?!1:((d=r.value)==null?void 0:d.isValid())??!1}),s=t.computed(()=>{var d;return V.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("INTERNATIONAL"))??""}),a=t.computed(()=>{var d;return V.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=af,h=sf,p=of,m=rf,g=mx,b=I.NPopover;return t.openBlock(),t.createElementBlock("div",px,[t.createVNode(b,{disabled:n.fullView,placement:"bottom"},{trigger:t.withCtx(()=>{var x,w,C,N;return[t.createElementVNode("div",{class:t.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(x=n.contact)!=null&&x.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${n.classes}`),style:t.normalizeStyle(n.styles),onMouseenter:u[0]||(u[0]=k=>c.value=!0),onFocusin:u[1]||(u[1]=k=>c.value=!0),onMouseleave:u[2]||(u[2]=k=>c.value=!1),onFocusout:u[3]||(u[3]=k=>c.value=!1)},[t.createElementVNode("div",null,[n.fullView&&(n.contact.name||(w=n.contact)!=null&&w.position)?(t.openBlock(),t.createElementBlock("div",gx,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(C=n.contact)!=null&&C.position?(t.openBlock(),t.createElementBlock("span",yx,t.toDisplayString((N=n.contact)==null?void 0:N.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),n.contact.phone?(t.openBlock(),t.createElementBlock("div",bx,t.toDisplayString(s.value),1)):t.createCommentVNode("",!0),n.contact.email?(t.openBlock(),t.createElementBlock("div",_x,t.toDisplayString(n.contact.email),1)):t.createCommentVNode("",!0),l.value&&c.value?(t.openBlock(),t.createElementBlock("div",wx,[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,xx)):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,kx)):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,Cx)):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,vx)):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,Sx)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)])],38)]}),default:t.withCtx(()=>{var x,w,C,N;return[n.contact.name?(t.openBlock(),t.createElementBlock("div",Bx,[t.createTextVNode(t.toDisplayString(i.value)+" ",1),(x=n.contact)!=null&&x.position?(t.openBlock(),t.createElementBlock("span",Nx,t.toDisplayString((w=n.contact)==null?void 0:w.position),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),(C=n.contact)!=null&&C.comment?(t.openBlock(),t.createElementBlock("div",Tx,[u[4]||(u[4]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((N=n.contact)==null?void 0:N.comment),1)])):t.createCommentVNode("",!0)]}),_:1},8,["disabled"]),n.fullView&&((y=n.contact)!=null&&y.comment)?(t.openBlock(),t.createElementBlock("div",$x,[u[5]||(u[5]=t.createElementVNode("sup",null,"**",-1)),t.createTextVNode(" "+t.toDisplayString((_=n.contact)==null?void 0:_.comment),1)])):t.createCommentVNode("",!0)])}}});class Px{constructor(e){B(this,"minHeight");B(this,"maxHeights");B(this,"minWidth");B(this,"maxWidths");B(this,"netType");B(this,"color");B(this,"mountType");B(this,"descriptions");B(this,"crossbarCount");B(this,"heightOverlaps");B(this,"widthOverlaps");B(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=Ns.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=Ns.objectToSnake(e.heightOverlaps),this.widthOverlaps=Ns.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function Fx(n){var e;return((e=n.properties)==null?void 0:e.configurator)!==W.ConfiguratorsEnum.SandwichM2?!0:n.properties.configuratorSettings!==void 0&&V.isArray(n.products)&&n.products.length>0}const Vx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Mx(n,e){return t.openBlock(),t.createElementBlock("svg",Vx,[...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 Ix=t.markRaw({name:"mdi-dots-horizontal",render:Mx}),Ax={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ox(n,e){return t.openBlock(),t.createElementBlock("svg",Ax,[...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 zx=t.markRaw({name:"mdi-magnify-minus-outline",render:Ox}),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.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 Hx=t.markRaw({name:"mdi-magnify-plus-outline",render:Lx}),Wx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function jx(n,e){return t.openBlock(),t.createElementBlock("svg",Wx,[...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 lf=t.markRaw({name:"mdi-chevron-right",render:jx}),qx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Xx(n,e){return t.openBlock(),t.createElementBlock("svg",qx,[...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 cf=t.markRaw({name:"mdi-chevron-left",render:Xx}),Yx={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"},Lr={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"},df="date-range.dialog.mode",uf="date-range.dialog.scale",ff="date-range.quick-periods",hf=["thisMonth","lastMonth","thisQuarter","lastQuarter","thisYear","lastYear","fromBeginningOfThisYear"],mf=["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],Ux=["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],Kx=["Пн","Вт","Ср","Чт","Пт","Сб","Вс"],pf=new Date(2e3,0,1),Ri=n=>Ce.differenceInCalendarDays(n,pf),gf=n=>Ce.addDays(pf,n),yf=(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?Ce.startOfDay(r):void 0,to:o?Ce.endOfDay(o):void 0}},Aa=n=>Object.entries(n).map(([e,i])=>({value:e,label:i.label,item:i})),bf=(n,e)=>{const i=Object.entries(n).filter(([,r])=>r.group===e);return e!=="other"?[{type:"group",key:e,children:Aa(Object.fromEntries(i))}]:W.STANDARD_PERIOD_SECTIONS.map(r=>{const o=i.filter(([,s])=>s.section===r.key);return{type:"group",key:r.key,label:r.label,children:Aa(Object.fromEntries(o))}}).filter(r=>r.children.length>0)},_f=(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}},Gx={class:"flex items-center justify-between gap-2"},Zx={class:"flex items-center gap-2"},Qx={class:"text-center font-semibold"},Jx={class:"grid grid-cols-7 gap-0.5 text-center text-xs text-gray-500"},ek={class:"grid grid-cols-7 gap-0.5"},tk=["disabled","onPointerdown","onPointerenter","onKeydown"],nk={},ik=t.defineComponent({...nk,__name:"day-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=42,s=I.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=Ue.initRefDependingOnDeviceResolution(1,2,3),c=t.computed(()=>["grid-cols-1","grid-cols-2","grid-cols-3"][l.value-1]),d=y=>Ce.subMonths(Ce.startOfMonth(y),l.value===3?1:0),u=y=>y&&Ce.isValid(y)?y:new Date,f=t.ref(d(u(i.from??i.to))),h=t.computed(()=>{const{from:y,to:_}=i;return!y||!_||!Ce.isValid(y)||!Ce.isValid(_)?null:[Ri(y),Ri(_)]}),p=_f(h,(y,_)=>{r("select",{from:Ce.startOfDay(gf(y)),to:Ce.endOfDay(gf(_))})}),m=y=>{const _=Ce.subDays(y,(Ce.getDay(y)+6)%7);return V.times(o,x=>{const w=Ce.addDays(_,x);return{index:Ri(w),day:w.getDate(),isCurrentMonth:Ce.isSameMonth(w,y),isToday:Ce.isToday(w)}})},g=t.computed(()=>V.times(l.value,y=>{const _=Ce.addMonths(f.value,y);return{key:`${_.getFullYear()}-${_.getMonth()}`,title:`${Ux[_.getMonth()]} ${_.getFullYear()}`,cells:m(_)}})),b=y=>{if(!y.isCurrentMonth)return["sc-day--outside"];const _=y.isToday?["sc-day--today"]:[],x=p.cellPosition(y.index);return x&&_.push(`sc-day--${x}`),_};return t.watch(()=>[i.from,i.to],()=>{const y=i.from??i.to;if(!y||!Ce.isValid(y))return;const _=`${y.getFullYear()}-${y.getMonth()}`;V.some(g.value,["key",_])||(f.value=d(y))}),(y,_)=>{const x=cf,w=I.NButton,C=lf;return t.openBlock(),t.createElementBlock("div",{class:"flex select-none flex-col gap-3",style:t.normalizeStyle(a.value),onPointerleave:_[2]||(_[2]=(...N)=>t.unref(p).pointerLeaveHandler&&t.unref(p).pointerLeaveHandler(...N))},[t.createElementVNode("div",Gx,[t.createVNode(w,{size:"small","aria-label":"Предыдущий месяц","theme-overrides":t.unref(Lr),onClick:_[0]||(_[0]=N=>f.value=t.unref(Ce.subMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(x)]),_:1},8,["theme-overrides"]),_[3]||(_[3]=t.createElementVNode("span",{class:"text-sm text-gray-600"},"Выберите диапазон на календаре",-1)),t.createElementVNode("div",Zx,[t.renderSlot(y.$slots,"actions",{},void 0,!0),t.createVNode(w,{size:"small","aria-label":"Следующий месяц","theme-overrides":t.unref(Lr),onClick:_[1]||(_[1]=N=>f.value=t.unref(Ce.addMonths)(f.value,1))},{icon:t.withCtx(()=>[t.createVNode(C)]),_: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,N=>(t.openBlock(),t.createElementBlock("div",{key:N.key,class:"flex flex-col gap-1"},[t.createElementVNode("div",Qx,t.toDisplayString(N.title),1),t.createElementVNode("div",Jx,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(Kx),k=>(t.openBlock(),t.createElementBlock("span",{key:k},t.toDisplayString(k),1))),128))]),t.createElementVNode("div",ek,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(N.cells,k=>(t.openBlock(),t.createElementBlock("button",{key:k.index,type:"button",class:t.normalizeClass(["sc-day h-7 rounded border-0 p-0 text-xs",b(k)]),disabled:!k.isCurrentMonth,onPointerdown:t.withModifiers($=>t.unref(p).pointerDownHandler(k.index),["prevent"]),onPointerenter:$=>t.unref(p).pointerEnterHandler(k.index),onKeydown:[t.withKeys(t.withModifiers($=>t.unref(p).selectHandler(k.index),["prevent"]),["enter"]),t.withKeys(t.withModifiers($=>t.unref(p).selectHandler(k.index),["prevent"]),["space"])]},t.toDisplayString(k.day),43,tk))),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)}}}),rk=gn(ik,[["__scopeId","data-v-a41e813d"]]),ok={class:"flex items-center justify-between gap-2"},sk={class:"flex items-center gap-2"},ak={class:"text-center font-semibold"},lk={class:"grid grid-cols-3 gap-2"},ck=["onPointerdown","onPointerenter","onKeydown"],dk={},uk=t.defineComponent({...dk,__name:"month-range-grid",props:{from:{},to:{}},emits:["select"],setup(n,{emit:e}){const i=n,r=e,o=I.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&&Ce.isValid(p)?p.getFullYear():m},l=t.ref(a(i.from??i.to)),c=Ue.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||!Ce.isValid(p)||!Ce.isValid(m)?null:[p.getFullYear()*12+p.getMonth(),m.getFullYear()*12+m.getMonth()]}),f=_f(u,(p,m)=>{r("select",{from:new Date(Math.floor(p/12),p%12,1),to:Ce.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||!Ce.isValid(p))return;const m=p.getFullYear();(m<l.value-1||m>l.value+1)&&(l.value=m)}),(p,m)=>{const g=cf,b=I.NButton,y=lf;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",ok,[t.createVNode(b,{size:"small","aria-label":"Предыдущий год","theme-overrides":t.unref(Lr),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",sk,[t.renderSlot(p.$slots,"actions",{},void 0,!0),t.createVNode(b,{size:"small","aria-label":"Следующий год","theme-overrides":t.unref(Lr),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",ak,t.toDisplayString(_),1),t.createElementVNode("div",lk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(mf),(x,w)=>(t.openBlock(),t.createElementBlock("button",{key:x,type:"button",class:t.normalizeClass(["sc-month cursor-pointer rounded-lg px-1 py-2.5 text-sm",h(_,w)]),onPointerdown:t.withModifiers(C=>t.unref(f).pointerDownHandler(_*12+w),["prevent"]),onPointerenter:C=>t.unref(f).pointerEnterHandler(_*12+w),onKeydown:[t.withKeys(t.withModifiers(C=>t.unref(f).selectHandler(_*12+w),["prevent"]),["enter"]),t.withKeys(t.withModifiers(C=>t.unref(f).selectHandler(_*12+w),["prevent"]),["space"])]},t.toDisplayString(x),43,ck))),128))])]))),128))],2)],36)}}}),fk=gn(uk,[["__scopeId","data-v-dd09a19d"]]),hk={class:"sc-date-range-sidebar flex flex-col gap-1"},mk={class:"flex items-center justify-center gap-1"},pk={class:"min-w-12 text-center font-semibold"},gk={class:"grid grid-flow-col grid-cols-2 grid-rows-6 gap-1"},yk={},bk=t.defineComponent({...yk,__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=I.NButton;return t.openBlock(),t.createElementBlock("div",hk,[t.createElementVNode("div",mk,[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",pk,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",gk,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(mf),(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})])}}}),_k={},wf=t.defineComponent({..._k,__name:"date-range-input",props:{clearable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{default:void 0},value:{default:null},dateFormat:{default:()=>W.useBaseConfigStateStore().config.dateFormats.uiDate}},emits:["update:value"],setup(n,{emit:e}){const i=n,r=e,o=Ue.initRefDependingOnDeviceResolution(!0,!1,!1),s=t.ref(null),a=t.ref(!1),l=t.ref(0),c=t.ref(i.value&&Ce.isValid(i.value)?i.value:new Date),d=t.computed(()=>{const x=i.value&&Ce.isValid(i.value)?i.value:c.value;return x.getFullYear()===c.value.getFullYear()?x.getMonth():null});let u=0;const f=x=>{var w,C;(C=(w=x.target)==null?void 0:w.closest)!=null&&C.call(w,".n-base-clear__clear")&&(u=performance.now())},h=x=>{x&&performance.now()-u<300||(a.value=x,x&&(c.value=i.value&&Ce.isValid(i.value)?i.value:new Date))},p=x=>{r("update:value",x===null?null:new Date(x))},m=(x,w)=>{const C=new Date(x,w,1);if(c.value=C,i.value&&Ce.isValid(i.value)){const N=Math.min(Ce.getDate(i.value),Ce.getDaysInMonth(C));r("update:value",new Date(x,w,N));return}l.value+=1,t.nextTick().then(()=>{var N;return(N=s.value)==null?void 0:N.focus()})},g=(x,w)=>{c.value=Ce.addYears(Ce.addMonths(c.value,x),w)},b=x=>{m(x,c.value.getMonth())},y=x=>{m(c.value.getFullYear(),x)},_=()=>{a.value=!1,r("update:value",new Date)};return(x,w)=>{const C=I.NButton,N=I.NDatePicker;return t.openBlock(),t.createBlock(N,{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:w[0]||(w[0]=k=>g(1,0)),onPrevMonth:w[1]||(w[1]=k=>g(-1,0)),onNextYear:w[2]||(w[2]=k=>g(0,1)),onPrevYear:w[3]||(w[3]=k=>g(0,-1))},{footer:t.withCtx(()=>[t.unref(o)?(t.openBlock(),t.createBlock(C,{key:1,size:"small",text:"",type:"info",onClick:_},{default:t.withCtx(()=>[...w[4]||(w[4]=[t.createTextVNode(" Сегодня ",-1)])]),_:1})):(t.openBlock(),t.createBlock(bk,{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"])}}}),wk={key:0,class:"text-gray-400"},xk={},xf=t.defineComponent({...xk,__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=Ue.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(wf,{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",wk," – ")),t.createVNode(wf,{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)}}}),kk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ck(n,e){return t.openBlock(),t.createElementBlock("svg",kk,[...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 vk=t.markRaw({name:"mdi-calendar-month-outline",render:Ck}),Sk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Bk(n,e){return t.openBlock(),t.createElementBlock("svg",Sk,[...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 Nk=t.markRaw({name:"mdi-chart-line",render:Bk}),Tk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function $k(n,e){return t.openBlock(),t.createElementBlock("svg",Tk,[...e[0]||(e[0]=[t.createElementVNode("path",{fill:"currentColor",d:"M22 21H2V3h2v16h2v-9h4v9h2V6h4v13h2v-5h4z"},null,-1)])])}const Ek=t.markRaw({name:"mdi-chart-bar",render:$k}),Rk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Pk(n,e){return t.openBlock(),t.createElementBlock("svg",Rk,[...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 Fk=t.markRaw({name:"mdi-calendar-week-outline",render:Pk}),Vk={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Mk(n,e){return t.openBlock(),t.createElementBlock("svg",Vk,[...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 Ik=t.markRaw({name:"mdi-calendar-today-outline",render:Mk}),Ak={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ok(n,e){return t.openBlock(),t.createElementBlock("svg",Ak,[...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 zk=t.markRaw({name:"mdi-cog-outline",render:Ok}),Dk={class:"grid gap-x-6 gap-y-4 pr-3 sm:grid-cols-2"},Lk={class:"font-medium"},Hk={key:0,class:"pt-1 text-xs text-gray-500"},Wk={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},jk={class:"flex items-center gap-3"},qk={class:"text-sm text-gray-600"},Xk={class:"flex gap-2"},Yk={},Uk=t.defineComponent({...Yk,__name:"quick-periods-settings",props:{show:{type:Boolean},selectedKeys:{}},emits:["update:show","save"],setup(n,{emit:e}){const i=n,r=e,o=Ue.initRefDependingOnDeviceResolution("100%","90%","40rem"),s=W.DateTimeProvider.standardPeriods(),a=W.STANDARD_PERIOD_GROUPS.map(u=>({key:u.key,label:u.label,sections:bf(s,u.key)})),l=t.ref([]),c=t.computed(()=>{const u=l.value.length;return`Выбрано: ${u} ${W.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=I.NCheckbox,p=I.NCheckboxGroup,m=I.NScrollbar,g=I.NButton,b=I.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",Wk,[t.createElementVNode("div",jk,[t.createElementVNode("span",qk,t.toDisplayString(c.value),1),t.createVNode(g,{text:"",type:"info",onClick:f[1]||(f[1]=y=>l.value=[...t.unref(hf)])},{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",Xk,[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",Dk,[(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",Lk,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",Hk,t.toDisplayString(_.label),1)):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.children,x=>(t.openBlock(),t.createBlock(h,{key:x.value,value:x.value,label:x.label},null,8,["value","label"]))),128))],64))),128))]))),128))])]),_:1},8,["value"])]),_:1})]),_:1},8,["show","style"])}}}),Kk={class:"flex flex-col gap-2"},Gk={class:"flex items-center gap-2"},Zk={class:"flex gap-2 px-px pb-4 pt-px"},Qk={key:0,class:"text-sm text-gray-500"},Jk={},e2=t.defineComponent({...Jk,__name:"quick-periods",props:{from:{},to:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o=W.DateTimeProvider.standardPeriods(),s=()=>{const f=ff,h=W.PreferencesStorageProvider.getActualDataFromStorage(f);return(V.isArray(h)?h:hf).filter(m=>V.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?Ri(i.from):null,h=i.to?Ri(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:Ri(g)===f&&Ri(b)===h});return p?String(p.value):null}),u=f=>{a.value=f;const h=ff;W.PreferencesStorageProvider.saveActualDataToStorage(h,f,Ce.addYears(Ce.startOfToday(),1))};return(f,h)=>{const p=zk,m=I.NButton,g=Ik,b=Fk,y=Ek,_=Nk,x=vk,w=I.NScrollbar;return t.openBlock(),t.createElementBlock("div",Kk,[t.createElementVNode("div",Gk,[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]=C=>l.value=!0)},{icon:t.withCtx(()=>[t.createVNode(p)]),_:1})]),t.createVNode(w,{"x-scrollable":""},{default:t.withCtx(()=>[t.createElementVNode("div",Zk,[c.value.length===0?(t.openBlock(),t.createElementBlock("span",Qk," Периоды не выбраны ")):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,C=>(t.openBlock(),t.createBlock(m,{key:C.value,type:C.value===d.value?"primary":"default",ghost:C.value===d.value,"theme-overrides":t.unref(Yx),class:"shrink-0",onClick:N=>r("apply",C),onMouseenter:N=>r("preview",C),onMouseleave:h[1]||(h[1]=N=>r("preview"))},{icon:t.withCtx(()=>[C.group==="day"?(t.openBlock(),t.createBlock(g,{key:0})):C.group==="week"||C.group==="decade"?(t.openBlock(),t.createBlock(b,{key:1})):C.group==="quarter"||C.group==="halfYear"?(t.openBlock(),t.createBlock(y,{key:2})):C.group==="other"?(t.openBlock(),t.createBlock(_,{key:3})):(t.openBlock(),t.createBlock(x,{key:4}))]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(C.label),1)]),_:2},1032,["type","ghost","theme-overrides","onClick","onMouseenter"]))),128))])]),_:1}),t.createVNode(Uk,{show:l.value,"onUpdate:show":h[2]||(h[2]=C=>l.value=C),"selected-keys":a.value,onSave:u},null,8,["show","selected-keys"])])}}}),t2={class:"flex flex-col items-stretch gap-3 sm:flex-row"},n2={class:"order-2 flex-1 rounded-lg border border-solid border-gray-200 p-2 shadow-sm"},i2={class:"flex flex-col items-stretch pr-3"},r2={key:0,class:"px-2 pb-0.5 pt-2 text-xs text-gray-400"},o2={key:1,class:"order-2 w-44 shrink-0 rounded-lg border border-solid border-gray-200 p-1 shadow-sm"},s2={},a2=t.defineComponent({...s2,__name:"standard-periods",props:{activeKey:{},customPeriods:{}},emits:["apply","preview"],setup(n,{emit:e}){const i=n,r=e,o="custom",s=Ue.initRefDependingOnDeviceResolution(!0,!1,!1),a=W.DateTimeProvider.standardPeriods(),l=t.ref(W.STANDARD_PERIOD_GROUPS[0].key),c=t.computed(()=>{const u=W.STANDARD_PERIOD_GROUPS.map(f=>({key:f.key,value:f.key,label:f.label}));return V.isEmpty(i.customPeriods)||u.push({key:o,value:o,label:"Пользовательские"}),u}),d=t.computed(()=>l.value===o?[{type:"group",key:o,children:Aa(i.customPeriods??{})}]:bf(a,l.value));return(u,f)=>{const h=I.NButton,p=I.NScrollbar,m=I.NSelect,g=I.NMenu;return t.openBlock(),t.createElementBlock("div",t2,[t.createElementVNode("div",n2,[t.createVNode(p,{class:"max-h-96"},{default:t.withCtx(()=>[t.createElementVNode("div",i2,[(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",r2,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",o2,[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"])]))])}}}),l2={class:"flex flex-col gap-3"},c2={class:"flex flex-col gap-1 sm:flex-row sm:items-center"},d2={key:1,class:"overflow-x-auto rounded-lg border border-solid border-gray-200 p-2 shadow-sm sm:p-3"},u2={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},f2={class:"flex gap-2"},h2={},m2=t.defineComponent({...h2,__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=Ue.initRefDependingOnDeviceResolution("100%","90%","48rem"),s=t.ref("custom"),a=t.ref("months"),l=t.computed(()=>a.value==="months"?"Показать по дням":"Показать по месяцам"),c=()=>W.PreferencesStorageProvider.getActualDataFromStorage(df)==="standard"?"standard":"custom",d=()=>W.PreferencesStorageProvider.getActualDataFromStorage(uf)==="days"?"days":"months",u=(v,E)=>{W.PreferencesStorageProvider.saveActualDataToStorage(v,E,Ce.addYears(Ce.startOfToday(),1))},f=t.ref({}),h=t.ref(null),p=t.ref(null),m=t.computed(()=>h.value??f.value),g=(v,E)=>{var R,M;const P=(R=i.disabled)!=null&&R.from?f.value.from:v,F=(M=i.disabled)!=null&&M.to?f.value.to:E;h.value=null,f.value=yf(P,F,i.disabled)},b=v=>{p.value=null,g(v,f.value.to)},y=v=>{p.value=null,g(f.value.from,v)},_=()=>{p.value=null,g(null,null)},x=v=>{p.value=null,g(v.from,v.to)},w=v=>{const E=v.item;g(E.from,E.to),p.value=String(v.value)},C=v=>{const E=v==null?void 0:v.item;h.value=E?{from:E.from,to:E.to}:null},N=()=>{h.value=null,s.value=s.value==="custom"?"standard":"custom",u(df,s.value)},k=()=>{a.value=a.value==="months"?"days":"months",u(uf,a.value)},$=()=>{r("select",f.value),r("update:show",!1)};return t.watch(()=>i.show,v=>{v&&(s.value=c(),a.value=d(),p.value=null,h.value=null,f.value={...i.dateRange})}),(v,E)=>{const P=I.NButton,F=Hx,R=zx,M=I.NTooltip,X=I.NModal;return t.openBlock(),t.createBlock(X,{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":E[1]||(E[1]=G=>r("update:show",G))},{footer:t.withCtx(()=>[t.createElementVNode("div",u2,[t.createVNode(P,{text:"",type:"info",onClick:N},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(s.value==="custom"?"Показать стандартные периоды":"Показать произвольный период"),1)]),_:1}),t.createElementVNode("div",f2,[t.createVNode(P,{type:"primary",onClick:$},{default:t.withCtx(()=>[...E[3]||(E[3]=[t.createTextVNode(" Выбрать ",-1)])]),_:1}),t.createVNode(P,{onClick:E[0]||(E[0]=G=>r("update:show",!1))},{default:t.withCtx(()=>[...E[4]||(E[4]=[t.createTextVNode("Отмена",-1)])]),_:1})])])]),default:t.withCtx(()=>[t.createElementVNode("div",l2,[s.value==="custom"?(t.openBlock(),t.createBlock(e2,{key:0,from:f.value.from,to:f.value.to,onApply:w,onPreview:C},null,8,["from","to"])):t.createCommentVNode("",!0),t.createElementVNode("div",c2,[t.createVNode(xf,{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(P,{key:0,text:"",type:"info",class:"sm:ml-2",onClick:_},{default:t.withCtx(()=>[...E[2]||(E[2]=[t.createTextVNode(" Очистить период ",-1)])]),_:1})):t.createCommentVNode("",!0)]),s.value==="custom"?(t.openBlock(),t.createElementBlock("div",d2,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.value==="months"?fk:rk),{from:f.value.from,to:f.value.to,onSelect:x},{actions:t.withCtx(()=>[t.createVNode(M,{placement:"top",trigger:"hover"},{trigger:t.withCtx(()=>[t.createVNode(P,{size:"small","aria-label":l.value,"theme-overrides":t.unref(Lr),onClick:k},{icon:t.withCtx(()=>[a.value==="months"?(t.openBlock(),t.createBlock(F,{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(a2,{key:2,"active-key":p.value,"custom-periods":n.customPeriods,onApply:w,onPreview:C},null,8,["active-key","custom-periods"]))])]),_:1},8,["show","style"])}}}),p2={class:"flex w-full min-w-0 items-center gap-1"},g2={},y2=t.defineComponent({...g2,__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?W.DateTimeProvider.defaultDateRanges():{},...i.predefinedDateRanges};return V.isEmpty(u)?void 0:u}),a=(u,f)=>{r("update:date-range",yf(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=Ix,p=I.NButton;return t.openBlock(),t.createElementBlock("div",p2,[t.createVNode(xf,{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(m2,{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"])])}}}),b2={class:"sc-lbl-date text-nowrap"},_2={},es=t.defineComponent({..._2,__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(()=>Ce.format(e.date,W.useBaseConfigStateStore().config.dateFormats.uiDate)),r=t.computed(()=>Ce.format(e.date,"HH:mm"));return(o,s)=>(t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass({"flex flex-col":n.isTimeOnSecondLine})},[t.createElementVNode("span",b2,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))}}),w2={},x2=t.defineComponent({...w2,__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)}}),k2={class:"flex flex-row gap-2.5"},C2={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},v2={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},S2={class:"mb-0.5 sm:mb-0 sm:ml-3"},B2={},N2=t.defineComponent({...B2,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(n){return(e,i)=>{const r=Jo,o=I.NButton,s=I.NPopover;return t.openBlock(),t.createElementBlock("div",k2,[t.createElementVNode("div",C2,[t.renderSlot(e.$slots,"main")]),t.createElementVNode("div",null,[t.createElementVNode("div",v2,[t.renderSlot(e.$slots,"extra-buttons"),t.createElementVNode("div",S2,[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)])])])])}}}),T2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function $2(n,e){return t.openBlock(),t.createElementBlock("svg",T2,[...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 E2=t.markRaw({name:"ion-checkmark-done-sharp",render:$2}),R2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function P2(n,e){return t.openBlock(),t.createElementBlock("svg",R2,[...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 F2=t.markRaw({name:"ion-options-outline",render:P2}),V2={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},M2={class:"flex-auto"},I2={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"},A2={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"},O2={},Oa=t.defineComponent({...O2,__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=F2,f=I.NButton,h=I.NPopover,p=E2,m=Jo;return t.openBlock(),t.createElementBlock("div",V2,[t.createElementVNode("div",M2,[t.renderSlot(c.$slots,"default")]),t.createElementVNode("div",null,[t.createElementVNode("div",I2,[t.createElementVNode("div",A2,[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")])])])}}}),z2={},kf=t.defineComponent({...z2,__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(Oa,{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(Oa,{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"]))]))}}),D2={key:0,class:"whitespace-pre-line"},L2={key:1,class:"text-sc-dark-grey"},H2={},W2=t.defineComponent({...H2,__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=I.NInput;return t.openBlock(),t.createBlock(kf,{disabled:n.disabled,"onEditor:apply":s,"onEditor:cancel":a},{viewer:t.withCtx(()=>[t.createElementVNode("div",null,[n.comment?(t.openBlock(),t.createElementBlock("span",D2,t.toDisplayString(n.comment),1)):(t.openBlock(),t.createElementBlock("span",L2," - Комментарий отсутствует - "))])]),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"])}}}),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:"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 X2=t.markRaw({name:"ion-download-outline",render:q2}),Y2={},U2=t.defineComponent({...Y2,__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=X2;return t.openBlock(),t.createBlock(t.unref(I.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(I.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"])}}}),K2={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function G2(n,e){return t.openBlock(),t.createElementBlock("svg",K2,[...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 Z2=t.markRaw({name:"ion-warning",render:G2}),Q2={},J2=t.defineComponent({...Q2,__name:"warning-icon",props:{popoverText:{default:""},iconClass:{default:"text-sc-warning"}},setup(n){return(e,i)=>{const r=Z2,o=I.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"])}}}),eC={},tC=t.defineComponent({...eC,__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=V.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(I.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"]))}}),nC={},iC=t.defineComponent({...nC,__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=V.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(I.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"]))}}),rC={},oC=t.defineComponent({...rC,__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=V.debounce(c=>r("update:value",c),i.debounceTime??0),a=c=>{let d="";if(V.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(V.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof Br.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=Br.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof Br.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(Pm.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"]))}}),sC=gn(oC,[["__scopeId","data-v-751dbb0e"]]),aC={class:"mb-7 grid grid-cols-2 gap-3.5 lg:grid-cols-4"},lC={class:"mb-2 text-[11.5px] font-semibold uppercase text-gray-500"},cC={},dC=t.defineComponent({...cC,__name:"kpi-grid",props:{items:{},isLoading:{type:Boolean}},setup(n){return(e,i)=>(t.openBlock(),t.createElementBlock("div",aC,[(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",lC,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))]))}}),uC={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function fC(n,e){return t.openBlock(),t.createElementBlock("svg",uC,[...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 hC=t.markRaw({name:"tabler-external-link",render:fC}),mC={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},pC=["href"],gC={},yC=t.defineComponent({...gC,__name:"external-link",props:{text:{},url:{},description:{}},setup(n){return(e,i)=>{const r=hC,o=I.NTooltip;return t.openBlock(),t.createBlock(o,{disabled:t.unref(V.isUndefined)(n.description),placement:"top-start"},{trigger:t.withCtx(()=>[t.createElementVNode("span",mC,[t.createElementVNode("a",{href:n.url,target:"_blank",class:"no-underline"},t.toDisplayString(n.text),9,pC),t.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(n.description),1)]),_:1},8,["disabled"])}}}),bC={key:1,class:"h-24"},_C={key:2,class:"flex flex-col gap-3"},wC={},xC=t.defineComponent({...wC,__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(I.NSpin),{show:n.isLoading},{default:t.withCtx(()=>[!n.isLoading&&n.isEmpty?(t.openBlock(),t.createBlock(t.unref(I.NEmpty),{key:0,description:n.emptyDescription},null,8,["description"])):n.isLoading&&n.isEmpty?(t.openBlock(),t.createElementBlock("div",bC)):(t.openBlock(),t.createElementBlock("div",_C,[t.renderSlot(o.$slots,"default")])),n.pagination&&n.pagination.itemCount>0?(t.openBlock(),t.createBlock(t.unref(I.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(Jl),"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"]))}}),kC={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function CC(n,e){return t.openBlock(),t.createElementBlock("svg",kC,[...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 vC=t.markRaw({name:"ion-remove-circle-outline",render:CC});let ts=[];const Cf=new WeakMap;function SC(){ts.forEach(n=>n(...Cf.get(n))),ts=[]}function vf(n,...e){Cf.set(n,e),!ts.includes(n)&&ts.push(n)===1&&requestAnimationFrame(SC)}function Hr(n,e){let{target:i}=n;for(;i;){if(i.dataset&&i.dataset[e]!==void 0)return!0;i=i.parentElement}return!1}function Wr(n){return n.composedPath()[0]||null}function jr(n){return typeof n=="string"?n.endsWith("px")?Number(n.slice(0,n.length-2)):Number(n):n}function qr(n){if(n!=null)return typeof n=="number"?`${n}px`:n.endsWith("px")?n:`${n}px`}function xn(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 Sf={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 BC(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 NC(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 Mn="^\\s*",In="\\s*$",mi="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",rn="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",Pi="([0-9A-Fa-f])",Fi="([0-9A-Fa-f]{2})",Bf=new RegExp(`${Mn}hsl\\s*\\(${rn},${mi},${mi}\\)${In}`),Nf=new RegExp(`${Mn}hsv\\s*\\(${rn},${mi},${mi}\\)${In}`),Tf=new RegExp(`${Mn}hsla\\s*\\(${rn},${mi},${mi},${rn}\\)${In}`),$f=new RegExp(`${Mn}hsva\\s*\\(${rn},${mi},${mi},${rn}\\)${In}`),TC=new RegExp(`${Mn}rgb\\s*\\(${rn},${rn},${rn}\\)${In}`),$C=new RegExp(`${Mn}rgba\\s*\\(${rn},${rn},${rn},${rn}\\)${In}`),EC=new RegExp(`${Mn}#${Pi}${Pi}${Pi}${In}`),RC=new RegExp(`${Mn}#${Fi}${Fi}${Fi}${In}`),PC=new RegExp(`${Mn}#${Pi}${Pi}${Pi}${Pi}${In}`),FC=new RegExp(`${Mn}#${Fi}${Fi}${Fi}${Fi}${In}`);function Qt(n){return parseInt(n,16)}function VC(n){try{let e;if(e=Tf.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),Mi(e[13])];if(e=Bf.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${n}.`)}catch(e){throw e}}function MC(n){try{let e;if(e=$f.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),Mi(e[13])];if(e=Nf.exec(n))return[is(e[1]),pi(e[5]),pi(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${n}.`)}catch(e){throw e}}function Vi(n){try{let e;if(e=RC.exec(n))return[Qt(e[1]),Qt(e[2]),Qt(e[3]),1];if(e=TC.exec(n))return[$t(e[1]),$t(e[5]),$t(e[9]),1];if(e=$C.exec(n))return[$t(e[1]),$t(e[5]),$t(e[9]),Mi(e[13])];if(e=EC.exec(n))return[Qt(e[1]+e[1]),Qt(e[2]+e[2]),Qt(e[3]+e[3]),1];if(e=FC.exec(n))return[Qt(e[1]),Qt(e[2]),Qt(e[3]),Mi(Qt(e[4])/255)];if(e=PC.exec(n))return[Qt(e[1]+e[1]),Qt(e[2]+e[2]),Qt(e[3]+e[3]),Mi(Qt(e[4]+e[4])/255)];if(n in Sf)return Vi(Sf[n]);if(Bf.test(n)||Tf.test(n)){const[i,r,o,s]=VC(n);return[...NC(i,r,o),s]}else if(Nf.test(n)||$f.test(n)){const[i,r,o,s]=MC(n);return[...BC(i,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${n}.`)}catch(e){throw e}}function IC(n){return n>1?1:n<0?0:n}function za(n,e,i,r){return`rgba(${$t(n)}, ${$t(e)}, ${$t(i)}, ${IC(r)})`}function Da(n,e,i,r,o){return $t((n*e*(1-r)+i*r)/o)}function AC(n,e){Array.isArray(n)||(n=Vi(n)),Array.isArray(e)||(e=Vi(e));const i=n[3],r=e[3],o=Mi(i+r-i*r);return za(Da(n[0],i,e[0],r,o),Da(n[1],i,e[1],r,o),Da(n[2],i,e[2],r,o),o)}function Le(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Vi(n);return typeof e.alpha=="number"?za(i,r,o,e.alpha):za(i,r,o,s)}function ns(n,e){const[i,r,o,s=1]=Array.isArray(n)?n:Vi(n),{lightness:a=1,alpha:l=1}=e;return OC([i*a,r*a,o*a,s*l])}function Mi(n){const e=Math.round(Number(n)*100)/100;return e>1?1:e<0?0:e}function is(n){const e=Math.round(Number(n));return e>=360||e<0?0:e}function $t(n){const e=Math.round(Number(n));return e>255?255:e<0?0:e}function pi(n){const e=Math.round(Number(n));return e>100?100:e<0?0:e}function OC(n){const[e,i,r]=n;return 3 in n?`rgba(${$t(e)}, ${$t(i)}, ${$t(r)}, ${Mi(n[3])})`:`rgba(${$t(e)}, ${$t(i)}, ${$t(r)}, 1)`}function zC(n=8){return Math.random().toString(16).slice(2,2+n)}function Ef(n){return Array.isArray(n)?n:[n]}const La={STOP:"STOP"};function Rf(n,e){const i=e(n);n.children!==void 0&&i!==La.STOP&&n.children.forEach(r=>Rf(r,e))}function DC(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 LC(n,e){const{isLeaf:i}=n;return i!==void 0?i:!e(n)}function HC(n){return n.children}function WC(n){return n.key}function jC(){return!1}function qC(n,e){const{isLeaf:i}=n;return!(i===!1&&!Array.isArray(e(n)))}function XC(n){return n.disabled===!0}function YC(n,e){return n.isLeaf===!1&&!Array.isArray(e(n))}function UC(n,e){if(n.isLeaf===!0){const i=e(n);if(Array.isArray(i)&&i.length>0)return!0}return!1}function Ha(n){var e;return n==null?[]:Array.isArray(n)?n:(e=n.checkedKeys)!==null&&e!==void 0?e:[]}function Wa(n){var e;return n==null||Array.isArray(n)?[]:(e=n.indeterminateKeys)!==null&&e!==void 0?e:[]}function KC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)||i.add(r)}),Array.from(i)}function GC(n,e){const i=new Set(n);return e.forEach(r=>{i.has(r)&&i.delete(r)}),Array.from(i)}function ZC(n){return(n==null?void 0:n.type)==="group"}function QC(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 JC extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function ev(n,e,i,r){return rs(e.concat(n),i,r,!1)}function tv(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 nv(n,e,i,r){const o=rs(e,i,r,!1),s=rs(n,i,r,!0),a=tv(n,i),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function ja(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:KC(i,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:GC(i,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(i),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let f;o!==void 0?f=nv(o,i,e,d):r!==void 0?f=ev(r,i,e,d):f=rs(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,x=u.get(y);for(const w of x){if(w.isLeaf)continue;const{key:C,shallowLoaded:N}=w;if(p&&N&&w.children.forEach(E=>{!E.disabled&&!E.isLeaf&&E.shallowLoaded&&m.has(E.key)&&m.delete(E.key)}),w.disabled||!N)continue;let k=!0,$=!1,v=!0;for(const E of w.children){const P=E.key;if(!E.disabled){if(v&&(v=!1),m.has(P))$=!0;else if(g.has(P)){$=!0,k=!1;break}else if(k=!1,$)break}}k&&!v?(h&&w.children.forEach(E=>{!E.disabled&&m.has(E.key)&&m.delete(E.key)}),m.add(C)):$&&g.add(C),_&&p&&m.has(C)&&m.delete(C)}}return{checkedKeys:Array.from(m),indeterminateKeys:Array.from(g)}}function rs(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&&Rf(d,u=>{if(u.disabled)return La.STOP;const{key:f}=u;if(!a.has(f)&&(a.add(f),l.add(f),YC(u.rawNode,s))){if(r)return La.STOP;if(!i)throw new JC}})}),l}function iv(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 rv(n){if(n.length===0)return null;const e=n[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function ov(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 Pf(n,e,{loop:i=!1,includeDisabled:r=!1}={}){const o=e==="prev"?sv:ov,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=qa(d,s);u!==null?l=u:c(o(d,i))}else{const u=o(d,!1);if(u!==null)c(u);else{const f=av(d);f!=null&&f.isGroup?c(o(f,i)):i&&c(o(d,!0))}}}}return c(n),l}function sv(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 av(n){return n.parent}function qa(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=qa(d,e);if(u!==null)return u}else return d}}return null}const lv={getChild(){return this.ignored?null:qa(this)},getParent(){const{parent:n}=this;return n!=null&&n.isGroup?n.getParent():n},getNext(n={}){return Pf(this,"next",n)},getPrev(n={}){return Pf(this,"prev",n)}};function cv(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 dv(n,e){const i=n.key;for(;e;){if(e.key===i)return!0;e=e.parent}return!1}var uv={};function Ff(n,e,i,r,o,s=null,a=0){const l=[];return n.forEach((c,d)=>{var u;uv.NODE_ENV!=="production"&&UC(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=Ff(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 fv(n,e={}){var i;const r=new Map,o=new Map,{getDisabled:s=XC,getIgnored:a=jC,getIsGroup:l=ZC,getKey:c=WC}=e,d=(i=e.getChildren)!==null&&i!==void 0?i:HC,u=e.ignoreEmptyChildren?w=>{const C=d(w);return Array.isArray(C)?C.length?C:null:C}: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 LC(this.rawNode,u)},get shallowLoaded(){return qC(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(w){return dv(this,w)}},lv),h=Ff(n,r,o,f,u);function p(w){if(w==null)return null;const C=r.get(w);return C&&!C.isGroup&&!C.ignored?C:null}function m(w){if(w==null)return null;const C=r.get(w);return C&&!C.ignored?C:null}function g(w,C){const N=m(w);return N?N.getPrev(C):null}function b(w,C){const N=m(w);return N?N.getNext(C):null}function y(w){const C=m(w);return C?C.getParent():null}function _(w){const C=m(w);return C?C.getChild():null}const x={treeNodes:h,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(w){return cv(h,w)},getNode:p,getPrev:g,getNext:b,getParent:y,getChild:_,getFirstAvailableNode(){return rv(h)},getPath(w,C={}){return iv(w,C,x)},getCheckedKeys(w,C={}){const{cascade:N=!0,leafOnly:k=!1,checkStrategy:$="all",allowNotLoaded:v=!1}=C;return ja({checkedKeys:Ha(w),indeterminateKeys:Wa(w),cascade:N,leafOnly:k,checkStrategy:$,allowNotLoaded:v},x)},check(w,C,N={}){const{cascade:k=!0,leafOnly:$=!1,checkStrategy:v="all",allowNotLoaded:E=!1}=N;return ja({checkedKeys:Ha(C),indeterminateKeys:Wa(C),keysToCheck:w==null?[]:Ef(w),cascade:k,leafOnly:$,checkStrategy:v,allowNotLoaded:E},x)},uncheck(w,C,N={}){const{cascade:k=!0,leafOnly:$=!1,checkStrategy:v="all",allowNotLoaded:E=!1}=N;return ja({checkedKeys:Ha(C),indeterminateKeys:Wa(C),keysToUncheck:w==null?[]:Ef(w),cascade:k,leafOnly:$,checkStrategy:v,allowNotLoaded:E},x)},getNonLeafKeys(w={}){return DC(h,w)}};return x}function os(n){return n.composedPath()[0]}const hv={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function mv(n,e,i){if(n==="mousemoveoutside"){const r=o=>{e.contains(os(o))||i(o)};return{mousemove:r,touchstart:r}}else if(n==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(os(a))},s=a=>{r&&(e.contains(os(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 Vf(n,e,i){const r=hv[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=mv(n,e,i)),s}function pv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=Vf(n,e,i);return Object.keys(o).forEach(s=>{Lt(s,document,o[s],r)}),!0}return!1}function gv(n,e,i,r){if(n==="mousemoveoutside"||n==="clickoutside"){const o=Vf(n,e,i);return Object.keys(o).forEach(s=>{yt(s,document,o[s],r)}),!0}return!1}function yv(){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(k,$,v){const E=k[$];return k[$]=function(){return v.apply(k,arguments),E.apply(k,arguments)},k}function s(k,$){k[$]=Event.prototype[$]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var k;return(k=a.get(this))!==null&&k!==void 0?k:null}function d(k,$){l!==void 0&&Object.defineProperty(k,"currentTarget",{configurable:!0,enumerable:!0,get:$??l.get})}const u={bubble:{},capture:{}},f={};function h(){const k=function($){const{type:v,eventPhase:E,bubbles:P}=$,F=os($);if(E===2)return;const R=E===1?"capture":"bubble";let M=F;const X=[];for(;M===null&&(M=window),X.push(M),M!==window;)M=M.parentNode||null;const G=u.capture[v],Z=u.bubble[v];if(o($,"stopPropagation",i),o($,"stopImmediatePropagation",r),d($,c),R==="capture"){if(G===void 0)return;for(let O=X.length-1;O>=0&&!n.has($);--O){const A=X[O],Y=G.get(A);if(Y!==void 0){a.set($,A);for(const H of Y){if(e.has($))break;H($)}}if(O===0&&!P&&Z!==void 0){const H=Z.get(A);if(H!==void 0)for(const T of H){if(e.has($))break;T($)}}}}else if(R==="bubble"){if(Z===void 0)return;for(let O=0;O<X.length&&!n.has($);++O){const A=X[O],Y=Z.get(A);if(Y!==void 0){a.set($,A);for(const H of Y){if(e.has($))break;H($)}}}}s($,"stopPropagation"),s($,"stopImmediatePropagation"),d($)};return k.displayName="evtdUnifiedHandler",k}function p(){const k=function($){const{type:v,eventPhase:E}=$;if(E!==2)return;const P=f[v];P!==void 0&&P.forEach(F=>F($))};return k.displayName="evtdUnifiedWindowEventHandler",k}const m=h(),g=p();function b(k,$){const v=u[k];return v[$]===void 0&&(v[$]=new Map,window.addEventListener($,m,k==="capture")),v[$]}function y(k){return f[k]===void 0&&(f[k]=new Set,window.addEventListener(k,g)),f[k]}function _(k,$){let v=k.get($);return v===void 0&&k.set($,v=new Set),v}function x(k,$,v,E){const P=u[$][v];if(P!==void 0){const F=P.get(k);if(F!==void 0&&F.has(E))return!0}return!1}function w(k,$){const v=f[k];return!!(v!==void 0&&v.has($))}function C(k,$,v,E){let P;if(typeof E=="object"&&E.once===!0?P=G=>{N(k,$,P,E),v(G)}:P=v,pv(k,$,P,E))return;const R=E===!0||typeof E=="object"&&E.capture===!0?"capture":"bubble",M=b(R,k),X=_(M,$);if(X.has(P)||X.add(P),$===window){const G=y(k);G.has(P)||G.add(P)}}function N(k,$,v,E){if(gv(k,$,v,E))return;const F=E===!0||typeof E=="object"&&E.capture===!0,R=F?"capture":"bubble",M=b(R,k),X=_(M,$);if($===window&&!x($,F?"bubble":"capture",k,v)&&w(k,v)){const Z=f[k];Z.delete(v),Z.size===0&&(window.removeEventListener(k,g),f[k]=void 0)}X.has(v)&&X.delete(v),X.size===0&&M.delete($),M.size===0&&(window.removeEventListener(k,m,R==="capture"),u[R][k]=void 0)}return{on:C,off:N}}const{on:Lt,off:yt}=yv(),br="@@mmoContext",bv={mounted(n,{value:e}){n[br]={handler:void 0},typeof e=="function"&&(n[br].handler=e,Lt("mousemoveoutside",n,e))},updated(n,{value:e}){const i=n[br];typeof e=="function"?i.handler?i.handler!==e&&(yt("mousemoveoutside",n,i.handler),i.handler=e,Lt("mousemoveoutside",n,e)):(n[br].handler=e,Lt("mousemoveoutside",n,e)):i.handler&&(yt("mousemoveoutside",n,i.handler),i.handler=void 0)},unmounted(n){const{handler:e}=n[br];e&&yt("mousemoveoutside",n,e),n[br].handler=void 0}},_r="@@coContext",ss={mounted(n,{value:e,modifiers:i}){n[_r]={handler:void 0},typeof e=="function"&&(n[_r].handler=e,Lt("clickoutside",n,e,{capture:i.capture}))},updated(n,{value:e,modifiers:i}){const r=n[_r];typeof e=="function"?r.handler?r.handler!==e&&(yt("clickoutside",n,r.handler,{capture:i.capture}),r.handler=e,Lt("clickoutside",n,e,{capture:i.capture})):(n[_r].handler=e,Lt("clickoutside",n,e,{capture:i.capture})):r.handler&&(yt("clickoutside",n,r.handler,{capture:i.capture}),r.handler=void 0)},unmounted(n,{modifiers:e}){const{handler:i}=n[_r];i&&yt("clickoutside",n,i,{capture:e.capture}),n[_r].handler=void 0}};function _v(n,e){console.error(`[vdirs/${n}]: ${e}`)}class wv{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&&_v("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 Xa=new wv,wr="@@ziContext",Mf={mounted(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i;n[wr]={enabled:!!o,initialized:!1},o&&(Xa.ensureZIndex(n,r),n[wr].initialized=!0)},updated(n,e){const{value:i={}}=e,{zIndex:r,enabled:o}=i,s=n[wr].enabled;o&&!s&&(Xa.ensureZIndex(n,r),n[wr].initialized=!0),n[wr].enabled=!!o},unmounted(n,e){if(!n[wr].initialized)return;const{value:i={}}=e,{zIndex:r}=i;Xa.unregister(n,r)}};function xv(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 fn(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 kv=typeof window<"u";let xr,Xr;(()=>{var n,e;xr=kv?(e=(n=document)===null||n===void 0?void 0:n.fonts)===null||e===void 0?void 0:e.ready:void 0,Xr=!1,xr!==void 0?xr.then(()=>{Xr=!0}):Xr=!0})();function Cv(n){if(Xr)return;let e=!1;t.onMounted(()=>{Xr||xr==null||xr.then(()=>{e||n()})}),t.onBeforeUnmount(()=>{e=!0})}function Ya(n,e){return t.watch(n,i=>{i!==void 0&&(e.value=i)}),t.computed(()=>n.value===void 0?e.value:n.value)}function as(){const n=t.ref(!1);return t.onMounted(()=>{n.value=!0}),t.readonly(n)}function If(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 vv=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function Sv(){return vv}function Ua(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);return r()}function Ka(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)){Ka(r,e,i);return}if(r.type===t.Fragment){if(r.children===null)return;Array.isArray(r.children)&&Ka(r.children,e,i)}else r.type!==t.Comment&&i.push(r)}}),i}function Af(n,e,i="default"){const r=e[i];if(r===void 0)throw new Error(`[vueuc/${n}]: slot[${i}] is empty.`);const o=Ka(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${n}]: slot[${i}] should have exactly one child.`)}let gi=null;function Of(){if(gi===null&&(gi=document.getElementById("v-binder-view-measurer"),gi===null)){gi=document.createElement("div"),gi.id="v-binder-view-measurer";const{style:n}=gi;n.position="fixed",n.left="0",n.right="0",n.top="0",n.bottom="0",n.pointerEvents="none",n.visibility="hidden",document.body.appendChild(gi)}return gi.getBoundingClientRect()}function Bv(n,e){const i=Of();return{top:e,left:n,height:0,width:0,right:i.width-n,bottom:i.height-e}}function Ga(n){const e=n.getBoundingClientRect(),i=Of();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 Nv(n){return n.nodeType===9?null:n.parentNode}function zf(n){if(n===null)return null;const e=Nv(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 zf(e)}const Df=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=zf(y),y!==null;)s.push(y);for(const _ of s)Lt("scroll",_,f,!0)},l=()=>{for(const y of s)yt("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=()=>{vf(h)},h=()=>{c.forEach(y=>y())},p=new Set,m=y=>{p.size===0&&Lt("resize",window,b),p.has(y)||p.add(y)},g=y=>{p.has(y)&&p.delete(y),p.size===0&&yt("resize",window,b)},b=()=>{p.forEach(y=>y())};return t.onBeforeUnmount(()=>{yt("resize",window,b),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:m,removeResizeListener:g}},render(){return Ua("binder",this.$slots)}}),Lf=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(Af("follower",this.$slots),[[e]]):Af("follower",this.$slots)}}),Tv="@css-render/vue3-ssr";function $v(n,e){return`<style cssr-id="${n}">
|
|
104
104
|
${e}
|
|
105
105
|
</style>`}function Ev(n,e,i){const{styles:r,ids:o}=i;o.has(n)||r!==null&&(o.add(n),r.push($v(n,e)))}const Rv=typeof document<"u";function Ii(){if(Rv)return;const n=t.inject(Tv,null);if(n!==null)return{adapter:(e,i)=>Ev(e,i,n),context:n}}function Hf(n,e){console.error(`[vueuc/${n}]: ${e}`)}function Pv(n){let e=0;for(let i=0;i<n.length;++i)n[i]==="&"&&++e;return e}const Wf=/\s*,(?![^(]*\))\s*/g,Fv=/\s+/g;function Vv(n,e){const i=[];return e.split(Wf).forEach(r=>{let o=Pv(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 Mv(n,e){const i=[];return e.split(Wf).forEach(r=>{n.forEach(o=>{i.push((o&&o+" ")+r)})}),i}function Iv(n){let e=[""];return n.forEach(i=>{i=i&&i.trim(),i&&(i.includes("&")?e=Vv(e,i):e=Mv(e,i))}),e.join(", ").replace(Fv," ")}function jf(n){if(!n)return;const e=n.parentElement;e&&e.removeChild(n)}function ls(n,e){return(e??document.head).querySelector(`style[cssr-id="${n}"]`)}function Av(n){const e=document.createElement("style");return e.setAttribute("cssr-id",n),e}function cs(n){return n?/^\s*@(s|m)/.test(n):!1}const Ov=/[A-Z]/g;function qf(n){return n.replace(Ov,e=>"-"+e.toLowerCase())}function zv(n,e=" "){return typeof n=="object"&&n!==null?` {
|
|
106
106
|
`+Object.entries(n).map(i=>e+` ${qf(i[0])}: ${i[1]};`).join(`
|