@snabcentr/vue-ui-lib 4.7.0 → 4.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -100,7 +100,7 @@
100
100
  }
101
101
  gl_FragColor = texel;
102
102
  }
103
- `}},so=Hi.Multiply,xp=[1,0,0,0,1,0,0,0,1],Gn=new hn(9),kp=yt.Utils,Ec=new re,Bs=new hn([0,0,1,0,0,1,0,1,1,0,1,1]),xe={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Xe.document?Xe.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new Hi,group:{removeChild:function(t,e){if(t.children)for(let n=0;n<t.children.length;n++)xe.group.removeChild(t.children[n],e);t._renderer.texture&&(e.deleteTexture(t._renderer.texture),delete t._renderer.texture),t._renderer.positionBuffer&&(e.deleteBuffer(t._renderer.positionBuffer),delete t._renderer.positionBuffer)},render:function(t,e){if(!this._visible)return;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.parent,r=n._matrix&&n._matrix.manual||n._flagMatrix,o=this._matrix.manual||this._flagMatrix;if((r||o)&&(this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Gn),so(Gn,n._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re),this._scale instanceof re?(this._renderer.scale.x=this._scale.x,this._renderer.scale.y=this._scale.y):(this._renderer.scale.x=this._scale,this._renderer.scale.y=this._scale),/renderer/i.test(n._renderer.type)||(this._renderer.scale.x*=n._renderer.scale.x,this._renderer.scale.y*=n._renderer.scale.y),r&&(this._flagMatrix=!0)),this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const a=yt.Utils.getRendererType(this._mask._renderer.type);xe[a].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}this._flagOpacity=n._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);let s;if(this._flagSubtractions)for(s=0;s<this.subtractions.length;s++)xe.group.removeChild(this.subtractions[s],t);for(s=0;s<this.children.length;s++){const a=this.children[s],l=yt.Utils.getRendererType(a._renderer.type);xe[l].render.call(a,t,e)}return this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(t,e){let n,r,o,s,a,l,c,d,u,h,f,g,m,p;const y=e._renderer.vertices,b=this.canvas,_=this.ctx,C=t.renderer.ratio,k=Ec.copy(e._renderer.scale).multiply(C),E=e._stroke,$=e._linewidth,x=e._fill,B=e._renderer.opacity||e._opacity,w=e._cap,T=e._join,N=e._miter,V=e._closed,R=e.dashes,I=y.length,W=I-1;b.width=Math.max(Math.ceil(e._renderer.rect.width*k.x),1),b.height=Math.max(Math.ceil(e._renderer.rect.height*k.y),1);const ee=e._renderer.rect.centroid,ne=ee.x,D=ee.y;if(_.clearRect(0,0,b.width,b.height),x)if(typeof x=="string")_.fillStyle=x;else{const Y=yt.Utils.getRendererType(x._renderer.type);xe[Y].render.call(x,_,e),_.fillStyle=x._renderer.effect}if(E){if(typeof E=="string")_.strokeStyle=E;else{const Y=yt.Utils.getRendererType(E._renderer.type);xe[Y].render.call(E,_,e),_.strokeStyle=E._renderer.effect}$&&(_.lineWidth=fn(e)),N&&(_.miterLimit=N),T&&(_.lineJoin=T),!V&&w&&(_.lineCap=w)}typeof B=="number"&&(_.globalAlpha=B),R&&R.length>0&&(_.lineDashOffset=R.offset||0,_.setLineDash(R));let H,L,A,z,U,K,F,q;_.save(),_.scale(k.x,k.y),_.translate(ne,D),_.beginPath();for(let Y=0;Y<y.length;Y++){const J=y[Y];switch(g=J.x,m=J.y,J.command){case oe.close:_.closePath();break;case oe.arc:L=J.rx,A=J.ry,z=J.xAxisRotation,U=J.largeArcFlag,K=J.sweepFlag,n=V?Dt(Y-1,I):Math.max(Y-1,0),r=y[n],F=r.x,q=r.y,kp.renderSvgArcCommand(_,F,q,L,A,U,K,z,g,m);break;case oe.curve:n=V?Dt(Y-1,I):Math.max(Y-1,0),r=y[n],d=r.controls&&r.controls.right||re.zero,u=J.controls&&J.controls.left||re.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),J._relative?(s=u.x+J.x,a=u.y+J.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,g,m),Y>=W&&V&&(o=H,h=J.controls&&J.controls.right||re.zero,f=o.controls&&o.controls.left||re.zero,J._relative?(l=h.x+J.x,c=h.y+J.y):(l=h.x,c=h.y),o._relative?(s=f.x+o.x,a=f.y+o.y):(s=f.x,a=f.y),g=o.x,m=o.y,_.bezierCurveTo(l,c,s,a,g,m));break;case oe.line:_.lineTo(g,m);break;case oe.move:H=J,_.moveTo(g,m);break}}V&&_.closePath(),xe.isHidden.test(x)||(p=x._renderer&&x._renderer.offset,p&&(_.save(),_.translate(-x._renderer.offset.x,-x._renderer.offset.y),_.scale(x._renderer.scale.x,x._renderer.scale.y)),_.fill(),p&&_.restore()),xe.isHidden.test(E)||(p=E._renderer&&E._renderer.offset,p&&(_.save(),_.translate(-E._renderer.offset.x,-E._renderer.offset.y),_.scale(E._renderer.scale.x,E._renderer.scale.y),_.lineWidth=$/E._renderer.scale.x),_.stroke(),p&&_.restore()),_.restore()},getBoundingClientRect:function(t,e,n){let r=1/0,o=-1/0,s=1/0,a=-1/0,l,c;t.forEach(function(d){const u=d.x,h=d.y,f=d.controls;let g,m,p,y,b,_;s=Math.min(h,s),r=Math.min(u,r),o=Math.max(u,o),a=Math.max(h,a),d.controls&&(b=f.left,_=f.right,!(!b||!_)&&(g=d._relative?b.x+u:b.x,m=d._relative?b.y+h:b.y,p=d._relative?_.x+u:_.x,y=d._relative?_.y+h:_.y,!(!g||!m||!p||!y)&&(s=Math.min(m,y,s),r=Math.min(g,p,r),o=Math.max(g,p,o),a=Math.max(m,y,a))))}),typeof e=="number"&&(s-=e,r-=e,o+=e,a+=e),l=o-r,c=a-s,n.top=s,n.left=r,n.right=o,n.bottom=a,n.width=l,n.height=c,n.centroid||(n.centroid={}),n.centroid.x=-r,n.centroid.y=-s},render:function(t,e,n){if(!this._visible||!this._opacity)return this;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,o=yt.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 Ye&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Oe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ye&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(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 hn(9)),this._matrix.toTransformArray(!0,Gn),so(Gn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let h,f;this._scale instanceof re?(h=this._scale.x*r._renderer.scale.x,f=this._scale.y*r._renderer.scale.y):(h=this._scale*r._renderer.scale.x,f=this._scale*r._renderer.scale.y),this._renderer.scale.x=h<0?-h:h,this._renderer.scale.y=f<0?-f:f,c&&(this._renderer.parent=r)}if(this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const h=yt.Utils.getRendererType(this._mask._renderer.type);xe[h].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}if(d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,xe.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),xe.updateTexture.call(xe,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==s&&(t.useProgram(s),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,Bs,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const u=this._renderer.rect;return t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform4f(s.rect,u.left,u.top,u.right,u.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(t,e){let n;const r=this.canvas,o=this.ctx,s=t.renderer.ratio,a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,h=e._size*s;let f=h;xe.isHidden.test(a)||(f+=l),r.width=_l(f),r.height=r.width;const g=f/r.width,m=r.width/2,p=r.height/2;if(o.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")o.fillStyle=c;else{const y=yt.Utils.getRendererType(c._renderer.type);xe[y].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const y=yt.Utils.getRendererType(a._renderer.type);xe[y].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=fn(e)/g)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(m,p),o.scale(xe.precision,xe.precision),o.beginPath(),o.arc(0,0,h/g*.5,0,gt),o.restore(),closed&&o.closePath(),xe.isHidden.test(c)||(n=c._renderer&&c._renderer.offset,n&&(o.save(),o.translate(-c._renderer.offset.x,-c._renderer.offset.y),o.scale(c._renderer.scale.x,c._renderer.scale.y)),o.fill(),n&&o.restore()),xe.isHidden.test(a)||(n=a._renderer&&a._renderer.offset,n&&(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(),n&&o.restore())},render:function(t,e,n){if(!this._visible||!this._opacity)return this;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const o=n||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,h=this._renderer.parent!==o,f=this._renderer.vertices,g=this._renderer.collection.length,m=this._flagVertices,p=this._flagFill||this._fill instanceof Ye&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Oe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ye&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(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||h){this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Gn),so(Gn,o._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let y,b;this._scale instanceof re?(y=this._scale.x*o._renderer.scale.x,b=this._scale.y*o._renderer.scale.y):(y=this._scale*o._renderer.scale.x,b=this._scale*o._renderer.scale.y),this._renderer.scale.x=y<0?-y:y,this._renderer.scale.y=b<0?-b:b,h&&(this._renderer.parent=o)}if(m){const y=this._renderer.positionBuffer;y&&t.deleteBuffer(y),this._renderer.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this._renderer.positionBuffer),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,f,t.STATIC_DRAW)}return p?(this._renderer.opacity=this._opacity*o._renderer.opacity,xe.updateTexture.call(xe,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture?this:(xe.isHidden.test(l)||(r+=c),r/=xe.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),e.current!==s&&(t.useProgram(s),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture),t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform1f(s.size,r*e.resolution.ratio),t.drawArrays(t.POINTS,0,g),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(t,e){const n=this.canvas,r=this.ctx,o=t.renderer.ratio,s=Ec.copy(e._renderer.scale).multiply(o),a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,h=e._decoration,f=e._direction;n.width=Math.max(Math.ceil(e._renderer.rect.width*s.x),1),n.height=Math.max(Math.ceil(e._renderer.rect.height*s.y),1);const g=e._renderer.rect.centroid,m=g.x,p=g.y;let y,b,_,C,k,E,$,x,B,w,T;const N=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,n.width,n.height),N||(r.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=f,c)if(typeof c=="string")r.fillStyle=c;else{const V=yt.Utils.getRendererType(c._renderer.type);xe[V].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const V=yt.Utils.getRendererType(a._renderer.type);xe[V].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=fn(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,p),xe.isHidden.test(c)||(c._renderer&&c._renderer.offset?(E=c._renderer.scale.x,$=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(E,$),y=e._size/c._renderer.scale.y,b=e._leading/c._renderer.scale.y,r.font=[e._style,e._weight,y+"px/",b+"px",e._family].join(" "),_=c._renderer.offset.x/c._renderer.scale.x,C=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,C),r.restore()):r.fillText(e.value,0,0)),xe.isHidden.test(a)||(a._renderer&&a._renderer.offset?(E=a._renderer.scale.x,$=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(E,$),y=e._size/a._renderer.scale.y,b=e._leading/a._renderer.scale.y,r.font=[e._style,e._weight,y+"px/",b+"px",e._family].join(" "),_=a._renderer.offset.x/a._renderer.scale.x,C=a._renderer.offset.y/a._renderer.scale.y,k=l/a._renderer.scale.x,r.lineWidth=k,r.strokeText(e.value,_,C),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(h)){const V=r.measureText(e.value);switch(h){case"underline":B=V.actualBoundingBoxDescent,T=V.actualBoundingBoxDescent;break;case"strikethrough":B=0,T=0;break}x=-V.width/2,w=V.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(x,B),r.lineTo(w,T),r.stroke()}r.restore()},getBoundingClientRect:function(t,e){const n=xe.ctx;n.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" "),n.textAlign="center",n.textBaseline=yt.Utils.baselines[t._baseline]||t._baseline;const r=n.measureText(t._value);let o=r.width,s=1.15*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent);this._linewidth&&!xe.isHidden.test(this._stroke)&&(o+=this._linewidth*2,s+=this._linewidth*2);const a=o/2,l=s/2;switch(xe.alignments[t._alignment]||t._alignment){case xe.alignments.left:t.direction==="ltr"?(e.left=0,e.right=o):(e.left=-o,e.right=0);break;case xe.alignments.right:t.direction==="ltr"?(e.left=-o,e.right=0):(e.left=0,e.right=o);break;default:e.left=-a,e.right=a}switch(t._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(t,e,n){if(!this._visible||!this._opacity)return this;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||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 Ye&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Oe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ye&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(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 hn(9)),this._matrix.toTransformArray(!0,Gn),so(Gn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let u,h;this._scale instanceof re?(u=this._scale.x*r._renderer.scale.x,h=this._scale.y*r._renderer.scale.y):(u=this._scale*r._renderer.scale.x,h=this._scale*r._renderer.scale.y),this._renderer.scale.x=u<0?-u:u,this._renderer.scale.y=h<0?-h:h,l&&(this._renderer.parent=r)}if(this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const u=yt.Utils.getRendererType(this._mask._renderer.type);xe[u].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}if(c?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,xe.text.getBoundingClientRect(this,this._renderer.rect),xe.updateTexture.call(xe,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==o&&(t.useProgram(o),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(o.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o.position),t.bufferData(t.ARRAY_BUFFER,Bs,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return t.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),t.uniform4f(o.rect,d.left,d.top,d.right,d.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let n,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(n=e.getBoundingClientRect(!0),r=(r-.5)*n.width,o=(o-.5)*n.height,s=(s-.5)*n.width,a=(a-.5)*n.height),this._renderer.effect=t.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let n,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(n=e.getBoundingClientRect(!0),r=(r-.5)*n.width*.5,o=(o-.5)*n.height*.5,s=(s-.5)*n.width*.5,a=(a-.5)*n.height*.5,l*=Math.min(n.width,n.height)),this._renderer.effect=t.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(t,e){if(!t.canvas.getContext("2d"))return;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=t.createPattern(n,this._repeat);else if(!this._renderer.effect)return this.flagReset();if((this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof re||(this._renderer.offset=new re),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,n&&(this._renderer.offset.x+=n.width/2,this._renderer.offset.y+=n.height/2,this._scale instanceof re?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),this._flagScale||this._flagLoaded){this._renderer.scale instanceof re||(this._renderer.scale=new re);let r,o;this._scale instanceof re?(r=this._scale.x,o=this._scale.y):(r=this._scale,o=this._scale),this._renderer.scale.x=r<0?-r:r,this._renderer.scale.y=o<0?-o:o}return ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(t,e){const n=yt.Utils.getRendererType(e._renderer.type);if(this[n].updateCanvas.call(xe,t,e),this.canvas.width<=0||this.canvas.height<=0){e._renderer.texture&&t.deleteTexture(e._renderer.texture),delete e._renderer.texture;return}e._renderer.texture||(e._renderer.texture=t.createTexture()),t.bindTexture(t.TEXTURE_2D,e._renderer.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.canvas),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR)},program:{create:function(t,e){let n,r,o;if(n=t.createProgram(),ie.each(e,function(s){t.attachShader(n,s)}),t.linkProgram(n),r=t.getProgramParameter(n,t.LINK_STATUS),!r)throw o=t.getProgramInfoLog(n),t.deleteProgram(n),new Mt("unable to link program: "+o);return n}},extensions:{init:function(t){const e={},n=["EXT_texture_filter_anisotropic","WEBGL_compressed_texture_s3tc","OES_texture_float_linear","WEBGL_multisampled_render_to_texture"];for(let r=0;r<n.length;r++){const o=n[r];e[o]=xe.extensions.get(t,o)}return e},get:function(t,e){return t.getExtension(e)||t.getExtension(`MOZ_${e}`)||t.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new qr};xe.ctx=xe.canvas.getContext("2d");var Rc=class extends Z{constructor(t){super();let e,n,r,o;if(this.domElement=t.domElement||document.createElement("canvas"),typeof t.offscreenElement<"u"&&(xe.canvas=t.offscreenElement,xe.ctx=xe.canvas.getContext("2d")),this.scene=new ct,this.scene.parent=this,this._renderer={type:"renderer",matrix:new hn(xp),scale:1,opacity:1},this._flagMatrix=!0,t=ie.defaults(t||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=t.overdraw,e=this.ctx=this.domElement.getContext("webgl",t)||this.domElement.getContext("experimental-webgl",t),!this.ctx)throw new Mt("unable to create a webgl context. Try using another renderer.");r=Kt.create(e,Kt.path.vertex,Kt.types.vertex),o=Kt.create(e,Kt.path.fragment,Kt.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},n=this.programs.path=xe.program.create(e,[r,o]),this.programs.text=this.programs.path,e.extensions=xe.extensions.init(e),e.renderer=this,n.position=e.getAttribLocation(n,"a_position"),n.matrix=e.getUniformLocation(n,"u_matrix"),n.rect=e.getUniformLocation(n,"u_rect");const s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(n.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n.position),e.bufferData(e.ARRAY_BUFFER,Bs,e.STATIC_DRAW),r=Kt.create(e,Kt.points.vertex,Kt.types.vertex),o=Kt.create(e,Kt.points.fragment,Kt.types.fragment),n=this.programs.points=xe.program.create(e,[r,o]),n.position=e.getAttribLocation(n,"a_position"),n.matrix=e.getUniformLocation(n,"u_matrix"),n.size=e.getUniformLocation(n,"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(t,e,n){let r,o;const s=this.ctx;return this.width=t,this.height=e,this.ratio=typeof n>"u"?ns(s):n,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,ie.isObject(this.domElement.style)&&ie.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=t*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(Z.Types.resize,t,e,n)}render(){const t=this.ctx;return this.overdraw||t.clear(t.COLOR_BUFFER_BIT),xe.group.render.call(this.scene,t,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};v(Rc,"Utils",xe);var vp=ie.extend({Error:Mt,getRatio:ns,read:qe,xhr:Cc},ie,Bt,gl,pl),Ce=class Dr{constructor(e){v(this,"_events",new Z),v(this,"type",""),v(this,"renderer",null),v(this,"scene",null),v(this,"width",0),v(this,"height",0),v(this,"frameCount",0),v(this,"timeDelta",0),v(this,"playing",!1);const n=ie.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:Dr.Types.svg,autostart:!1});if(ie.each(n,function(r,o){/fullscreen/i.test(o)||/autostart/i.test(o)||(this[o]=r)},this),ie.isElement(n.domElement)){const r=n.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=Dr.Types[r])}this.renderer=new Dr[this.type](this),this.setPlaying(n.autostart),this.frameCount=0,n.fullscreen?(this.fit=Cp.bind(this),this.fit.domElement=window,this.fit.attached=!0,ie.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),ie.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),Lt.bind(this.fit.domElement,"resize",this.fit),this.fit()):n.fitted?(this.fit=Sp.bind(this),ie.extend(this.renderer.domElement.style,{display:"block"})):typeof n.width=="number"&&typeof n.height=="number"&&(this.renderer.setSize(n.width,n.height,this.ratio),this.width=n.width,this.height=n.height),this.renderer.bind(Z.Types.resize,Bp.bind(this)),this.scene=this.renderer.scene,Dr.Instances.push(this),n.autostart&&gr.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){return this._events.addEventListener.apply(this,arguments)}on(){return this._events.addEventListener.apply(this,arguments)}bind(){return this._events.addEventListener.apply(this,arguments)}removeEventListener(){return this._events.removeEventListener.apply(this,arguments)}off(){return this._events.removeEventListener.apply(this,arguments)}unbind(){return this._events.removeEventListener.apply(this,arguments)}dispatchEvent(){return this._events.dispatchEvent.apply(this,arguments)}trigger(){return this._events.dispatchEvent.apply(this,arguments)}listen(){return this._events.listen.apply(this,arguments)}ignore(){return this._events.ignore.apply(this,arguments)}appendTo(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,gr.init(),this.trigger(Z.Types.play)}pause(){return this.playing=!1,this.trigger(Z.Types.pause)}setPlaying(e){this.playing=e}release(e){let n,r,o;if(typeof e>"u")return this.release(this.scene);if(typeof e.unbind=="function"&&e.unbind(),typeof e.fill=="object"&&"unbind"in e.fill&&e.fill.unbind(),typeof e.stroke=="object"&&"unbind"in e.stroke&&e.stroke.unbind(),e.vertices){if(typeof e.vertices.unbind=="function")try{e.vertices.unbind()}catch{}for(n=0;n<e.vertices.length;n++)r=e.vertices[n],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(n=0;n<e.children.length;n++)o=e.children[n],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}update(){const e=!!this._lastFrame,n=ie.performance.now();e&&(this.timeDelta=parseFloat((n-this._lastFrame).toFixed(3))),this._lastFrame=n,this.fit&&this.fit.domElement&&!this.fit.attached&&(Lt.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(Z.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(Z.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,n,r,o){const s=new to(e,n,r,o);return this.scene.add(s),s}makeArrow(e,n,r,o,s){const a=typeof s=="number"?s:10,l=Math.atan2(o-n,r-e),c=[new Be(e,n,void 0,void 0,void 0,void 0,oe.move),new Be(r,o,void 0,void 0,void 0,void 0,oe.line),new Be(r-a*Math.cos(l-Math.PI/4),o-a*Math.sin(l-Math.PI/4),void 0,void 0,void 0,void 0,oe.line),new Be(r,o,void 0,void 0,void 0,void 0,oe.move),new Be(r-a*Math.cos(l+Math.PI/4),o-a*Math.sin(l+Math.PI/4),void 0,void 0,void 0,void 0,oe.line)],d=new $e(c,!1,!1,!0);return d.noFill(),d.cap="round",d.join="round",this.scene.add(d),d}makeRectangle(e,n,r,o){const s=new Kn(e,n,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,n,r,o,s){const a=new Qr(e,n,r,o,s);return this.scene.add(a),a}makeCircle(e,n,r,o){const s=new Gr(e,n,r,o);return this.scene.add(s),s}makeEllipse(e,n,r,o,s){const a=new Zr(e,n,r,o,s);return this.scene.add(a),a}makeStar(e,n,r,o,s){const a=new ys(e,n,r,o,s);return this.scene.add(a),a}makeCurve(e){const n=arguments.length;if(!Array.isArray(e)){e=[];for(let a=0;a<n;a+=2){const l=arguments[a];if(typeof l!="number")break;const c=arguments[a+1];e.push(new Be(l,c))}}const r=arguments[n-1],o=new $e(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,n,r,o){const s=new ps(e,n,r,o);return this.scene.add(s),s}makeArcSegment(e,n,r,o,s,a,l){const c=new ds(e,n,r,o,s,a,l);return this.scene.add(c),c}makePoints(e){const n=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let s=0;s<n;s+=2){const a=arguments[s];if(typeof a!="number")break;const l=arguments[s+1];r.push(new re(a,l))}}const o=new gs(r);return this.scene.add(o),o}makePath(e){const n=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let l=0;l<n;l+=2){const c=arguments[l];if(typeof c!="number")break;const d=arguments[l+1];r.push(new Be(c,d))}}const o=arguments[n-1],s=new $e(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,n,r,o){const s=new mn(e,n,r,o);return this.add(s),s}makeLinearGradient(e,n,r,o){const s=Array.prototype.slice.call(arguments,4),a=new Ye(e,n,r,o,s);return this.add(a),a}makeRadialGradient(e,n,r){const o=Array.prototype.slice.call(arguments,3),s=new Ue(e,n,r,o);return this.add(s),s}makeSprite(e,n,r,o,s,a,l){const c=new Kr(e,n,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,n,r,o,s,a){const l=new Sc(e,n,r,o,s,a);return this.add(l),l}makeImageSequence(e,n,r,o,s){const a=new xs(e,n,r,o);return s&&a.play(),this.add(a),a}makeTexture(e,n){return new Oe(e,n)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const n=new ct;return this.scene.add(n),n.add(e),n}interpret(e,n,r){const o=e.tagName.toLowerCase();if(r=typeof r<"u"?r:!0,!(o in qe))return null;const s=qe[o].call(this,e);return r?this.add(n&&s instanceof ct?s.children:s):s.parent&&s.remove(),s}load(e,n){const r=new ct;let o,s,a;const l=(function(c){for(Lt.temp.innerHTML=c,s=0;s<Lt.temp.children.length;s++)o=Lt.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof n=="function"){const d=Lt.temp.children.length<=1?Lt.temp.children[0]:Lt.temp.children;n(r,d)}}).bind(this);return/\.svg$/i.test(e)?(Cc(e,l),r):(l(e),r)}};v(Ce,"NextFrameId",Tt.NextFrameId),v(Ce,"Types",Tt.Types),v(Ce,"Version",Tt.Version),v(Ce,"PublishDate",Tt.PublishDate),v(Ce,"Identifier",Tt.Identifier),v(Ce,"Resolution",Tt.Resolution),v(Ce,"AutoCalculateImportedMatrices",Tt.AutoCalculateImportedMatrices),v(Ce,"Instances",Tt.Instances),v(Ce,"uniqueId",Tt.uniqueId),v(Ce,"Anchor",Be),v(Ce,"Collection",Xn),v(Ce,"Events",Z),v(Ce,"Group",ct),v(Ce,"Matrix",Hi),v(Ce,"Path",$e),v(Ce,"Registry",qr),v(Ce,"Element",Li),v(Ce,"Shape",Un),v(Ce,"Text",mn),v(Ce,"Vector",re),v(Ce,"Gradient",ot),v(Ce,"Image",Sc),v(Ce,"ImageSequence",xs),v(Ce,"LinearGradient",Ye),v(Ce,"RadialGradient",Ue),v(Ce,"Sprite",Kr),v(Ce,"Stop",Yn),v(Ce,"Texture",Oe),v(Ce,"ArcSegment",ds),v(Ce,"Circle",Gr),v(Ce,"Ellipse",Zr),v(Ce,"Line",to),v(Ce,"Points",gs),v(Ce,"Polygon",ps),v(Ce,"Rectangle",Kn),v(Ce,"RoundedRectangle",Qr),v(Ce,"Star",ys),v(Ce,"CanvasRenderer",yt),v(Ce,"SVGRenderer",$c),v(Ce,"WebGLRenderer",Rc),v(Ce,"Commands",oe),v(Ce,"Utils",vp);var pn=Ce;function Cp(){const t=document.body.getBoundingClientRect(),e=this.width=t.width,n=this.height=t.height;this.renderer.setSize(e,n,this.ratio)}function Sp(){const t=this.renderer.domElement.parentElement;if(!t){console.warn("Two.js: Attempting to fit to parent, but no parent found.");return}const e=t.getBoundingClientRect(),n=this.width=e.width,r=this.height=e.height;this.renderer.setSize(n,r,this.ratio)}function Bp(t,e){this.width=t,this.height=e,this.trigger(Z.Types.resize,t,e)}var gr=Lt.getRequestAnimationFrame();function Pc(){for(let t=0;t<pn.Instances.length;t++){const e=pn.Instances[t];e.playing&&e.update()}pn.NextFrameId=gr(Pc)}gr.init=function(){Pc(),gr.init=function(){}};let yn;typeof window<"u"?yn=window:typeof global<"u"?yn=global:typeof self<"u"&&(yn=self);let Fc;const ui=Math.PI*2,dt=Math.PI*.5;function Tp(t,e,n,r,o,s){let a;return arguments.length<=1?(a=t.a,e=t.b,n=t.c,r=t.d,o=t.e,s=t.f):a=t,{translateX:o,translateY:s,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(n*n+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function Np(t){Fc=t}function $p(t,e){e=e&&e.identity()||new Fc;let n=t;const r=[];for(;n&&n._matrix;)r.push(n._matrix),n=n.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Gt(t,e,n){return n*(e-t)+t}function qi(t,e){for(;t<0;)t+=e;return t%e}const Vc=yn.Float32Array||Array,Ep=Math.floor;function bn(t){return Ep(t*1e6)/1e6}const pe={move:"M",line:"L",curve:"C",close:"Z"};class te{constructor(){S(this,"_events",{});S(this,"_bound",!1)}addEventListener(e,n){return(this._events[e]||(this._events[e]=[])).push(n),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,n){if(!this._events)return this;if(!e&&!n)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(n)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,n!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const n=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...n);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,n,r){const o=this;e&&(s.obj=e,s.name=n,s.handler=r,e.on(n,s));function s(){r.apply(o,arguments)}return o}ignore(e,n,r){return e.off(n,r),this}}S(te,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),S(te,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Ic={x:{enumerable:!0,get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this._bound&&this.dispatchEvent(te.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this._bound&&this.dispatchEvent(te.Types.change))}}},ht=class ht extends te{constructor(n=0,r=0){super();S(this,"_x",0);S(this,"_y",0);for(let o in Ic)Object.defineProperty(this,o,Ic[o]);this.x=n,this.y=r}static add(n,r){return new ht(n.x+r.x,n.y+r.y)}static sub(n,r){return new ht(n.x-r.x,n.y-r.y)}static subtract(n,r){return ht.sub(n,r)}static ratioBetween(n,r){return(n.x*r.x+n.y*r.y)/(n.length()*r.length())}static angleBetween(n,r){if(arguments.length>=4){const a=arguments[0]-arguments[2],l=arguments[1]-arguments[3];return Math.atan2(l,a)}const o=n.x-r.x,s=n.y-r.y;return Math.atan2(s,o)}static distanceBetween(n,r){return Math.sqrt(ht.distanceBetweenSquared(n,r))}static distanceBetweenSquared(n,r){const o=n.x-r.x,s=n.y-r.y;return o*o+s*s}set(n,r){return this.x=n,this.y=r,this}copy(n){return this.x=n.x,this.y=n.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new ht(this.x,this.y)}add(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x+=n,this.y+=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x+=n.x,this.y+=n.y):(this.x+=n,this.y+=r),this)}addSelf(n){return this.add.apply(this,arguments)}sub(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x-=n,this.y-=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x-=n.x,this.y-=n.y):(this.x-=n,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(n){return this.sub.apply(this,arguments)}subtractSelf(n){return this.sub.apply(this,arguments)}multiply(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x*=n,this.y*=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x*=n.x,this.y*=n.y):(this.x*=n,this.y*=r),this)}multiplySelf(n){return this.multiply.apply(this,arguments)}multiplyScalar(n){return this.multiply(n)}divide(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x/=n,this.y/=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x/=n.x,this.y/=n.y):(this.x/=n,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(n){return this.divide.apply(this,arguments)}divideScalar(n){return this.divide(n)}negate(){return this.multiply(-1)}dot(n){return this.x*n.x+this.y*n.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(n){return Math.sqrt(this.distanceToSquared(n))}distanceToSquared(n){const r=this.x-n.x,o=this.y-n.y;return r*r+o*o}setLength(n){return this.normalize().multiplyScalar(n)}equals(n,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(n)<r}lerp(n,r){const o=(n.x-this.x)*r+this.x,s=(n.y-this.y)*r+this.y;return this.set(o,s)}isZero(n){return n=typeof n>"u"?1e-4:n,this.length()<n}toString(){return this.x+", "+this.y}toObject(){return{x:bn(this.x),y:bn(this.y)}}rotate(n){const r=this.x,o=this.y,s=Math.cos(n),a=Math.sin(n);return this.x=r*s-o*a,this.y=r*a+o*s,this}};S(ht,"zero",new ht),S(ht,"left",new ht(-1,0)),S(ht,"right",new ht(1,0)),S(ht,"up",new ht(0,-1)),S(ht,"down",new ht(0,1));let be=ht;class Fe extends be{constructor(n=0,r=0,o=0,s=0,a=0,l=0,c=pe.move){super(n,r);S(this,"controls",{left:new be,right:new be});S(this,"_command",pe.move);S(this,"_relative",!0);S(this,"_rx",0);S(this,"_ry",0);S(this,"_xAxisRotation",0);S(this,"_largeArcFlag",0);S(this,"_sweepFlag",1);for(let u in Mc)Object.defineProperty(this,u,Mc[u]);this.command=c,this.relative=!0;const d=Fe.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(n){return r;function r(){n._bound&&n.dispatchEvent(te.Types.change)}}static fromObject(n){return new Fe().copy(n)}copy(n){return this.x=n.x,this.y=n.y,typeof n.command=="string"&&(this.command=n.command),n.controls&&(n.controls.left&&this.controls.left.copy(n.controls.left),n.controls.right&&this.controls.right.copy(n.controls.right)),typeof n.relative=="boolean"&&(this.relative=n.relative),typeof n.rx=="number"&&(this.rx=n.rx),typeof n.ry=="number"&&(this.ry=n.ry),typeof n.xAxisRotation=="number"&&(this.xAxisRotation=n.xAxisRotation),typeof n.largeArcFlag=="number"&&(this.largeArcFlag=n.largeArcFlag),typeof n.sweepFlag=="number"&&(this.sweepFlag=n.sweepFlag),this}clone(){return new Fe().copy(this)}toObject(){return{x:bn(this.x),y:bn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:bn(this.rx),ry:bn(this.ry),xAxisRotation:bn(this.xAxisRotation),largeArcFlag:bn(this.largeArcFlag),sweepFlag:bn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const Mc={command:{enumerable:!0,get:function(){return this._command},set:function(t){this._command!==t&&(this._command=t,this._bound&&this.dispatchEvent(te.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(t){this._relative!==!!t&&(this._relative=!!t,this._bound&&this.dispatchEvent(te.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(t){this._rx!==t&&(this._rx=t,this._bound&&this.dispatchEvent(te.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(t){this._ry!==t&&(this._ry=t,this._bound&&this.dispatchEvent(te.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(t){this._xAxisRotation!==t&&(this._xAxisRotation=t,this._bound&&this.dispatchEvent(te.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(t){this._largeArcFlag!==t&&(this._largeArcFlag=t,this._bound&&this.dispatchEvent(te.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(t){this._sweepFlag!==t&&(this._sweepFlag=t,this._bound&&this.dispatchEvent(te.Types.change))}}};let Rp=0;const Ts={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return Rp++}},ao={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 lo(t,e,n,r,o){const s=1-t;return s*s*s*e+3*s*s*t*n+3*s*t*t*r+t*t*t*o}function Ac(t,e,n,r,o,s,a,l,c){c=c||ao.RecursionLimit;const d=c+1;if(Math.abs(t-a)<.001&&Math.abs(e-l)<.001)return[new Fe(a,l)];const u=[];for(let h=0;h<d;h++){const f=h/d,g=lo(f,t,n,o,a),m=lo(f,e,r,s,l);u.push(new Fe(g,m))}return u}function Pp(t,e,n,r,o,s,a,l,c){if(t===n&&e===r&&o===a&&s===l){const y=a-t,b=l-e;return Math.sqrt(y*y+b*b)}const d=9*(n-o)+3*(a-t),u=6*(t+o)-12*n,h=3*(n-t),f=9*(r-s)+3*(l-e),g=6*(e+s)-12*r,m=3*(r-e);function p(y){const b=(d*y+u)*y+h,_=(f*y+g)*y+m;return Math.sqrt(b*b+_*_)}return Vp(p,0,1,c||ao.RecursionLimit)}function Fp(t,e,n,r,o,s,a,l){const c=[],d=[[],[]];let u,h,f,g,m,p,y,b;for(let E=0;E<2;++E){if(E===0?(h=6*t-12*n+6*o,u=-3*t+9*n-9*o+3*a,f=3*n-3*t):(h=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,f=3*r-3*e),Math.abs(u)<.001){if(Math.abs(h)<.001)continue;g=-f/h,0<g&&g<1&&c.push(g);continue}y=h*h-4*f*u,b=Math.sqrt(y),!(y<0)&&(m=(-h+b)/(2*u),0<m&&m<1&&c.push(m),p=(-h-b)/(2*u),0<p&&p<1&&c.push(p))}let _=c.length,C=_,k;for(;_--;)g=c[_],k=1-g,d[0][_]=k*k*k*t+3*k*k*g*n+3*k*g*g*o+g*g*g*a,d[1][_]=k*k*k*e+3*k*k*g*r+3*k*g*g*s+g*g*g*l;return d[0][C]=t,d[1][C]=e,d[0][C+1]=a,d[1][C+1]=l,d[0].length=d[1].length=C+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 Vp(t,e,n,r){let o=ao.abscissas[r-2],s=ao.weights[r-2],a=.5*(n-e),l=a+e,c=0,d=r+1>>1,u=r&1?s[c++]*t(l):0;for(;c<d;){const h=a*o[c];u+=s[c++]*(t(l+h)+t(l-h))}return a*u}function Ip(t,e){const n=t.length,r=n-1;for(let o=0;o<n;o++){const s=t[o],a=e?qi(o-1,n):Math.max(o-1,0),l=e?qi(o+1,n):Math.min(o+1,r),c=t[a],d=s,u=t[l];Mp(c,d,u),d.command=o===0?pe.move:pe.curve}}function Mp(t,e,n){const r=be.angleBetween(t,e),o=be.angleBetween(n,e);let s=be.distanceBetween(t,e),a=be.distanceBetween(n,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=dt:l-=dt,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 pr=(Ti=class extends te{constructor(){super();S(this,"_flagId",!1);S(this,"_flagClassName",!1);S(this,"_renderer",{});S(this,"_id",Ts.Identifier+Ts.uniqueId());S(this,"_className","");S(this,"classList",[]);for(let n in Oc)Object.defineProperty(this,n,Oc[n])}static fromObject(n){const r=new Ti().copy(n);return"id"in n&&(r.id=n.id),r}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(n){return n.renderer&&typeof n.renderer.type=="string"&&(this.renderer.type=n.renderer.type),typeof n.className=="string"&&(this.className=n.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){const n=this._renderer.type;return this._renderer={type:n},typeof this.unbind=="function"&&this.unbind(),this}},S(Ti,"Properties",["renderer","id","className"]),Ti);const Oc={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(t){const e=this._id;t!==this._id&&(this._id=t,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(t){this._className!==t&&(this._flagClassName=!0,this.classList=t.split(/\s+?/),this._className=t)}}};class co extends Error{constructor(n){super();S(this,"name","Two.js");S(this,"message");this.message=n}}class Ap{constructor(){S(this,"map",{})}add(e,n){return this.map[e]=n,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}}let uo;const zc={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};yn.document&&(uo=document.createElement("a"));const Ge=class Ge extends pr{constructor(n,r){super();S(this,"_flagSrc",!1);S(this,"_flagImage",!1);S(this,"_flagVideo",!1);S(this,"_flagLoaded",!1);S(this,"_flagRepeat",!1);S(this,"_flagOffset",!1);S(this,"_flagScale",!1);S(this,"_src","");S(this,"_image",null);S(this,"_loaded",!1);S(this,"_repeat","no-repeat");S(this,"_scale",1);S(this,"_offset",null);for(let o in Dc)Object.defineProperty(this,o,Dc[o]);if(this._renderer.type="texture",this._renderer.flagOffset=Op.bind(this),this._renderer.flagScale=zp.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 n=="string")this.src=n;else if(typeof n=="object"){const o=Object.prototype.toString.call(n);(o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]"||o==="[object HTMLVideoElement]"||o==="[object Image]")&&(this.image=n)}this._update()}fromObject(n){const r=new Ge().copy(n);return"id"in n&&(r.id=n.id),r}static getAbsoluteURL(n){return uo?(uo.href=n,uo.href):n}static loadHeadlessBuffer(n,r){n.image.onload=r,n.image.src=n.src}static getTag(n){return n&&n.nodeName&&n.nodeName.toLowerCase()||"img"}static getImage(n){const r=Ge.getAbsoluteURL(n);if(Ge.ImageRegistry.contains(r))return Ge.ImageRegistry.get(r);let o;return yn.document?zc.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(n,r){let o=n.image,s=Ge.getTag(o);n._flagImage&&(/canvas/i.test(s)?Ge.Register.canvas(n,r):(n._src=o.getAttribute("two-src")||o.src,Ge.Register[s](n,r))),n._flagSrc&&(o||(o=Ge.getImage(n.src),n.image=o),s=Ge.getTag(o),Ge.Register[s](n,r))}clone(){const n=new Ge(this.src);return n.repeat=this.repeat,n.offset.copy(this.offset),n.scale=this.scale,n}copy(n){return this.src=n.src,this.repeat=n.repeat,this.offset=typeof n.offset=="number"||n.offset instanceof be?n.offset:new be().copy(n.offset),this.scale=typeof n.scale=="number"||n.scale instanceof be?n.scale:new be().copy(n.scale),this}toObject(){const n=super.toObject.call(this);return n.renderer.type="texture",n.src=this.src,n.repeat=this.repeat,n.offset=this.offset.toObject(),n.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),n}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(te.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Ge.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 n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(Ge,"Properties",["src","loaded","repeat","scale","offset","image"]),S(Ge,"RegularExpressions",zc),S(Ge,"ImageRegistry",new Ap),S(Ge,"Register",{canvas:function(n,r){n._src="#"+n.id,Ge.ImageRegistry.add(n.src,n.image),typeof r=="function"&&r()},img:function(n,r){const o=n.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 co("unable to load "+n.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)),n._src=Ge.getAbsoluteURL(n._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",n.src),Ge.ImageRegistry.add(n.src,o),n.image.src=n.src)},video:function(n,r){const o=function(a){n.image.removeEventListener("canplaythrough",o,!1),n.image.removeEventListener("error",s,!1),n.image.width=n.image.videoWidth,n.image.height=n.image.videoHeight,typeof r=="function"&&r()},s=function(a){throw n.image.removeEventListener("canplaythrough",o,!1),n.image.removeEventListener("error",s,!1),new co("unable to load "+n.src)};n._src=Ge.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),Ge.ImageRegistry.add(n.src,n.image)),n.image.readyState>=4?o():(n.image.addEventListener("canplaythrough",o,!1),n.image.addEventListener("error",s,!1),n.image.src=n.src,n.image.load())}});let Ke=Ge;const Dc={src:{enumerable:!0,get:function(){return this._src},set:function(t){this._src=t,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(t){this._loaded=t,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(t){this._repeat=t,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(t){const e=Ke.getTag(t);let n;switch(e){case"canvas":n="#"+t.id;break;default:n=t.src}Ke.ImageRegistry.contains(n)?this._image=Ke.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset&&this._offset.unbind(te.Types.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(te.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof be&&this._scale.unbind(te.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof be&&this._scale.bind(te.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Op(){this._flagOffset=!0}function zp(){this._flagScale=!0}class hi extends Array{constructor(){super();Ya(this,ft,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 Ft(this,ft)}set _events(n){nf(this,ft,n)}get _bound(){return Ft(this,ft)._bound}set _bound(n){Ft(this,ft)._bound=n}addEventListener(){return Ft(this,ft).addEventListener.apply(this,arguments)}on(){return Ft(this,ft).on.apply(this,arguments)}bind(){return Ft(this,ft).bind.apply(this,arguments)}removeEventListener(){return Ft(this,ft).removeEventListener.apply(this,arguments)}off(){return Ft(this,ft).off.apply(this,arguments)}unbind(){return Ft(this,ft).unbind.apply(this,arguments)}dispatchEvent(){return Ft(this,ft).dispatchEvent.apply(this,arguments)}trigger(){return Ft(this,ft).trigger.apply(this,arguments)}listen(){return Ft(this,ft).listen.apply(this,arguments)}ignore(){return Ft(this,ft).ignore.apply(this,arguments)}pop(){const n=super.pop.apply(this,arguments);return this.trigger(te.Types.remove,[n]),n}shift(){const n=super.shift.apply(this,arguments);return this.trigger(te.Types.remove,[n]),n}push(){const n=super.push.apply(this,arguments);return this.trigger(te.Types.insert,arguments),n}unshift(){const n=super.unshift.apply(this,arguments);return this.trigger(te.Types.insert,arguments),n}splice(){const n=super.splice.apply(this,arguments);if(this.trigger(te.Types.remove,n),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 n}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(n,r){const o=[];for(let s=0;s<this.length;s++){const a=this[s];let l;r?l=n.call(r,a,s):l=n(a,s),o.push(l)}return o}}ft=new WeakMap;const Lc=Array.prototype.slice;function Dp(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}const Ie={isNaN:function(t){return typeof t=="number"&&t!==+t},isElement:function(t){return!!(t&&t.nodeType===1)},isObject:function(t){const e=typeof t;return e==="function"||e==="object"&&!!t},isFunction:function(t){return typeof t=="function"},extend:function(t){const e=Lc.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let o in r)t[o]=r[o]}return t},defaults:function(t){const e=Lc.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let o in r)t[o]===void 0&&(t[o]=r[o])}return t},each:function(t,e,n){const r=n||this,o=!Dp(t)&&Object.keys(t),s=(o||t).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,t[l],l,t)}return t},performance:yn.performance&&yn.performance.now?yn.performance:Date},Ot=class Ot extends pr{constructor(n,r,o){super();S(this,"_flagOffset",!0);S(this,"_flagOpacity",!0);S(this,"_flagColor",!0);S(this,"_offset",0);S(this,"_opacity",1);S(this,"_color","#fff");for(let s in Hc)Object.defineProperty(this,s,Hc[s]);this._renderer.type="stop",this.offset=typeof n=="number"?n:Ot.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:Ot.Index<=0?"#fff":"#000",Ot.Index=(Ot.Index+1)%2}static fromObject(n){const r=new Ot().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Ot.Properties.length;r++){const o=Ot.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Ot;return Ie.each(Ot.Properties,function(o){r[o]=this[o]},this),n&&n.stops&&n.stops.push(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="stop",Ie.each(Ot.Properties,r=>{n[r]=this[r]},this),n}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};S(Ot,"Index",0),S(Ot,"Properties",["offset","opacity","color"]);let fi=Ot;const Hc={offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},vn=class vn extends pr{constructor(n){super();S(this,"_flagStops",!1);S(this,"_flagSpread",!1);S(this,"_flagUnits",!1);S(this,"_spread","");S(this,"_units","");for(let r in Wc)Object.defineProperty(this,r,Wc[r]);this._renderer.type="gradient",this._renderer.flagStops=Lp.bind(this),this._renderer.bindStops=Hp.bind(this),this._renderer.unbindStops=Wp.bind(this),this.spread="pad",this.units="objectBoundingBox",n&&(this.stops=n)}static fromObject(n){let r=n.stops;r&&r.length>0&&(r=r.map(s=>s instanceof fi?s:new fi().copy(s)));const o=new vn(r).copy(n);return"id"in n&&(o.id=n.id),o}clone(n){const r=this.stops.map(s=>s.clone()),o=new vn(r);return Ie.each(vn.Properties,s=>{o[s]=this[s]},this),n&&n.add(o),o}copy(n){super.copy.call(this,n);for(let r=0;r<vn.Properties.length;r++){const o=vn.Properties[r];o in n&&(this[o]=n[o])}return this}toObject(){const n={stops:this.stops.map(r=>r.toObject())};return Ie.each(vn.Properties,r=>{n[r]=this[r]},this),n}_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 n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(vn,"Stop",fi),S(vn,"Properties",["spread","stops","units"]);let st=vn;const Wc={spread:{enumerable:!0,get:function(){return this._spread},set:function(t){this._spread=t,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(t){this._units=t,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(t){const e=this._renderer.bindStops,n=this._renderer.unbindStops;this._stops&&this._stops.unbind(te.Types.insert,e).unbind(te.Types.remove,n),this._stops=new hi((t||[]).slice(0)),this._stops.bind(te.Types.insert,e).bind(te.Types.remove,n),e(this._stops)}}};function Lp(){this._flagStops=!0}function Hp(t){let e=t.length;for(;e--;)t[e].bind(te.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function Wp(t){let e=t.length;for(;e--;)t[e].unbind(te.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}const ni=class ni extends st{constructor(n,r,o,s,a){super(a);S(this,"_flagEndPoints",!1);S(this,"_left",null);S(this,"_right",null);for(let l in jc)Object.defineProperty(this,l,jc[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=jp.bind(this),this.left=new be,this.right=new be,typeof n=="number"&&(this.left.x=n),typeof r=="number"&&(this.left.y=r),typeof o=="number"&&(this.right.x=o),typeof s=="number"&&(this.right.y=s)}static fromObject(n){const r=new ni().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<ni.Properties.length;r++){const o=ni.Properties[r];o in n&&(this[o]=n[o]instanceof be?n[o]:new be().copy(n[o]))}return this}clone(n){const r=this.stops.map(function(s){return s.clone()}),o=new ni(this.left._x,this.left._y,this.right._x,this.right._y,r);return Ie.each(st.Properties,function(s){o[s]=this[s]},this),n&&n.add(o),o}toObject(){const n=super.toObject.call(this);return n.left=this.left.toObject(),n.right=this.right.toObject(),n}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};S(ni,"Stop",fi),S(ni,"Properties",["left","right"]);let Nt=ni;const jc={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof be&&this._left.unbind(te.Types.change,this._renderer.flagEndPoints),this._left=t,this._left.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(t){this._right instanceof be&&this._right.unbind(te.Types.change,this._renderer.flagEndPoints),this._right=t,this._right.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function jp(){this._flagEndPoints=!0}const Cn=class Cn extends st{constructor(n,r,o,s,a,l){super(s);S(this,"_flagRadius",!1);S(this,"_flagCenter",!1);S(this,"_flagFocal",!1);S(this,"_radius",0);S(this,"_center",null);S(this,"_focal",null);for(let c in qc)Object.defineProperty(this,c,qc[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=qp.bind(this),this._renderer.flagFocal=Xp.bind(this),this.center=new be,this.radius=typeof o=="number"?o:1,this.focal=new be,typeof n=="number"&&(this.center.x=n),typeof r=="number"&&(this.center.y=r),this.focal.copy(this.center),typeof a=="number"&&(this.focal.x=a),typeof l=="number"&&(this.focal.y=l)}static fromObject(n){const r=new Cn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Cn.Properties.length;r++){const o=Cn.Properties[r];o in n&&(/(center|focal)i/.test(o)?this[o]=n[o]instanceof be?n[o]:new be().copy(n[o]):typeof n[o]=="number"&&(this[o]=n[MediaKeySystemAccess]))}return this}clone(n){const r=this.stops.map(function(s){return s.clone()}),o=new Cn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return Ie.each(st.Properties.concat(Cn.Properties),function(s){o[s]=this[s]},this),n&&n.add(o),o}toObject(){const n=super.toObject.call(this);return Ie.each(Cn.Properties,function(r){n[r]=this[r]},this),n.center=this.center.toObject(),n.focal=this.focal.toObject(),n}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};S(Cn,"Stop",fi),S(Cn,"Properties",["center","radius","focal"]);let $t=Cn;const qc={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(t){this._center&&this._center.unbind(te.Types.change,this._renderer.flagCenter),this._center=t,this._center.bind(te.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(t){this._focal&&this._focal.unbind(te.Types.change,this._renderer.flagFocal),this._focal=t,this._focal.bind(te.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function qp(){this._flagCenter=!0}function Xp(){this._flagFocal=!0}function Xc(t,e){if(e===0||e===1)return!0;const r=t._length*e;let o=0;for(let s=0;s<t._lengths.length;s++){const a=t._lengths[s];if(o>=r)return r-o>=0;o+=a}return!1}function ho(t,e){const n=t._length;if(e<=0)return 0;if(e>=n)return t._lengths.length-1;for(let r=0,o=0;r<t._lengths.length;r++){if(o+t._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/t._lengths[r];o+=t._lengths[r]}return-1}function Yc(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,f=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(f||t).x,d=(f||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),f&&t._relative&&(s+=t.x,d+=t.y),Pp(r,l,o,c,s,d,a,u,n)}function Uc(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,f=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(f||t).x,d=(f||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),f&&t._relative&&(s+=t.x,d+=t.y),Ac(r,l,o,c,s,d,a,u,n)}function mi(t){switch(t.renderer.type){case"texture":return Ke.fromObject(t);case"gradient":return st.fromObject(t);case"linear-gradient":return Nt.fromObject(t);case"radial-gradient":return $t.fromObject(t)}return t}const Yp=Math.cos,Up=Math.sin,Kc=Math.tan,Ns=[],Rt=class Rt extends te{constructor(n,r,o,s,a,l){super();S(this,"elements",new Vc(9));S(this,"manual",!1);let c=n;Array.isArray(c)||(c=Array.prototype.slice.call(arguments)),this.identity(),c.length>0&&this.set(c)}static Multiply(n,r,o){if(r.length<=3){const x=n;let B,w,T;const N=r[0]||0,V=r[1]||0,R=r[2]||0;return B=x[0]*N+x[1]*V+x[2]*R,w=x[3]*N+x[4]*V+x[5]*R,T=x[6]*N+x[7]*V+x[8]*R,[B,w,T]}const s=n[0],a=n[1],l=n[2],c=n[3],d=n[4],u=n[5],h=n[6],f=n[7],g=n[8],m=r[0],p=r[1],y=r[2],b=r[3],_=r[4],C=r[5],k=r[6],E=r[7],$=r[8];return o=o||new Vc(9),o[0]=s*m+a*b+l*k,o[1]=s*p+a*_+l*E,o[2]=s*y+a*C+l*$,o[3]=c*m+d*b+u*k,o[4]=c*p+d*_+u*E,o[5]=c*y+d*C+u*$,o[6]=h*m+f*b+g*k,o[7]=h*p+f*_+g*E,o[8]=h*y+f*C+g*$,o}static fromObject(n){return new Rt().copy(n)}set(n,r,o,s,a,l,c,d,u){if(typeof r>"u"){const h=n;n=h[0],r=h[1],o=h[2],s=h[3],a=h[4],l=h[5],c=h[6],d=h[7],u=h[8]}return this.elements[0]=n,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(n){return this.elements[0]=n.elements[0],this.elements[1]=n.elements[1],this.elements[2]=n.elements[2],this.elements[3]=n.elements[3],this.elements[4]=n.elements[4],this.elements[5]=n.elements[5],this.elements[6]=n.elements[6],this.elements[7]=n.elements[7],this.elements[8]=n.elements[8],this.manual=n.manual,this.trigger(te.Types.change)}identity(){return this.elements[0]=Rt.Identity[0],this.elements[1]=Rt.Identity[1],this.elements[2]=Rt.Identity[2],this.elements[3]=Rt.Identity[3],this.elements[4]=Rt.Identity[4],this.elements[5]=Rt.Identity[5],this.elements[6]=Rt.Identity[6],this.elements[7]=Rt.Identity[7],this.elements[8]=Rt.Identity[8],this.trigger(te.Types.change)}multiply(n,r,o,s,a,l,c,d,u){if(typeof r>"u")return this.elements[0]*=n,this.elements[1]*=n,this.elements[2]*=n,this.elements[3]*=n,this.elements[4]*=n,this.elements[5]*=n,this.elements[6]*=n,this.elements[7]*=n,this.elements[8]*=n,this.trigger(te.Types.change);if(typeof o>"u"&&(o=1),typeof s>"u"){n=n||0,r=r||0,o=o||0,a=this.elements;const W=a[0]*n+a[1]*r+a[2]*o,ee=a[3]*n+a[4]*r+a[5]*o,ne=a[6]*n+a[7]*r+a[8]*o;return[W,ee,ne]}const h=this.elements,f=[n,r,o,s,a,l,c,d,u],g=h[0],m=h[1],p=h[2],y=h[3],b=h[4],_=h[5],C=h[6],k=h[7],E=h[8],$=f[0],x=f[1],B=f[2],w=f[3],T=f[4],N=f[5],V=f[6],R=f[7],I=f[8];return this.elements[0]=g*$+m*w+p*V,this.elements[1]=g*x+m*T+p*R,this.elements[2]=g*B+m*N+p*I,this.elements[3]=y*$+b*w+_*V,this.elements[4]=y*x+b*T+_*R,this.elements[5]=y*B+b*N+_*I,this.elements[6]=C*$+k*w+E*V,this.elements[7]=C*x+k*T+E*R,this.elements[8]=C*B+k*N+E*I,this.trigger(te.Types.change)}inverse(n){const r=this.elements;n=n||new Rt;const o=r[0],s=r[1],a=r[2],l=r[3],c=r[4],d=r[5],u=r[6],h=r[7],f=r[8],g=f*c-d*h,m=-f*l+d*u,p=h*l-c*u;let y=o*g+s*m+a*p;return y?(y=1/y,n.elements[0]=g*y,n.elements[1]=(-f*s+a*h)*y,n.elements[2]=(d*s-a*c)*y,n.elements[3]=m*y,n.elements[4]=(f*o-a*u)*y,n.elements[5]=(-d*o+a*l)*y,n.elements[6]=p*y,n.elements[7]=(-h*o+s*u)*y,n.elements[8]=(c*o-s*l)*y,n):null}scale(n,r){return arguments.length<=1&&(r=n),this.multiply(n,0,0,0,r,0,0,0,1)}rotate(n){const r=Yp(n),o=Up(n);return this.multiply(r,-o,0,o,r,0,0,0,1)}translate(n,r){return this.multiply(1,0,n,0,1,r,0,0,1)}skewX(n){const r=Kc(n);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(n){const r=Kc(n);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(n){return Ns.length=0,this.toTransformArray(n,Ns),Ns.map(bn).join(" ")}toTransformArray(n,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],h=o[5];if(n){const f=o[6],g=o[7],m=o[8];if(s){r[0]=a,r[1]=d,r[2]=f,r[3]=l,r[4]=u,r[5]=g,r[6]=c,r[7]=h,r[8]=m;return}return[a,d,f,l,u,g,c,h,m]}if(s){r[0]=a,r[1]=d,r[2]=l,r[3]=u,r[4]=c,r[5]=h;return}return[a,d,l,u,c,h]}toArray(n,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],h=o[5];if(n){const f=o[6],g=o[7],m=o[8];if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=h,r[6]=f,r[7]=g,r[8]=m;return}return[a,l,c,d,u,h,f,g,m]}if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=h;return}return[a,l,c,d,u,h]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Rt().copy(this)}};S(Rt,"Identity",[1,0,0,0,1,0,0,0,1]);let yr=Rt;Np(yr);const Mr=class Mr extends pr{constructor(){super();S(this,"_flagMatrix",!0);S(this,"_flagScale",!1);S(this,"_matrix",null);S(this,"_worldMatrix",null);S(this,"_position",null);S(this,"_rotation",0);S(this,"_scale",1);S(this,"_skewX",0);S(this,"_skewY",0);for(let n in fo)Object.defineProperty(this,n,fo[n]);this._renderer.flagMatrix=Gc.bind(this),this.isShape=!0,this.matrix=new yr,this.worldMatrix=new yr,this.position=new be,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(n){const r=new Mr().copy(n);return"id"in n&&(r.id=n.id),r}get renderer(){return this._renderer}set renderer(n){this._renderer=n}get translation(){return fo.position.get.apply(this,arguments)}set translation(n){fo.position.set.apply(this,arguments)}addTo(n){return n.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}copy(n){return super.copy.call(this,n),"position"in n&&(n.position instanceof be?this.position=n.position:this.position.copy(n.position)),"rotation"in n&&(this.rotation=n.rotation),"scale"in n&&(this.scale=typeof n.scale=="number"||n.scale instanceof be?n.scale:new be(n.scale.x,n.scale.y)),"skewX"in n&&(this.skewX=n.skewX),"skewY"in n&&(this.skewY=n.skewY),"matrix"in n&&n.matrix.manual&&(this.matrix.copy(n.matrix),this.matrix.manual=!0),this}clone(n){const r=new Mr;return r.position.copy(this.position),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer={type:"shape"},n.isShape=!0,n.translation=this.translation.toObject(),n.rotation=this.translation.rotation,n.scale=this.scale instanceof be?this.scale.toObject():this.scale,n.skewX=this.skewX,n.skewY=this.skewY,n.matrix=this.matrix.toObject(),n}_update(n){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof 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)),n&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};S(Mr,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let $n=Mr;const fo={position:{enumerable:!0,get:function(){return this._position},set:function(t){this._position&&this._position.unbind(te.Types.change,this._renderer.flagMatrix),this._position=t,this._position.bind(te.Types.change,this._renderer.flagMatrix),Gc.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof be&&this._scale.unbind(te.Types.change,this._renderer.flagMatrix),this._scale=t,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(t){this._skewX=t,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(t){this._skewY=t,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(t){this._matrix=t,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return $p(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function Gc(){this._flagMatrix=!0}const Xi=Math.min,Yi=Math.max,Kp=Math.ceil,Gp=Math.floor,Zp=new be,sn=class sn extends $n{constructor(n,r,o,s){super();S(this,"_flagVertices",!0);S(this,"_flagLength",!0);S(this,"_flagFill",!0);S(this,"_flagStroke",!0);S(this,"_flagLinewidth",!0);S(this,"_flagOpacity",!0);S(this,"_flagVisible",!0);S(this,"_flagCap",!0);S(this,"_flagJoin",!0);S(this,"_flagMiter",!0);S(this,"_flagStrokeAttenuation",!0);S(this,"_flagMask",!1);S(this,"_flagClip",!1);S(this,"_length",0);S(this,"_fill","#fff");S(this,"_stroke","#000");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_cap","round");S(this,"_join","round");S(this,"_miter",4);S(this,"_closed",!0);S(this,"_curved",!1);S(this,"_automatic",!0);S(this,"_beginning",0);S(this,"_ending",1);S(this,"_mask",null);S(this,"_clip",!1);S(this,"_dashes",null);S(this,"_strokeAttenuation",!0);for(let a in Zc)Object.defineProperty(this,a,Zc[a]);this._renderer.type="path",this._renderer.flagVertices=Qc.bind(this),this._renderer.bindVertices=Jc.bind(this),this._renderer.unbindVertices=ed.bind(this),this._renderer.flagFill=td.bind(this),this._renderer.flagStroke=nd.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=n,this.automatic=!s,this.dashes=[],this.dashes.offset=0}static fromObject(n){const r=typeof n.fill=="string"?n.fill:mi(n.fill),o=typeof n.stroke=="string"?n.stroke:mi(n.stroke),s=new sn().copy({...n,fill:r,stroke:o});return"id"in n&&(s.id=n.id),s}copy(n){if(super.copy.call(this,n),n.vertices){this.vertices=[];for(let r=0;r<n.vertices.length;r++){const o=n.vertices[r];o instanceof Fe?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Fe().copy(o))}}for(let r=0;r<sn.Properties.length;r++){const o=sn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new sn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<sn.Properties.length;o++){const s=sn.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),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="path",n.vertices=this.vertices.map(r=>r.toObject()),Ie.each(sn.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];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"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const n=this.getBoundingClientRect(!0),r=n.width/2,o=n.height/2,s=n.left+n.width/2,a=n.top+n.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=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 n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,o=n.top+n.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(n){let r,o,s,a,l,c,d=1/0,u=-1/0,h=1/0,f=-1/0;if(this._update(!0),r=n?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:g,scaleY:m}=Tp(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof g=="number"&&typeof m=="number"&&(o=Math.max(g,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[g,m]=r.multiply(l.x,l.y),[p,y]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let b=l.controls.right.x,_=l.controls.right.y;l.relative&&(b+=l.x,_+=l.y);let[C,k]=r.multiply(b,_),E=c.controls.left.x,$=c.controls.left.y;c.relative&&(E+=c.x,$+=c.y);let[x,B]=r.multiply(E,$);const w=Fp(g,m,C,k,x,B,p,y);h=Xi(w.min.y-o,h),d=Xi(w.min.x-o,d),u=Yi(w.max.x+o,u),f=Yi(w.max.y+o,f)}else a<=1&&(h=Xi(m-o,h),d=Xi(g-o,d),u=Yi(g+o,u),f=Yi(m+o,f)),h=Xi(y-o,h),d=Xi(p-o,d),u=Yi(p+o,u),f=Yi(y+o,f)}return{top:h,left:d,right:u,bottom:f,width:u-d,height:f-h}}getPointAt(n,r){let o,s,a,l,c,d,u,h,f,g,m,p,y,b,_,C=this.length*Math.min(Math.max(n,0),1);const k=this.vertices.length,E=k-1;let $=null,x=null;for(let D=0,H=this._lengths.length,L=0;D<H;D++){if(L+this._lengths[D]>=C){this._closed?(o=qi(D,k),s=qi(D-1,k),D===0&&(o=s,s=D)):(o=D,s=Math.min(Math.max(D-1,0),E)),$=this.vertices[o],x=this.vertices[s],C-=L,this._lengths[D]!==0?n=C/this._lengths[D]:n=0;break}L+=this._lengths[D]}if($===null||x===null)return null;if($){if(!x)return $}else return x;_=x.controls&&x.controls.right,b=$.controls&&$.controls.left,c=x.x,g=x.y,d=(_||x).x,m=(_||x).y,u=(b||$).x,p=(b||$).y,h=$.x,y=$.y,_&&x.relative&&(d+=x.x,m+=x.y),b&&$.relative&&(u+=$.x,p+=$.y),l=lo(n,c,d,u,h),f=lo(n,g,m,p,y);const B=Gt(c,d,n),w=Gt(g,m,n),T=Gt(d,u,n),N=Gt(m,p,n),V=Gt(u,h,n),R=Gt(p,y,n),I=Gt(B,T,n),W=Gt(w,N,n),ee=Gt(T,V,n),ne=Gt(N,R,n);return Ie.isObject(r)?(r.x=l,r.y=f,r instanceof Fe&&(r.controls.left.x=I,r.controls.left.y=W,r.controls.right.x=ee,r.controls.right.y=ne,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=f,r.controls.right.x-=l,r.controls.right.y-=f)),r.t=n,r):(a=new Fe(l,f,I-l,W-f,ee-l,ne-f,this._curved?pe.curve:pe.line),a.t=n,a)}plot(){if(this.curved)return Ip(this._collection,this.closed),this;for(let n=0;n<this._collection.length;n++)this._collection[n].command=n===0?pe.move:pe.line;return this}subdivide(n){this._update();const r=this.vertices.length-1,o=this._closed||this.vertices[r]._command===pe.close;let s=this.vertices[r],a=[],l;return Ie.each(this.vertices,function(c,d){if(d<=0&&!o){s=c;return}if(c.command===pe.move){a.push(new Fe(s.x,s.y)),d>0&&(a[a.length-1].command=pe.line),s=c;return}l=Uc(c,s,n),a=a.concat(l),Ie.each(l,function(u,h){h<=0&&s.command===pe.move?u.command=pe.move:u.command=pe.line}),d>=r&&(this._closed&&this._automatic&&(s=c,l=Uc(c,s,n),a=a.concat(l),Ie.each(l,function(u,h){h<=0&&s.command===pe.move?u.command=pe.move:u.command=pe.line})),a.push(new Fe(c.x,c.y)),a[a.length-1].command=o?pe.close:pe.line),s=c},this),this._automatic=!1,this._curved=!1,this.vertices=a,this}_updateLength(n,r){r||this._update();const s=this.vertices.length-1;let a=this.vertices[s],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),Ie.each(this.vertices,function(c,d){if(d<=0||c.command===pe.move){a=c,this._lengths[d]=0;return}this._lengths[d]=Yc(c,a,n),l+=this._lengths[d],a=c},this),this._length=l,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const n=this._collection.length,r=this._closed,o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),a=ho(this,o*this._length),l=ho(this,s*this._length),c=Kp(a),d=Gp(l);let u,h,f,g,m,p;for(this._renderer.vertices.length=0,p=0;p<n;p++)this._renderer.collection.length<=p&&this._renderer.collection.push(new Fe),p>d&&!h?(m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(s,m),m.command=this._renderer.collection[p].command,this._renderer.vertices.push(m),h=m,f=this._collection[p-1],f&&f.controls&&(m.relative?m.controls.right.clear():m.controls.right.copy(m),f.relative?this._renderer.collection[p-1].controls.right.copy(f.controls.right).lerp(be.zero,1-m.t):this._renderer.collection[p-1].controls.right.copy(f.controls.right).lerp(f,1-m.t))):p>=c&&p<=d&&(m=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(m),p===d&&Xc(this,s)?(h=m,!r&&h.controls&&(h.relative?h.controls.right.clear():h.controls.right.copy(h))):p===c&&Xc(this,o)&&(u=m,u.command=pe.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(p=c-1,m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(o,m),m.command=pe.move,this._renderer.vertices.unshift(m),g=this._collection[p+1],g&&g.controls&&(m.controls.left.clear(),g.relative?this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(be.zero,m.t):(Zp.copy(g),this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(g,m.t))))}return $n.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,$n.prototype.flagReset.call(this),this}};S(sn,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),S(sn,"Utils",{getCurveLength:Yc});let Me=sn;const Zc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof st||this._fill instanceof Nt||this._fill instanceof $t||this._fill instanceof Ke)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof Nt||this._fill instanceof $t||this._fill instanceof Ke)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof Nt||this._stroke instanceof $t||this._stroke instanceof Ke)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof Nt||this._stroke instanceof $t||this._stroke instanceof Ke)&&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(t){this._closed=!!t,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t===this._automatic)return;this._automatic=!!t;const e=this._automatic?"ignore":"listen";Ie.each(this.vertices,function(n){n[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,n),t instanceof hi?this._collection=t:this._collection=new hi(t||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,n),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Ie.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function Qc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Jc(t){let e=t.length;for(;e--;)t[e].bind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function ed(t){let e=t.length;for(;e--;)t[e].unbind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function td(){this._flagFill=!0}function nd(){this._flagStroke=!0}const Qp=Math.ceil,Jp=Math.floor,Sn=class Sn extends $n{constructor(n){super();S(this,"_flagVertices",!0);S(this,"_flagLength",!0);S(this,"_flagFill",!0);S(this,"_flagStroke",!0);S(this,"_flagLinewidth",!0);S(this,"_flagOpacity",!0);S(this,"_flagVisible",!0);S(this,"_flagSize",!0);S(this,"_flagSizeAttenuation",!0);S(this,"_flagStrokeAttenuation",!0);S(this,"_length",0);S(this,"_fill","#fff");S(this,"_stroke","#000");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_size",1);S(this,"_sizeAttenuation",!1);S(this,"_beginning",0);S(this,"_ending",1);S(this,"_dashes",null);S(this,"_strokeAttenuation",!0);S(this,"noFill",Me.prototype.noFill);S(this,"noStroke",Me.prototype.noStroke);S(this,"corner",Me.prototype.corner);S(this,"center",Me.prototype.center);S(this,"getBoundingClientRect",Me.prototype.getBoundingClientRect);S(this,"_updateLength",Me.prototype._updateLength);for(let r in id)Object.defineProperty(this,r,id[r]);this._renderer.type="points",this._renderer.flagVertices=Qc.bind(this),this._renderer.bindVertices=Jc.bind(this),this._renderer.unbindVertices=ed.bind(this),this._renderer.flagFill=td.bind(this),this._renderer.flagStroke=nd.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.size=1,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.vertices=n,this.dashes=[],this.dashes.offset=0}static fromObject(n){const r=typeof n.fill=="string"?n.fill:mi(n.fill),o=typeof n.stroke=="string"?n.stroke:mi(n.stroke),s=new Sn().copy({...n,fill:r,stroke:o});return"id"in n&&(s.id=n.id),s}copy(n){super.copy.call(this,n);for(let r=0;r<n.vertices.length;r++){const o=n.vertices[r];o instanceof Fe?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Fe().copy(o))}for(let r=0;r<Sn.Properties.length;r++){const o=Sn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Sn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Sn.Properties.length;o++){const s=Sn.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),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="points",n.vertices=this.vertices.map(r=>r.toObject()),Ie.each(Sn.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];typeof r.unbind=="function"&&r.unbind()}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}subdivide(n){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,h=Ac(l,c,l,c,d,u,d,u,n);r=r.concat(h)}return this.vertices=r,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const n=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),o=ho(this,n*this._length),s=ho(this,r*this._length),a=Qp(o),l=Jp(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}};S(Sn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let mo=Sn;const id={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(t){this._sizeAttenuation=t,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof st||this._fill instanceof Nt||this._fill instanceof $t||this._fill instanceof Ke)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof Nt||this._fill instanceof $t||this._fill instanceof Ke)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof Nt||this._stroke instanceof $t||this._stroke instanceof Ke)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof Nt||this._stroke instanceof $t||this._stroke instanceof Ke)&&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(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,n),t instanceof hi?this._collection=t:this._collection=new hi(t||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,n),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};class rd extends hi{constructor(n){n=Array.isArray(n)?n:Array.prototype.slice.call(arguments);super(n);Ya(this,Lo,{});this.attach(n),this.on(te.Types.insert,this.attach),this.on(te.Types.remove,this.detach)}get ids(){return Ft(this,Lo)}attach(n){for(let r=0;r<n.length;r++){const o=n[r];o&&o.id&&(this.ids[o.id]=o)}return this}detach(n){for(let r=0;r<n.length;r++)delete this.ids[n[r].id];return this}}Lo=new WeakMap;const Vn=class Vn extends Me{constructor(n,r,o,s,a,l,c){const d=c||Ts.Resolution*3,u=[];for(let h=0;h<d;h++)u.push(new Fe);super(u,!0,!1,!0);S(this,"_flagStartAngle",!1);S(this,"_flagEndAngle",!1);S(this,"_flagInnerRadius",!1);S(this,"_flagOuterRadius",!1);S(this,"_startAngle",0);S(this,"_endAngle",ui);S(this,"_innerRadius",0);S(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let h in od)Object.defineProperty(this,h,od[h]);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 n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Vn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Vn.Properties.length;r++){const o=Vn.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const n=this._startAngle,r=this._endAngle,o=this._innerRadius,s=this._outerRadius,a=qi(n,ui)===qi(r,ui),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,h=0,f,g,m,p,y,b,_,C,k;for(a?d--:l||(d-=2),f=0,g=d-1;f<d;f++){switch(m=f/g,p=c[h],y=m*(r-n)+n,b=(r-n)/d,_=s*Math.cos(y),C=s*Math.sin(y),f){case 0:u=pe.move;break;default:u=pe.curve}p.command=u,p.x=_,p.y=C,p.controls.left.clear(),p.controls.right.clear(),p.command===pe.curve&&(k=s*b/Math.PI,p.controls.left.x=k*Math.cos(y-dt),p.controls.left.y=k*Math.sin(y-dt),p.controls.right.x=k*Math.cos(y+dt),p.controls.right.y=k*Math.sin(y+dt),f===1&&p.controls.left.multiplyScalar(2),f===g&&p.controls.right.multiplyScalar(2)),h++}if(l){for(a?(c[h].command=pe.close,h++):(d--,g=d-1),f=0;f<d;f++)m=f/g,p=c[h],y=(1-m)*(r-n)+n,b=(r-n)/d,_=o*Math.cos(y),C=o*Math.sin(y),u=pe.curve,f<=0&&(u=a?pe.move:pe.line),p.command=u,p.x=_,p.y=C,p.controls.left.clear(),p.controls.right.clear(),p.command===pe.curve&&(k=o*b/Math.PI,p.controls.left.x=k*Math.cos(y+dt),p.controls.left.y=k*Math.sin(y+dt),p.controls.right.x=k*Math.cos(y-dt),p.controls.right.y=k*Math.sin(y-dt),f===1&&p.controls.left.multiplyScalar(2),f===g&&p.controls.right.multiplyScalar(2)),h++;c[h].copy(c[0]),c[h].command=pe.line}else a||(c[h].command=pe.line,c[h].x=0,c[h].y=0,h++,c[h].copy(c[0]),c[h].command=pe.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(n){const r=this.innerRadius,o=this.outerRadius,s=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new Vn(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<Me.Properties.length;d++){const u=Me.Properties[d];c[u]=this[u]}return n&&n.add(c),c}toObject(){const n=super.toObject.call(this);n.renderer.type="arc-segment";for(let r=0;r<Vn.Properties.length;r++){const o=Vn.Properties[r];n[o]=this[o]}return n}};S(Vn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let $s=Vn;const od={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(t){this._startAngle=t,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(t){this._endAngle=t,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}}},Es=Math.cos,Rs=Math.sin,In=class In extends Me{constructor(n,r,o,s){const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Fe(0,0,0,0,0,0));super(l,!0,!0,!0);S(this,"_flagRadius",!1);S(this,"_radius",0);this._renderer.type="circle";for(let c in sd)Object.defineProperty(this,c,sd[c]);typeof o=="number"&&(this.radius=o),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new In().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<In.Properties.length;r++){const o=In.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagRadius){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(n*2)),o=this._radius,s=o*r;for(let a=0;a<this.vertices.length;a++){const c=a/n*ui,d=o*Es(c),u=o*Rs(c),h=s*Es(c-dt),f=s*Rs(c-dt),g=s*Es(c+dt),m=s*Rs(c+dt),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(h,f),p.controls.right.set(g,m)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=new In(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<Me.Properties.length;o++){const s=Me.Properties[o];r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="circle";for(let r=0;r<In.Properties.length;r++){const o=In.Properties[r];n[o]=this[o]}return n}};S(In,"Properties",["radius"]);let Ps=In;const sd={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},Fs=Math.cos,Vs=Math.sin,Mn=class Mn extends Me{constructor(n,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 Fe);super(c,!0,!0,!0);S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_width",0);S(this,"_height",0);this._renderer.type="ellipse";for(let d in ad)Object.defineProperty(this,d,ad[d]);typeof o=="number"&&(this.width=o*2),typeof s=="number"&&(this.height=s*2),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Mn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Mn.Properties.length;r++){const o=Mn.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(this.vertices.length*2)),o=this._width/2,s=this._height/2;for(let a=0;a<this.vertices.length;a++){const c=a/n*ui,d=o*Fs(c),u=s*Vs(c),h=o*r*Fs(c-dt),f=s*r*Vs(c-dt),g=o*r*Fs(c+dt),m=s*r*Vs(c+dt),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(h,f),p.controls.right.set(g,m)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=this.width/2,o=this.height/2,s=this.vertices.length,a=new Mn(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<Me.Properties.length;l++){const c=Me.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="ellipse";for(let r=0;r<Mn.Properties.length;r++){const o=Mn.Properties[r];n[o]=this[o]}return n}};S(Mn,"Properties",["width","height"]);let Is=Mn;const ad={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}}},ey=Math.cos,ty=Math.sin,An=class An extends Me{constructor(n,r,o,s){s=Math.max(s||0,3);super();S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_flagSides",!1);S(this,"_radius",0);S(this,"_width",0);S(this,"_height",0);S(this,"_sides",0);this._renderer.type="polygon";for(let a in ld)Object.defineProperty(this,a,ld[a]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.radius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new An().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<An.Properties.length;r++){const o=An.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const n=this._sides,r=n+1;let o=this.vertices.length;o>n&&(this.vertices.splice(n-1,o-n),o=n);for(let s=0;s<r;s++){const a=(s+.5)/n,l=ui*a+Math.PI/2,c=this._width*ey(l)/2,d=this._height*ty(l)/2;s>=o?this.vertices.push(new Fe(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?pe.move:pe.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=new An(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<Me.Properties.length;o++){const s=Me.Properties[o];r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="polygon";for(let r=0;r<An.Properties.length;r++){const o=An.Properties[r];n[o]=this[o]}return n}};S(An,"Properties",["width","height","sides"]);let Ms=An;const ld={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this.width=t*2,this.height=t*2}},width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},Ni=class Ni extends Me{constructor(n,r,o,s){const a=[new Fe,new Fe,new Fe,new Fe];super(a,!0,!1,!0);S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_width",0);S(this,"_height",0);S(this,"_origin",null);this._renderer.type="rectangle";for(let l in cd)Object.defineProperty(this,l,cd[l]);this.width=typeof o=="number"?o:1,this.height=typeof s=="number"?s:1,this.origin=new be,typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(n){const r=new Ni().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Ni.Properties.length;r++){const o=Ni.Properties[r];o in n&&(typeof n[o]=="number"?this[o]=n[o]:this[o]instanceof be&&this[o].copy(n[o]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const n=this._width/2,r=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Fe),this.vertices[0].set(-n,-r).sub(this._origin).command=pe.move,this.vertices[1].set(n,-r).sub(this._origin).command=pe.line,this.vertices[2].set(n,r).sub(this._origin).command=pe.line,this.vertices[3].set(-n,r).sub(this._origin).command=pe.line,this.vertices[4]&&(this.vertices[4].set(-n,-r).sub(this._origin).command=pe.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=new Ni(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<Me.Properties.length;o++){const s=Me.Properties[o];r[s]instanceof be?r[s].copy(this[s]):r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="rectangle",n.width=this.width,n.height=this.height,n.origin=this.origin.toObject(),n}};S(Ni,"Properties",["width","height","origin"]);let br=Ni;const cd={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(t){this._origin&&this._origin.unbind(te.Types.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(te.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},On=class On extends Me{constructor(n,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 Fe(0,0,0,0,0,0,c===0?pe.move:pe.curve));super(l);S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_flagRadius",!1);S(this,"_width",0);S(this,"_height",0);S(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in dd)Object.defineProperty(this,c,dd[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=ny.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 n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new On().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<On.Properties.length;r++){const o=On.Properties[r];if(o in n){const s=n[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 n=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=n/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(n){const r=this.width,o=this.height,s=this.radius,a=new On(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<Me.Properties.length;l++){const c=Me.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="rounded-rectangle";for(let r=0;r<On.Properties.length;r++){const o=On.Properties[r];n[o]=this[o]}return n.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),n}};S(On,"Properties",["width","height","radius"]);let As=On;const dd={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof be&&this._radius.unbind(te.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof be&&this._radius.bind(te.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function ny(){this._flagRadius=!0}const iy=Math.cos,ry=Math.sin,zn=class zn extends Me{constructor(n,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();S(this,"_flagInnerRadius",!1);S(this,"_flagOuterRadius",!1);S(this,"_flagSides",!1);S(this,"_innerRadius",0);S(this,"_outerRadius",0);S(this,"_sides",0);this._renderer.type="star";for(let l in ud)Object.defineProperty(this,l,ud[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 n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new zn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<zn.Properties.length;r++){const o=zn.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const n=this._sides*2,r=n+1;let o=this.vertices.length;o>n&&(this.vertices.splice(n-1,o-n),o=n);for(let s=0;s<r;s++){const a=(s+.5)/n,l=ui*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*iy(l),u=c*ry(l);s>=o?this.vertices.push(new Fe(d,u)):this.vertices[s].set(d,u),this.vertices[s].command=s===0?pe.move:pe.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=this.innerRadius,o=this.outerRadius,s=this.sides,a=new zn(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Me.Properties.length;l++){const c=Me.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="star";for(let r=0;r<zn.Properties.length;r++){const o=zn.Properties[r];n[o]=this[o]}return n}};S(zn,"Properties",["innerRadius","outerRadius","sides"]);let Os=zn;const ud={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}};let zs;const hd=Math.min,fd=Math.max;yn.document&&(zs=document.createElement("canvas"));const vt=class vt extends $n{constructor(n,r,o,s){super();S(this,"_flagValue",!0);S(this,"_flagFamily",!0);S(this,"_flagSize",!0);S(this,"_flagLeading",!0);S(this,"_flagAlignment",!0);S(this,"_flagBaseline",!0);S(this,"_flagStyle",!0);S(this,"_flagWeight",!0);S(this,"_flagDecoration",!0);S(this,"_flagFill",!0);S(this,"_flagStroke",!0);S(this,"_flagLinewidth",!0);S(this,"_flagOpacity",!0);S(this,"_flagVisible",!0);S(this,"_flagMask",!1);S(this,"_flagClip",!1);S(this,"_flagDirection",!0);S(this,"_flagStrokeAttenuation",!0);S(this,"_value","");S(this,"_family","sans-serif");S(this,"_size",13);S(this,"_leading",17);S(this,"_alignment","center");S(this,"_baseline","middle");S(this,"_style","normal");S(this,"_weight",500);S(this,"_decoration","none");S(this,"_direction","ltr");S(this,"_fill","#000");S(this,"_stroke","none");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_mask",null);S(this,"_clip",!1);S(this,"_dashes",null);S(this,"_strokeAttenuation",!0);for(let a in md)Object.defineProperty(this,a,md[a]);if(this._renderer.type="text",this._renderer.flagFill=oy.bind(this),this._renderer.flagStroke=sy.bind(this),this.value=n,typeof r=="number"&&(this.translation.x=r),typeof o=="number"&&(this.translation.y=o),this.dashes=[],this.dashes.offset=0,!Ie.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(n){if(zs){const r=zs.getContext("2d");r.font=[n._style,n._weight,`${n._size}px/${n._leading}px`,n._family].join(" ");const o=r.measureText(n.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(n){const r=typeof n.fill=="string"?n.fill:mi(n.fill),o=typeof n.stroke=="string"?n.stroke:mi(n.stroke),s=new vt().copy({...n,fill:r,stroke:o});return"id"in n&&(s.id=n.id),s}copy(n){super.copy.call(this,n);for(let r=0;r<vt.Properties.length;r++){const o=vt.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){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),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);n.renderer.type="text";for(let r=0;r<vt.Properties.length;r++){const o=vt.Properties[r];n[o]=this[o]}return n}dispose(){return super.dispose(),typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(n){let r,o,s,a,l;this._update(!0),r=n?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[h,f]=r.multiply(o,a),[g,m]=r.multiply(o,l),[p,y]=r.multiply(s,a),[b,_]=r.multiply(s,l);return a=hd(f,m,y,_),o=hd(h,g,p,b),s=fd(h,g,p,b),l=fd(f,m,y,_),{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}};S(vt,"Ratio",.6),S(vt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let Ui=vt;const md={value:{enumerable:!0,get:function(){return this._value},set:function(t){this._value=t,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(t){this._family=t,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(t){this._leading=t,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(t){this._alignment=t,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(t){this._style=t,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(t){this._weight=t,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(t){this._decoration=t,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(t){this._direction=t,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(t){this._baseline=t,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof st||this._fill instanceof Nt||this._fill instanceof $t||this._fill instanceof Ke)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof Nt||this._fill instanceof $t||this._fill instanceof Ke)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof Nt||this._stroke instanceof $t||this._stroke instanceof Ke)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof Nt||this._stroke instanceof $t||this._stroke instanceof Ke)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Ie.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function oy(){this._flagFill=!0}function sy(){this._flagStroke=!0}const Dn=class Dn extends br{constructor(n,r,o,s){super(r,o,0,0);S(this,"_flagTextures",!1);S(this,"_flagFrameRate",!1);S(this,"_flagIndex",!1);S(this,"_amount",1);S(this,"_duration",0);S(this,"_index",0);S(this,"_startTime",0);S(this,"_playing",!1);S(this,"_firstFrame",0);S(this,"_lastFrame",0);S(this,"_loop",!0);S(this,"_textures",null);S(this,"_frameRate",0);S(this,"_origin",null);this._renderer.type="image-sequence";for(let a in gd)Object.defineProperty(this,a,gd[a]);this._renderer.flagTextures=ay.bind(this),this._renderer.bindTextures=ly.bind(this),this._renderer.unbindTextures=cy.bind(this),this.noStroke(),this.noFill(),Array.isArray(n)?this.textures=n.map(pd.bind(this)):typeof n=="string"&&(this.textures=[pd(n)]),this.origin=new be,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=Dn.DefaultFrameRate,this.index=0}static fromObject(n){const r=new Dn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Dn.Properties.length;r++){const o=Dn.Properties[r];o in n&&(this[o]=n[o])}return this}play(n,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=Ie.performance.now(),typeof n=="number"&&(this._firstFrame=n),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(n){const r=new Dn(this.textures,this.translation.x,this.translation.y,this.frameRate);return r._loop=this._loop,this._playing&&r.play(),n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="image-sequence",n.textures=this.textures.map(function(r){return r.toObject()}),n.frameRate=this.frameRate,n.index=this.index,n.firstFrame=this.firstFrame,n.lastFrame=this.lastFrame,n.loop=this.loop,n}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 n=0;n<this.textures.length;n++){const r=this.textures[n];typeof r.dispose=="function"?r.dispose():typeof r.unbind=="function"&&r.unbind()}return this}_update(){const n=this._textures;let r,o,s,a,l,c,d,u;return n&&(this._flagTextures&&(this._amount=n.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(a=this._amount,Ie.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=Ie.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=Gt(this._firstFrame,u,s/l),d=Math.floor(d),d!==this._index&&(this._index=d,c=n[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 Ke))&&(c=n[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}};S(Dn,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),S(Dn,"DefaultFrameRate",30);let Ds=Dn;const gd={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(t){const e=this._renderer.bindTextures,n=this._renderer.unbindTextures;this._textures&&this._textures.unbind(te.Types.insert,e).unbind(te.Types.remove,n),this._textures=new hi((t||[]).slice(0)),this._textures.bind(te.Types.insert,e).bind(te.Types.remove,n),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}};function ay(){this._flagTextures=!0}function ly(t){let e=t.length;for(;e--;)t[e].bind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function cy(t){let e=t.length;for(;e--;)t[e].unbind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function pd(t){if(t instanceof Ke)return t;if(typeof t=="string")return new Ke(t)}const $i=class $i extends br{constructor(n,r,o,s,a,l){super(r,o,0,0);S(this,"_flagTexture",!1);S(this,"_flagColumns",!1);S(this,"_flagRows",!1);S(this,"_flagFrameRate",!1);S(this,"_flagIndex",!1);S(this,"_amount",1);S(this,"_duration",0);S(this,"_startTime",0);S(this,"_playing",!1);S(this,"_firstFrame",0);S(this,"_lastFrame",0);S(this,"_loop",!0);S(this,"_texture",null);S(this,"_columns",1);S(this,"_rows",1);S(this,"_frameRate",0);S(this,"_index",0);S(this,"_origin",null);this._renderer.type="sprite";for(let c in yd)Object.defineProperty(this,c,yd[c]);this.noStroke(),this.noFill(),n instanceof Ke?this.texture=n:typeof n=="string"&&(this.texture=new Ke(n)),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(n){const r=new $i().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<$i.Properties.length;r++){const o=$i.Properties[r];o in n&&(this[o]=n[o])}return this}play(n,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=Ie.performance.now(),typeof n=="number"&&(this._firstFrame=n),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(n){const r=new $i(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,n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="sprite",n.texture=this.texture.toObject(),n.columns=this.columns,n.rows=this.rows,n.frameRate=this.frameRate,n.index=this.index,n.firstFrame=this.firstFrame,n.lastFrame=this.lastFrame,n.loop=this.loop,n}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 n=this._texture,r=this._columns,o=this._rows;let s,a,l,c,d,u,h,f,g;if(n&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=n),n.loaded)){h=n.image.width,f=n.image.height,s=h/r,a=f/o,c=this._amount,this.width!==s&&(this.width=s),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&(Ie.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=Ie.performance.now()-this._startTime,g=this._lastFrame+1,d=1e3*(g-this._firstFrame)/this._frameRate,this._loop?l=l%d:l=Math.min(l,d),u=Gt(this._firstFrame,g,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,p=Math.floor(this._index/r),y=-s*m+(h-s)/2,b=-a*p+(f-a)/2;y!==n.offset.x&&(n.offset.x=y),b!==n.offset.y&&(n.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};S($i,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let Ls=$i;const yd={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(t){this._columns=t,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(t){this._rows=t,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}},go=Math.min,po=Math.max,an=class an extends $n{constructor(n){super();S(this,"_flagAdditions",!1);S(this,"_flagSubtractions",!1);S(this,"_flagOrder",!1);S(this,"_flagOpacity",!0);S(this,"_flagBeginning",!1);S(this,"_flagEnding",!1);S(this,"_flagLength",!1);S(this,"_flagMask",!1);S(this,"_fill","#fff");S(this,"_stroke","#000");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_cap","round");S(this,"_join","round");S(this,"_miter",4);S(this,"_closed",!0);S(this,"_curved",!1);S(this,"_automatic",!0);S(this,"_beginning",0);S(this,"_ending",1);S(this,"_length",0);S(this,"_mask",null);S(this,"_strokeAttenuation",!0);for(let r in bd)Object.defineProperty(this,r,bd[r]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(n)?n:Array.prototype.slice.call(arguments)}static InsertChildren(n){for(let r=0;r<n.length;r++)_d.call(this,n[r],this)}static RemoveChildren(n){for(let r=0;r<n.length;r++)_d.call(this,n[r])}static OrderChildren(n){this._flagOrder=!0}static fromObject(n){const r=new an;for(let s=0;s<an.Properties.length;s++){const a=an.Properties[s];a in n&&(/(fill|stroke)/i.test(a)?r[a]=typeof n[a]=="string"?n[a]:mi(n[a]):r[a]=n[a])}return"mask"in n&&(r.mask=o(n.mask)),"id"in n&&(r.id=n.id),r.children=n.children.map(o),r;function o(s){if(s&&s.renderer)switch(s.renderer.type){case"arc-segment":return $s.fromObject(s);case"circle":return Ps.fromObject(s);case"element":return pr.fromObject(s);case"ellipse":return Is.fromObject(s);case"group":return an.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Ds.fromObject(s);case"path":return Me.fromObject(s);case"points":return mo.fromObject(s);case"polygon":return Ms.fromObject(s);case"rectangle":return br.fromObject(s);case"rounded-rectangle":return As.fromObject(s);case"shape":return $n.fromObject(s);case"sprite":return Ls.fromObject(s);case"star":return Os.fromObject(s);case"text":return Ui.fromObject(s)}return s}}copy(n){super.copy.call(this,n),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let r=0;r<an.Properties.length;r++){const o=an.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new an,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),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="group",n.children=[],n.opacity=this.opacity,n.className=this.className,n.mask=this.mask?this.mask.toObject():null,Ie.each(this.children,(r,o)=>{n.children[o]=r.toObject()},this),n}dispose(){if(super.dispose(),this.children)for(let n=0;n<this.children.length;n++){const r=this.children[n];typeof r.dispose=="function"&&r.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}corner(){const n=this.getBoundingClientRect(!0);for(let r=0;r<this.children.length;r++){const o=this.children[r];o.translation.x-=n.left,o.translation.y-=n.top}return this.mask&&(this.mask.translation.x-=n.left,this.mask.translation.y-=n.top),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,o=n.top+n.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(n){let r=null;function o(s){if(s.id===n)return s;if(s.children){if(s.children.ids[n])return s.children.ids[n];for(let a=0;a<s.children.length;a++)if(r=o(s.children[a]),r)return r}return null}return o(this)}getByClassName(n){const r=[];function o(s){if(Array.prototype.indexOf.call(s.classList,n)>=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(n){const r=[];function o(s){if(s instanceof n&&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(n){n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let r=0;r<n.length;r++){const o=n[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(n){const r=arguments.length,o=this.parent;if(r<=0&&o)return o.remove(this),this;n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let s=0;s<n.length;s++){const a=n[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(n){let r,o,s,a,l,c;this._update(!0);let d=1/0,u=-1/0,h=1/0,f=-1/0;const g=/texture|gradient/i;o=n?this.matrix:this.worldMatrix;for(let m=0;m<this.children.length;m++){const p=this.children[m];if(!(!p.visible||g.test(p._renderer.type))&&(r=p.getBoundingClientRect(n),s=typeof r.top!="number"||Ie.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||Ie.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||Ie.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||Ie.isNaN(r.bottom)||!isFinite(r.bottom),!(s||a||l||c)))if(n){const[y,b]=o.multiply(r.left,r.top),[_,C]=o.multiply(r.right,r.top),[k,E]=o.multiply(r.left,r.bottom),[$,x]=o.multiply(r.right,r.bottom);h=go(b,C,E,x,h),d=go(y,_,k,$,d),u=po(y,_,k,$,u),f=po(b,C,E,x,f)}else h=go(r.top,h),d=go(r.left,d),u=po(r.right,u),f=po(r.bottom,f)}return{top:h,left:d,right:u,bottom:f,width:u-d,height:f-h}}noFill(){return this.children.forEach(function(n){n.noFill()}),this}noStroke(){return this.children.forEach(function(n){n.noStroke()}),this}subdivide(){const n=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,n)}),this}_update(){let n,r,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(n=0;n<this.children.length;n++)o=this.children[n],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}};S(an,"Children",rd),S(an,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let En=an;const bd={visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._flagVisible=this._visible!==t||this._flagVisible,this._visible=t}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!==t||this._flagOpacity,this._opacity=t}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._flagBeginning=this._beginning!==t||this._flagBeginning,this._beginning=t}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._flagEnding=this._ending!==t||this._flagEnding,this._ending=t}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let t=0;t<this.children.length;t++){const e=this.children[t];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){this._fill=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.fill=t}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){this._stroke=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.stroke=t}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.linewidth=t}}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.join=t}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.miter=t}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.cap=t}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.closed=t}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.curved=t}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){this._automatic=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.automatic=t}}},children:{enumerable:!0,get:function(){return this._children},set:function(t){const e=En.InsertChildren.bind(this),n=En.RemoveChildren.bind(this),r=En.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new rd(t),this._children.bind(te.Types.insert,e),this._children.bind(te.Types.remove,n),this._children.bind(te.Types.order,r),t.length>0&&e(t)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Ie.isObject(t)&&!t.clip&&(t.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.strokeAttenuation!==void 0&&(n.strokeAttenuation=t)}}}};function _d(t,e){const n=t.parent;let r;if(n===e){o();return}if(n&&n.children.ids[t.id]&&(r=Array.prototype.indexOf.call(n.children,t),n.children.splice(r,1),s()),e){o();return}s(),n._flagAdditions&&n.additions.length===0&&(n._flagAdditions=!1),n._flagSubtractions&&n.subtractions.length===0&&(n._flagSubtractions=!1),delete t.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,t),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,t),r>=0&&e.additions.splice(r,1)),t.parent=e,e.additions.push(t),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(n.additions,t),r>=0&&n.additions.splice(r,1),r=Array.prototype.indexOf.call(n.subtractions,t),r<0&&(n.subtractions.push(t),n._flagSubtractions=!0)}}class yo extends Me{constructor(e,n,r,o){const s=[new Fe(e,n),new Fe(r,o)];super(s);for(let a in wd)Object.defineProperty(this,a,wd[a]);this.vertices[0].command=pe.move,this.vertices[1].command=pe.line,this.automatic=!1}}S(yo,"Properties",["left","right"]);const wd={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if(Ie.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=pe.move;else{const e=new co("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(t){if(Ie.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=pe.line;else{const e=new co("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class Hs{constructor(e=0,n=0){this.x=e,this.y=n}}class _n{constructor(e=10,n=0,r="A"){S(this,"start",new Hs);S(this,"end",new Hs);this.width=e,this.angle=n,this.label=r}}const je={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"}},dy={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function uy(t,e){return i.openBlock(),i.createElementBlock("svg",dy,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"m289.94 256l95-95A24 24 0 0 0 351 127l-95 95l-95-95a24 24 0 0 0-34 34l95 95l-95 95a24 24 0 1 0 34 34l95-95l95 95a24 24 0 0 0 34-34Z"},null,-1)])])}const bo=i.markRaw({name:"ion-close",render:uy}),hy={class:"mr-3 flex flex-col gap-2"},fy=["onClick"],my={class:"h-full p-2"},gy={},py=i.defineComponent({...gy,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(t,{emit:e}){const n=t,r=i.ref(!1),o=i.useTemplateRef("drawing-template-containers"),s=i.useTemplateRef("drawing-custom-template-containers"),a=e,l=c=>{r.value=!0,a("remove-custom-template",c,()=>{r.value=!1})};return i.onMounted(()=>{var c,d;(c=n.settings.templates)==null||c.forEach((u,h)=>{var g;const f=(g=o.value)==null?void 0:g.at(h);f&&a("init-draw-template",f,u)}),(d=n.settings.customTemplates)==null||d.forEach((u,h)=>{var g;const f=(g=s.value)==null?void 0:g.at(h);f&&a("init-draw-template",f,u)})}),i.watch(()=>[...n.settings.customTemplates],(c,d)=>{i.nextTick(()=>{c.forEach((u,h)=>{var f;if(!(d!=null&&d.includes(u))){const g=(f=s.value)==null?void 0:f.at(h);g&&a("init-draw-template",g,u)}}),d.length>c.length&&d.forEach((u,h)=>{var g;const f=(g=s.value)==null?void 0:g.at(h);f&&(f.innerHTML="",a("init-draw-template",f,u))})})},{deep:!0}),(c,d)=>{const u=bo;return i.openBlock(),i.createBlock(i.unref(O.NScrollbar),{style:{width:"auto"},trigger:"none",class:"max-h-[19rem] md:max-h-[40rem] w-auto"},{default:i.withCtx(()=>[i.createElementVNode("div",hy,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.settings.allTemplates,(h,f)=>(i.openBlock(),i.createElementBlock("div",{key:`${h.id}-${f}`,class:"group relative"},[i.createVNode(i.unref(O.NPopover),{trigger:"hover",placement:"right"},{trigger:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["relative h-10 w-24 shrink-0 rounded-md border-2 border-solid border-slate-200",{"!border-green-700":f===t.selectTemplateIndex}]),onClick:g=>a("template:select",f)},[i.createElementVNode("div",my,[i.createElementVNode("div",{ref_for:!0,ref:h.isCustom&&h.id!==-1?"drawing-custom-template-containers":"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,fy)]),default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(h.label),1)]),_:2},1024),h.isCustom&&!h.isNewRec()?(i.openBlock(),i.createBlock(i.unref(O.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:g=>l(f)},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),xd=jn(py,[["__scopeId","data-v-afccb364"]]),yy={class:"flex gap-3 min-w-[20rem] relative"},by={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},_y={ref:"drawing-container",class:"size-full"},wy={},kd=i.defineComponent({...wy,__name:"kozyrek-configurator-preview",props:{settings:{},value:{},selectTemplateIndex:{}},emits:["pointer:move","pointer:up","template:select","remove-custom-template"],setup(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("drawing-container");let s=[],a=[],l=[],c=null;const d=.75,u=i.computed(()=>n.value.configuratorParams.linesAngles.map((D,H)=>new _n(n.value.configuratorParams.linesWidths[H],D,`A-${H+1}`))),h=i.computed(()=>n.value.configuratorParams.colorSide==="bottom"),f=i.computed(()=>{var D,H;return n.value.configuratorParams.startTailType&&((D=n.settings.startTailConfigs)!=null&&D[n.value.configuratorParams.startTailType])?(H=n.settings.startTailConfigs)==null?void 0:H[n.value.configuratorParams.startTailType].points:[]}),g=i.computed(()=>{var H;const D=n.value.configuratorParams.endTailType!==void 0&&((H=n.settings.endTailConfigs)==null?void 0:H[n.value.configuratorParams.endTailType]);return!D||!D.points?[]:D.points.map((L,A)=>Array.isArray(L)?new _n(L[0],L[1],`A-${A+1}`):new _n(L.width,L.angle,`A-${A+1}`))}),m=(D,H=!1)=>{D[0].start.x=0,D[0].start.y=0;let L=0;for(let A=0;A<D.length;A++){const z=D[A],U=D[A-1]??new _n(0,L);L+=!H||A>1?U.angle:0;const K=(!H||A>0?z.angle:0)+L;if(D[A].end.x=z.width*Math.cos(K*Math.PI/180)+D[A].start.x,D[A].end.y=z.width*Math.sin(K*Math.PI/180)+D[A].start.y,A<D.length-1){const F=A+1;D[F].start.x=D[A].end.x,D[F].start.y=D[A].end.y}}return D},p=(D,H,L,A,z=!1)=>{let U=m([...L,...A]);H.length>0&&(U=[...m(H),...U]);let K=0,F=0,q=0,Y=0;U.forEach(Te=>{K=Math.min(K,Te.start.x,Te.end.x),F=Math.min(F,Te.start.y,Te.end.y),q=Math.max(q,Te.start.x,Te.end.x),Y=Math.max(Y,Te.start.y,Te.end.y)});let J,ue;K===0&&F===0&&q===0&&Y===0?(J=1,ue=1):(J=D.width/Math.abs(q-K),ue=(z?D.height:D.height-je.colorSideLabel.size)/Math.abs(Y-F));const ve=Math.min(J,ue);return K=K<0?-K*ve:0,F=F<0?-F*ve:0,[ve,K,F]},y=D=>{const H=new mo([D]);return H._size=je.anchorPoint.size,H.fill=je.anchorPoint.color,H.stroke="transparent",H._linewidth=je.anchorPoint.strokeSize,l.push(H),H},b=(D,H)=>{if(l=[],n.settings.allowChangeFirstPoint){const L=D[0],A=new be(L.vertices[0].x,L.vertices[0].y);A.bind(te.Types.change,()=>{L.vertices[0].copy(A)});const z=y(A);H.add(z)}D.forEach((L,A)=>{const z=D[A+1],U=new be(L.vertices[1].x,L.vertices[1].y);U.bind(te.Types.change,()=>{L.vertices[1].copy(U),z!==void 0&&z.vertices[0].copy(U)});const K=y(U);H.add(K)})},_=D=>D*(Math.PI/180),C=(D,H,L)=>{const A=H.vertices.length-1;D.position.x=H.vertices[A].x,D.position.y=H.vertices[A].y;const z=Math.atan2(H.vertices[A].y-H.vertices[0].y,H.vertices[A].x-H.vertices[0].x);D.rotation=_(L)+z},k=(D,H,L)=>{if(H.vertices[0]===void 0)return;D.position.x=H.vertices[0].x,D.position.y=H.vertices[0].y;const A=H.vertices.length-1,z=Math.atan2(H.vertices[A].y-H.vertices[0].y,H.vertices[A].x-H.vertices[0].x);D.rotation=_(L)+z},E=(D,H,L)=>{const A=new En;if(D.length===0)return A;const z=[];return[...D].reverse().forEach((U,K)=>{K!==0&&U.angle>0&&(U.angle*=-1),z.push(U)}),D=m(z,!0),k(A,H,D[0].angle),[H.vertices[0],H.vertices[1]].forEach(U=>{U.bind(te.Types.change,()=>{k(A,H,D[0].angle)})}),D.forEach(U=>{const K=U.start.x*L,F=U.end.x*L,q=U.start.y*L,Y=U.end.y*L,J=new yo(K,q,F,Y);J.linewidth=je.line.size,J.stroke=je.line.color,A.add(J)}),A},$=(D,H,L)=>{const A=new En;return D.length===0||(D=m(D,!0),C(A,H,D[0].angle),[H.vertices[0],H.vertices[1]].forEach(z=>{z.bind(te.Types.change,()=>{C(A,H,D[0].angle)})}),D.forEach(z=>{const U=z.start.x*L,K=z.end.x*L,F=z.start.y*L,q=z.end.y*L,Y=new yo(U,F,K,q);Y.linewidth=je.line.size,Y.stroke=je.line.color,A.add(Y)})),A},x=(D,H,L,A)=>{const z=H.vertices[0].x+(H.vertices[1].x-H.vertices[0].x)/2-8*Math.sin(D.angle*Math.PI/180),U=H.vertices[0].y+(H.vertices[1].y-H.vertices[0].y)/2-8*Math.cos(D.angle*Math.PI/180),K=new Ui(D.label,z+10,U-10);let F;K.size=je.lineLabel.size,K.weight=600,K.fill=je.lineLabel.color,K.id+=1,K.rotation=je.lineLabel.rotation,A>0&&(F=new Ui(`${D.angle}°`,H.vertices[0].x+25,H.vertices[0].y-25),F.size=je.angleLabel.size,F.weight=600,F.fill=je.angleLabel.color,F.rotation=je.angleLabel.rotation,F.id+=A,s.push(F),L.add(F)),L.add(K),w(K,H,0,F),w(K,H,1)},B=()=>{const{size:D}=je.colorSideLabel,H=0,L=0,A=h.value?D/2:D/2-D,z=h.value?D/2-D:D/2,U=new En;if(!c)return U;const K=5,F=Math.atan2(z-A,L-H),q=[new Fe(H,A,0,0,0,0,pn.Commands.move),new Fe(L,z,0,0,0,0,pn.Commands.line),new Fe(L-K*Math.cos(F-Math.PI/4),z-K*Math.sin(F-Math.PI/4),0,0,0,0,pn.Commands.line),new Fe(L,z,0,0,0,0,pn.Commands.move),new Fe(L-K*Math.cos(F+Math.PI/4),z-K*Math.sin(F+Math.PI/4),0,0,0,0,pn.Commands.line)],Y=new Me(q,!1,!1,!0);Y.noFill(),Y.cap="round",Y.join="round",Y.linewidth=D/7,Y.stroke=je.colorSideLabel.color,U.add(Y);const J=new Ui(h.value?"Цвет снизу":"Цвет сверху",10,0);J.size=D,J.weight=600,J.fill=je.colorSideLabel.color,J.alignment="left",U.add(J);const ue=U.getBoundingClientRect();return U.position.x=(c.width-ue.width)*d+10,U.position.y=h.value?c.height+ue.height*2:ue.height/2,U},w=(D,H,L,A)=>{H.vertices[L].bind(te.Types.change,()=>{const z=H.vertices.length-1,U=Math.atan2(H.vertices[0].y-H.vertices[z].y,H.vertices[0].x-H.vertices[z].x)*180/Math.PI,K=H.vertices[0].x+(H.vertices[z].x-H.vertices[0].x)/2-8*Math.sin(U*Math.PI/180),F=H.vertices[0].y+(H.vertices[z].y-H.vertices[0].y)/2-8*Math.cos(U*Math.PI/180);D.position.x=K+10,D.position.y=F-10,D.rotation=-.5,A&&(A.position.x=H.vertices[0].x+25,A.position.y=H.vertices[0].y-25)})},T=(D,H,L,A,z=!1)=>{var We;if(D.clear(),L.length===0){D.update();return}const U=m(L),[K,F,q]=p(D,H,U,A,z),Y=new En,J=new Array,ue=new Array;z||(s=[],a=[]),U.forEach((ce,mt)=>{const Ne=ce.start.x*K+F,Pt=ce.end.x*K+F,Wt=ce.start.y*K+q,ln=ce.end.y*K+q,Ct=new yo(Ne,Wt,Pt,ln);Ct.linewidth=z?je.previewLine.size:je.line.size,Ct.stroke=z?je.previewLine.color:je.line.color,a.push(Ct),J.push(Ct),Y.add(Ct),!z&&ce.label!==""&&x(ce,Ct,Y,mt)});const ve=J.at(-1);let Te=Y.getBoundingClientRect();if(!z){const ce=B();ue.push(ce)}if(H.length>0){const ce=E(H,J[0],K);Y.add(ce)}if(A.length>0&&ve){const ce=$(A,ve,K);Y.add(ce)}if(ue.push(Y),D.makeGroup(ue),Te=Y.getBoundingClientRect(),Y.position.x=0-Te.left+(D.width-Te.width)/(2*(z?1:d)),Y.position.y=0-Te.top+(D.height-Te.height)/(2*(z?1:d)),D.update(),!z){const ce=((We=n.value.configuratorParams)==null?void 0:We.colorSide)==="top";Y.position.y=Y.position.y+je.colorSideLabel.size*Number(ce),b(J,Y),D.update()}},N=(D,H)=>{if(D&&!H.isNewRec()){const L=new pn({width:D.scrollWidth,height:D.scrollHeight});L.appendTo(D),T(L,[],H.points,[],!0)}},V=()=>{c&&T(c,f.value,u.value,g.value,!1)},R=D=>D*(180/Math.PI),I=(D,H)=>{const L=D[1].x-D[0].x,A=D[1].y-D[0].y,z=H[1].x-H[0].x,U=H[1].y-H[0].y;let K=Math.atan2(L*U-A*z,L*z+A*U);return K=R(K),Math.round(K)*-1},W=D=>{const H=a.map((L,A,z)=>{const U=z[A-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let K=Math.ceil(L._length/D/n.settings.lineWidthStep)*n.settings.lineWidthStep;const F=s[A-1];K<(z.length>1?n.settings.minLineWidth:n.settings.stripMinWidth)&&(K=z.length>1?n.settings.minLineWidth:n.settings.stripMinWidth),K>n.settings.maxLineWidth&&(K=n.settings.maxLineWidth);const q=I(L.vertices,U.vertices);return F&&(F.value=`${q}°`),new _n(K,q,`A-${A+1}`)});r("pointer:move",H)},ee=D=>{let H=null,L;const A=F=>{H=l.find(q=>{const Y=q.renderer;return(Y==null?void 0:Y.elem)===F.target}),[L]=p(D,f.value,u.value.map(q=>q),g.value)},z=F=>{if(H){const q=H.renderer,Y=q==null?void 0:q.elem;if(!Y)return;const J=Y.getBoundingClientRect();H.vertices[0].x-=J.x-(F instanceof MouseEvent?F.clientX:F.targetTouches[0].clientX)+je.anchorPoint.size/2,H.vertices[0].y-=J.y-(F instanceof MouseEvent?F.clientY:F.targetTouches[0].clientY)+je.anchorPoint.size/2,W(L),D.update()}},U=()=>{H&&r("pointer:up",u.value),H=null},K=o.value;K&&(K.addEventListener("touchstart",A,{passive:!0}),K.addEventListener("touchend",U,{passive:!0}),K.addEventListener("mousedown",A),K.addEventListener("mouseup",U),K.addEventListener("mousemove",z),K.addEventListener("touchmove",z,{passive:!0}))},ne=(D,H)=>{r("remove-custom-template",D,H)};return i.onMounted(()=>{o.value&&(c=new pn({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),i.watch(()=>n.value,()=>{V()},{deep:!0,immediate:!0}),ee(c))}),i.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(D,H)=>(i.openBlock(),i.createElementBlock("div",yy,[i.createVNode(xd,{"select-template-index":t.selectTemplateIndex,settings:t.settings,"onTemplate:select":H[0]||(H[0]=L=>r("template:select",L)),onInitDrawTemplate:N,onRemoveCustomTemplate:ne},null,8,["select-template-index","settings"]),i.createElementVNode("div",by,[i.createElementVNode("div",_y,null,512)])]))}});class Ki extends j.Identity{constructor(n,r){super();S(this,"label","");S(this,"points",[]);S(this,"isCustom",!1);S(this,"id",-1);S(this,"guid","");n?(this.label=n.label,this.points=n.points.map((o,s)=>M.isArray(o)?new _n(o[0],o[1],`A-${s+1}`):new _n(o.width,o.angle,`A-${s+1}`)),this.isCustom=n.isCustom):(this.label="-- Новая конфигурация --",this.points=[new _n(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class Ws extends Ki{constructor(n){super(n);S(this,"isDefault");this.isDefault=n.isDefault??!1}}class vd{constructor(e){S(this,"minLineWidth");S(this,"maxLineWidth");S(this,"lineWidthStep");S(this,"minLineAngle");S(this,"maxLineAngle");S(this,"lineAngleStep");S(this,"stripMinWidth");S(this,"stripMaxWidth");S(this,"stripMinLength");S(this,"stripMaxLength");S(this,"allowShowTable");S(this,"showOnlyTemplates");S(this,"templates");S(this,"customTemplates",[]);S(this,"startTailConfigs");S(this,"endTailConfigs");S(this,"bendCountForExtended");S(this,"extendedProductCatalog");S(this,"allowChangeFirstPoint");S(this,"allowSaveTemplates");S(this,"userTemplatesPrefix");S(this,"lengthStep");S(this,"canSetDopProdaga");var n,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 Ki(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((n=e.startTailConfigs)==null?void 0:n.map(o=>new Ws(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new Ws(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 Ki(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new Ki({label:"-- Новая конфигурация --",points:[new _n(this.stripMinWidth,0,"A-1")],isCustom:!0,id:-1,guid:""})))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(e){if(!this.allowSaveTemplates)return;const n=this.customTemplates.findLast(o=>!o.isNewRec()),r=new Ki(e);r.isCustom=!0,r.id=n?n.id+1:0,this.customTemplates.splice(-1,0,r)}removeCustomTemplate(e){if(!this.allowSaveTemplates)return;const n=this.customTemplates.findIndex(r=>r.id===e);n!==-1&&this.customTemplates.splice(n,1)}}const xy={class:"flex flex-col gap-3"},ky={class:"grid gap-5 md:grid-cols-5"},vy={},Cd=i.defineComponent({...vy,__name:"kozyrek-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{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(t,{emit:e}){const n=t,r=e,o=i.ref(!1),s=i.ref(!1),a=i.ref(!1),l=i.ref(n.cartItem),c=i.ref(new vd(n.settings)),d=i.ref({linesWidths:[...n.cartItem.configuratorParams.linesWidths],linesAngles:[...n.cartItem.configuratorParams.linesAngles]}),u=i.ref({quantity:{},marker:{},length:{}}),h=i.ref(0),f=i.useTemplateRef("kozyrek-configurator-params-form"),g=(w=0)=>{var N;const T=(N=c.value.allTemplates)==null?void 0:N.at(w);T!==void 0&&(h.value=w,l.value.configuratorParams.linesWidths=T.points.map(V=>M.isArray(V)?V[0]:V.width),l.value.configuratorParams.linesAngles=T.points.map(V=>M.isArray(V)?V[1]:V.angle),C()),b(l.value.configuratorParams)},m=async()=>{const w=prompt("Введите название шаблона:");if(!w)return;a.value=!0;const T={label:w,points:l.value.configuratorParams.linesWidths.map((V,R)=>[V,l.value.configuratorParams.linesAngles[R]])},N=V=>{V&&(c.value.addCustomTemplate(T),h.value=c.value.allTemplates.length-2),a.value=!1};n.eventEmitter.emit("configurator:create-template",{category:n.cartItem.category,template:T,callback:N})},p=async(w,T)=>{var R;const N=(R=c.value.allTemplates)==null?void 0:R.at(w);if(!N||!N.isCustom)return;const V=I=>{I&&(c.value.removeCustomTemplate(N.id),g()),T==null||T()};n.eventEmitter.emit("configurator:remove-template",{category:n.cartItem.category,templateId:N.id,callback:V})},y=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(h.value=c.value.allTemplates.length-1)},b=async w=>{var T,N;l.value.product=new j.ClientProduct,(N=(T=f.value)==null?void 0:T.formReference)==null||N.validate(V=>{V||(C(),o.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:w,validationFieldResultData:u.value,callback:R=>{R?l.value.product=R:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(M.noop)},_=async()=>{var w,T;(T=(w=f.value)==null?void 0:w.formReference)==null||T.validate(N=>{var V,R;if(!N){s.value=!0;const I=new j.OrderItemBase(l.value);(V=c.value.startTailConfigs)!=null&&V.length||delete I.configuratorParams.startTailType,(R=c.value.endTailConfigs)!=null&&R.length||delete I.configuratorParams.endTailType,r("submit",I,u.value,()=>{s.value=!1,i.nextTick(()=>{var W,ee;(ee=(W=f.value)==null?void 0:W.formReference)==null||ee.restoreValidation()})})}}).catch(M.noop)},C=()=>{const w={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach((T,N)=>{w[`lines_widths[${N+1}]`]={},w[`lines_angles[${N+1}]`]={}}),u.value=w},k=w=>{d.value.linesWidths=w.map(T=>T.width),d.value.linesAngles=w.map(T=>T.angle)},E=w=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,C(),y(),b(l.value.configuratorParams)},$=(w,T)=>{d.value.linesWidths=w,d.value.linesAngles=T},x=w=>{const T=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,N=0;l.value.configuratorParams.linesWidths.splice(w+1,0,T),l.value.configuratorParams.linesAngles.splice(w+1,0,N),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],C(),y(),b(l.value.configuratorParams)},B=w=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(w,1),l.value.configuratorParams.linesAngles.splice(w,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],C(),y(),b(l.value.configuratorParams))};return i.onBeforeMount(()=>{n.cartItem.isNewRec()?g():(C(),b(l.value.configuratorParams))}),i.watch(()=>n.cartItem,w=>{l.value=new j.OrderItemBase(w),w.isNewRec()?g():(C(),b(l.value.configuratorParams))}),(w,T)=>{const N=O.NButton;return i.openBlock(),i.createElementBlock("div",xy,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(N,{key:0,type:"tertiary",class:"self-end",onClick:T[0]||(T[0]=V=>r("click:view-switch"))},{default:i.withCtx(()=>[...T[3]||(T[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",ky,[i.createVNode(kd,{value:l.value,"select-template-index":h.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":E,"onPointer:move":k,"onTemplate:select":g,onRemoveCustomTemplate:p},null,8,["value","select-template-index","settings"]),i.createVNode(ll,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":T[1]||(T[1]=V=>l.value=V),"preview-params":d.value,validation:u.value,settings:c.value,"is-submit-processing":s.value,"is-product-searching":o.value,"select-template-index":h.value,class:"col-span-2","onUpdate:params":T[2]||(T[2]=V=>b(V)),"onUpdate:preview":$,onSubmit:_,"onClick:saveTemplate":m,"onClick:addLine":x,"onClick:removeLine":B},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),Cy={class:"flex flex-col items-center justify-between rounded-xl"},Sy={class:"img-preview relative flex justify-center"},By={},Ty=i.defineComponent({...By,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(t,{emit:e}){const n=t,r=i.computed(()=>{const{height:s}=n.configuratorParams,a=M.keys(n.settings.crossbarCount).reverse().find(l=>{const c=n.settings.crossbarCount[Number(l)];return s>=c});if(a!==void 0)return String(Number(a)+1)}),o=e;return(s,a)=>{const l=O.NButton;return i.openBlock(),i.createElementBlock("div",Cy,[i.createElementVNode("div",Sy,[a[1]||(a[1]=i.createElementVNode("div",{class:"window"},null,-1)),i.createElementVNode("div",{class:i.normalizeClass(["net",`net-${t.configuratorParams.netType}`])},null,2),i.createElementVNode("div",{class:i.normalizeClass(["frame",`frame-${t.configuratorParams.color}`])},null,2),r.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["frame-crossbar",`frame-crossbar-${r.value}-${t.configuratorParams.color}`])},null,2)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["mount",`mount-${t.configuratorParams.mountType}-${t.configuratorParams.color}`])},null,2),i.createElementVNode("div",{class:i.normalizeClass(["cut-preview",`cut-preview-${t.configuratorParams.mountType}-${t.configuratorParams.color}`])},null,2)]),i.createVNode(l,{type:"primary",class:"block justify-self-center",onClick:a[0]||(a[0]=c=>o("open-instructions"))},{default:i.withCtx(()=>[...a[2]||(a[2]=[i.createTextVNode(" Руководство по замеру ",-1)])]),_:1})])}}}),js=jn(Ty,[["__scopeId","data-v-a67fd61e"]]),Ny={key:0,class:"flex items-baseline gap-1"},$y={key:0,class:"flex items-baseline gap-1"},Ey={key:1},Ry={class:"text-lg font-semibold"},Py={key:2,class:"text-red-500 text-sm mb-2"},Fy={class:"flex gap-3"},Vy={},Sd=i.defineComponent({...Vy,__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(t,{expose:e,emit:n}){var x;const r=t,o=n,s=i.computed(()=>St.isPhoneDevice()),a=i.useTemplateRef("form-reference"),l=i.useTemplateRef("width-form-item-reference"),c=i.useTemplateRef("height-form-item-reference"),d=i.useTemplateRef("width-input-reference"),u=i.ref(M.cloneDeep(r.value)),h=i.computed(()=>r.settings.widthOverlaps[u.value.configuratorParams.mountType]??0),f=i.computed(()=>r.settings.heightOverlaps[u.value.configuratorParams.mountType]??0),g=i.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),m=i.computed(()=>r.settings.maxHeights[u.value.configuratorParams.netType]),p=i.computed(()=>u.value.configuratorParams.width?u.value.configuratorParams.width+h.value:0),y=i.computed(()=>u.value.configuratorParams.height?u.value.configuratorParams.height+f.value:0),b=i.ref(r.settings.canSetDopProdaga??!1),_=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth-h.value),ae.max(g.value-h.value),ae.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[ae.required,ae.min(r.settings.minHeight-f.value),ae.max(m.value-f.value),ae.step(1),He.serverValidation(r.validation.height.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),C=i.computed(()=>{var R;const B=p.value,w=y.value,{quantity:T}=r.value,N=((R=r.value.product)==null?void 0:R.costRub)||0;if(!B||!w||!T||N===0)return null;const V=B*w/1e6;return(N*T*V).toLocaleString("ru-ru",{minimumFractionDigits:2})}),k=i.computed(()=>{const B=p.value,w=y.value,T=!!(B&&B>=r.settings.minWidth&&B<=r.settings.maxWidths[u.value.configuratorParams.netType]),N=!!(w&&w>=r.settings.minHeight&&w<=r.settings.maxHeights[u.value.configuratorParams.netType]),V=!!(r.value.quantity&&r.value.quantity>0);return T&&N&&V}),E=(B,w)=>{var V,R;const T=u.value.configuratorParams;B&&B in T&&(T[B]=w);const N={...T,width:p.value??0,height:y.value??0};B==="width"&&((V=l.value)==null||V.validate().catch(M.noop)),B==="height"&&((R=c.value)==null||R.validate().catch(M.noop)),i.nextTick(()=>{var W,ee;!((W=l.value)!=null&&W.validationErrored)&&!((ee=c.value)!=null&&ee.validationErrored)&&N.height&&N.width&&o("update:params",N),$("configuratorParams",N)})},$=(B,w)=>{const T=new j.OrderItemBase(r.value);T[B]=w,B==="configuratorParams"&&(T.product=new j.ClientProduct),o("update:value",T)};return i.watch(()=>r.value,B=>{const w=M.cloneDeep(i.toRaw(B)),T=w.configuratorParams.mountType,N=r.settings.widthOverlaps[T]??0,V=r.settings.heightOverlaps[T]??0;w.configuratorParams.width&&w.configuratorParams.width>0&&(w.configuratorParams.width-=N),w.configuratorParams.height&&w.configuratorParams.height>0&&(w.configuratorParams.height-=V),u.value=w},{deep:!0}),i.onMounted(()=>{var B;(B=d.value)==null||B.select()}),e({validate:(x=a.value)==null?void 0:x.validate,formReference:a}),(B,w)=>{const T=O.NCheckbox;return i.openBlock(),i.createBlock(i.unref(O.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",onKeydown:w[25]||(w[25]=i.withKeys(i.withModifiers(N=>o("submit",u.value),["prevent"]),["enter"]))},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:u.value.configuratorParams.netType,"onUpdate:value":[w[0]||(w[0]=N=>u.value.configuratorParams.netType=N),w[1]||(w[1]=N=>E("netType",N))],options:t.settings.netType.map(N=>({label:t.settings.descriptions.net_type[N],value:N}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:u.value.configuratorParams.color,"onUpdate:value":[w[2]||(w[2]=N=>u.value.configuratorParams.color=N),w[3]||(w[3]=N=>E("color",N))],options:t.settings.color.map(N=>({label:t.settings.descriptions.color[N],value:N}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:u.value.configuratorParams.mountType,"onUpdate:value":[w[4]||(w[4]=N=>u.value.configuratorParams.mountType=N),w[5]||(w[5]=N=>E("mountType",N))],options:t.settings.mountType.map(N=>({label:t.settings.descriptions.mount_type[N],value:N}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(O.NFormItem),{ref:"width-form-item-reference",path:"configuratorParams.width",label:`Ширина светового проёма от ${t.settings.minWidth-h.value} ${g.value?" до "+(g.value-h.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.width.showFeedback&&p.value>=t.settings.minWidth&&p.value<=t.settings.maxWidths[u.value.configuratorParams.netType]?(i.openBlock(),i.createElementBlock("div",Ny,[i.createVNode(i.unref(O.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Ширина готового изделия "+i.toDisplayString(p.value),1)]),_:1}),i.createVNode(i.unref(O.NButton),{quaternary:"",type:"info",size:"tiny",onClick:w[10]||(w[10]=N=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...w[26]||(w[26]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{ref:"width-input-reference",value:u.value.configuratorParams.width,"onUpdate:value":[w[6]||(w[6]=N=>u.value.configuratorParams.width=N),w[9]||(w[9]=N=>E("width",N))],parse:i.unref(it),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:w[7]||(w[7]=N=>i.unref(tt)(N)),onInput:w[8]||(w[8]=N=>i.unref(et)(t.validation,"width")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(O.NFormItem),{ref:"height-form-item-reference",path:"configuratorParams.height",label:`Высота светового проёма от ${t.settings.minHeight-f.value} ${m.value?" до "+(m.value-f.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.height.showFeedback&&y.value>=t.settings.minHeight&&y.value<=t.settings.maxHeights[u.value.configuratorParams.netType]?(i.openBlock(),i.createElementBlock("div",$y,[i.createVNode(i.unref(O.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Высота готового изделия "+i.toDisplayString(y.value),1)]),_:1}),i.createVNode(i.unref(O.NButton),{quaternary:"",type:"info",size:"tiny",onClick:w[15]||(w[15]=N=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...w[27]||(w[27]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[w[11]||(w[11]=N=>u.value.configuratorParams.height=N),w[14]||(w[14]=N=>E("height",N))],parse:i.unref(it),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:w[12]||(w[12]=N=>i.unref(tt)(N)),onInput:w[13]||(w[13]=N=>i.unref(et)(t.validation,"height")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(O.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:u.value.quantity,"onUpdate:value":[w[16]||(w[16]=N=>u.value.quantity=N),w[19]||(w[19]=N=>$("quantity",N??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:w[17]||(w[17]=N=>i.unref(tt)(N,!1)),onInput:w[18]||(w[18]=N=>i.unref(et)(t.validation,"quantity")),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(O.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:w[20]||(w[20]=N=>i.unref(et)(t.validation,"marker")),"onUpdate:value":w[21]||(w[21]=N=>{u.value.marker=N??null,$("marker",N??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),b.value?(i.openBlock(),i.createBlock(T,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":w[22]||(w[22]=N=>{u.value.isAdditionalSale=N??!1,$("isAdditionalSale",N??!1)})},{default:i.withCtx(()=>[...w[28]||(w[28]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(hr,{"is-product-searching":t.isProductSearching,product:u.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),C.value?(i.openBlock(),i.createElementBlock("div",Ey,[w[29]||(w[29]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",Ry,i.toDisplayString(C.value)+" ₽",1)])):i.createCommentVNode("",!0),k.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Py," Пожалуйста, заполните все обязательные поля корректно. ")),i.createElementVNode("div",Fy,[i.createVNode(i.unref(O.NButton),{loading:t.isSubmitProcessing,disabled:!k.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:w[23]||(w[23]=N=>o("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"]),s.value?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,type:"default",onClick:w[24]||(w[24]=N=>o("click:show-preview-drawer"))},{default:i.withCtx(()=>[...w[30]||(w[30]=[i.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1},8,["model","rules"])}}}),Iy="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",My="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",Ay="/img/configurators/mosquitto/measurement-instructions/mount.png",Oy="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",zy="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",Dy={class:"flex flex-col gap-6"},Ly={class:"flex gap-4"},Hy={class:"flex flex-col gap-2"},Wy={class:"flex gap-4"},jy={class:"flex flex-col gap-2"},qy={class:"flex gap-4"},Xy={class:"flex flex-col gap-2"},Yy={},Bd=i.defineComponent({...Yy,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(t,{emit:e}){const n=St.initRefDependingOnDeviceResolution("small","small","medium"),r=St.initRefDependingOnDeviceResolution(.98,.95,.8),o=i.computed(()=>window.innerWidth*r.value),s=e;return(a,l)=>{const c=O.NText;return i.openBlock(),i.createBlock(i.unref(O.NModal),{show:t.show,"show-icon":!1,size:i.unref(n),style:i.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:i.withCtx(()=>[i.createElementVNode("div",Dy,[i.createVNode(c,{type:"error",class:"text-base font-medium"},{default:i.withCtx(()=>[...l[3]||(l[3]=[i.createTextVNode(" Важно! Для того,что бы произвести замер, необходимо открыть оконную створку. ",-1)])]),_:1}),l[22]||(l[22]=i.createElementVNode("div",{class:"grid gap-6 md:grid-cols-2"},[i.createElementVNode("div",{class:"flex items-start gap-4"},[i.createElementVNode("img",{src:Iy,alt:"measurement-height",class:"w-[7.5rem]"}),i.createElementVNode("div",{class:"flex flex-col gap-2"},[i.createElementVNode("span",{class:"text-lg font-bold"},"Замер ширины"),i.createElementVNode("span",null,"Замерить по ширине световой проем оконной рамы. Размер учитывать c точностью до 1 мм")])]),i.createElementVNode("div",{class:"flex items-start gap-4"},[i.createElementVNode("img",{src:My,alt:"measurement-height",class:"w-[7.5rem]"}),i.createElementVNode("div",{class:"flex flex-col gap-2"},[i.createElementVNode("span",{class:"text-lg font-bold"},"Замер высоты"),i.createElementVNode("span",null,"Замерить по высоте световой проем оконной рамы. Размер учитывать с точностью до 1 мм")])])],-1)),i.createElementVNode("div",Ly,[l[9]||(l[9]=i.createElementVNode("img",{src:Ay,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Hy,[l[8]||(l[8]=i.createElementVNode("span",{class:"text-lg font-bold"},"Крепление на раме сетки",-1)),i.createElementVNode("span",null,[l[4]||(l[4]=i.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[5]||(l[5]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(t.widthOverlaps.frame)+" мм. Высота светового проема +"+i.toDisplayString(t.heightOverlaps.frame)+" мм. ",1),l[6]||(l[6]=i.createElementVNode("br",null,null,-1)),l[7]||(l[7]=i.createTextVNode(" Крепления находятся на раме сетки. ",-1))])])]),i.createElementVNode("div",Wy,[l[15]||(l[15]=i.createElementVNode("img",{src:Oy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",jy,[l[14]||(l[14]=i.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление пластик (верх+низ)",-1)),i.createElementVNode("span",null,[l[10]||(l[10]=i.createTextVNode(" Расчетные размеры москитной сетки:",-1)),l[11]||(l[11]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(t.widthOverlaps.external_plastic)+" мм. Высота светового проема +"+i.toDisplayString(t.heightOverlaps.external_plastic)+" мм. ",1),l[12]||(l[12]=i.createElementVNode("br",null,null,-1)),l[13]||(l[13]=i.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])]),i.createElementVNode("div",qy,[l[21]||(l[21]=i.createElementVNode("img",{src:zy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Xy,[l[20]||(l[20]=i.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление металл (верх+низ)",-1)),i.createElementVNode("span",null,[l[16]||(l[16]=i.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[17]||(l[17]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(t.widthOverlaps.external_metal)+" мм. Высота светового проема +"+i.toDisplayString(t.heightOverlaps.external_metal)+" мм. ",1),l[18]||(l[18]=i.createElementVNode("br",null,null,-1)),l[19]||(l[19]=i.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])])])]),_:1},8,["show","size","style"])}}}),Uy={class:"grid md:grid-cols-2"},Ky={},Td=i.defineComponent({...Ky,__name:"mosquito-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{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(t,{emit:e}){const n=t,r=e,o=i.computed(()=>St.isPhoneDevice()),s=i.ref(!1),a=i.ref(!1),l=i.ref(n.cartItem),c=i.useTemplateRef("mosquito-configurator-form"),d=i.ref({width:{},height:{},quantity:{},marker:{}}),u=i.ref(!1),h=i.ref(!1),f=i.computed(()=>i.inject("debounce-input-time",300)),g=M.debounce(async p=>{var y,b;l.value.product=new j.ClientProduct,(b=(y=c.value)==null?void 0:y.formReference)==null||b.validate(_=>{_||(u.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:p,validationFieldResultData:d.value,callback:C=>{C?l.value.product=C:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(M.noop)},f.value),m=()=>{h.value=!0,r("submit",l.value,d.value,()=>{h.value=!1})};return i.watch(()=>n.cartItem,p=>{l.value=p},{deep:!0}),(p,y)=>{const b=bo;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(Bd,{show:a.value,"onUpdate:show":y[0]||(y[0]=_=>a.value=_),"height-overlaps":t.settings.heightOverlaps,"width-overlaps":t.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),i.createElementVNode("div",Uy,[o.value?(i.openBlock(),i.createBlock(i.unref(O.NDrawer),{key:1,show:s.value,"onUpdate:show":y[4]||(y[4]=_=>s.value=_),"default-width":375,resizable:""},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NDrawerContent),null,{header:i.withCtx(()=>[i.createVNode(i.unref(O.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:y[2]||(y[2]=_=>s.value=!1)},{default:i.withCtx(()=>[i.createVNode(b)]),_:1})]),default:i.withCtx(()=>[i.createVNode(js,{"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:y[3]||(y[3]=_=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(i.openBlock(),i.createBlock(js,{key:0,"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:y[1]||(y[1]=_=>a.value=!0)},null,8,["configurator-params","settings"])),i.createVNode(Sd,{ref:"mosquito-configurator-form",value:l.value,"onUpdate:value":y[5]||(y[5]=_=>l.value=_),validation:d.value,settings:t.settings,"is-product-searching":u.value,"is-submit-processing":h.value,"onUpdate:params":y[6]||(y[6]=_=>i.unref(g)(_)),onSubmit:y[7]||(y[7]=_=>m()),"onClick:instructionsToggle":y[8]||(y[8]=_=>a.value=!a.value),"onClick:showPreviewDrawer":y[9]||(y[9]=_=>s.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),Gy={},Nd=i.defineComponent({...Gy,__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},validation:{}},emits:["update:value","click:add-line","click:remove-line"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.useTemplateRef("width-input-element"),a=i.ref(!1),l=i.ref(r.value),c=i.useTemplateRef("form-item-reference"),d=i.computed(()=>{var f;return!((f=c.value)!=null&&f.validationErrored)}),u=f=>{l.value=f,o("update:value",f,r.index,a)},h=()=>{var f;(f=s.value)==null||f.select()};return i.watch(()=>r.value,f=>{l.value=f}),i.onMounted(()=>{r.autoFocus&&i.nextTick(()=>{h()})}),e({isValid:d,formItemReference:c}),(f,g)=>{const m=al,p=jr;return i.openBlock(),i.createBlock(i.unref(O.NFormItem),{ref:"form-item-reference",path:t.path,label:`Полоса №${t.index+1}, мм`,class:"sc-hide-empty-feedback-message"},{feedback:i.withCtx(()=>[d.value?(i.openBlock(),i.createBlock(hr,{key:0,"is-product-searching":a.value,product:t.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(i.unref(O.NDropdown),{trigger:"click",options:t.suggestionOption,placement:"bottom-start",size:"large",onSelect:u},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{ref:"width-input-element",value:l.value??null,class:"w-full","show-button":!1,parse:i.unref(it),placeholder:"Введите ширину",onKeydown:g[0]||(g[0]=y=>i.unref(tt)(y)),onInput:g[1]||(g[1]=y=>i.unref(et)(t.validation,`linesWidths.${t.index}`)),onFocus:i.unref(Le),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),i.createVNode(i.unref(O.NButton),{disabled:t.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:g[2]||(g[2]=y=>o("click:add-line",t.index))},{default:i.withCtx(()=>[i.createVNode(m)]),_:1},8,["disabled"]),i.createVNode(i.unref(O.NButton),{disabled:t.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:g[3]||(g[3]=y=>o("click:remove-line",t.index))},{default:i.withCtx(()=>[i.createVNode(p)]),_:1},8,["disabled"])]),_:1},8,["path","label"])}}}),Zy={class:"my-2 flex w-full flex-col"},Qy={key:1},Jy={class:"text-lg font-semibold"},e0={class:"flex gap-3"},t0={},$d=i.defineComponent({...t0,__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(t,{expose:e,emit:n}){var _;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("line-items-reference"),l=i.ref(M.cloneDeep(r.value)),c=i.computed(()=>{const C={length:[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(r.settings.lengthStep),He.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]};return M.forEach(l.value,(k,E)=>{var $;C[`configuratorParams.linesWidths.${E}`]=[ae.required,ae.min(r.settings.minLineWidth),ae.step(r.settings.lineWidthStep),He.serverValidation(($=r.validation[`linesWidths.${E}`])==null?void 0:$.feedback)]}),C}),d=i.ref(r.settings.canSetDopProdaga??!1),u=i.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((C,k)=>(C??0)+(k??0),0)),h=i.computed(()=>r.settings.width-u.value),f=i.computed(()=>!r.value.some(({product:C})=>!C||C.isNewRec())),g=i.computed(()=>r.isSubmitProcessing||!f.value||h.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(C=>C.product.isNewRec())),m=i.computed(()=>C=>h.value===0?void 0:[{label:`${(h.value>0?"Остаток +":"Излишек ")+h.value} мм.`,key:h.value+C}]),p=i.computed(()=>{const{length:C}=r.value[0];return!C||u.value!==r.settings.width?null:(M.reduce(r.value,(E,$)=>{var B;const x=((B=$.product)==null?void 0:B.costRub)||0;return E+x},0)*r.value[0].quantity*C).toLocaleString("ru-ru",{minimumFractionDigits:2})}),y=(C,k,E)=>{var x,B,w;l.value[k].product.id=-1;const{configuratorParams:$}=l.value[k];$.linesWidths[k]=C,b("configuratorParams",$),(w=(B=(x=a.value)==null?void 0:x.at(k))==null?void 0:B.formItemReference)==null||w.validate().catch(M.noop),i.nextTick(()=>{var T,N;(N=(T=a.value)==null?void 0:T.at(k))!=null&&N.isValid&&o("update:params",$,k,E)})},b=(C,k)=>{l.value.forEach(E=>{E[C]=k}),o("update:value",l.value)};return i.watch(()=>r.value,C=>{l.value=M.cloneDeep(C)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(C,k)=>{const E=O.NCheckbox;return i.openBlock(),i.createBlock(i.unref(O.NForm),{ref:"form-reference",model:l.value[0],rules:c.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message",onKeydown:k[15]||(k[15]=i.withKeys(i.withModifiers($=>o("submit",l.value),["prevent"]),["enter"]))},{default:i.withCtx(()=>{var $;return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(x,B)=>{var w,T,N;return i.openBlock(),i.createBlock(Nd,{key:B,ref_for:!0,ref:"line-items-reference",value:((w=x.configuratorParams)==null?void 0:w.linesWidths.at(B))??null,"auto-focus":(((T=x.configuratorParams)==null?void 0:T.linesWidths.at(B))??0)===0,index:B,path:`configuratorParams.linesWidths.${B}`,product:x.product,settings:t.settings,validation:t.validation,"suggestion-option":m.value(((N=x.configuratorParams)==null?void 0:N.linesWidths.at(B))??0),"add-line-button-disabled":h.value<=0||t.value.length>=t.settings.maxLinesCount||t.value.some(V=>V.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"onUpdate:value":y,"onClick:addLine":k[0]||(k[0]=V=>o("click:add-line",V)),"onClick:removeLine":k[1]||(k[1]=V=>o("click:remove-line",V))},null,8,["value","auto-focus","index","path","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled"])}),128)),i.createElementVNode("div",Zy,[h.value<0?(i.openBlock(),i.createBlock(i.unref(O.NText),{key:0,type:"error"},{default:i.withCtx(()=>[i.createTextVNode(" Сумма ширин всех полос должна быть равна "+i.toDisplayString(t.settings.width),1)]),_:1})):i.createCommentVNode("",!0),f.value&&l.value.length===t.settings.maxLinesCount&&h.value>0?(i.openBlock(),i.createBlock(i.unref(O.NText),{key:1,type:"error"},{default:i.withCtx(()=>[...k[16]||(k[16]=[i.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",null,[k[17]||(k[17]=i.createTextVNode(" Остаток для резки: ",-1)),i.createVNode(i.unref(O.NText),{type:h.value>=0?"Success":"error"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(h.value),1)]),_:1},8,["type"]),i.createTextVNode(" из "+i.toDisplayString(t.settings.width)+" мм ",1)])]),i.createVNode(i.unref(O.NButton),{disabled:g.value,type:"primary",class:"self-center",onClick:k[2]||(k[2]=x=>o("click:add-line",l.value.length))},{default:i.withCtx(()=>[...k[18]||(k[18]=[i.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["disabled"]),i.createVNode(i.unref(O.NFormItem),{path:"length",label:`Метраж ${t.settings.minLength?" от "+t.settings.minLength:""} ${t.settings.maxLength?" до "+t.settings.maxLength:""} м.`},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:l.value[0].length,"onUpdate:value":[k[3]||(k[3]=x=>l.value[0].length=x),k[6]||(k[6]=x=>b("length",x))],parse:i.unref(it),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:k[4]||(k[4]=x=>i.unref(tt)(x,!1)),onInput:k[5]||(k[5]=x=>i.unref(et)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(O.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:l.value[0].quantity,"onUpdate:value":[k[7]||(k[7]=x=>l.value[0].quantity=x),k[10]||(k[10]=x=>b("quantity",x))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:k[8]||(k[8]=x=>i.unref(tt)(x,!1)),onInput:k[9]||(k[9]=x=>i.unref(et)(t.validation,"quantity")),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(O.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:l.value[0].marker??null,placeholder:"Введите маркировку",onInput:k[11]||(k[11]=x=>i.unref(et)(t.validation,"marker")),"onUpdate:value":k[12]||(k[12]=x=>{l.value[0].marker=x??null,b("marker",x??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(E,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":k[13]||(k[13]=x=>{l.value[0].isAdditionalSale=x??!1,b("isAdditionalSale",x??!1)})},{default:i.withCtx(()=>[...k[19]||(k[19]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),p.value?(i.openBlock(),i.createElementBlock("div",Qy,[k[20]||(k[20]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",Jy,i.toDisplayString(p.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",e0,[i.createVNode(i.unref(O.NButton),{loading:t.isSubmitProcessing,disabled:!f.value||h.value!=0||!(($=l.value[0])!=null&&$.length)||l.value[0].length>t.settings.maxLength||l.value[0].length<t.settings.minLength||l.value[0].quantity===0,type:"primary",class:"self-start",onClick:k[14]||(k[14]=x=>o("submit",l.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(l.value[0].isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])}}}),n0={class:"flex grow flex-col"},i0=["src"],r0={class:"w-full"},o0={},Ed=i.defineComponent({...o0,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",n0,[i.createElementVNode("img",{src:"/img/configurators/strip/strip-"+t.value.length+".png",class:"w-full max-w-96 self-center py-5",alt:"Штрипс"},null,8,i0),i.createElementVNode("div",r0,[i.createTextVNode(" Число полос можно указать от "+i.toDisplayString(t.settings.minLinesCount)+" до "+i.toDisplayString(t.settings.maxLinesCount)+". ",1),n[0]||(n[0]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Минимальная ширина полосы "+i.toDisplayString(t.settings.minLineWidth)+" мм. ",1),n[1]||(n[1]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина всех полос "+i.toDisplayString(t.settings.width)+" мм. ",1),n[2]||(n[2]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Шаг ширины полосы - "+i.toDisplayString(t.settings.lineWidthStep)+" мм. ",1)])]))}}),s0={class:"flex flex-col gap-2"},a0={class:"w-104 flex grow flex-col px-5"},l0={},Rd=i.defineComponent({...l0,__name:"strip-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{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(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("strip-configurator-form"),s=i.ref(n.cartItems),a=i.ref({width:{},length:{},quantity:{},marker:{}}),l=i.ref(!1),c=i.computed(()=>i.inject("debounce-input-time",300)),d=i.computed(()=>{var m;return(m=s.value[0].configuratorParams)==null?void 0:m.linesWidths.reduce((p,y)=>(p??0)+(y??0),0)}),u=m=>{m===void 0&&(m=s.value.length-1);const p=s.value.at(0);if(!p)return;p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(m+1,0,null),s.value.forEach(b=>{b.configuratorParams.linesWidths=p.configuratorParams.linesWidths});const y=new j.OrderItemBase({quantity:(p==null?void 0:p.quantity)??1,category:p==null?void 0:p.category,length:(p==null?void 0:p.length)??n.settings.minLength,marker:p==null?void 0:p.marker,configuratorParams:{linesWidths:p==null?void 0:p.configuratorParams.linesWidths}});s.value=s.value.toSpliced(m+1,0,y)},h=m=>{const p=s.value.at(0);p&&(p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(m,1),s.value.forEach(y=>{y.configuratorParams.linesWidths=p.configuratorParams.linesWidths}),s.value=s.value.toSpliced(m,1),delete a[`linesWidths.${m}`],delete a[`linesWidths.${m}`])},f=M.debounce(async(m,p,y)=>{const b={linesWidths:m.linesWidths.at(p)};y.value=!0,a.value[`linesWidths.${p}`]={},s.value[p].product=new j.ClientProduct,n.eventEmitter.emit("configurator:search-product",{category:s.value[p].category,params:b,validationFieldResultData:a.value,callback:_=>{_?(s.value[p].product=_,p===s.value.length-1&&s.value.length<n.settings.maxLinesCount&&d.value&&d.value<n.settings.width&&u()):(s.value[p].product=new j.ClientProduct,a.value[`linesWidths.${p}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},y.value=!1),y.value=!1}})},c.value),g=async()=>{var m,p;(p=(m=o.value)==null?void 0:m.formReference)==null||p.validate(y=>{if(!y){l.value=!0;const b=s.value.at(0);if(!b)return;r("submit",b,a.value,()=>{l.value=!1,i.nextTick(()=>{var _,C;(C=(_=o.value)==null?void 0:_.formReference)==null||C.restoreValidation()})})}}).catch(M.noop)};return i.watch(()=>n.cartItems,m=>{s.value=m.map(p=>new j.OrderItemBase(p))}),(m,p)=>{const y=O.NButton;return i.openBlock(),i.createElementBlock("div",s0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(y,{key:0,type:"tertiary",class:"self-center",onClick:p[0]||(p[0]=b=>r("click:view-switch"))},{default:i.withCtx(()=>[...p[3]||(p[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",a0,[i.createVNode(Ed,{value:s.value,"onUpdate:value":p[1]||(p[1]=b=>s.value=b),settings:t.settings},null,8,["value","settings"]),i.createVNode($d,{ref:"strip-configurator-form",value:s.value,"onUpdate:value":p[2]||(p[2]=b=>s.value=b),validation:a.value,settings:t.settings,"is-submit-processing":l.value,"onUpdate:params":i.unref(f),onSubmit:g,"onClick:addLine":u,"onClick:removeLine":h},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),c0={class:"flex flex-col gap-3"},d0={},Pd=i.defineComponent({...d0,__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(t,{expose:e,emit:n}){var g;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("first-input-element"),l=i.ref(M.cloneDeep(r.value)),c=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth),...r.settings.maxWidth?[ae.max(r.settings.maxWidth)]:[],ae.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(1),He.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),d=i.ref(r.settings.canSetDopProdaga??!1),u=()=>{o("update:params",l.value.configuratorParams),h("configuratorParams",l.value.configuratorParams)},h=(m,p)=>{const y=new j.OrderItemBase(r.value);y[m]=p,m==="configuratorParams"&&(y.product=new j.ClientProduct),o("update:value",y)},f=()=>{var m;(m=a.value)==null||m.select()};return i.watch(()=>r.value,m=>{l.value=M.cloneDeep(m)},{deep:!0}),i.onMounted(()=>{r.value.isNewRec()&&i.nextTick(()=>{f()})}),e({validate:(g=s.value)==null?void 0:g.validate,formReference:s}),(m,p)=>{const y=O.NCheckbox;return i.openBlock(),i.createBlock(i.unref(O.NForm),{ref:"form-reference",model:l.value,rules:c.value,disabled:t.isSubmitProcessing,class:"flex flex-col gap-2 sc-hide-empty-feedback-message",onKeydown:p[13]||(p[13]=i.withKeys(i.withModifiers(b=>o("submit",l.value),["prevent"]),["enter"]))},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NFormItem),{path:"configuratorParams.width",label:`Ширина, ${t.settings.minWidth?" от "+t.settings.minWidth:""}${t.settings.maxWidth?" до "+t.settings.maxWidth:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{ref:"first-input-element",value:l.value.configuratorParams.width,"onUpdate:value":[p[0]||(p[0]=b=>l.value.configuratorParams.width=b),u],class:"w-full",parse:i.unref(it),"show-button":!1,placeholder:"Введите ширину",onKeydown:p[1]||(p[1]=b=>i.unref(tt)(b)),onInput:p[2]||(p[2]=b=>i.unref(et)(t.validation,"width")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(O.NFormItem),{path:"configuratorParams.length",label:`Длина, ${t.settings.minLength?" от "+t.settings.minLength:""}${t.settings.maxLength?" до "+t.settings.maxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[p[3]||(p[3]=b=>l.value.configuratorParams.length=b),u],placeholder:"Введите длину",parse:i.unref(it),"show-button":!1,class:"w-full",onKeydown:p[4]||(p[4]=b=>i.unref(tt)(b)),onInput:p[5]||(p[5]=b=>i.unref(et)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(O.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:t.value.quantity,placeholder:"Введите количество",min:1,"show-button":!1,class:"w-full",onKeydown:p[6]||(p[6]=b=>i.unref(tt)(b,!1)),onInput:p[7]||(p[7]=b=>i.unref(et)(t.validation,"quantity")),"onUpdate:value":p[8]||(p[8]=b=>h("quantity",b??0)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(O.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:t.value.marker??null,placeholder:"Введите маркировку",onInput:p[9]||(p[9]=b=>i.unref(et)(t.validation,"marker")),"onUpdate:value":p[10]||(p[10]=b=>h("marker",b??null)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(y,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":p[11]||(p[11]=b=>{l.value.isAdditionalSale=b??!1,h("isAdditionalSale",b??!1)})},{default:i.withCtx(()=>[...p[14]||(p[14]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(hr,{"is-product-searching":t.isProductSearching,product:t.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),i.createElementVNode("div",c0,[i.createVNode(i.unref(O.NButton),{disabled:t.value.product.isNewRec()||t.isProductSearching||t.isSubmitProcessing||t.value.length===0||t.value.width===0||t.value.quantity===0,type:"primary",class:"self-start",onClick:p[12]||(p[12]=b=>o("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["model","rules","disabled"])}}}),u0={class:"flex flex-col gap-2 w-72"},h0={},Fd=i.defineComponent({...h0,__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]},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(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("metal-for-doors-configurator-form"),s=i.ref(n.cartItem),a=i.ref({width:{},length:{},quantity:{},marker:{}}),l=i.ref(!1),c=i.ref(!1),d=i.computed(()=>i.inject("debounce-input-time",300)),u=M.debounce(async f=>{var g,m;s.value.product=new j.ClientProduct,(m=(g=o.value)==null?void 0:g.formReference)==null||m.validate(p=>{p||(l.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:f,validationFieldResultData:a.value,callback:y=>{y?s.value.product=y:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(M.noop)},d.value),h=async()=>{var f,g;(g=(f=o.value)==null?void 0:f.formReference)==null||g.validate(m=>{m||(c.value=!0,r("submit",s.value,a.value,()=>{c.value=!1,i.nextTick(()=>{var p,y;(y=(p=o.value)==null?void 0:p.formReference)==null||y.restoreValidation()})}))}).catch(M.noop)};return i.watch(()=>n.cartItem,f=>{s.value=new j.OrderItemBase(f)},{deep:!0}),(f,g)=>{const m=O.NButton;return i.openBlock(),i.createElementBlock("div",u0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(m,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=p=>r("click:view-switch"))},{default:i.withCtx(()=>[...g[4]||(g[4]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Pd,{ref:"metal-for-doors-configurator-form",value:s.value,"onUpdate:value":g[1]||(g[1]=p=>s.value=p),validation:a.value,settings:t.settings,"is-submit-processing":c.value,"is-product-searching":l.value,"onUpdate:params":g[2]||(g[2]=p=>i.unref(u)(p)),onSubmit:g[3]||(g[3]=p=>h())},null,8,["value","validation","settings","is-submit-processing","is-product-searching"])])}}}),f0={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function m0(t,e){return i.openBlock(),i.createElementBlock("svg",f0,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 112v288m144-144H112"},null,-1)])])}const Vd=i.markRaw({name:"ion-add",render:m0}),g0={key:0,class:"-mt-1 text-sm text-gray-500"},p0={class:"font-bold"},y0={class:"flex flex-col gap-3"},b0={key:0,class:"mt-4 flex flex-col gap-1.5"},_0={class:"flex flex-col gap-1 text-sm text-gray-700"},w0={key:0},x0={key:1},k0={"form-array-name":"items",class:"flex flex-col gap-3"},v0={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},C0={key:0,class:"flex flex-wrap items-end gap-2"},S0={class:"whitespace-nowrap text-xl font-bold"},B0={key:0,class:"whitespace-nowrap text-lg text-gray-500"},T0={class:"font-bold"},N0={class:"font-bold"},$0={class:"flex gap-3"},E0={},Id=i.defineComponent({...E0,__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]},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(t,{expose:e,emit:n}){var H;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.ref(M.cloneDeep(r.value)),l=i.ref({...r.validation}),c=L=>{var A;delete l.value[L],(A=s.value)==null||A.restoreValidation()};i.watch(()=>r.validation,L=>{l.value={...L},Object.values(L).some(z=>z==null?void 0:z.feedback)&&i.nextTick(()=>{var z;return(z=s.value)==null?void 0:z.validate(M.noop).catch(M.noop)})},{deep:!0});const d=i.computed(()=>r.value.category),u=i.ref(null),h=i.ref(null),f=i.computed(()=>d.value.products??[]),g=i.computed(()=>f.value.map(L=>({label:L.name,value:L.id}))),m=(L,A,z)=>{const U=L!=null&&L>0,K=A!=null&&A>0;return!U&&!K?null:U&&K?`от ${L} ${z} до ${A} ${z}`:U?`от ${L} ${z}`:`до ${A} ${z}`},p=i.computed(()=>{var L,A;return m(r.settings.minWidth,(A=(L=u.value)==null?void 0:L.properties)==null?void 0:A.width,"мм")}),y=i.computed(()=>{var L,A;return m(r.settings.minLength,(A=(L=u.value)==null?void 0:L.properties)==null?void 0:A.length,"мм")}),b=i.ref(null),_=i.ref(!1);i.computed(()=>{var L,A;return(A=(L=u.value)==null?void 0:L.properties)!=null&&A.width?ae.max(u.value.properties.width):null}),i.computed(()=>{var L,A;return(A=(L=u.value)==null?void 0:L.properties)!=null&&A.length?ae.max(u.value.properties.length):null});const C=i.computed(()=>{var A;const L={marker:[He.serverValidation((A=l.value.marker)==null?void 0:A.feedback)]};return a.value.configuratorParams.items.forEach((z,U)=>{var K,F,q,Y,J,ue,ve;L[`configuratorParams.items.${U}.width`]=[ae.required,ae.min(r.settings.minWidth),...(F=(K=u.value)==null?void 0:K.properties)!=null&&F.width?[ae.max(u.value.properties.width)]:[],ae.step(1),He.serverValidation((q=l.value[`items.${U}.width`])==null?void 0:q.feedback)],L[`configuratorParams.items.${U}.length`]=[ae.required,ae.min(r.settings.minLength),...(J=(Y=u.value)==null?void 0:Y.properties)!=null&&J.length?[ae.max(u.value.properties.length)]:[],ae.step(1),He.serverValidation((ue=l.value[`items.${U}.length`])==null?void 0:ue.feedback)],L[`configuratorParams.items.${U}.count`]=[ae.required,ae.min(1),ae.step(1),He.serverValidation((ve=l.value[`items.${U}.count`])==null?void 0:ve.feedback)]}),L}),k=i.ref(r.settings.canSetDopProdaga??!1),E=i.computed(()=>a.value.configuratorParams.items.some(L=>{var A,z;return!u.value||!L.width||L.width<r.settings.minWidth||L.width>(((A=u.value.properties)==null?void 0:A.width)??0)||L.length===0||L.length<r.settings.minLength||L.length>(((z=u.value.properties)==null?void 0:z.length)??0)||!L.count||L.count<1})),$=i.computed(()=>!u.value||E.value||a.value.configuratorParams.items.length===0),x=i.ref(null),B=L=>{if(!L){u.value=null,h.value=null,a.value.product=new j.ClientProduct,b.value=null;return}const A=f.value.find(z=>z.id===L);A&&(u.value=A,h.value=L,a.value.product=A,ne("product",a.value.product),a.value.configuratorParams.items.forEach(z=>{var U,K;(U=A.properties)!=null&&U.width&&z.width>A.properties.width&&(z.width=A.properties.width),(K=A.properties)!=null&&K.length&&z.length>A.properties.length&&(z.length=A.properties.length)}),T())};let w=!1;const T=()=>{w=!0,b.value=null,x.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},N=async()=>{var L;if(!u.value||a.value.configuratorParams.items.length===0||E.value){T();return}(L=s.value)==null||L.validate(A=>{if(A){T();return}if(_.value=!0,!u.value||!d.value){T(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:z=>{z?(b.value=z,a.value.configuratorParams.calculationId=z.id,a.value.quantity=z.quantity,i.nextTick(()=>{ne("quantity",z.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,T()),ne("configuratorParams",a.value.configuratorParams),V(),_.value=!1}})}).catch(()=>{T(),_.value=!1})},V=()=>{var A;if(!((A=u.value)!=null&&A.costRub)||!b.value){x.value=null;return}const L=b.value.quantity*u.value.costRub;x.value=Math.round(L*100)/100},R=L=>{var z,U;const A=a.value.configuratorParams.items[L];u.value&&((z=u.value.properties)!=null&&z.width&&A.width>u.value.properties.width&&(A.width=u.value.properties.width),(U=u.value.properties)!=null&&U.length&&A.length>u.value.properties.length&&(A.length=u.value.properties.length)),ne("configuratorParams",a.value.configuratorParams),T()},I=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),ne("configuratorParams",a.value.configuratorParams),T(),o("add-item",a.value.configuratorParams.items.length)},W=L=>{a.value.configuratorParams.items.splice(L,1),ne("configuratorParams",a.value.configuratorParams),T(),o("remove-item",L)},ee=()=>{if(!($.value||_.value||r.isSubmitProcessing)){if(!b.value){N();return}o("submit",a.value)}},ne=(L,A)=>{const z=new j.OrderItemBase(r.value);z[L]=A,o("update:value",z)};i.watch(()=>r.value,L=>{const A=M.cloneDeep(i.toRaw(L));(!A.configuratorParams.items||A.configuratorParams.items.length===0)&&(A.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=A,r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,h.value=r.value.product.id),r.value.product.isNewRec()&&(u.value=null,h.value=null),w?w=!1:D()},{deep:!0});const D=()=>{const{calculationId:L}=a.value.configuratorParams,A=a.value.quantity??0;L&&A>0&&a.value.product&&!a.value.product.isNewRec()&&(b.value={id:L,quantity:A,sheets:[]},V())};return i.onMounted(()=>{r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,h.value=r.value.product.id),D()}),e({validate:(H=s.value)==null?void 0:H.validate,formReference:s}),(L,A)=>{const z=jr,U=Vd;return i.openBlock(),i.createBlock(i.unref(O.NForm),{ref:"form-reference",model:a.value,rules:C.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message",onKeydown:i.withKeys(i.withModifiers(ee,["prevent"]),["enter"])},{default:i.withCtx(()=>{var K;return[i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:h.value,"onUpdate:value":[A[0]||(A[0]=F=>h.value=F),B],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((K=u.value)==null?void 0:K.costRub)!=null?(i.openBlock(),i.createElementBlock("div",g0,[i.createElementVNode("span",p0,i.toDisplayString(u.value.code),1),i.createTextVNode(" — "+i.toDisplayString(u.value.costRub.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol)+"/шт. ",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",y0,[u.value?(i.openBlock(),i.createElementBlock("div",b0,[A[7]||(A[7]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",_0,[p.value?(i.openBlock(),i.createElementBlock("div",w0,"Ширина "+i.toDisplayString(p.value)+".",1)):i.createCommentVNode("",!0),y.value?(i.openBlock(),i.createElementBlock("div",x0,"Длина "+i.toDisplayString(y.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",k0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value.configuratorParams.items,(F,q)=>(i.openBlock(),i.createElementBlock("div",{key:q,class:"flex grow gap-2"},[i.createElementVNode("div",v0,[i.createVNode(i.unref(O.NFormItem),{path:`configuratorParams.items.${q}.width`,label:"Ширина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:a.value.configuratorParams.items[q].width,"onUpdate:value":[Y=>a.value.configuratorParams.items[q].width=Y,Y=>R(q)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:A[1]||(A[1]=Y=>i.unref(tt)(Y)),onInput:Y=>c(`items.${q}.width`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(O.NFormItem),{path:`configuratorParams.items.${q}.length`,label:"Длина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:a.value.configuratorParams.items[q].length,"onUpdate:value":[Y=>a.value.configuratorParams.items[q].length=Y,Y=>R(q)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:A[2]||(A[2]=Y=>i.unref(tt)(Y)),onInput:Y=>c(`items.${q}.length`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(O.NFormItem),{path:`configuratorParams.items.${q}.count`,label:"Количество, шт"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:a.value.configuratorParams.items[q].count,"onUpdate:value":[Y=>a.value.configuratorParams.items[q].count=Y,Y=>R(q)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:A[3]||(A[3]=Y=>i.unref(tt)(Y,!1)),onInput:Y=>c(`items.${q}.count`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),i.createVNode(i.unref(O.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:Y=>W(q)},{default:i.withCtx(()=>[i.createVNode(z)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:1,disabled:E.value,type:"default",class:"self-center",onClick:I},{default:i.withCtx(()=>[i.createVNode(U),A[8]||(A[8]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0)]),i.createVNode(i.unref(O.NFormItem),{path:"marker",label:"Маркировка распила"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:a.value.marker??null,disabled:!u.value,placeholder:"Введите маркировку распила",onInput:A[4]||(A[4]=F=>c("marker")),"onUpdate:value":A[5]||(A[5]=F=>ne("marker",F??null)),onFocus:i.unref(Le)},null,8,["value","disabled","onFocus"])]),_:1}),k.value?(i.openBlock(),i.createBlock(i.unref(O.NCheckbox),{key:1,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":A[6]||(A[6]=F=>{a.value.isAdditionalSale=F??!1,ne("isAdditionalSale",F??!1)})},{default:i.withCtx(()=>[...A[9]||(A[9]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(i.unref(O.NSpin),{show:_.value,size:"small",class:"grow"},{default:i.withCtx(()=>{var F;return[b.value&&u.value&&x.value?(i.openBlock(),i.createElementBlock("div",C0,[i.createElementVNode("div",null,[A[10]||(A[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",S0,i.toDisplayString(x.value.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol),1)]),b.value.quantity&&u.value?(i.openBlock(),i.createElementBlock("div",B0,[i.createElementVNode("span",T0,"("+i.toDisplayString(b.value.quantity)+" шт.",1),A[11]||(A[11]=i.createTextVNode(" x ",-1)),i.createElementVNode("span",N0,i.toDisplayString((F=u.value.costRub)==null?void 0:F.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]}),_:1},8,["show"]),i.createElementVNode("div",$0,[b.value&&!_.value?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,loading:t.isSubmitProcessing,disabled:$.value||_.value,type:"primary",class:"self-start",onClick:ee},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(a.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])):(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:1,loading:_.value,disabled:$.value||_.value,type:"info",class:"self-start",onClick:N},{default:i.withCtx(()=>[...A[12]||(A[12]=[i.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules","onKeydown"])}}}),R0={class:"flex flex-col gap-2"},P0={class:"w-104 flex grow flex-col px-5"},F0={},Md=i.defineComponent({...F0,__name:"sandwich-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{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(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("sandwich-configurator-form"),s=i.ref(n.cartItem),a=i.ref({width:{},length:{},quantity:{},marker:{},product:{}}),l=i.ref(!1),c=async()=>{var h,f;(f=(h=o.value)==null?void 0:h.formReference)==null||f.validate(g=>{if(!g){l.value=!0;const m=M.cloneDeep(s.value);"items"in m.configuratorParams&&delete m.configuratorParams.items,r("submit",m,a.value,()=>{l.value=!1,i.nextTick(()=>{var p,y;(y=(p=o.value)==null?void 0:p.formReference)==null||y.restoreValidation()})})}}).catch(M.noop)},d=h=>{a.value[`items.${h}.width`]={},a.value[`items.${h}.length`]={},a.value[`items.${h}.count`]={}},u=h=>{delete a.value[`items.${h}.width`],delete a.value[`items.${h}.length`],delete a.value[`items.${h}.count`]};return i.onMounted(()=>{n.cartItem.configuratorParams.items.forEach((h,f)=>{a.value[`items.${f}.width`]={},a.value[`items.${f}.length`]={},a.value[`items.${f}.count`]={}})}),i.watch(()=>n.cartItem,h=>{s.value=new j.OrderItemBase(h)},{deep:!0}),(h,f)=>{const g=O.NButton;return i.openBlock(),i.createElementBlock("div",R0,[t.settings.allowShowTable&&s.value.isNewRec()?(i.openBlock(),i.createBlock(g,{key:0,type:"tertiary",class:"self-center",onClick:f[0]||(f[0]=m=>r("click:view-switch"))},{default:i.withCtx(()=>[...f[2]||(f[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",P0,[i.createVNode(Id,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":f[1]||(f[1]=m=>s.value=m),validation:a.value,settings:t.settings,"event-emitter":t.eventEmitter,"is-submit-processing":l.value,onSubmit:c,onAddItem:d,onRemoveItem:u},null,8,["value","validation","settings","event-emitter","is-submit-processing"])])])}}}),V0={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function I0(t,e){return i.openBlock(),i.createElementBlock("svg",V0,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"},null,-1)])])}const M0=i.markRaw({name:"ion-checkmark",render:I0}),A0={key:0,class:"-mt-1 text-sm text-gray-500"},O0={class:"font-bold"},z0={class:"flex flex-col gap-3"},D0={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},L0={class:"flex flex-col gap-1 text-sm text-gray-700"},H0={key:0},W0={key:1},j0={"form-array-name":"items",class:"flex flex-col gap-3"},q0={class:"min-w-0 flex-1"},X0={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},Y0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},U0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},K0={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},G0={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},Z0={key:0,class:"lg:!flex-[2]"},Q0={class:"font-bold"},J0={key:1,class:"lg:!flex-[3]"},eb={class:"font-bold"},tb={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"},nb={key:0},ib={class:"font-bold"},rb={key:1},ob={class:"font-bold"},sb={class:"flex flex-wrap items-center gap-3"},ab={},Ad=i.defineComponent({...ab,__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]},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(t,{expose:e,emit:n}){var K;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("widthInputs"),l=r.value==null?[]:M.cloneDeep(i.toRaw(r.value)),c=i.ref(l.map(F=>new j.OrderItemBase(F))),d=i.computed(()=>({items:c.value})),u=i.ref({...r.validation}),h=F=>{var q;delete u.value[F],(q=s.value)==null||q.restoreValidation()},f=i.ref(null),g=i.ref(null),m=i.computed(()=>{var F,q;return((q=(F=c.value[0])==null?void 0:F.category)==null?void 0:q.products)??[]}),p=i.computed(()=>m.value.map(F=>({label:F.name,value:F.id}))),y=(F,q,Y)=>{const J=F!=null&&F>0,ue=q!=null&&q>0;return!J&&!ue?null:J&&ue?`от ${F} ${Y} до ${q} ${Y}`:J?`от ${F} ${Y}`:`до ${q} ${Y}`},b=i.computed(()=>{var F,q;return y(r.settings.minWidth,(q=(F=f.value)==null?void 0:F.properties)==null?void 0:q.width,"мм")}),_=i.computed(()=>{var F,q;return y(r.settings.minLength,(q=(F=f.value)==null?void 0:F.properties)==null?void 0:q.length,"мм")}),C=i.computed(()=>{const F={};return c.value.forEach((q,Y)=>{var J,ue,ve,Te,We,ce,mt,Ne;F[`items.${Y}.configuratorParams.width`]=[ae.required,ae.min(r.settings.minWidth),...(ue=(J=f.value)==null?void 0:J.properties)!=null&&ue.width?[ae.max(f.value.properties.width)]:[],ae.step(1),He.serverValidation((ve=u.value[`items.${Y}.width`])==null?void 0:ve.feedback)],F[`items.${Y}.configuratorParams.length`]=[ae.required,ae.min(r.settings.minLength),...(We=(Te=f.value)==null?void 0:Te.properties)!=null&&We.length?[ae.max(f.value.properties.length)]:[],ae.step(1),He.serverValidation((ce=u.value[`items.${Y}.length`])==null?void 0:ce.feedback)],F[`items.${Y}.quantity`]=[ae.required,ae.min(1),ae.step(1),He.serverValidation((mt=u.value[`items.${Y}.quantity`])==null?void 0:mt.feedback)],F[`items.${Y}.marker`]=[He.serverValidation((Ne=u.value[`items.${Y}.marker`])==null?void 0:Ne.feedback)]}),F});i.watch(()=>r.validation,F=>{u.value={...F},Object.values(F).some(Y=>Y==null?void 0:Y.feedback)&&i.nextTick(()=>{var Y;return(Y=s.value)==null?void 0:Y.validate(M.noop).catch(M.noop)})},{deep:!0});const k=i.ref(r.settings.canSetDopProdaga??!1),E=i.computed(()=>{const F=f.value;return F?c.value.some(q=>{var ve,Te;const Y=q.configuratorParams,J=(ve=F.properties)==null?void 0:ve.width,ue=(Te=F.properties)==null?void 0:Te.length;return Y.width===0||Y.width<r.settings.minWidth||J!=null&&Y.width>J||Y.length===0||Y.length<r.settings.minLength||ue!=null&&Y.length>ue||q.quantity===0||q.quantity<1}):!0}),$=i.computed(()=>!f.value||E.value||c.value.length===0),x=i.computed(()=>{const F=c.value[0];return F!=null&&!F.isNewRec()}),B=F=>r.itemStates[F]??"idle",w=F=>B(F)==="success",T=F=>B(F)==="loading",N=i.computed(()=>c.value.length===0?!0:c.value.every((F,q)=>{const Y=B(q);return Y==="success"||Y==="loading"})),V=F=>F.width===0||F.length===0?0:F.width*F.length/1e6,R=F=>{var ve;const q=F.configuratorParams,Y=V(q),J=((ve=f.value)==null?void 0:ve.costRub)??0,ue=F.quantity??0;return!Y||!ue?0:Math.round(Y*J*ue*100)/100},I=i.computed(()=>M.sum(c.value.map(F=>{const q=F.configuratorParams;return!q.width||q.length===0||!F.quantity?0:q.width*q.length*F.quantity/1e6}))),W=i.computed(()=>Math.round(M.sum(c.value.map(F=>R(F)))*100)/100),ee=()=>{var F,q,Y;return new j.OrderItemBase({category:(F=c.value[0])==null?void 0:F.category,configurator:(q=c.value[0])==null?void 0:q.configurator,product:f.value??new j.ClientProduct,quantity:1,isAdditionalSale:(Y=c.value[0])==null?void 0:Y.isAdditionalSale,configuratorParams:{width:0,length:0}})},ne=F=>{if(!F){f.value=null,g.value=null,c.value.forEach(Y=>{Y.product=new j.ClientProduct}),o("update:value",c.value);return}const q=m.value.find(Y=>Y.id===F);q&&(f.value=q,g.value=F,c.value.forEach((Y,J)=>{var ue,ve;Y.product=q,(ue=q.properties)!=null&&ue.width&&Y.configuratorParams.width>q.properties.width&&(Y.configuratorParams.width=q.properties.width),(ve=q.properties)!=null&&ve.length&&Y.configuratorParams.length>q.properties.length&&(Y.configuratorParams.length=q.properties.length),o("item-reset",J)}),o("update:value",c.value))},D=F=>{var J,ue;const q=c.value[F],Y=f.value;Y&&((J=Y.properties)!=null&&J.width&&q.configuratorParams.width>Y.properties.width&&(q.configuratorParams.width=Y.properties.width),(ue=Y.properties)!=null&&ue.length&&q.configuratorParams.length>Y.properties.length&&(q.configuratorParams.length=Y.properties.length)),o("item-reset",F),o("update:value",c.value)},H=(F,q)=>{c.value[F].marker=q===null||q===""?void 0:q,o("item-reset",F),o("update:value",c.value)},L=F=>{c.value.forEach(q=>{q.isAdditionalSale=F}),o("update:value",c.value)},A=()=>{c.value.push(ee()),o("update:value",c.value),o("add-item",c.value.length),i.nextTick(()=>{var q,Y,J,ue;const F=c.value.length-1;(Y=(q=a.value)==null?void 0:q[F])==null||Y.focus(),(ue=(J=a.value)==null?void 0:J[F])==null||ue.select()})},z=F=>{c.value.splice(F,1),o("update:value",c.value),o("remove-item",F)};i.watch(()=>r.value,F=>{var ue;const Y=(F==null?[]:M.cloneDeep(i.toRaw(F))).map(ve=>new j.OrderItemBase(ve));c.value=Y.length>0?Y:[ee()];const J=(ue=c.value[0])==null?void 0:ue.product;J&&!J.isNewRec()?(f.value=J,g.value=J.id):(f.value=null,g.value=null)},{deep:!0});const U=()=>{var q;if(f.value!==null)return;const F=(q=m.value[0])==null?void 0:q.id;F!=null&&ne(F)};return i.watch(m,()=>{U()}),i.onMounted(()=>{var q;c.value.length===0&&(c.value=[ee()]);const F=(q=c.value[0])==null?void 0:q.product;F&&!F.isNewRec()&&(f.value=F,g.value=F.id),U()}),e({validate:(K=s.value)==null?void 0:K.validate,formReference:s}),(F,q)=>{const Y=M0,J=jr,ue=Vd;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(O.NForm),{ref:"form-reference",model:d.value,rules:C.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>{var ve,Te;return[i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:g.value,"onUpdate:value":[q[0]||(q[0]=We=>g.value=We),ne],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((ve=f.value)==null?void 0:ve.costRub)!=null?(i.openBlock(),i.createElementBlock("div",A0,[i.createElementVNode("span",O0,i.toDisplayString(f.value.code),1),i.createTextVNode(" — "+i.toDisplayString(f.value.costRub.toLocaleString())+" "+i.toDisplayString(f.value.currency.symbol)+"/м² ",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",z0,[f.value?(i.openBlock(),i.createElementBlock("div",D0,[q[6]||(q[6]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",L0,[b.value?(i.openBlock(),i.createElementBlock("div",H0,"Ширина "+i.toDisplayString(b.value)+".",1)):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createElementBlock("div",W0,"Длина "+i.toDisplayString(_.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",j0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value.items,(We,ce)=>{var mt;return i.openBlock(),i.createElementBlock("div",{key:ce,class:i.normalizeClass(["flex min-w-0 items-start gap-2 border-b border-gray-100 last:border-0",w(ce)?"opacity-70":""])},[i.createElementVNode("div",q0,[i.createElementVNode("div",X0,[i.createElementVNode("div",Y0,[i.createVNode(i.unref(O.NFormItem),{path:`items.${ce}.configuratorParams.width`,label:"Ширина, мм",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{ref_for:!0,ref:"widthInputs",value:d.value.items[ce].configuratorParams.width,"onUpdate:value":[Ne=>d.value.items[ce].configuratorParams.width=Ne,Ne=>D(ce)],parse:i.unref(it),"show-button":!1,disabled:!f.value||w(ce)||T(ce),placeholder:"Ширина",class:"w-full",onKeydown:q[1]||(q[1]=Ne=>i.unref(tt)(Ne)),onInput:Ne=>h(`items.${ce}.width`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(O.NFormItem),{path:`items.${ce}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:d.value.items[ce].configuratorParams.length,"onUpdate:value":[Ne=>d.value.items[ce].configuratorParams.length=Ne,Ne=>D(ce)],parse:i.unref(it),"show-button":!1,disabled:!f.value||w(ce)||T(ce),placeholder:"Длина",class:"w-full",onKeydown:q[2]||(q[2]=Ne=>i.unref(tt)(Ne)),onInput:Ne=>h(`items.${ce}.length`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),i.createElementVNode("div",U0,[i.createVNode(i.unref(O.NFormItem),{path:`items.${ce}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:d.value.items[ce].quantity,"onUpdate:value":[Ne=>d.value.items[ce].quantity=Ne,Ne=>D(ce)],parse:i.unref(it),"show-button":!1,disabled:!f.value||w(ce)||T(ce),placeholder:"Кол-во",class:"w-full",onKeydown:q[3]||(q[3]=Ne=>i.unref(tt)(Ne,!1)),onInput:Ne=>h(`items.${ce}.quantity`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(O.NFormItem),{path:`items.${ce}.marker`,label:"Маркировка",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:d.value.items[ce].marker??null,disabled:!f.value||w(ce)||T(ce),placeholder:"Маркировка",class:"w-full",onInput:Ne=>h(`items.${ce}.marker`),"onUpdate:value":Ne=>H(ce,Ne??null),onFocus:i.unref(Le)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),T(ce)||w(ce)?(i.openBlock(),i.createElementBlock("div",K0,[T(ce)?(i.openBlock(),i.createBlock(i.unref(O.NSpin),{key:0,size:14})):w(ce)?(i.openBlock(),i.createBlock(Y,{key:1,class:"text-green-600 text-xl"})):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),i.createElementVNode("div",G0,[We.configuratorParams.width>0&&We.configuratorParams.length>0?(i.openBlock(),i.createElementBlock("div",Z0,[q[7]||(q[7]=i.createTextVNode(" Площадь (S) = ",-1)),i.createElementVNode("span",Q0,i.toDisplayString(V(We.configuratorParams).toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),R(We)>0?(i.openBlock(),i.createElementBlock("div",J0,[q[8]||(q[8]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",eb,i.toDisplayString(R(We).toLocaleString())+" "+i.toDisplayString((mt=f.value)==null?void 0:mt.currency.symbol),1)])):i.createCommentVNode("",!0)])]),x.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,disabled:T(ce)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:Ne=>z(ce)},{default:i.withCtx(()=>[i.createVNode(J)]),_:1},8,["disabled","onClick"]))],2)}),128))]),f.value?(i.openBlock(),i.createElementBlock("div",tb,[I.value>0?(i.openBlock(),i.createElementBlock("div",nb,[q[9]||(q[9]=i.createTextVNode(" Общая площадь: ",-1)),i.createElementVNode("span",ib,i.toDisplayString(I.value.toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),W.value>0?(i.openBlock(),i.createElementBlock("div",rb,[q[10]||(q[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",ob,i.toDisplayString(W.value.toLocaleString())+" "+i.toDisplayString(f.value.currency.symbol),1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),k.value?(i.openBlock(),i.createBlock(i.unref(O.NCheckbox),{key:1,checked:((Te=c.value[0])==null?void 0:Te.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":q[4]||(q[4]=We=>L(We??!1))},{default:i.withCtx(()=>[...q[11]||(q[11]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createElementVNode("div",sb,[f.value&&!x.value?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,disabled:E.value,type:"default",onClick:A},{default:i.withCtx(()=>[i.createVNode(ue),q[12]||(q[12]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),i.createVNode(i.unref(O.NButton),{loading:t.isSubmitProcessing,disabled:$.value||N.value,type:"primary",class:"ml-auto",onClick:q[5]||(q[5]=We=>o("submit",c.value))},{default:i.withCtx(()=>{var We;return[i.createTextVNode(i.toDisplayString((We=c.value[0])!=null&&We.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[i.unref(Za)]])}}}),lb={class:"flex flex-col gap-2"},cb={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},db={},Od=i.defineComponent({...db,__name:"sandwich-m2-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{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(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("sandwich-m2-configurator-form"),s=i.ref((n.cartItems??[]).map(C=>new j.OrderItemBase(C))),a=i.ref([]),l=i.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=C=>{c.forEach(k=>{l.value[`items.${C}.${k}`]={}})},u=C=>{c.forEach(k=>{delete l.value[`items.${C}.${k}`]})},h=i.computed(()=>a.value.includes("loading")),f=()=>({width:{},length:{},quantity:{},marker:{}}),g=(C,k)=>{let E=!1;return c.forEach($=>{var V,R;const x=`items.0.${$}`,B=(V=C[$])==null?void 0:V.feedback,T=((R=C[x])==null?void 0:R.feedback)??B,N=`items.${k}.${$}`;T?(l.value[N]=C[x]??C[$],E=!0):l.value[N]={}}),E},m=(C,k,E)=>new Promise($=>{const x=f();let B=!1;const w=T=>{if(B)return;B=!0;const N=g(x,k),V=(T===void 0?!N:T)&&!N;a.value[k]=V?"success":"error",i.nextTick(()=>{var R,I;(I=(R=o.value)==null?void 0:R.formReference)==null||I.restoreValidation()}),$(V)};a.value[k]="loading",r("submit",[M.cloneDeep(C)],x,w,{isFinalSuccessfulCompletion:E})}),p=async()=>{var E,$;try{await(($=(E=o.value)==null?void 0:E.formReference)==null?void 0:$.validate())}catch{return}const C=s.value.map((x,B)=>B).filter(x=>{const B=a.value[x]??"idle";return B!=="success"&&B!=="loading"});let k=!0;for(let x=0;x<C.length;x+=1){const B=C[x],w=s.value[B];if(!w)break;const N=x===C.length-1&&k;await m(w,B,N)||(k=!1)}},y=C=>{const k=C-1;a.value[k]="idle",d(k)},b=C=>{a.value.splice(C,1),u(C);for(let k=C;k<s.value.length;k+=1)d(k)},_=C=>{const k=a.value[C];(k==="success"||k==="error")&&(a.value[C]="idle")};return i.onMounted(()=>{(n.cartItems??[]).forEach((C,k)=>{a.value[k]="idle",d(k)})}),i.watch(()=>n.cartItems,C=>{const k=(C??[]).map(E=>new j.OrderItemBase(E));s.value=k,a.value=k.map(()=>"idle"),k.forEach((E,$)=>{d($)})},{deep:!0}),(C,k)=>{var $;const E=O.NButton;return i.openBlock(),i.createElementBlock("div",lb,[t.settings.allowShowTable&&(($=s.value[0])!=null&&$.isNewRec())?(i.openBlock(),i.createBlock(E,{key:0,type:"tertiary",class:"self-center",onClick:k[0]||(k[0]=x=>r("click:view-switch"))},{default:i.withCtx(()=>[...k[2]||(k[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",cb,[i.createVNode(Ad,{ref:"sandwich-m2-configurator-form",value:s.value,"onUpdate:value":k[1]||(k[1]=x=>s.value=x),validation:l.value,settings:t.settings,"event-emitter":t.eventEmitter,"is-submit-processing":h.value,"item-states":a.value,onSubmit:p,onAddItem:y,onRemoveItem:b,onItemReset:_},null,8,["value","validation","settings","event-emitter","is-submit-processing","item-states"])])])}}}),ub={key:0,class:"flex justify-center p-4"},hb={key:1,class:"p-4 text-center text-red-500"},fb={key:2,class:"flex justify-center"},mb={class:"!bg-white p-4 m-2 rounded-md w-max"},gb={key:3,class:"p-4 text-center text-gray-500"},pb={},zd=i.defineComponent({...pb,__name:"dynamic-configurator",props:{eventEmitter:{},settings:{},editor:{},cartItem:{},cartItems:{},category:{}},setup(t){const e=t,n=i.ref(!1),r=i.ref(null),o=i.ref(e.cartItem??null),s=i.ref(e.cartItems??null),a=f=>{const g=f.configuratorParams;return[new j.OrderItemBase({...f,quantity:f.quantity??1,marker:f.marker,configuratorParams:{width:(g==null?void 0:g.width)??f.width??0,length:(g==null?void 0:g.length)??f.length??0}})]},l=i.ref(e.editor===j.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var g,m,p;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const f={category:((g=e.cartItem)==null?void 0:g.category)??e.category,configurator:e.editor,quantity:1};switch(e.editor){case"kozyrek":{const y=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{length:y.stripMinLength,linesAngles:[],linesWidths:[],startTailType:M.some(y.startTailConfigs,b=>b.isDefault)?(m=y.startTailConfigs)==null?void 0:m.findIndex(b=>b.isDefault):void 0,endTailType:M.some(y.endTailConfigs,b=>b.isDefault)?(p=y.endTailConfigs)==null?void 0:p.findIndex(b=>b.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const y=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{width:0,height:0,netType:y.netType[0]||"",color:y.color[0]||"",mountType:y.mountType[0]||""}});break}case"strip":{const y=e.settings;s.value=[new j.OrderItemBase({...f,length:y.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const y=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{width:y.minWidth,length:y.minLength}});break}case"sandwich":{o.value=new j.OrderItemBase({...f,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new j.OrderItemBase({...f,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(f,g,m)=>{const p=y=>{m==null||m(),y&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:f,callback:p,validation:g})},u=(f,g,m,p)=>{const y=f[0];if(!y){m==null||m();return}const b=(p==null?void 0:p.isFinalSuccessfulCompletion)===!0,_=C=>{m==null||m(C),b&&C&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:y,callback:_,validation:g,additionalParams:p})},h=()=>{e.category&&e.eventEmitter.emit("configurator:click-view-switch",{category:e.category})};return i.onMounted(()=>{!e.cartItem&&!e.cartItems&&c()}),(f,g)=>{const m=O.NSpin;return i.openBlock(),i.createElementBlock(i.Fragment,null,[n.value?(i.openBlock(),i.createElementBlock("div",ub,[i.createVNode(m,{size:"large"})])):r.value?(i.openBlock(),i.createElementBlock("div",hb,i.toDisplayString(r.value),1)):i.createCommentVNode("",!0),t.settings!==null&&(o.value!==null||s.value!==null||l.value!==null)?(i.openBlock(),i.createElementBlock("div",fb,[i.createElementVNode("div",mb,[t.editor==="kozyrek"?(i.openBlock(),i.createBlock(Cd,{key:0,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":h,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="mosquitto"?(i.openBlock(),i.createBlock(Td,{key:1,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="strip"?(i.openBlock(),i.createBlock(Rd,{key:2,"event-emitter":t.eventEmitter,settings:t.settings,"cart-items":s.value,"onClick:viewSwitch":h,onSubmit:d},null,8,["event-emitter","settings","cart-items"])):t.editor==="metal_for_doors"?(i.openBlock(),i.createBlock(Fd,{key:3,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":h,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="sandwich"?(i.openBlock(),i.createBlock(Md,{key:4,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":h,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="sandwich_m2"?(i.openBlock(),i.createBlock(Od,{key:5,"event-emitter":t.eventEmitter,settings:t.settings,"cart-items":l.value,"onClick:viewSwitch":h,onSubmit:u},null,8,["event-emitter","settings","cart-items"])):i.createCommentVNode("",!0)])])):(i.openBlock(),i.createElementBlock("div",gb,' Конфигуратор "'+i.toDisplayString(t.editor)+'" не поддерживается. ',1))],64)}}});function Dd(t){return Object.values(j.ConfiguratorsEnum).includes(t)}function Ld(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.Sandwich?!0:t.properties.configuratorSettings!==void 0&&M.isArray(t.products)&&t.products.length>0}const yb={key:0,class:"pt-0.5"},bb={key:0},_b={class:"line-through"},wb={key:0},xb={key:1},kb={class:"flex flex-row gap-1"},vb={key:0},Cb={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},Sb={class:"flex flex-col gap-2.5 sm:flex-row"},Bb={class:"mt-2"},Tb={key:1,class:"flex flex-col"},Nb={},$b=i.defineComponent({...Nb,__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},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(t){const e=t,n=i.inject(cr,"medium"),r=i.computed(()=>{var K;return(K=e==null?void 0:e.filteredItems)==null?void 0:K[e.categoryItem.id]}),o=i.computed(()=>{var K,F;return M.isArray((K=e.categoryItem)==null?void 0:K.categories)&&((F=e.categoryItem.categories)==null?void 0:F.length)>0}),s=i.computed(()=>{var K;return M.isArray((K=e.categoryItem)==null?void 0:K.products)?e.categoryItem.products:[]}),a=i.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([K,F])=>`${F} руб./${N(K)}`).join(", ")),l=i.computed(()=>M.isUndefined(e.filteredItems)||r.value==="*"?s.value:s.value.filter(K=>{var q;const F=(q=r.value)==null?void 0:q.products;return M.isArray(F)&&F.includes(K.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>M.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),u=i.computed(()=>M.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),h=i.computed(()=>M.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),f=i.computed(()=>M.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),g=i.computed(()=>{var K,F,q;return((K=e.categoryItem.properties)==null?void 0:K.configurator)!==void 0&&Dd((F=e.categoryItem.properties)==null?void 0:F.configurator)&&Ld(e.categoryItem)&&((q=e.categoryItem.properties)==null?void 0:q.configuratorSettings)!==void 0&&(M.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),m=i.computed(()=>g.value&&(M.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),p=i.computed(()=>M.isNil(e.categoryContextButtonsConfig)?[]:M.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),y=i.computed(()=>new j.ClientCategory(e.categoryItem)),b=i.ref(!1),_=i.ref(!1),C=i.computed(()=>!M.isUndefined(e.isCategoryItemSelected)),k=i.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),E=i.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),$=i.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),x=i.computed(()=>A.value&&St.getDeviceTypeByResolution()===Qe.laptop?"auto":"fixed"),B=i.useTemplateRef("collapse-item-reference"),w=i.computed(()=>{var K,F;return(F=(K=e.categoryItem.properties)==null?void 0:K.templateCost)==null?void 0:F.priceCoefficient}),T=i.computed(()=>{var K,F;return(F=(K=e.categoryItem.properties)==null?void 0:K.templateCost)==null?void 0:F.increasePercent}),N=(K,F="ru-RU")=>0 .toLocaleString(F,{style:"currency",currency:K,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),V=K=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:K,target:B.value})},R=(K,F)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:F,isLoadingState:b,target:B.value})},I=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:B.value})},W=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:B.value})},ee=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:B.value})},ne=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:B.value})},D=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:B.value})},H=K=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:K,target:B.value})},L=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},A=i.ref(0),z=i.computed(()=>A.value&&s.value.length>0?rg(s.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),U=M.debounce(()=>{A.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",U)}),window.addEventListener("resize",U),U(),(K,F)=>{const q=O.NCheckbox,Y=Vf,J=O.NTooltip,ue=Rf,ve=O.NTag,Te=Nf,We=Sf,ce=O.NButton,mt=kf,Ne=el,Pt=Ja,Wt=Qa,ln=Xo,Ct=O.NDropdown,Ln=O.NDataTable,cn=O.NAlert,Jt=O.NSpin;return i.openBlock(),i.createBlock(tl,{ref:"collapse-item-reference",name:t.categoryItem.id,"data-id":t.categoryItem.id,"onHeader:click":R},{"pre-arrow":i.withCtx(()=>{var Ve,Q;return[C.value?(i.openBlock(),i.createElementBlock("div",yb,[i.createVNode(q,{checked:k.value,indeterminate:$.value,disabled:E.value,"onUpdate:checked":V},null,8,["checked","indeterminate","disabled"])])):i.createCommentVNode("",!0),!d.value&&((Ve=y.value)!=null&&Ve.isDisabled)?(i.openBlock(),i.createBlock(J,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(Y,{class:"pt-1.5"})]),default:i.withCtx(()=>[F[1]||(F[1]=i.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):i.createCommentVNode("",!0),((Q=y.value)==null?void 0:Q.isFavorite)??!1?(i.openBlock(),i.createBlock(J,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ue,{class:"pt-1.5"})]),default:i.withCtx(()=>[F[2]||(F[2]=i.createTextVNode(" Избранная категория ",-1))]),_:1})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var Ve,Q,le,De,ii;return[i.createElementVNode("div",{class:i.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":t.categoryItem.isHidden,"text-gray-400":(Ve=y.value)==null?void 0:Ve.isDisabled})},[i.createVNode(J,{disabled:!t.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createElementVNode("span",null,i.toDisplayString(t.categoryItem.name),1)]),default:i.withCtx(()=>[F[3]||(F[3]=i.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:F[0]||(F[0]=i.withModifiers((...nt)=>i.unref(M.noop)&&i.unref(M.noop)(...nt),["prevent","stop"]))},[(Q=t.categoryItem.properties)!=null&&Q.m2Price?(i.openBlock(),i.createBlock(ve,{key:0,size:i.unref(n),class:i.normalizeClass({"!pr-0":((le=t.categoryItem.properties)==null?void 0:le.templateCost)&&t.categoryItem.properties.m2PriceRetail&&T.value}),round:""},{default:i.withCtx(()=>{var nt;return[i.createTextVNode(" Установленная стоимость: "+i.toDisplayString(t.categoryItem.properties.m2Price)+" руб./м2 ",1),(nt=t.categoryItem.properties)!=null&&nt.templateCost&&t.categoryItem.properties.m2PriceRetail&&T.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[T.value?(i.openBlock(),i.createBlock(ve,{key:0,type:"success",bordered:!1,size:i.unref(n),class:"ml-2 !pr-0",round:""},{default:i.withCtx(()=>[T.value?(i.openBlock(),i.createElementBlock("span",bb,i.toDisplayString(T.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0),i.createVNode(ve,{size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createElementVNode("span",_b,i.toDisplayString(t.categoryItem.properties.m2PriceRetail)+" руб./м2",1)]),_:1},8,["size"])]),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0)]}),_:1},8,["size","class"])):(De=t.categoryItem.properties)!=null&&De.templateCost?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[w.value||T.value?(i.openBlock(),i.createBlock(ve,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>{var nt;return[w.value?(i.openBlock(),i.createElementBlock("span",wb,i.toDisplayString((nt=w.value)==null?void 0:nt.name),1)):i.createCommentVNode("",!0),T.value?(i.openBlock(),i.createElementBlock("span",xb,i.toDisplayString(T.value>0?"+":"")+i.toDisplayString(T.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0)]}),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(ve,{key:2,size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createTextVNode(" Фиксированный курс: "+i.toDisplayString(a.value),1)]),_:1},8,["size"])):i.createCommentVNode("",!0),u.value&&((ii=y.value)!=null&&ii.manager)?(i.openBlock(),i.createBlock(ve,{key:3,size:i.unref(n),closable:!0,round:"",class:"align-bottom",onClose:ne},{default:i.withCtx(()=>[i.createVNode(J,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var nt,jt;return[i.createElementVNode("span",kb,[i.createVNode(Te),i.createTextVNode(" "+i.toDisplayString((jt=(nt=y.value)==null?void 0:nt.manager)==null?void 0:jt.name),1)])]}),default:i.withCtx(()=>{var nt,jt;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((jt=(nt=y.value)==null?void 0:nt.manager)==null?void 0:jt.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[t.showSlugs||t.showProperties?(i.openBlock(),i.createElementBlock("div",vb,[i.createElementVNode("ul",Cb,[t.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:t.categoryItem.id,slug:t.categoryItem.slug},(Ve,Q)=>(i.openBlock(),i.createElementBlock("li",{key:Q}," ("+i.toDisplayString(Q)+"): "+i.toDisplayString(Ve),1))),128)):i.createCommentVNode("",!0),t.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(t.categoryItem.properties,(Ve,Q)=>(i.openBlock(),i.createElementBlock("li",{key:Q}," ("+i.toDisplayString(Q)+"): "+i.toDisplayString(Ve),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var Ve;return[i.createElementVNode("div",Sb,[d.value?(i.openBlock(),i.createBlock(J,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),onClick:I},{default:i.withCtx(()=>{var Q;return[(Q=y.value)!=null&&Q.isDisabled?(i.openBlock(),i.createBlock(Y,{key:1})):(i.openBlock(),i.createBlock(We,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var Q;return[(Q=y.value)!=null&&Q.isDisabled?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" Скрыто для клиента"+i.toDisplayString(y.value.hidingComment?`. Причина: '${y.value.hidingComment}'`:""),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Видимо клиенту")],64))]}),_:1})):i.createCommentVNode("",!0),u.value&&!((Ve=y.value)!=null&&Ve.manager)?(i.openBlock(),i.createBlock(J,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),onClick:ee},{default:i.withCtx(()=>[i.createVNode(mt)]),_:1},8,["size"])]),default:i.withCtx(()=>{var Q,le,De;return[(Q=y.value)!=null&&Q.manager?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode('Категория закреплена за "'+i.toDisplayString(((De=(le=y.value)==null?void 0:le.manager)==null?void 0:De.name)??"-")+'"',1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode("Закрепить")],64))]}),_:1})):i.createCommentVNode("",!0),h.value?(i.openBlock(),i.createBlock(J,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,disabled:h.value==="disabled",size:i.unref(n),onClick:W},{default:i.withCtx(()=>{var Q;return[(Q=y.value)!=null&&Q.isRequired?(i.openBlock(),i.createBlock(Pt,{key:1})):(i.openBlock(),i.createBlock(Ne,{key:0}))]}),_:1},8,["disabled","size"])]),default:i.withCtx(()=>[F[4]||(F[4]=i.createTextVNode(" Категория, которую нужно предлагать клиенту ",-1))]),_:1})):i.createCommentVNode("",!0),f.value?(i.openBlock(),i.createBlock(J,{key:3,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),type:"primary",onClick:D},{default:i.withCtx(()=>[i.createVNode(Wt)]),_:1},8,["size"])]),default:i.withCtx(()=>[F[5]||(F[5]=i.createTextVNode(" Редактировать ",-1))]),_:1})):i.createCommentVNode("",!0),p.value.length>0?(i.openBlock(),i.createBlock(Ct,{key:4,options:p.value,size:i.unref(n),trigger:"click",onSelect:H},{default:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(ln)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(K.$slots,"default",{},()=>{var Ve,Q,le;return[i.createElementVNode("div",Bb,[o.value?(i.openBlock(),i.createBlock(Wd,{key:0,"categories-items":t.categoryItem.categories??[],"has-products":c.value||b.value,"event-emitter":t.eventEmitter,"filtered-items":r.value?((Ve=r.value)==null?void 0:Ve.categories)??{}:void 0,"is-category-item-selected":t.isCategoryItemSelected,"show-slugs":t.showSlugs,"show-properties":t.showProperties,"allow-name-click":t.allowNameClick,"allow-price-click":t.allowPriceClick,"show-price-history":t.showPriceHistory,"show-cost-date":t.showCostDate,"show-category-required-button":t.showCategoryRequiredButton,"show-category-hide-for-client-button":t.showCategoryHideForClientButton,"show-category-pin-button":t.showCategoryPinButton,"show-category-edit-button":t.showCategoryEditButton,"category-context-buttons-config":t.categoryContextButtonsConfig,"is-product-item-selected":t.isProductItemSelected,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-costs":t.showProductCosts,"show-product-required-button":t.showProductRequiredButton,"show-product-edit-button":t.showProductEditButton,"product-context-buttons-config":t.productContextButtonsConfig,"show-configurator":t.showConfigurator,"can-show-configurator":t.canShowConfigurator},null,8,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"])):i.createCommentVNode("",!0)]),g.value&&m.value?(i.openBlock(),i.createBlock(zd,{key:0,"event-emitter":t.eventEmitter,settings:(Q=t.categoryItem.properties)==null?void 0:Q.configuratorSettings,editor:(le=t.categoryItem.properties)==null?void 0:le.configurator,category:t.categoryItem},null,8,["event-emitter","settings","editor","category"])):c.value?(i.openBlock(),i.createElementBlock("div",Tb,[g.value?(i.openBlock(),i.createBlock(ce,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:L},{default:i.withCtx(()=>[...F[6]||(F[6]=[i.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Ln,{columns:z.value,data:l.value,bordered:!0,loading:b.value,remote:!0,"row-key":De=>De.id,"table-layout":x.value,class:"mt-2"},null,8,["columns","data","loading","row-key","table-layout"])])):i.createCommentVNode("",!0),!b.value&&!_.value&&!o.value&&!c.value?(i.openBlock(),i.createBlock(cn,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createBlock(cn,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),b.value?(i.openBlock(),i.createBlock(Jt,{key:4,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>[...F[7]||(F[7]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),Eb=jn($b,[["__scopeId","data-v-607a5aad"]]),Rb={class:"sc-collapse flex w-full flex-col"},Pb={},Hd=i.defineComponent({...Pb,__name:"collapse",props:{defaultExpandedNames:{default:()=>[]},expandedNames:{default:()=>[]}},emits:["on-item-header-click"],setup(t,{emit:e}){const n=t,r=e,o=(s,a)=>{r("on-item-header-click",s,a)};return i.provide("itemHeaderClickHandler",o),i.provide("defaultExpandedNames",n.defaultExpandedNames),i.provide("expandedNames",n.expandedNames),(s,a)=>(i.openBlock(),i.createElementBlock("div",Rb,[i.renderSlot(s.$slots,"default")]))}}),Fb={},Wd=i.defineComponent({...Fb,__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},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(t){const e=t,n=i.inject(cr,"medium"),r=i.computed(()=>M.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(M.isUndefined(a))return;const l=a[s.id];if(l==="*")return;const c={};return c[s.id]=structuredClone(i.toRaw(l)),c};return(s,a)=>{const l=O.NSpin,c=O.NAlert;return i.openBlock(),i.createElementBlock(i.Fragment,null,[r.value.length>0?(i.openBlock(),i.createBlock(Hd,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(Eb,{key:d.id,"category-item":d,"event-emitter":t.eventEmitter,"filtered-items":o(d,t.filteredItems),"is-category-item-selected":t.isCategoryItemSelected,"show-slugs":t.showSlugs,"show-properties":t.showProperties,"allow-name-click":t.allowNameClick,"allow-price-click":t.allowPriceClick,"show-price-history":t.showPriceHistory,"show-cost-date":t.showCostDate,"show-category-required-button":t.showCategoryRequiredButton,"show-category-hide-for-client-button":t.showCategoryHideForClientButton,"show-category-pin-button":t.showCategoryPinButton,"show-category-edit-button":t.showCategoryEditButton,"category-context-buttons-config":t.categoryContextButtonsConfig,"is-product-item-selected":t.isProductItemSelected,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-costs":t.showProductCosts,"show-product-required-button":t.showProductRequiredButton,"show-product-edit-button":t.showProductEditButton,"product-context-buttons-config":t.productContextButtonsConfig,"show-configurator":t.showConfigurator,"can-show-configurator":t.canShowConfigurator},null,8,["category-item","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"]))),128))]),_:1})):t.loading?(i.openBlock(),i.createBlock(l,{key:1,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>[...a[0]||(a[0]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0),!t.hasProducts&&!t.loading&&t.categoriesItems.length>0&&r.value.length===0?(i.openBlock(),i.createBlock(c,{key:2,"show-icon":!0,type:"warning",title:"Товары не найдены",class:"mx-10"})):i.createCommentVNode("",!0)],64)}}}),Vb={},jd=i.defineComponent({...Vb,__name:"reference-select",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean},referenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1},sortOptionsByLabel:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},maxTagCount:{default:void 0}},emits:["update:value"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.computed(()=>M.isArray(r.value)),a=new j.Reference,l=i.computed(()=>M.isNil(r.value)?s.value?[]:null:M.isArray(r.value)?r.value.map(g=>g.id):r.value.id),c=i.computed(()=>Vt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue)),d=g=>{var m;if(M.isArray(g)){const p=g.length>0?g.map(y=>{var b;return(b=c.value.find(_=>_.value===y))==null?void 0:b.item}):[];o("update:value",p)}else{const p=g===a.id||M.isNil(g)||(m=c.value.find(y=>y.value===g))==null?void 0:m.item;o("update:value",p)}},u=i.useTemplateRef("select-component");return e({focus:()=>{var g;return(g=u.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=u.value)==null?void 0:g.blur()}}),(g,m)=>(i.openBlock(),i.createBlock(i.unref(O.NSelect),{ref:"select-component",value:l.value,clearable:r.clearable,"consistent-menu-width":t.consistentMenuWidth,disabled:t.disabled||c.value.length===0,filterable:t.filterable,"max-tag-count":t.maxTagCount,multiple:s.value,options:c.value,placeholder:"",class:"w-full","onUpdate:value":d},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),Ib={},Mb=i.defineComponent({...Ib,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{}},emits:["update:value"],setup(t,{emit:e}){var k,E;const n=t,r=e,o=()=>{const $=j.PriceCoefficient.getRetailPriceCoefficient();return M.unset($,"isNewRec"),$},s=$=>!$||$.id===o().id,a=i.computed(()=>{var $;return(($=n.catalogItem)==null?void 0:$.type)==="product"}),l=i.computed(()=>a.value?n.catalogItem:void 0),c=$=>{var x,B,w,T;return $.id===o().id?(x=l.value)==null?void 0:x.getRetailCost():(T=(w=(B=l.value)==null?void 0:B.priceCoefficients)==null?void 0:w.find(N=>N.coefficient.id===$.id))==null?void 0:T.cost},d=i.computed(()=>{var x;const $=[...((x=j.useReferencesStore().priceCoefficientsReference)==null?void 0:x.map(B=>structuredClone(i.toRaw(B))))??[],o()];return a.value&&$.forEach(B=>{var T;const w=c(B);w?B.name+=` (${w} ${(T=l.value)==null?void 0:T.currency.symbol})`:B.name=""}),$.filter(B=>B.name!=="")}),u=i.ref(n.value.coefficient),h=i.ref(((E=(k=n.value)==null?void 0:k.value)==null?void 0:E.toString())??null),f=i.ref(null),g=i.computed(()=>{var $,x;return(x=($=l.value)==null?void 0:$.priceCoefficients)==null?void 0:x.find(B=>B.coefficient.slug===j.PriceCoefficientEnum.K0)}),m=i.ref(void 0),p=$=>Number.parseFloat(($??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),y=()=>{var x,B;m.value=void 0;let $=p(h.value);if($=Number.isNaN($)?void 0:$,a.value)if(u.value||h.value){const w=o(),T=c(u.value??w)??0,N=T+T*(($??0)/100);f.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(N),N>(((x=l.value)==null?void 0:x.getRetailCost())??N)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),g.value&&N<(((B=g.value)==null?void 0:B.cost)??0)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else f.value=null;r("update:value",{value:Number.isNaN($)?void 0:$,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})},b=$=>{M.isArray($)||M.isNull($)||(u.value=$,h.value=null,!u.value&&h.value&&(u.value=o()),y())},_=()=>{u.value||(u.value=o()),y()},C=$=>{var B,w,T,N,V;const x=p($);if(a.value){let R=0;if(x<=0)u.value=void 0,h.value=null;else if(g.value&&x<(((B=g.value)==null?void 0:B.cost)??0))u.value=(w=g.value)==null?void 0:w.coefficient,R=(x-g.value.cost)*100/g.value.cost,m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(x>(((T=l.value)==null?void 0:T.getRetailCost())??x)){u.value=o();const I=((N=l.value)==null?void 0:N.getRetailCost())??0;R=(x-I)*100/I,m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const I=((V=l.value)==null?void 0:V.priceCoefficients)??[],W=M.sortBy(I,[D=>D.cost]),ne=W.filter(D=>D.cost<=x).at(-1)??W.at(0);ne&&(u.value=ne.coefficient,R=(x-ne.cost)*100/ne.cost),m.value={validationStatus:void 0,feedback:void 0}}h.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:5}).format(R),r("update:value",{value:Number.isNaN(R)?void 0:R,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})}else r("update:value",{value:Number.isNaN(x)?void 0:x,coefficient:void 0})};return i.onMounted(()=>{var $,x,B,w;n.calculationType===j.CalculationTypeEnum.m2Cost?f.value=((x=($=n.value)==null?void 0:$.value)==null?void 0:x.toString())??null:!((B=n.value)!=null&&B.coefficient)&&((w=n.value)!=null&&w.value)&&(u.value=o()),y()}),($,x)=>{var T,N,V;const B=O.NInput,w=O.NInputGroup;return i.openBlock(),i.createBlock(i.unref(O.NFormItem),{"show-label":!i.unref(M.isNil)(t.label),label:t.label,"show-feedback":!i.unref(M.isNil)(((T=m.value)==null?void 0:T.feedback)??t.feedback),feedback:((N=m.value)==null?void 0:N.feedback)??t.feedback,"validation-status":((V=m.value)==null?void 0:V.validationStatus)??t.validationStatus},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([{"sm:grid-cols-3":a.value&&t.calculationType!==i.unref(j.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[t.calculationType!==i.unref(j.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(w,{key:0,class:i.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:i.withCtx(()=>[i.createVNode(jd,{class:"w-full min-w-0 flex-1",value:u.value,"reference-list":d.value,clearable:t.clearable,disabled:t.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"onUpdate:value":b},null,8,["value","reference-list","clearable","disabled"]),i.createVNode(B,{value:h.value,"onUpdate:value":[x[0]||(x[0]=R=>h.value=R),_],clearable:t.clearable,disabled:t.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},i.createSlots({suffix:i.withCtx(()=>[x[3]||(x[3]=i.createTextVNode("%",-1))]),_:2},[h.value&&!h.value.startsWith("-")?{name:"prefix",fn:i.withCtx(()=>[x[2]||(x[2]=i.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):i.createCommentVNode("",!0),a.value||t.calculationType===i.unref(j.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(B,{key:1,value:f.value,"onUpdate:value":[x[1]||(x[1]=R=>f.value=R),C],clearable:t.clearable,disabled:t.disabled,placeholder:"Стоимость",class:"w-full"},i.createSlots({_:2},[a.value?{name:"suffix",fn:i.withCtx(()=>{var R;return[i.createTextVNode(i.toDisplayString((R=l.value)==null?void 0:R.currency.symbol),1)]}),key:"0"}:void 0]),1032,["value","clearable","disabled"])):i.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),Ab={key:0,class:"flex flex-row gap-2.5"},Ob={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},zb={},qd=i.defineComponent({...zb,__name:"base-dialog",props:{show:{type:Boolean},title:{},sizes:{default:()=>({phone:{size:"small",scale:.98},tablet:{size:"small",scale:.9},default:{size:"medium",scale:.7}})},modalWidth:{default:void 0},processing:{type:Boolean,default:!1},valid:{type:Boolean,default:!0},acceptButton:{default:()=>({show:!0,text:"ОК"})},cancelButton:{default:()=>({show:!0,text:"Отмена"})},trapFocus:{type:Boolean,default:!0}},emits:["update:show","opening","closing","accept","processing:cancel"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.ref(r.show),a=i.ref(r.processing),l=St.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=St.initRefDependingOnDeviceResolution(r.sizes.phone.scale,r.sizes.tablet.scale,r.sizes.default.scale),d=i.computed(()=>r.modalWidth??window.innerWidth*c.value),u=()=>{o("opening"),s.value=!0,o("update:show",s.value)},h=(g="other")=>{if(a.value){o("processing:cancel",b=>{a.value=b});return}let m=!1;o("closing",g,()=>{m=!0}),m||(s.value=!1,o("update:show",s.value))},f=()=>{o("accept",m=>{a.value=m})};return i.watch(()=>r.show,g=>{g?u():h("other")}),i.watch(()=>r.processing,g=>{a.value=g}),e({open:u,close:h,acceptHandler:f}),(g,m)=>{const p=O.NButton,y=O.NModal;return i.openBlock(),i.createBlock(y,{loading:a.value,show:s.value,"show-icon":!1,size:i.unref(l),style:i.normalizeStyle(`width: ${d.value}px`),title:t.title,"trap-focus":t.trapFocus??!0,"action-class":g.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:m[1]||(m[1]=b=>h("header")),onEsc:m[2]||(m[2]=b=>h("esc")),onMaskClick:m[3]||(m[3]=b=>h("mask"))},i.createSlots({default:i.withCtx(()=>[i.renderSlot(g.$slots,"default")]),_:2},[g.$slots.header?{name:"header",fn:i.withCtx(()=>[i.renderSlot(g.$slots,"header")]),key:"0"}:void 0,g.$slots.action||g.$slots["extra-action"]||t.acceptButton.show||t.cancelButton.show?{name:"action",fn:i.withCtx(()=>[g.$slots["extra-action"]?(i.openBlock(),i.createElementBlock("div",Ab,[i.renderSlot(g.$slots,"extra-action")])):i.createCommentVNode("",!0),g.$slots.action||t.acceptButton.show||t.cancelButton.show?(i.openBlock(),i.createElementBlock("div",Ob,[i.renderSlot(g.$slots,"action",{disabled:a.value}),t.acceptButton.show??!0?(i.openBlock(),i.createBlock(p,{key:0,disabled:a.value||!t.valid,size:i.unref(l),type:"primary",onClick:f},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","size"])):i.createCommentVNode("",!0),t.cancelButton.show??!0?(i.openBlock(),i.createBlock(p,{key:1,size:i.unref(l),type:"default",onClick:m[0]||(m[0]=b=>h("footer"))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.cancelButton.text??"Отмена"),1)]),_:1},8,["size"])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["loading","show","size","style","title","trap-focus","action-class"])}}}),Db={class:"text-sm"},Lb={class:"text-sm"},Hb={},Wb=i.defineComponent({...Hb,__name:"add-product-to-cart-dialog",emits:["submit"],setup(t,{expose:e,emit:n}){const r=i.useTemplateRef("form-reference"),o=i.useTemplateRef("base-dialog-reference"),s=i.ref(null),a=i.computed(()=>{var x,B,w;return((x=s.value)==null?void 0:x.unit.isLinear)&&((w=(B=s.value)==null?void 0:B.properties)==null?void 0:w.isLengthConfigurator)}),l=i.ref(void 0),c=i.ref(void 0),d=i.ref(!0),u=i.ref(null),h=n,f=()=>({length:{},quantity:{},marker:{}}),g=i.ref(f()),m=i.ref(!1),p=i.computed(()=>{var N,V,R,I;if(!s.value)return{};const x=j.UnitsHelper.getProductLengthMultiplicity(s.value),B=j.UnitsHelper.getProductMultiplicity(s.value),w=((V=(N=s.value)==null?void 0:N.properties)==null?void 0:V.minLength)||x,T=(I=(R=s.value)==null?void 0:R.properties)==null?void 0:I.maxLength;return{length:[ae.required,ae.min(w??.1),ae.max(T),ae.step(x),He.serverValidation(g.value.length.feedback)],quantity:[ae.required,ae.min(B),ae.step(B),He.serverValidation(g.value.quantity.feedback)],marker:[He.serverValidation(g.value.marker.feedback)]}}),y=i.computed(()=>{var x,B,w;return s.value?((x=s.value.properties)==null?void 0:x.lengthStep)??((B=s.value.properties)!=null&&B.ignoreMinCountCheck?0:((w=s.value.properties)==null?void 0:w.minCount)??0):0}),b=i.computed(()=>{var w,T,N,V,R,I,W,ee,ne;if(!s.value)return"";const x=((T=(w=s.value)==null?void 0:w.properties)==null?void 0:T.minLength)??((V=(N=s.value)==null?void 0:N.properties)!=null&&V.ignoreMinCountCheck?0:(I=(R=s.value)==null?void 0:R.properties)==null?void 0:I.minCount),B=(ee=(W=s.value)==null?void 0:W.properties)==null?void 0:ee.maxLength;return x||B?`(${x?`от ${x}`:""}${x&&B?" ":""}${B?`до ${B}`:""} ${(ne=s.value)==null?void 0:ne.unit.name})`:""}),_=x=>{var V,R;if(!((R=(V=s.value)==null?void 0:V.properties)!=null&&R.isLengthConfigurator)||!u.value||M.isNil(x)||y.value===0)return;const B=x/y.value,w=Math.round(B),T=j.UnitsHelper.getProductMultiplicity(s.value),N=Math.max(w,T);u.value.quantity=N},C=x=>{var N,V,R,I;if(!((V=(N=s.value)==null?void 0:N.properties)!=null&&V.isLengthConfigurator)||!u.value||M.isNil(x)||y.value===0)return;const B=x*y.value,w=((R=s.value.properties)==null?void 0:R.minLength)||j.UnitsHelper.getProductLengthMultiplicity(s.value),T=(I=s.value.properties)==null?void 0:I.maxLength;w!==void 0&&B<w?u.value.length=w:T!==void 0&&B>T?u.value.length=T:u.value.length=B},k=async x=>{var w;const B=M.cloneDeep(u.value);try{await((w=r.value)==null?void 0:w.validate(T=>{if(!T){if(!s.value||!B)return;j.UnitsHelper.productIsMeasurable(s.value)||delete B.length,a.value&&y.value&&(B.length=y.value),m.value=!0,h("submit",B,g.value,()=>{m.value=!1,x(!1),i.nextTick(()=>{var N;(N=r.value)==null||N.validate(M.noop).catch(M.noop)})})}}))}catch{}},E=()=>{s.value=null,l.value=void 0,u.value=null,g.value=f()};return e({show:(x,B)=>{var w,T,N,V,R;if(s.value=x,l.value=B==null?void 0:B.cartItemData,c.value=B==null?void 0:B.orderId,d.value=(B==null?void 0:B.canSetDopProdaga)??!1,u.value=new j.OrderItemBase((B==null?void 0:B.cartItemData)??new j.OrderItemBase({product:x,quantity:j.UnitsHelper.productIsMeasurable(s.value)?1:((w=x==null?void 0:x.properties)==null?void 0:w.minCount)??1,length:((T=x==null?void 0:x.properties)==null?void 0:T.minLength)||((N=x==null?void 0:x.properties)!=null&&N.ignoreMinCountCheck?0:(V=x==null?void 0:x.properties)==null?void 0:V.minCount)||0})),(R=x==null?void 0:x.properties)!=null&&R.isLengthConfigurator&&u.value&&y.value>0){const I=y.value,W=u.value.quantity||1;u.value.length=W*I}},closeDialog:E}),(x,B)=>{var R;const w=O.NFormItem,T=O.NInputGroupLabel,N=O.NInputGroup,V=O.NCheckbox;return i.openBlock(),i.createBlock(qd,{ref:"base-dialog-reference",show:!i.unref(M.isNil)(s.value)&&!i.unref(M.isNil)(u.value),title:`${l.value?"Изменение":"Добавление"} товара ${(R=s.value)==null?void 0:R.name} в ${c.value?` заказ №${c.value}`:"корзину"}`,"accept-button":{show:!0,text:l.value?"Изменить":"Добавить"},processing:m.value,"modal-width":500,onAccept:k,onClosing:E},{default:i.withCtx(()=>{var I;return[s.value&&u.value?(i.openBlock(),i.createBlock(i.unref(O.NForm),{key:0,ref:"form-reference",model:u.value,rules:p.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message",onKeydown:i.withKeys(i.withModifiers((I=o.value)==null?void 0:I.acceptHandler,["prevent"]),["enter"])},{default:i.withCtx(()=>[i.unref(j.UnitsHelper).productIsMeasurable(s.value)?(i.openBlock(),i.createBlock(w,{key:0,path:"length",label:`Метраж, ${b.value+s.value.unit.name}`},i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:u.value.length,"onUpdate:value":[B[0]||(B[0]=W=>u.value.length=W),_],parse:i.unref(it),step:i.unref(j.UnitsHelper).getProductLengthMultiplicity(s.value),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:B[1]||(B[1]=W=>i.unref(Lr)(W,".",!1)),onInput:B[2]||(B[2]=W=>i.unref(et)(g.value,"length")),onFocus:i.unref(Le)},null,8,["value","parse","step","onFocus"])]),_:2},[!g.value.length.feedback&&i.unref(j.UnitsHelper).getProductLengthMultiplicity(s.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Db,"Метраж должно быть кратно "+i.toDisplayString(i.unref(j.UnitsHelper).getProductLengthMultiplicity(s.value)),1)]),key:"0"}:void 0]),1032,["label"])):i.createCommentVNode("",!0),i.createVNode(w,{path:"quantity",label:"Количество, шт."},{default:i.withCtx(()=>[i.createVNode(N,null,i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:u.value.quantity,"onUpdate:value":[B[3]||(B[3]=W=>u.value.quantity=W),C],parse:i.unref(it),step:i.unref(j.UnitsHelper).getProductMultiplicity(s.value),"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:B[4]||(B[4]=W=>i.unref(Lr)(W,".",!1)),onInput:B[5]||(B[5]=W=>i.unref(et)(g.value,"quantity")),onFocus:i.unref(Le)},null,8,["value","parse","step","onFocus"]),a.value?(i.openBlock(),i.createBlock(T,{key:0,class:"bg-orange-100 font-bold"},{default:i.withCtx(()=>[i.createTextVNode(" x "+i.toDisplayString(y.value)+" "+i.toDisplayString(s.value.unit.name),1)]),_:1})):i.createCommentVNode("",!0)]),_:2},[!g.value.quantity.feedback&&i.unref(j.UnitsHelper).getProductMultiplicity(s.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Lb,"Количество должно быть кратно "+i.toDisplayString(i.unref(j.UnitsHelper).getProductMultiplicity(s.value)),1)]),key:"0"}:void 0]),1024)]),_:1}),i.unref(j.UnitsHelper).productIsMeasurable(s.value)?(i.openBlock(),i.createBlock(w,{key:1,path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:B[6]||(B[6]=W=>i.unref(et)(g.value,"marker")),"onUpdate:value":B[7]||(B[7]=W=>u.value.marker=W??null),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1})):i.createCommentVNode("",!0),d.value?(i.openBlock(),i.createBlock(V,{key:2,checked:u.value.isAdditionalSale,"onUpdate:checked":B[8]||(B[8]=W=>u.value.isAdditionalSale=W),"true-value":!0,"false-value":!1},{default:i.withCtx(()=>[...B[9]||(B[9]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0)]),_:1},8,["model","rules","onKeydown"])):i.createCommentVNode("",!0)]}),_:1},8,["show","title","accept-button","processing"])}}}),jb={class:"flex flex-row gap-1"},qb={class:"sc-client-name flex flex-col gap-1 text-base"},Xb=["href"],Yb={key:1,class:"text-sc-grey"},Ub={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Kb={key:0},Gb={key:1,class:"text-sm"},Zb={},_r=i.defineComponent({...Zb,__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(t,{emit:e}){const n=t,r=e,o=i.computed(()=>n.client.lastLoginAt?en.format(n.client.lastLoginAt,j.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{M.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=Yo,d=O.NButton,u=O.NPopover;return i.openBlock(),i.createElementBlock("div",jb,[t.showClientInfoIcon?(i.openBlock(),i.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=h=>a.$emit("click:client-info",t.client))},{default:i.withCtx(()=>[i.createVNode(c)]),_:1})):i.createCommentVNode("",!0),i.createVNode(u,{disabled:i.unref(M.isNil)(t.popoverPosition),placement:t.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",qb,[i.createElementVNode("a",{href:t.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=h=>s(h))},[i.createElementVNode("span",{class:i.normalizeClass({"line-through":!t.client.isActive})},i.toDisplayString(t.client.name),3),t.showSalesDirection&&t.client.salesDirection?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass({"line-through":!t.client.isActive})}," ("+i.toDisplayString(t.client.salesDirection.name)+") ",3)):i.createCommentVNode("",!0),t.client.isActive?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",Yb," [ Деактивирован ] "))],8,Xb),t.showCityAndRegion&&t.client.city?(i.openBlock(),i.createElementBlock("span",Ub," г. "+i.toDisplayString(t.client.city.name)+", "+i.toDisplayString(t.client.city.region.name),1)):i.createCommentVNode("",!0)])]),default:i.withCtx(()=>[t.client.alternativeName?(i.openBlock(),i.createElementBlock("div",Kb,i.toDisplayString(t.client.alternativeName),1)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("span",Gb," Последний вход: "+i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),Qb={class:"text-base"},Jb={},Xd=i.defineComponent({...Jb,__name:"contragent-with-short-info",props:{contragent:{}},setup(t){const e=t,n=i.computed(()=>Wn.getFormatEntityName(e.contragent));return(r,o)=>(i.openBlock(),i.createElementBlock("span",Qb,i.toDisplayString(n.value),1))}}),e_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function t_(t,e){return i.openBlock(),i.createElementBlock("svg",e_,[...e[0]||(e[0]=[i.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[i.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),i.createElementVNode("path",{d:"m3 7l9 6l9-6"})],-1)])])}const n_=i.markRaw({name:"tabler-mail",render:t_}),i_=["href"],r_={},o_=i.defineComponent({...r_,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(t){return(e,n)=>{const r=n_;return i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-row items-center gap-1":t.showEmailIcon})},[t.showEmailIcon?(i.openBlock(),i.createBlock(r,{key:0})):i.createCommentVNode("",!0),i.createElementVNode("a",{href:`mailto:${t.email}`,class:"no-underline"},i.toDisplayString(t.email),9,i_)],2)}}}),s_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function a_(t,e){return i.openBlock(),i.createElementBlock("svg",s_,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M444 49.9C431.3 38.2 379.9.9 265.3.4c0 0-135.1-8.1-200.9 52.3C27.8 89.3 14.9 143 13.5 209.5s-3.1 191.1 117 224.9h.1l-.1 51.6s-.8 20.9 13 25.1c16.6 5.2 26.4-10.7 42.3-27.8c8.7-9.4 20.7-23.2 29.8-33.7c82.2 6.9 145.3-8.9 152.5-11.2c16.6-5.4 110.5-17.4 125.7-142c15.8-128.6-7.6-209.8-49.8-246.5M457.9 287c-12.9 104-89 110.6-103 115.1c-6 1.9-61.5 15.7-131.2 11.2c0 0-52 62.7-68.2 79c-5.3 5.3-11.1 4.8-11-5.7c0-6.9.4-85.7.4-85.7q-.15 0 0 0C43.1 372.7 49.1 266.6 50.2 211.1s11.6-101 42.6-131.6c55.7-50.5 170.4-43 170.4-43c96.9.4 143.3 29.6 154.1 39.4c35.7 30.6 53.9 103.8 40.6 211.1m-139-80.8c.4 8.6-12.5 9.2-12.9.6c-1.1-22-11.4-32.7-32.6-33.9c-8.6-.5-7.8-13.4.7-12.9c27.9 1.5 43.4 17.5 44.8 46.2m20.3 11.3c1-42.4-25.5-75.6-75.8-79.3c-8.5-.6-7.6-13.5.9-12.9c58 4.2 88.9 44.1 87.8 92.5c-.1 8.6-13.1 8.2-12.9-.3m47 13.4c.1 8.6-12.9 8.7-12.9.1c-.6-81.5-54.9-125.9-120.8-126.4c-8.5-.1-8.5-12.9 0-12.9c73.7.5 133 51.4 133.7 139.2M374.9 329v.2c-10.8 19-31 40-51.8 33.3l-.2-.3c-21.1-5.9-70.8-31.5-102.2-56.5c-16.2-12.8-31-27.9-42.4-42.4c-10.3-12.9-20.7-28.2-30.8-46.6c-21.3-38.5-26-55.7-26-55.7c-6.7-20.8 14.2-41 33.3-51.8h.2c9.2-4.8 18-3.2 23.9 3.9c0 0 12.4 14.8 17.7 22.1c5 6.8 11.7 17.7 15.2 23.8c6.1 10.9 2.3 22-3.7 26.6l-12 9.6c-6.1 4.9-5.3 14-5.3 14s17.8 67.3 84.3 84.3c0 0 9.1.8 14-5.3l9.6-12c4.6-6 15.7-9.8 26.6-3.7c14.7 8.3 33.4 21.2 45.8 32.9c7 5.7 8.6 14.4 3.8 23.6"},null,-1)])])}const Yd=i.markRaw({name:"fa6-brands-viber",render:a_}),l_={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},c_=["id"],d_=["id"],u_=["fill"],h_=["fill"];function f_(t,e){return i.openBlock(),i.createElementBlock("svg",l_,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:t.idMap.SVGBRLHCcSy,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[0]||(e[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#1FAF38"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#60D669"},null,-1)])],8,c_),i.createElementVNode("linearGradient",{id:t.idMap.SVGHW6lecxh,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[1]||(e[1]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#F9F9F9"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#FFF"},null,-1)])],8,d_)]),i.createElementVNode("path",{fill:"url(#"+t.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,u_),i.createElementVNode("path",{fill:"url(#"+t.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,h_),e[2]||(e[2]=i.createElementVNode("path",{fill:"#FFF",d:"M96.678 74.148c-2.386-5.303-4.897-5.41-7.166-5.503c-1.858-.08-3.982-.074-6.104-.074c-2.124 0-5.575.799-8.492 3.984c-2.92 3.188-11.148 10.892-11.148 26.561s11.413 30.813 13.004 32.94c1.593 2.123 22.033 35.307 54.405 48.073c26.904 10.609 32.379 8.499 38.218 7.967c5.84-.53 18.844-7.702 21.497-15.139c2.655-7.436 2.655-13.81 1.859-15.142c-.796-1.327-2.92-2.124-6.105-3.716s-18.844-9.298-21.763-10.361c-2.92-1.062-5.043-1.592-7.167 1.597c-2.124 3.184-8.223 10.356-10.082 12.48c-1.857 2.129-3.716 2.394-6.9.801c-3.187-1.598-13.444-4.957-25.613-15.806c-9.468-8.442-15.86-18.867-17.718-22.056c-1.858-3.184-.199-4.91 1.398-6.497c1.431-1.427 3.186-3.719 4.78-5.578c1.588-1.86 2.118-3.187 3.18-5.311c1.063-2.126.531-3.986-.264-5.579c-.798-1.593-6.987-17.343-9.819-23.64"},null,-1))])}const Ud=i.markRaw({name:"logos-whatsapp-icon",render:f_,setup(){const t=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+t(),SVGHW6lecxh:"uicons-"+t()}}}}),m_={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},g_=["id"],p_=["fill"];function y_(t,e){return i.openBlock(),i.createElementBlock("svg",m_,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:t.idMap.SVGuySfwdaH,x1:"50%",x2:"50%",y1:"0%",y2:"100%"},[...e[0]||(e[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#2AABEE"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#229ED9"},null,-1)])],8,g_)]),i.createElementVNode("path",{fill:"url(#"+t.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,p_),e[1]||(e[1]=i.createElementVNode("path",{fill:"#FFF",d:"M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072"},null,-1))])}const Kd=i.markRaw({name:"logos-telegram",render:y_,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),b_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function __(t,e){return i.openBlock(),i.createElementBlock("svg",b_,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M391 480c-19.52 0-46.94-7.06-88-30c-49.93-28-88.55-53.85-138.21-103.38C116.91 298.77 93.61 267.79 61 208.45c-36.84-67-30.56-102.12-23.54-117.13C45.82 73.38 58.16 62.65 74.11 52a176.3 176.3 0 0 1 28.64-15.2c1-.43 1.93-.84 2.76-1.21c4.95-2.23 12.45-5.6 21.95-2c6.34 2.38 12 7.25 20.86 16c18.17 17.92 43 57.83 52.16 77.43c6.15 13.21 10.22 21.93 10.23 31.71c0 11.45-5.76 20.28-12.75 29.81c-1.31 1.79-2.61 3.5-3.87 5.16c-7.61 10-9.28 12.89-8.18 18.05c2.23 10.37 18.86 41.24 46.19 68.51s57.31 42.85 67.72 45.07c5.38 1.15 8.33-.59 18.65-8.47c1.48-1.13 3-2.3 4.59-3.47c10.66-7.93 19.08-13.54 30.26-13.54h.06c9.73 0 18.06 4.22 31.86 11.18c18 9.08 59.11 33.59 77.14 51.78c8.77 8.84 13.66 14.48 16.05 20.81c3.6 9.53.21 17-2 22c-.37.83-.78 1.74-1.21 2.75a176.5 176.5 0 0 1-15.29 28.58c-10.63 15.9-21.4 28.21-39.38 36.58A67.4 67.4 0 0 1 391 480"},null,-1)])])}const Gd=i.markRaw({name:"ion-call",render:__}),w_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function x_(t,e){return i.openBlock(),i.createElementBlock("svg",w_,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l2 5l-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2m10 3a2 2 0 0 1 2 2m-2-6a6 6 0 0 1 6 6"},null,-1)])])}const k_=i.markRaw({name:"tabler-phone-call",render:x_}),v_={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},C_=["href"],S_=["href"],B_=["href"],T_=["href"],N_={},$_=i.defineComponent({...N_,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(t){const e=t,n=i.computed(()=>{try{return e.phone?sr.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=i.computed(()=>{var l;return M.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),o=i.computed(()=>{var l;return M.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=i.computed(()=>{var l;return M.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=k_,u=Gd,h=Kd,f=Ud,g=Yd;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",{class:i.normalizeClass({"border-xl relative inline-flex items-center rounded px-2":r.value&&a.value,"min-w-10":!0}),onClick:c[0]||(c[0]=m=>a.value=!a.value),onFocusout:c[1]||(c[1]=m=>a.value=!1),onMouseleave:c[2]||(c[2]=m=>a.value=!1)},[i.createElementVNode("div",{class:i.normalizeClass({"flex flex-row items-center gap-1":t.showPhoneIcon})},[t.showPhoneIcon?(i.openBlock(),i.createBlock(d,{key:0})):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(o.value),1)],2),r.value&&a.value?(i.openBlock(),i.createElementBlock("div",v_,[r.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:`tel:${s.value}`,class:"text-blue-600 hover:animate-pulse hover:text-blue-600"},[i.createVNode(u)],8,C_)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:1,href:`https://t.me/${s.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(h)],8,S_)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${s.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(f)],8,B_)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${s.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[i.createVNode(g)],8,T_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),E_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function R_(t,e){return i.openBlock(),i.createElementBlock("svg",E_,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"m20 8l-8 5l-8-5V6l8 5l8-5m0-2H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2"},null,-1)])])}const P_=i.markRaw({name:"mdi-envelope",render:R_}),F_={class:"flex flex-col gap-1"},V_={key:0,class:"mb-2 flex flex-col text-base"},I_={key:0,class:"text-sc-dark-grey text-sm"},M_={key:1,class:"whitespace-nowrap text-sm"},A_={key:2,class:"whitespace-nowrap text-sm"},O_={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},z_=["href"],D_=["href"],L_=["href"],H_=["href"],W_=["href"],j_={key:0,class:"flex flex-col text-base"},q_={key:0,class:"text-sc-dark-grey text-sm"},X_={key:1,class:"mt-2 text-sm"},Y_={key:0,class:"-mt-1"},U_={},K_=i.defineComponent({...U_,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(t){const e=t,n=i.computed(()=>Wn.getFormatEntityName(e.contact)),r=i.computed(()=>{try{return e.contact.phone?sr.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),o=i.computed(()=>{var d;return M.isString(r.value)?!1:((d=r.value)==null?void 0:d.isValid())??!1}),s=i.computed(()=>{var d;return M.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("INTERNATIONAL"))??""}),a=i.computed(()=>{var d;return M.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("E.164"))??""}),l=i.computed(()=>o.value||e.contact.email),c=i.ref(!1);return(d,u)=>{var b,_;const h=Gd,f=Kd,g=Ud,m=Yd,p=P_,y=O.NPopover;return i.openBlock(),i.createElementBlock("div",F_,[i.createVNode(y,{disabled:t.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var C,k,E,$;return[i.createElementVNode("div",{class:i.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(C=t.contact)!=null&&C.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${t.classes}`),style:i.normalizeStyle(t.styles),onMouseenter:u[0]||(u[0]=x=>c.value=!0),onFocusin:u[1]||(u[1]=x=>c.value=!0),onMouseleave:u[2]||(u[2]=x=>c.value=!1),onFocusout:u[3]||(u[3]=x=>c.value=!1)},[i.createElementVNode("div",null,[t.fullView&&(t.contact.name||(k=t.contact)!=null&&k.position)?(i.openBlock(),i.createElementBlock("div",V_,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),(E=t.contact)!=null&&E.position?(i.openBlock(),i.createElementBlock("span",I_,i.toDisplayString(($=t.contact)==null?void 0:$.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),t.contact.phone?(i.openBlock(),i.createElementBlock("div",M_,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("div",A_,i.toDisplayString(t.contact.email),1)):i.createCommentVNode("",!0),l.value&&c.value?(i.openBlock(),i.createElementBlock("div",O_,[o.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:`tel:${a.value}`,class:"text-blue-600 hover:text-3xl hover:text-blue-600"},[i.createVNode(h)],8,z_)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("a",{key:1,href:`https://t.me/${a.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(f)],8,D_)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${a.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(g)],8,L_)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${a.value}`,class:"text-purple-600 hover:text-3xl hover:text-purple-600"},[i.createVNode(m)],8,H_)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${t.contact.email}`,class:"hover:text-3xl"},[i.createVNode(p)],8,W_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var C,k,E,$;return[t.contact.name?(i.openBlock(),i.createElementBlock("div",j_,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),(C=t.contact)!=null&&C.position?(i.openBlock(),i.createElementBlock("span",q_,i.toDisplayString((k=t.contact)==null?void 0:k.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),(E=t.contact)!=null&&E.comment?(i.openBlock(),i.createElementBlock("div",X_,[u[4]||(u[4]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString(($=t.contact)==null?void 0:$.comment),1)])):i.createCommentVNode("",!0)]}),_:1},8,["disabled"]),t.fullView&&((b=t.contact)!=null&&b.comment)?(i.openBlock(),i.createElementBlock("div",Y_,[u[5]||(u[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((_=t.contact)==null?void 0:_.comment),1)])):i.createCommentVNode("",!0)])}}});class G_{constructor(e){S(this,"minHeight");S(this,"maxHeights");S(this,"minWidth");S(this,"maxWidths");S(this,"netType");S(this,"color");S(this,"mountType");S(this,"descriptions");S(this,"crossbarCount");S(this,"heightOverlaps");S(this,"widthOverlaps");S(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=qo.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=qo.objectToSnake(e.heightOverlaps),this.widthOverlaps=qo.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function Z_(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.SandwichM2?!0:t.properties.configuratorSettings!==void 0&&M.isArray(t.products)&&t.products.length>0}const Q_={class:"flex flex-wrap gap-2"},J_={class:"flex flex-col"},e1={class:"flex flex-col"},t1={},n1=i.defineComponent({...t1,__name:"date-range",props:{clearable:{type:Boolean,default:!0},dateRange:{default:void 0},dateFormat:{default:()=>j.useBaseConfigStateStore().config.dateFormats.uiDate},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1}},emits:["update:date-range"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{if(n.predefinedDateRanges)return n.predefinedDateRanges;if(n.useDefaultPredefinedDateRanges){const a={};return M.forOwn(j.DateTimeProvider.defaultDateRanges(),(l,c)=>{a[c]={label:l.label,from:l.from??void 0,to:l.to??void 0}}),a}}),s=(a,l)=>{r("update:date-range",{from:a?en.startOfDay(new Date(a)):void 0,to:l?en.endOfDay(new Date(l)):void 0})};return(a,l)=>{var u,h,f,g,m,p;const c=O.NButton,d=O.NDatePicker;return i.openBlock(),i.createElementBlock("div",Q_,[i.createVNode(d,{value:((h=(u=t.dateRange)==null?void 0:u.from)==null?void 0:h.getTime())??null,clearable:t.clearable,"is-date-disabled":y=>{var b,_;return((b=t.dateRange)==null?void 0:b.to)&&y>((_=t.dateRange)==null?void 0:_.to)},disabled:(f=t.disabled)==null?void 0:f.from,format:t.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[0]||(l[0]=y=>{var b,_;return s(y,(_=(b=t.dateRange)==null?void 0:b.to)==null?void 0:_.getTime())})},i.createSlots({_:2},[o.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",J_,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,(y,b)=>(i.openBlock(),i.createBlock(c,{key:b,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:_=>{var C,k;return s((C=y==null?void 0:y.from)==null?void 0:C.getTime(),(k=y==null?void 0:y.to)==null?void 0:k.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"]),i.createVNode(d,{value:((m=(g=t.dateRange)==null?void 0:g.to)==null?void 0:m.getTime())??null,clearable:t.clearable,"is-date-disabled":y=>{var b,_;return((b=t.dateRange)==null?void 0:b.from)&&y<((_=t.dateRange)==null?void 0:_.from)},disabled:(p=t.disabled)==null?void 0:p.to,format:t.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[1]||(l[1]=y=>{var b,_;return s((_=(b=t.dateRange)==null?void 0:b.from)==null?void 0:_.getTime(),y)})},i.createSlots({_:2},[o.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",e1,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,(y,b)=>(i.openBlock(),i.createBlock(c,{key:b,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:_=>{var C,k;return s((C=y==null?void 0:y.from)==null?void 0:C.getTime(),(k=y==null?void 0:y.to)==null?void 0:k.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"])])}}}),i1={class:"sc-lbl-date text-nowrap"},r1={},_o=i.defineComponent({...r1,__name:"date-time-label",props:{date:{},isTimeSecondary:{type:Boolean},isTimeOnSecondLine:{type:Boolean},isShowTime:{type:Boolean,default:!0}},setup(t){const e=t,n=i.computed(()=>en.format(e.date,j.useBaseConfigStateStore().config.dateFormats.uiDate)),r=i.computed(()=>en.format(e.date,"HH:mm"));return(o,s)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-col":t.isTimeOnSecondLine})},[i.createElementVNode("span",i1,i.toDisplayString(n.value),1),t.isShowTime?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass([{"text-sc-grey":t.isTimeSecondary,"ml-1":!t.isTimeOnSecondLine},"sc-lbl-time"])},i.toDisplayString(r.value),3)):i.createCommentVNode("",!0)],2))}}),o1={class:"flex flex-row gap-2.5"},s1={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},a1={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},l1={class:"mb-0.5 sm:mb-0 sm:ml-3"},c1={},d1=i.defineComponent({...c1,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(t){return(e,n)=>{const r=bo,o=O.NButton,s=O.NPopover;return i.openBlock(),i.createElementBlock("div",o1,[i.createElementVNode("div",s1,[i.renderSlot(e.$slots,"main")]),i.createElementVNode("div",null,[i.createElementVNode("div",a1,[i.renderSlot(e.$slots,"extra-buttons"),i.createElementVNode("div",l1,[t.showCloseButton?(i.openBlock(),i.createBlock(s,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(o,{size:"small",type:"error",onClick:n[0]||(n[0]=a=>e.$emit("close"))},{default:i.withCtx(()=>[i.createVNode(r)]),_:1})]),default:i.withCtx(()=>[n[1]||(n[1]=i.createTextVNode(" Закрыть ",-1))]),_:1})):i.createCommentVNode("",!0)])])])])}}}),u1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function h1(t,e){return i.openBlock(),i.createElementBlock("svg",u1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 176h40a40 40 0 0 1 40 40v208a40 40 0 0 1-40 40H136a40 40 0 0 1-40-40V216a40 40 0 0 1 40-40h40"},null,-1),i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m176 272l80 80l80-80M256 48v288"},null,-1)])])}const f1=i.markRaw({name:"ion-download-outline",render:h1}),m1={},g1=i.defineComponent({...m1,__name:"single-file-upload-selector",props:{draggedAreaText:{},accept:{},isError:{type:Boolean}},emits:["update:file"],setup(t,{emit:e}){const n=t,r=e,o=i.ref([]),s=i.computed(()=>o.value.map(l=>(l.status=n.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=f1;return i.openBlock(),i.createBlock(i.unref(O.NUpload),{"file-list":s.value,"default-upload":!1,max:1,"show-retry-button":!1,action:"",accept:t.accept,"directory-dnd":"",class:"content-center","onUpdate:fileList":a},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NUploadDragger),null,{default:i.withCtx(()=>[i.renderSlot(l.$slots,"dragged-area",{},()=>[i.createElementVNode("div",null,[i.createVNode(d,{class:"text-2xl"}),i.createElementVNode("div",null,i.toDisplayString(t.draggedAreaText??"Перетащите в эту область файл, который необходимо загрузить."),1)])])]),_:3})]),_:3},8,["file-list","accept"])}}}),p1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function y1(t,e){return i.openBlock(),i.createElementBlock("svg",p1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"square","stroke-miterlimit":"10","stroke-width":"44",d:"M465 127L241 384l-92-92m-9 93l-93-93m316-165L236 273"},null,-1)])])}const b1=i.markRaw({name:"ion-checkmark-done-sharp",render:y1}),_1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function w1(t,e){return i.openBlock(),i.createElementBlock("svg",_1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128h80m-384 0h240m64 256h80m-384 0h240m-96-128h240m-384 0h80"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"128",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"176",cy:"256",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"384",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1)])])}const x1=i.markRaw({name:"ion-options-outline",render:w1}),k1={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},v1={class:"flex-auto"},C1={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"},S1={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"},B1={},qs=i.defineComponent({...B1,__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(t,{emit:e}){const n=e,r=i.ref(!1),o=()=>{n("edit")},s=()=>{r.value=!1},a=()=>{r.value=!0,n("apply",s)},l=()=>{n("cancel",s)};return(c,d)=>{const u=x1,h=O.NButton,f=O.NPopover,g=b1,m=bo;return i.openBlock(),i.createElementBlock("div",k1,[i.createElementVNode("div",v1,[i.renderSlot(c.$slots,"default")]),i.createElementVNode("div",null,[i.createElementVNode("div",C1,[i.createElementVNode("div",S1,[t.showEditButton?(i.openBlock(),i.createBlock(f,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(h,{disabled:t.disabled||r.value,type:"info",ghost:"",size:"small",onClick:o},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[0]||(d[0]=i.createTextVNode(" Редактировать данные ",-1))]),_:1})):i.createCommentVNode("",!0),t.showApplyButton?(i.openBlock(),i.createBlock(f,{key:1,disabled:r.value,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(h,{disabled:t.disabled||r.value,type:"primary",size:"small",onClick:a},{default:i.withCtx(()=>[i.createVNode(g)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[1]||(d[1]=i.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),t.showCancelButton?(i.openBlock(),i.createBlock(f,{key:2,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(h,{disabled:t.disabled||r.value,type:"error",size:"small",onClick:l},{default:i.withCtx(()=>[i.createVNode(m)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[2]||(d[2]=i.createTextVNode(" Отменить изменения ",-1))]),_:1})):i.createCommentVNode("",!0)]),i.renderSlot(c.$slots,"extra-buttons")])])])}}}),T1={},Zd=i.defineComponent({...T1,__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(t,{emit:e}){const n=t,r=e,o=i.ref(n.showEditor),s=l=>{r("editor:apply",d=>{o.value=!d,l()})},a=l=>{o.value=!1,l(),r("editor:cancel")};return i.onMounted(()=>{i.watch(()=>n.showEditor,l=>{o.value=l})}),(l,c)=>(i.openBlock(),i.createElementBlock("div",null,[o.value?(i.openBlock(),i.createBlock(qs,{key:1,disabled:t.disabled,"show-apply-button":!0,"show-cancel-button":!0,onApply:s,onCancel:a},{"extra-buttons":i.withCtx(()=>[i.renderSlot(l.$slots,"extra-editor-buttons")]),default:i.withCtx(()=>[i.renderSlot(l.$slots,"editor")]),_:3},8,["disabled"])):(i.openBlock(),i.createBlock(qs,{key:0,disabled:t.disabled,"show-edit-button":t.showEditButton,onEdit:c[0]||(c[0]=d=>o.value=!0)},{"extra-buttons":i.withCtx(()=>[i.renderSlot(l.$slots,"extra-viewer-buttons")]),default:i.withCtx(()=>[i.renderSlot(l.$slots,"viewer")]),_:3},8,["disabled","show-edit-button"]))]))}}),N1={},$1=i.defineComponent({...N1,__name:"debounced-input",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:800},placeholder:{default:""}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,o=i.ref(n.value),s=i.computed(()=>i.inject("debounce-input-time",n.debounceTime)),a=M.debounce(()=>r("update:value",o.value),s.value),l=c=>{o.value=c,a()};return i.watch(()=>n.value,c=>{o.value=c}),(c,d)=>(i.openBlock(),i.createBlock(i.unref(O.NInput),{value:o.value,"onUpdate:value":[d[0]||(d[0]=u=>o.value=u),l],clearable:t.clearable,placeholder:t.placeholder},{prefix:i.withCtx(()=>[i.renderSlot(c.$slots,"prefix")]),_:3},8,["value","clearable","placeholder"]))}}),E1={},R1=i.defineComponent({...E1,__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(t,{expose:e,emit:n}){const r=t,o=n,s=i.ref(r.value),a=i.computed(()=>i.inject("debounce-input-time",r.debounceTime)),l=M.debounce(()=>o("update:value",s.value),a.value),c=g=>{s.value=g,l()};i.watch(()=>r.value,g=>{s.value=g});const d=i.ref(null);return e({focus:()=>{var g;return(g=d.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=d.value)==null?void 0:g.blur()},select:()=>{var g;return(g=d.value)==null?void 0:g.select()}}),(g,m)=>(i.openBlock(),i.createBlock(i.unref(O.NInputNumber),{ref_key:"inputReference",ref:d,value:s.value??null,clearable:t.clearable,parse:t.parse,"show-button":t.showButton,placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,validator:t.validator,"onUpdate:value":c,onKeydown:m[0]||(m[0]=p=>o("keydown",p)),onInput:m[1]||(m[1]=p=>o("input",p)),onFocus:m[2]||(m[2]=p=>o("focus",p))},{prefix:i.withCtx(()=>[i.renderSlot(g.$slots,"prefix")]),_:3},8,["value","clearable","parse","show-button","placeholder","min","max","step","validator"]))}}),P1={},F1=i.defineComponent({...P1,__name:"phone-input",props:{value:{},debounceTime:{},disabled:{type:Boolean},placeholder:{},defaultCountry:{},preferredCountries:{},onlyCountries:{}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,o=i.ref((n.value??"").replaceAll(/\D*/g,"")),s=M.debounce(c=>r("update:value",c),n.debounceTime??0),a=c=>{let d="";if(M.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(M.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof sr.PhoneNumber?c.format("E.164"):`+${c.countryCallingCode}${c.nationalNumber}`}n.debounceTime?s(d):r("update:value",d)},l=c=>{const d=c.replaceAll(/\D*/g,"");try{const u=sr.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof sr.ParseError)o.value=d;else throw u}};return i.watch(()=>n.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}),i.onBeforeMount(()=>l(o.value??"")),(c,d)=>(i.openBlock(),i.createBlock(i.unref(of.VueTelInput),{modelValue:o.value,"onUpdate:modelValue":[d[0]||(d[0]=u=>o.value=u),a],"auto-default-country":!1,"auto-format":!0,"default-country":t.defaultCountry,disabled:t.disabled,"input-options":{placeholder:t.placeholder},"preferred-countries":t.preferredCountries,"only-countries":t.onlyCountries,mode:"international",class:"tel-input"},null,8,["modelValue","default-country","disabled","input-options","preferred-countries","only-countries"]))}}),V1=jn(F1,[["__scopeId","data-v-751dbb0e"]]),I1={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function M1(t,e){return i.openBlock(),i.createElementBlock("svg",I1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6m-7 1l9-9m-5 0h5v5"},null,-1)])])}const A1=i.markRaw({name:"tabler-external-link",render:M1}),O1={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},z1=["href"],D1={},L1=i.defineComponent({...D1,__name:"external-link",props:{text:{},url:{},description:{}},setup(t){return(e,n)=>{const r=A1,o=O.NTooltip;return i.openBlock(),i.createBlock(o,{disabled:i.unref(M.isUndefined)(t.description),placement:"top-start"},{trigger:i.withCtx(()=>[i.createElementVNode("span",O1,[i.createElementVNode("a",{href:t.url,target:"_blank",class:"no-underline"},i.toDisplayString(t.text),9,z1),i.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.description),1)]),_:1},8,["disabled"])}}}),H1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function W1(t,e){return i.openBlock(),i.createElementBlock("svg",H1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192Z"},null,-1),i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 256H176"},null,-1)])])}const j1=i.markRaw({name:"ion-remove-circle-outline",render:W1});let wo=[];const Qd=new WeakMap;function q1(){wo.forEach(t=>t(...Qd.get(t))),wo=[]}function Jd(t,...e){Qd.set(t,e),!wo.includes(t)&&wo.push(t)===1&&requestAnimationFrame(q1)}function wr(t,e){let{target:n}=t;for(;n;){if(n.dataset&&n.dataset[e]!==void 0)return!0;n=n.parentElement}return!1}function xr(t){return t.composedPath()[0]||null}function kr(t){return typeof t=="string"?t.endsWith("px")?Number(t.slice(0,t.length-2)):Number(t):t}function vr(t){if(t!=null)return typeof t=="number"?`${t}px`:t.endsWith("px")?t:`${t}px`}function rn(t,e){const n=t.trim().split(/\s+/g),r={top:n[0]};switch(n.length){case 1:r.right=n[0],r.bottom=n[0],r.left=n[0];break;case 2:r.right=n[1],r.left=n[1],r.bottom=n[0];break;case 3:r.right=n[1],r.bottom=n[2],r.left=n[1];break;case 4:r.right=n[1],r.bottom=n[2],r.left=n[3];break;default:throw new Error("[seemly/getMargin]:"+t+" is not a valid value.")}return e===void 0?r:r[e]}const eu={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 X1(t,e,n){e/=100,n/=100;let r=(o,s=(o+t/60)%6)=>n-n*e*Math.max(Math.min(s,4-s,1),0);return[r(5)*255,r(3)*255,r(1)*255]}function Y1(t,e,n){e/=100,n/=100;let r=e*Math.min(n,1-n),o=(s,a=(s+t/30)%12)=>n-r*Math.max(Math.min(a-3,9-a,1),-1);return[o(0)*255,o(8)*255,o(4)*255]}const wn="^\\s*",xn="\\s*$",Zn="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Ht="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",gi="([0-9A-Fa-f])",pi="([0-9A-Fa-f]{2})",tu=new RegExp(`${wn}hsl\\s*\\(${Ht},${Zn},${Zn}\\)${xn}`),nu=new RegExp(`${wn}hsv\\s*\\(${Ht},${Zn},${Zn}\\)${xn}`),iu=new RegExp(`${wn}hsla\\s*\\(${Ht},${Zn},${Zn},${Ht}\\)${xn}`),ru=new RegExp(`${wn}hsva\\s*\\(${Ht},${Zn},${Zn},${Ht}\\)${xn}`),U1=new RegExp(`${wn}rgb\\s*\\(${Ht},${Ht},${Ht}\\)${xn}`),K1=new RegExp(`${wn}rgba\\s*\\(${Ht},${Ht},${Ht},${Ht}\\)${xn}`),G1=new RegExp(`${wn}#${gi}${gi}${gi}${xn}`),Z1=new RegExp(`${wn}#${pi}${pi}${pi}${xn}`),Q1=new RegExp(`${wn}#${gi}${gi}${gi}${gi}${xn}`),J1=new RegExp(`${wn}#${pi}${pi}${pi}${pi}${xn}`);function At(t){return parseInt(t,16)}function ew(t){try{let e;if(e=iu.exec(t))return[ko(e[1]),Qn(e[5]),Qn(e[9]),bi(e[13])];if(e=tu.exec(t))return[ko(e[1]),Qn(e[5]),Qn(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${t}.`)}catch(e){throw e}}function tw(t){try{let e;if(e=ru.exec(t))return[ko(e[1]),Qn(e[5]),Qn(e[9]),bi(e[13])];if(e=nu.exec(t))return[ko(e[1]),Qn(e[5]),Qn(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${t}.`)}catch(e){throw e}}function yi(t){try{let e;if(e=Z1.exec(t))return[At(e[1]),At(e[2]),At(e[3]),1];if(e=U1.exec(t))return[bt(e[1]),bt(e[5]),bt(e[9]),1];if(e=K1.exec(t))return[bt(e[1]),bt(e[5]),bt(e[9]),bi(e[13])];if(e=G1.exec(t))return[At(e[1]+e[1]),At(e[2]+e[2]),At(e[3]+e[3]),1];if(e=J1.exec(t))return[At(e[1]),At(e[2]),At(e[3]),bi(At(e[4])/255)];if(e=Q1.exec(t))return[At(e[1]+e[1]),At(e[2]+e[2]),At(e[3]+e[3]),bi(At(e[4]+e[4])/255)];if(t in eu)return yi(eu[t]);if(tu.test(t)||iu.test(t)){const[n,r,o,s]=ew(t);return[...Y1(n,r,o),s]}else if(nu.test(t)||ru.test(t)){const[n,r,o,s]=tw(t);return[...X1(n,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${t}.`)}catch(e){throw e}}function nw(t){return t>1?1:t<0?0:t}function Xs(t,e,n,r){return`rgba(${bt(t)}, ${bt(e)}, ${bt(n)}, ${nw(r)})`}function Ys(t,e,n,r,o){return bt((t*e*(1-r)+n*r)/o)}function iw(t,e){Array.isArray(t)||(t=yi(t)),Array.isArray(e)||(e=yi(e));const n=t[3],r=e[3],o=bi(n+r-n*r);return Xs(Ys(t[0],n,e[0],r,o),Ys(t[1],n,e[1],r,o),Ys(t[2],n,e[2],r,o),o)}function ze(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:yi(t);return typeof e.alpha=="number"?Xs(n,r,o,e.alpha):Xs(n,r,o,s)}function xo(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:yi(t),{lightness:a=1,alpha:l=1}=e;return rw([n*a,r*a,o*a,s*l])}function bi(t){const e=Math.round(Number(t)*100)/100;return e>1?1:e<0?0:e}function ko(t){const e=Math.round(Number(t));return e>=360||e<0?0:e}function bt(t){const e=Math.round(Number(t));return e>255?255:e<0?0:e}function Qn(t){const e=Math.round(Number(t));return e>100?100:e<0?0:e}function rw(t){const[e,n,r]=t;return 3 in t?`rgba(${bt(e)}, ${bt(n)}, ${bt(r)}, ${bi(t[3])})`:`rgba(${bt(e)}, ${bt(n)}, ${bt(r)}, 1)`}function ow(t=8){return Math.random().toString(16).slice(2,2+t)}function ou(t){return Array.isArray(t)?t:[t]}const Us={STOP:"STOP"};function su(t,e){const n=e(t);t.children!==void 0&&n!==Us.STOP&&t.children.forEach(r=>su(r,e))}function sw(t,e={}){const{preserveGroup:n=!1}=e,r=[],o=n?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(t),r}function aw(t,e){const{isLeaf:n}=t;return n!==void 0?n:!e(t)}function lw(t){return t.children}function cw(t){return t.key}function dw(){return!1}function uw(t,e){const{isLeaf:n}=t;return!(n===!1&&!Array.isArray(e(t)))}function hw(t){return t.disabled===!0}function fw(t,e){return t.isLeaf===!1&&!Array.isArray(e(t))}function mw(t,e){if(t.isLeaf===!0){const n=e(t);if(Array.isArray(n)&&n.length>0)return!0}return!1}function Ks(t){var e;return t==null?[]:Array.isArray(t)?t:(e=t.checkedKeys)!==null&&e!==void 0?e:[]}function Gs(t){var e;return t==null||Array.isArray(t)?[]:(e=t.indeterminateKeys)!==null&&e!==void 0?e:[]}function gw(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)||n.add(r)}),Array.from(n)}function pw(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)&&n.delete(r)}),Array.from(n)}function yw(t){return(t==null?void 0:t.type)==="group"}function bw(t){const e=new Map;return t.forEach((n,r)=>{e.set(n.key,r)}),n=>{var r;return(r=e.get(n))!==null&&r!==void 0?r:null}}class _w extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function ww(t,e,n,r){return vo(e.concat(t),n,r,!1)}function xw(t,e){const n=new Set;return t.forEach(r=>{const o=e.treeNodeMap.get(r);if(o!==void 0){let s=o.parent;for(;s!==null&&!(s.disabled||n.has(s.key));)n.add(s.key),s=s.parent}}),n}function kw(t,e,n,r){const o=vo(e,n,r,!1),s=vo(t,n,r,!0),a=xw(t,n),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function Zs(t,e){const{checkedKeys:n,keysToCheck:r,keysToUncheck:o,indeterminateKeys:s,cascade:a,leafOnly:l,checkStrategy:c,allowNotLoaded:d}=t;if(!a)return r!==void 0?{checkedKeys:gw(n,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:pw(n,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(n),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let h;o!==void 0?h=kw(o,n,e,d):r!==void 0?h=ww(r,n,e,d):h=vo(n,e,d,!1);const f=c==="parent",g=c==="child"||l,m=h,p=new Set,y=Math.max.apply(null,Array.from(u.keys()));for(let b=y;b>=0;b-=1){const _=b===0,C=u.get(b);for(const k of C){if(k.isLeaf)continue;const{key:E,shallowLoaded:$}=k;if(g&&$&&k.children.forEach(T=>{!T.disabled&&!T.isLeaf&&T.shallowLoaded&&m.has(T.key)&&m.delete(T.key)}),k.disabled||!$)continue;let x=!0,B=!1,w=!0;for(const T of k.children){const N=T.key;if(!T.disabled){if(w&&(w=!1),m.has(N))B=!0;else if(p.has(N)){B=!0,x=!1;break}else if(x=!1,B)break}}x&&!w?(f&&k.children.forEach(T=>{!T.disabled&&m.has(T.key)&&m.delete(T.key)}),m.add(E)):B&&p.add(E),_&&g&&m.has(E)&&m.delete(E)}}return{checkedKeys:Array.from(m),indeterminateKeys:Array.from(p)}}function vo(t,e,n,r){const{treeNodeMap:o,getChildren:s}=e,a=new Set,l=new Set(t);return t.forEach(c=>{const d=o.get(c);d!==void 0&&su(d,u=>{if(u.disabled)return Us.STOP;const{key:h}=u;if(!a.has(h)&&(a.add(h),l.add(h),fw(u.rawNode,s))){if(r)return Us.STOP;if(!n)throw new _w}})}),l}function vw(t,{includeGroup:e=!1,includeSelf:n=!0},r){var o;const s=r.treeNodeMap;let a=t==null?null:(o=s.get(t))!==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(),n||l.treeNodePath.pop(),l.keyPath=l.treeNodePath.map(c=>c.key),l}function Cw(t){if(t.length===0)return null;const e=t[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function Sw(t,e){const n=t.siblings,r=n.length,{index:o}=t;return e?n[(o+1)%r]:o===n.length-1?null:n[o+1]}function au(t,e,{loop:n=!1,includeDisabled:r=!1}={}){const o=e==="prev"?Bw:Sw,s={reverse:e==="prev"};let a=!1,l=null;function c(d){if(d!==null){if(d===t){if(!a)a=!0;else if(!t.disabled&&!t.isGroup){l=t;return}}else if((!d.disabled||r)&&!d.ignored&&!d.isGroup){l=d;return}if(d.isGroup){const u=Qs(d,s);u!==null?l=u:c(o(d,n))}else{const u=o(d,!1);if(u!==null)c(u);else{const h=Tw(d);h!=null&&h.isGroup?c(o(h,n)):n&&c(o(d,!0))}}}}return c(t),l}function Bw(t,e){const n=t.siblings,r=n.length,{index:o}=t;return e?n[(o-1+r)%r]:o===0?null:n[o-1]}function Tw(t){return t.parent}function Qs(t,e={}){const{reverse:n=!1}=e,{children:r}=t;if(r){const{length:o}=r,s=n?o-1:0,a=n?-1:o,l=n?-1:1;for(let c=s;c!==a;c+=l){const d=r[c];if(!d.disabled&&!d.ignored)if(d.isGroup){const u=Qs(d,e);if(u!==null)return u}else return d}}return null}const Nw={getChild(){return this.ignored?null:Qs(this)},getParent(){const{parent:t}=this;return t!=null&&t.isGroup?t.getParent():t},getNext(t={}){return au(this,"next",t)},getPrev(t={}){return au(this,"prev",t)}};function $w(t,e){const n=e?new Set(e):void 0,r=[];function o(s){s.forEach(a=>{r.push(a),!(a.isLeaf||!a.children||a.ignored)&&(a.isGroup||n===void 0||n.has(a.key))&&o(a.children)})}return o(t),r}function Ew(t,e){const n=t.key;for(;e;){if(e.key===n)return!0;e=e.parent}return!1}var Rw={};function lu(t,e,n,r,o,s=null,a=0){const l=[];return t.forEach((c,d)=>{var u;Rw.NODE_ENV!=="production"&&mw(c,o)&&console.error("[treemate]: node",c,"is invalid");const h=Object.create(r);if(h.rawNode=c,h.siblings=l,h.level=a,h.index=d,h.isFirstChild=d===0,h.isLastChild=d+1===t.length,h.parent=s,!h.ignored){const f=o(c);Array.isArray(f)&&(h.children=lu(f,e,n,r,o,h,a+1))}l.push(h),e.set(h.key,h),n.has(a)||n.set(a,[]),(u=n.get(a))===null||u===void 0||u.push(h)}),l}function Pw(t,e={}){var n;const r=new Map,o=new Map,{getDisabled:s=hw,getIgnored:a=dw,getIsGroup:l=yw,getKey:c=cw}=e,d=(n=e.getChildren)!==null&&n!==void 0?n:lw,u=e.ignoreEmptyChildren?k=>{const E=d(k);return Array.isArray(E)?E.length?E:null:E}:d,h=Object.assign({get key(){return c(this.rawNode)},get disabled(){return s(this.rawNode)},get isGroup(){return l(this.rawNode)},get isLeaf(){return aw(this.rawNode,u)},get shallowLoaded(){return uw(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(k){return Ew(this,k)}},Nw),f=lu(t,r,o,h,u);function g(k){if(k==null)return null;const E=r.get(k);return E&&!E.isGroup&&!E.ignored?E:null}function m(k){if(k==null)return null;const E=r.get(k);return E&&!E.ignored?E:null}function p(k,E){const $=m(k);return $?$.getPrev(E):null}function y(k,E){const $=m(k);return $?$.getNext(E):null}function b(k){const E=m(k);return E?E.getParent():null}function _(k){const E=m(k);return E?E.getChild():null}const C={treeNodes:f,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(k){return $w(f,k)},getNode:g,getPrev:p,getNext:y,getParent:b,getChild:_,getFirstAvailableNode(){return Cw(f)},getPath(k,E={}){return vw(k,E,C)},getCheckedKeys(k,E={}){const{cascade:$=!0,leafOnly:x=!1,checkStrategy:B="all",allowNotLoaded:w=!1}=E;return Zs({checkedKeys:Ks(k),indeterminateKeys:Gs(k),cascade:$,leafOnly:x,checkStrategy:B,allowNotLoaded:w},C)},check(k,E,$={}){const{cascade:x=!0,leafOnly:B=!1,checkStrategy:w="all",allowNotLoaded:T=!1}=$;return Zs({checkedKeys:Ks(E),indeterminateKeys:Gs(E),keysToCheck:k==null?[]:ou(k),cascade:x,leafOnly:B,checkStrategy:w,allowNotLoaded:T},C)},uncheck(k,E,$={}){const{cascade:x=!0,leafOnly:B=!1,checkStrategy:w="all",allowNotLoaded:T=!1}=$;return Zs({checkedKeys:Ks(E),indeterminateKeys:Gs(E),keysToUncheck:k==null?[]:ou(k),cascade:x,leafOnly:B,checkStrategy:w,allowNotLoaded:T},C)},getNonLeafKeys(k={}){return sw(f,k)}};return C}function Co(t){return t.composedPath()[0]}const Fw={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function Vw(t,e,n){if(t==="mousemoveoutside"){const r=o=>{e.contains(Co(o))||n(o)};return{mousemove:r,touchstart:r}}else if(t==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(Co(a))},s=a=>{r&&(e.contains(Co(a))||n(a))};return{mousedown:o,mouseup:s,touchstart:o,touchend:s}}return console.error(`[evtd/create-trap-handler]: name \`${t}\` is invalid. This could be a bug of evtd.`),{}}function cu(t,e,n){const r=Fw[t];let o=r.get(e);o===void 0&&r.set(e,o=new WeakMap);let s=o.get(n);return s===void 0&&o.set(n,s=Vw(t,e,n)),s}function Iw(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=cu(t,e,n);return Object.keys(o).forEach(s=>{Et(s,document,o[s],r)}),!0}return!1}function Mw(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=cu(t,e,n);return Object.keys(o).forEach(s=>{at(s,document,o[s],r)}),!0}return!1}function Aw(){if(typeof window>"u")return{on:()=>{},off:()=>{}};const t=new WeakMap,e=new WeakMap;function n(){t.set(this,!0)}function r(){t.set(this,!0),e.set(this,!0)}function o(x,B,w){const T=x[B];return x[B]=function(){return w.apply(x,arguments),T.apply(x,arguments)},x}function s(x,B){x[B]=Event.prototype[B]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var x;return(x=a.get(this))!==null&&x!==void 0?x:null}function d(x,B){l!==void 0&&Object.defineProperty(x,"currentTarget",{configurable:!0,enumerable:!0,get:B??l.get})}const u={bubble:{},capture:{}},h={};function f(){const x=function(B){const{type:w,eventPhase:T,bubbles:N}=B,V=Co(B);if(T===2)return;const R=T===1?"capture":"bubble";let I=V;const W=[];for(;I===null&&(I=window),W.push(I),I!==window;)I=I.parentNode||null;const ee=u.capture[w],ne=u.bubble[w];if(o(B,"stopPropagation",n),o(B,"stopImmediatePropagation",r),d(B,c),R==="capture"){if(ee===void 0)return;for(let D=W.length-1;D>=0&&!t.has(B);--D){const H=W[D],L=ee.get(H);if(L!==void 0){a.set(B,H);for(const A of L){if(e.has(B))break;A(B)}}if(D===0&&!N&&ne!==void 0){const A=ne.get(H);if(A!==void 0)for(const z of A){if(e.has(B))break;z(B)}}}}else if(R==="bubble"){if(ne===void 0)return;for(let D=0;D<W.length&&!t.has(B);++D){const H=W[D],L=ne.get(H);if(L!==void 0){a.set(B,H);for(const A of L){if(e.has(B))break;A(B)}}}}s(B,"stopPropagation"),s(B,"stopImmediatePropagation"),d(B)};return x.displayName="evtdUnifiedHandler",x}function g(){const x=function(B){const{type:w,eventPhase:T}=B;if(T!==2)return;const N=h[w];N!==void 0&&N.forEach(V=>V(B))};return x.displayName="evtdUnifiedWindowEventHandler",x}const m=f(),p=g();function y(x,B){const w=u[x];return w[B]===void 0&&(w[B]=new Map,window.addEventListener(B,m,x==="capture")),w[B]}function b(x){return h[x]===void 0&&(h[x]=new Set,window.addEventListener(x,p)),h[x]}function _(x,B){let w=x.get(B);return w===void 0&&x.set(B,w=new Set),w}function C(x,B,w,T){const N=u[B][w];if(N!==void 0){const V=N.get(x);if(V!==void 0&&V.has(T))return!0}return!1}function k(x,B){const w=h[x];return!!(w!==void 0&&w.has(B))}function E(x,B,w,T){let N;if(typeof T=="object"&&T.once===!0?N=ee=>{$(x,B,N,T),w(ee)}:N=w,Iw(x,B,N,T))return;const R=T===!0||typeof T=="object"&&T.capture===!0?"capture":"bubble",I=y(R,x),W=_(I,B);if(W.has(N)||W.add(N),B===window){const ee=b(x);ee.has(N)||ee.add(N)}}function $(x,B,w,T){if(Mw(x,B,w,T))return;const V=T===!0||typeof T=="object"&&T.capture===!0,R=V?"capture":"bubble",I=y(R,x),W=_(I,B);if(B===window&&!C(B,V?"bubble":"capture",x,w)&&k(x,w)){const ne=h[x];ne.delete(w),ne.size===0&&(window.removeEventListener(x,p),h[x]=void 0)}W.has(w)&&W.delete(w),W.size===0&&I.delete(B),I.size===0&&(window.removeEventListener(x,m,R==="capture"),u[R][x]=void 0)}return{on:E,off:$}}const{on:Et,off:at}=Aw(),Gi="@@mmoContext",Ow={mounted(t,{value:e}){t[Gi]={handler:void 0},typeof e=="function"&&(t[Gi].handler=e,Et("mousemoveoutside",t,e))},updated(t,{value:e}){const n=t[Gi];typeof e=="function"?n.handler?n.handler!==e&&(at("mousemoveoutside",t,n.handler),n.handler=e,Et("mousemoveoutside",t,e)):(t[Gi].handler=e,Et("mousemoveoutside",t,e)):n.handler&&(at("mousemoveoutside",t,n.handler),n.handler=void 0)},unmounted(t){const{handler:e}=t[Gi];e&&at("mousemoveoutside",t,e),t[Gi].handler=void 0}},Zi="@@coContext",So={mounted(t,{value:e,modifiers:n}){t[Zi]={handler:void 0},typeof e=="function"&&(t[Zi].handler=e,Et("clickoutside",t,e,{capture:n.capture}))},updated(t,{value:e,modifiers:n}){const r=t[Zi];typeof e=="function"?r.handler?r.handler!==e&&(at("clickoutside",t,r.handler,{capture:n.capture}),r.handler=e,Et("clickoutside",t,e,{capture:n.capture})):(t[Zi].handler=e,Et("clickoutside",t,e,{capture:n.capture})):r.handler&&(at("clickoutside",t,r.handler,{capture:n.capture}),r.handler=void 0)},unmounted(t,{modifiers:e}){const{handler:n}=t[Zi];n&&at("clickoutside",t,n,{capture:e.capture}),t[Zi].handler=void 0}};function zw(t,e){console.error(`[vdirs/${t}]: ${e}`)}class Dw{constructor(){this.elementZIndex=new Map,this.nextZIndex=2e3}get elementCount(){return this.elementZIndex.size}ensureZIndex(e,n){const{elementZIndex:r}=this;if(n!==void 0){e.style.zIndex=`${n}`,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,n){const{elementZIndex:r}=this;r.has(e)?r.delete(e):n===void 0&&zw("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((n,r)=>n[1]-r[1]),this.nextZIndex=2e3,e.forEach(n=>{const r=n[0],o=this.nextZIndex++;`${o}`!==r.style.zIndex&&(r.style.zIndex=`${o}`)})}}const Js=new Dw,Qi="@@ziContext",du={mounted(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n;t[Qi]={enabled:!!o,initialized:!1},o&&(Js.ensureZIndex(t,r),t[Qi].initialized=!0)},updated(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n,s=t[Qi].enabled;o&&!s&&(Js.ensureZIndex(t,r),t[Qi].initialized=!0),t[Qi].enabled=!!o},unmounted(t,e){if(!t[Qi].initialized)return;const{value:n={}}=e,{zIndex:r}=n;Js.unregister(t,r)}};function Lw(t){const e=i.ref(!!t.value);if(e.value)return i.readonly(e);const n=i.watch(t,r=>{r&&(e.value=!0,n())});return i.readonly(e)}function Zt(t){const e=i.computed(t),n=i.ref(e.value);return i.watch(e,r=>{n.value=r}),typeof t=="function"?n:{__v_isRef:!0,get value(){return n.value},set value(r){t.set(r)}}}const Hw=typeof window<"u";let Ji,Cr;(()=>{var t,e;Ji=Hw?(e=(t=document)===null||t===void 0?void 0:t.fonts)===null||e===void 0?void 0:e.ready:void 0,Cr=!1,Ji!==void 0?Ji.then(()=>{Cr=!0}):Cr=!0})();function Ww(t){if(Cr)return;let e=!1;i.onMounted(()=>{Cr||Ji==null||Ji.then(()=>{e||t()})}),i.onBeforeUnmount(()=>{e=!0})}function ea(t,e){return i.watch(t,n=>{n!==void 0&&(e.value=n)}),i.computed(()=>t.value===void 0?e.value:t.value)}function Bo(){const t=i.ref(!1);return i.onMounted(()=>{t.value=!0}),i.readonly(t)}function uu(t,e){return i.computed(()=>{for(const n of e)if(t[n]!==void 0)return t[n];return t[e[e.length-1]]})}const jw=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function qw(){return jw}function ta(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);return r()}function na(t,e=!0,n=[]){return t.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&n.push(i.createTextVNode(String(r)));return}if(Array.isArray(r)){na(r,e,n);return}if(r.type===i.Fragment){if(r.children===null)return;Array.isArray(r.children)&&na(r.children,e,n)}else r.type!==i.Comment&&n.push(r)}}),n}function hu(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);const o=na(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${t}]: slot[${n}] should have exactly one child.`)}let Jn=null;function fu(){if(Jn===null&&(Jn=document.getElementById("v-binder-view-measurer"),Jn===null)){Jn=document.createElement("div"),Jn.id="v-binder-view-measurer";const{style:t}=Jn;t.position="fixed",t.left="0",t.right="0",t.top="0",t.bottom="0",t.pointerEvents="none",t.visibility="hidden",document.body.appendChild(Jn)}return Jn.getBoundingClientRect()}function Xw(t,e){const n=fu();return{top:e,left:t,height:0,width:0,right:n.width-t,bottom:n.height-e}}function ia(t){const e=t.getBoundingClientRect(),n=fu();return{left:e.left-n.left,top:e.top-n.top,bottom:n.height+n.top-e.bottom,right:n.width+n.left-e.right,width:e.width,height:e.height}}function Yw(t){return t.nodeType===9?null:t.parentNode}function mu(t){if(t===null)return null;const e=Yw(t);if(e===null)return null;if(e.nodeType===9)return document;if(e.nodeType===1){const{overflow:n,overflowX:r,overflowY:o}=getComputedStyle(e);if(/(auto|scroll|overlay)/.test(n+o+r))return e}return mu(e)}const gu=i.defineComponent({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(t){var e;i.provide("VBinder",(e=i.getCurrentInstance())===null||e===void 0?void 0:e.proxy);const n=i.inject("VBinder",null),r=i.ref(null),o=b=>{r.value=b,n&&t.syncTargetWithParent&&n.setTargetRef(b)};let s=[];const a=()=>{let b=r.value;for(;b=mu(b),b!==null;)s.push(b);for(const _ of s)Et("scroll",_,h,!0)},l=()=>{for(const b of s)at("scroll",b,h,!0);s=[]},c=new Set,d=b=>{c.size===0&&a(),c.has(b)||c.add(b)},u=b=>{c.has(b)&&c.delete(b),c.size===0&&l()},h=()=>{Jd(f)},f=()=>{c.forEach(b=>b())},g=new Set,m=b=>{g.size===0&&Et("resize",window,y),g.has(b)||g.add(b)},p=b=>{g.has(b)&&g.delete(b),g.size===0&&at("resize",window,y)},y=()=>{g.forEach(b=>b())};return i.onBeforeUnmount(()=>{at("resize",window,y),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:m,removeResizeListener:p}},render(){return ta("binder",this.$slots)}}),pu=i.defineComponent({name:"Target",setup(){const{setTargetRef:t,syncTarget:e}=i.inject("VBinder");return{syncTarget:e,setTargetDirective:{mounted:t,updated:t}}},render(){const{syncTarget:t,setTargetDirective:e}=this;return t?i.withDirectives(hu("follower",this.$slots),[[e]]):hu("follower",this.$slots)}}),Uw="@css-render/vue3-ssr";function Kw(t,e){return`<style cssr-id="${t}">
103
+ `}},so=Hi.Multiply,xp=[1,0,0,0,1,0,0,0,1],Gn=new hn(9),kp=yt.Utils,Ec=new re,Bs=new hn([0,0,1,0,0,1,0,1,1,0,1,1]),xe={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Xe.document?Xe.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new Hi,group:{removeChild:function(t,e){if(t.children)for(let n=0;n<t.children.length;n++)xe.group.removeChild(t.children[n],e);t._renderer.texture&&(e.deleteTexture(t._renderer.texture),delete t._renderer.texture),t._renderer.positionBuffer&&(e.deleteBuffer(t._renderer.positionBuffer),delete t._renderer.positionBuffer)},render:function(t,e){if(!this._visible)return;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.parent,r=n._matrix&&n._matrix.manual||n._flagMatrix,o=this._matrix.manual||this._flagMatrix;if((r||o)&&(this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Gn),so(Gn,n._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re),this._scale instanceof re?(this._renderer.scale.x=this._scale.x,this._renderer.scale.y=this._scale.y):(this._renderer.scale.x=this._scale,this._renderer.scale.y=this._scale),/renderer/i.test(n._renderer.type)||(this._renderer.scale.x*=n._renderer.scale.x,this._renderer.scale.y*=n._renderer.scale.y),r&&(this._flagMatrix=!0)),this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const a=yt.Utils.getRendererType(this._mask._renderer.type);xe[a].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}this._flagOpacity=n._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);let s;if(this._flagSubtractions)for(s=0;s<this.subtractions.length;s++)xe.group.removeChild(this.subtractions[s],t);for(s=0;s<this.children.length;s++){const a=this.children[s],l=yt.Utils.getRendererType(a._renderer.type);xe[l].render.call(a,t,e)}return this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(t,e){let n,r,o,s,a,l,c,d,u,h,f,g,m,p;const y=e._renderer.vertices,b=this.canvas,_=this.ctx,C=t.renderer.ratio,k=Ec.copy(e._renderer.scale).multiply(C),E=e._stroke,$=e._linewidth,x=e._fill,B=e._renderer.opacity||e._opacity,w=e._cap,T=e._join,N=e._miter,V=e._closed,R=e.dashes,I=y.length,W=I-1;b.width=Math.max(Math.ceil(e._renderer.rect.width*k.x),1),b.height=Math.max(Math.ceil(e._renderer.rect.height*k.y),1);const ee=e._renderer.rect.centroid,ne=ee.x,D=ee.y;if(_.clearRect(0,0,b.width,b.height),x)if(typeof x=="string")_.fillStyle=x;else{const Y=yt.Utils.getRendererType(x._renderer.type);xe[Y].render.call(x,_,e),_.fillStyle=x._renderer.effect}if(E){if(typeof E=="string")_.strokeStyle=E;else{const Y=yt.Utils.getRendererType(E._renderer.type);xe[Y].render.call(E,_,e),_.strokeStyle=E._renderer.effect}$&&(_.lineWidth=fn(e)),N&&(_.miterLimit=N),T&&(_.lineJoin=T),!V&&w&&(_.lineCap=w)}typeof B=="number"&&(_.globalAlpha=B),R&&R.length>0&&(_.lineDashOffset=R.offset||0,_.setLineDash(R));let H,L,A,z,U,K,F,q;_.save(),_.scale(k.x,k.y),_.translate(ne,D),_.beginPath();for(let Y=0;Y<y.length;Y++){const J=y[Y];switch(g=J.x,m=J.y,J.command){case oe.close:_.closePath();break;case oe.arc:L=J.rx,A=J.ry,z=J.xAxisRotation,U=J.largeArcFlag,K=J.sweepFlag,n=V?Dt(Y-1,I):Math.max(Y-1,0),r=y[n],F=r.x,q=r.y,kp.renderSvgArcCommand(_,F,q,L,A,U,K,z,g,m);break;case oe.curve:n=V?Dt(Y-1,I):Math.max(Y-1,0),r=y[n],d=r.controls&&r.controls.right||re.zero,u=J.controls&&J.controls.left||re.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),J._relative?(s=u.x+J.x,a=u.y+J.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,g,m),Y>=W&&V&&(o=H,h=J.controls&&J.controls.right||re.zero,f=o.controls&&o.controls.left||re.zero,J._relative?(l=h.x+J.x,c=h.y+J.y):(l=h.x,c=h.y),o._relative?(s=f.x+o.x,a=f.y+o.y):(s=f.x,a=f.y),g=o.x,m=o.y,_.bezierCurveTo(l,c,s,a,g,m));break;case oe.line:_.lineTo(g,m);break;case oe.move:H=J,_.moveTo(g,m);break}}V&&_.closePath(),xe.isHidden.test(x)||(p=x._renderer&&x._renderer.offset,p&&(_.save(),_.translate(-x._renderer.offset.x,-x._renderer.offset.y),_.scale(x._renderer.scale.x,x._renderer.scale.y)),_.fill(),p&&_.restore()),xe.isHidden.test(E)||(p=E._renderer&&E._renderer.offset,p&&(_.save(),_.translate(-E._renderer.offset.x,-E._renderer.offset.y),_.scale(E._renderer.scale.x,E._renderer.scale.y),_.lineWidth=$/E._renderer.scale.x),_.stroke(),p&&_.restore()),_.restore()},getBoundingClientRect:function(t,e,n){let r=1/0,o=-1/0,s=1/0,a=-1/0,l,c;t.forEach(function(d){const u=d.x,h=d.y,f=d.controls;let g,m,p,y,b,_;s=Math.min(h,s),r=Math.min(u,r),o=Math.max(u,o),a=Math.max(h,a),d.controls&&(b=f.left,_=f.right,!(!b||!_)&&(g=d._relative?b.x+u:b.x,m=d._relative?b.y+h:b.y,p=d._relative?_.x+u:_.x,y=d._relative?_.y+h:_.y,!(!g||!m||!p||!y)&&(s=Math.min(m,y,s),r=Math.min(g,p,r),o=Math.max(g,p,o),a=Math.max(m,y,a))))}),typeof e=="number"&&(s-=e,r-=e,o+=e,a+=e),l=o-r,c=a-s,n.top=s,n.left=r,n.right=o,n.bottom=a,n.width=l,n.height=c,n.centroid||(n.centroid={}),n.centroid.x=-r,n.centroid.y=-s},render:function(t,e,n){if(!this._visible||!this._opacity)return this;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,o=yt.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 Ye&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Oe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ye&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(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 hn(9)),this._matrix.toTransformArray(!0,Gn),so(Gn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let h,f;this._scale instanceof re?(h=this._scale.x*r._renderer.scale.x,f=this._scale.y*r._renderer.scale.y):(h=this._scale*r._renderer.scale.x,f=this._scale*r._renderer.scale.y),this._renderer.scale.x=h<0?-h:h,this._renderer.scale.y=f<0?-f:f,c&&(this._renderer.parent=r)}if(this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const h=yt.Utils.getRendererType(this._mask._renderer.type);xe[h].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}if(d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,xe.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),xe.updateTexture.call(xe,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==s&&(t.useProgram(s),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,Bs,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const u=this._renderer.rect;return t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform4f(s.rect,u.left,u.top,u.right,u.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(t,e){let n;const r=this.canvas,o=this.ctx,s=t.renderer.ratio,a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,h=e._size*s;let f=h;xe.isHidden.test(a)||(f+=l),r.width=_l(f),r.height=r.width;const g=f/r.width,m=r.width/2,p=r.height/2;if(o.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")o.fillStyle=c;else{const y=yt.Utils.getRendererType(c._renderer.type);xe[y].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const y=yt.Utils.getRendererType(a._renderer.type);xe[y].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=fn(e)/g)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(m,p),o.scale(xe.precision,xe.precision),o.beginPath(),o.arc(0,0,h/g*.5,0,gt),o.restore(),closed&&o.closePath(),xe.isHidden.test(c)||(n=c._renderer&&c._renderer.offset,n&&(o.save(),o.translate(-c._renderer.offset.x,-c._renderer.offset.y),o.scale(c._renderer.scale.x,c._renderer.scale.y)),o.fill(),n&&o.restore()),xe.isHidden.test(a)||(n=a._renderer&&a._renderer.offset,n&&(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(),n&&o.restore())},render:function(t,e,n){if(!this._visible||!this._opacity)return this;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const o=n||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,h=this._renderer.parent!==o,f=this._renderer.vertices,g=this._renderer.collection.length,m=this._flagVertices,p=this._flagFill||this._fill instanceof Ye&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Oe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ye&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(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||h){this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Gn),so(Gn,o._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let y,b;this._scale instanceof re?(y=this._scale.x*o._renderer.scale.x,b=this._scale.y*o._renderer.scale.y):(y=this._scale*o._renderer.scale.x,b=this._scale*o._renderer.scale.y),this._renderer.scale.x=y<0?-y:y,this._renderer.scale.y=b<0?-b:b,h&&(this._renderer.parent=o)}if(m){const y=this._renderer.positionBuffer;y&&t.deleteBuffer(y),this._renderer.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this._renderer.positionBuffer),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,f,t.STATIC_DRAW)}return p?(this._renderer.opacity=this._opacity*o._renderer.opacity,xe.updateTexture.call(xe,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture?this:(xe.isHidden.test(l)||(r+=c),r/=xe.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),e.current!==s&&(t.useProgram(s),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture),t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform1f(s.size,r*e.resolution.ratio),t.drawArrays(t.POINTS,0,g),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(t,e){const n=this.canvas,r=this.ctx,o=t.renderer.ratio,s=Ec.copy(e._renderer.scale).multiply(o),a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,h=e._decoration,f=e._direction;n.width=Math.max(Math.ceil(e._renderer.rect.width*s.x),1),n.height=Math.max(Math.ceil(e._renderer.rect.height*s.y),1);const g=e._renderer.rect.centroid,m=g.x,p=g.y;let y,b,_,C,k,E,$,x,B,w,T;const N=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,n.width,n.height),N||(r.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=f,c)if(typeof c=="string")r.fillStyle=c;else{const V=yt.Utils.getRendererType(c._renderer.type);xe[V].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const V=yt.Utils.getRendererType(a._renderer.type);xe[V].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=fn(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,p),xe.isHidden.test(c)||(c._renderer&&c._renderer.offset?(E=c._renderer.scale.x,$=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(E,$),y=e._size/c._renderer.scale.y,b=e._leading/c._renderer.scale.y,r.font=[e._style,e._weight,y+"px/",b+"px",e._family].join(" "),_=c._renderer.offset.x/c._renderer.scale.x,C=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,C),r.restore()):r.fillText(e.value,0,0)),xe.isHidden.test(a)||(a._renderer&&a._renderer.offset?(E=a._renderer.scale.x,$=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(E,$),y=e._size/a._renderer.scale.y,b=e._leading/a._renderer.scale.y,r.font=[e._style,e._weight,y+"px/",b+"px",e._family].join(" "),_=a._renderer.offset.x/a._renderer.scale.x,C=a._renderer.offset.y/a._renderer.scale.y,k=l/a._renderer.scale.x,r.lineWidth=k,r.strokeText(e.value,_,C),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(h)){const V=r.measureText(e.value);switch(h){case"underline":B=V.actualBoundingBoxDescent,T=V.actualBoundingBoxDescent;break;case"strikethrough":B=0,T=0;break}x=-V.width/2,w=V.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(x,B),r.lineTo(w,T),r.stroke()}r.restore()},getBoundingClientRect:function(t,e){const n=xe.ctx;n.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" "),n.textAlign="center",n.textBaseline=yt.Utils.baselines[t._baseline]||t._baseline;const r=n.measureText(t._value);let o=r.width,s=1.15*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent);this._linewidth&&!xe.isHidden.test(this._stroke)&&(o+=this._linewidth*2,s+=this._linewidth*2);const a=o/2,l=s/2;switch(xe.alignments[t._alignment]||t._alignment){case xe.alignments.left:t.direction==="ltr"?(e.left=0,e.right=o):(e.left=-o,e.right=0);break;case xe.alignments.right:t.direction==="ltr"?(e.left=-o,e.right=0):(e.left=0,e.right=o);break;default:e.left=-a,e.right=a}switch(t._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(t,e,n){if(!this._visible||!this._opacity)return this;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||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 Ye&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Oe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ye&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(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 hn(9)),this._matrix.toTransformArray(!0,Gn),so(Gn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let u,h;this._scale instanceof re?(u=this._scale.x*r._renderer.scale.x,h=this._scale.y*r._renderer.scale.y):(u=this._scale*r._renderer.scale.x,h=this._scale*r._renderer.scale.y),this._renderer.scale.x=u<0?-u:u,this._renderer.scale.y=h<0?-h:h,l&&(this._renderer.parent=r)}if(this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const u=yt.Utils.getRendererType(this._mask._renderer.type);xe[u].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}if(c?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,xe.text.getBoundingClientRect(this,this._renderer.rect),xe.updateTexture.call(xe,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==o&&(t.useProgram(o),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(o.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o.position),t.bufferData(t.ARRAY_BUFFER,Bs,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return t.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),t.uniform4f(o.rect,d.left,d.top,d.right,d.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let n,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(n=e.getBoundingClientRect(!0),r=(r-.5)*n.width,o=(o-.5)*n.height,s=(s-.5)*n.width,a=(a-.5)*n.height),this._renderer.effect=t.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let n,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(n=e.getBoundingClientRect(!0),r=(r-.5)*n.width*.5,o=(o-.5)*n.height*.5,s=(s-.5)*n.width*.5,a=(a-.5)*n.height*.5,l*=Math.min(n.width,n.height)),this._renderer.effect=t.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(t,e){if(!t.canvas.getContext("2d"))return;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=t.createPattern(n,this._repeat);else if(!this._renderer.effect)return this.flagReset();if((this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof re||(this._renderer.offset=new re),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,n&&(this._renderer.offset.x+=n.width/2,this._renderer.offset.y+=n.height/2,this._scale instanceof re?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),this._flagScale||this._flagLoaded){this._renderer.scale instanceof re||(this._renderer.scale=new re);let r,o;this._scale instanceof re?(r=this._scale.x,o=this._scale.y):(r=this._scale,o=this._scale),this._renderer.scale.x=r<0?-r:r,this._renderer.scale.y=o<0?-o:o}return ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(t,e){const n=yt.Utils.getRendererType(e._renderer.type);if(this[n].updateCanvas.call(xe,t,e),this.canvas.width<=0||this.canvas.height<=0){e._renderer.texture&&t.deleteTexture(e._renderer.texture),delete e._renderer.texture;return}e._renderer.texture||(e._renderer.texture=t.createTexture()),t.bindTexture(t.TEXTURE_2D,e._renderer.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.canvas),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR)},program:{create:function(t,e){let n,r,o;if(n=t.createProgram(),ie.each(e,function(s){t.attachShader(n,s)}),t.linkProgram(n),r=t.getProgramParameter(n,t.LINK_STATUS),!r)throw o=t.getProgramInfoLog(n),t.deleteProgram(n),new Mt("unable to link program: "+o);return n}},extensions:{init:function(t){const e={},n=["EXT_texture_filter_anisotropic","WEBGL_compressed_texture_s3tc","OES_texture_float_linear","WEBGL_multisampled_render_to_texture"];for(let r=0;r<n.length;r++){const o=n[r];e[o]=xe.extensions.get(t,o)}return e},get:function(t,e){return t.getExtension(e)||t.getExtension(`MOZ_${e}`)||t.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new qr};xe.ctx=xe.canvas.getContext("2d");var Rc=class extends Z{constructor(t){super();let e,n,r,o;if(this.domElement=t.domElement||document.createElement("canvas"),typeof t.offscreenElement<"u"&&(xe.canvas=t.offscreenElement,xe.ctx=xe.canvas.getContext("2d")),this.scene=new ct,this.scene.parent=this,this._renderer={type:"renderer",matrix:new hn(xp),scale:1,opacity:1},this._flagMatrix=!0,t=ie.defaults(t||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=t.overdraw,e=this.ctx=this.domElement.getContext("webgl",t)||this.domElement.getContext("experimental-webgl",t),!this.ctx)throw new Mt("unable to create a webgl context. Try using another renderer.");r=Kt.create(e,Kt.path.vertex,Kt.types.vertex),o=Kt.create(e,Kt.path.fragment,Kt.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},n=this.programs.path=xe.program.create(e,[r,o]),this.programs.text=this.programs.path,e.extensions=xe.extensions.init(e),e.renderer=this,n.position=e.getAttribLocation(n,"a_position"),n.matrix=e.getUniformLocation(n,"u_matrix"),n.rect=e.getUniformLocation(n,"u_rect");const s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(n.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n.position),e.bufferData(e.ARRAY_BUFFER,Bs,e.STATIC_DRAW),r=Kt.create(e,Kt.points.vertex,Kt.types.vertex),o=Kt.create(e,Kt.points.fragment,Kt.types.fragment),n=this.programs.points=xe.program.create(e,[r,o]),n.position=e.getAttribLocation(n,"a_position"),n.matrix=e.getUniformLocation(n,"u_matrix"),n.size=e.getUniformLocation(n,"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(t,e,n){let r,o;const s=this.ctx;return this.width=t,this.height=e,this.ratio=typeof n>"u"?ns(s):n,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,ie.isObject(this.domElement.style)&&ie.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=t*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(Z.Types.resize,t,e,n)}render(){const t=this.ctx;return this.overdraw||t.clear(t.COLOR_BUFFER_BIT),xe.group.render.call(this.scene,t,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};v(Rc,"Utils",xe);var vp=ie.extend({Error:Mt,getRatio:ns,read:qe,xhr:Cc},ie,Bt,gl,pl),Ce=class Dr{constructor(e){v(this,"_events",new Z),v(this,"type",""),v(this,"renderer",null),v(this,"scene",null),v(this,"width",0),v(this,"height",0),v(this,"frameCount",0),v(this,"timeDelta",0),v(this,"playing",!1);const n=ie.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:Dr.Types.svg,autostart:!1});if(ie.each(n,function(r,o){/fullscreen/i.test(o)||/autostart/i.test(o)||(this[o]=r)},this),ie.isElement(n.domElement)){const r=n.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=Dr.Types[r])}this.renderer=new Dr[this.type](this),this.setPlaying(n.autostart),this.frameCount=0,n.fullscreen?(this.fit=Cp.bind(this),this.fit.domElement=window,this.fit.attached=!0,ie.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),ie.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),Lt.bind(this.fit.domElement,"resize",this.fit),this.fit()):n.fitted?(this.fit=Sp.bind(this),ie.extend(this.renderer.domElement.style,{display:"block"})):typeof n.width=="number"&&typeof n.height=="number"&&(this.renderer.setSize(n.width,n.height,this.ratio),this.width=n.width,this.height=n.height),this.renderer.bind(Z.Types.resize,Bp.bind(this)),this.scene=this.renderer.scene,Dr.Instances.push(this),n.autostart&&gr.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){return this._events.addEventListener.apply(this,arguments)}on(){return this._events.addEventListener.apply(this,arguments)}bind(){return this._events.addEventListener.apply(this,arguments)}removeEventListener(){return this._events.removeEventListener.apply(this,arguments)}off(){return this._events.removeEventListener.apply(this,arguments)}unbind(){return this._events.removeEventListener.apply(this,arguments)}dispatchEvent(){return this._events.dispatchEvent.apply(this,arguments)}trigger(){return this._events.dispatchEvent.apply(this,arguments)}listen(){return this._events.listen.apply(this,arguments)}ignore(){return this._events.ignore.apply(this,arguments)}appendTo(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,gr.init(),this.trigger(Z.Types.play)}pause(){return this.playing=!1,this.trigger(Z.Types.pause)}setPlaying(e){this.playing=e}release(e){let n,r,o;if(typeof e>"u")return this.release(this.scene);if(typeof e.unbind=="function"&&e.unbind(),typeof e.fill=="object"&&"unbind"in e.fill&&e.fill.unbind(),typeof e.stroke=="object"&&"unbind"in e.stroke&&e.stroke.unbind(),e.vertices){if(typeof e.vertices.unbind=="function")try{e.vertices.unbind()}catch{}for(n=0;n<e.vertices.length;n++)r=e.vertices[n],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(n=0;n<e.children.length;n++)o=e.children[n],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}update(){const e=!!this._lastFrame,n=ie.performance.now();e&&(this.timeDelta=parseFloat((n-this._lastFrame).toFixed(3))),this._lastFrame=n,this.fit&&this.fit.domElement&&!this.fit.attached&&(Lt.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(Z.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(Z.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,n,r,o){const s=new to(e,n,r,o);return this.scene.add(s),s}makeArrow(e,n,r,o,s){const a=typeof s=="number"?s:10,l=Math.atan2(o-n,r-e),c=[new Be(e,n,void 0,void 0,void 0,void 0,oe.move),new Be(r,o,void 0,void 0,void 0,void 0,oe.line),new Be(r-a*Math.cos(l-Math.PI/4),o-a*Math.sin(l-Math.PI/4),void 0,void 0,void 0,void 0,oe.line),new Be(r,o,void 0,void 0,void 0,void 0,oe.move),new Be(r-a*Math.cos(l+Math.PI/4),o-a*Math.sin(l+Math.PI/4),void 0,void 0,void 0,void 0,oe.line)],d=new $e(c,!1,!1,!0);return d.noFill(),d.cap="round",d.join="round",this.scene.add(d),d}makeRectangle(e,n,r,o){const s=new Kn(e,n,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,n,r,o,s){const a=new Qr(e,n,r,o,s);return this.scene.add(a),a}makeCircle(e,n,r,o){const s=new Gr(e,n,r,o);return this.scene.add(s),s}makeEllipse(e,n,r,o,s){const a=new Zr(e,n,r,o,s);return this.scene.add(a),a}makeStar(e,n,r,o,s){const a=new ys(e,n,r,o,s);return this.scene.add(a),a}makeCurve(e){const n=arguments.length;if(!Array.isArray(e)){e=[];for(let a=0;a<n;a+=2){const l=arguments[a];if(typeof l!="number")break;const c=arguments[a+1];e.push(new Be(l,c))}}const r=arguments[n-1],o=new $e(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,n,r,o){const s=new ps(e,n,r,o);return this.scene.add(s),s}makeArcSegment(e,n,r,o,s,a,l){const c=new ds(e,n,r,o,s,a,l);return this.scene.add(c),c}makePoints(e){const n=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let s=0;s<n;s+=2){const a=arguments[s];if(typeof a!="number")break;const l=arguments[s+1];r.push(new re(a,l))}}const o=new gs(r);return this.scene.add(o),o}makePath(e){const n=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let l=0;l<n;l+=2){const c=arguments[l];if(typeof c!="number")break;const d=arguments[l+1];r.push(new Be(c,d))}}const o=arguments[n-1],s=new $e(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,n,r,o){const s=new mn(e,n,r,o);return this.add(s),s}makeLinearGradient(e,n,r,o){const s=Array.prototype.slice.call(arguments,4),a=new Ye(e,n,r,o,s);return this.add(a),a}makeRadialGradient(e,n,r){const o=Array.prototype.slice.call(arguments,3),s=new Ue(e,n,r,o);return this.add(s),s}makeSprite(e,n,r,o,s,a,l){const c=new Kr(e,n,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,n,r,o,s,a){const l=new Sc(e,n,r,o,s,a);return this.add(l),l}makeImageSequence(e,n,r,o,s){const a=new xs(e,n,r,o);return s&&a.play(),this.add(a),a}makeTexture(e,n){return new Oe(e,n)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const n=new ct;return this.scene.add(n),n.add(e),n}interpret(e,n,r){const o=e.tagName.toLowerCase();if(r=typeof r<"u"?r:!0,!(o in qe))return null;const s=qe[o].call(this,e);return r?this.add(n&&s instanceof ct?s.children:s):s.parent&&s.remove(),s}load(e,n){const r=new ct;let o,s,a;const l=(function(c){for(Lt.temp.innerHTML=c,s=0;s<Lt.temp.children.length;s++)o=Lt.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof n=="function"){const d=Lt.temp.children.length<=1?Lt.temp.children[0]:Lt.temp.children;n(r,d)}}).bind(this);return/\.svg$/i.test(e)?(Cc(e,l),r):(l(e),r)}};v(Ce,"NextFrameId",Tt.NextFrameId),v(Ce,"Types",Tt.Types),v(Ce,"Version",Tt.Version),v(Ce,"PublishDate",Tt.PublishDate),v(Ce,"Identifier",Tt.Identifier),v(Ce,"Resolution",Tt.Resolution),v(Ce,"AutoCalculateImportedMatrices",Tt.AutoCalculateImportedMatrices),v(Ce,"Instances",Tt.Instances),v(Ce,"uniqueId",Tt.uniqueId),v(Ce,"Anchor",Be),v(Ce,"Collection",Xn),v(Ce,"Events",Z),v(Ce,"Group",ct),v(Ce,"Matrix",Hi),v(Ce,"Path",$e),v(Ce,"Registry",qr),v(Ce,"Element",Li),v(Ce,"Shape",Un),v(Ce,"Text",mn),v(Ce,"Vector",re),v(Ce,"Gradient",ot),v(Ce,"Image",Sc),v(Ce,"ImageSequence",xs),v(Ce,"LinearGradient",Ye),v(Ce,"RadialGradient",Ue),v(Ce,"Sprite",Kr),v(Ce,"Stop",Yn),v(Ce,"Texture",Oe),v(Ce,"ArcSegment",ds),v(Ce,"Circle",Gr),v(Ce,"Ellipse",Zr),v(Ce,"Line",to),v(Ce,"Points",gs),v(Ce,"Polygon",ps),v(Ce,"Rectangle",Kn),v(Ce,"RoundedRectangle",Qr),v(Ce,"Star",ys),v(Ce,"CanvasRenderer",yt),v(Ce,"SVGRenderer",$c),v(Ce,"WebGLRenderer",Rc),v(Ce,"Commands",oe),v(Ce,"Utils",vp);var pn=Ce;function Cp(){const t=document.body.getBoundingClientRect(),e=this.width=t.width,n=this.height=t.height;this.renderer.setSize(e,n,this.ratio)}function Sp(){const t=this.renderer.domElement.parentElement;if(!t){console.warn("Two.js: Attempting to fit to parent, but no parent found.");return}const e=t.getBoundingClientRect(),n=this.width=e.width,r=this.height=e.height;this.renderer.setSize(n,r,this.ratio)}function Bp(t,e){this.width=t,this.height=e,this.trigger(Z.Types.resize,t,e)}var gr=Lt.getRequestAnimationFrame();function Pc(){for(let t=0;t<pn.Instances.length;t++){const e=pn.Instances[t];e.playing&&e.update()}pn.NextFrameId=gr(Pc)}gr.init=function(){Pc(),gr.init=function(){}};let yn;typeof window<"u"?yn=window:typeof global<"u"?yn=global:typeof self<"u"&&(yn=self);let Fc;const ui=Math.PI*2,dt=Math.PI*.5;function Tp(t,e,n,r,o,s){let a;return arguments.length<=1?(a=t.a,e=t.b,n=t.c,r=t.d,o=t.e,s=t.f):a=t,{translateX:o,translateY:s,scaleX:Math.sqrt(a*a+e*e),scaleY:Math.sqrt(n*n+r*r),rotation:180*Math.atan2(e,a)/Math.PI}}function Np(t){Fc=t}function $p(t,e){e=e&&e.identity()||new Fc;let n=t;const r=[];for(;n&&n._matrix;)r.push(n._matrix),n=n.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Gt(t,e,n){return n*(e-t)+t}function qi(t,e){for(;t<0;)t+=e;return t%e}const Vc=yn.Float32Array||Array,Ep=Math.floor;function bn(t){return Ep(t*1e6)/1e6}const pe={move:"M",line:"L",curve:"C",close:"Z"};class te{constructor(){S(this,"_events",{});S(this,"_bound",!1)}addEventListener(e,n){return(this._events[e]||(this._events[e]=[])).push(n),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,n){if(!this._events)return this;if(!e&&!n)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(n)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,n!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const n=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...n);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,n,r){const o=this;e&&(s.obj=e,s.name=n,s.handler=r,e.on(n,s));function s(){r.apply(o,arguments)}return o}ignore(e,n,r){return e.off(n,r),this}}S(te,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),S(te,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Ic={x:{enumerable:!0,get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this._bound&&this.dispatchEvent(te.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this._bound&&this.dispatchEvent(te.Types.change))}}},ht=class ht extends te{constructor(n=0,r=0){super();S(this,"_x",0);S(this,"_y",0);for(let o in Ic)Object.defineProperty(this,o,Ic[o]);this.x=n,this.y=r}static add(n,r){return new ht(n.x+r.x,n.y+r.y)}static sub(n,r){return new ht(n.x-r.x,n.y-r.y)}static subtract(n,r){return ht.sub(n,r)}static ratioBetween(n,r){return(n.x*r.x+n.y*r.y)/(n.length()*r.length())}static angleBetween(n,r){if(arguments.length>=4){const a=arguments[0]-arguments[2],l=arguments[1]-arguments[3];return Math.atan2(l,a)}const o=n.x-r.x,s=n.y-r.y;return Math.atan2(s,o)}static distanceBetween(n,r){return Math.sqrt(ht.distanceBetweenSquared(n,r))}static distanceBetweenSquared(n,r){const o=n.x-r.x,s=n.y-r.y;return o*o+s*s}set(n,r){return this.x=n,this.y=r,this}copy(n){return this.x=n.x,this.y=n.y,this}clear(){return this.x=0,this.y=0,this}clone(){return new ht(this.x,this.y)}add(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x+=n,this.y+=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x+=n.x,this.y+=n.y):(this.x+=n,this.y+=r),this)}addSelf(n){return this.add.apply(this,arguments)}sub(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x-=n,this.y-=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x-=n.x,this.y-=n.y):(this.x-=n,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(n){return this.sub.apply(this,arguments)}subtractSelf(n){return this.sub.apply(this,arguments)}multiply(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x*=n,this.y*=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x*=n.x,this.y*=n.y):(this.x*=n,this.y*=r),this)}multiplySelf(n){return this.multiply.apply(this,arguments)}multiplyScalar(n){return this.multiply(n)}divide(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x/=n,this.y/=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x/=n.x,this.y/=n.y):(this.x/=n,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(n){return this.divide.apply(this,arguments)}divideScalar(n){return this.divide(n)}negate(){return this.multiply(-1)}dot(n){return this.x*n.x+this.y*n.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(n){return Math.sqrt(this.distanceToSquared(n))}distanceToSquared(n){const r=this.x-n.x,o=this.y-n.y;return r*r+o*o}setLength(n){return this.normalize().multiplyScalar(n)}equals(n,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(n)<r}lerp(n,r){const o=(n.x-this.x)*r+this.x,s=(n.y-this.y)*r+this.y;return this.set(o,s)}isZero(n){return n=typeof n>"u"?1e-4:n,this.length()<n}toString(){return this.x+", "+this.y}toObject(){return{x:bn(this.x),y:bn(this.y)}}rotate(n){const r=this.x,o=this.y,s=Math.cos(n),a=Math.sin(n);return this.x=r*s-o*a,this.y=r*a+o*s,this}};S(ht,"zero",new ht),S(ht,"left",new ht(-1,0)),S(ht,"right",new ht(1,0)),S(ht,"up",new ht(0,-1)),S(ht,"down",new ht(0,1));let be=ht;class Fe extends be{constructor(n=0,r=0,o=0,s=0,a=0,l=0,c=pe.move){super(n,r);S(this,"controls",{left:new be,right:new be});S(this,"_command",pe.move);S(this,"_relative",!0);S(this,"_rx",0);S(this,"_ry",0);S(this,"_xAxisRotation",0);S(this,"_largeArcFlag",0);S(this,"_sweepFlag",1);for(let u in Mc)Object.defineProperty(this,u,Mc[u]);this.command=c,this.relative=!0;const d=Fe.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(n){return r;function r(){n._bound&&n.dispatchEvent(te.Types.change)}}static fromObject(n){return new Fe().copy(n)}copy(n){return this.x=n.x,this.y=n.y,typeof n.command=="string"&&(this.command=n.command),n.controls&&(n.controls.left&&this.controls.left.copy(n.controls.left),n.controls.right&&this.controls.right.copy(n.controls.right)),typeof n.relative=="boolean"&&(this.relative=n.relative),typeof n.rx=="number"&&(this.rx=n.rx),typeof n.ry=="number"&&(this.ry=n.ry),typeof n.xAxisRotation=="number"&&(this.xAxisRotation=n.xAxisRotation),typeof n.largeArcFlag=="number"&&(this.largeArcFlag=n.largeArcFlag),typeof n.sweepFlag=="number"&&(this.sweepFlag=n.sweepFlag),this}clone(){return new Fe().copy(this)}toObject(){return{x:bn(this.x),y:bn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:bn(this.rx),ry:bn(this.ry),xAxisRotation:bn(this.xAxisRotation),largeArcFlag:bn(this.largeArcFlag),sweepFlag:bn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const Mc={command:{enumerable:!0,get:function(){return this._command},set:function(t){this._command!==t&&(this._command=t,this._bound&&this.dispatchEvent(te.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(t){this._relative!==!!t&&(this._relative=!!t,this._bound&&this.dispatchEvent(te.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(t){this._rx!==t&&(this._rx=t,this._bound&&this.dispatchEvent(te.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(t){this._ry!==t&&(this._ry=t,this._bound&&this.dispatchEvent(te.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(t){this._xAxisRotation!==t&&(this._xAxisRotation=t,this._bound&&this.dispatchEvent(te.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(t){this._largeArcFlag!==t&&(this._largeArcFlag=t,this._bound&&this.dispatchEvent(te.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(t){this._sweepFlag!==t&&(this._sweepFlag=t,this._bound&&this.dispatchEvent(te.Types.change))}}};let Rp=0;const Ts={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return Rp++}},ao={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 lo(t,e,n,r,o){const s=1-t;return s*s*s*e+3*s*s*t*n+3*s*t*t*r+t*t*t*o}function Ac(t,e,n,r,o,s,a,l,c){c=c||ao.RecursionLimit;const d=c+1;if(Math.abs(t-a)<.001&&Math.abs(e-l)<.001)return[new Fe(a,l)];const u=[];for(let h=0;h<d;h++){const f=h/d,g=lo(f,t,n,o,a),m=lo(f,e,r,s,l);u.push(new Fe(g,m))}return u}function Pp(t,e,n,r,o,s,a,l,c){if(t===n&&e===r&&o===a&&s===l){const y=a-t,b=l-e;return Math.sqrt(y*y+b*b)}const d=9*(n-o)+3*(a-t),u=6*(t+o)-12*n,h=3*(n-t),f=9*(r-s)+3*(l-e),g=6*(e+s)-12*r,m=3*(r-e);function p(y){const b=(d*y+u)*y+h,_=(f*y+g)*y+m;return Math.sqrt(b*b+_*_)}return Vp(p,0,1,c||ao.RecursionLimit)}function Fp(t,e,n,r,o,s,a,l){const c=[],d=[[],[]];let u,h,f,g,m,p,y,b;for(let E=0;E<2;++E){if(E===0?(h=6*t-12*n+6*o,u=-3*t+9*n-9*o+3*a,f=3*n-3*t):(h=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,f=3*r-3*e),Math.abs(u)<.001){if(Math.abs(h)<.001)continue;g=-f/h,0<g&&g<1&&c.push(g);continue}y=h*h-4*f*u,b=Math.sqrt(y),!(y<0)&&(m=(-h+b)/(2*u),0<m&&m<1&&c.push(m),p=(-h-b)/(2*u),0<p&&p<1&&c.push(p))}let _=c.length,C=_,k;for(;_--;)g=c[_],k=1-g,d[0][_]=k*k*k*t+3*k*k*g*n+3*k*g*g*o+g*g*g*a,d[1][_]=k*k*k*e+3*k*k*g*r+3*k*g*g*s+g*g*g*l;return d[0][C]=t,d[1][C]=e,d[0][C+1]=a,d[1][C+1]=l,d[0].length=d[1].length=C+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 Vp(t,e,n,r){let o=ao.abscissas[r-2],s=ao.weights[r-2],a=.5*(n-e),l=a+e,c=0,d=r+1>>1,u=r&1?s[c++]*t(l):0;for(;c<d;){const h=a*o[c];u+=s[c++]*(t(l+h)+t(l-h))}return a*u}function Ip(t,e){const n=t.length,r=n-1;for(let o=0;o<n;o++){const s=t[o],a=e?qi(o-1,n):Math.max(o-1,0),l=e?qi(o+1,n):Math.min(o+1,r),c=t[a],d=s,u=t[l];Mp(c,d,u),d.command=o===0?pe.move:pe.curve}}function Mp(t,e,n){const r=be.angleBetween(t,e),o=be.angleBetween(n,e);let s=be.distanceBetween(t,e),a=be.distanceBetween(n,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=dt:l-=dt,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 pr=(Ti=class extends te{constructor(){super();S(this,"_flagId",!1);S(this,"_flagClassName",!1);S(this,"_renderer",{});S(this,"_id",Ts.Identifier+Ts.uniqueId());S(this,"_className","");S(this,"classList",[]);for(let n in Oc)Object.defineProperty(this,n,Oc[n])}static fromObject(n){const r=new Ti().copy(n);return"id"in n&&(r.id=n.id),r}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(n){return n.renderer&&typeof n.renderer.type=="string"&&(this.renderer.type=n.renderer.type),typeof n.className=="string"&&(this.className=n.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){const n=this._renderer.type;return this._renderer={type:n},typeof this.unbind=="function"&&this.unbind(),this}},S(Ti,"Properties",["renderer","id","className"]),Ti);const Oc={renderer:{enumerable:!1,get:function(){return this._renderer}},id:{enumerable:!0,get:function(){return this._id},set:function(t){const e=this._id;t!==this._id&&(this._id=t,this._flagId=!0,this.parent&&(delete this.parent.children.ids[e],this.parent.children.ids[this._id]=this))}},className:{enumerable:!0,get:function(){return this._className},set:function(t){this._className!==t&&(this._flagClassName=!0,this.classList=t.split(/\s+?/),this._className=t)}}};class co extends Error{constructor(n){super();S(this,"name","Two.js");S(this,"message");this.message=n}}class Ap{constructor(){S(this,"map",{})}add(e,n){return this.map[e]=n,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}}let uo;const zc={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};yn.document&&(uo=document.createElement("a"));const Ge=class Ge extends pr{constructor(n,r){super();S(this,"_flagSrc",!1);S(this,"_flagImage",!1);S(this,"_flagVideo",!1);S(this,"_flagLoaded",!1);S(this,"_flagRepeat",!1);S(this,"_flagOffset",!1);S(this,"_flagScale",!1);S(this,"_src","");S(this,"_image",null);S(this,"_loaded",!1);S(this,"_repeat","no-repeat");S(this,"_scale",1);S(this,"_offset",null);for(let o in Dc)Object.defineProperty(this,o,Dc[o]);if(this._renderer.type="texture",this._renderer.flagOffset=Op.bind(this),this._renderer.flagScale=zp.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 n=="string")this.src=n;else if(typeof n=="object"){const o=Object.prototype.toString.call(n);(o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]"||o==="[object HTMLVideoElement]"||o==="[object Image]")&&(this.image=n)}this._update()}fromObject(n){const r=new Ge().copy(n);return"id"in n&&(r.id=n.id),r}static getAbsoluteURL(n){return uo?(uo.href=n,uo.href):n}static loadHeadlessBuffer(n,r){n.image.onload=r,n.image.src=n.src}static getTag(n){return n&&n.nodeName&&n.nodeName.toLowerCase()||"img"}static getImage(n){const r=Ge.getAbsoluteURL(n);if(Ge.ImageRegistry.contains(r))return Ge.ImageRegistry.get(r);let o;return yn.document?zc.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(n,r){let o=n.image,s=Ge.getTag(o);n._flagImage&&(/canvas/i.test(s)?Ge.Register.canvas(n,r):(n._src=o.getAttribute("two-src")||o.src,Ge.Register[s](n,r))),n._flagSrc&&(o||(o=Ge.getImage(n.src),n.image=o),s=Ge.getTag(o),Ge.Register[s](n,r))}clone(){const n=new Ge(this.src);return n.repeat=this.repeat,n.offset.copy(this.offset),n.scale=this.scale,n}copy(n){return this.src=n.src,this.repeat=n.repeat,this.offset=typeof n.offset=="number"||n.offset instanceof be?n.offset:new be().copy(n.offset),this.scale=typeof n.scale=="number"||n.scale instanceof be?n.scale:new be().copy(n.scale),this}toObject(){const n=super.toObject.call(this);return n.renderer.type="texture",n.src=this.src,n.repeat=this.repeat,n.offset=this.offset.toObject(),n.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),n}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(te.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Ge.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 n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(Ge,"Properties",["src","loaded","repeat","scale","offset","image"]),S(Ge,"RegularExpressions",zc),S(Ge,"ImageRegistry",new Ap),S(Ge,"Register",{canvas:function(n,r){n._src="#"+n.id,Ge.ImageRegistry.add(n.src,n.image),typeof r=="function"&&r()},img:function(n,r){const o=n.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 co("unable to load "+n.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)),n._src=Ge.getAbsoluteURL(n._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",n.src),Ge.ImageRegistry.add(n.src,o),n.image.src=n.src)},video:function(n,r){const o=function(a){n.image.removeEventListener("canplaythrough",o,!1),n.image.removeEventListener("error",s,!1),n.image.width=n.image.videoWidth,n.image.height=n.image.videoHeight,typeof r=="function"&&r()},s=function(a){throw n.image.removeEventListener("canplaythrough",o,!1),n.image.removeEventListener("error",s,!1),new co("unable to load "+n.src)};n._src=Ge.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),Ge.ImageRegistry.add(n.src,n.image)),n.image.readyState>=4?o():(n.image.addEventListener("canplaythrough",o,!1),n.image.addEventListener("error",s,!1),n.image.src=n.src,n.image.load())}});let Ke=Ge;const Dc={src:{enumerable:!0,get:function(){return this._src},set:function(t){this._src=t,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(t){this._loaded=t,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(t){this._repeat=t,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(t){const e=Ke.getTag(t);let n;switch(e){case"canvas":n="#"+t.id;break;default:n=t.src}Ke.ImageRegistry.contains(n)?this._image=Ke.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset&&this._offset.unbind(te.Types.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(te.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof be&&this._scale.unbind(te.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof be&&this._scale.bind(te.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Op(){this._flagOffset=!0}function zp(){this._flagScale=!0}class hi extends Array{constructor(){super();Ya(this,ft,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 Ft(this,ft)}set _events(n){nf(this,ft,n)}get _bound(){return Ft(this,ft)._bound}set _bound(n){Ft(this,ft)._bound=n}addEventListener(){return Ft(this,ft).addEventListener.apply(this,arguments)}on(){return Ft(this,ft).on.apply(this,arguments)}bind(){return Ft(this,ft).bind.apply(this,arguments)}removeEventListener(){return Ft(this,ft).removeEventListener.apply(this,arguments)}off(){return Ft(this,ft).off.apply(this,arguments)}unbind(){return Ft(this,ft).unbind.apply(this,arguments)}dispatchEvent(){return Ft(this,ft).dispatchEvent.apply(this,arguments)}trigger(){return Ft(this,ft).trigger.apply(this,arguments)}listen(){return Ft(this,ft).listen.apply(this,arguments)}ignore(){return Ft(this,ft).ignore.apply(this,arguments)}pop(){const n=super.pop.apply(this,arguments);return this.trigger(te.Types.remove,[n]),n}shift(){const n=super.shift.apply(this,arguments);return this.trigger(te.Types.remove,[n]),n}push(){const n=super.push.apply(this,arguments);return this.trigger(te.Types.insert,arguments),n}unshift(){const n=super.unshift.apply(this,arguments);return this.trigger(te.Types.insert,arguments),n}splice(){const n=super.splice.apply(this,arguments);if(this.trigger(te.Types.remove,n),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 n}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(n,r){const o=[];for(let s=0;s<this.length;s++){const a=this[s];let l;r?l=n.call(r,a,s):l=n(a,s),o.push(l)}return o}}ft=new WeakMap;const Lc=Array.prototype.slice;function Dp(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}const Ie={isNaN:function(t){return typeof t=="number"&&t!==+t},isElement:function(t){return!!(t&&t.nodeType===1)},isObject:function(t){const e=typeof t;return e==="function"||e==="object"&&!!t},isFunction:function(t){return typeof t=="function"},extend:function(t){const e=Lc.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let o in r)t[o]=r[o]}return t},defaults:function(t){const e=Lc.call(arguments,1);for(let n=0;n<e.length;n++){const r=e[n];for(let o in r)t[o]===void 0&&(t[o]=r[o])}return t},each:function(t,e,n){const r=n||this,o=!Dp(t)&&Object.keys(t),s=(o||t).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,t[l],l,t)}return t},performance:yn.performance&&yn.performance.now?yn.performance:Date},Ot=class Ot extends pr{constructor(n,r,o){super();S(this,"_flagOffset",!0);S(this,"_flagOpacity",!0);S(this,"_flagColor",!0);S(this,"_offset",0);S(this,"_opacity",1);S(this,"_color","#fff");for(let s in Hc)Object.defineProperty(this,s,Hc[s]);this._renderer.type="stop",this.offset=typeof n=="number"?n:Ot.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:Ot.Index<=0?"#fff":"#000",Ot.Index=(Ot.Index+1)%2}static fromObject(n){const r=new Ot().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Ot.Properties.length;r++){const o=Ot.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Ot;return Ie.each(Ot.Properties,function(o){r[o]=this[o]},this),n&&n.stops&&n.stops.push(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="stop",Ie.each(Ot.Properties,r=>{n[r]=this[r]},this),n}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};S(Ot,"Index",0),S(Ot,"Properties",["offset","opacity","color"]);let fi=Ot;const Hc={offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},vn=class vn extends pr{constructor(n){super();S(this,"_flagStops",!1);S(this,"_flagSpread",!1);S(this,"_flagUnits",!1);S(this,"_spread","");S(this,"_units","");for(let r in Wc)Object.defineProperty(this,r,Wc[r]);this._renderer.type="gradient",this._renderer.flagStops=Lp.bind(this),this._renderer.bindStops=Hp.bind(this),this._renderer.unbindStops=Wp.bind(this),this.spread="pad",this.units="objectBoundingBox",n&&(this.stops=n)}static fromObject(n){let r=n.stops;r&&r.length>0&&(r=r.map(s=>s instanceof fi?s:new fi().copy(s)));const o=new vn(r).copy(n);return"id"in n&&(o.id=n.id),o}clone(n){const r=this.stops.map(s=>s.clone()),o=new vn(r);return Ie.each(vn.Properties,s=>{o[s]=this[s]},this),n&&n.add(o),o}copy(n){super.copy.call(this,n);for(let r=0;r<vn.Properties.length;r++){const o=vn.Properties[r];o in n&&(this[o]=n[o])}return this}toObject(){const n={stops:this.stops.map(r=>r.toObject())};return Ie.each(vn.Properties,r=>{n[r]=this[r]},this),n}_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 n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(vn,"Stop",fi),S(vn,"Properties",["spread","stops","units"]);let st=vn;const Wc={spread:{enumerable:!0,get:function(){return this._spread},set:function(t){this._spread=t,this._flagSpread=!0}},units:{enumerable:!0,get:function(){return this._units},set:function(t){this._units=t,this._flagUnits=!0}},stops:{enumerable:!0,get:function(){return this._stops},set:function(t){const e=this._renderer.bindStops,n=this._renderer.unbindStops;this._stops&&this._stops.unbind(te.Types.insert,e).unbind(te.Types.remove,n),this._stops=new hi((t||[]).slice(0)),this._stops.bind(te.Types.insert,e).bind(te.Types.remove,n),e(this._stops)}}};function Lp(){this._flagStops=!0}function Hp(t){let e=t.length;for(;e--;)t[e].bind(te.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function Wp(t){let e=t.length;for(;e--;)t[e].unbind(te.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}const ni=class ni extends st{constructor(n,r,o,s,a){super(a);S(this,"_flagEndPoints",!1);S(this,"_left",null);S(this,"_right",null);for(let l in jc)Object.defineProperty(this,l,jc[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=jp.bind(this),this.left=new be,this.right=new be,typeof n=="number"&&(this.left.x=n),typeof r=="number"&&(this.left.y=r),typeof o=="number"&&(this.right.x=o),typeof s=="number"&&(this.right.y=s)}static fromObject(n){const r=new ni().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<ni.Properties.length;r++){const o=ni.Properties[r];o in n&&(this[o]=n[o]instanceof be?n[o]:new be().copy(n[o]))}return this}clone(n){const r=this.stops.map(function(s){return s.clone()}),o=new ni(this.left._x,this.left._y,this.right._x,this.right._y,r);return Ie.each(st.Properties,function(s){o[s]=this[s]},this),n&&n.add(o),o}toObject(){const n=super.toObject.call(this);return n.left=this.left.toObject(),n.right=this.right.toObject(),n}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};S(ni,"Stop",fi),S(ni,"Properties",["left","right"]);let Nt=ni;const jc={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof be&&this._left.unbind(te.Types.change,this._renderer.flagEndPoints),this._left=t,this._left.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(t){this._right instanceof be&&this._right.unbind(te.Types.change,this._renderer.flagEndPoints),this._right=t,this._right.bind(te.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function jp(){this._flagEndPoints=!0}const Cn=class Cn extends st{constructor(n,r,o,s,a,l){super(s);S(this,"_flagRadius",!1);S(this,"_flagCenter",!1);S(this,"_flagFocal",!1);S(this,"_radius",0);S(this,"_center",null);S(this,"_focal",null);for(let c in qc)Object.defineProperty(this,c,qc[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=qp.bind(this),this._renderer.flagFocal=Xp.bind(this),this.center=new be,this.radius=typeof o=="number"?o:1,this.focal=new be,typeof n=="number"&&(this.center.x=n),typeof r=="number"&&(this.center.y=r),this.focal.copy(this.center),typeof a=="number"&&(this.focal.x=a),typeof l=="number"&&(this.focal.y=l)}static fromObject(n){const r=new Cn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Cn.Properties.length;r++){const o=Cn.Properties[r];o in n&&(/(center|focal)i/.test(o)?this[o]=n[o]instanceof be?n[o]:new be().copy(n[o]):typeof n[o]=="number"&&(this[o]=n[MediaKeySystemAccess]))}return this}clone(n){const r=this.stops.map(function(s){return s.clone()}),o=new Cn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return Ie.each(st.Properties.concat(Cn.Properties),function(s){o[s]=this[s]},this),n&&n.add(o),o}toObject(){const n=super.toObject.call(this);return Ie.each(Cn.Properties,function(r){n[r]=this[r]},this),n.center=this.center.toObject(),n.focal=this.focal.toObject(),n}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(te.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};S(Cn,"Stop",fi),S(Cn,"Properties",["center","radius","focal"]);let $t=Cn;const qc={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}},center:{enumerable:!0,get:function(){return this._center},set:function(t){this._center&&this._center.unbind(te.Types.change,this._renderer.flagCenter),this._center=t,this._center.bind(te.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(t){this._focal&&this._focal.unbind(te.Types.change,this._renderer.flagFocal),this._focal=t,this._focal.bind(te.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function qp(){this._flagCenter=!0}function Xp(){this._flagFocal=!0}function Xc(t,e){if(e===0||e===1)return!0;const r=t._length*e;let o=0;for(let s=0;s<t._lengths.length;s++){const a=t._lengths[s];if(o>=r)return r-o>=0;o+=a}return!1}function ho(t,e){const n=t._length;if(e<=0)return 0;if(e>=n)return t._lengths.length-1;for(let r=0,o=0;r<t._lengths.length;r++){if(o+t._lengths[r]>=e)return e-=o,Math.max(r-1,0)+e/t._lengths[r];o+=t._lengths[r]}return-1}function Yc(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,f=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(f||t).x,d=(f||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),f&&t._relative&&(s+=t.x,d+=t.y),Pp(r,l,o,c,s,d,a,u,n)}function Uc(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,f=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(f||t).x,d=(f||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),f&&t._relative&&(s+=t.x,d+=t.y),Ac(r,l,o,c,s,d,a,u,n)}function mi(t){switch(t.renderer.type){case"texture":return Ke.fromObject(t);case"gradient":return st.fromObject(t);case"linear-gradient":return Nt.fromObject(t);case"radial-gradient":return $t.fromObject(t)}return t}const Yp=Math.cos,Up=Math.sin,Kc=Math.tan,Ns=[],Rt=class Rt extends te{constructor(n,r,o,s,a,l){super();S(this,"elements",new Vc(9));S(this,"manual",!1);let c=n;Array.isArray(c)||(c=Array.prototype.slice.call(arguments)),this.identity(),c.length>0&&this.set(c)}static Multiply(n,r,o){if(r.length<=3){const x=n;let B,w,T;const N=r[0]||0,V=r[1]||0,R=r[2]||0;return B=x[0]*N+x[1]*V+x[2]*R,w=x[3]*N+x[4]*V+x[5]*R,T=x[6]*N+x[7]*V+x[8]*R,[B,w,T]}const s=n[0],a=n[1],l=n[2],c=n[3],d=n[4],u=n[5],h=n[6],f=n[7],g=n[8],m=r[0],p=r[1],y=r[2],b=r[3],_=r[4],C=r[5],k=r[6],E=r[7],$=r[8];return o=o||new Vc(9),o[0]=s*m+a*b+l*k,o[1]=s*p+a*_+l*E,o[2]=s*y+a*C+l*$,o[3]=c*m+d*b+u*k,o[4]=c*p+d*_+u*E,o[5]=c*y+d*C+u*$,o[6]=h*m+f*b+g*k,o[7]=h*p+f*_+g*E,o[8]=h*y+f*C+g*$,o}static fromObject(n){return new Rt().copy(n)}set(n,r,o,s,a,l,c,d,u){if(typeof r>"u"){const h=n;n=h[0],r=h[1],o=h[2],s=h[3],a=h[4],l=h[5],c=h[6],d=h[7],u=h[8]}return this.elements[0]=n,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(n){return this.elements[0]=n.elements[0],this.elements[1]=n.elements[1],this.elements[2]=n.elements[2],this.elements[3]=n.elements[3],this.elements[4]=n.elements[4],this.elements[5]=n.elements[5],this.elements[6]=n.elements[6],this.elements[7]=n.elements[7],this.elements[8]=n.elements[8],this.manual=n.manual,this.trigger(te.Types.change)}identity(){return this.elements[0]=Rt.Identity[0],this.elements[1]=Rt.Identity[1],this.elements[2]=Rt.Identity[2],this.elements[3]=Rt.Identity[3],this.elements[4]=Rt.Identity[4],this.elements[5]=Rt.Identity[5],this.elements[6]=Rt.Identity[6],this.elements[7]=Rt.Identity[7],this.elements[8]=Rt.Identity[8],this.trigger(te.Types.change)}multiply(n,r,o,s,a,l,c,d,u){if(typeof r>"u")return this.elements[0]*=n,this.elements[1]*=n,this.elements[2]*=n,this.elements[3]*=n,this.elements[4]*=n,this.elements[5]*=n,this.elements[6]*=n,this.elements[7]*=n,this.elements[8]*=n,this.trigger(te.Types.change);if(typeof o>"u"&&(o=1),typeof s>"u"){n=n||0,r=r||0,o=o||0,a=this.elements;const W=a[0]*n+a[1]*r+a[2]*o,ee=a[3]*n+a[4]*r+a[5]*o,ne=a[6]*n+a[7]*r+a[8]*o;return[W,ee,ne]}const h=this.elements,f=[n,r,o,s,a,l,c,d,u],g=h[0],m=h[1],p=h[2],y=h[3],b=h[4],_=h[5],C=h[6],k=h[7],E=h[8],$=f[0],x=f[1],B=f[2],w=f[3],T=f[4],N=f[5],V=f[6],R=f[7],I=f[8];return this.elements[0]=g*$+m*w+p*V,this.elements[1]=g*x+m*T+p*R,this.elements[2]=g*B+m*N+p*I,this.elements[3]=y*$+b*w+_*V,this.elements[4]=y*x+b*T+_*R,this.elements[5]=y*B+b*N+_*I,this.elements[6]=C*$+k*w+E*V,this.elements[7]=C*x+k*T+E*R,this.elements[8]=C*B+k*N+E*I,this.trigger(te.Types.change)}inverse(n){const r=this.elements;n=n||new Rt;const o=r[0],s=r[1],a=r[2],l=r[3],c=r[4],d=r[5],u=r[6],h=r[7],f=r[8],g=f*c-d*h,m=-f*l+d*u,p=h*l-c*u;let y=o*g+s*m+a*p;return y?(y=1/y,n.elements[0]=g*y,n.elements[1]=(-f*s+a*h)*y,n.elements[2]=(d*s-a*c)*y,n.elements[3]=m*y,n.elements[4]=(f*o-a*u)*y,n.elements[5]=(-d*o+a*l)*y,n.elements[6]=p*y,n.elements[7]=(-h*o+s*u)*y,n.elements[8]=(c*o-s*l)*y,n):null}scale(n,r){return arguments.length<=1&&(r=n),this.multiply(n,0,0,0,r,0,0,0,1)}rotate(n){const r=Yp(n),o=Up(n);return this.multiply(r,-o,0,o,r,0,0,0,1)}translate(n,r){return this.multiply(1,0,n,0,1,r,0,0,1)}skewX(n){const r=Kc(n);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(n){const r=Kc(n);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(n){return Ns.length=0,this.toTransformArray(n,Ns),Ns.map(bn).join(" ")}toTransformArray(n,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],h=o[5];if(n){const f=o[6],g=o[7],m=o[8];if(s){r[0]=a,r[1]=d,r[2]=f,r[3]=l,r[4]=u,r[5]=g,r[6]=c,r[7]=h,r[8]=m;return}return[a,d,f,l,u,g,c,h,m]}if(s){r[0]=a,r[1]=d,r[2]=l,r[3]=u,r[4]=c,r[5]=h;return}return[a,d,l,u,c,h]}toArray(n,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],h=o[5];if(n){const f=o[6],g=o[7],m=o[8];if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=h,r[6]=f,r[7]=g,r[8]=m;return}return[a,l,c,d,u,h,f,g,m]}if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=h;return}return[a,l,c,d,u,h]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Rt().copy(this)}};S(Rt,"Identity",[1,0,0,0,1,0,0,0,1]);let yr=Rt;Np(yr);const Mr=class Mr extends pr{constructor(){super();S(this,"_flagMatrix",!0);S(this,"_flagScale",!1);S(this,"_matrix",null);S(this,"_worldMatrix",null);S(this,"_position",null);S(this,"_rotation",0);S(this,"_scale",1);S(this,"_skewX",0);S(this,"_skewY",0);for(let n in fo)Object.defineProperty(this,n,fo[n]);this._renderer.flagMatrix=Gc.bind(this),this.isShape=!0,this.matrix=new yr,this.worldMatrix=new yr,this.position=new be,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(n){const r=new Mr().copy(n);return"id"in n&&(r.id=n.id),r}get renderer(){return this._renderer}set renderer(n){this._renderer=n}get translation(){return fo.position.get.apply(this,arguments)}set translation(n){fo.position.set.apply(this,arguments)}addTo(n){return n.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}copy(n){return super.copy.call(this,n),"position"in n&&(n.position instanceof be?this.position=n.position:this.position.copy(n.position)),"rotation"in n&&(this.rotation=n.rotation),"scale"in n&&(this.scale=typeof n.scale=="number"||n.scale instanceof be?n.scale:new be(n.scale.x,n.scale.y)),"skewX"in n&&(this.skewX=n.skewX),"skewY"in n&&(this.skewY=n.skewY),"matrix"in n&&n.matrix.manual&&(this.matrix.copy(n.matrix),this.matrix.manual=!0),this}clone(n){const r=new Mr;return r.position.copy(this.position),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer={type:"shape"},n.isShape=!0,n.translation=this.translation.toObject(),n.rotation=this.translation.rotation,n.scale=this.scale instanceof be?this.scale.toObject():this.scale,n.skewX=this.skewX,n.skewY=this.skewY,n.matrix=this.matrix.toObject(),n}_update(n){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof 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)),n&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};S(Mr,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let $n=Mr;const fo={position:{enumerable:!0,get:function(){return this._position},set:function(t){this._position&&this._position.unbind(te.Types.change,this._renderer.flagMatrix),this._position=t,this._position.bind(te.Types.change,this._renderer.flagMatrix),Gc.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof be&&this._scale.unbind(te.Types.change,this._renderer.flagMatrix),this._scale=t,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(t){this._skewX=t,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(t){this._skewY=t,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(t){this._matrix=t,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return $p(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function Gc(){this._flagMatrix=!0}const Xi=Math.min,Yi=Math.max,Kp=Math.ceil,Gp=Math.floor,Zp=new be,sn=class sn extends $n{constructor(n,r,o,s){super();S(this,"_flagVertices",!0);S(this,"_flagLength",!0);S(this,"_flagFill",!0);S(this,"_flagStroke",!0);S(this,"_flagLinewidth",!0);S(this,"_flagOpacity",!0);S(this,"_flagVisible",!0);S(this,"_flagCap",!0);S(this,"_flagJoin",!0);S(this,"_flagMiter",!0);S(this,"_flagStrokeAttenuation",!0);S(this,"_flagMask",!1);S(this,"_flagClip",!1);S(this,"_length",0);S(this,"_fill","#fff");S(this,"_stroke","#000");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_cap","round");S(this,"_join","round");S(this,"_miter",4);S(this,"_closed",!0);S(this,"_curved",!1);S(this,"_automatic",!0);S(this,"_beginning",0);S(this,"_ending",1);S(this,"_mask",null);S(this,"_clip",!1);S(this,"_dashes",null);S(this,"_strokeAttenuation",!0);for(let a in Zc)Object.defineProperty(this,a,Zc[a]);this._renderer.type="path",this._renderer.flagVertices=Qc.bind(this),this._renderer.bindVertices=Jc.bind(this),this._renderer.unbindVertices=ed.bind(this),this._renderer.flagFill=td.bind(this),this._renderer.flagStroke=nd.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=n,this.automatic=!s,this.dashes=[],this.dashes.offset=0}static fromObject(n){const r=typeof n.fill=="string"?n.fill:mi(n.fill),o=typeof n.stroke=="string"?n.stroke:mi(n.stroke),s=new sn().copy({...n,fill:r,stroke:o});return"id"in n&&(s.id=n.id),s}copy(n){if(super.copy.call(this,n),n.vertices){this.vertices=[];for(let r=0;r<n.vertices.length;r++){const o=n.vertices[r];o instanceof Fe?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Fe().copy(o))}}for(let r=0;r<sn.Properties.length;r++){const o=sn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new sn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<sn.Properties.length;o++){const s=sn.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),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="path",n.vertices=this.vertices.map(r=>r.toObject()),Ie.each(sn.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];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"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const n=this.getBoundingClientRect(!0),r=n.width/2,o=n.height/2,s=n.left+n.width/2,a=n.top+n.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=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 n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,o=n.top+n.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(n){let r,o,s,a,l,c,d=1/0,u=-1/0,h=1/0,f=-1/0;if(this._update(!0),r=n?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:g,scaleY:m}=Tp(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof g=="number"&&typeof m=="number"&&(o=Math.max(g,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[g,m]=r.multiply(l.x,l.y),[p,y]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let b=l.controls.right.x,_=l.controls.right.y;l.relative&&(b+=l.x,_+=l.y);let[C,k]=r.multiply(b,_),E=c.controls.left.x,$=c.controls.left.y;c.relative&&(E+=c.x,$+=c.y);let[x,B]=r.multiply(E,$);const w=Fp(g,m,C,k,x,B,p,y);h=Xi(w.min.y-o,h),d=Xi(w.min.x-o,d),u=Yi(w.max.x+o,u),f=Yi(w.max.y+o,f)}else a<=1&&(h=Xi(m-o,h),d=Xi(g-o,d),u=Yi(g+o,u),f=Yi(m+o,f)),h=Xi(y-o,h),d=Xi(p-o,d),u=Yi(p+o,u),f=Yi(y+o,f)}return{top:h,left:d,right:u,bottom:f,width:u-d,height:f-h}}getPointAt(n,r){let o,s,a,l,c,d,u,h,f,g,m,p,y,b,_,C=this.length*Math.min(Math.max(n,0),1);const k=this.vertices.length,E=k-1;let $=null,x=null;for(let D=0,H=this._lengths.length,L=0;D<H;D++){if(L+this._lengths[D]>=C){this._closed?(o=qi(D,k),s=qi(D-1,k),D===0&&(o=s,s=D)):(o=D,s=Math.min(Math.max(D-1,0),E)),$=this.vertices[o],x=this.vertices[s],C-=L,this._lengths[D]!==0?n=C/this._lengths[D]:n=0;break}L+=this._lengths[D]}if($===null||x===null)return null;if($){if(!x)return $}else return x;_=x.controls&&x.controls.right,b=$.controls&&$.controls.left,c=x.x,g=x.y,d=(_||x).x,m=(_||x).y,u=(b||$).x,p=(b||$).y,h=$.x,y=$.y,_&&x.relative&&(d+=x.x,m+=x.y),b&&$.relative&&(u+=$.x,p+=$.y),l=lo(n,c,d,u,h),f=lo(n,g,m,p,y);const B=Gt(c,d,n),w=Gt(g,m,n),T=Gt(d,u,n),N=Gt(m,p,n),V=Gt(u,h,n),R=Gt(p,y,n),I=Gt(B,T,n),W=Gt(w,N,n),ee=Gt(T,V,n),ne=Gt(N,R,n);return Ie.isObject(r)?(r.x=l,r.y=f,r instanceof Fe&&(r.controls.left.x=I,r.controls.left.y=W,r.controls.right.x=ee,r.controls.right.y=ne,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=f,r.controls.right.x-=l,r.controls.right.y-=f)),r.t=n,r):(a=new Fe(l,f,I-l,W-f,ee-l,ne-f,this._curved?pe.curve:pe.line),a.t=n,a)}plot(){if(this.curved)return Ip(this._collection,this.closed),this;for(let n=0;n<this._collection.length;n++)this._collection[n].command=n===0?pe.move:pe.line;return this}subdivide(n){this._update();const r=this.vertices.length-1,o=this._closed||this.vertices[r]._command===pe.close;let s=this.vertices[r],a=[],l;return Ie.each(this.vertices,function(c,d){if(d<=0&&!o){s=c;return}if(c.command===pe.move){a.push(new Fe(s.x,s.y)),d>0&&(a[a.length-1].command=pe.line),s=c;return}l=Uc(c,s,n),a=a.concat(l),Ie.each(l,function(u,h){h<=0&&s.command===pe.move?u.command=pe.move:u.command=pe.line}),d>=r&&(this._closed&&this._automatic&&(s=c,l=Uc(c,s,n),a=a.concat(l),Ie.each(l,function(u,h){h<=0&&s.command===pe.move?u.command=pe.move:u.command=pe.line})),a.push(new Fe(c.x,c.y)),a[a.length-1].command=o?pe.close:pe.line),s=c},this),this._automatic=!1,this._curved=!1,this.vertices=a,this}_updateLength(n,r){r||this._update();const s=this.vertices.length-1;let a=this.vertices[s],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),Ie.each(this.vertices,function(c,d){if(d<=0||c.command===pe.move){a=c,this._lengths[d]=0;return}this._lengths[d]=Yc(c,a,n),l+=this._lengths[d],a=c},this),this._length=l,this._flagLength=!1,this}_update(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);const n=this._collection.length,r=this._closed,o=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),a=ho(this,o*this._length),l=ho(this,s*this._length),c=Kp(a),d=Gp(l);let u,h,f,g,m,p;for(this._renderer.vertices.length=0,p=0;p<n;p++)this._renderer.collection.length<=p&&this._renderer.collection.push(new Fe),p>d&&!h?(m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(s,m),m.command=this._renderer.collection[p].command,this._renderer.vertices.push(m),h=m,f=this._collection[p-1],f&&f.controls&&(m.relative?m.controls.right.clear():m.controls.right.copy(m),f.relative?this._renderer.collection[p-1].controls.right.copy(f.controls.right).lerp(be.zero,1-m.t):this._renderer.collection[p-1].controls.right.copy(f.controls.right).lerp(f,1-m.t))):p>=c&&p<=d&&(m=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(m),p===d&&Xc(this,s)?(h=m,!r&&h.controls&&(h.relative?h.controls.right.clear():h.controls.right.copy(h))):p===c&&Xc(this,o)&&(u=m,u.command=pe.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(p=c-1,m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(o,m),m.command=pe.move,this._renderer.vertices.unshift(m),g=this._collection[p+1],g&&g.controls&&(m.controls.left.clear(),g.relative?this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(be.zero,m.t):(Zp.copy(g),this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(g,m.t))))}return $n.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,$n.prototype.flagReset.call(this),this}};S(sn,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),S(sn,"Utils",{getCurveLength:Yc});let Me=sn;const Zc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof st||this._fill instanceof Nt||this._fill instanceof $t||this._fill instanceof Ke)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof Nt||this._fill instanceof $t||this._fill instanceof Ke)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof Nt||this._stroke instanceof $t||this._stroke instanceof Ke)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof Nt||this._stroke instanceof $t||this._stroke instanceof Ke)&&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(t){this._closed=!!t,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t===this._automatic)return;this._automatic=!!t;const e=this._automatic?"ignore":"listen";Ie.each(this.vertices,function(n){n[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,n),t instanceof hi?this._collection=t:this._collection=new hi(t||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,n),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Ie.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function Qc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Jc(t){let e=t.length;for(;e--;)t[e].bind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function ed(t){let e=t.length;for(;e--;)t[e].unbind(te.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function td(){this._flagFill=!0}function nd(){this._flagStroke=!0}const Qp=Math.ceil,Jp=Math.floor,Sn=class Sn extends $n{constructor(n){super();S(this,"_flagVertices",!0);S(this,"_flagLength",!0);S(this,"_flagFill",!0);S(this,"_flagStroke",!0);S(this,"_flagLinewidth",!0);S(this,"_flagOpacity",!0);S(this,"_flagVisible",!0);S(this,"_flagSize",!0);S(this,"_flagSizeAttenuation",!0);S(this,"_flagStrokeAttenuation",!0);S(this,"_length",0);S(this,"_fill","#fff");S(this,"_stroke","#000");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_size",1);S(this,"_sizeAttenuation",!1);S(this,"_beginning",0);S(this,"_ending",1);S(this,"_dashes",null);S(this,"_strokeAttenuation",!0);S(this,"noFill",Me.prototype.noFill);S(this,"noStroke",Me.prototype.noStroke);S(this,"corner",Me.prototype.corner);S(this,"center",Me.prototype.center);S(this,"getBoundingClientRect",Me.prototype.getBoundingClientRect);S(this,"_updateLength",Me.prototype._updateLength);for(let r in id)Object.defineProperty(this,r,id[r]);this._renderer.type="points",this._renderer.flagVertices=Qc.bind(this),this._renderer.bindVertices=Jc.bind(this),this._renderer.unbindVertices=ed.bind(this),this._renderer.flagFill=td.bind(this),this._renderer.flagStroke=nd.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.size=1,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.vertices=n,this.dashes=[],this.dashes.offset=0}static fromObject(n){const r=typeof n.fill=="string"?n.fill:mi(n.fill),o=typeof n.stroke=="string"?n.stroke:mi(n.stroke),s=new Sn().copy({...n,fill:r,stroke:o});return"id"in n&&(s.id=n.id),s}copy(n){super.copy.call(this,n);for(let r=0;r<n.vertices.length;r++){const o=n.vertices[r];o instanceof Fe?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Fe().copy(o))}for(let r=0;r<Sn.Properties.length;r++){const o=Sn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Sn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Sn.Properties.length;o++){const s=Sn.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),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="points",n.vertices=this.vertices.map(r=>r.toObject()),Ie.each(Sn.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];typeof r.unbind=="function"&&r.unbind()}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}subdivide(n){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,h=Ac(l,c,l,c,d,u,d,u,n);r=r.concat(h)}return this.vertices=r,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const n=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),o=ho(this,n*this._length),s=ho(this,r*this._length),a=Qp(o),l=Jp(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}};S(Sn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let mo=Sn;const id={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(t){this._sizeAttenuation=t,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof st||this._fill instanceof Nt||this._fill instanceof $t||this._fill instanceof Ke)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof Nt||this._fill instanceof $t||this._fill instanceof Ke)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof Nt||this._stroke instanceof $t||this._stroke instanceof Ke)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof Nt||this._stroke instanceof $t||this._stroke instanceof Ke)&&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(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(te.Types.insert,e).unbind(te.Types.remove,n),t instanceof hi?this._collection=t:this._collection=new hi(t||[]),this._collection.bind(te.Types.insert,e).bind(te.Types.remove,n),e(this._collection)}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};class rd extends hi{constructor(n){n=Array.isArray(n)?n:Array.prototype.slice.call(arguments);super(n);Ya(this,Lo,{});this.attach(n),this.on(te.Types.insert,this.attach),this.on(te.Types.remove,this.detach)}get ids(){return Ft(this,Lo)}attach(n){for(let r=0;r<n.length;r++){const o=n[r];o&&o.id&&(this.ids[o.id]=o)}return this}detach(n){for(let r=0;r<n.length;r++)delete this.ids[n[r].id];return this}}Lo=new WeakMap;const Vn=class Vn extends Me{constructor(n,r,o,s,a,l,c){const d=c||Ts.Resolution*3,u=[];for(let h=0;h<d;h++)u.push(new Fe);super(u,!0,!1,!0);S(this,"_flagStartAngle",!1);S(this,"_flagEndAngle",!1);S(this,"_flagInnerRadius",!1);S(this,"_flagOuterRadius",!1);S(this,"_startAngle",0);S(this,"_endAngle",ui);S(this,"_innerRadius",0);S(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let h in od)Object.defineProperty(this,h,od[h]);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 n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Vn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Vn.Properties.length;r++){const o=Vn.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const n=this._startAngle,r=this._endAngle,o=this._innerRadius,s=this._outerRadius,a=qi(n,ui)===qi(r,ui),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,h=0,f,g,m,p,y,b,_,C,k;for(a?d--:l||(d-=2),f=0,g=d-1;f<d;f++){switch(m=f/g,p=c[h],y=m*(r-n)+n,b=(r-n)/d,_=s*Math.cos(y),C=s*Math.sin(y),f){case 0:u=pe.move;break;default:u=pe.curve}p.command=u,p.x=_,p.y=C,p.controls.left.clear(),p.controls.right.clear(),p.command===pe.curve&&(k=s*b/Math.PI,p.controls.left.x=k*Math.cos(y-dt),p.controls.left.y=k*Math.sin(y-dt),p.controls.right.x=k*Math.cos(y+dt),p.controls.right.y=k*Math.sin(y+dt),f===1&&p.controls.left.multiplyScalar(2),f===g&&p.controls.right.multiplyScalar(2)),h++}if(l){for(a?(c[h].command=pe.close,h++):(d--,g=d-1),f=0;f<d;f++)m=f/g,p=c[h],y=(1-m)*(r-n)+n,b=(r-n)/d,_=o*Math.cos(y),C=o*Math.sin(y),u=pe.curve,f<=0&&(u=a?pe.move:pe.line),p.command=u,p.x=_,p.y=C,p.controls.left.clear(),p.controls.right.clear(),p.command===pe.curve&&(k=o*b/Math.PI,p.controls.left.x=k*Math.cos(y+dt),p.controls.left.y=k*Math.sin(y+dt),p.controls.right.x=k*Math.cos(y-dt),p.controls.right.y=k*Math.sin(y-dt),f===1&&p.controls.left.multiplyScalar(2),f===g&&p.controls.right.multiplyScalar(2)),h++;c[h].copy(c[0]),c[h].command=pe.line}else a||(c[h].command=pe.line,c[h].x=0,c[h].y=0,h++,c[h].copy(c[0]),c[h].command=pe.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(n){const r=this.innerRadius,o=this.outerRadius,s=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new Vn(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<Me.Properties.length;d++){const u=Me.Properties[d];c[u]=this[u]}return n&&n.add(c),c}toObject(){const n=super.toObject.call(this);n.renderer.type="arc-segment";for(let r=0;r<Vn.Properties.length;r++){const o=Vn.Properties[r];n[o]=this[o]}return n}};S(Vn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let $s=Vn;const od={startAngle:{enumerable:!0,get:function(){return this._startAngle},set:function(t){this._startAngle=t,this._flagStartAngle=!0}},endAngle:{enumerable:!0,get:function(){return this._endAngle},set:function(t){this._endAngle=t,this._flagEndAngle=!0}},innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}}},Es=Math.cos,Rs=Math.sin,In=class In extends Me{constructor(n,r,o,s){const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Fe(0,0,0,0,0,0));super(l,!0,!0,!0);S(this,"_flagRadius",!1);S(this,"_radius",0);this._renderer.type="circle";for(let c in sd)Object.defineProperty(this,c,sd[c]);typeof o=="number"&&(this.radius=o),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new In().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<In.Properties.length;r++){const o=In.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagRadius){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(n*2)),o=this._radius,s=o*r;for(let a=0;a<this.vertices.length;a++){const c=a/n*ui,d=o*Es(c),u=o*Rs(c),h=s*Es(c-dt),f=s*Rs(c-dt),g=s*Es(c+dt),m=s*Rs(c+dt),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(h,f),p.controls.right.set(g,m)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=new In(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<Me.Properties.length;o++){const s=Me.Properties[o];r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="circle";for(let r=0;r<In.Properties.length;r++){const o=In.Properties[r];n[o]=this[o]}return n}};S(In,"Properties",["radius"]);let Ps=In;const sd={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},Fs=Math.cos,Vs=Math.sin,Mn=class Mn extends Me{constructor(n,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 Fe);super(c,!0,!0,!0);S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_width",0);S(this,"_height",0);this._renderer.type="ellipse";for(let d in ad)Object.defineProperty(this,d,ad[d]);typeof o=="number"&&(this.width=o*2),typeof s=="number"&&(this.height=s*2),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Mn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Mn.Properties.length;r++){const o=Mn.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(this.vertices.length*2)),o=this._width/2,s=this._height/2;for(let a=0;a<this.vertices.length;a++){const c=a/n*ui,d=o*Fs(c),u=s*Vs(c),h=o*r*Fs(c-dt),f=s*r*Vs(c-dt),g=o*r*Fs(c+dt),m=s*r*Vs(c+dt),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(h,f),p.controls.right.set(g,m)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=this.width/2,o=this.height/2,s=this.vertices.length,a=new Mn(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<Me.Properties.length;l++){const c=Me.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="ellipse";for(let r=0;r<Mn.Properties.length;r++){const o=Mn.Properties[r];n[o]=this[o]}return n}};S(Mn,"Properties",["width","height"]);let Is=Mn;const ad={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}}},ey=Math.cos,ty=Math.sin,An=class An extends Me{constructor(n,r,o,s){s=Math.max(s||0,3);super();S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_flagSides",!1);S(this,"_radius",0);S(this,"_width",0);S(this,"_height",0);S(this,"_sides",0);this._renderer.type="polygon";for(let a in ld)Object.defineProperty(this,a,ld[a]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.radius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new An().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<An.Properties.length;r++){const o=An.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const n=this._sides,r=n+1;let o=this.vertices.length;o>n&&(this.vertices.splice(n-1,o-n),o=n);for(let s=0;s<r;s++){const a=(s+.5)/n,l=ui*a+Math.PI/2,c=this._width*ey(l)/2,d=this._height*ty(l)/2;s>=o?this.vertices.push(new Fe(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?pe.move:pe.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=new An(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<Me.Properties.length;o++){const s=Me.Properties[o];r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="polygon";for(let r=0;r<An.Properties.length;r++){const o=An.Properties[r];n[o]=this[o]}return n}};S(An,"Properties",["width","height","sides"]);let Ms=An;const ld={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this.width=t*2,this.height=t*2}},width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0,this._radius=Math.max(this.width,this.height)/2}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0,this._radius=Math.max(this.width,this.height)/2}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}},Ni=class Ni extends Me{constructor(n,r,o,s){const a=[new Fe,new Fe,new Fe,new Fe];super(a,!0,!1,!0);S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_width",0);S(this,"_height",0);S(this,"_origin",null);this._renderer.type="rectangle";for(let l in cd)Object.defineProperty(this,l,cd[l]);this.width=typeof o=="number"?o:1,this.height=typeof s=="number"?s:1,this.origin=new be,typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(n){const r=new Ni().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Ni.Properties.length;r++){const o=Ni.Properties[r];o in n&&(typeof n[o]=="number"?this[o]=n[o]:this[o]instanceof be&&this[o].copy(n[o]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const n=this._width/2,r=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Fe),this.vertices[0].set(-n,-r).sub(this._origin).command=pe.move,this.vertices[1].set(n,-r).sub(this._origin).command=pe.line,this.vertices[2].set(n,r).sub(this._origin).command=pe.line,this.vertices[3].set(-n,r).sub(this._origin).command=pe.line,this.vertices[4]&&(this.vertices[4].set(-n,-r).sub(this._origin).command=pe.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=new Ni(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<Me.Properties.length;o++){const s=Me.Properties[o];r[s]instanceof be?r[s].copy(this[s]):r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="rectangle",n.width=this.width,n.height=this.height,n.origin=this.origin.toObject(),n}};S(Ni,"Properties",["width","height","origin"]);let br=Ni;const cd={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(t){this._origin&&this._origin.unbind(te.Types.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(te.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},On=class On extends Me{constructor(n,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 Fe(0,0,0,0,0,0,c===0?pe.move:pe.curve));super(l);S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_flagRadius",!1);S(this,"_width",0);S(this,"_height",0);S(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in dd)Object.defineProperty(this,c,dd[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=ny.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 n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new On().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<On.Properties.length;r++){const o=On.Properties[r];if(o in n){const s=n[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 n=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=n/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(n){const r=this.width,o=this.height,s=this.radius,a=new On(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<Me.Properties.length;l++){const c=Me.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="rounded-rectangle";for(let r=0;r<On.Properties.length;r++){const o=On.Properties[r];n[o]=this[o]}return n.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),n}};S(On,"Properties",["width","height","radius"]);let As=On;const dd={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof be&&this._radius.unbind(te.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof be&&this._radius.bind(te.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function ny(){this._flagRadius=!0}const iy=Math.cos,ry=Math.sin,zn=class zn extends Me{constructor(n,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();S(this,"_flagInnerRadius",!1);S(this,"_flagOuterRadius",!1);S(this,"_flagSides",!1);S(this,"_innerRadius",0);S(this,"_outerRadius",0);S(this,"_sides",0);this._renderer.type="star";for(let l in ud)Object.defineProperty(this,l,ud[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 n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new zn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<zn.Properties.length;r++){const o=zn.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const n=this._sides*2,r=n+1;let o=this.vertices.length;o>n&&(this.vertices.splice(n-1,o-n),o=n);for(let s=0;s<r;s++){const a=(s+.5)/n,l=ui*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*iy(l),u=c*ry(l);s>=o?this.vertices.push(new Fe(d,u)):this.vertices[s].set(d,u),this.vertices[s].command=s===0?pe.move:pe.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=this.innerRadius,o=this.outerRadius,s=this.sides,a=new zn(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Me.Properties.length;l++){const c=Me.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="star";for(let r=0;r<zn.Properties.length;r++){const o=zn.Properties[r];n[o]=this[o]}return n}};S(zn,"Properties",["innerRadius","outerRadius","sides"]);let Os=zn;const ud={innerRadius:{enumerable:!0,get:function(){return this._innerRadius},set:function(t){this._innerRadius=t,this._flagInnerRadius=!0}},outerRadius:{enumerable:!0,get:function(){return this._outerRadius},set:function(t){this._outerRadius=t,this._flagOuterRadius=!0}},sides:{enumerable:!0,get:function(){return this._sides},set:function(t){this._sides=t,this._flagSides=!0}}};let zs;const hd=Math.min,fd=Math.max;yn.document&&(zs=document.createElement("canvas"));const vt=class vt extends $n{constructor(n,r,o,s){super();S(this,"_flagValue",!0);S(this,"_flagFamily",!0);S(this,"_flagSize",!0);S(this,"_flagLeading",!0);S(this,"_flagAlignment",!0);S(this,"_flagBaseline",!0);S(this,"_flagStyle",!0);S(this,"_flagWeight",!0);S(this,"_flagDecoration",!0);S(this,"_flagFill",!0);S(this,"_flagStroke",!0);S(this,"_flagLinewidth",!0);S(this,"_flagOpacity",!0);S(this,"_flagVisible",!0);S(this,"_flagMask",!1);S(this,"_flagClip",!1);S(this,"_flagDirection",!0);S(this,"_flagStrokeAttenuation",!0);S(this,"_value","");S(this,"_family","sans-serif");S(this,"_size",13);S(this,"_leading",17);S(this,"_alignment","center");S(this,"_baseline","middle");S(this,"_style","normal");S(this,"_weight",500);S(this,"_decoration","none");S(this,"_direction","ltr");S(this,"_fill","#000");S(this,"_stroke","none");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_mask",null);S(this,"_clip",!1);S(this,"_dashes",null);S(this,"_strokeAttenuation",!0);for(let a in md)Object.defineProperty(this,a,md[a]);if(this._renderer.type="text",this._renderer.flagFill=oy.bind(this),this._renderer.flagStroke=sy.bind(this),this.value=n,typeof r=="number"&&(this.translation.x=r),typeof o=="number"&&(this.translation.y=o),this.dashes=[],this.dashes.offset=0,!Ie.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(n){if(zs){const r=zs.getContext("2d");r.font=[n._style,n._weight,`${n._size}px/${n._leading}px`,n._family].join(" ");const o=r.measureText(n.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(n){const r=typeof n.fill=="string"?n.fill:mi(n.fill),o=typeof n.stroke=="string"?n.stroke:mi(n.stroke),s=new vt().copy({...n,fill:r,stroke:o});return"id"in n&&(s.id=n.id),s}copy(n){super.copy.call(this,n);for(let r=0;r<vt.Properties.length;r++){const o=vt.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){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),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);n.renderer.type="text";for(let r=0;r<vt.Properties.length;r++){const o=vt.Properties[r];n[o]=this[o]}return n}dispose(){return super.dispose(),typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(n){let r,o,s,a,l;this._update(!0),r=n?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[h,f]=r.multiply(o,a),[g,m]=r.multiply(o,l),[p,y]=r.multiply(s,a),[b,_]=r.multiply(s,l);return a=hd(f,m,y,_),o=hd(h,g,p,b),s=fd(h,g,p,b),l=fd(f,m,y,_),{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}};S(vt,"Ratio",.6),S(vt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let Ui=vt;const md={value:{enumerable:!0,get:function(){return this._value},set:function(t){this._value=t,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(t){this._family=t,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(t){this._leading=t,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(t){this._alignment=t,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(t){this._style=t,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(t){this._weight=t,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(t){this._decoration=t,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(t){this._direction=t,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(t){this._baseline=t,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof st||this._fill instanceof Nt||this._fill instanceof $t||this._fill instanceof Ke)&&this._fill.unbind(te.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof Nt||this._fill instanceof $t||this._fill instanceof Ke)&&this._fill.bind(te.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof Nt||this._stroke instanceof $t||this._stroke instanceof Ke)&&this._stroke.unbind(te.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof Nt||this._stroke instanceof $t||this._stroke instanceof Ke)&&this._stroke.bind(te.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Ie.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function oy(){this._flagFill=!0}function sy(){this._flagStroke=!0}const Dn=class Dn extends br{constructor(n,r,o,s){super(r,o,0,0);S(this,"_flagTextures",!1);S(this,"_flagFrameRate",!1);S(this,"_flagIndex",!1);S(this,"_amount",1);S(this,"_duration",0);S(this,"_index",0);S(this,"_startTime",0);S(this,"_playing",!1);S(this,"_firstFrame",0);S(this,"_lastFrame",0);S(this,"_loop",!0);S(this,"_textures",null);S(this,"_frameRate",0);S(this,"_origin",null);this._renderer.type="image-sequence";for(let a in gd)Object.defineProperty(this,a,gd[a]);this._renderer.flagTextures=ay.bind(this),this._renderer.bindTextures=ly.bind(this),this._renderer.unbindTextures=cy.bind(this),this.noStroke(),this.noFill(),Array.isArray(n)?this.textures=n.map(pd.bind(this)):typeof n=="string"&&(this.textures=[pd(n)]),this.origin=new be,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=Dn.DefaultFrameRate,this.index=0}static fromObject(n){const r=new Dn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Dn.Properties.length;r++){const o=Dn.Properties[r];o in n&&(this[o]=n[o])}return this}play(n,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=Ie.performance.now(),typeof n=="number"&&(this._firstFrame=n),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(n){const r=new Dn(this.textures,this.translation.x,this.translation.y,this.frameRate);return r._loop=this._loop,this._playing&&r.play(),n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="image-sequence",n.textures=this.textures.map(function(r){return r.toObject()}),n.frameRate=this.frameRate,n.index=this.index,n.firstFrame=this.firstFrame,n.lastFrame=this.lastFrame,n.loop=this.loop,n}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 n=0;n<this.textures.length;n++){const r=this.textures[n];typeof r.dispose=="function"?r.dispose():typeof r.unbind=="function"&&r.unbind()}return this}_update(){const n=this._textures;let r,o,s,a,l,c,d,u;return n&&(this._flagTextures&&(this._amount=n.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(a=this._amount,Ie.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=Ie.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=Gt(this._firstFrame,u,s/l),d=Math.floor(d),d!==this._index&&(this._index=d,c=n[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 Ke))&&(c=n[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}};S(Dn,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),S(Dn,"DefaultFrameRate",30);let Ds=Dn;const gd={frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},textures:{enumerable:!0,get:function(){return this._textures},set:function(t){const e=this._renderer.bindTextures,n=this._renderer.unbindTextures;this._textures&&this._textures.unbind(te.Types.insert,e).unbind(te.Types.remove,n),this._textures=new hi((t||[]).slice(0)),this._textures.bind(te.Types.insert,e).bind(te.Types.remove,n),e(this._textures)}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}};function ay(){this._flagTextures=!0}function ly(t){let e=t.length;for(;e--;)t[e].bind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function cy(t){let e=t.length;for(;e--;)t[e].unbind(te.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function pd(t){if(t instanceof Ke)return t;if(typeof t=="string")return new Ke(t)}const $i=class $i extends br{constructor(n,r,o,s,a,l){super(r,o,0,0);S(this,"_flagTexture",!1);S(this,"_flagColumns",!1);S(this,"_flagRows",!1);S(this,"_flagFrameRate",!1);S(this,"_flagIndex",!1);S(this,"_amount",1);S(this,"_duration",0);S(this,"_startTime",0);S(this,"_playing",!1);S(this,"_firstFrame",0);S(this,"_lastFrame",0);S(this,"_loop",!0);S(this,"_texture",null);S(this,"_columns",1);S(this,"_rows",1);S(this,"_frameRate",0);S(this,"_index",0);S(this,"_origin",null);this._renderer.type="sprite";for(let c in yd)Object.defineProperty(this,c,yd[c]);this.noStroke(),this.noFill(),n instanceof Ke?this.texture=n:typeof n=="string"&&(this.texture=new Ke(n)),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(n){const r=new $i().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<$i.Properties.length;r++){const o=$i.Properties[r];o in n&&(this[o]=n[o])}return this}play(n,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=Ie.performance.now(),typeof n=="number"&&(this._firstFrame=n),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(n){const r=new $i(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,n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="sprite",n.texture=this.texture.toObject(),n.columns=this.columns,n.rows=this.rows,n.frameRate=this.frameRate,n.index=this.index,n.firstFrame=this.firstFrame,n.lastFrame=this.lastFrame,n.loop=this.loop,n}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 n=this._texture,r=this._columns,o=this._rows;let s,a,l,c,d,u,h,f,g;if(n&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=n),n.loaded)){h=n.image.width,f=n.image.height,s=h/r,a=f/o,c=this._amount,this.width!==s&&(this.width=s),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&(Ie.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=Ie.performance.now()-this._startTime,g=this._lastFrame+1,d=1e3*(g-this._firstFrame)/this._frameRate,this._loop?l=l%d:l=Math.min(l,d),u=Gt(this._firstFrame,g,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,p=Math.floor(this._index/r),y=-s*m+(h-s)/2,b=-a*p+(f-a)/2;y!==n.offset.x&&(n.offset.x=y),b!==n.offset.y&&(n.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};S($i,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let Ls=$i;const yd={texture:{enumerable:!0,get:function(){return this._texture},set:function(t){this._texture=t,this._flagTexture=!0}},columns:{enumerable:!0,get:function(){return this._columns},set:function(t){this._columns=t,this._flagColumns=!0}},rows:{enumerable:!0,get:function(){return this._rows},set:function(t){this._rows=t,this._flagRows=!0}},frameRate:{enumerable:!0,get:function(){return this._frameRate},set:function(t){this._frameRate=t,this._flagFrameRate=!0}},index:{enumerable:!0,get:function(){return this._index},set:function(t){this._index=t,this._flagIndex=!0}},firstFrame:{enumerable:!0,get:function(){return this._firstFrame},set:function(t){this._firstFrame=t}},lastFrame:{enumerable:!0,get:function(){return this._lastFrame},set:function(t){this._lastFrame=t}},loop:{enumerable:!0,get:function(){return this._loop},set:function(t){this._loop=!!t}}},go=Math.min,po=Math.max,an=class an extends $n{constructor(n){super();S(this,"_flagAdditions",!1);S(this,"_flagSubtractions",!1);S(this,"_flagOrder",!1);S(this,"_flagOpacity",!0);S(this,"_flagBeginning",!1);S(this,"_flagEnding",!1);S(this,"_flagLength",!1);S(this,"_flagMask",!1);S(this,"_fill","#fff");S(this,"_stroke","#000");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_cap","round");S(this,"_join","round");S(this,"_miter",4);S(this,"_closed",!0);S(this,"_curved",!1);S(this,"_automatic",!0);S(this,"_beginning",0);S(this,"_ending",1);S(this,"_length",0);S(this,"_mask",null);S(this,"_strokeAttenuation",!0);for(let r in bd)Object.defineProperty(this,r,bd[r]);this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(n)?n:Array.prototype.slice.call(arguments)}static InsertChildren(n){for(let r=0;r<n.length;r++)_d.call(this,n[r],this)}static RemoveChildren(n){for(let r=0;r<n.length;r++)_d.call(this,n[r])}static OrderChildren(n){this._flagOrder=!0}static fromObject(n){const r=new an;for(let s=0;s<an.Properties.length;s++){const a=an.Properties[s];a in n&&(/(fill|stroke)/i.test(a)?r[a]=typeof n[a]=="string"?n[a]:mi(n[a]):r[a]=n[a])}return"mask"in n&&(r.mask=o(n.mask)),"id"in n&&(r.id=n.id),r.children=n.children.map(o),r;function o(s){if(s&&s.renderer)switch(s.renderer.type){case"arc-segment":return $s.fromObject(s);case"circle":return Ps.fromObject(s);case"element":return pr.fromObject(s);case"ellipse":return Is.fromObject(s);case"group":return an.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Ds.fromObject(s);case"path":return Me.fromObject(s);case"points":return mo.fromObject(s);case"polygon":return Ms.fromObject(s);case"rectangle":return br.fromObject(s);case"rounded-rectangle":return As.fromObject(s);case"shape":return $n.fromObject(s);case"sprite":return Ls.fromObject(s);case"star":return Os.fromObject(s);case"text":return Ui.fromObject(s)}return s}}copy(n){super.copy.call(this,n),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let r=0;r<an.Properties.length;r++){const o=an.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new an,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),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="group",n.children=[],n.opacity=this.opacity,n.className=this.className,n.mask=this.mask?this.mask.toObject():null,Ie.each(this.children,(r,o)=>{n.children[o]=r.toObject()},this),n}dispose(){if(super.dispose(),this.children)for(let n=0;n<this.children.length;n++){const r=this.children[n];typeof r.dispose=="function"&&r.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}corner(){const n=this.getBoundingClientRect(!0);for(let r=0;r<this.children.length;r++){const o=this.children[r];o.translation.x-=n.left,o.translation.y-=n.top}return this.mask&&(this.mask.translation.x-=n.left,this.mask.translation.y-=n.top),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,o=n.top+n.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(n){let r=null;function o(s){if(s.id===n)return s;if(s.children){if(s.children.ids[n])return s.children.ids[n];for(let a=0;a<s.children.length;a++)if(r=o(s.children[a]),r)return r}return null}return o(this)}getByClassName(n){const r=[];function o(s){if(Array.prototype.indexOf.call(s.classList,n)>=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(n){const r=[];function o(s){if(s instanceof n&&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(n){n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let r=0;r<n.length;r++){const o=n[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(n){const r=arguments.length,o=this.parent;if(r<=0&&o)return o.remove(this),this;n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let s=0;s<n.length;s++){const a=n[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(n){let r,o,s,a,l,c;this._update(!0);let d=1/0,u=-1/0,h=1/0,f=-1/0;const g=/texture|gradient/i;o=n?this.matrix:this.worldMatrix;for(let m=0;m<this.children.length;m++){const p=this.children[m];if(!(!p.visible||g.test(p._renderer.type))&&(r=p.getBoundingClientRect(n),s=typeof r.top!="number"||Ie.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||Ie.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||Ie.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||Ie.isNaN(r.bottom)||!isFinite(r.bottom),!(s||a||l||c)))if(n){const[y,b]=o.multiply(r.left,r.top),[_,C]=o.multiply(r.right,r.top),[k,E]=o.multiply(r.left,r.bottom),[$,x]=o.multiply(r.right,r.bottom);h=go(b,C,E,x,h),d=go(y,_,k,$,d),u=po(y,_,k,$,u),f=po(b,C,E,x,f)}else h=go(r.top,h),d=go(r.left,d),u=po(r.right,u),f=po(r.bottom,f)}return{top:h,left:d,right:u,bottom:f,width:u-d,height:f-h}}noFill(){return this.children.forEach(function(n){n.noFill()}),this}noStroke(){return this.children.forEach(function(n){n.noStroke()}),this}subdivide(){const n=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,n)}),this}_update(){let n,r,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(n=0;n<this.children.length;n++)o=this.children[n],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}};S(an,"Children",rd),S(an,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let En=an;const bd={visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._flagVisible=this._visible!==t||this._flagVisible,this._visible=t}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!==t||this._flagOpacity,this._opacity=t}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._flagBeginning=this._beginning!==t||this._flagBeginning,this._beginning=t}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._flagEnding=this._ending!==t||this._flagEnding,this._ending=t}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let t=0;t<this.children.length;t++){const e=this.children[t];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){this._fill=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.fill=t}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){this._stroke=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.stroke=t}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.linewidth=t}}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.join=t}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.miter=t}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.cap=t}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.closed=t}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.curved=t}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){this._automatic=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.automatic=t}}},children:{enumerable:!0,get:function(){return this._children},set:function(t){const e=En.InsertChildren.bind(this),n=En.RemoveChildren.bind(this),r=En.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new rd(t),this._children.bind(te.Types.insert,e),this._children.bind(te.Types.remove,n),this._children.bind(te.Types.order,r),t.length>0&&e(t)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Ie.isObject(t)&&!t.clip&&(t.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.strokeAttenuation!==void 0&&(n.strokeAttenuation=t)}}}};function _d(t,e){const n=t.parent;let r;if(n===e){o();return}if(n&&n.children.ids[t.id]&&(r=Array.prototype.indexOf.call(n.children,t),n.children.splice(r,1),s()),e){o();return}s(),n._flagAdditions&&n.additions.length===0&&(n._flagAdditions=!1),n._flagSubtractions&&n.subtractions.length===0&&(n._flagSubtractions=!1),delete t.parent;function o(){e.subtractions.length>0&&(r=Array.prototype.indexOf.call(e.subtractions,t),r>=0&&e.subtractions.splice(r,1)),e.additions.length>0&&(r=Array.prototype.indexOf.call(e.additions,t),r>=0&&e.additions.splice(r,1)),t.parent=e,e.additions.push(t),e._flagAdditions=!0}function s(){r=Array.prototype.indexOf.call(n.additions,t),r>=0&&n.additions.splice(r,1),r=Array.prototype.indexOf.call(n.subtractions,t),r<0&&(n.subtractions.push(t),n._flagSubtractions=!0)}}class yo extends Me{constructor(e,n,r,o){const s=[new Fe(e,n),new Fe(r,o)];super(s);for(let a in wd)Object.defineProperty(this,a,wd[a]);this.vertices[0].command=pe.move,this.vertices[1].command=pe.line,this.automatic=!1}}S(yo,"Properties",["left","right"]);const wd={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if(Ie.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=pe.move;else{const e=new co("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(t){if(Ie.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=pe.line;else{const e=new co("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class Hs{constructor(e=0,n=0){this.x=e,this.y=n}}class _n{constructor(e=10,n=0,r="A"){S(this,"start",new Hs);S(this,"end",new Hs);this.width=e,this.angle=n,this.label=r}}const je={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"}},dy={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function uy(t,e){return i.openBlock(),i.createElementBlock("svg",dy,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"m289.94 256l95-95A24 24 0 0 0 351 127l-95 95l-95-95a24 24 0 0 0-34 34l95 95l-95 95a24 24 0 1 0 34 34l95-95l95 95a24 24 0 0 0 34-34Z"},null,-1)])])}const bo=i.markRaw({name:"ion-close",render:uy}),hy={class:"mr-3 flex flex-col gap-2"},fy=["onClick"],my={class:"h-full p-2"},gy={},py=i.defineComponent({...gy,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(t,{emit:e}){const n=t,r=i.ref(!1),o=i.useTemplateRef("drawing-template-containers"),s=i.useTemplateRef("drawing-custom-template-containers"),a=e,l=c=>{r.value=!0,a("remove-custom-template",c,()=>{r.value=!1})};return i.onMounted(()=>{var c,d;(c=n.settings.templates)==null||c.forEach((u,h)=>{var g;const f=(g=o.value)==null?void 0:g.at(h);f&&a("init-draw-template",f,u)}),(d=n.settings.customTemplates)==null||d.forEach((u,h)=>{var g;const f=(g=s.value)==null?void 0:g.at(h);f&&a("init-draw-template",f,u)})}),i.watch(()=>[...n.settings.customTemplates],(c,d)=>{i.nextTick(()=>{c.forEach((u,h)=>{var f;if(!(d!=null&&d.includes(u))){const g=(f=s.value)==null?void 0:f.at(h);g&&a("init-draw-template",g,u)}}),d.length>c.length&&d.forEach((u,h)=>{var g;const f=(g=s.value)==null?void 0:g.at(h);f&&(f.innerHTML="",a("init-draw-template",f,u))})})},{deep:!0}),(c,d)=>{const u=bo;return i.openBlock(),i.createBlock(i.unref(O.NScrollbar),{style:{width:"auto"},trigger:"none",class:"max-h-[19rem] md:max-h-[40rem] w-auto"},{default:i.withCtx(()=>[i.createElementVNode("div",hy,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.settings.allTemplates,(h,f)=>(i.openBlock(),i.createElementBlock("div",{key:`${h.id}-${f}`,class:"group relative"},[i.createVNode(i.unref(O.NPopover),{trigger:"hover",placement:"right"},{trigger:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["relative h-10 w-24 shrink-0 rounded-md border-2 border-solid border-slate-200",{"!border-green-700":f===t.selectTemplateIndex}]),onClick:g=>a("template:select",f)},[i.createElementVNode("div",my,[i.createElementVNode("div",{ref_for:!0,ref:h.isCustom&&h.id!==-1?"drawing-custom-template-containers":"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,fy)]),default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(h.label),1)]),_:2},1024),h.isCustom&&!h.isNewRec()?(i.openBlock(),i.createBlock(i.unref(O.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:g=>l(f)},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),xd=jn(py,[["__scopeId","data-v-afccb364"]]),yy={class:"flex gap-3 min-w-[20rem] relative"},by={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},_y={ref:"drawing-container",class:"size-full"},wy={},kd=i.defineComponent({...wy,__name:"kozyrek-configurator-preview",props:{settings:{},value:{},selectTemplateIndex:{}},emits:["pointer:move","pointer:up","template:select","remove-custom-template"],setup(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("drawing-container");let s=[],a=[],l=[],c=null;const d=.75,u=i.computed(()=>n.value.configuratorParams.linesAngles.map((D,H)=>new _n(n.value.configuratorParams.linesWidths[H],D,`A-${H+1}`))),h=i.computed(()=>n.value.configuratorParams.colorSide==="bottom"),f=i.computed(()=>{var D,H;return n.value.configuratorParams.startTailType&&((D=n.settings.startTailConfigs)!=null&&D[n.value.configuratorParams.startTailType])?(H=n.settings.startTailConfigs)==null?void 0:H[n.value.configuratorParams.startTailType].points:[]}),g=i.computed(()=>{var H;const D=n.value.configuratorParams.endTailType!==void 0&&((H=n.settings.endTailConfigs)==null?void 0:H[n.value.configuratorParams.endTailType]);return!D||!D.points?[]:D.points.map((L,A)=>Array.isArray(L)?new _n(L[0],L[1],`A-${A+1}`):new _n(L.width,L.angle,`A-${A+1}`))}),m=(D,H=!1)=>{D[0].start.x=0,D[0].start.y=0;let L=0;for(let A=0;A<D.length;A++){const z=D[A],U=D[A-1]??new _n(0,L);L+=!H||A>1?U.angle:0;const K=(!H||A>0?z.angle:0)+L;if(D[A].end.x=z.width*Math.cos(K*Math.PI/180)+D[A].start.x,D[A].end.y=z.width*Math.sin(K*Math.PI/180)+D[A].start.y,A<D.length-1){const F=A+1;D[F].start.x=D[A].end.x,D[F].start.y=D[A].end.y}}return D},p=(D,H,L,A,z=!1)=>{let U=m([...L,...A]);H.length>0&&(U=[...m(H),...U]);let K=0,F=0,q=0,Y=0;U.forEach(Te=>{K=Math.min(K,Te.start.x,Te.end.x),F=Math.min(F,Te.start.y,Te.end.y),q=Math.max(q,Te.start.x,Te.end.x),Y=Math.max(Y,Te.start.y,Te.end.y)});let J,ue;K===0&&F===0&&q===0&&Y===0?(J=1,ue=1):(J=D.width/Math.abs(q-K),ue=(z?D.height:D.height-je.colorSideLabel.size)/Math.abs(Y-F));const ve=Math.min(J,ue);return K=K<0?-K*ve:0,F=F<0?-F*ve:0,[ve,K,F]},y=D=>{const H=new mo([D]);return H._size=je.anchorPoint.size,H.fill=je.anchorPoint.color,H.stroke="transparent",H._linewidth=je.anchorPoint.strokeSize,l.push(H),H},b=(D,H)=>{if(l=[],n.settings.allowChangeFirstPoint){const L=D[0],A=new be(L.vertices[0].x,L.vertices[0].y);A.bind(te.Types.change,()=>{L.vertices[0].copy(A)});const z=y(A);H.add(z)}D.forEach((L,A)=>{const z=D[A+1],U=new be(L.vertices[1].x,L.vertices[1].y);U.bind(te.Types.change,()=>{L.vertices[1].copy(U),z!==void 0&&z.vertices[0].copy(U)});const K=y(U);H.add(K)})},_=D=>D*(Math.PI/180),C=(D,H,L)=>{const A=H.vertices.length-1;D.position.x=H.vertices[A].x,D.position.y=H.vertices[A].y;const z=Math.atan2(H.vertices[A].y-H.vertices[0].y,H.vertices[A].x-H.vertices[0].x);D.rotation=_(L)+z},k=(D,H,L)=>{if(H.vertices[0]===void 0)return;D.position.x=H.vertices[0].x,D.position.y=H.vertices[0].y;const A=H.vertices.length-1,z=Math.atan2(H.vertices[A].y-H.vertices[0].y,H.vertices[A].x-H.vertices[0].x);D.rotation=_(L)+z},E=(D,H,L)=>{const A=new En;if(D.length===0)return A;const z=[];return[...D].reverse().forEach((U,K)=>{K!==0&&U.angle>0&&(U.angle*=-1),z.push(U)}),D=m(z,!0),k(A,H,D[0].angle),[H.vertices[0],H.vertices[1]].forEach(U=>{U.bind(te.Types.change,()=>{k(A,H,D[0].angle)})}),D.forEach(U=>{const K=U.start.x*L,F=U.end.x*L,q=U.start.y*L,Y=U.end.y*L,J=new yo(K,q,F,Y);J.linewidth=je.line.size,J.stroke=je.line.color,A.add(J)}),A},$=(D,H,L)=>{const A=new En;return D.length===0||(D=m(D,!0),C(A,H,D[0].angle),[H.vertices[0],H.vertices[1]].forEach(z=>{z.bind(te.Types.change,()=>{C(A,H,D[0].angle)})}),D.forEach(z=>{const U=z.start.x*L,K=z.end.x*L,F=z.start.y*L,q=z.end.y*L,Y=new yo(U,F,K,q);Y.linewidth=je.line.size,Y.stroke=je.line.color,A.add(Y)})),A},x=(D,H,L,A)=>{const z=H.vertices[0].x+(H.vertices[1].x-H.vertices[0].x)/2-8*Math.sin(D.angle*Math.PI/180),U=H.vertices[0].y+(H.vertices[1].y-H.vertices[0].y)/2-8*Math.cos(D.angle*Math.PI/180),K=new Ui(D.label,z+10,U-10);let F;K.size=je.lineLabel.size,K.weight=600,K.fill=je.lineLabel.color,K.id+=1,K.rotation=je.lineLabel.rotation,A>0&&(F=new Ui(`${D.angle}°`,H.vertices[0].x+25,H.vertices[0].y-25),F.size=je.angleLabel.size,F.weight=600,F.fill=je.angleLabel.color,F.rotation=je.angleLabel.rotation,F.id+=A,s.push(F),L.add(F)),L.add(K),w(K,H,0,F),w(K,H,1)},B=()=>{const{size:D}=je.colorSideLabel,H=0,L=0,A=h.value?D/2:D/2-D,z=h.value?D/2-D:D/2,U=new En;if(!c)return U;const K=5,F=Math.atan2(z-A,L-H),q=[new Fe(H,A,0,0,0,0,pn.Commands.move),new Fe(L,z,0,0,0,0,pn.Commands.line),new Fe(L-K*Math.cos(F-Math.PI/4),z-K*Math.sin(F-Math.PI/4),0,0,0,0,pn.Commands.line),new Fe(L,z,0,0,0,0,pn.Commands.move),new Fe(L-K*Math.cos(F+Math.PI/4),z-K*Math.sin(F+Math.PI/4),0,0,0,0,pn.Commands.line)],Y=new Me(q,!1,!1,!0);Y.noFill(),Y.cap="round",Y.join="round",Y.linewidth=D/7,Y.stroke=je.colorSideLabel.color,U.add(Y);const J=new Ui(h.value?"Цвет снизу":"Цвет сверху",10,0);J.size=D,J.weight=600,J.fill=je.colorSideLabel.color,J.alignment="left",U.add(J);const ue=U.getBoundingClientRect();return U.position.x=(c.width-ue.width)*d+10,U.position.y=h.value?c.height+ue.height*2:ue.height/2,U},w=(D,H,L,A)=>{H.vertices[L].bind(te.Types.change,()=>{const z=H.vertices.length-1,U=Math.atan2(H.vertices[0].y-H.vertices[z].y,H.vertices[0].x-H.vertices[z].x)*180/Math.PI,K=H.vertices[0].x+(H.vertices[z].x-H.vertices[0].x)/2-8*Math.sin(U*Math.PI/180),F=H.vertices[0].y+(H.vertices[z].y-H.vertices[0].y)/2-8*Math.cos(U*Math.PI/180);D.position.x=K+10,D.position.y=F-10,D.rotation=-.5,A&&(A.position.x=H.vertices[0].x+25,A.position.y=H.vertices[0].y-25)})},T=(D,H,L,A,z=!1)=>{var We;if(D.clear(),L.length===0){D.update();return}const U=m(L),[K,F,q]=p(D,H,U,A,z),Y=new En,J=new Array,ue=new Array;z||(s=[],a=[]),U.forEach((ce,mt)=>{const Ne=ce.start.x*K+F,Pt=ce.end.x*K+F,Wt=ce.start.y*K+q,ln=ce.end.y*K+q,Ct=new yo(Ne,Wt,Pt,ln);Ct.linewidth=z?je.previewLine.size:je.line.size,Ct.stroke=z?je.previewLine.color:je.line.color,a.push(Ct),J.push(Ct),Y.add(Ct),!z&&ce.label!==""&&x(ce,Ct,Y,mt)});const ve=J.at(-1);let Te=Y.getBoundingClientRect();if(!z){const ce=B();ue.push(ce)}if(H.length>0){const ce=E(H,J[0],K);Y.add(ce)}if(A.length>0&&ve){const ce=$(A,ve,K);Y.add(ce)}if(ue.push(Y),D.makeGroup(ue),Te=Y.getBoundingClientRect(),Y.position.x=0-Te.left+(D.width-Te.width)/(2*(z?1:d)),Y.position.y=0-Te.top+(D.height-Te.height)/(2*(z?1:d)),D.update(),!z){const ce=((We=n.value.configuratorParams)==null?void 0:We.colorSide)==="top";Y.position.y=Y.position.y+je.colorSideLabel.size*Number(ce),b(J,Y),D.update()}},N=(D,H)=>{if(D&&!H.isNewRec()){const L=new pn({width:D.scrollWidth,height:D.scrollHeight});L.appendTo(D),T(L,[],H.points,[],!0)}},V=()=>{c&&T(c,f.value,u.value,g.value,!1)},R=D=>D*(180/Math.PI),I=(D,H)=>{const L=D[1].x-D[0].x,A=D[1].y-D[0].y,z=H[1].x-H[0].x,U=H[1].y-H[0].y;let K=Math.atan2(L*U-A*z,L*z+A*U);return K=R(K),Math.round(K)*-1},W=D=>{const H=a.map((L,A,z)=>{const U=z[A-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let K=Math.ceil(L._length/D/n.settings.lineWidthStep)*n.settings.lineWidthStep;const F=s[A-1];K<(z.length>1?n.settings.minLineWidth:n.settings.stripMinWidth)&&(K=z.length>1?n.settings.minLineWidth:n.settings.stripMinWidth),K>n.settings.maxLineWidth&&(K=n.settings.maxLineWidth);const q=I(L.vertices,U.vertices);return F&&(F.value=`${q}°`),new _n(K,q,`A-${A+1}`)});r("pointer:move",H)},ee=D=>{let H=null,L;const A=F=>{H=l.find(q=>{const Y=q.renderer;return(Y==null?void 0:Y.elem)===F.target}),[L]=p(D,f.value,u.value.map(q=>q),g.value)},z=F=>{if(H){const q=H.renderer,Y=q==null?void 0:q.elem;if(!Y)return;const J=Y.getBoundingClientRect();H.vertices[0].x-=J.x-(F instanceof MouseEvent?F.clientX:F.targetTouches[0].clientX)+je.anchorPoint.size/2,H.vertices[0].y-=J.y-(F instanceof MouseEvent?F.clientY:F.targetTouches[0].clientY)+je.anchorPoint.size/2,W(L),D.update()}},U=()=>{H&&r("pointer:up",u.value),H=null},K=o.value;K&&(K.addEventListener("touchstart",A,{passive:!0}),K.addEventListener("touchend",U,{passive:!0}),K.addEventListener("mousedown",A),K.addEventListener("mouseup",U),K.addEventListener("mousemove",z),K.addEventListener("touchmove",z,{passive:!0}))},ne=(D,H)=>{r("remove-custom-template",D,H)};return i.onMounted(()=>{o.value&&(c=new pn({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),i.watch(()=>n.value,()=>{V()},{deep:!0,immediate:!0}),ee(c))}),i.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(D,H)=>(i.openBlock(),i.createElementBlock("div",yy,[i.createVNode(xd,{"select-template-index":t.selectTemplateIndex,settings:t.settings,"onTemplate:select":H[0]||(H[0]=L=>r("template:select",L)),onInitDrawTemplate:N,onRemoveCustomTemplate:ne},null,8,["select-template-index","settings"]),i.createElementVNode("div",by,[i.createElementVNode("div",_y,null,512)])]))}});class Ki extends j.Identity{constructor(n,r){super();S(this,"label","");S(this,"points",[]);S(this,"isCustom",!1);S(this,"id",-1);S(this,"guid","");n?(this.label=n.label,this.points=n.points.map((o,s)=>M.isArray(o)?new _n(o[0],o[1],`A-${s+1}`):new _n(o.width,o.angle,`A-${s+1}`)),this.isCustom=n.isCustom):(this.label="-- Новая конфигурация --",this.points=[new _n(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class Ws extends Ki{constructor(n){super(n);S(this,"isDefault");this.isDefault=n.isDefault??!1}}class vd{constructor(e){S(this,"minLineWidth");S(this,"maxLineWidth");S(this,"lineWidthStep");S(this,"minLineAngle");S(this,"maxLineAngle");S(this,"lineAngleStep");S(this,"stripMinWidth");S(this,"stripMaxWidth");S(this,"stripMinLength");S(this,"stripMaxLength");S(this,"allowShowTable");S(this,"showOnlyTemplates");S(this,"templates");S(this,"customTemplates",[]);S(this,"startTailConfigs");S(this,"endTailConfigs");S(this,"bendCountForExtended");S(this,"extendedProductCatalog");S(this,"allowChangeFirstPoint");S(this,"allowSaveTemplates");S(this,"userTemplatesPrefix");S(this,"lengthStep");S(this,"canSetDopProdaga");var n,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 Ki(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((n=e.startTailConfigs)==null?void 0:n.map(o=>new Ws(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new Ws(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 Ki(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new Ki({label:"-- Новая конфигурация --",points:[new _n(this.stripMinWidth,0,"A-1")],isCustom:!0,id:-1,guid:""})))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(e){if(!this.allowSaveTemplates)return;const n=this.customTemplates.findLast(o=>!o.isNewRec()),r=new Ki(e);r.isCustom=!0,r.id=n?n.id+1:0,this.customTemplates.splice(-1,0,r)}removeCustomTemplate(e){if(!this.allowSaveTemplates)return;const n=this.customTemplates.findIndex(r=>r.id===e);n!==-1&&this.customTemplates.splice(n,1)}}const xy={class:"flex flex-col gap-3"},ky={class:"grid gap-5 md:grid-cols-5"},vy={},Cd=i.defineComponent({...vy,__name:"kozyrek-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{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(t,{emit:e}){const n=t,r=e,o=i.ref(!1),s=i.ref(!1),a=i.ref(!1),l=i.ref(n.cartItem),c=i.ref(new vd(n.settings)),d=i.ref({linesWidths:[...n.cartItem.configuratorParams.linesWidths],linesAngles:[...n.cartItem.configuratorParams.linesAngles]}),u=i.ref({quantity:{},marker:{},length:{}}),h=i.ref(0),f=i.useTemplateRef("kozyrek-configurator-params-form"),g=(w=0)=>{var N;const T=(N=c.value.allTemplates)==null?void 0:N.at(w);T!==void 0&&(h.value=w,l.value.configuratorParams.linesWidths=T.points.map(V=>M.isArray(V)?V[0]:V.width),l.value.configuratorParams.linesAngles=T.points.map(V=>M.isArray(V)?V[1]:V.angle),C()),b(l.value.configuratorParams)},m=async()=>{const w=prompt("Введите название шаблона:");if(!w)return;a.value=!0;const T={label:w,points:l.value.configuratorParams.linesWidths.map((V,R)=>[V,l.value.configuratorParams.linesAngles[R]])},N=V=>{V&&(c.value.addCustomTemplate(T),h.value=c.value.allTemplates.length-2),a.value=!1};n.eventEmitter.emit("configurator:create-template",{category:n.cartItem.category,template:T,callback:N})},p=async(w,T)=>{var R;const N=(R=c.value.allTemplates)==null?void 0:R.at(w);if(!N||!N.isCustom)return;const V=I=>{I&&(c.value.removeCustomTemplate(N.id),g()),T==null||T()};n.eventEmitter.emit("configurator:remove-template",{category:n.cartItem.category,templateId:N.id,callback:V})},y=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(h.value=c.value.allTemplates.length-1)},b=async w=>{var T,N;l.value.product=new j.ClientProduct,(N=(T=f.value)==null?void 0:T.formReference)==null||N.validate(V=>{V||(C(),o.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:w,validationFieldResultData:u.value,callback:R=>{R?l.value.product=R:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(M.noop)},_=async()=>{var w,T;(T=(w=f.value)==null?void 0:w.formReference)==null||T.validate(N=>{var V,R;if(!N){s.value=!0;const I=new j.OrderItemBase(l.value);(V=c.value.startTailConfigs)!=null&&V.length||delete I.configuratorParams.startTailType,(R=c.value.endTailConfigs)!=null&&R.length||delete I.configuratorParams.endTailType,r("submit",I,u.value,()=>{s.value=!1,i.nextTick(()=>{var W,ee;(ee=(W=f.value)==null?void 0:W.formReference)==null||ee.restoreValidation()})})}}).catch(M.noop)},C=()=>{const w={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach((T,N)=>{w[`lines_widths[${N+1}]`]={},w[`lines_angles[${N+1}]`]={}}),u.value=w},k=w=>{d.value.linesWidths=w.map(T=>T.width),d.value.linesAngles=w.map(T=>T.angle)},E=w=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,C(),y(),b(l.value.configuratorParams)},$=(w,T)=>{d.value.linesWidths=w,d.value.linesAngles=T},x=w=>{const T=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,N=0;l.value.configuratorParams.linesWidths.splice(w+1,0,T),l.value.configuratorParams.linesAngles.splice(w+1,0,N),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],C(),y(),b(l.value.configuratorParams)},B=w=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(w,1),l.value.configuratorParams.linesAngles.splice(w,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],C(),y(),b(l.value.configuratorParams))};return i.onBeforeMount(()=>{n.cartItem.isNewRec()?g():(C(),b(l.value.configuratorParams))}),i.watch(()=>n.cartItem,w=>{l.value=new j.OrderItemBase(w),w.isNewRec()?g():(C(),b(l.value.configuratorParams))}),(w,T)=>{const N=O.NButton;return i.openBlock(),i.createElementBlock("div",xy,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(N,{key:0,type:"tertiary",class:"self-end",onClick:T[0]||(T[0]=V=>r("click:view-switch"))},{default:i.withCtx(()=>[...T[3]||(T[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",ky,[i.createVNode(kd,{value:l.value,"select-template-index":h.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":E,"onPointer:move":k,"onTemplate:select":g,onRemoveCustomTemplate:p},null,8,["value","select-template-index","settings"]),i.createVNode(ll,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":T[1]||(T[1]=V=>l.value=V),"preview-params":d.value,validation:u.value,settings:c.value,"is-submit-processing":s.value,"is-product-searching":o.value,"select-template-index":h.value,class:"col-span-2","onUpdate:params":T[2]||(T[2]=V=>b(V)),"onUpdate:preview":$,onSubmit:_,"onClick:saveTemplate":m,"onClick:addLine":x,"onClick:removeLine":B},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),Cy={class:"flex flex-col items-center justify-between rounded-xl"},Sy={class:"img-preview relative flex justify-center"},By={},Ty=i.defineComponent({...By,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(t,{emit:e}){const n=t,r=i.computed(()=>{const{height:s}=n.configuratorParams,a=M.keys(n.settings.crossbarCount).reverse().find(l=>{const c=n.settings.crossbarCount[Number(l)];return s>=c});if(a!==void 0)return String(Number(a)+1)}),o=e;return(s,a)=>{const l=O.NButton;return i.openBlock(),i.createElementBlock("div",Cy,[i.createElementVNode("div",Sy,[a[1]||(a[1]=i.createElementVNode("div",{class:"window"},null,-1)),i.createElementVNode("div",{class:i.normalizeClass(["net",`net-${t.configuratorParams.netType}`])},null,2),i.createElementVNode("div",{class:i.normalizeClass(["frame",`frame-${t.configuratorParams.color}`])},null,2),r.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["frame-crossbar",`frame-crossbar-${r.value}-${t.configuratorParams.color}`])},null,2)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["mount",`mount-${t.configuratorParams.mountType}-${t.configuratorParams.color}`])},null,2),i.createElementVNode("div",{class:i.normalizeClass(["cut-preview",`cut-preview-${t.configuratorParams.mountType}-${t.configuratorParams.color}`])},null,2)]),i.createVNode(l,{type:"primary",class:"block justify-self-center",onClick:a[0]||(a[0]=c=>o("open-instructions"))},{default:i.withCtx(()=>[...a[2]||(a[2]=[i.createTextVNode(" Руководство по замеру ",-1)])]),_:1})])}}}),js=jn(Ty,[["__scopeId","data-v-a67fd61e"]]),Ny={key:0,class:"flex items-baseline gap-1"},$y={key:0,class:"flex items-baseline gap-1"},Ey={key:1},Ry={class:"text-lg font-semibold"},Py={key:2,class:"text-red-500 text-sm mb-2"},Fy={class:"flex gap-3"},Vy={},Sd=i.defineComponent({...Vy,__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(t,{expose:e,emit:n}){var x;const r=t,o=n,s=i.computed(()=>St.isPhoneDevice()),a=i.useTemplateRef("form-reference"),l=i.useTemplateRef("width-form-item-reference"),c=i.useTemplateRef("height-form-item-reference"),d=i.useTemplateRef("width-input-reference"),u=i.ref(M.cloneDeep(r.value)),h=i.computed(()=>r.settings.widthOverlaps[u.value.configuratorParams.mountType]??0),f=i.computed(()=>r.settings.heightOverlaps[u.value.configuratorParams.mountType]??0),g=i.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),m=i.computed(()=>r.settings.maxHeights[u.value.configuratorParams.netType]),p=i.computed(()=>u.value.configuratorParams.width?u.value.configuratorParams.width+h.value:0),y=i.computed(()=>u.value.configuratorParams.height?u.value.configuratorParams.height+f.value:0),b=i.ref(r.settings.canSetDopProdaga??!1),_=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth-h.value),ae.max(g.value-h.value),ae.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[ae.required,ae.min(r.settings.minHeight-f.value),ae.max(m.value-f.value),ae.step(1),He.serverValidation(r.validation.height.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),C=i.computed(()=>{var R;const B=p.value,w=y.value,{quantity:T}=r.value,N=((R=r.value.product)==null?void 0:R.costRub)||0;if(!B||!w||!T||N===0)return null;const V=B*w/1e6;return(N*T*V).toLocaleString("ru-ru",{minimumFractionDigits:2})}),k=i.computed(()=>{const B=p.value,w=y.value,T=!!(B&&B>=r.settings.minWidth&&B<=r.settings.maxWidths[u.value.configuratorParams.netType]),N=!!(w&&w>=r.settings.minHeight&&w<=r.settings.maxHeights[u.value.configuratorParams.netType]),V=!!(r.value.quantity&&r.value.quantity>0);return T&&N&&V}),E=(B,w)=>{var V,R;const T=u.value.configuratorParams;B&&B in T&&(T[B]=w);const N={...T,width:p.value??0,height:y.value??0};B==="width"&&((V=l.value)==null||V.validate().catch(M.noop)),B==="height"&&((R=c.value)==null||R.validate().catch(M.noop)),i.nextTick(()=>{var W,ee;!((W=l.value)!=null&&W.validationErrored)&&!((ee=c.value)!=null&&ee.validationErrored)&&N.height&&N.width&&o("update:params",N),$("configuratorParams",N)})},$=(B,w)=>{const T=new j.OrderItemBase(r.value);T[B]=w,B==="configuratorParams"&&(T.product=new j.ClientProduct),o("update:value",T)};return i.watch(()=>r.value,B=>{const w=M.cloneDeep(i.toRaw(B)),T=w.configuratorParams.mountType,N=r.settings.widthOverlaps[T]??0,V=r.settings.heightOverlaps[T]??0;w.configuratorParams.width&&w.configuratorParams.width>0&&(w.configuratorParams.width-=N),w.configuratorParams.height&&w.configuratorParams.height>0&&(w.configuratorParams.height-=V),u.value=w},{deep:!0}),i.onMounted(()=>{var B;(B=d.value)==null||B.select()}),e({validate:(x=a.value)==null?void 0:x.validate,formReference:a}),(B,w)=>{const T=O.NCheckbox;return i.openBlock(),i.createBlock(i.unref(O.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",onKeydown:w[25]||(w[25]=i.withKeys(i.withModifiers(N=>o("submit",u.value),["prevent"]),["enter"]))},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:u.value.configuratorParams.netType,"onUpdate:value":[w[0]||(w[0]=N=>u.value.configuratorParams.netType=N),w[1]||(w[1]=N=>E("netType",N))],options:t.settings.netType.map(N=>({label:t.settings.descriptions.net_type[N],value:N}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:u.value.configuratorParams.color,"onUpdate:value":[w[2]||(w[2]=N=>u.value.configuratorParams.color=N),w[3]||(w[3]=N=>E("color",N))],options:t.settings.color.map(N=>({label:t.settings.descriptions.color[N],value:N}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:u.value.configuratorParams.mountType,"onUpdate:value":[w[4]||(w[4]=N=>u.value.configuratorParams.mountType=N),w[5]||(w[5]=N=>E("mountType",N))],options:t.settings.mountType.map(N=>({label:t.settings.descriptions.mount_type[N],value:N}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(O.NFormItem),{ref:"width-form-item-reference",path:"configuratorParams.width",label:`Ширина светового проёма от ${t.settings.minWidth-h.value} ${g.value?" до "+(g.value-h.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.width.showFeedback&&p.value>=t.settings.minWidth&&p.value<=t.settings.maxWidths[u.value.configuratorParams.netType]?(i.openBlock(),i.createElementBlock("div",Ny,[i.createVNode(i.unref(O.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Ширина готового изделия "+i.toDisplayString(p.value),1)]),_:1}),i.createVNode(i.unref(O.NButton),{quaternary:"",type:"info",size:"tiny",onClick:w[10]||(w[10]=N=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...w[26]||(w[26]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{ref:"width-input-reference",value:u.value.configuratorParams.width,"onUpdate:value":[w[6]||(w[6]=N=>u.value.configuratorParams.width=N),w[9]||(w[9]=N=>E("width",N))],parse:i.unref(it),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:w[7]||(w[7]=N=>i.unref(tt)(N)),onInput:w[8]||(w[8]=N=>i.unref(et)(t.validation,"width")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(O.NFormItem),{ref:"height-form-item-reference",path:"configuratorParams.height",label:`Высота светового проёма от ${t.settings.minHeight-f.value} ${m.value?" до "+(m.value-f.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.height.showFeedback&&y.value>=t.settings.minHeight&&y.value<=t.settings.maxHeights[u.value.configuratorParams.netType]?(i.openBlock(),i.createElementBlock("div",$y,[i.createVNode(i.unref(O.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Высота готового изделия "+i.toDisplayString(y.value),1)]),_:1}),i.createVNode(i.unref(O.NButton),{quaternary:"",type:"info",size:"tiny",onClick:w[15]||(w[15]=N=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...w[27]||(w[27]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[w[11]||(w[11]=N=>u.value.configuratorParams.height=N),w[14]||(w[14]=N=>E("height",N))],parse:i.unref(it),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:w[12]||(w[12]=N=>i.unref(tt)(N)),onInput:w[13]||(w[13]=N=>i.unref(et)(t.validation,"height")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(O.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:u.value.quantity,"onUpdate:value":[w[16]||(w[16]=N=>u.value.quantity=N),w[19]||(w[19]=N=>$("quantity",N??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:w[17]||(w[17]=N=>i.unref(tt)(N,!1)),onInput:w[18]||(w[18]=N=>i.unref(et)(t.validation,"quantity")),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(O.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:w[20]||(w[20]=N=>i.unref(et)(t.validation,"marker")),"onUpdate:value":w[21]||(w[21]=N=>{u.value.marker=N??null,$("marker",N??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),b.value?(i.openBlock(),i.createBlock(T,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":w[22]||(w[22]=N=>{u.value.isAdditionalSale=N??!1,$("isAdditionalSale",N??!1)})},{default:i.withCtx(()=>[...w[28]||(w[28]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(hr,{"is-product-searching":t.isProductSearching,product:u.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),C.value?(i.openBlock(),i.createElementBlock("div",Ey,[w[29]||(w[29]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",Ry,i.toDisplayString(C.value)+" ₽",1)])):i.createCommentVNode("",!0),k.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Py," Пожалуйста, заполните все обязательные поля корректно. ")),i.createElementVNode("div",Fy,[i.createVNode(i.unref(O.NButton),{loading:t.isSubmitProcessing,disabled:!k.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:w[23]||(w[23]=N=>o("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"]),s.value?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,type:"default",onClick:w[24]||(w[24]=N=>o("click:show-preview-drawer"))},{default:i.withCtx(()=>[...w[30]||(w[30]=[i.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1},8,["model","rules"])}}}),Iy="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",My="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",Ay="/img/configurators/mosquitto/measurement-instructions/mount.png",Oy="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",zy="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",Dy={class:"flex flex-col gap-6"},Ly={class:"flex gap-4"},Hy={class:"flex flex-col gap-2"},Wy={class:"flex gap-4"},jy={class:"flex flex-col gap-2"},qy={class:"flex gap-4"},Xy={class:"flex flex-col gap-2"},Yy={},Bd=i.defineComponent({...Yy,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(t,{emit:e}){const n=St.initRefDependingOnDeviceResolution("small","small","medium"),r=St.initRefDependingOnDeviceResolution(.98,.95,.8),o=i.computed(()=>window.innerWidth*r.value),s=e;return(a,l)=>{const c=O.NText;return i.openBlock(),i.createBlock(i.unref(O.NModal),{show:t.show,"show-icon":!1,size:i.unref(n),style:i.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:i.withCtx(()=>[i.createElementVNode("div",Dy,[i.createVNode(c,{type:"error",class:"text-base font-medium"},{default:i.withCtx(()=>[...l[3]||(l[3]=[i.createTextVNode(" Важно! Для того,что бы произвести замер, необходимо открыть оконную створку. ",-1)])]),_:1}),l[22]||(l[22]=i.createElementVNode("div",{class:"grid gap-6 md:grid-cols-2"},[i.createElementVNode("div",{class:"flex items-start gap-4"},[i.createElementVNode("img",{src:Iy,alt:"measurement-height",class:"w-[7.5rem]"}),i.createElementVNode("div",{class:"flex flex-col gap-2"},[i.createElementVNode("span",{class:"text-lg font-bold"},"Замер ширины"),i.createElementVNode("span",null,"Замерить по ширине световой проем оконной рамы. Размер учитывать c точностью до 1 мм")])]),i.createElementVNode("div",{class:"flex items-start gap-4"},[i.createElementVNode("img",{src:My,alt:"measurement-height",class:"w-[7.5rem]"}),i.createElementVNode("div",{class:"flex flex-col gap-2"},[i.createElementVNode("span",{class:"text-lg font-bold"},"Замер высоты"),i.createElementVNode("span",null,"Замерить по высоте световой проем оконной рамы. Размер учитывать с точностью до 1 мм")])])],-1)),i.createElementVNode("div",Ly,[l[9]||(l[9]=i.createElementVNode("img",{src:Ay,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Hy,[l[8]||(l[8]=i.createElementVNode("span",{class:"text-lg font-bold"},"Крепление на раме сетки",-1)),i.createElementVNode("span",null,[l[4]||(l[4]=i.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[5]||(l[5]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(t.widthOverlaps.frame)+" мм. Высота светового проема +"+i.toDisplayString(t.heightOverlaps.frame)+" мм. ",1),l[6]||(l[6]=i.createElementVNode("br",null,null,-1)),l[7]||(l[7]=i.createTextVNode(" Крепления находятся на раме сетки. ",-1))])])]),i.createElementVNode("div",Wy,[l[15]||(l[15]=i.createElementVNode("img",{src:Oy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",jy,[l[14]||(l[14]=i.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление пластик (верх+низ)",-1)),i.createElementVNode("span",null,[l[10]||(l[10]=i.createTextVNode(" Расчетные размеры москитной сетки:",-1)),l[11]||(l[11]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(t.widthOverlaps.external_plastic)+" мм. Высота светового проема +"+i.toDisplayString(t.heightOverlaps.external_plastic)+" мм. ",1),l[12]||(l[12]=i.createElementVNode("br",null,null,-1)),l[13]||(l[13]=i.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])]),i.createElementVNode("div",qy,[l[21]||(l[21]=i.createElementVNode("img",{src:zy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Xy,[l[20]||(l[20]=i.createElementVNode("span",{class:"text-lg font-bold"},"Z-Образное крепление металл (верх+низ)",-1)),i.createElementVNode("span",null,[l[16]||(l[16]=i.createTextVNode(" Расчетные размеры москитной сетки: ",-1)),l[17]||(l[17]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина светового проема +"+i.toDisplayString(t.widthOverlaps.external_metal)+" мм. Высота светового проема +"+i.toDisplayString(t.heightOverlaps.external_metal)+" мм. ",1),l[18]||(l[18]=i.createElementVNode("br",null,null,-1)),l[19]||(l[19]=i.createTextVNode(" Крепления прикручиваются к раме окна c помощью шурупов. ",-1))])])])])]),_:1},8,["show","size","style"])}}}),Uy={class:"grid md:grid-cols-2"},Ky={},Td=i.defineComponent({...Ky,__name:"mosquito-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{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(t,{emit:e}){const n=t,r=e,o=i.computed(()=>St.isPhoneDevice()),s=i.ref(!1),a=i.ref(!1),l=i.ref(n.cartItem),c=i.useTemplateRef("mosquito-configurator-form"),d=i.ref({width:{},height:{},quantity:{},marker:{}}),u=i.ref(!1),h=i.ref(!1),f=i.computed(()=>i.inject("debounce-input-time",300)),g=M.debounce(async p=>{var y,b;l.value.product=new j.ClientProduct,(b=(y=c.value)==null?void 0:y.formReference)==null||b.validate(_=>{_||(u.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:p,validationFieldResultData:d.value,callback:C=>{C?l.value.product=C:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(M.noop)},f.value),m=()=>{h.value=!0,r("submit",l.value,d.value,()=>{h.value=!1})};return i.watch(()=>n.cartItem,p=>{l.value=p},{deep:!0}),(p,y)=>{const b=bo;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(Bd,{show:a.value,"onUpdate:show":y[0]||(y[0]=_=>a.value=_),"height-overlaps":t.settings.heightOverlaps,"width-overlaps":t.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),i.createElementVNode("div",Uy,[o.value?(i.openBlock(),i.createBlock(i.unref(O.NDrawer),{key:1,show:s.value,"onUpdate:show":y[4]||(y[4]=_=>s.value=_),"default-width":375,resizable:""},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NDrawerContent),null,{header:i.withCtx(()=>[i.createVNode(i.unref(O.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:y[2]||(y[2]=_=>s.value=!1)},{default:i.withCtx(()=>[i.createVNode(b)]),_:1})]),default:i.withCtx(()=>[i.createVNode(js,{"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:y[3]||(y[3]=_=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(i.openBlock(),i.createBlock(js,{key:0,"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:y[1]||(y[1]=_=>a.value=!0)},null,8,["configurator-params","settings"])),i.createVNode(Sd,{ref:"mosquito-configurator-form",value:l.value,"onUpdate:value":y[5]||(y[5]=_=>l.value=_),validation:d.value,settings:t.settings,"is-product-searching":u.value,"is-submit-processing":h.value,"onUpdate:params":y[6]||(y[6]=_=>i.unref(g)(_)),onSubmit:y[7]||(y[7]=_=>m()),"onClick:instructionsToggle":y[8]||(y[8]=_=>a.value=!a.value),"onClick:showPreviewDrawer":y[9]||(y[9]=_=>s.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),Gy={},Nd=i.defineComponent({...Gy,__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},validation:{}},emits:["update:value","click:add-line","click:remove-line"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.useTemplateRef("width-input-element"),a=i.ref(!1),l=i.ref(r.value),c=i.useTemplateRef("form-item-reference"),d=i.computed(()=>{var f;return!((f=c.value)!=null&&f.validationErrored)}),u=f=>{l.value=f,o("update:value",f,r.index,a)},h=()=>{var f;(f=s.value)==null||f.select()};return i.watch(()=>r.value,f=>{l.value=f}),i.onMounted(()=>{r.autoFocus&&i.nextTick(()=>{h()})}),e({isValid:d,formItemReference:c}),(f,g)=>{const m=al,p=jr;return i.openBlock(),i.createBlock(i.unref(O.NFormItem),{ref:"form-item-reference",path:t.path,label:`Полоса №${t.index+1}, мм`,class:"sc-hide-empty-feedback-message"},{feedback:i.withCtx(()=>[d.value?(i.openBlock(),i.createBlock(hr,{key:0,"is-product-searching":a.value,product:t.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(i.unref(O.NDropdown),{trigger:"click",options:t.suggestionOption,placement:"bottom-start",size:"large",onSelect:u},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{ref:"width-input-element",value:l.value??null,class:"w-full","show-button":!1,parse:i.unref(it),placeholder:"Введите ширину",onKeydown:g[0]||(g[0]=y=>i.unref(tt)(y)),onInput:g[1]||(g[1]=y=>i.unref(et)(t.validation,`linesWidths.${t.index}`)),onFocus:i.unref(Le),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),i.createVNode(i.unref(O.NButton),{disabled:t.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:g[2]||(g[2]=y=>o("click:add-line",t.index))},{default:i.withCtx(()=>[i.createVNode(m)]),_:1},8,["disabled"]),i.createVNode(i.unref(O.NButton),{disabled:t.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:g[3]||(g[3]=y=>o("click:remove-line",t.index))},{default:i.withCtx(()=>[i.createVNode(p)]),_:1},8,["disabled"])]),_:1},8,["path","label"])}}}),Zy={class:"my-2 flex w-full flex-col"},Qy={key:1},Jy={class:"text-lg font-semibold"},e0={class:"flex gap-3"},t0={},$d=i.defineComponent({...t0,__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(t,{expose:e,emit:n}){var _;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("line-items-reference"),l=i.ref(M.cloneDeep(r.value)),c=i.computed(()=>{const C={length:[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(r.settings.lengthStep),He.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]};return M.forEach(l.value,(k,E)=>{var $;C[`configuratorParams.linesWidths.${E}`]=[ae.required,ae.min(r.settings.minLineWidth),ae.step(r.settings.lineWidthStep),He.serverValidation(($=r.validation[`linesWidths.${E}`])==null?void 0:$.feedback)]}),C}),d=i.ref(r.settings.canSetDopProdaga??!1),u=i.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((C,k)=>(C??0)+(k??0),0)),h=i.computed(()=>r.settings.width-u.value),f=i.computed(()=>!r.value.some(({product:C})=>!C||C.isNewRec())),g=i.computed(()=>r.isSubmitProcessing||!f.value||h.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(C=>C.product.isNewRec())),m=i.computed(()=>C=>h.value===0?void 0:[{label:`${(h.value>0?"Остаток +":"Излишек ")+h.value} мм.`,key:h.value+C}]),p=i.computed(()=>{const{length:C}=r.value[0];return!C||u.value!==r.settings.width?null:(M.reduce(r.value,(E,$)=>{var B;const x=((B=$.product)==null?void 0:B.costRub)||0;return E+x},0)*r.value[0].quantity*C).toLocaleString("ru-ru",{minimumFractionDigits:2})}),y=(C,k,E)=>{var x,B,w;l.value[k].product.id=-1;const{configuratorParams:$}=l.value[k];$.linesWidths[k]=C,b("configuratorParams",$),(w=(B=(x=a.value)==null?void 0:x.at(k))==null?void 0:B.formItemReference)==null||w.validate().catch(M.noop),i.nextTick(()=>{var T,N;(N=(T=a.value)==null?void 0:T.at(k))!=null&&N.isValid&&o("update:params",$,k,E)})},b=(C,k)=>{l.value.forEach(E=>{E[C]=k}),o("update:value",l.value)};return i.watch(()=>r.value,C=>{l.value=M.cloneDeep(C)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(C,k)=>{const E=O.NCheckbox;return i.openBlock(),i.createBlock(i.unref(O.NForm),{ref:"form-reference",model:l.value[0],rules:c.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message",onKeydown:k[15]||(k[15]=i.withKeys(i.withModifiers($=>o("submit",l.value),["prevent"]),["enter"]))},{default:i.withCtx(()=>{var $;return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(x,B)=>{var w,T,N;return i.openBlock(),i.createBlock(Nd,{key:B,ref_for:!0,ref:"line-items-reference",value:((w=x.configuratorParams)==null?void 0:w.linesWidths.at(B))??null,"auto-focus":(((T=x.configuratorParams)==null?void 0:T.linesWidths.at(B))??0)===0,index:B,path:`configuratorParams.linesWidths.${B}`,product:x.product,settings:t.settings,validation:t.validation,"suggestion-option":m.value(((N=x.configuratorParams)==null?void 0:N.linesWidths.at(B))??0),"add-line-button-disabled":h.value<=0||t.value.length>=t.settings.maxLinesCount||t.value.some(V=>V.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"onUpdate:value":y,"onClick:addLine":k[0]||(k[0]=V=>o("click:add-line",V)),"onClick:removeLine":k[1]||(k[1]=V=>o("click:remove-line",V))},null,8,["value","auto-focus","index","path","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled"])}),128)),i.createElementVNode("div",Zy,[h.value<0?(i.openBlock(),i.createBlock(i.unref(O.NText),{key:0,type:"error"},{default:i.withCtx(()=>[i.createTextVNode(" Сумма ширин всех полос должна быть равна "+i.toDisplayString(t.settings.width),1)]),_:1})):i.createCommentVNode("",!0),f.value&&l.value.length===t.settings.maxLinesCount&&h.value>0?(i.openBlock(),i.createBlock(i.unref(O.NText),{key:1,type:"error"},{default:i.withCtx(()=>[...k[16]||(k[16]=[i.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",null,[k[17]||(k[17]=i.createTextVNode(" Остаток для резки: ",-1)),i.createVNode(i.unref(O.NText),{type:h.value>=0?"Success":"error"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(h.value),1)]),_:1},8,["type"]),i.createTextVNode(" из "+i.toDisplayString(t.settings.width)+" мм ",1)])]),i.createVNode(i.unref(O.NButton),{disabled:g.value,type:"primary",class:"self-center",onClick:k[2]||(k[2]=x=>o("click:add-line",l.value.length))},{default:i.withCtx(()=>[...k[18]||(k[18]=[i.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["disabled"]),i.createVNode(i.unref(O.NFormItem),{path:"length",label:`Метраж ${t.settings.minLength?" от "+t.settings.minLength:""} ${t.settings.maxLength?" до "+t.settings.maxLength:""} м.`},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:l.value[0].length,"onUpdate:value":[k[3]||(k[3]=x=>l.value[0].length=x),k[6]||(k[6]=x=>b("length",x))],parse:i.unref(it),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:k[4]||(k[4]=x=>i.unref(tt)(x,!1)),onInput:k[5]||(k[5]=x=>i.unref(et)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(O.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:l.value[0].quantity,"onUpdate:value":[k[7]||(k[7]=x=>l.value[0].quantity=x),k[10]||(k[10]=x=>b("quantity",x))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:k[8]||(k[8]=x=>i.unref(tt)(x,!1)),onInput:k[9]||(k[9]=x=>i.unref(et)(t.validation,"quantity")),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(O.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:l.value[0].marker??null,placeholder:"Введите маркировку",onInput:k[11]||(k[11]=x=>i.unref(et)(t.validation,"marker")),"onUpdate:value":k[12]||(k[12]=x=>{l.value[0].marker=x??null,b("marker",x??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(E,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":k[13]||(k[13]=x=>{l.value[0].isAdditionalSale=x??!1,b("isAdditionalSale",x??!1)})},{default:i.withCtx(()=>[...k[19]||(k[19]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),p.value?(i.openBlock(),i.createElementBlock("div",Qy,[k[20]||(k[20]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",Jy,i.toDisplayString(p.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",e0,[i.createVNode(i.unref(O.NButton),{loading:t.isSubmitProcessing,disabled:!f.value||h.value!=0||!(($=l.value[0])!=null&&$.length)||l.value[0].length>t.settings.maxLength||l.value[0].length<t.settings.minLength||l.value[0].quantity===0,type:"primary",class:"self-start",onClick:k[14]||(k[14]=x=>o("submit",l.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(l.value[0].isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])}}}),n0={class:"flex grow flex-col"},i0=["src"],r0={class:"w-full"},o0={},Ed=i.defineComponent({...o0,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",n0,[i.createElementVNode("img",{src:"/img/configurators/strip/strip-"+t.value.length+".png",class:"w-full max-w-96 self-center py-5",alt:"Штрипс"},null,8,i0),i.createElementVNode("div",r0,[i.createTextVNode(" Число полос можно указать от "+i.toDisplayString(t.settings.minLinesCount)+" до "+i.toDisplayString(t.settings.maxLinesCount)+". ",1),n[0]||(n[0]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Минимальная ширина полосы "+i.toDisplayString(t.settings.minLineWidth)+" мм. ",1),n[1]||(n[1]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Ширина всех полос "+i.toDisplayString(t.settings.width)+" мм. ",1),n[2]||(n[2]=i.createElementVNode("br",null,null,-1)),i.createTextVNode(" Шаг ширины полосы - "+i.toDisplayString(t.settings.lineWidthStep)+" мм. ",1)])]))}}),s0={class:"flex flex-col gap-2"},a0={class:"w-104 flex grow flex-col px-5"},l0={},Rd=i.defineComponent({...l0,__name:"strip-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{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(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("strip-configurator-form"),s=i.ref(n.cartItems),a=i.ref({width:{},length:{},quantity:{},marker:{}}),l=i.ref(!1),c=i.computed(()=>i.inject("debounce-input-time",300)),d=i.computed(()=>{var m;return(m=s.value[0].configuratorParams)==null?void 0:m.linesWidths.reduce((p,y)=>(p??0)+(y??0),0)}),u=m=>{m===void 0&&(m=s.value.length-1);const p=s.value.at(0);if(!p)return;p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(m+1,0,null),s.value.forEach(b=>{b.configuratorParams.linesWidths=p.configuratorParams.linesWidths});const y=new j.OrderItemBase({quantity:(p==null?void 0:p.quantity)??1,category:p==null?void 0:p.category,length:(p==null?void 0:p.length)??n.settings.minLength,marker:p==null?void 0:p.marker,configuratorParams:{linesWidths:p==null?void 0:p.configuratorParams.linesWidths}});s.value=s.value.toSpliced(m+1,0,y)},h=m=>{const p=s.value.at(0);p&&(p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(m,1),s.value.forEach(y=>{y.configuratorParams.linesWidths=p.configuratorParams.linesWidths}),s.value=s.value.toSpliced(m,1),delete a[`linesWidths.${m}`],delete a[`linesWidths.${m}`])},f=M.debounce(async(m,p,y)=>{const b={linesWidths:m.linesWidths.at(p)};y.value=!0,a.value[`linesWidths.${p}`]={},s.value[p].product=new j.ClientProduct,n.eventEmitter.emit("configurator:search-product",{category:s.value[p].category,params:b,validationFieldResultData:a.value,callback:_=>{_?(s.value[p].product=_,p===s.value.length-1&&s.value.length<n.settings.maxLinesCount&&d.value&&d.value<n.settings.width&&u()):(s.value[p].product=new j.ClientProduct,a.value[`linesWidths.${p}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},y.value=!1),y.value=!1}})},c.value),g=async()=>{var m,p;(p=(m=o.value)==null?void 0:m.formReference)==null||p.validate(y=>{if(!y){l.value=!0;const b=s.value.at(0);if(!b)return;r("submit",b,a.value,()=>{l.value=!1,i.nextTick(()=>{var _,C;(C=(_=o.value)==null?void 0:_.formReference)==null||C.restoreValidation()})})}}).catch(M.noop)};return i.watch(()=>n.cartItems,m=>{s.value=m.map(p=>new j.OrderItemBase(p))}),(m,p)=>{const y=O.NButton;return i.openBlock(),i.createElementBlock("div",s0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(y,{key:0,type:"tertiary",class:"self-center",onClick:p[0]||(p[0]=b=>r("click:view-switch"))},{default:i.withCtx(()=>[...p[3]||(p[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",a0,[i.createVNode(Ed,{value:s.value,"onUpdate:value":p[1]||(p[1]=b=>s.value=b),settings:t.settings},null,8,["value","settings"]),i.createVNode($d,{ref:"strip-configurator-form",value:s.value,"onUpdate:value":p[2]||(p[2]=b=>s.value=b),validation:a.value,settings:t.settings,"is-submit-processing":l.value,"onUpdate:params":i.unref(f),onSubmit:g,"onClick:addLine":u,"onClick:removeLine":h},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),c0={class:"flex flex-col gap-3"},d0={},Pd=i.defineComponent({...d0,__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(t,{expose:e,emit:n}){var g;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("first-input-element"),l=i.ref(M.cloneDeep(r.value)),c=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth),...r.settings.maxWidth?[ae.max(r.settings.maxWidth)]:[],ae.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(1),He.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),d=i.ref(r.settings.canSetDopProdaga??!1),u=()=>{o("update:params",l.value.configuratorParams),h("configuratorParams",l.value.configuratorParams)},h=(m,p)=>{const y=new j.OrderItemBase(r.value);y[m]=p,m==="configuratorParams"&&(y.product=new j.ClientProduct),o("update:value",y)},f=()=>{var m;(m=a.value)==null||m.select()};return i.watch(()=>r.value,m=>{l.value=M.cloneDeep(m)},{deep:!0}),i.onMounted(()=>{r.value.isNewRec()&&i.nextTick(()=>{f()})}),e({validate:(g=s.value)==null?void 0:g.validate,formReference:s}),(m,p)=>{const y=O.NCheckbox;return i.openBlock(),i.createBlock(i.unref(O.NForm),{ref:"form-reference",model:l.value,rules:c.value,disabled:t.isSubmitProcessing,class:"flex flex-col gap-2 sc-hide-empty-feedback-message",onKeydown:p[13]||(p[13]=i.withKeys(i.withModifiers(b=>o("submit",l.value),["prevent"]),["enter"]))},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NFormItem),{path:"configuratorParams.width",label:`Ширина, ${t.settings.minWidth?" от "+t.settings.minWidth:""}${t.settings.maxWidth?" до "+t.settings.maxWidth:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{ref:"first-input-element",value:l.value.configuratorParams.width,"onUpdate:value":[p[0]||(p[0]=b=>l.value.configuratorParams.width=b),u],class:"w-full",parse:i.unref(it),"show-button":!1,placeholder:"Введите ширину",onKeydown:p[1]||(p[1]=b=>i.unref(tt)(b)),onInput:p[2]||(p[2]=b=>i.unref(et)(t.validation,"width")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(O.NFormItem),{path:"configuratorParams.length",label:`Длина, ${t.settings.minLength?" от "+t.settings.minLength:""}${t.settings.maxLength?" до "+t.settings.maxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[p[3]||(p[3]=b=>l.value.configuratorParams.length=b),u],placeholder:"Введите длину",parse:i.unref(it),"show-button":!1,class:"w-full",onKeydown:p[4]||(p[4]=b=>i.unref(tt)(b)),onInput:p[5]||(p[5]=b=>i.unref(et)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(O.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:t.value.quantity,placeholder:"Введите количество",min:1,"show-button":!1,class:"w-full",onKeydown:p[6]||(p[6]=b=>i.unref(tt)(b,!1)),onInput:p[7]||(p[7]=b=>i.unref(et)(t.validation,"quantity")),"onUpdate:value":p[8]||(p[8]=b=>h("quantity",b??0)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(O.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:t.value.marker??null,placeholder:"Введите маркировку",onInput:p[9]||(p[9]=b=>i.unref(et)(t.validation,"marker")),"onUpdate:value":p[10]||(p[10]=b=>h("marker",b??null)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(y,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":p[11]||(p[11]=b=>{l.value.isAdditionalSale=b??!1,h("isAdditionalSale",b??!1)})},{default:i.withCtx(()=>[...p[14]||(p[14]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(hr,{"is-product-searching":t.isProductSearching,product:t.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),i.createElementVNode("div",c0,[i.createVNode(i.unref(O.NButton),{disabled:t.value.product.isNewRec()||t.isProductSearching||t.isSubmitProcessing||t.value.length===0||t.value.width===0||t.value.quantity===0,type:"primary",class:"self-start",onClick:p[12]||(p[12]=b=>o("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["model","rules","disabled"])}}}),u0={class:"flex flex-col gap-2 w-72"},h0={},Fd=i.defineComponent({...h0,__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]},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(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("metal-for-doors-configurator-form"),s=i.ref(n.cartItem),a=i.ref({width:{},length:{},quantity:{},marker:{}}),l=i.ref(!1),c=i.ref(!1),d=i.computed(()=>i.inject("debounce-input-time",300)),u=M.debounce(async f=>{var g,m;s.value.product=new j.ClientProduct,(m=(g=o.value)==null?void 0:g.formReference)==null||m.validate(p=>{p||(l.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:f,validationFieldResultData:a.value,callback:y=>{y?s.value.product=y:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(M.noop)},d.value),h=async()=>{var f,g;(g=(f=o.value)==null?void 0:f.formReference)==null||g.validate(m=>{m||(c.value=!0,r("submit",s.value,a.value,()=>{c.value=!1,i.nextTick(()=>{var p,y;(y=(p=o.value)==null?void 0:p.formReference)==null||y.restoreValidation()})}))}).catch(M.noop)};return i.watch(()=>n.cartItem,f=>{s.value=new j.OrderItemBase(f)},{deep:!0}),(f,g)=>{const m=O.NButton;return i.openBlock(),i.createElementBlock("div",u0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(m,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=p=>r("click:view-switch"))},{default:i.withCtx(()=>[...g[4]||(g[4]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Pd,{ref:"metal-for-doors-configurator-form",value:s.value,"onUpdate:value":g[1]||(g[1]=p=>s.value=p),validation:a.value,settings:t.settings,"is-submit-processing":c.value,"is-product-searching":l.value,"onUpdate:params":g[2]||(g[2]=p=>i.unref(u)(p)),onSubmit:g[3]||(g[3]=p=>h())},null,8,["value","validation","settings","is-submit-processing","is-product-searching"])])}}}),f0={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function m0(t,e){return i.openBlock(),i.createElementBlock("svg",f0,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M256 112v288m144-144H112"},null,-1)])])}const Vd=i.markRaw({name:"ion-add",render:m0}),g0={key:0,class:"-mt-1 text-sm text-gray-500"},p0={class:"font-bold"},y0={class:"flex flex-col gap-3"},b0={key:0,class:"mt-4 flex flex-col gap-1.5"},_0={class:"flex flex-col gap-1 text-sm text-gray-700"},w0={key:0},x0={key:1},k0={"form-array-name":"items",class:"flex flex-col gap-3"},v0={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},C0={key:0,class:"flex flex-wrap items-end gap-2"},S0={class:"whitespace-nowrap text-xl font-bold"},B0={key:0,class:"whitespace-nowrap text-lg text-gray-500"},T0={class:"font-bold"},N0={class:"font-bold"},$0={class:"flex gap-3"},E0={},Id=i.defineComponent({...E0,__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]},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(t,{expose:e,emit:n}){var H;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.ref(M.cloneDeep(r.value)),l=i.ref({...r.validation}),c=L=>{var A;delete l.value[L],(A=s.value)==null||A.restoreValidation()};i.watch(()=>r.validation,L=>{l.value={...L},Object.values(L).some(z=>z==null?void 0:z.feedback)&&i.nextTick(()=>{var z;return(z=s.value)==null?void 0:z.validate(M.noop).catch(M.noop)})},{deep:!0});const d=i.computed(()=>r.value.category),u=i.ref(null),h=i.ref(null),f=i.computed(()=>d.value.products??[]),g=i.computed(()=>f.value.map(L=>({label:L.name,value:L.id}))),m=(L,A,z)=>{const U=L!=null&&L>0,K=A!=null&&A>0;return!U&&!K?null:U&&K?`от ${L} ${z} до ${A} ${z}`:U?`от ${L} ${z}`:`до ${A} ${z}`},p=i.computed(()=>{var L,A;return m(r.settings.minWidth,(A=(L=u.value)==null?void 0:L.properties)==null?void 0:A.width,"мм")}),y=i.computed(()=>{var L,A;return m(r.settings.minLength,(A=(L=u.value)==null?void 0:L.properties)==null?void 0:A.length,"мм")}),b=i.ref(null),_=i.ref(!1);i.computed(()=>{var L,A;return(A=(L=u.value)==null?void 0:L.properties)!=null&&A.width?ae.max(u.value.properties.width):null}),i.computed(()=>{var L,A;return(A=(L=u.value)==null?void 0:L.properties)!=null&&A.length?ae.max(u.value.properties.length):null});const C=i.computed(()=>{var A;const L={marker:[He.serverValidation((A=l.value.marker)==null?void 0:A.feedback)]};return a.value.configuratorParams.items.forEach((z,U)=>{var K,F,q,Y,J,ue,ve;L[`configuratorParams.items.${U}.width`]=[ae.required,ae.min(r.settings.minWidth),...(F=(K=u.value)==null?void 0:K.properties)!=null&&F.width?[ae.max(u.value.properties.width)]:[],ae.step(1),He.serverValidation((q=l.value[`items.${U}.width`])==null?void 0:q.feedback)],L[`configuratorParams.items.${U}.length`]=[ae.required,ae.min(r.settings.minLength),...(J=(Y=u.value)==null?void 0:Y.properties)!=null&&J.length?[ae.max(u.value.properties.length)]:[],ae.step(1),He.serverValidation((ue=l.value[`items.${U}.length`])==null?void 0:ue.feedback)],L[`configuratorParams.items.${U}.count`]=[ae.required,ae.min(1),ae.step(1),He.serverValidation((ve=l.value[`items.${U}.count`])==null?void 0:ve.feedback)]}),L}),k=i.ref(r.settings.canSetDopProdaga??!1),E=i.computed(()=>a.value.configuratorParams.items.some(L=>{var A,z;return!u.value||!L.width||L.width<r.settings.minWidth||L.width>(((A=u.value.properties)==null?void 0:A.width)??0)||L.length===0||L.length<r.settings.minLength||L.length>(((z=u.value.properties)==null?void 0:z.length)??0)||!L.count||L.count<1})),$=i.computed(()=>!u.value||E.value||a.value.configuratorParams.items.length===0),x=i.ref(null),B=L=>{if(!L){u.value=null,h.value=null,a.value.product=new j.ClientProduct,b.value=null;return}const A=f.value.find(z=>z.id===L);A&&(u.value=A,h.value=L,a.value.product=A,ne("product",a.value.product),a.value.configuratorParams.items.forEach(z=>{var U,K;(U=A.properties)!=null&&U.width&&z.width>A.properties.width&&(z.width=A.properties.width),(K=A.properties)!=null&&K.length&&z.length>A.properties.length&&(z.length=A.properties.length)}),T())};let w=!1;const T=()=>{w=!0,b.value=null,x.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},N=async()=>{var L;if(!u.value||a.value.configuratorParams.items.length===0||E.value){T();return}(L=s.value)==null||L.validate(A=>{if(A){T();return}if(_.value=!0,!u.value||!d.value){T(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:z=>{z?(b.value=z,a.value.configuratorParams.calculationId=z.id,a.value.quantity=z.quantity,i.nextTick(()=>{ne("quantity",z.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,T()),ne("configuratorParams",a.value.configuratorParams),V(),_.value=!1}})}).catch(()=>{T(),_.value=!1})},V=()=>{var A;if(!((A=u.value)!=null&&A.costRub)||!b.value){x.value=null;return}const L=b.value.quantity*u.value.costRub;x.value=Math.round(L*100)/100},R=L=>{var z,U;const A=a.value.configuratorParams.items[L];u.value&&((z=u.value.properties)!=null&&z.width&&A.width>u.value.properties.width&&(A.width=u.value.properties.width),(U=u.value.properties)!=null&&U.length&&A.length>u.value.properties.length&&(A.length=u.value.properties.length)),ne("configuratorParams",a.value.configuratorParams),T()},I=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),ne("configuratorParams",a.value.configuratorParams),T(),o("add-item",a.value.configuratorParams.items.length)},W=L=>{a.value.configuratorParams.items.splice(L,1),ne("configuratorParams",a.value.configuratorParams),T(),o("remove-item",L)},ee=()=>{if(!($.value||_.value||r.isSubmitProcessing)){if(!b.value){N();return}o("submit",a.value)}},ne=(L,A)=>{const z=new j.OrderItemBase(r.value);z[L]=A,o("update:value",z)};i.watch(()=>r.value,L=>{const A=M.cloneDeep(i.toRaw(L));(!A.configuratorParams.items||A.configuratorParams.items.length===0)&&(A.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=A,r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,h.value=r.value.product.id),r.value.product.isNewRec()&&(u.value=null,h.value=null),w?w=!1:D()},{deep:!0});const D=()=>{const{calculationId:L}=a.value.configuratorParams,A=a.value.quantity??0;L&&A>0&&a.value.product&&!a.value.product.isNewRec()&&(b.value={id:L,quantity:A,sheets:[]},V())};return i.onMounted(()=>{r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,h.value=r.value.product.id),D()}),e({validate:(H=s.value)==null?void 0:H.validate,formReference:s}),(L,A)=>{const z=jr,U=Vd;return i.openBlock(),i.createBlock(i.unref(O.NForm),{ref:"form-reference",model:a.value,rules:C.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message",onKeydown:i.withKeys(i.withModifiers(ee,["prevent"]),["enter"])},{default:i.withCtx(()=>{var K;return[i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:h.value,"onUpdate:value":[A[0]||(A[0]=F=>h.value=F),B],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((K=u.value)==null?void 0:K.costRub)!=null?(i.openBlock(),i.createElementBlock("div",g0,[i.createElementVNode("span",p0,i.toDisplayString(u.value.code),1),i.createTextVNode(" — "+i.toDisplayString(u.value.costRub.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol)+"/шт. ",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",y0,[u.value?(i.openBlock(),i.createElementBlock("div",b0,[A[7]||(A[7]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",_0,[p.value?(i.openBlock(),i.createElementBlock("div",w0,"Ширина "+i.toDisplayString(p.value)+".",1)):i.createCommentVNode("",!0),y.value?(i.openBlock(),i.createElementBlock("div",x0,"Длина "+i.toDisplayString(y.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",k0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value.configuratorParams.items,(F,q)=>(i.openBlock(),i.createElementBlock("div",{key:q,class:"flex grow gap-2"},[i.createElementVNode("div",v0,[i.createVNode(i.unref(O.NFormItem),{path:`configuratorParams.items.${q}.width`,label:"Ширина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:a.value.configuratorParams.items[q].width,"onUpdate:value":[Y=>a.value.configuratorParams.items[q].width=Y,Y=>R(q)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:A[1]||(A[1]=Y=>i.unref(tt)(Y)),onInput:Y=>c(`items.${q}.width`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(O.NFormItem),{path:`configuratorParams.items.${q}.length`,label:"Длина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:a.value.configuratorParams.items[q].length,"onUpdate:value":[Y=>a.value.configuratorParams.items[q].length=Y,Y=>R(q)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:A[2]||(A[2]=Y=>i.unref(tt)(Y)),onInput:Y=>c(`items.${q}.length`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(O.NFormItem),{path:`configuratorParams.items.${q}.count`,label:"Количество, шт"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:a.value.configuratorParams.items[q].count,"onUpdate:value":[Y=>a.value.configuratorParams.items[q].count=Y,Y=>R(q)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:A[3]||(A[3]=Y=>i.unref(tt)(Y,!1)),onInput:Y=>c(`items.${q}.count`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),i.createVNode(i.unref(O.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:Y=>W(q)},{default:i.withCtx(()=>[i.createVNode(z)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:1,disabled:E.value,type:"default",class:"self-center",onClick:I},{default:i.withCtx(()=>[i.createVNode(U),A[8]||(A[8]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0)]),i.createVNode(i.unref(O.NFormItem),{path:"marker",label:"Маркировка распила"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:a.value.marker??null,disabled:!u.value,placeholder:"Введите маркировку распила",onInput:A[4]||(A[4]=F=>c("marker")),"onUpdate:value":A[5]||(A[5]=F=>ne("marker",F??null)),onFocus:i.unref(Le)},null,8,["value","disabled","onFocus"])]),_:1}),k.value?(i.openBlock(),i.createBlock(i.unref(O.NCheckbox),{key:1,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":A[6]||(A[6]=F=>{a.value.isAdditionalSale=F??!1,ne("isAdditionalSale",F??!1)})},{default:i.withCtx(()=>[...A[9]||(A[9]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(i.unref(O.NSpin),{show:_.value,size:"small",class:"grow"},{default:i.withCtx(()=>{var F;return[b.value&&u.value&&x.value?(i.openBlock(),i.createElementBlock("div",C0,[i.createElementVNode("div",null,[A[10]||(A[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",S0,i.toDisplayString(x.value.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol),1)]),b.value.quantity&&u.value?(i.openBlock(),i.createElementBlock("div",B0,[i.createElementVNode("span",T0,"("+i.toDisplayString(b.value.quantity)+" шт.",1),A[11]||(A[11]=i.createTextVNode(" x ",-1)),i.createElementVNode("span",N0,i.toDisplayString((F=u.value.costRub)==null?void 0:F.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]}),_:1},8,["show"]),i.createElementVNode("div",$0,[b.value&&!_.value?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,loading:t.isSubmitProcessing,disabled:$.value||_.value,type:"primary",class:"self-start",onClick:ee},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(a.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])):(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:1,loading:_.value,disabled:$.value||_.value,type:"info",class:"self-start",onClick:N},{default:i.withCtx(()=>[...A[12]||(A[12]=[i.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules","onKeydown"])}}}),R0={class:"flex flex-col gap-2"},P0={class:"w-104 flex grow flex-col px-5"},F0={},Md=i.defineComponent({...F0,__name:"sandwich-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{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(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("sandwich-configurator-form"),s=i.ref(n.cartItem),a=i.ref({width:{},length:{},quantity:{},marker:{},product:{}}),l=i.ref(!1),c=async()=>{var h,f;(f=(h=o.value)==null?void 0:h.formReference)==null||f.validate(g=>{if(!g){l.value=!0;const m=M.cloneDeep(s.value);"items"in m.configuratorParams&&delete m.configuratorParams.items,r("submit",m,a.value,()=>{l.value=!1,i.nextTick(()=>{var p,y;(y=(p=o.value)==null?void 0:p.formReference)==null||y.restoreValidation()})})}}).catch(M.noop)},d=h=>{a.value[`items.${h}.width`]={},a.value[`items.${h}.length`]={},a.value[`items.${h}.count`]={}},u=h=>{delete a.value[`items.${h}.width`],delete a.value[`items.${h}.length`],delete a.value[`items.${h}.count`]};return i.onMounted(()=>{n.cartItem.configuratorParams.items.forEach((h,f)=>{a.value[`items.${f}.width`]={},a.value[`items.${f}.length`]={},a.value[`items.${f}.count`]={}})}),i.watch(()=>n.cartItem,h=>{s.value=new j.OrderItemBase(h)},{deep:!0}),(h,f)=>{const g=O.NButton;return i.openBlock(),i.createElementBlock("div",R0,[t.settings.allowShowTable&&s.value.isNewRec()?(i.openBlock(),i.createBlock(g,{key:0,type:"tertiary",class:"self-center",onClick:f[0]||(f[0]=m=>r("click:view-switch"))},{default:i.withCtx(()=>[...f[2]||(f[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",P0,[i.createVNode(Id,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":f[1]||(f[1]=m=>s.value=m),validation:a.value,settings:t.settings,"event-emitter":t.eventEmitter,"is-submit-processing":l.value,onSubmit:c,onAddItem:d,onRemoveItem:u},null,8,["value","validation","settings","event-emitter","is-submit-processing"])])])}}}),V0={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function I0(t,e){return i.openBlock(),i.createElementBlock("svg",V0,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M416 128L192 384l-96-96"},null,-1)])])}const M0=i.markRaw({name:"ion-checkmark",render:I0}),A0={key:0,class:"-mt-1 text-sm text-gray-500"},O0={class:"font-bold"},z0={class:"flex flex-col gap-3"},D0={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},L0={class:"flex flex-col gap-1 text-sm text-gray-700"},H0={key:0},W0={key:1},j0={"form-array-name":"items",class:"flex flex-col gap-3"},q0={class:"min-w-0 flex-1"},X0={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},Y0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},U0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},K0={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},G0={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},Z0={key:0,class:"lg:!flex-[2]"},Q0={class:"font-bold"},J0={key:1,class:"lg:!flex-[3]"},eb={class:"font-bold"},tb={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"},nb={key:0},ib={class:"font-bold"},rb={key:1},ob={class:"font-bold"},sb={class:"flex flex-wrap items-center gap-3"},ab={},Ad=i.defineComponent({...ab,__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]},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(t,{expose:e,emit:n}){var K;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("widthInputs"),l=r.value==null?[]:M.cloneDeep(i.toRaw(r.value)),c=i.ref(l.map(F=>new j.OrderItemBase(F))),d=i.computed(()=>({items:c.value})),u=i.ref({...r.validation}),h=F=>{var q;delete u.value[F],(q=s.value)==null||q.restoreValidation()},f=i.ref(null),g=i.ref(null),m=i.computed(()=>{var F,q;return((q=(F=c.value[0])==null?void 0:F.category)==null?void 0:q.products)??[]}),p=i.computed(()=>m.value.map(F=>({label:F.name,value:F.id}))),y=(F,q,Y)=>{const J=F!=null&&F>0,ue=q!=null&&q>0;return!J&&!ue?null:J&&ue?`от ${F} ${Y} до ${q} ${Y}`:J?`от ${F} ${Y}`:`до ${q} ${Y}`},b=i.computed(()=>{var F,q;return y(r.settings.minWidth,(q=(F=f.value)==null?void 0:F.properties)==null?void 0:q.width,"мм")}),_=i.computed(()=>{var F,q;return y(r.settings.minLength,(q=(F=f.value)==null?void 0:F.properties)==null?void 0:q.length,"мм")}),C=i.computed(()=>{const F={};return c.value.forEach((q,Y)=>{var J,ue,ve,Te,We,ce,mt,Ne;F[`items.${Y}.configuratorParams.width`]=[ae.required,ae.min(r.settings.minWidth),...(ue=(J=f.value)==null?void 0:J.properties)!=null&&ue.width?[ae.max(f.value.properties.width)]:[],ae.step(1),He.serverValidation((ve=u.value[`items.${Y}.width`])==null?void 0:ve.feedback)],F[`items.${Y}.configuratorParams.length`]=[ae.required,ae.min(r.settings.minLength),...(We=(Te=f.value)==null?void 0:Te.properties)!=null&&We.length?[ae.max(f.value.properties.length)]:[],ae.step(1),He.serverValidation((ce=u.value[`items.${Y}.length`])==null?void 0:ce.feedback)],F[`items.${Y}.quantity`]=[ae.required,ae.min(1),ae.step(1),He.serverValidation((mt=u.value[`items.${Y}.quantity`])==null?void 0:mt.feedback)],F[`items.${Y}.marker`]=[He.serverValidation((Ne=u.value[`items.${Y}.marker`])==null?void 0:Ne.feedback)]}),F});i.watch(()=>r.validation,F=>{u.value={...F},Object.values(F).some(Y=>Y==null?void 0:Y.feedback)&&i.nextTick(()=>{var Y;return(Y=s.value)==null?void 0:Y.validate(M.noop).catch(M.noop)})},{deep:!0});const k=i.ref(r.settings.canSetDopProdaga??!1),E=i.computed(()=>{const F=f.value;return F?c.value.some(q=>{var ve,Te;const Y=q.configuratorParams,J=(ve=F.properties)==null?void 0:ve.width,ue=(Te=F.properties)==null?void 0:Te.length;return Y.width===0||Y.width<r.settings.minWidth||J!=null&&Y.width>J||Y.length===0||Y.length<r.settings.minLength||ue!=null&&Y.length>ue||q.quantity===0||q.quantity<1}):!0}),$=i.computed(()=>!f.value||E.value||c.value.length===0),x=i.computed(()=>{const F=c.value[0];return F!=null&&!F.isNewRec()}),B=F=>r.itemStates[F]??"idle",w=F=>B(F)==="success",T=F=>B(F)==="loading",N=i.computed(()=>c.value.length===0?!0:c.value.every((F,q)=>{const Y=B(q);return Y==="success"||Y==="loading"})),V=F=>F.width===0||F.length===0?0:F.width*F.length/1e6,R=F=>{var ve;const q=F.configuratorParams,Y=V(q),J=((ve=f.value)==null?void 0:ve.costRub)??0,ue=F.quantity??0;return!Y||!ue?0:Math.round(Y*J*ue*100)/100},I=i.computed(()=>M.sum(c.value.map(F=>{const q=F.configuratorParams;return!q.width||q.length===0||!F.quantity?0:q.width*q.length*F.quantity/1e6}))),W=i.computed(()=>Math.round(M.sum(c.value.map(F=>R(F)))*100)/100),ee=()=>{var F,q,Y;return new j.OrderItemBase({category:(F=c.value[0])==null?void 0:F.category,configurator:(q=c.value[0])==null?void 0:q.configurator,product:f.value??new j.ClientProduct,quantity:1,isAdditionalSale:(Y=c.value[0])==null?void 0:Y.isAdditionalSale,configuratorParams:{width:0,length:0}})},ne=F=>{if(!F){f.value=null,g.value=null,c.value.forEach(Y=>{Y.product=new j.ClientProduct}),o("update:value",c.value);return}const q=m.value.find(Y=>Y.id===F);q&&(f.value=q,g.value=F,c.value.forEach((Y,J)=>{var ue,ve;Y.product=q,(ue=q.properties)!=null&&ue.width&&Y.configuratorParams.width>q.properties.width&&(Y.configuratorParams.width=q.properties.width),(ve=q.properties)!=null&&ve.length&&Y.configuratorParams.length>q.properties.length&&(Y.configuratorParams.length=q.properties.length),o("item-reset",J)}),o("update:value",c.value))},D=F=>{var J,ue;const q=c.value[F],Y=f.value;Y&&((J=Y.properties)!=null&&J.width&&q.configuratorParams.width>Y.properties.width&&(q.configuratorParams.width=Y.properties.width),(ue=Y.properties)!=null&&ue.length&&q.configuratorParams.length>Y.properties.length&&(q.configuratorParams.length=Y.properties.length)),o("item-reset",F),o("update:value",c.value)},H=(F,q)=>{c.value[F].marker=q===null||q===""?void 0:q,o("item-reset",F),o("update:value",c.value)},L=F=>{c.value.forEach(q=>{q.isAdditionalSale=F}),o("update:value",c.value)},A=()=>{c.value.push(ee()),o("update:value",c.value),o("add-item",c.value.length),i.nextTick(()=>{var q,Y,J,ue;const F=c.value.length-1;(Y=(q=a.value)==null?void 0:q[F])==null||Y.focus(),(ue=(J=a.value)==null?void 0:J[F])==null||ue.select()})},z=F=>{c.value.splice(F,1),o("update:value",c.value),o("remove-item",F)};i.watch(()=>r.value,F=>{var ue;const Y=(F==null?[]:M.cloneDeep(i.toRaw(F))).map(ve=>new j.OrderItemBase(ve));c.value=Y.length>0?Y:[ee()];const J=(ue=c.value[0])==null?void 0:ue.product;J&&!J.isNewRec()?(f.value=J,g.value=J.id):(f.value=null,g.value=null)},{deep:!0});const U=()=>{var q;if(f.value!==null)return;const F=(q=m.value[0])==null?void 0:q.id;F!=null&&ne(F)};return i.watch(m,()=>{U()}),i.onMounted(()=>{var q;c.value.length===0&&(c.value=[ee()]);const F=(q=c.value[0])==null?void 0:q.product;F&&!F.isNewRec()&&(f.value=F,g.value=F.id),U()}),e({validate:(K=s.value)==null?void 0:K.validate,formReference:s}),(F,q)=>{const Y=M0,J=jr,ue=Vd;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(O.NForm),{ref:"form-reference",model:d.value,rules:C.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>{var ve,Te;return[i.createVNode(i.unref(O.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NSelect),{value:g.value,"onUpdate:value":[q[0]||(q[0]=We=>g.value=We),ne],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((ve=f.value)==null?void 0:ve.costRub)!=null?(i.openBlock(),i.createElementBlock("div",A0,[i.createElementVNode("span",O0,i.toDisplayString(f.value.code),1),i.createTextVNode(" — "+i.toDisplayString(f.value.costRub.toLocaleString())+" "+i.toDisplayString(f.value.currency.symbol)+"/м² ",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",z0,[f.value?(i.openBlock(),i.createElementBlock("div",D0,[q[6]||(q[6]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",L0,[b.value?(i.openBlock(),i.createElementBlock("div",H0,"Ширина "+i.toDisplayString(b.value)+".",1)):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createElementBlock("div",W0,"Длина "+i.toDisplayString(_.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",j0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value.items,(We,ce)=>{var mt;return i.openBlock(),i.createElementBlock("div",{key:ce,class:i.normalizeClass(["flex min-w-0 items-start gap-2 border-b border-gray-100 last:border-0",w(ce)?"opacity-70":""])},[i.createElementVNode("div",q0,[i.createElementVNode("div",X0,[i.createElementVNode("div",Y0,[i.createVNode(i.unref(O.NFormItem),{path:`items.${ce}.configuratorParams.width`,label:"Ширина, мм",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{ref_for:!0,ref:"widthInputs",value:d.value.items[ce].configuratorParams.width,"onUpdate:value":[Ne=>d.value.items[ce].configuratorParams.width=Ne,Ne=>D(ce)],parse:i.unref(it),"show-button":!1,disabled:!f.value||w(ce)||T(ce),placeholder:"Ширина",class:"w-full",onKeydown:q[1]||(q[1]=Ne=>i.unref(tt)(Ne)),onInput:Ne=>h(`items.${ce}.width`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(O.NFormItem),{path:`items.${ce}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:d.value.items[ce].configuratorParams.length,"onUpdate:value":[Ne=>d.value.items[ce].configuratorParams.length=Ne,Ne=>D(ce)],parse:i.unref(it),"show-button":!1,disabled:!f.value||w(ce)||T(ce),placeholder:"Длина",class:"w-full",onKeydown:q[2]||(q[2]=Ne=>i.unref(tt)(Ne)),onInput:Ne=>h(`items.${ce}.length`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),i.createElementVNode("div",U0,[i.createVNode(i.unref(O.NFormItem),{path:`items.${ce}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:d.value.items[ce].quantity,"onUpdate:value":[Ne=>d.value.items[ce].quantity=Ne,Ne=>D(ce)],parse:i.unref(it),"show-button":!1,disabled:!f.value||w(ce)||T(ce),placeholder:"Кол-во",class:"w-full",onKeydown:q[3]||(q[3]=Ne=>i.unref(tt)(Ne,!1)),onInput:Ne=>h(`items.${ce}.quantity`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(O.NFormItem),{path:`items.${ce}.marker`,label:"Маркировка",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:d.value.items[ce].marker??null,disabled:!f.value||w(ce)||T(ce),placeholder:"Маркировка",class:"w-full",onInput:Ne=>h(`items.${ce}.marker`),"onUpdate:value":Ne=>H(ce,Ne??null),onFocus:i.unref(Le)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),T(ce)||w(ce)?(i.openBlock(),i.createElementBlock("div",K0,[T(ce)?(i.openBlock(),i.createBlock(i.unref(O.NSpin),{key:0,size:14})):w(ce)?(i.openBlock(),i.createBlock(Y,{key:1,class:"text-green-600 text-xl"})):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),i.createElementVNode("div",G0,[We.configuratorParams.width>0&&We.configuratorParams.length>0?(i.openBlock(),i.createElementBlock("div",Z0,[q[7]||(q[7]=i.createTextVNode(" Площадь (S) = ",-1)),i.createElementVNode("span",Q0,i.toDisplayString(V(We.configuratorParams).toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),R(We)>0?(i.openBlock(),i.createElementBlock("div",J0,[q[8]||(q[8]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",eb,i.toDisplayString(R(We).toLocaleString())+" "+i.toDisplayString((mt=f.value)==null?void 0:mt.currency.symbol),1)])):i.createCommentVNode("",!0)])]),x.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,disabled:T(ce)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:Ne=>z(ce)},{default:i.withCtx(()=>[i.createVNode(J)]),_:1},8,["disabled","onClick"]))],2)}),128))]),f.value?(i.openBlock(),i.createElementBlock("div",tb,[I.value>0?(i.openBlock(),i.createElementBlock("div",nb,[q[9]||(q[9]=i.createTextVNode(" Общая площадь: ",-1)),i.createElementVNode("span",ib,i.toDisplayString(I.value.toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),W.value>0?(i.openBlock(),i.createElementBlock("div",rb,[q[10]||(q[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",ob,i.toDisplayString(W.value.toLocaleString())+" "+i.toDisplayString(f.value.currency.symbol),1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),k.value?(i.openBlock(),i.createBlock(i.unref(O.NCheckbox),{key:1,checked:((Te=c.value[0])==null?void 0:Te.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":q[4]||(q[4]=We=>L(We??!1))},{default:i.withCtx(()=>[...q[11]||(q[11]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createElementVNode("div",sb,[f.value&&!x.value?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,disabled:E.value,type:"default",onClick:A},{default:i.withCtx(()=>[i.createVNode(ue),q[12]||(q[12]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),i.createVNode(i.unref(O.NButton),{loading:t.isSubmitProcessing,disabled:$.value||N.value,type:"primary",class:"ml-auto",onClick:q[5]||(q[5]=We=>o("submit",c.value))},{default:i.withCtx(()=>{var We;return[i.createTextVNode(i.toDisplayString((We=c.value[0])!=null&&We.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[i.unref(Za)]])}}}),lb={class:"flex flex-col gap-2"},cb={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},db={},Od=i.defineComponent({...db,__name:"sandwich-m2-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{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(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("sandwich-m2-configurator-form"),s=i.ref((n.cartItems??[]).map(C=>new j.OrderItemBase(C))),a=i.ref([]),l=i.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=C=>{c.forEach(k=>{l.value[`items.${C}.${k}`]={}})},u=C=>{c.forEach(k=>{delete l.value[`items.${C}.${k}`]})},h=i.computed(()=>a.value.includes("loading")),f=()=>({width:{},length:{},quantity:{},marker:{}}),g=(C,k)=>{let E=!1;return c.forEach($=>{var V,R;const x=`items.0.${$}`,B=(V=C[$])==null?void 0:V.feedback,T=((R=C[x])==null?void 0:R.feedback)??B,N=`items.${k}.${$}`;T?(l.value[N]=C[x]??C[$],E=!0):l.value[N]={}}),E},m=(C,k,E)=>new Promise($=>{const x=f();let B=!1;const w=T=>{if(B)return;B=!0;const N=g(x,k),V=(T===void 0?!N:T)&&!N;a.value[k]=V?"success":"error",i.nextTick(()=>{var R,I;(I=(R=o.value)==null?void 0:R.formReference)==null||I.restoreValidation()}),$(V)};a.value[k]="loading",r("submit",[M.cloneDeep(C)],x,w,{isFinalSuccessfulCompletion:E})}),p=async()=>{var E,$;try{await(($=(E=o.value)==null?void 0:E.formReference)==null?void 0:$.validate())}catch{return}const C=s.value.map((x,B)=>B).filter(x=>{const B=a.value[x]??"idle";return B!=="success"&&B!=="loading"});let k=!0;for(let x=0;x<C.length;x+=1){const B=C[x],w=s.value[B];if(!w)break;const N=x===C.length-1&&k;await m(w,B,N)||(k=!1)}},y=C=>{const k=C-1;a.value[k]="idle",d(k)},b=C=>{a.value.splice(C,1),u(C);for(let k=C;k<s.value.length;k+=1)d(k)},_=C=>{const k=a.value[C];(k==="success"||k==="error")&&(a.value[C]="idle")};return i.onMounted(()=>{(n.cartItems??[]).forEach((C,k)=>{a.value[k]="idle",d(k)})}),i.watch(()=>n.cartItems,C=>{const k=(C??[]).map(E=>new j.OrderItemBase(E));s.value=k,a.value=k.map(()=>"idle"),k.forEach((E,$)=>{d($)})},{deep:!0}),(C,k)=>{var $;const E=O.NButton;return i.openBlock(),i.createElementBlock("div",lb,[t.settings.allowShowTable&&(($=s.value[0])!=null&&$.isNewRec())?(i.openBlock(),i.createBlock(E,{key:0,type:"tertiary",class:"self-center",onClick:k[0]||(k[0]=x=>r("click:view-switch"))},{default:i.withCtx(()=>[...k[2]||(k[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",cb,[i.createVNode(Ad,{ref:"sandwich-m2-configurator-form",value:s.value,"onUpdate:value":k[1]||(k[1]=x=>s.value=x),validation:l.value,settings:t.settings,"event-emitter":t.eventEmitter,"is-submit-processing":h.value,"item-states":a.value,onSubmit:p,onAddItem:y,onRemoveItem:b,onItemReset:_},null,8,["value","validation","settings","event-emitter","is-submit-processing","item-states"])])])}}}),ub={key:0,class:"flex justify-center p-4"},hb={key:1,class:"p-4 text-center text-red-500"},fb={key:2,class:"flex justify-center"},mb={class:"!bg-white p-4 m-2 rounded-md w-max"},gb={key:3,class:"p-4 text-center text-gray-500"},pb={},zd=i.defineComponent({...pb,__name:"dynamic-configurator",props:{eventEmitter:{},settings:{},editor:{},cartItem:{},cartItems:{},category:{}},setup(t){const e=t,n=i.ref(!1),r=i.ref(null),o=i.ref(e.cartItem??null),s=i.ref(e.cartItems??null),a=f=>{const g=f.configuratorParams;return[new j.OrderItemBase({...f,quantity:f.quantity??1,marker:f.marker,configuratorParams:{width:(g==null?void 0:g.width)??f.width??0,length:(g==null?void 0:g.length)??f.length??0}})]},l=i.ref(e.editor===j.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var g,m,p;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const f={category:((g=e.cartItem)==null?void 0:g.category)??e.category,configurator:e.editor,quantity:1};switch(e.editor){case"kozyrek":{const y=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{length:y.stripMinLength,linesAngles:[],linesWidths:[],startTailType:M.some(y.startTailConfigs,b=>b.isDefault)?(m=y.startTailConfigs)==null?void 0:m.findIndex(b=>b.isDefault):void 0,endTailType:M.some(y.endTailConfigs,b=>b.isDefault)?(p=y.endTailConfigs)==null?void 0:p.findIndex(b=>b.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const y=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{width:0,height:0,netType:y.netType[0]||"",color:y.color[0]||"",mountType:y.mountType[0]||""}});break}case"strip":{const y=e.settings;s.value=[new j.OrderItemBase({...f,length:y.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const y=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{width:y.minWidth,length:y.minLength}});break}case"sandwich":{o.value=new j.OrderItemBase({...f,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new j.OrderItemBase({...f,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(f,g,m)=>{const p=y=>{m==null||m(),y&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:f,callback:p,validation:g})},u=(f,g,m,p)=>{const y=f[0];if(!y){m==null||m();return}const b=(p==null?void 0:p.isFinalSuccessfulCompletion)===!0,_=C=>{m==null||m(C),b&&C&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:y,callback:_,validation:g,additionalParams:p})},h=()=>{e.category&&e.eventEmitter.emit("configurator:click-view-switch",{category:e.category})};return i.onMounted(()=>{!e.cartItem&&!e.cartItems&&c()}),(f,g)=>{const m=O.NSpin;return i.openBlock(),i.createElementBlock(i.Fragment,null,[n.value?(i.openBlock(),i.createElementBlock("div",ub,[i.createVNode(m,{size:"large"})])):r.value?(i.openBlock(),i.createElementBlock("div",hb,i.toDisplayString(r.value),1)):i.createCommentVNode("",!0),t.settings!==null&&(o.value!==null||s.value!==null||l.value!==null)?(i.openBlock(),i.createElementBlock("div",fb,[i.createElementVNode("div",mb,[t.editor==="kozyrek"?(i.openBlock(),i.createBlock(Cd,{key:0,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":h,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="mosquitto"?(i.openBlock(),i.createBlock(Td,{key:1,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="strip"?(i.openBlock(),i.createBlock(Rd,{key:2,"event-emitter":t.eventEmitter,settings:t.settings,"cart-items":s.value,"onClick:viewSwitch":h,onSubmit:d},null,8,["event-emitter","settings","cart-items"])):t.editor==="metal_for_doors"?(i.openBlock(),i.createBlock(Fd,{key:3,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":h,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="sandwich"?(i.openBlock(),i.createBlock(Md,{key:4,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":h,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="sandwich_m2"?(i.openBlock(),i.createBlock(Od,{key:5,"event-emitter":t.eventEmitter,settings:t.settings,"cart-items":l.value,"onClick:viewSwitch":h,onSubmit:u},null,8,["event-emitter","settings","cart-items"])):i.createCommentVNode("",!0)])])):(i.openBlock(),i.createElementBlock("div",gb,' Конфигуратор "'+i.toDisplayString(t.editor)+'" не поддерживается. ',1))],64)}}});function Dd(t){return Object.values(j.ConfiguratorsEnum).includes(t)}function Ld(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.Sandwich?!0:t.properties.configuratorSettings!==void 0&&M.isArray(t.products)&&t.products.length>0}const yb={key:0,class:"pt-0.5"},bb={key:0},_b={class:"line-through"},wb={key:0},xb={key:1},kb={class:"flex flex-row gap-1"},vb={key:0},Cb={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},Sb={class:"flex flex-col gap-2.5 sm:flex-row"},Bb={class:"mt-2"},Tb={key:1,class:"flex flex-col"},Nb={},$b=i.defineComponent({...Nb,__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},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(t){const e=t,n=i.inject(cr,"medium"),r=i.computed(()=>{var K;return(K=e==null?void 0:e.filteredItems)==null?void 0:K[e.categoryItem.id]}),o=i.computed(()=>{var K,F;return M.isArray((K=e.categoryItem)==null?void 0:K.categories)&&((F=e.categoryItem.categories)==null?void 0:F.length)>0}),s=i.computed(()=>{var K;return M.isArray((K=e.categoryItem)==null?void 0:K.products)?e.categoryItem.products:[]}),a=i.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([K,F])=>`${F} руб./${N(K)}`).join(", ")),l=i.computed(()=>M.isUndefined(e.filteredItems)||r.value==="*"?s.value:s.value.filter(K=>{var q;const F=(q=r.value)==null?void 0:q.products;return M.isArray(F)&&F.includes(K.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>M.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),u=i.computed(()=>M.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),h=i.computed(()=>M.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),f=i.computed(()=>M.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),g=i.computed(()=>{var K,F,q;return((K=e.categoryItem.properties)==null?void 0:K.configurator)!==void 0&&Dd((F=e.categoryItem.properties)==null?void 0:F.configurator)&&Ld(e.categoryItem)&&((q=e.categoryItem.properties)==null?void 0:q.configuratorSettings)!==void 0&&(M.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),m=i.computed(()=>g.value&&(M.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),p=i.computed(()=>M.isNil(e.categoryContextButtonsConfig)?[]:M.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),y=i.computed(()=>new j.ClientCategory(e.categoryItem)),b=i.ref(!1),_=i.ref(!1),C=i.computed(()=>!M.isUndefined(e.isCategoryItemSelected)),k=i.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),E=i.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),$=i.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),x=i.computed(()=>A.value&&St.getDeviceTypeByResolution()===Qe.laptop?"auto":"fixed"),B=i.useTemplateRef("collapse-item-reference"),w=i.computed(()=>{var K,F;return(F=(K=e.categoryItem.properties)==null?void 0:K.templateCost)==null?void 0:F.priceCoefficient}),T=i.computed(()=>{var K,F;return(F=(K=e.categoryItem.properties)==null?void 0:K.templateCost)==null?void 0:F.increasePercent}),N=(K,F="ru-RU")=>0 .toLocaleString(F,{style:"currency",currency:K,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),V=K=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:K,target:B.value})},R=(K,F)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:F,isLoadingState:b,target:B.value})},I=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:B.value})},W=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:B.value})},ee=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:B.value})},ne=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:B.value})},D=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:B.value})},H=K=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:K,target:B.value})},L=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},A=i.ref(0),z=i.computed(()=>A.value&&s.value.length>0?rg(s.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),U=M.debounce(()=>{A.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",U)}),window.addEventListener("resize",U),U(),(K,F)=>{const q=O.NCheckbox,Y=Vf,J=O.NTooltip,ue=Rf,ve=O.NTag,Te=Nf,We=Sf,ce=O.NButton,mt=kf,Ne=el,Pt=Ja,Wt=Qa,ln=Xo,Ct=O.NDropdown,Ln=O.NDataTable,cn=O.NAlert,Jt=O.NSpin;return i.openBlock(),i.createBlock(tl,{ref:"collapse-item-reference",name:t.categoryItem.id,"data-id":t.categoryItem.id,"onHeader:click":R},{"pre-arrow":i.withCtx(()=>{var Ve,Q;return[C.value?(i.openBlock(),i.createElementBlock("div",yb,[i.createVNode(q,{checked:k.value,indeterminate:$.value,disabled:E.value,"onUpdate:checked":V},null,8,["checked","indeterminate","disabled"])])):i.createCommentVNode("",!0),!d.value&&((Ve=y.value)!=null&&Ve.isDisabled)?(i.openBlock(),i.createBlock(J,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(Y,{class:"pt-1.5"})]),default:i.withCtx(()=>[F[1]||(F[1]=i.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):i.createCommentVNode("",!0),((Q=y.value)==null?void 0:Q.isFavorite)??!1?(i.openBlock(),i.createBlock(J,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ue,{class:"pt-1.5"})]),default:i.withCtx(()=>[F[2]||(F[2]=i.createTextVNode(" Избранная категория ",-1))]),_:1})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var Ve,Q,le,De,ii;return[i.createElementVNode("div",{class:i.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":t.categoryItem.isHidden,"text-gray-400":(Ve=y.value)==null?void 0:Ve.isDisabled})},[i.createVNode(J,{disabled:!t.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createElementVNode("span",null,i.toDisplayString(t.categoryItem.name),1)]),default:i.withCtx(()=>[F[3]||(F[3]=i.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:F[0]||(F[0]=i.withModifiers((...nt)=>i.unref(M.noop)&&i.unref(M.noop)(...nt),["prevent","stop"]))},[(Q=t.categoryItem.properties)!=null&&Q.m2Price?(i.openBlock(),i.createBlock(ve,{key:0,size:i.unref(n),class:i.normalizeClass({"!pr-0":((le=t.categoryItem.properties)==null?void 0:le.templateCost)&&t.categoryItem.properties.m2PriceRetail&&T.value}),round:""},{default:i.withCtx(()=>{var nt;return[i.createTextVNode(" Установленная стоимость: "+i.toDisplayString(t.categoryItem.properties.m2Price)+" руб./м2 ",1),(nt=t.categoryItem.properties)!=null&&nt.templateCost&&t.categoryItem.properties.m2PriceRetail&&T.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[T.value?(i.openBlock(),i.createBlock(ve,{key:0,type:"success",bordered:!1,size:i.unref(n),class:"ml-2 !pr-0",round:""},{default:i.withCtx(()=>[T.value?(i.openBlock(),i.createElementBlock("span",bb,i.toDisplayString(T.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0),i.createVNode(ve,{size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createElementVNode("span",_b,i.toDisplayString(t.categoryItem.properties.m2PriceRetail)+" руб./м2",1)]),_:1},8,["size"])]),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0)]}),_:1},8,["size","class"])):(De=t.categoryItem.properties)!=null&&De.templateCost?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[w.value||T.value?(i.openBlock(),i.createBlock(ve,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>{var nt;return[w.value?(i.openBlock(),i.createElementBlock("span",wb,i.toDisplayString((nt=w.value)==null?void 0:nt.name),1)):i.createCommentVNode("",!0),T.value?(i.openBlock(),i.createElementBlock("span",xb,i.toDisplayString(T.value>0?"+":"")+i.toDisplayString(T.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0)]}),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(ve,{key:2,size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createTextVNode(" Фиксированный курс: "+i.toDisplayString(a.value),1)]),_:1},8,["size"])):i.createCommentVNode("",!0),u.value&&((ii=y.value)!=null&&ii.manager)?(i.openBlock(),i.createBlock(ve,{key:3,size:i.unref(n),closable:!0,round:"",class:"align-bottom",onClose:ne},{default:i.withCtx(()=>[i.createVNode(J,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var nt,jt;return[i.createElementVNode("span",kb,[i.createVNode(Te),i.createTextVNode(" "+i.toDisplayString((jt=(nt=y.value)==null?void 0:nt.manager)==null?void 0:jt.name),1)])]}),default:i.withCtx(()=>{var nt,jt;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((jt=(nt=y.value)==null?void 0:nt.manager)==null?void 0:jt.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[t.showSlugs||t.showProperties?(i.openBlock(),i.createElementBlock("div",vb,[i.createElementVNode("ul",Cb,[t.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:t.categoryItem.id,slug:t.categoryItem.slug},(Ve,Q)=>(i.openBlock(),i.createElementBlock("li",{key:Q}," ("+i.toDisplayString(Q)+"): "+i.toDisplayString(Ve),1))),128)):i.createCommentVNode("",!0),t.showProperties?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:1},i.renderList(t.categoryItem.properties,(Ve,Q)=>(i.openBlock(),i.createElementBlock("li",{key:Q}," ("+i.toDisplayString(Q)+"): "+i.toDisplayString(Ve),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var Ve;return[i.createElementVNode("div",Sb,[d.value?(i.openBlock(),i.createBlock(J,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),onClick:I},{default:i.withCtx(()=>{var Q;return[(Q=y.value)!=null&&Q.isDisabled?(i.openBlock(),i.createBlock(Y,{key:1})):(i.openBlock(),i.createBlock(We,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var Q;return[(Q=y.value)!=null&&Q.isDisabled?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" Скрыто для клиента"+i.toDisplayString(y.value.hidingComment?`. Причина: '${y.value.hidingComment}'`:""),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Видимо клиенту")],64))]}),_:1})):i.createCommentVNode("",!0),u.value&&!((Ve=y.value)!=null&&Ve.manager)?(i.openBlock(),i.createBlock(J,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),onClick:ee},{default:i.withCtx(()=>[i.createVNode(mt)]),_:1},8,["size"])]),default:i.withCtx(()=>{var Q,le,De;return[(Q=y.value)!=null&&Q.manager?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode('Категория закреплена за "'+i.toDisplayString(((De=(le=y.value)==null?void 0:le.manager)==null?void 0:De.name)??"-")+'"',1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode("Закрепить")],64))]}),_:1})):i.createCommentVNode("",!0),h.value?(i.openBlock(),i.createBlock(J,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,disabled:h.value==="disabled",size:i.unref(n),onClick:W},{default:i.withCtx(()=>{var Q;return[(Q=y.value)!=null&&Q.isRequired?(i.openBlock(),i.createBlock(Pt,{key:1})):(i.openBlock(),i.createBlock(Ne,{key:0}))]}),_:1},8,["disabled","size"])]),default:i.withCtx(()=>[F[4]||(F[4]=i.createTextVNode(" Категория, которую нужно предлагать клиенту ",-1))]),_:1})):i.createCommentVNode("",!0),f.value?(i.openBlock(),i.createBlock(J,{key:3,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),type:"primary",onClick:D},{default:i.withCtx(()=>[i.createVNode(Wt)]),_:1},8,["size"])]),default:i.withCtx(()=>[F[5]||(F[5]=i.createTextVNode(" Редактировать ",-1))]),_:1})):i.createCommentVNode("",!0),p.value.length>0?(i.openBlock(),i.createBlock(Ct,{key:4,options:p.value,size:i.unref(n),trigger:"click",onSelect:H},{default:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(ln)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(K.$slots,"default",{},()=>{var Ve,Q,le;return[i.createElementVNode("div",Bb,[o.value?(i.openBlock(),i.createBlock(Wd,{key:0,"categories-items":t.categoryItem.categories??[],"has-products":c.value||b.value,"event-emitter":t.eventEmitter,"filtered-items":r.value?((Ve=r.value)==null?void 0:Ve.categories)??{}:void 0,"is-category-item-selected":t.isCategoryItemSelected,"show-slugs":t.showSlugs,"show-properties":t.showProperties,"allow-name-click":t.allowNameClick,"allow-price-click":t.allowPriceClick,"show-price-history":t.showPriceHistory,"show-cost-date":t.showCostDate,"show-category-required-button":t.showCategoryRequiredButton,"show-category-hide-for-client-button":t.showCategoryHideForClientButton,"show-category-pin-button":t.showCategoryPinButton,"show-category-edit-button":t.showCategoryEditButton,"category-context-buttons-config":t.categoryContextButtonsConfig,"is-product-item-selected":t.isProductItemSelected,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-costs":t.showProductCosts,"show-product-required-button":t.showProductRequiredButton,"show-product-edit-button":t.showProductEditButton,"product-context-buttons-config":t.productContextButtonsConfig,"show-configurator":t.showConfigurator,"can-show-configurator":t.canShowConfigurator},null,8,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"])):i.createCommentVNode("",!0)]),g.value&&m.value?(i.openBlock(),i.createBlock(zd,{key:0,"event-emitter":t.eventEmitter,settings:(Q=t.categoryItem.properties)==null?void 0:Q.configuratorSettings,editor:(le=t.categoryItem.properties)==null?void 0:le.configurator,category:t.categoryItem},null,8,["event-emitter","settings","editor","category"])):c.value?(i.openBlock(),i.createElementBlock("div",Tb,[g.value?(i.openBlock(),i.createBlock(ce,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:L},{default:i.withCtx(()=>[...F[6]||(F[6]=[i.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Ln,{columns:z.value,data:l.value,bordered:!0,loading:b.value,remote:!0,"row-key":De=>De.id,"table-layout":x.value,class:"mt-2"},null,8,["columns","data","loading","row-key","table-layout"])])):i.createCommentVNode("",!0),!b.value&&!_.value&&!o.value&&!c.value?(i.openBlock(),i.createBlock(cn,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createBlock(cn,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),b.value?(i.openBlock(),i.createBlock(Jt,{key:4,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>[...F[7]||(F[7]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),Eb=jn($b,[["__scopeId","data-v-607a5aad"]]),Rb={class:"sc-collapse flex w-full flex-col"},Pb={},Hd=i.defineComponent({...Pb,__name:"collapse",props:{defaultExpandedNames:{default:()=>[]},expandedNames:{default:()=>[]}},emits:["on-item-header-click"],setup(t,{emit:e}){const n=t,r=e,o=(s,a)=>{r("on-item-header-click",s,a)};return i.provide("itemHeaderClickHandler",o),i.provide("defaultExpandedNames",n.defaultExpandedNames),i.provide("expandedNames",n.expandedNames),(s,a)=>(i.openBlock(),i.createElementBlock("div",Rb,[i.renderSlot(s.$slots,"default")]))}}),Fb={},Wd=i.defineComponent({...Fb,__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},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(t){const e=t,n=i.inject(cr,"medium"),r=i.computed(()=>M.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(M.isUndefined(a))return;const l=a[s.id];if(l==="*")return;const c={};return c[s.id]=structuredClone(i.toRaw(l)),c};return(s,a)=>{const l=O.NSpin,c=O.NAlert;return i.openBlock(),i.createElementBlock(i.Fragment,null,[r.value.length>0?(i.openBlock(),i.createBlock(Hd,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(Eb,{key:d.id,"category-item":d,"event-emitter":t.eventEmitter,"filtered-items":o(d,t.filteredItems),"is-category-item-selected":t.isCategoryItemSelected,"show-slugs":t.showSlugs,"show-properties":t.showProperties,"allow-name-click":t.allowNameClick,"allow-price-click":t.allowPriceClick,"show-price-history":t.showPriceHistory,"show-cost-date":t.showCostDate,"show-category-required-button":t.showCategoryRequiredButton,"show-category-hide-for-client-button":t.showCategoryHideForClientButton,"show-category-pin-button":t.showCategoryPinButton,"show-category-edit-button":t.showCategoryEditButton,"category-context-buttons-config":t.categoryContextButtonsConfig,"is-product-item-selected":t.isProductItemSelected,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-costs":t.showProductCosts,"show-product-required-button":t.showProductRequiredButton,"show-product-edit-button":t.showProductEditButton,"product-context-buttons-config":t.productContextButtonsConfig,"show-configurator":t.showConfigurator,"can-show-configurator":t.canShowConfigurator},null,8,["category-item","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"]))),128))]),_:1})):t.loading?(i.openBlock(),i.createBlock(l,{key:1,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>[...a[0]||(a[0]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0),!t.hasProducts&&!t.loading&&t.categoriesItems.length>0&&r.value.length===0?(i.openBlock(),i.createBlock(c,{key:2,"show-icon":!0,type:"warning",title:"Товары не найдены",class:"mx-10"})):i.createCommentVNode("",!0)],64)}}}),Vb={},jd=i.defineComponent({...Vb,__name:"reference-select",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean},referenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1},sortOptionsByLabel:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},maxTagCount:{default:void 0},disabledItem:{type:Function,default:void 0}},emits:["update:value"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.computed(()=>M.isArray(r.value)),a=new j.Reference,l=i.computed(()=>M.isNil(r.value)?s.value?[]:null:M.isArray(r.value)?r.value.map(g=>g.id):r.value.id),c=i.computed(()=>Vt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue,void 0,r.disabledItem)),d=g=>{var m;if(M.isArray(g)){const p=g.length>0?g.map(y=>{var b;return(b=c.value.find(_=>_.value===y))==null?void 0:b.item}):[];o("update:value",p)}else{const p=g===a.id||M.isNil(g)||(m=c.value.find(y=>y.value===g))==null?void 0:m.item;o("update:value",p)}},u=i.useTemplateRef("select-component");return e({focus:()=>{var g;return(g=u.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=u.value)==null?void 0:g.blur()}}),(g,m)=>(i.openBlock(),i.createBlock(i.unref(O.NSelect),{ref:"select-component",value:l.value,clearable:r.clearable,"consistent-menu-width":t.consistentMenuWidth,disabled:t.disabled||c.value.length===0,filterable:t.filterable,"max-tag-count":t.maxTagCount,multiple:s.value,options:c.value,placeholder:"",class:"w-full","onUpdate:value":d},null,8,["value","clearable","consistent-menu-width","disabled","filterable","max-tag-count","multiple","options"]))}}),Ib={},Mb=i.defineComponent({...Ib,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{}},emits:["update:value"],setup(t,{emit:e}){var k,E;const n=t,r=e,o=()=>{const $=j.PriceCoefficient.getRetailPriceCoefficient();return M.unset($,"isNewRec"),$},s=$=>!$||$.id===o().id,a=i.computed(()=>{var $;return(($=n.catalogItem)==null?void 0:$.type)==="product"}),l=i.computed(()=>a.value?n.catalogItem:void 0),c=$=>{var x,B,w,T;return $.id===o().id?(x=l.value)==null?void 0:x.getRetailCost():(T=(w=(B=l.value)==null?void 0:B.priceCoefficients)==null?void 0:w.find(N=>N.coefficient.id===$.id))==null?void 0:T.cost},d=i.computed(()=>{var x;const $=[...((x=j.useReferencesStore().priceCoefficientsReference)==null?void 0:x.map(B=>structuredClone(i.toRaw(B))))??[],o()];return a.value&&$.forEach(B=>{var T;const w=c(B);w?B.name+=` (${w} ${(T=l.value)==null?void 0:T.currency.symbol})`:B.name=""}),$.filter(B=>B.name!=="")}),u=i.ref(n.value.coefficient),h=i.ref(((E=(k=n.value)==null?void 0:k.value)==null?void 0:E.toString())??null),f=i.ref(null),g=i.computed(()=>{var $,x;return(x=($=l.value)==null?void 0:$.priceCoefficients)==null?void 0:x.find(B=>B.coefficient.slug===j.PriceCoefficientEnum.K0)}),m=i.ref(void 0),p=$=>Number.parseFloat(($??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),y=()=>{var x,B;m.value=void 0;let $=p(h.value);if($=Number.isNaN($)?void 0:$,a.value)if(u.value||h.value){const w=o(),T=c(u.value??w)??0,N=T+T*(($??0)/100);f.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(N),N>(((x=l.value)==null?void 0:x.getRetailCost())??N)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),g.value&&N<(((B=g.value)==null?void 0:B.cost)??0)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else f.value=null;r("update:value",{value:Number.isNaN($)?void 0:$,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})},b=$=>{M.isArray($)||M.isNull($)||(u.value=$,h.value=null,!u.value&&h.value&&(u.value=o()),y())},_=()=>{u.value||(u.value=o()),y()},C=$=>{var B,w,T,N,V;const x=p($);if(a.value){let R=0;if(x<=0)u.value=void 0,h.value=null;else if(g.value&&x<(((B=g.value)==null?void 0:B.cost)??0))u.value=(w=g.value)==null?void 0:w.coefficient,R=(x-g.value.cost)*100/g.value.cost,m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(x>(((T=l.value)==null?void 0:T.getRetailCost())??x)){u.value=o();const I=((N=l.value)==null?void 0:N.getRetailCost())??0;R=(x-I)*100/I,m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const I=((V=l.value)==null?void 0:V.priceCoefficients)??[],W=M.sortBy(I,[D=>D.cost]),ne=W.filter(D=>D.cost<=x).at(-1)??W.at(0);ne&&(u.value=ne.coefficient,R=(x-ne.cost)*100/ne.cost),m.value={validationStatus:void 0,feedback:void 0}}h.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:5}).format(R),r("update:value",{value:Number.isNaN(R)?void 0:R,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})}else r("update:value",{value:Number.isNaN(x)?void 0:x,coefficient:void 0})};return i.onMounted(()=>{var $,x,B,w;n.calculationType===j.CalculationTypeEnum.m2Cost?f.value=((x=($=n.value)==null?void 0:$.value)==null?void 0:x.toString())??null:!((B=n.value)!=null&&B.coefficient)&&((w=n.value)!=null&&w.value)&&(u.value=o()),y()}),($,x)=>{var T,N,V;const B=O.NInput,w=O.NInputGroup;return i.openBlock(),i.createBlock(i.unref(O.NFormItem),{"show-label":!i.unref(M.isNil)(t.label),label:t.label,"show-feedback":!i.unref(M.isNil)(((T=m.value)==null?void 0:T.feedback)??t.feedback),feedback:((N=m.value)==null?void 0:N.feedback)??t.feedback,"validation-status":((V=m.value)==null?void 0:V.validationStatus)??t.validationStatus},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([{"sm:grid-cols-3":a.value&&t.calculationType!==i.unref(j.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[t.calculationType!==i.unref(j.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(w,{key:0,class:i.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:i.withCtx(()=>[i.createVNode(jd,{class:"w-full min-w-0 flex-1",value:u.value,"reference-list":d.value,clearable:t.clearable,disabled:t.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"onUpdate:value":b},null,8,["value","reference-list","clearable","disabled"]),i.createVNode(B,{value:h.value,"onUpdate:value":[x[0]||(x[0]=R=>h.value=R),_],clearable:t.clearable,disabled:t.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},i.createSlots({suffix:i.withCtx(()=>[x[3]||(x[3]=i.createTextVNode("%",-1))]),_:2},[h.value&&!h.value.startsWith("-")?{name:"prefix",fn:i.withCtx(()=>[x[2]||(x[2]=i.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):i.createCommentVNode("",!0),a.value||t.calculationType===i.unref(j.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(B,{key:1,value:f.value,"onUpdate:value":[x[1]||(x[1]=R=>f.value=R),C],clearable:t.clearable,disabled:t.disabled,placeholder:"Стоимость",class:"w-full"},i.createSlots({_:2},[a.value?{name:"suffix",fn:i.withCtx(()=>{var R;return[i.createTextVNode(i.toDisplayString((R=l.value)==null?void 0:R.currency.symbol),1)]}),key:"0"}:void 0]),1032,["value","clearable","disabled"])):i.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),Ab={key:0,class:"flex flex-row gap-2.5"},Ob={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},zb={},qd=i.defineComponent({...zb,__name:"base-dialog",props:{show:{type:Boolean},title:{},sizes:{default:()=>({phone:{size:"small",scale:.98},tablet:{size:"small",scale:.9},default:{size:"medium",scale:.7}})},modalWidth:{default:void 0},processing:{type:Boolean,default:!1},valid:{type:Boolean,default:!0},acceptButton:{default:()=>({show:!0,text:"ОК"})},cancelButton:{default:()=>({show:!0,text:"Отмена"})},trapFocus:{type:Boolean,default:!0}},emits:["update:show","opening","closing","accept","processing:cancel"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.ref(r.show),a=i.ref(r.processing),l=St.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=St.initRefDependingOnDeviceResolution(r.sizes.phone.scale,r.sizes.tablet.scale,r.sizes.default.scale),d=i.computed(()=>r.modalWidth??window.innerWidth*c.value),u=()=>{o("opening"),s.value=!0,o("update:show",s.value)},h=(g="other")=>{if(a.value){o("processing:cancel",b=>{a.value=b});return}let m=!1;o("closing",g,()=>{m=!0}),m||(s.value=!1,o("update:show",s.value))},f=()=>{o("accept",m=>{a.value=m})};return i.watch(()=>r.show,g=>{g?u():h("other")}),i.watch(()=>r.processing,g=>{a.value=g}),e({open:u,close:h,acceptHandler:f}),(g,m)=>{const p=O.NButton,y=O.NModal;return i.openBlock(),i.createBlock(y,{loading:a.value,show:s.value,"show-icon":!1,size:i.unref(l),style:i.normalizeStyle(`width: ${d.value}px`),title:t.title,"trap-focus":t.trapFocus??!0,"action-class":g.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:m[1]||(m[1]=b=>h("header")),onEsc:m[2]||(m[2]=b=>h("esc")),onMaskClick:m[3]||(m[3]=b=>h("mask"))},i.createSlots({default:i.withCtx(()=>[i.renderSlot(g.$slots,"default")]),_:2},[g.$slots.header?{name:"header",fn:i.withCtx(()=>[i.renderSlot(g.$slots,"header")]),key:"0"}:void 0,g.$slots.action||g.$slots["extra-action"]||t.acceptButton.show||t.cancelButton.show?{name:"action",fn:i.withCtx(()=>[g.$slots["extra-action"]?(i.openBlock(),i.createElementBlock("div",Ab,[i.renderSlot(g.$slots,"extra-action")])):i.createCommentVNode("",!0),g.$slots.action||t.acceptButton.show||t.cancelButton.show?(i.openBlock(),i.createElementBlock("div",Ob,[i.renderSlot(g.$slots,"action",{disabled:a.value}),t.acceptButton.show??!0?(i.openBlock(),i.createBlock(p,{key:0,disabled:a.value||!t.valid,size:i.unref(l),type:"primary",onClick:f},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","size"])):i.createCommentVNode("",!0),t.cancelButton.show??!0?(i.openBlock(),i.createBlock(p,{key:1,size:i.unref(l),type:"default",onClick:m[0]||(m[0]=b=>h("footer"))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.cancelButton.text??"Отмена"),1)]),_:1},8,["size"])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["loading","show","size","style","title","trap-focus","action-class"])}}}),Db={class:"text-sm"},Lb={class:"text-sm"},Hb={},Wb=i.defineComponent({...Hb,__name:"add-product-to-cart-dialog",emits:["submit"],setup(t,{expose:e,emit:n}){const r=i.useTemplateRef("form-reference"),o=i.useTemplateRef("base-dialog-reference"),s=i.ref(null),a=i.computed(()=>{var x,B,w;return((x=s.value)==null?void 0:x.unit.isLinear)&&((w=(B=s.value)==null?void 0:B.properties)==null?void 0:w.isLengthConfigurator)}),l=i.ref(void 0),c=i.ref(void 0),d=i.ref(!0),u=i.ref(null),h=n,f=()=>({length:{},quantity:{},marker:{}}),g=i.ref(f()),m=i.ref(!1),p=i.computed(()=>{var N,V,R,I;if(!s.value)return{};const x=j.UnitsHelper.getProductLengthMultiplicity(s.value),B=j.UnitsHelper.getProductMultiplicity(s.value),w=((V=(N=s.value)==null?void 0:N.properties)==null?void 0:V.minLength)||x,T=(I=(R=s.value)==null?void 0:R.properties)==null?void 0:I.maxLength;return{length:[ae.required,ae.min(w??.1),ae.max(T),ae.step(x),He.serverValidation(g.value.length.feedback)],quantity:[ae.required,ae.min(B),ae.step(B),He.serverValidation(g.value.quantity.feedback)],marker:[He.serverValidation(g.value.marker.feedback)]}}),y=i.computed(()=>{var x,B,w;return s.value?((x=s.value.properties)==null?void 0:x.lengthStep)??((B=s.value.properties)!=null&&B.ignoreMinCountCheck?0:((w=s.value.properties)==null?void 0:w.minCount)??0):0}),b=i.computed(()=>{var w,T,N,V,R,I,W,ee,ne;if(!s.value)return"";const x=((T=(w=s.value)==null?void 0:w.properties)==null?void 0:T.minLength)??((V=(N=s.value)==null?void 0:N.properties)!=null&&V.ignoreMinCountCheck?0:(I=(R=s.value)==null?void 0:R.properties)==null?void 0:I.minCount),B=(ee=(W=s.value)==null?void 0:W.properties)==null?void 0:ee.maxLength;return x||B?`(${x?`от ${x}`:""}${x&&B?" ":""}${B?`до ${B}`:""} ${(ne=s.value)==null?void 0:ne.unit.name})`:""}),_=x=>{var V,R;if(!((R=(V=s.value)==null?void 0:V.properties)!=null&&R.isLengthConfigurator)||!u.value||M.isNil(x)||y.value===0)return;const B=x/y.value,w=Math.round(B),T=j.UnitsHelper.getProductMultiplicity(s.value),N=Math.max(w,T);u.value.quantity=N},C=x=>{var N,V,R,I;if(!((V=(N=s.value)==null?void 0:N.properties)!=null&&V.isLengthConfigurator)||!u.value||M.isNil(x)||y.value===0)return;const B=x*y.value,w=((R=s.value.properties)==null?void 0:R.minLength)||j.UnitsHelper.getProductLengthMultiplicity(s.value),T=(I=s.value.properties)==null?void 0:I.maxLength;w!==void 0&&B<w?u.value.length=w:T!==void 0&&B>T?u.value.length=T:u.value.length=B},k=async x=>{var w;const B=M.cloneDeep(u.value);try{await((w=r.value)==null?void 0:w.validate(T=>{if(!T){if(!s.value||!B)return;j.UnitsHelper.productIsMeasurable(s.value)||delete B.length,a.value&&y.value&&(B.length=y.value),m.value=!0,h("submit",B,g.value,()=>{m.value=!1,x(!1),i.nextTick(()=>{var N;(N=r.value)==null||N.validate(M.noop).catch(M.noop)})})}}))}catch{}},E=()=>{s.value=null,l.value=void 0,u.value=null,g.value=f()};return e({show:(x,B)=>{var w,T,N,V,R;if(s.value=x,l.value=B==null?void 0:B.cartItemData,c.value=B==null?void 0:B.orderId,d.value=(B==null?void 0:B.canSetDopProdaga)??!1,u.value=new j.OrderItemBase((B==null?void 0:B.cartItemData)??new j.OrderItemBase({product:x,quantity:j.UnitsHelper.productIsMeasurable(s.value)?1:((w=x==null?void 0:x.properties)==null?void 0:w.minCount)??1,length:((T=x==null?void 0:x.properties)==null?void 0:T.minLength)||((N=x==null?void 0:x.properties)!=null&&N.ignoreMinCountCheck?0:(V=x==null?void 0:x.properties)==null?void 0:V.minCount)||0})),(R=x==null?void 0:x.properties)!=null&&R.isLengthConfigurator&&u.value&&y.value>0){const I=y.value,W=u.value.quantity||1;u.value.length=W*I}},closeDialog:E}),(x,B)=>{var R;const w=O.NFormItem,T=O.NInputGroupLabel,N=O.NInputGroup,V=O.NCheckbox;return i.openBlock(),i.createBlock(qd,{ref:"base-dialog-reference",show:!i.unref(M.isNil)(s.value)&&!i.unref(M.isNil)(u.value),title:`${l.value?"Изменение":"Добавление"} товара ${(R=s.value)==null?void 0:R.name} в ${c.value?` заказ №${c.value}`:"корзину"}`,"accept-button":{show:!0,text:l.value?"Изменить":"Добавить"},processing:m.value,"modal-width":500,onAccept:k,onClosing:E},{default:i.withCtx(()=>{var I;return[s.value&&u.value?(i.openBlock(),i.createBlock(i.unref(O.NForm),{key:0,ref:"form-reference",model:u.value,rules:p.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message",onKeydown:i.withKeys(i.withModifiers((I=o.value)==null?void 0:I.acceptHandler,["prevent"]),["enter"])},{default:i.withCtx(()=>[i.unref(j.UnitsHelper).productIsMeasurable(s.value)?(i.openBlock(),i.createBlock(w,{key:0,path:"length",label:`Метраж, ${b.value+s.value.unit.name}`},i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:u.value.length,"onUpdate:value":[B[0]||(B[0]=W=>u.value.length=W),_],parse:i.unref(it),step:i.unref(j.UnitsHelper).getProductLengthMultiplicity(s.value),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:B[1]||(B[1]=W=>i.unref(Lr)(W,".",!1)),onInput:B[2]||(B[2]=W=>i.unref(et)(g.value,"length")),onFocus:i.unref(Le)},null,8,["value","parse","step","onFocus"])]),_:2},[!g.value.length.feedback&&i.unref(j.UnitsHelper).getProductLengthMultiplicity(s.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Db,"Метраж должно быть кратно "+i.toDisplayString(i.unref(j.UnitsHelper).getProductLengthMultiplicity(s.value)),1)]),key:"0"}:void 0]),1032,["label"])):i.createCommentVNode("",!0),i.createVNode(w,{path:"quantity",label:"Количество, шт."},{default:i.withCtx(()=>[i.createVNode(N,null,i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:u.value.quantity,"onUpdate:value":[B[3]||(B[3]=W=>u.value.quantity=W),C],parse:i.unref(it),step:i.unref(j.UnitsHelper).getProductMultiplicity(s.value),"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:B[4]||(B[4]=W=>i.unref(Lr)(W,".",!1)),onInput:B[5]||(B[5]=W=>i.unref(et)(g.value,"quantity")),onFocus:i.unref(Le)},null,8,["value","parse","step","onFocus"]),a.value?(i.openBlock(),i.createBlock(T,{key:0,class:"bg-orange-100 font-bold"},{default:i.withCtx(()=>[i.createTextVNode(" x "+i.toDisplayString(y.value)+" "+i.toDisplayString(s.value.unit.name),1)]),_:1})):i.createCommentVNode("",!0)]),_:2},[!g.value.quantity.feedback&&i.unref(j.UnitsHelper).getProductMultiplicity(s.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Lb,"Количество должно быть кратно "+i.toDisplayString(i.unref(j.UnitsHelper).getProductMultiplicity(s.value)),1)]),key:"0"}:void 0]),1024)]),_:1}),i.unref(j.UnitsHelper).productIsMeasurable(s.value)?(i.openBlock(),i.createBlock(w,{key:1,path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:B[6]||(B[6]=W=>i.unref(et)(g.value,"marker")),"onUpdate:value":B[7]||(B[7]=W=>u.value.marker=W??null),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1})):i.createCommentVNode("",!0),d.value?(i.openBlock(),i.createBlock(V,{key:2,checked:u.value.isAdditionalSale,"onUpdate:checked":B[8]||(B[8]=W=>u.value.isAdditionalSale=W),"true-value":!0,"false-value":!1},{default:i.withCtx(()=>[...B[9]||(B[9]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0)]),_:1},8,["model","rules","onKeydown"])):i.createCommentVNode("",!0)]}),_:1},8,["show","title","accept-button","processing"])}}}),jb={class:"flex flex-row gap-1"},qb={class:"sc-client-name flex flex-col gap-1 text-base"},Xb=["href"],Yb={key:1,class:"text-sc-grey"},Ub={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Kb={key:0},Gb={key:1,class:"text-sm"},Zb={},_r=i.defineComponent({...Zb,__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(t,{emit:e}){const n=t,r=e,o=i.computed(()=>n.client.lastLoginAt?en.format(n.client.lastLoginAt,j.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{M.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=Yo,d=O.NButton,u=O.NPopover;return i.openBlock(),i.createElementBlock("div",jb,[t.showClientInfoIcon?(i.openBlock(),i.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=h=>a.$emit("click:client-info",t.client))},{default:i.withCtx(()=>[i.createVNode(c)]),_:1})):i.createCommentVNode("",!0),i.createVNode(u,{disabled:i.unref(M.isNil)(t.popoverPosition),placement:t.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",qb,[i.createElementVNode("a",{href:t.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=h=>s(h))},[i.createElementVNode("span",{class:i.normalizeClass({"line-through":!t.client.isActive})},i.toDisplayString(t.client.name),3),t.showSalesDirection&&t.client.salesDirection?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass({"line-through":!t.client.isActive})}," ("+i.toDisplayString(t.client.salesDirection.name)+") ",3)):i.createCommentVNode("",!0),t.client.isActive?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",Yb," [ Деактивирован ] "))],8,Xb),t.showCityAndRegion&&t.client.city?(i.openBlock(),i.createElementBlock("span",Ub," г. "+i.toDisplayString(t.client.city.name)+", "+i.toDisplayString(t.client.city.region.name),1)):i.createCommentVNode("",!0)])]),default:i.withCtx(()=>[t.client.alternativeName?(i.openBlock(),i.createElementBlock("div",Kb,i.toDisplayString(t.client.alternativeName),1)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("span",Gb," Последний вход: "+i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),Qb={class:"text-base"},Jb={},Xd=i.defineComponent({...Jb,__name:"contragent-with-short-info",props:{contragent:{}},setup(t){const e=t,n=i.computed(()=>Wn.getFormatEntityName(e.contragent));return(r,o)=>(i.openBlock(),i.createElementBlock("span",Qb,i.toDisplayString(n.value),1))}}),e_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function t_(t,e){return i.openBlock(),i.createElementBlock("svg",e_,[...e[0]||(e[0]=[i.createElementVNode("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[i.createElementVNode("path",{d:"M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),i.createElementVNode("path",{d:"m3 7l9 6l9-6"})],-1)])])}const n_=i.markRaw({name:"tabler-mail",render:t_}),i_=["href"],r_={},o_=i.defineComponent({...r_,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(t){return(e,n)=>{const r=n_;return i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-row items-center gap-1":t.showEmailIcon})},[t.showEmailIcon?(i.openBlock(),i.createBlock(r,{key:0})):i.createCommentVNode("",!0),i.createElementVNode("a",{href:`mailto:${t.email}`,class:"no-underline"},i.toDisplayString(t.email),9,i_)],2)}}}),s_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function a_(t,e){return i.openBlock(),i.createElementBlock("svg",s_,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M444 49.9C431.3 38.2 379.9.9 265.3.4c0 0-135.1-8.1-200.9 52.3C27.8 89.3 14.9 143 13.5 209.5s-3.1 191.1 117 224.9h.1l-.1 51.6s-.8 20.9 13 25.1c16.6 5.2 26.4-10.7 42.3-27.8c8.7-9.4 20.7-23.2 29.8-33.7c82.2 6.9 145.3-8.9 152.5-11.2c16.6-5.4 110.5-17.4 125.7-142c15.8-128.6-7.6-209.8-49.8-246.5M457.9 287c-12.9 104-89 110.6-103 115.1c-6 1.9-61.5 15.7-131.2 11.2c0 0-52 62.7-68.2 79c-5.3 5.3-11.1 4.8-11-5.7c0-6.9.4-85.7.4-85.7q-.15 0 0 0C43.1 372.7 49.1 266.6 50.2 211.1s11.6-101 42.6-131.6c55.7-50.5 170.4-43 170.4-43c96.9.4 143.3 29.6 154.1 39.4c35.7 30.6 53.9 103.8 40.6 211.1m-139-80.8c.4 8.6-12.5 9.2-12.9.6c-1.1-22-11.4-32.7-32.6-33.9c-8.6-.5-7.8-13.4.7-12.9c27.9 1.5 43.4 17.5 44.8 46.2m20.3 11.3c1-42.4-25.5-75.6-75.8-79.3c-8.5-.6-7.6-13.5.9-12.9c58 4.2 88.9 44.1 87.8 92.5c-.1 8.6-13.1 8.2-12.9-.3m47 13.4c.1 8.6-12.9 8.7-12.9.1c-.6-81.5-54.9-125.9-120.8-126.4c-8.5-.1-8.5-12.9 0-12.9c73.7.5 133 51.4 133.7 139.2M374.9 329v.2c-10.8 19-31 40-51.8 33.3l-.2-.3c-21.1-5.9-70.8-31.5-102.2-56.5c-16.2-12.8-31-27.9-42.4-42.4c-10.3-12.9-20.7-28.2-30.8-46.6c-21.3-38.5-26-55.7-26-55.7c-6.7-20.8 14.2-41 33.3-51.8h.2c9.2-4.8 18-3.2 23.9 3.9c0 0 12.4 14.8 17.7 22.1c5 6.8 11.7 17.7 15.2 23.8c6.1 10.9 2.3 22-3.7 26.6l-12 9.6c-6.1 4.9-5.3 14-5.3 14s17.8 67.3 84.3 84.3c0 0 9.1.8 14-5.3l9.6-12c4.6-6 15.7-9.8 26.6-3.7c14.7 8.3 33.4 21.2 45.8 32.9c7 5.7 8.6 14.4 3.8 23.6"},null,-1)])])}const Yd=i.markRaw({name:"fa6-brands-viber",render:a_}),l_={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},c_=["id"],d_=["id"],u_=["fill"],h_=["fill"];function f_(t,e){return i.openBlock(),i.createElementBlock("svg",l_,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:t.idMap.SVGBRLHCcSy,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[0]||(e[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#1FAF38"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#60D669"},null,-1)])],8,c_),i.createElementVNode("linearGradient",{id:t.idMap.SVGHW6lecxh,x1:"50%",x2:"50%",y1:"100%",y2:"0%"},[...e[1]||(e[1]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#F9F9F9"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#FFF"},null,-1)])],8,d_)]),i.createElementVNode("path",{fill:"url(#"+t.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,u_),i.createElementVNode("path",{fill:"url(#"+t.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,h_),e[2]||(e[2]=i.createElementVNode("path",{fill:"#FFF",d:"M96.678 74.148c-2.386-5.303-4.897-5.41-7.166-5.503c-1.858-.08-3.982-.074-6.104-.074c-2.124 0-5.575.799-8.492 3.984c-2.92 3.188-11.148 10.892-11.148 26.561s11.413 30.813 13.004 32.94c1.593 2.123 22.033 35.307 54.405 48.073c26.904 10.609 32.379 8.499 38.218 7.967c5.84-.53 18.844-7.702 21.497-15.139c2.655-7.436 2.655-13.81 1.859-15.142c-.796-1.327-2.92-2.124-6.105-3.716s-18.844-9.298-21.763-10.361c-2.92-1.062-5.043-1.592-7.167 1.597c-2.124 3.184-8.223 10.356-10.082 12.48c-1.857 2.129-3.716 2.394-6.9.801c-3.187-1.598-13.444-4.957-25.613-15.806c-9.468-8.442-15.86-18.867-17.718-22.056c-1.858-3.184-.199-4.91 1.398-6.497c1.431-1.427 3.186-3.719 4.78-5.578c1.588-1.86 2.118-3.187 3.18-5.311c1.063-2.126.531-3.986-.264-5.579c-.798-1.593-6.987-17.343-9.819-23.64"},null,-1))])}const Ud=i.markRaw({name:"logos-whatsapp-icon",render:f_,setup(){const t=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+t(),SVGHW6lecxh:"uicons-"+t()}}}}),m_={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},g_=["id"],p_=["fill"];function y_(t,e){return i.openBlock(),i.createElementBlock("svg",m_,[i.createElementVNode("defs",null,[i.createElementVNode("linearGradient",{id:t.idMap.SVGuySfwdaH,x1:"50%",x2:"50%",y1:"0%",y2:"100%"},[...e[0]||(e[0]=[i.createElementVNode("stop",{offset:"0%","stop-color":"#2AABEE"},null,-1),i.createElementVNode("stop",{offset:"100%","stop-color":"#229ED9"},null,-1)])],8,g_)]),i.createElementVNode("path",{fill:"url(#"+t.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,p_),e[1]||(e[1]=i.createElementVNode("path",{fill:"#FFF",d:"M57.94 126.648q55.98-24.384 74.64-32.152c35.56-14.786 42.94-17.354 47.76-17.441c1.06-.017 3.42.245 4.96 1.49c1.28 1.05 1.64 2.47 1.82 3.467c.16.996.38 3.266.2 5.038c-1.92 20.24-10.26 69.356-14.5 92.026c-1.78 9.592-5.32 12.808-8.74 13.122c-7.44.684-13.08-4.912-20.28-9.63c-11.26-7.386-17.62-11.982-28.56-19.188c-12.64-8.328-4.44-12.906 2.76-20.386c1.88-1.958 34.64-31.748 35.26-34.45c.08-.338.16-1.598-.6-2.262c-.74-.666-1.84-.438-2.64-.258c-1.14.256-19.12 12.152-54 35.686c-5.1 3.508-9.72 5.218-13.88 5.128c-4.56-.098-13.36-2.584-19.9-4.708c-8-2.606-14.38-3.984-13.82-8.41c.28-2.304 3.46-4.662 9.52-7.072"},null,-1))])}const Kd=i.markRaw({name:"logos-telegram",render:y_,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),b_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function __(t,e){return i.openBlock(),i.createElementBlock("svg",b_,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M391 480c-19.52 0-46.94-7.06-88-30c-49.93-28-88.55-53.85-138.21-103.38C116.91 298.77 93.61 267.79 61 208.45c-36.84-67-30.56-102.12-23.54-117.13C45.82 73.38 58.16 62.65 74.11 52a176.3 176.3 0 0 1 28.64-15.2c1-.43 1.93-.84 2.76-1.21c4.95-2.23 12.45-5.6 21.95-2c6.34 2.38 12 7.25 20.86 16c18.17 17.92 43 57.83 52.16 77.43c6.15 13.21 10.22 21.93 10.23 31.71c0 11.45-5.76 20.28-12.75 29.81c-1.31 1.79-2.61 3.5-3.87 5.16c-7.61 10-9.28 12.89-8.18 18.05c2.23 10.37 18.86 41.24 46.19 68.51s57.31 42.85 67.72 45.07c5.38 1.15 8.33-.59 18.65-8.47c1.48-1.13 3-2.3 4.59-3.47c10.66-7.93 19.08-13.54 30.26-13.54h.06c9.73 0 18.06 4.22 31.86 11.18c18 9.08 59.11 33.59 77.14 51.78c8.77 8.84 13.66 14.48 16.05 20.81c3.6 9.53.21 17-2 22c-.37.83-.78 1.74-1.21 2.75a176.5 176.5 0 0 1-15.29 28.58c-10.63 15.9-21.4 28.21-39.38 36.58A67.4 67.4 0 0 1 391 480"},null,-1)])])}const Gd=i.markRaw({name:"ion-call",render:__}),w_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function x_(t,e){return i.openBlock(),i.createElementBlock("svg",w_,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l2 5l-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2m10 3a2 2 0 0 1 2 2m-2-6a6 6 0 0 1 6 6"},null,-1)])])}const k_=i.markRaw({name:"tabler-phone-call",render:x_}),v_={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},C_=["href"],S_=["href"],B_=["href"],T_=["href"],N_={},$_=i.defineComponent({...N_,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(t){const e=t,n=i.computed(()=>{try{return e.phone?sr.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=i.computed(()=>{var l;return M.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),o=i.computed(()=>{var l;return M.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=i.computed(()=>{var l;return M.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=k_,u=Gd,h=Kd,f=Ud,g=Yd;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",{class:i.normalizeClass({"border-xl relative inline-flex items-center rounded px-2":r.value&&a.value,"min-w-10":!0}),onClick:c[0]||(c[0]=m=>a.value=!a.value),onFocusout:c[1]||(c[1]=m=>a.value=!1),onMouseleave:c[2]||(c[2]=m=>a.value=!1)},[i.createElementVNode("div",{class:i.normalizeClass({"flex flex-row items-center gap-1":t.showPhoneIcon})},[t.showPhoneIcon?(i.openBlock(),i.createBlock(d,{key:0})):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(o.value),1)],2),r.value&&a.value?(i.openBlock(),i.createElementBlock("div",v_,[r.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:`tel:${s.value}`,class:"text-blue-600 hover:animate-pulse hover:text-blue-600"},[i.createVNode(u)],8,C_)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:1,href:`https://t.me/${s.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(h)],8,S_)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${s.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(f)],8,B_)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${s.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[i.createVNode(g)],8,T_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),E_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function R_(t,e){return i.openBlock(),i.createElementBlock("svg",E_,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"m20 8l-8 5l-8-5V6l8 5l8-5m0-2H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2"},null,-1)])])}const P_=i.markRaw({name:"mdi-envelope",render:R_}),F_={class:"flex flex-col gap-1"},V_={key:0,class:"mb-2 flex flex-col text-base"},I_={key:0,class:"text-sc-dark-grey text-sm"},M_={key:1,class:"whitespace-nowrap text-sm"},A_={key:2,class:"whitespace-nowrap text-sm"},O_={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},z_=["href"],D_=["href"],L_=["href"],H_=["href"],W_=["href"],j_={key:0,class:"flex flex-col text-base"},q_={key:0,class:"text-sc-dark-grey text-sm"},X_={key:1,class:"mt-2 text-sm"},Y_={key:0,class:"-mt-1"},U_={},K_=i.defineComponent({...U_,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(t){const e=t,n=i.computed(()=>Wn.getFormatEntityName(e.contact)),r=i.computed(()=>{try{return e.contact.phone?sr.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),o=i.computed(()=>{var d;return M.isString(r.value)?!1:((d=r.value)==null?void 0:d.isValid())??!1}),s=i.computed(()=>{var d;return M.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("INTERNATIONAL"))??""}),a=i.computed(()=>{var d;return M.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("E.164"))??""}),l=i.computed(()=>o.value||e.contact.email),c=i.ref(!1);return(d,u)=>{var b,_;const h=Gd,f=Kd,g=Ud,m=Yd,p=P_,y=O.NPopover;return i.openBlock(),i.createElementBlock("div",F_,[i.createVNode(y,{disabled:t.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var C,k,E,$;return[i.createElementVNode("div",{class:i.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(C=t.contact)!=null&&C.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${t.classes}`),style:i.normalizeStyle(t.styles),onMouseenter:u[0]||(u[0]=x=>c.value=!0),onFocusin:u[1]||(u[1]=x=>c.value=!0),onMouseleave:u[2]||(u[2]=x=>c.value=!1),onFocusout:u[3]||(u[3]=x=>c.value=!1)},[i.createElementVNode("div",null,[t.fullView&&(t.contact.name||(k=t.contact)!=null&&k.position)?(i.openBlock(),i.createElementBlock("div",V_,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),(E=t.contact)!=null&&E.position?(i.openBlock(),i.createElementBlock("span",I_,i.toDisplayString(($=t.contact)==null?void 0:$.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),t.contact.phone?(i.openBlock(),i.createElementBlock("div",M_,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("div",A_,i.toDisplayString(t.contact.email),1)):i.createCommentVNode("",!0),l.value&&c.value?(i.openBlock(),i.createElementBlock("div",O_,[o.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:`tel:${a.value}`,class:"text-blue-600 hover:text-3xl hover:text-blue-600"},[i.createVNode(h)],8,z_)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("a",{key:1,href:`https://t.me/${a.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(f)],8,D_)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${a.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(g)],8,L_)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${a.value}`,class:"text-purple-600 hover:text-3xl hover:text-purple-600"},[i.createVNode(m)],8,H_)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${t.contact.email}`,class:"hover:text-3xl"},[i.createVNode(p)],8,W_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var C,k,E,$;return[t.contact.name?(i.openBlock(),i.createElementBlock("div",j_,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),(C=t.contact)!=null&&C.position?(i.openBlock(),i.createElementBlock("span",q_,i.toDisplayString((k=t.contact)==null?void 0:k.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),(E=t.contact)!=null&&E.comment?(i.openBlock(),i.createElementBlock("div",X_,[u[4]||(u[4]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString(($=t.contact)==null?void 0:$.comment),1)])):i.createCommentVNode("",!0)]}),_:1},8,["disabled"]),t.fullView&&((b=t.contact)!=null&&b.comment)?(i.openBlock(),i.createElementBlock("div",Y_,[u[5]||(u[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((_=t.contact)==null?void 0:_.comment),1)])):i.createCommentVNode("",!0)])}}});class G_{constructor(e){S(this,"minHeight");S(this,"maxHeights");S(this,"minWidth");S(this,"maxWidths");S(this,"netType");S(this,"color");S(this,"mountType");S(this,"descriptions");S(this,"crossbarCount");S(this,"heightOverlaps");S(this,"widthOverlaps");S(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=qo.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=qo.objectToSnake(e.heightOverlaps),this.widthOverlaps=qo.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function Z_(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.SandwichM2?!0:t.properties.configuratorSettings!==void 0&&M.isArray(t.products)&&t.products.length>0}const Q_={class:"flex flex-wrap gap-2"},J_={class:"flex flex-col"},e1={class:"flex flex-col"},t1={},n1=i.defineComponent({...t1,__name:"date-range",props:{clearable:{type:Boolean,default:!0},dateRange:{default:void 0},dateFormat:{default:()=>j.useBaseConfigStateStore().config.dateFormats.uiDate},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1}},emits:["update:date-range"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{if(n.predefinedDateRanges)return n.predefinedDateRanges;if(n.useDefaultPredefinedDateRanges){const a={};return M.forOwn(j.DateTimeProvider.defaultDateRanges(),(l,c)=>{a[c]={label:l.label,from:l.from??void 0,to:l.to??void 0}}),a}}),s=(a,l)=>{r("update:date-range",{from:a?en.startOfDay(new Date(a)):void 0,to:l?en.endOfDay(new Date(l)):void 0})};return(a,l)=>{var u,h,f,g,m,p;const c=O.NButton,d=O.NDatePicker;return i.openBlock(),i.createElementBlock("div",Q_,[i.createVNode(d,{value:((h=(u=t.dateRange)==null?void 0:u.from)==null?void 0:h.getTime())??null,clearable:t.clearable,"is-date-disabled":y=>{var b,_;return((b=t.dateRange)==null?void 0:b.to)&&y>((_=t.dateRange)==null?void 0:_.to)},disabled:(f=t.disabled)==null?void 0:f.from,format:t.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[0]||(l[0]=y=>{var b,_;return s(y,(_=(b=t.dateRange)==null?void 0:b.to)==null?void 0:_.getTime())})},i.createSlots({_:2},[o.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",J_,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,(y,b)=>(i.openBlock(),i.createBlock(c,{key:b,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:_=>{var C,k;return s((C=y==null?void 0:y.from)==null?void 0:C.getTime(),(k=y==null?void 0:y.to)==null?void 0:k.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"]),i.createVNode(d,{value:((m=(g=t.dateRange)==null?void 0:g.to)==null?void 0:m.getTime())??null,clearable:t.clearable,"is-date-disabled":y=>{var b,_;return((b=t.dateRange)==null?void 0:b.from)&&y<((_=t.dateRange)==null?void 0:_.from)},disabled:(p=t.disabled)==null?void 0:p.to,format:t.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[1]||(l[1]=y=>{var b,_;return s((_=(b=t.dateRange)==null?void 0:b.from)==null?void 0:_.getTime(),y)})},i.createSlots({_:2},[o.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",e1,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,(y,b)=>(i.openBlock(),i.createBlock(c,{key:b,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:_=>{var C,k;return s((C=y==null?void 0:y.from)==null?void 0:C.getTime(),(k=y==null?void 0:y.to)==null?void 0:k.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"])])}}}),i1={class:"sc-lbl-date text-nowrap"},r1={},_o=i.defineComponent({...r1,__name:"date-time-label",props:{date:{},isTimeSecondary:{type:Boolean},isTimeOnSecondLine:{type:Boolean},isShowTime:{type:Boolean,default:!0}},setup(t){const e=t,n=i.computed(()=>en.format(e.date,j.useBaseConfigStateStore().config.dateFormats.uiDate)),r=i.computed(()=>en.format(e.date,"HH:mm"));return(o,s)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-col":t.isTimeOnSecondLine})},[i.createElementVNode("span",i1,i.toDisplayString(n.value),1),t.isShowTime?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass([{"text-sc-grey":t.isTimeSecondary,"ml-1":!t.isTimeOnSecondLine},"sc-lbl-time"])},i.toDisplayString(r.value),3)):i.createCommentVNode("",!0)],2))}}),o1={class:"flex flex-row gap-2.5"},s1={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},a1={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},l1={class:"mb-0.5 sm:mb-0 sm:ml-3"},c1={},d1=i.defineComponent({...c1,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(t){return(e,n)=>{const r=bo,o=O.NButton,s=O.NPopover;return i.openBlock(),i.createElementBlock("div",o1,[i.createElementVNode("div",s1,[i.renderSlot(e.$slots,"main")]),i.createElementVNode("div",null,[i.createElementVNode("div",a1,[i.renderSlot(e.$slots,"extra-buttons"),i.createElementVNode("div",l1,[t.showCloseButton?(i.openBlock(),i.createBlock(s,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(o,{size:"small",type:"error",onClick:n[0]||(n[0]=a=>e.$emit("close"))},{default:i.withCtx(()=>[i.createVNode(r)]),_:1})]),default:i.withCtx(()=>[n[1]||(n[1]=i.createTextVNode(" Закрыть ",-1))]),_:1})):i.createCommentVNode("",!0)])])])])}}}),u1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function h1(t,e){return i.openBlock(),i.createElementBlock("svg",u1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 176h40a40 40 0 0 1 40 40v208a40 40 0 0 1-40 40H136a40 40 0 0 1-40-40V216a40 40 0 0 1 40-40h40"},null,-1),i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"m176 272l80 80l80-80M256 48v288"},null,-1)])])}const f1=i.markRaw({name:"ion-download-outline",render:h1}),m1={},g1=i.defineComponent({...m1,__name:"single-file-upload-selector",props:{draggedAreaText:{},accept:{},isError:{type:Boolean}},emits:["update:file"],setup(t,{emit:e}){const n=t,r=e,o=i.ref([]),s=i.computed(()=>o.value.map(l=>(l.status=n.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=f1;return i.openBlock(),i.createBlock(i.unref(O.NUpload),{"file-list":s.value,"default-upload":!1,max:1,"show-retry-button":!1,action:"",accept:t.accept,"directory-dnd":"",class:"content-center","onUpdate:fileList":a},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NUploadDragger),null,{default:i.withCtx(()=>[i.renderSlot(l.$slots,"dragged-area",{},()=>[i.createElementVNode("div",null,[i.createVNode(d,{class:"text-2xl"}),i.createElementVNode("div",null,i.toDisplayString(t.draggedAreaText??"Перетащите в эту область файл, который необходимо загрузить."),1)])])]),_:3})]),_:3},8,["file-list","accept"])}}}),p1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function y1(t,e){return i.openBlock(),i.createElementBlock("svg",p1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"square","stroke-miterlimit":"10","stroke-width":"44",d:"M465 127L241 384l-92-92m-9 93l-93-93m316-165L236 273"},null,-1)])])}const b1=i.markRaw({name:"ion-checkmark-done-sharp",render:y1}),_1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function w1(t,e){return i.openBlock(),i.createElementBlock("svg",_1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128h80m-384 0h240m64 256h80m-384 0h240m-96-128h240m-384 0h80"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"128",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"176",cy:"256",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"384",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1)])])}const x1=i.markRaw({name:"ion-options-outline",render:w1}),k1={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},v1={class:"flex-auto"},C1={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"},S1={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"},B1={},qs=i.defineComponent({...B1,__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(t,{emit:e}){const n=e,r=i.ref(!1),o=()=>{n("edit")},s=()=>{r.value=!1},a=()=>{r.value=!0,n("apply",s)},l=()=>{n("cancel",s)};return(c,d)=>{const u=x1,h=O.NButton,f=O.NPopover,g=b1,m=bo;return i.openBlock(),i.createElementBlock("div",k1,[i.createElementVNode("div",v1,[i.renderSlot(c.$slots,"default")]),i.createElementVNode("div",null,[i.createElementVNode("div",C1,[i.createElementVNode("div",S1,[t.showEditButton?(i.openBlock(),i.createBlock(f,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(h,{disabled:t.disabled||r.value,type:"info",ghost:"",size:"small",onClick:o},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[0]||(d[0]=i.createTextVNode(" Редактировать данные ",-1))]),_:1})):i.createCommentVNode("",!0),t.showApplyButton?(i.openBlock(),i.createBlock(f,{key:1,disabled:r.value,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(h,{disabled:t.disabled||r.value,type:"primary",size:"small",onClick:a},{default:i.withCtx(()=>[i.createVNode(g)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[1]||(d[1]=i.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),t.showCancelButton?(i.openBlock(),i.createBlock(f,{key:2,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(h,{disabled:t.disabled||r.value,type:"error",size:"small",onClick:l},{default:i.withCtx(()=>[i.createVNode(m)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[2]||(d[2]=i.createTextVNode(" Отменить изменения ",-1))]),_:1})):i.createCommentVNode("",!0)]),i.renderSlot(c.$slots,"extra-buttons")])])])}}}),T1={},Zd=i.defineComponent({...T1,__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(t,{emit:e}){const n=t,r=e,o=i.ref(n.showEditor),s=l=>{r("editor:apply",d=>{o.value=!d,l()})},a=l=>{o.value=!1,l(),r("editor:cancel")};return i.onMounted(()=>{i.watch(()=>n.showEditor,l=>{o.value=l})}),(l,c)=>(i.openBlock(),i.createElementBlock("div",null,[o.value?(i.openBlock(),i.createBlock(qs,{key:1,disabled:t.disabled,"show-apply-button":!0,"show-cancel-button":!0,onApply:s,onCancel:a},{"extra-buttons":i.withCtx(()=>[i.renderSlot(l.$slots,"extra-editor-buttons")]),default:i.withCtx(()=>[i.renderSlot(l.$slots,"editor")]),_:3},8,["disabled"])):(i.openBlock(),i.createBlock(qs,{key:0,disabled:t.disabled,"show-edit-button":t.showEditButton,onEdit:c[0]||(c[0]=d=>o.value=!0)},{"extra-buttons":i.withCtx(()=>[i.renderSlot(l.$slots,"extra-viewer-buttons")]),default:i.withCtx(()=>[i.renderSlot(l.$slots,"viewer")]),_:3},8,["disabled","show-edit-button"]))]))}}),N1={},$1=i.defineComponent({...N1,__name:"debounced-input",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:800},placeholder:{default:""}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,o=i.ref(n.value),s=i.computed(()=>i.inject("debounce-input-time",n.debounceTime)),a=M.debounce(()=>r("update:value",o.value),s.value),l=c=>{o.value=c,a()};return i.watch(()=>n.value,c=>{o.value=c}),(c,d)=>(i.openBlock(),i.createBlock(i.unref(O.NInput),{value:o.value,"onUpdate:value":[d[0]||(d[0]=u=>o.value=u),l],clearable:t.clearable,placeholder:t.placeholder},{prefix:i.withCtx(()=>[i.renderSlot(c.$slots,"prefix")]),_:3},8,["value","clearable","placeholder"]))}}),E1={},R1=i.defineComponent({...E1,__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(t,{expose:e,emit:n}){const r=t,o=n,s=i.ref(r.value),a=i.computed(()=>i.inject("debounce-input-time",r.debounceTime)),l=M.debounce(()=>o("update:value",s.value),a.value),c=g=>{s.value=g,l()};i.watch(()=>r.value,g=>{s.value=g});const d=i.ref(null);return e({focus:()=>{var g;return(g=d.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=d.value)==null?void 0:g.blur()},select:()=>{var g;return(g=d.value)==null?void 0:g.select()}}),(g,m)=>(i.openBlock(),i.createBlock(i.unref(O.NInputNumber),{ref_key:"inputReference",ref:d,value:s.value??null,clearable:t.clearable,parse:t.parse,"show-button":t.showButton,placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,validator:t.validator,"onUpdate:value":c,onKeydown:m[0]||(m[0]=p=>o("keydown",p)),onInput:m[1]||(m[1]=p=>o("input",p)),onFocus:m[2]||(m[2]=p=>o("focus",p))},{prefix:i.withCtx(()=>[i.renderSlot(g.$slots,"prefix")]),_:3},8,["value","clearable","parse","show-button","placeholder","min","max","step","validator"]))}}),P1={},F1=i.defineComponent({...P1,__name:"phone-input",props:{value:{},debounceTime:{},disabled:{type:Boolean},placeholder:{},defaultCountry:{},preferredCountries:{},onlyCountries:{}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,o=i.ref((n.value??"").replaceAll(/\D*/g,"")),s=M.debounce(c=>r("update:value",c),n.debounceTime??0),a=c=>{let d="";if(M.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(M.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof sr.PhoneNumber?c.format("E.164"):`+${c.countryCallingCode}${c.nationalNumber}`}n.debounceTime?s(d):r("update:value",d)},l=c=>{const d=c.replaceAll(/\D*/g,"");try{const u=sr.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof sr.ParseError)o.value=d;else throw u}};return i.watch(()=>n.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}),i.onBeforeMount(()=>l(o.value??"")),(c,d)=>(i.openBlock(),i.createBlock(i.unref(of.VueTelInput),{modelValue:o.value,"onUpdate:modelValue":[d[0]||(d[0]=u=>o.value=u),a],"auto-default-country":!1,"auto-format":!0,"default-country":t.defaultCountry,disabled:t.disabled,"input-options":{placeholder:t.placeholder},"preferred-countries":t.preferredCountries,"only-countries":t.onlyCountries,mode:"international",class:"tel-input"},null,8,["modelValue","default-country","disabled","input-options","preferred-countries","only-countries"]))}}),V1=jn(F1,[["__scopeId","data-v-751dbb0e"]]),I1={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function M1(t,e){return i.openBlock(),i.createElementBlock("svg",I1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6m-7 1l9-9m-5 0h5v5"},null,-1)])])}const A1=i.markRaw({name:"tabler-external-link",render:M1}),O1={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},z1=["href"],D1={},L1=i.defineComponent({...D1,__name:"external-link",props:{text:{},url:{},description:{}},setup(t){return(e,n)=>{const r=A1,o=O.NTooltip;return i.openBlock(),i.createBlock(o,{disabled:i.unref(M.isUndefined)(t.description),placement:"top-start"},{trigger:i.withCtx(()=>[i.createElementVNode("span",O1,[i.createElementVNode("a",{href:t.url,target:"_blank",class:"no-underline"},i.toDisplayString(t.text),9,z1),i.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.description),1)]),_:1},8,["disabled"])}}}),H1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function W1(t,e){return i.openBlock(),i.createElementBlock("svg",H1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-miterlimit":"10","stroke-width":"32",d:"M448 256c0-106-86-192-192-192S64 150 64 256s86 192 192 192s192-86 192-192Z"},null,-1),i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M336 256H176"},null,-1)])])}const j1=i.markRaw({name:"ion-remove-circle-outline",render:W1});let wo=[];const Qd=new WeakMap;function q1(){wo.forEach(t=>t(...Qd.get(t))),wo=[]}function Jd(t,...e){Qd.set(t,e),!wo.includes(t)&&wo.push(t)===1&&requestAnimationFrame(q1)}function wr(t,e){let{target:n}=t;for(;n;){if(n.dataset&&n.dataset[e]!==void 0)return!0;n=n.parentElement}return!1}function xr(t){return t.composedPath()[0]||null}function kr(t){return typeof t=="string"?t.endsWith("px")?Number(t.slice(0,t.length-2)):Number(t):t}function vr(t){if(t!=null)return typeof t=="number"?`${t}px`:t.endsWith("px")?t:`${t}px`}function rn(t,e){const n=t.trim().split(/\s+/g),r={top:n[0]};switch(n.length){case 1:r.right=n[0],r.bottom=n[0],r.left=n[0];break;case 2:r.right=n[1],r.left=n[1],r.bottom=n[0];break;case 3:r.right=n[1],r.bottom=n[2],r.left=n[1];break;case 4:r.right=n[1],r.bottom=n[2],r.left=n[3];break;default:throw new Error("[seemly/getMargin]:"+t+" is not a valid value.")}return e===void 0?r:r[e]}const eu={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 X1(t,e,n){e/=100,n/=100;let r=(o,s=(o+t/60)%6)=>n-n*e*Math.max(Math.min(s,4-s,1),0);return[r(5)*255,r(3)*255,r(1)*255]}function Y1(t,e,n){e/=100,n/=100;let r=e*Math.min(n,1-n),o=(s,a=(s+t/30)%12)=>n-r*Math.max(Math.min(a-3,9-a,1),-1);return[o(0)*255,o(8)*255,o(4)*255]}const wn="^\\s*",xn="\\s*$",Zn="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Ht="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",gi="([0-9A-Fa-f])",pi="([0-9A-Fa-f]{2})",tu=new RegExp(`${wn}hsl\\s*\\(${Ht},${Zn},${Zn}\\)${xn}`),nu=new RegExp(`${wn}hsv\\s*\\(${Ht},${Zn},${Zn}\\)${xn}`),iu=new RegExp(`${wn}hsla\\s*\\(${Ht},${Zn},${Zn},${Ht}\\)${xn}`),ru=new RegExp(`${wn}hsva\\s*\\(${Ht},${Zn},${Zn},${Ht}\\)${xn}`),U1=new RegExp(`${wn}rgb\\s*\\(${Ht},${Ht},${Ht}\\)${xn}`),K1=new RegExp(`${wn}rgba\\s*\\(${Ht},${Ht},${Ht},${Ht}\\)${xn}`),G1=new RegExp(`${wn}#${gi}${gi}${gi}${xn}`),Z1=new RegExp(`${wn}#${pi}${pi}${pi}${xn}`),Q1=new RegExp(`${wn}#${gi}${gi}${gi}${gi}${xn}`),J1=new RegExp(`${wn}#${pi}${pi}${pi}${pi}${xn}`);function At(t){return parseInt(t,16)}function ew(t){try{let e;if(e=iu.exec(t))return[ko(e[1]),Qn(e[5]),Qn(e[9]),bi(e[13])];if(e=tu.exec(t))return[ko(e[1]),Qn(e[5]),Qn(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${t}.`)}catch(e){throw e}}function tw(t){try{let e;if(e=ru.exec(t))return[ko(e[1]),Qn(e[5]),Qn(e[9]),bi(e[13])];if(e=nu.exec(t))return[ko(e[1]),Qn(e[5]),Qn(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${t}.`)}catch(e){throw e}}function yi(t){try{let e;if(e=Z1.exec(t))return[At(e[1]),At(e[2]),At(e[3]),1];if(e=U1.exec(t))return[bt(e[1]),bt(e[5]),bt(e[9]),1];if(e=K1.exec(t))return[bt(e[1]),bt(e[5]),bt(e[9]),bi(e[13])];if(e=G1.exec(t))return[At(e[1]+e[1]),At(e[2]+e[2]),At(e[3]+e[3]),1];if(e=J1.exec(t))return[At(e[1]),At(e[2]),At(e[3]),bi(At(e[4])/255)];if(e=Q1.exec(t))return[At(e[1]+e[1]),At(e[2]+e[2]),At(e[3]+e[3]),bi(At(e[4]+e[4])/255)];if(t in eu)return yi(eu[t]);if(tu.test(t)||iu.test(t)){const[n,r,o,s]=ew(t);return[...Y1(n,r,o),s]}else if(nu.test(t)||ru.test(t)){const[n,r,o,s]=tw(t);return[...X1(n,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${t}.`)}catch(e){throw e}}function nw(t){return t>1?1:t<0?0:t}function Xs(t,e,n,r){return`rgba(${bt(t)}, ${bt(e)}, ${bt(n)}, ${nw(r)})`}function Ys(t,e,n,r,o){return bt((t*e*(1-r)+n*r)/o)}function iw(t,e){Array.isArray(t)||(t=yi(t)),Array.isArray(e)||(e=yi(e));const n=t[3],r=e[3],o=bi(n+r-n*r);return Xs(Ys(t[0],n,e[0],r,o),Ys(t[1],n,e[1],r,o),Ys(t[2],n,e[2],r,o),o)}function ze(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:yi(t);return typeof e.alpha=="number"?Xs(n,r,o,e.alpha):Xs(n,r,o,s)}function xo(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:yi(t),{lightness:a=1,alpha:l=1}=e;return rw([n*a,r*a,o*a,s*l])}function bi(t){const e=Math.round(Number(t)*100)/100;return e>1?1:e<0?0:e}function ko(t){const e=Math.round(Number(t));return e>=360||e<0?0:e}function bt(t){const e=Math.round(Number(t));return e>255?255:e<0?0:e}function Qn(t){const e=Math.round(Number(t));return e>100?100:e<0?0:e}function rw(t){const[e,n,r]=t;return 3 in t?`rgba(${bt(e)}, ${bt(n)}, ${bt(r)}, ${bi(t[3])})`:`rgba(${bt(e)}, ${bt(n)}, ${bt(r)}, 1)`}function ow(t=8){return Math.random().toString(16).slice(2,2+t)}function ou(t){return Array.isArray(t)?t:[t]}const Us={STOP:"STOP"};function su(t,e){const n=e(t);t.children!==void 0&&n!==Us.STOP&&t.children.forEach(r=>su(r,e))}function sw(t,e={}){const{preserveGroup:n=!1}=e,r=[],o=n?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(t),r}function aw(t,e){const{isLeaf:n}=t;return n!==void 0?n:!e(t)}function lw(t){return t.children}function cw(t){return t.key}function dw(){return!1}function uw(t,e){const{isLeaf:n}=t;return!(n===!1&&!Array.isArray(e(t)))}function hw(t){return t.disabled===!0}function fw(t,e){return t.isLeaf===!1&&!Array.isArray(e(t))}function mw(t,e){if(t.isLeaf===!0){const n=e(t);if(Array.isArray(n)&&n.length>0)return!0}return!1}function Ks(t){var e;return t==null?[]:Array.isArray(t)?t:(e=t.checkedKeys)!==null&&e!==void 0?e:[]}function Gs(t){var e;return t==null||Array.isArray(t)?[]:(e=t.indeterminateKeys)!==null&&e!==void 0?e:[]}function gw(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)||n.add(r)}),Array.from(n)}function pw(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)&&n.delete(r)}),Array.from(n)}function yw(t){return(t==null?void 0:t.type)==="group"}function bw(t){const e=new Map;return t.forEach((n,r)=>{e.set(n.key,r)}),n=>{var r;return(r=e.get(n))!==null&&r!==void 0?r:null}}class _w extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function ww(t,e,n,r){return vo(e.concat(t),n,r,!1)}function xw(t,e){const n=new Set;return t.forEach(r=>{const o=e.treeNodeMap.get(r);if(o!==void 0){let s=o.parent;for(;s!==null&&!(s.disabled||n.has(s.key));)n.add(s.key),s=s.parent}}),n}function kw(t,e,n,r){const o=vo(e,n,r,!1),s=vo(t,n,r,!0),a=xw(t,n),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function Zs(t,e){const{checkedKeys:n,keysToCheck:r,keysToUncheck:o,indeterminateKeys:s,cascade:a,leafOnly:l,checkStrategy:c,allowNotLoaded:d}=t;if(!a)return r!==void 0?{checkedKeys:gw(n,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:pw(n,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(n),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let h;o!==void 0?h=kw(o,n,e,d):r!==void 0?h=ww(r,n,e,d):h=vo(n,e,d,!1);const f=c==="parent",g=c==="child"||l,m=h,p=new Set,y=Math.max.apply(null,Array.from(u.keys()));for(let b=y;b>=0;b-=1){const _=b===0,C=u.get(b);for(const k of C){if(k.isLeaf)continue;const{key:E,shallowLoaded:$}=k;if(g&&$&&k.children.forEach(T=>{!T.disabled&&!T.isLeaf&&T.shallowLoaded&&m.has(T.key)&&m.delete(T.key)}),k.disabled||!$)continue;let x=!0,B=!1,w=!0;for(const T of k.children){const N=T.key;if(!T.disabled){if(w&&(w=!1),m.has(N))B=!0;else if(p.has(N)){B=!0,x=!1;break}else if(x=!1,B)break}}x&&!w?(f&&k.children.forEach(T=>{!T.disabled&&m.has(T.key)&&m.delete(T.key)}),m.add(E)):B&&p.add(E),_&&g&&m.has(E)&&m.delete(E)}}return{checkedKeys:Array.from(m),indeterminateKeys:Array.from(p)}}function vo(t,e,n,r){const{treeNodeMap:o,getChildren:s}=e,a=new Set,l=new Set(t);return t.forEach(c=>{const d=o.get(c);d!==void 0&&su(d,u=>{if(u.disabled)return Us.STOP;const{key:h}=u;if(!a.has(h)&&(a.add(h),l.add(h),fw(u.rawNode,s))){if(r)return Us.STOP;if(!n)throw new _w}})}),l}function vw(t,{includeGroup:e=!1,includeSelf:n=!0},r){var o;const s=r.treeNodeMap;let a=t==null?null:(o=s.get(t))!==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(),n||l.treeNodePath.pop(),l.keyPath=l.treeNodePath.map(c=>c.key),l}function Cw(t){if(t.length===0)return null;const e=t[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function Sw(t,e){const n=t.siblings,r=n.length,{index:o}=t;return e?n[(o+1)%r]:o===n.length-1?null:n[o+1]}function au(t,e,{loop:n=!1,includeDisabled:r=!1}={}){const o=e==="prev"?Bw:Sw,s={reverse:e==="prev"};let a=!1,l=null;function c(d){if(d!==null){if(d===t){if(!a)a=!0;else if(!t.disabled&&!t.isGroup){l=t;return}}else if((!d.disabled||r)&&!d.ignored&&!d.isGroup){l=d;return}if(d.isGroup){const u=Qs(d,s);u!==null?l=u:c(o(d,n))}else{const u=o(d,!1);if(u!==null)c(u);else{const h=Tw(d);h!=null&&h.isGroup?c(o(h,n)):n&&c(o(d,!0))}}}}return c(t),l}function Bw(t,e){const n=t.siblings,r=n.length,{index:o}=t;return e?n[(o-1+r)%r]:o===0?null:n[o-1]}function Tw(t){return t.parent}function Qs(t,e={}){const{reverse:n=!1}=e,{children:r}=t;if(r){const{length:o}=r,s=n?o-1:0,a=n?-1:o,l=n?-1:1;for(let c=s;c!==a;c+=l){const d=r[c];if(!d.disabled&&!d.ignored)if(d.isGroup){const u=Qs(d,e);if(u!==null)return u}else return d}}return null}const Nw={getChild(){return this.ignored?null:Qs(this)},getParent(){const{parent:t}=this;return t!=null&&t.isGroup?t.getParent():t},getNext(t={}){return au(this,"next",t)},getPrev(t={}){return au(this,"prev",t)}};function $w(t,e){const n=e?new Set(e):void 0,r=[];function o(s){s.forEach(a=>{r.push(a),!(a.isLeaf||!a.children||a.ignored)&&(a.isGroup||n===void 0||n.has(a.key))&&o(a.children)})}return o(t),r}function Ew(t,e){const n=t.key;for(;e;){if(e.key===n)return!0;e=e.parent}return!1}var Rw={};function lu(t,e,n,r,o,s=null,a=0){const l=[];return t.forEach((c,d)=>{var u;Rw.NODE_ENV!=="production"&&mw(c,o)&&console.error("[treemate]: node",c,"is invalid");const h=Object.create(r);if(h.rawNode=c,h.siblings=l,h.level=a,h.index=d,h.isFirstChild=d===0,h.isLastChild=d+1===t.length,h.parent=s,!h.ignored){const f=o(c);Array.isArray(f)&&(h.children=lu(f,e,n,r,o,h,a+1))}l.push(h),e.set(h.key,h),n.has(a)||n.set(a,[]),(u=n.get(a))===null||u===void 0||u.push(h)}),l}function Pw(t,e={}){var n;const r=new Map,o=new Map,{getDisabled:s=hw,getIgnored:a=dw,getIsGroup:l=yw,getKey:c=cw}=e,d=(n=e.getChildren)!==null&&n!==void 0?n:lw,u=e.ignoreEmptyChildren?k=>{const E=d(k);return Array.isArray(E)?E.length?E:null:E}:d,h=Object.assign({get key(){return c(this.rawNode)},get disabled(){return s(this.rawNode)},get isGroup(){return l(this.rawNode)},get isLeaf(){return aw(this.rawNode,u)},get shallowLoaded(){return uw(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(k){return Ew(this,k)}},Nw),f=lu(t,r,o,h,u);function g(k){if(k==null)return null;const E=r.get(k);return E&&!E.isGroup&&!E.ignored?E:null}function m(k){if(k==null)return null;const E=r.get(k);return E&&!E.ignored?E:null}function p(k,E){const $=m(k);return $?$.getPrev(E):null}function y(k,E){const $=m(k);return $?$.getNext(E):null}function b(k){const E=m(k);return E?E.getParent():null}function _(k){const E=m(k);return E?E.getChild():null}const C={treeNodes:f,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(k){return $w(f,k)},getNode:g,getPrev:p,getNext:y,getParent:b,getChild:_,getFirstAvailableNode(){return Cw(f)},getPath(k,E={}){return vw(k,E,C)},getCheckedKeys(k,E={}){const{cascade:$=!0,leafOnly:x=!1,checkStrategy:B="all",allowNotLoaded:w=!1}=E;return Zs({checkedKeys:Ks(k),indeterminateKeys:Gs(k),cascade:$,leafOnly:x,checkStrategy:B,allowNotLoaded:w},C)},check(k,E,$={}){const{cascade:x=!0,leafOnly:B=!1,checkStrategy:w="all",allowNotLoaded:T=!1}=$;return Zs({checkedKeys:Ks(E),indeterminateKeys:Gs(E),keysToCheck:k==null?[]:ou(k),cascade:x,leafOnly:B,checkStrategy:w,allowNotLoaded:T},C)},uncheck(k,E,$={}){const{cascade:x=!0,leafOnly:B=!1,checkStrategy:w="all",allowNotLoaded:T=!1}=$;return Zs({checkedKeys:Ks(E),indeterminateKeys:Gs(E),keysToUncheck:k==null?[]:ou(k),cascade:x,leafOnly:B,checkStrategy:w,allowNotLoaded:T},C)},getNonLeafKeys(k={}){return sw(f,k)}};return C}function Co(t){return t.composedPath()[0]}const Fw={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function Vw(t,e,n){if(t==="mousemoveoutside"){const r=o=>{e.contains(Co(o))||n(o)};return{mousemove:r,touchstart:r}}else if(t==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(Co(a))},s=a=>{r&&(e.contains(Co(a))||n(a))};return{mousedown:o,mouseup:s,touchstart:o,touchend:s}}return console.error(`[evtd/create-trap-handler]: name \`${t}\` is invalid. This could be a bug of evtd.`),{}}function cu(t,e,n){const r=Fw[t];let o=r.get(e);o===void 0&&r.set(e,o=new WeakMap);let s=o.get(n);return s===void 0&&o.set(n,s=Vw(t,e,n)),s}function Iw(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=cu(t,e,n);return Object.keys(o).forEach(s=>{Et(s,document,o[s],r)}),!0}return!1}function Mw(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=cu(t,e,n);return Object.keys(o).forEach(s=>{at(s,document,o[s],r)}),!0}return!1}function Aw(){if(typeof window>"u")return{on:()=>{},off:()=>{}};const t=new WeakMap,e=new WeakMap;function n(){t.set(this,!0)}function r(){t.set(this,!0),e.set(this,!0)}function o(x,B,w){const T=x[B];return x[B]=function(){return w.apply(x,arguments),T.apply(x,arguments)},x}function s(x,B){x[B]=Event.prototype[B]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var x;return(x=a.get(this))!==null&&x!==void 0?x:null}function d(x,B){l!==void 0&&Object.defineProperty(x,"currentTarget",{configurable:!0,enumerable:!0,get:B??l.get})}const u={bubble:{},capture:{}},h={};function f(){const x=function(B){const{type:w,eventPhase:T,bubbles:N}=B,V=Co(B);if(T===2)return;const R=T===1?"capture":"bubble";let I=V;const W=[];for(;I===null&&(I=window),W.push(I),I!==window;)I=I.parentNode||null;const ee=u.capture[w],ne=u.bubble[w];if(o(B,"stopPropagation",n),o(B,"stopImmediatePropagation",r),d(B,c),R==="capture"){if(ee===void 0)return;for(let D=W.length-1;D>=0&&!t.has(B);--D){const H=W[D],L=ee.get(H);if(L!==void 0){a.set(B,H);for(const A of L){if(e.has(B))break;A(B)}}if(D===0&&!N&&ne!==void 0){const A=ne.get(H);if(A!==void 0)for(const z of A){if(e.has(B))break;z(B)}}}}else if(R==="bubble"){if(ne===void 0)return;for(let D=0;D<W.length&&!t.has(B);++D){const H=W[D],L=ne.get(H);if(L!==void 0){a.set(B,H);for(const A of L){if(e.has(B))break;A(B)}}}}s(B,"stopPropagation"),s(B,"stopImmediatePropagation"),d(B)};return x.displayName="evtdUnifiedHandler",x}function g(){const x=function(B){const{type:w,eventPhase:T}=B;if(T!==2)return;const N=h[w];N!==void 0&&N.forEach(V=>V(B))};return x.displayName="evtdUnifiedWindowEventHandler",x}const m=f(),p=g();function y(x,B){const w=u[x];return w[B]===void 0&&(w[B]=new Map,window.addEventListener(B,m,x==="capture")),w[B]}function b(x){return h[x]===void 0&&(h[x]=new Set,window.addEventListener(x,p)),h[x]}function _(x,B){let w=x.get(B);return w===void 0&&x.set(B,w=new Set),w}function C(x,B,w,T){const N=u[B][w];if(N!==void 0){const V=N.get(x);if(V!==void 0&&V.has(T))return!0}return!1}function k(x,B){const w=h[x];return!!(w!==void 0&&w.has(B))}function E(x,B,w,T){let N;if(typeof T=="object"&&T.once===!0?N=ee=>{$(x,B,N,T),w(ee)}:N=w,Iw(x,B,N,T))return;const R=T===!0||typeof T=="object"&&T.capture===!0?"capture":"bubble",I=y(R,x),W=_(I,B);if(W.has(N)||W.add(N),B===window){const ee=b(x);ee.has(N)||ee.add(N)}}function $(x,B,w,T){if(Mw(x,B,w,T))return;const V=T===!0||typeof T=="object"&&T.capture===!0,R=V?"capture":"bubble",I=y(R,x),W=_(I,B);if(B===window&&!C(B,V?"bubble":"capture",x,w)&&k(x,w)){const ne=h[x];ne.delete(w),ne.size===0&&(window.removeEventListener(x,p),h[x]=void 0)}W.has(w)&&W.delete(w),W.size===0&&I.delete(B),I.size===0&&(window.removeEventListener(x,m,R==="capture"),u[R][x]=void 0)}return{on:E,off:$}}const{on:Et,off:at}=Aw(),Gi="@@mmoContext",Ow={mounted(t,{value:e}){t[Gi]={handler:void 0},typeof e=="function"&&(t[Gi].handler=e,Et("mousemoveoutside",t,e))},updated(t,{value:e}){const n=t[Gi];typeof e=="function"?n.handler?n.handler!==e&&(at("mousemoveoutside",t,n.handler),n.handler=e,Et("mousemoveoutside",t,e)):(t[Gi].handler=e,Et("mousemoveoutside",t,e)):n.handler&&(at("mousemoveoutside",t,n.handler),n.handler=void 0)},unmounted(t){const{handler:e}=t[Gi];e&&at("mousemoveoutside",t,e),t[Gi].handler=void 0}},Zi="@@coContext",So={mounted(t,{value:e,modifiers:n}){t[Zi]={handler:void 0},typeof e=="function"&&(t[Zi].handler=e,Et("clickoutside",t,e,{capture:n.capture}))},updated(t,{value:e,modifiers:n}){const r=t[Zi];typeof e=="function"?r.handler?r.handler!==e&&(at("clickoutside",t,r.handler,{capture:n.capture}),r.handler=e,Et("clickoutside",t,e,{capture:n.capture})):(t[Zi].handler=e,Et("clickoutside",t,e,{capture:n.capture})):r.handler&&(at("clickoutside",t,r.handler,{capture:n.capture}),r.handler=void 0)},unmounted(t,{modifiers:e}){const{handler:n}=t[Zi];n&&at("clickoutside",t,n,{capture:e.capture}),t[Zi].handler=void 0}};function zw(t,e){console.error(`[vdirs/${t}]: ${e}`)}class Dw{constructor(){this.elementZIndex=new Map,this.nextZIndex=2e3}get elementCount(){return this.elementZIndex.size}ensureZIndex(e,n){const{elementZIndex:r}=this;if(n!==void 0){e.style.zIndex=`${n}`,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,n){const{elementZIndex:r}=this;r.has(e)?r.delete(e):n===void 0&&zw("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((n,r)=>n[1]-r[1]),this.nextZIndex=2e3,e.forEach(n=>{const r=n[0],o=this.nextZIndex++;`${o}`!==r.style.zIndex&&(r.style.zIndex=`${o}`)})}}const Js=new Dw,Qi="@@ziContext",du={mounted(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n;t[Qi]={enabled:!!o,initialized:!1},o&&(Js.ensureZIndex(t,r),t[Qi].initialized=!0)},updated(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n,s=t[Qi].enabled;o&&!s&&(Js.ensureZIndex(t,r),t[Qi].initialized=!0),t[Qi].enabled=!!o},unmounted(t,e){if(!t[Qi].initialized)return;const{value:n={}}=e,{zIndex:r}=n;Js.unregister(t,r)}};function Lw(t){const e=i.ref(!!t.value);if(e.value)return i.readonly(e);const n=i.watch(t,r=>{r&&(e.value=!0,n())});return i.readonly(e)}function Zt(t){const e=i.computed(t),n=i.ref(e.value);return i.watch(e,r=>{n.value=r}),typeof t=="function"?n:{__v_isRef:!0,get value(){return n.value},set value(r){t.set(r)}}}const Hw=typeof window<"u";let Ji,Cr;(()=>{var t,e;Ji=Hw?(e=(t=document)===null||t===void 0?void 0:t.fonts)===null||e===void 0?void 0:e.ready:void 0,Cr=!1,Ji!==void 0?Ji.then(()=>{Cr=!0}):Cr=!0})();function Ww(t){if(Cr)return;let e=!1;i.onMounted(()=>{Cr||Ji==null||Ji.then(()=>{e||t()})}),i.onBeforeUnmount(()=>{e=!0})}function ea(t,e){return i.watch(t,n=>{n!==void 0&&(e.value=n)}),i.computed(()=>t.value===void 0?e.value:t.value)}function Bo(){const t=i.ref(!1);return i.onMounted(()=>{t.value=!0}),i.readonly(t)}function uu(t,e){return i.computed(()=>{for(const n of e)if(t[n]!==void 0)return t[n];return t[e[e.length-1]]})}const jw=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function qw(){return jw}function ta(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);return r()}function na(t,e=!0,n=[]){return t.forEach(r=>{if(r!==null){if(typeof r!="object"){(typeof r=="string"||typeof r=="number")&&n.push(i.createTextVNode(String(r)));return}if(Array.isArray(r)){na(r,e,n);return}if(r.type===i.Fragment){if(r.children===null)return;Array.isArray(r.children)&&na(r.children,e,n)}else r.type!==i.Comment&&n.push(r)}}),n}function hu(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);const o=na(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${t}]: slot[${n}] should have exactly one child.`)}let Jn=null;function fu(){if(Jn===null&&(Jn=document.getElementById("v-binder-view-measurer"),Jn===null)){Jn=document.createElement("div"),Jn.id="v-binder-view-measurer";const{style:t}=Jn;t.position="fixed",t.left="0",t.right="0",t.top="0",t.bottom="0",t.pointerEvents="none",t.visibility="hidden",document.body.appendChild(Jn)}return Jn.getBoundingClientRect()}function Xw(t,e){const n=fu();return{top:e,left:t,height:0,width:0,right:n.width-t,bottom:n.height-e}}function ia(t){const e=t.getBoundingClientRect(),n=fu();return{left:e.left-n.left,top:e.top-n.top,bottom:n.height+n.top-e.bottom,right:n.width+n.left-e.right,width:e.width,height:e.height}}function Yw(t){return t.nodeType===9?null:t.parentNode}function mu(t){if(t===null)return null;const e=Yw(t);if(e===null)return null;if(e.nodeType===9)return document;if(e.nodeType===1){const{overflow:n,overflowX:r,overflowY:o}=getComputedStyle(e);if(/(auto|scroll|overlay)/.test(n+o+r))return e}return mu(e)}const gu=i.defineComponent({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(t){var e;i.provide("VBinder",(e=i.getCurrentInstance())===null||e===void 0?void 0:e.proxy);const n=i.inject("VBinder",null),r=i.ref(null),o=b=>{r.value=b,n&&t.syncTargetWithParent&&n.setTargetRef(b)};let s=[];const a=()=>{let b=r.value;for(;b=mu(b),b!==null;)s.push(b);for(const _ of s)Et("scroll",_,h,!0)},l=()=>{for(const b of s)at("scroll",b,h,!0);s=[]},c=new Set,d=b=>{c.size===0&&a(),c.has(b)||c.add(b)},u=b=>{c.has(b)&&c.delete(b),c.size===0&&l()},h=()=>{Jd(f)},f=()=>{c.forEach(b=>b())},g=new Set,m=b=>{g.size===0&&Et("resize",window,y),g.has(b)||g.add(b)},p=b=>{g.has(b)&&g.delete(b),g.size===0&&at("resize",window,y)},y=()=>{g.forEach(b=>b())};return i.onBeforeUnmount(()=>{at("resize",window,y),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:m,removeResizeListener:p}},render(){return ta("binder",this.$slots)}}),pu=i.defineComponent({name:"Target",setup(){const{setTargetRef:t,syncTarget:e}=i.inject("VBinder");return{syncTarget:e,setTargetDirective:{mounted:t,updated:t}}},render(){const{syncTarget:t,setTargetDirective:e}=this;return t?i.withDirectives(hu("follower",this.$slots),[[e]]):hu("follower",this.$slots)}}),Uw="@css-render/vue3-ssr";function Kw(t,e){return`<style cssr-id="${t}">
104
104
  ${e}
105
105
  </style>`}function Gw(t,e,n){const{styles:r,ids:o}=n;o.has(t)||r!==null&&(o.add(t),r.push(Kw(t,e)))}const Zw=typeof document<"u";function _i(){if(Zw)return;const t=i.inject(Uw,null);if(t!==null)return{adapter:(e,n)=>Gw(e,n,t),context:t}}function yu(t,e){console.error(`[vueuc/${t}]: ${e}`)}function Qw(t){let e=0;for(let n=0;n<t.length;++n)t[n]==="&"&&++e;return e}const bu=/\s*,(?![^(]*\))\s*/g,Jw=/\s+/g;function ex(t,e){const n=[];return e.split(bu).forEach(r=>{let o=Qw(r);if(o){if(o===1){t.forEach(a=>{n.push(r.replace("&",a))});return}}else{t.forEach(a=>{n.push((a&&a+" ")+r)});return}let s=[r];for(;o--;){const a=[];s.forEach(l=>{t.forEach(c=>{a.push(l.replace("&",c))})}),s=a}s.forEach(a=>n.push(a))}),n}function tx(t,e){const n=[];return e.split(bu).forEach(r=>{t.forEach(o=>{n.push((o&&o+" ")+r)})}),n}function nx(t){let e=[""];return t.forEach(n=>{n=n&&n.trim(),n&&(n.includes("&")?e=ex(e,n):e=tx(e,n))}),e.join(", ").replace(Jw," ")}function _u(t){if(!t)return;const e=t.parentElement;e&&e.removeChild(t)}function To(t,e){return(e??document.head).querySelector(`style[cssr-id="${t}"]`)}function ix(t){const e=document.createElement("style");return e.setAttribute("cssr-id",t),e}function No(t){return t?/^\s*@(s|m)/.test(t):!1}const rx=/[A-Z]/g;function wu(t){return t.replace(rx,e=>"-"+e.toLowerCase())}function ox(t,e=" "){return typeof t=="object"&&t!==null?` {
106
106
  `+Object.entries(t).map(n=>e+` ${wu(n[0])}: ${n[1]};`).join(`