@snabcentr/vue-ui-lib 3.62.0 → 3.63.0

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
- `}},no=Li.Multiply,ap=[1,0,0,0,1,0,0,0,1],Kn=new un(9),lp=yt.Utils,Tc=new re,ks=new un([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 Li,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 un(9)),this._matrix.toTransformArray(!0,Kn),no(Kn,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,m,g,f,p;const y=e._renderer.vertices,b=this.canvas,_=this.ctx,C=t.renderer.ratio,x=Tc.copy(e._renderer.scale).multiply(C),$=e._stroke,R=e._linewidth,w=e._fill,S=e._renderer.opacity||e._opacity,k=e._cap,T=e._join,N=e._miter,E=e._closed,P=e.dashes,W=y.length,I=W-1;b.width=Math.max(Math.ceil(e._renderer.rect.width*x.x),1),b.height=Math.max(Math.ceil(e._renderer.rect.height*x.y),1);const Z=e._renderer.rect.centroid,te=Z.x,D=Z.y;if(_.clearRect(0,0,b.width,b.height),w)if(typeof w=="string")_.fillStyle=w;else{const X=yt.Utils.getRendererType(w._renderer.type);xe[X].render.call(w,_,e),_.fillStyle=w._renderer.effect}if($){if(typeof $=="string")_.strokeStyle=$;else{const X=yt.Utils.getRendererType($._renderer.type);xe[X].render.call($,_,e),_.strokeStyle=$._renderer.effect}R&&(_.lineWidth=hn(e)),N&&(_.miterLimit=N),T&&(_.lineJoin=T),!E&&k&&(_.lineCap=k)}typeof S=="number"&&(_.globalAlpha=S),P&&P.length>0&&(_.lineDashOffset=P.offset||0,_.setLineDash(P));let H,L,A,z,Y,U,M,j;_.save(),_.scale(x.x,x.y),_.translate(te,D),_.beginPath();for(let X=0;X<y.length;X++){const ee=y[X];switch(g=ee.x,f=ee.y,ee.command){case oe.close:_.closePath();break;case oe.arc:L=ee.rx,A=ee.ry,z=ee.xAxisRotation,Y=ee.largeArcFlag,U=ee.sweepFlag,n=E?Dt(X-1,W):Math.max(X-1,0),r=y[n],M=r.x,j=r.y,lp.renderSvgArcCommand(_,M,j,L,A,Y,U,z,g,f);break;case oe.curve:n=E?Dt(X-1,W):Math.max(X-1,0),r=y[n],d=r.controls&&r.controls.right||re.zero,u=ee.controls&&ee.controls.left||re.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),ee._relative?(s=u.x+ee.x,a=u.y+ee.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,g,f),X>=I&&E&&(o=H,h=ee.controls&&ee.controls.right||re.zero,m=o.controls&&o.controls.left||re.zero,ee._relative?(l=h.x+ee.x,c=h.y+ee.y):(l=h.x,c=h.y),o._relative?(s=m.x+o.x,a=m.y+o.y):(s=m.x,a=m.y),g=o.x,f=o.y,_.bezierCurveTo(l,c,s,a,g,f));break;case oe.line:_.lineTo(g,f);break;case oe.move:H=ee,_.moveTo(g,f);break}}E&&_.closePath(),xe.isHidden.test(w)||(p=w._renderer&&w._renderer.offset,p&&(_.save(),_.translate(-w._renderer.offset.x,-w._renderer.offset.y),_.scale(w._renderer.scale.x,w._renderer.scale.y)),_.fill(),p&&_.restore()),xe.isHidden.test($)||(p=$._renderer&&$._renderer.offset,p&&(_.save(),_.translate(-$._renderer.offset.x,-$._renderer.offset.y),_.scale($._renderer.scale.x,$._renderer.scale.y),_.lineWidth=R/$._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,m=d.controls;let g,f,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=m.left,_=m.right,!(!b||!_)&&(g=d._relative?b.x+u:b.x,f=d._relative?b.y+h:b.y,p=d._relative?_.x+u:_.x,y=d._relative?_.y+h:_.y,!(!g||!f||!p||!y)&&(s=Math.min(f,y,s),r=Math.min(g,p,r),o=Math.max(g,p,o),a=Math.max(f,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 un(9)),this._matrix.toTransformArray(!0,Kn),no(Kn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let h,m;this._scale instanceof re?(h=this._scale.x*r._renderer.scale.x,m=this._scale.y*r._renderer.scale.y):(h=this._scale*r._renderer.scale.x,m=this._scale*r._renderer.scale.y),this._renderer.scale.x=h<0?-h:h,this._renderer.scale.y=m<0?-m:m,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,ks,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 m=h;xe.isHidden.test(a)||(m+=l),r.width=pl(m),r.height=r.width;const g=m/r.width,f=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=hn(e)/g)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(f,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,m=this._renderer.vertices,g=this._renderer.collection.length,f=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 un(9)),this._matrix.toTransformArray(!0,Kn),no(Kn,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(f){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,m,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=Tc.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,m=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,f=g.x,p=g.y;let y,b,_,C,x,$,R,w,S,k,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=m,c)if(typeof c=="string")r.fillStyle=c;else{const E=yt.Utils.getRendererType(c._renderer.type);xe[E].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const E=yt.Utils.getRendererType(a._renderer.type);xe[E].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=hn(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(f,p),xe.isHidden.test(c)||(c._renderer&&c._renderer.offset?($=c._renderer.scale.x,R=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale($,R),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?($=a._renderer.scale.x,R=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale($,R),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,x=l/a._renderer.scale.x,r.lineWidth=x,r.strokeText(e.value,_,C),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(h)){const E=r.measureText(e.value);switch(h){case"underline":S=E.actualBoundingBoxDescent,T=E.actualBoundingBoxDescent;break;case"strikethrough":S=0,T=0;break}w=-E.width/2,k=E.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(w,S),r.lineTo(k,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 un(9)),this._matrix.toTransformArray(!0,Kn),no(Kn,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,ks,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 It("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 Lr};xe.ctx=xe.canvas.getContext("2d");var Nc=class extends Q{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 un(ap),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 It("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,ks,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"?Qo(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(Q.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(Nc,"Utils",xe);var cp=ie.extend({Error:It,getRatio:Qo,read:qe,xhr:xc},ie,Tt,hl,fl),Ce=class Ir{constructor(e){v(this,"_events",new Q),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:Ir.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=Ir.Types[r])}this.renderer=new Ir[this.type](this),this.setPlaying(n.autostart),this.frameCount=0,n.fullscreen?(this.fit=dp.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=up.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(Q.Types.resize,hp.bind(this)),this.scene=this.renderer.scene,Ir.Instances.push(this),n.autostart&&hr.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,hr.init(),this.trigger(Q.Types.play)}pause(){return this.playing=!1,this.trigger(Q.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(Q.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(Q.Types.render,this.frameCount++)}add(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.add(e),this}remove(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.remove(e),this}clear(){return this.scene.remove(this.scene.children),this}makeLine(e,n,r,o){const s=new Zr(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 Un(e,n,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,n,r,o,s){const a=new Ur(e,n,r,o,s);return this.scene.add(a),a}makeCircle(e,n,r,o){const s=new Xr(e,n,r,o);return this.scene.add(s),s}makeEllipse(e,n,r,o,s){const a=new Yr(e,n,r,o,s);return this.scene.add(a),a}makeStar(e,n,r,o,s){const a=new fs(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 hs(e,n,r,o);return this.scene.add(s),s}makeArcSegment(e,n,r,o,s,a,l){const c=new ss(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 us(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 fn(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 qr(e,n,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,n,r,o,s,a){const l=new kc(e,n,r,o,s,a);return this.add(l),l}makeImageSequence(e,n,r,o,s){const a=new ys(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)?(xc(e,l),r):(l(e),r)}};v(Ce,"NextFrameId",Nt.NextFrameId),v(Ce,"Types",Nt.Types),v(Ce,"Version",Nt.Version),v(Ce,"PublishDate",Nt.PublishDate),v(Ce,"Identifier",Nt.Identifier),v(Ce,"Resolution",Nt.Resolution),v(Ce,"AutoCalculateImportedMatrices",Nt.AutoCalculateImportedMatrices),v(Ce,"Instances",Nt.Instances),v(Ce,"uniqueId",Nt.uniqueId),v(Ce,"Anchor",Be),v(Ce,"Collection",qn),v(Ce,"Events",Q),v(Ce,"Group",ct),v(Ce,"Matrix",Li),v(Ce,"Path",$e),v(Ce,"Registry",Lr),v(Ce,"Element",Di),v(Ce,"Shape",Yn),v(Ce,"Text",fn),v(Ce,"Vector",re),v(Ce,"Gradient",ot),v(Ce,"Image",kc),v(Ce,"ImageSequence",ys),v(Ce,"LinearGradient",Ye),v(Ce,"RadialGradient",Ue),v(Ce,"Sprite",qr),v(Ce,"Stop",Xn),v(Ce,"Texture",Oe),v(Ce,"ArcSegment",ss),v(Ce,"Circle",Xr),v(Ce,"Ellipse",Yr),v(Ce,"Line",Zr),v(Ce,"Points",us),v(Ce,"Polygon",hs),v(Ce,"Rectangle",Un),v(Ce,"RoundedRectangle",Ur),v(Ce,"Star",fs),v(Ce,"CanvasRenderer",yt),v(Ce,"SVGRenderer",Bc),v(Ce,"WebGLRenderer",Nc),v(Ce,"Commands",oe),v(Ce,"Utils",cp);var gn=Ce;function dp(){const t=document.body.getBoundingClientRect(),e=this.width=t.width,n=this.height=t.height;this.renderer.setSize(e,n,this.ratio)}function up(){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 hp(t,e){this.width=t,this.height=e,this.trigger(Q.Types.resize,t,e)}var hr=Lt.getRequestAnimationFrame();function $c(){for(let t=0;t<gn.Instances.length;t++){const e=gn.Instances[t];e.playing&&e.update()}gn.NextFrameId=hr($c)}hr.init=function(){$c(),hr.init=function(){}};let pn;typeof window<"u"?pn=window:typeof global<"u"?pn=global:typeof self<"u"&&(pn=self);let Rc;const di=Math.PI*2,dt=Math.PI*.5;function fp(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 mp(t){Rc=t}function gp(t,e){e=e&&e.identity()||new Rc;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 ji(t,e){for(;t<0;)t+=e;return t%e}const Ec=pn.Float32Array||Array,pp=Math.floor;function yn(t){return pp(t*1e6)/1e6}const pe={move:"M",line:"L",curve:"C",close:"Z"};class ne{constructor(){B(this,"_events",{});B(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}}B(ne,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),B(ne,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Pc={x:{enumerable:!0,get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this._bound&&this.dispatchEvent(ne.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this._bound&&this.dispatchEvent(ne.Types.change))}}},ht=class ht extends ne{constructor(n=0,r=0){super();B(this,"_x",0);B(this,"_y",0);for(let o in Pc)Object.defineProperty(this,o,Pc[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:yn(this.x),y:yn(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}};B(ht,"zero",new ht),B(ht,"left",new ht(-1,0)),B(ht,"right",new ht(1,0)),B(ht,"up",new ht(0,-1)),B(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);B(this,"controls",{left:new be,right:new be});B(this,"_command",pe.move);B(this,"_relative",!0);B(this,"_rx",0);B(this,"_ry",0);B(this,"_xAxisRotation",0);B(this,"_largeArcFlag",0);B(this,"_sweepFlag",1);for(let u in Fc)Object.defineProperty(this,u,Fc[u]);this.command=c,this.relative=!0;const d=Fe.makeBroadcast(this);this.controls.left.set(o,s).addEventListener(ne.Types.change,d),this.controls.right.set(a,l).addEventListener(ne.Types.change,d)}static makeBroadcast(n){return r;function r(){n._bound&&n.dispatchEvent(ne.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:yn(this.x),y:yn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:yn(this.rx),ry:yn(this.ry),xAxisRotation:yn(this.xAxisRotation),largeArcFlag:yn(this.largeArcFlag),sweepFlag:yn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const Fc={command:{enumerable:!0,get:function(){return this._command},set:function(t){this._command!==t&&(this._command=t,this._bound&&this.dispatchEvent(ne.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(t){this._relative!==!!t&&(this._relative=!!t,this._bound&&this.dispatchEvent(ne.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(t){this._rx!==t&&(this._rx=t,this._bound&&this.dispatchEvent(ne.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(t){this._ry!==t&&(this._ry=t,this._bound&&this.dispatchEvent(ne.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(t){this._xAxisRotation!==t&&(this._xAxisRotation=t,this._bound&&this.dispatchEvent(ne.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(t){this._largeArcFlag!==t&&(this._largeArcFlag=t,this._bound&&this.dispatchEvent(ne.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(t){this._sweepFlag!==t&&(this._sweepFlag=t,this._bound&&this.dispatchEvent(ne.Types.change))}}};let yp=0;const vs={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return yp++}},io={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 ro(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 Vc(t,e,n,r,o,s,a,l,c){c=c||io.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 m=h/d,g=ro(m,t,n,o,a),f=ro(m,e,r,s,l);u.push(new Fe(g,f))}return u}function bp(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),m=9*(r-s)+3*(l-e),g=6*(e+s)-12*r,f=3*(r-e);function p(y){const b=(d*y+u)*y+h,_=(m*y+g)*y+f;return Math.sqrt(b*b+_*_)}return wp(p,0,1,c||io.RecursionLimit)}function _p(t,e,n,r,o,s,a,l){const c=[],d=[[],[]];let u,h,m,g,f,p,y,b;for(let $=0;$<2;++$){if($===0?(h=6*t-12*n+6*o,u=-3*t+9*n-9*o+3*a,m=3*n-3*t):(h=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,m=3*r-3*e),Math.abs(u)<.001){if(Math.abs(h)<.001)continue;g=-m/h,0<g&&g<1&&c.push(g);continue}y=h*h-4*m*u,b=Math.sqrt(y),!(y<0)&&(f=(-h+b)/(2*u),0<f&&f<1&&c.push(f),p=(-h-b)/(2*u),0<p&&p<1&&c.push(p))}let _=c.length,C=_,x;for(;_--;)g=c[_],x=1-g,d[0][_]=x*x*x*t+3*x*x*g*n+3*x*g*g*o+g*g*g*a,d[1][_]=x*x*x*e+3*x*x*g*r+3*x*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 wp(t,e,n,r){let o=io.abscissas[r-2],s=io.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 xp(t,e){const n=t.length,r=n-1;for(let o=0;o<n;o++){const s=t[o],a=e?ji(o-1,n):Math.max(o-1,0),l=e?ji(o+1,n):Math.min(o+1,r),c=t[a],d=s,u=t[l];kp(c,d,u),d.command=o===0?pe.move:pe.curve}}function kp(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 fr=(Bi=class extends ne{constructor(){super();B(this,"_flagId",!1);B(this,"_flagClassName",!1);B(this,"_renderer",{});B(this,"_id",vs.Identifier+vs.uniqueId());B(this,"_className","");B(this,"classList",[]);for(let n in Mc)Object.defineProperty(this,n,Mc[n])}static fromObject(n){const r=new Bi().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}},B(Bi,"Properties",["renderer","id","className"]),Bi);const Mc={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 oo extends Error{constructor(n){super();B(this,"name","Two.js");B(this,"message");this.message=n}}class vp{constructor(){B(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 so;const Ic={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};pn.document&&(so=document.createElement("a"));const Ge=class Ge extends fr{constructor(n,r){super();B(this,"_flagSrc",!1);B(this,"_flagImage",!1);B(this,"_flagVideo",!1);B(this,"_flagLoaded",!1);B(this,"_flagRepeat",!1);B(this,"_flagOffset",!1);B(this,"_flagScale",!1);B(this,"_src","");B(this,"_image",null);B(this,"_loaded",!1);B(this,"_repeat","no-repeat");B(this,"_scale",1);B(this,"_offset",null);for(let o in Ac)Object.defineProperty(this,o,Ac[o]);if(this._renderer.type="texture",this._renderer.flagOffset=Cp.bind(this),this._renderer.flagScale=Sp.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new be,typeof r=="function"){const o=(function(){this.unbind(ne.Types.load,o),typeof r=="function"&&r()}).bind(this);this.bind(ne.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 so?(so.href=n,so.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 pn.document?Ic.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(ne.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Ge.load(this,(function(){this.loaded=!0,this.trigger(ne.Types.change).trigger(ne.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}};B(Ge,"Properties",["src","loaded","repeat","scale","offset","image"]),B(Ge,"RegularExpressions",Ic),B(Ge,"ImageRegistry",new vp),B(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 oo("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 oo("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 Ac={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(ne.Types.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(ne.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(ne.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof be&&this._scale.bind(ne.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Cp(){this._flagOffset=!0}function Sp(){this._flagScale=!0}class ui extends Array{constructor(){super();qa(this,ft,new ne);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 Vt(this,ft)}set _events(n){Zh(this,ft,n)}get _bound(){return Vt(this,ft)._bound}set _bound(n){Vt(this,ft)._bound=n}addEventListener(){return Vt(this,ft).addEventListener.apply(this,arguments)}on(){return Vt(this,ft).on.apply(this,arguments)}bind(){return Vt(this,ft).bind.apply(this,arguments)}removeEventListener(){return Vt(this,ft).removeEventListener.apply(this,arguments)}off(){return Vt(this,ft).off.apply(this,arguments)}unbind(){return Vt(this,ft).unbind.apply(this,arguments)}dispatchEvent(){return Vt(this,ft).dispatchEvent.apply(this,arguments)}trigger(){return Vt(this,ft).trigger.apply(this,arguments)}listen(){return Vt(this,ft).listen.apply(this,arguments)}ignore(){return Vt(this,ft).ignore.apply(this,arguments)}pop(){const n=super.pop.apply(this,arguments);return this.trigger(ne.Types.remove,[n]),n}shift(){const n=super.shift.apply(this,arguments);return this.trigger(ne.Types.remove,[n]),n}push(){const n=super.push.apply(this,arguments);return this.trigger(ne.Types.insert,arguments),n}unshift(){const n=super.unshift.apply(this,arguments);return this.trigger(ne.Types.insert,arguments),n}splice(){const n=super.splice.apply(this,arguments);if(this.trigger(ne.Types.remove,n),arguments.length>2){const r=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(ne.Types.insert,r),this.trigger(ne.Types.order)}return n}sort(){return super.sort.apply(this,arguments),this.trigger(ne.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(ne.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 Oc=Array.prototype.slice;function Bp(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}const Me={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=Oc.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=Oc.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=!Bp(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:pn.performance&&pn.performance.now?pn.performance:Date},Ot=class Ot extends fr{constructor(n,r,o){super();B(this,"_flagOffset",!0);B(this,"_flagOpacity",!0);B(this,"_flagColor",!0);B(this,"_offset",0);B(this,"_opacity",1);B(this,"_color","#fff");for(let s in zc)Object.defineProperty(this,s,zc[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 Me.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",Me.each(Ot.Properties,r=>{n[r]=this[r]},this),n}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};B(Ot,"Index",0),B(Ot,"Properties",["offset","opacity","color"]);let hi=Ot;const zc={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)}}},kn=class kn extends fr{constructor(n){super();B(this,"_flagStops",!1);B(this,"_flagSpread",!1);B(this,"_flagUnits",!1);B(this,"_spread","");B(this,"_units","");for(let r in Dc)Object.defineProperty(this,r,Dc[r]);this._renderer.type="gradient",this._renderer.flagStops=Tp.bind(this),this._renderer.bindStops=Np.bind(this),this._renderer.unbindStops=$p.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 hi?s:new hi().copy(s)));const o=new kn(r).copy(n);return"id"in n&&(o.id=n.id),o}clone(n){const r=this.stops.map(s=>s.clone()),o=new kn(r);return Me.each(kn.Properties,s=>{o[s]=this[s]},this),n&&n.add(o),o}copy(n){super.copy.call(this,n);for(let r=0;r<kn.Properties.length;r++){const o=kn.Properties[r];o in n&&(this[o]=n[o])}return this}toObject(){const n={stops:this.stops.map(r=>r.toObject())};return Me.each(kn.Properties,r=>{n[r]=this[r]},this),n}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(ne.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}};B(kn,"Stop",hi),B(kn,"Properties",["spread","stops","units"]);let st=kn;const Dc={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(ne.Types.insert,e).unbind(ne.Types.remove,n),this._stops=new ui((t||[]).slice(0)),this._stops.bind(ne.Types.insert,e).bind(ne.Types.remove,n),e(this._stops)}}};function Tp(){this._flagStops=!0}function Np(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function $p(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}const ti=class ti extends st{constructor(n,r,o,s,a){super(a);B(this,"_flagEndPoints",!1);B(this,"_left",null);B(this,"_right",null);for(let l in Lc)Object.defineProperty(this,l,Lc[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=Rp.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 ti().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<ti.Properties.length;r++){const o=ti.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 ti(this.left._x,this.left._y,this.right._x,this.right._y,r);return Me.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(ne.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};B(ti,"Stop",hi),B(ti,"Properties",["left","right"]);let $t=ti;const Lc={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof be&&this._left.unbind(ne.Types.change,this._renderer.flagEndPoints),this._left=t,this._left.bind(ne.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(ne.Types.change,this._renderer.flagEndPoints),this._right=t,this._right.bind(ne.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function Rp(){this._flagEndPoints=!0}const vn=class vn extends st{constructor(n,r,o,s,a,l){super(s);B(this,"_flagRadius",!1);B(this,"_flagCenter",!1);B(this,"_flagFocal",!1);B(this,"_radius",0);B(this,"_center",null);B(this,"_focal",null);for(let c in Hc)Object.defineProperty(this,c,Hc[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Ep.bind(this),this._renderer.flagFocal=Pp.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 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&&(/(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 vn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return Me.each(st.Properties.concat(vn.Properties),function(s){o[s]=this[s]},this),n&&n.add(o),o}toObject(){const n=super.toObject.call(this);return Me.each(vn.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(ne.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};B(vn,"Stop",hi),B(vn,"Properties",["center","radius","focal"]);let Rt=vn;const Hc={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(ne.Types.change,this._renderer.flagCenter),this._center=t,this._center.bind(ne.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(t){this._focal&&this._focal.unbind(ne.Types.change,this._renderer.flagFocal),this._focal=t,this._focal.bind(ne.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function Ep(){this._flagCenter=!0}function Pp(){this._flagFocal=!0}function Wc(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 ao(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 jc(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(m||t).x,d=(m||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),m&&t._relative&&(s+=t.x,d+=t.y),bp(r,l,o,c,s,d,a,u,n)}function qc(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(m||t).x,d=(m||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),m&&t._relative&&(s+=t.x,d+=t.y),Vc(r,l,o,c,s,d,a,u,n)}function fi(t){switch(t.renderer.type){case"texture":return Ke.fromObject(t);case"gradient":return st.fromObject(t);case"linear-gradient":return $t.fromObject(t);case"radial-gradient":return Rt.fromObject(t)}return t}const Fp=Math.cos,Vp=Math.sin,Xc=Math.tan,Cs=[],Pt=class Pt extends ne{constructor(n,r,o,s,a,l){super();B(this,"elements",new Ec(9));B(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 w=n;let S,k,T;const N=r[0]||0,E=r[1]||0,P=r[2]||0;return S=w[0]*N+w[1]*E+w[2]*P,k=w[3]*N+w[4]*E+w[5]*P,T=w[6]*N+w[7]*E+w[8]*P,[S,k,T]}const s=n[0],a=n[1],l=n[2],c=n[3],d=n[4],u=n[5],h=n[6],m=n[7],g=n[8],f=r[0],p=r[1],y=r[2],b=r[3],_=r[4],C=r[5],x=r[6],$=r[7],R=r[8];return o=o||new Ec(9),o[0]=s*f+a*b+l*x,o[1]=s*p+a*_+l*$,o[2]=s*y+a*C+l*R,o[3]=c*f+d*b+u*x,o[4]=c*p+d*_+u*$,o[5]=c*y+d*C+u*R,o[6]=h*f+m*b+g*x,o[7]=h*p+m*_+g*$,o[8]=h*y+m*C+g*R,o}static fromObject(n){return new Pt().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(ne.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(ne.Types.change)}identity(){return this.elements[0]=Pt.Identity[0],this.elements[1]=Pt.Identity[1],this.elements[2]=Pt.Identity[2],this.elements[3]=Pt.Identity[3],this.elements[4]=Pt.Identity[4],this.elements[5]=Pt.Identity[5],this.elements[6]=Pt.Identity[6],this.elements[7]=Pt.Identity[7],this.elements[8]=Pt.Identity[8],this.trigger(ne.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(ne.Types.change);if(typeof o>"u"&&(o=1),typeof s>"u"){n=n||0,r=r||0,o=o||0,a=this.elements;const I=a[0]*n+a[1]*r+a[2]*o,Z=a[3]*n+a[4]*r+a[5]*o,te=a[6]*n+a[7]*r+a[8]*o;return[I,Z,te]}const h=this.elements,m=[n,r,o,s,a,l,c,d,u],g=h[0],f=h[1],p=h[2],y=h[3],b=h[4],_=h[5],C=h[6],x=h[7],$=h[8],R=m[0],w=m[1],S=m[2],k=m[3],T=m[4],N=m[5],E=m[6],P=m[7],W=m[8];return this.elements[0]=g*R+f*k+p*E,this.elements[1]=g*w+f*T+p*P,this.elements[2]=g*S+f*N+p*W,this.elements[3]=y*R+b*k+_*E,this.elements[4]=y*w+b*T+_*P,this.elements[5]=y*S+b*N+_*W,this.elements[6]=C*R+x*k+$*E,this.elements[7]=C*w+x*T+$*P,this.elements[8]=C*S+x*N+$*W,this.trigger(ne.Types.change)}inverse(n){const r=this.elements;n=n||new Pt;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],m=r[8],g=m*c-d*h,f=-m*l+d*u,p=h*l-c*u;let y=o*g+s*f+a*p;return y?(y=1/y,n.elements[0]=g*y,n.elements[1]=(-m*s+a*h)*y,n.elements[2]=(d*s-a*c)*y,n.elements[3]=f*y,n.elements[4]=(m*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=Fp(n),o=Vp(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=Xc(n);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(n){const r=Xc(n);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(n){return Cs.length=0,this.toTransformArray(n,Cs),Cs.map(yn).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 m=o[6],g=o[7],f=o[8];if(s){r[0]=a,r[1]=d,r[2]=m,r[3]=l,r[4]=u,r[5]=g,r[6]=c,r[7]=h,r[8]=f;return}return[a,d,m,l,u,g,c,h,f]}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 m=o[6],g=o[7],f=o[8];if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=h,r[6]=m,r[7]=g,r[8]=f;return}return[a,l,c,d,u,h,m,g,f]}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 Pt().copy(this)}};B(Pt,"Identity",[1,0,0,0,1,0,0,0,1]);let mr=Pt;mp(mr);const Pr=class Pr extends fr{constructor(){super();B(this,"_flagMatrix",!0);B(this,"_flagScale",!1);B(this,"_matrix",null);B(this,"_worldMatrix",null);B(this,"_position",null);B(this,"_rotation",0);B(this,"_scale",1);B(this,"_skewX",0);B(this,"_skewY",0);for(let n in lo)Object.defineProperty(this,n,lo[n]);this._renderer.flagMatrix=Yc.bind(this),this.isShape=!0,this.matrix=new mr,this.worldMatrix=new mr,this.position=new be,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(n){const r=new Pr().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 lo.position.get.apply(this,arguments)}set translation(n){lo.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 Pr;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}};B(Pr,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let $n=Pr;const lo={position:{enumerable:!0,get:function(){return this._position},set:function(t){this._position&&this._position.unbind(ne.Types.change,this._renderer.flagMatrix),this._position=t,this._position.bind(ne.Types.change,this._renderer.flagMatrix),Yc.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(ne.Types.change,this._renderer.flagMatrix),this._scale=t,this._scale instanceof be&&this._scale.bind(ne.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 gp(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function Yc(){this._flagMatrix=!0}const qi=Math.min,Xi=Math.max,Mp=Math.ceil,Ip=Math.floor,Ap=new be,on=class on extends $n{constructor(n,r,o,s){super();B(this,"_flagVertices",!0);B(this,"_flagLength",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagCap",!0);B(this,"_flagJoin",!0);B(this,"_flagMiter",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_flagMask",!1);B(this,"_flagClip",!1);B(this,"_length",0);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_cap","round");B(this,"_join","round");B(this,"_miter",4);B(this,"_closed",!0);B(this,"_curved",!1);B(this,"_automatic",!0);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_mask",null);B(this,"_clip",!1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);for(let a in Uc)Object.defineProperty(this,a,Uc[a]);this._renderer.type="path",this._renderer.flagVertices=Kc.bind(this),this._renderer.bindVertices=Gc.bind(this),this._renderer.unbindVertices=Zc.bind(this),this._renderer.flagFill=Qc.bind(this),this._renderer.flagStroke=Jc.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:fi(n.fill),o=typeof n.stroke=="string"?n.stroke:fi(n.stroke),s=new on().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<on.Properties.length;r++){const o=on.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new on;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<on.Properties.length;o++){const s=on.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()),Me.each(on.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,m=-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:f}=fp(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof g=="number"&&typeof f=="number"&&(o=Math.max(g,f)*(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,f]=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,x]=r.multiply(b,_),$=c.controls.left.x,R=c.controls.left.y;c.relative&&($+=c.x,R+=c.y);let[w,S]=r.multiply($,R);const k=_p(g,f,C,x,w,S,p,y);h=qi(k.min.y-o,h),d=qi(k.min.x-o,d),u=Xi(k.max.x+o,u),m=Xi(k.max.y+o,m)}else a<=1&&(h=qi(f-o,h),d=qi(g-o,d),u=Xi(g+o,u),m=Xi(f+o,m)),h=qi(y-o,h),d=qi(p-o,d),u=Xi(p+o,u),m=Xi(y+o,m)}return{top:h,left:d,right:u,bottom:m,width:u-d,height:m-h}}getPointAt(n,r){let o,s,a,l,c,d,u,h,m,g,f,p,y,b,_,C=this.length*Math.min(Math.max(n,0),1);const x=this.vertices.length,$=x-1;let R=null,w=null;for(let D=0,H=this._lengths.length,L=0;D<H;D++){if(L+this._lengths[D]>=C){this._closed?(o=ji(D,x),s=ji(D-1,x),D===0&&(o=s,s=D)):(o=D,s=Math.min(Math.max(D-1,0),$)),R=this.vertices[o],w=this.vertices[s],C-=L,this._lengths[D]!==0?n=C/this._lengths[D]:n=0;break}L+=this._lengths[D]}if(R===null||w===null)return null;if(R){if(!w)return R}else return w;_=w.controls&&w.controls.right,b=R.controls&&R.controls.left,c=w.x,g=w.y,d=(_||w).x,f=(_||w).y,u=(b||R).x,p=(b||R).y,h=R.x,y=R.y,_&&w.relative&&(d+=w.x,f+=w.y),b&&R.relative&&(u+=R.x,p+=R.y),l=ro(n,c,d,u,h),m=ro(n,g,f,p,y);const S=Gt(c,d,n),k=Gt(g,f,n),T=Gt(d,u,n),N=Gt(f,p,n),E=Gt(u,h,n),P=Gt(p,y,n),W=Gt(S,T,n),I=Gt(k,N,n),Z=Gt(T,E,n),te=Gt(N,P,n);return Me.isObject(r)?(r.x=l,r.y=m,r instanceof Fe&&(r.controls.left.x=W,r.controls.left.y=I,r.controls.right.x=Z,r.controls.right.y=te,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=m,r.controls.right.x-=l,r.controls.right.y-=m)),r.t=n,r):(a=new Fe(l,m,W-l,I-m,Z-l,te-m,this._curved?pe.curve:pe.line),a.t=n,a)}plot(){if(this.curved)return xp(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 Me.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=qc(c,s,n),a=a.concat(l),Me.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=qc(c,s,n),a=a.concat(l),Me.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=[]),Me.each(this.vertices,function(c,d){if(d<=0||c.command===pe.move){a=c,this._lengths[d]=0;return}this._lengths[d]=jc(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=ao(this,o*this._length),l=ao(this,s*this._length),c=Mp(a),d=Ip(l);let u,h,m,g,f,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?(f=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(s,f),f.command=this._renderer.collection[p].command,this._renderer.vertices.push(f),h=f,m=this._collection[p-1],m&&m.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f),m.relative?this._renderer.collection[p-1].controls.right.copy(m.controls.right).lerp(be.zero,1-f.t):this._renderer.collection[p-1].controls.right.copy(m.controls.right).lerp(m,1-f.t))):p>=c&&p<=d&&(f=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(f),p===d&&Wc(this,s)?(h=f,!r&&h.controls&&(h.relative?h.controls.right.clear():h.controls.right.copy(h))):p===c&&Wc(this,o)&&(u=f,u.command=pe.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(p=c-1,f=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(o,f),f.command=pe.move,this._renderer.vertices.unshift(f),g=this._collection[p+1],g&&g.controls&&(f.controls.left.clear(),g.relative?this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(be.zero,f.t):(Ap.copy(g),this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(g,f.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}};B(on,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),B(on,"Utils",{getCurveLength:jc});let Ie=on;const Uc={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 $t||this._fill instanceof Rt||this._fill instanceof Ke)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Rt||this._fill instanceof Ke)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Rt||this._stroke instanceof Ke)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Rt||this._stroke instanceof Ke)&&this._stroke.bind(ne.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";Me.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(ne.Types.insert,e).unbind(ne.Types.remove,n),t instanceof ui?this._collection=t:this._collection=new ui(t||[]),this._collection.bind(ne.Types.insert,e).bind(ne.Types.remove,n),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Me.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 Kc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Gc(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Zc(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Qc(){this._flagFill=!0}function Jc(){this._flagStroke=!0}const Op=Math.ceil,zp=Math.floor,Cn=class Cn extends $n{constructor(n){super();B(this,"_flagVertices",!0);B(this,"_flagLength",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagSize",!0);B(this,"_flagSizeAttenuation",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_length",0);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_size",1);B(this,"_sizeAttenuation",!1);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);B(this,"noFill",Ie.prototype.noFill);B(this,"noStroke",Ie.prototype.noStroke);B(this,"corner",Ie.prototype.corner);B(this,"center",Ie.prototype.center);B(this,"getBoundingClientRect",Ie.prototype.getBoundingClientRect);B(this,"_updateLength",Ie.prototype._updateLength);for(let r in ed)Object.defineProperty(this,r,ed[r]);this._renderer.type="points",this._renderer.flagVertices=Kc.bind(this),this._renderer.bindVertices=Gc.bind(this),this._renderer.unbindVertices=Zc.bind(this),this._renderer.flagFill=Qc.bind(this),this._renderer.flagStroke=Jc.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:fi(n.fill),o=typeof n.stroke=="string"?n.stroke:fi(n.stroke),s=new Cn().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<Cn.Properties.length;r++){const o=Cn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Cn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Cn.Properties.length;o++){const s=Cn.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),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()),Me.each(Cn.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=Vc(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=ao(this,n*this._length),s=ao(this,r*this._length),a=Op(o),l=zp(s);let c=0,d;this._renderer.vertices=[],this._renderer.collection=[];for(let u=0;u<this._collection.length;u++)u>=a&&u<=l&&(d=this._collection[u],this._renderer.collection.push(d),this._renderer.vertices[c*2+0]=d.x,this._renderer.vertices[c*2+1]=d.y,c++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};B(Cn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let co=Cn;const ed={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 $t||this._fill instanceof Rt||this._fill instanceof Ke)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Rt||this._fill instanceof Ke)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Rt||this._stroke instanceof Ke)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Rt||this._stroke instanceof Ke)&&this._stroke.bind(ne.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(ne.Types.insert,e).unbind(ne.Types.remove,n),t instanceof ui?this._collection=t:this._collection=new ui(t||[]),this._collection.bind(ne.Types.insert,e).bind(ne.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 td extends ui{constructor(n){n=Array.isArray(n)?n:Array.prototype.slice.call(arguments);super(n);qa(this,Ao,{});this.attach(n),this.on(ne.Types.insert,this.attach),this.on(ne.Types.remove,this.detach)}get ids(){return Vt(this,Ao)}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}}Ao=new WeakMap;const Vn=class Vn extends Ie{constructor(n,r,o,s,a,l,c){const d=c||vs.Resolution*3,u=[];for(let h=0;h<d;h++)u.push(new Fe);super(u,!0,!1,!0);B(this,"_flagStartAngle",!1);B(this,"_flagEndAngle",!1);B(this,"_flagInnerRadius",!1);B(this,"_flagOuterRadius",!1);B(this,"_startAngle",0);B(this,"_endAngle",di);B(this,"_innerRadius",0);B(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let h in nd)Object.defineProperty(this,h,nd[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=ji(n,di)===ji(r,di),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,h=0,m,g,f,p,y,b,_,C,x;for(a?d--:l||(d-=2),m=0,g=d-1;m<d;m++){switch(f=m/g,p=c[h],y=f*(r-n)+n,b=(r-n)/d,_=s*Math.cos(y),C=s*Math.sin(y),m){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&&(x=s*b/Math.PI,p.controls.left.x=x*Math.cos(y-dt),p.controls.left.y=x*Math.sin(y-dt),p.controls.right.x=x*Math.cos(y+dt),p.controls.right.y=x*Math.sin(y+dt),m===1&&p.controls.left.multiplyScalar(2),m===g&&p.controls.right.multiplyScalar(2)),h++}if(l){for(a?(c[h].command=pe.close,h++):(d--,g=d-1),m=0;m<d;m++)f=m/g,p=c[h],y=(1-f)*(r-n)+n,b=(r-n)/d,_=o*Math.cos(y),C=o*Math.sin(y),u=pe.curve,m<=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&&(x=o*b/Math.PI,p.controls.left.x=x*Math.cos(y+dt),p.controls.left.y=x*Math.sin(y+dt),p.controls.right.x=x*Math.cos(y-dt),p.controls.right.y=x*Math.sin(y-dt),m===1&&p.controls.left.multiplyScalar(2),m===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<Ie.Properties.length;d++){const u=Ie.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}};B(Vn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let Ss=Vn;const nd={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}}},Bs=Math.cos,Ts=Math.sin,Mn=class Mn extends Ie{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);B(this,"_flagRadius",!1);B(this,"_radius",0);this._renderer.type="circle";for(let c in id)Object.defineProperty(this,c,id[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 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._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*di,d=o*Bs(c),u=o*Ts(c),h=s*Bs(c-dt),m=s*Ts(c-dt),g=s*Bs(c+dt),f=s*Ts(c+dt),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(h,m),p.controls.right.set(g,f)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=new Mn(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<Ie.Properties.length;o++){const s=Ie.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<Mn.Properties.length;r++){const o=Mn.Properties[r];n[o]=this[o]}return n}};B(Mn,"Properties",["radius"]);let Ns=Mn;const id={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},$s=Math.cos,Rs=Math.sin,In=class In extends Ie{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);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_width",0);B(this,"_height",0);this._renderer.type="ellipse";for(let d in rd)Object.defineProperty(this,d,rd[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 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._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*di,d=o*$s(c),u=s*Rs(c),h=o*r*$s(c-dt),m=s*r*Rs(c-dt),g=o*r*$s(c+dt),f=s*r*Rs(c+dt),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(h,m),p.controls.right.set(g,f)}}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 In(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<Ie.Properties.length;l++){const c=Ie.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<In.Properties.length;r++){const o=In.Properties[r];n[o]=this[o]}return n}};B(In,"Properties",["width","height"]);let Es=In;const rd={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}}},Dp=Math.cos,Lp=Math.sin,An=class An extends Ie{constructor(n,r,o,s){s=Math.max(s||0,3);super();B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_flagSides",!1);B(this,"_radius",0);B(this,"_width",0);B(this,"_height",0);B(this,"_sides",0);this._renderer.type="polygon";for(let a in od)Object.defineProperty(this,a,od[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=di*a+Math.PI/2,c=this._width*Dp(l)/2,d=this._height*Lp(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<Ie.Properties.length;o++){const s=Ie.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}};B(An,"Properties",["width","height","sides"]);let Ps=An;const od={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}}},Ti=class Ti extends Ie{constructor(n,r,o,s){const a=[new Fe,new Fe,new Fe,new Fe];super(a,!0,!1,!0);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_width",0);B(this,"_height",0);B(this,"_origin",null);this._renderer.type="rectangle";for(let l in sd)Object.defineProperty(this,l,sd[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 Ti().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Ti.Properties.length;r++){const o=Ti.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 Ti(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<Ie.Properties.length;o++){const s=Ie.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}};B(Ti,"Properties",["width","height","origin"]);let gr=Ti;const sd={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(ne.Types.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(ne.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},On=class On extends Ie{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);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_flagRadius",!1);B(this,"_width",0);B(this,"_height",0);B(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in ad)Object.defineProperty(this,c,ad[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=Hp.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<Ie.Properties.length;l++){const c=Ie.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}};B(On,"Properties",["width","height","radius"]);let Fs=On;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}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof be&&this._radius.unbind(ne.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof be&&this._radius.bind(ne.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function Hp(){this._flagRadius=!0}const Wp=Math.cos,jp=Math.sin,zn=class zn extends Ie{constructor(n,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();B(this,"_flagInnerRadius",!1);B(this,"_flagOuterRadius",!1);B(this,"_flagSides",!1);B(this,"_innerRadius",0);B(this,"_outerRadius",0);B(this,"_sides",0);this._renderer.type="star";for(let l in ld)Object.defineProperty(this,l,ld[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=di*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*Wp(l),u=c*jp(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<Ie.Properties.length;l++){const c=Ie.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}};B(zn,"Properties",["innerRadius","outerRadius","sides"]);let Vs=zn;const ld={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 Ms;const cd=Math.min,dd=Math.max;pn.document&&(Ms=document.createElement("canvas"));const kt=class kt extends $n{constructor(n,r,o,s){super();B(this,"_flagValue",!0);B(this,"_flagFamily",!0);B(this,"_flagSize",!0);B(this,"_flagLeading",!0);B(this,"_flagAlignment",!0);B(this,"_flagBaseline",!0);B(this,"_flagStyle",!0);B(this,"_flagWeight",!0);B(this,"_flagDecoration",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagMask",!1);B(this,"_flagClip",!1);B(this,"_flagDirection",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_value","");B(this,"_family","sans-serif");B(this,"_size",13);B(this,"_leading",17);B(this,"_alignment","center");B(this,"_baseline","middle");B(this,"_style","normal");B(this,"_weight",500);B(this,"_decoration","none");B(this,"_direction","ltr");B(this,"_fill","#000");B(this,"_stroke","none");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_mask",null);B(this,"_clip",!1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);for(let a in ud)Object.defineProperty(this,a,ud[a]);if(this._renderer.type="text",this._renderer.flagFill=qp.bind(this),this._renderer.flagStroke=Xp.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,!Me.isObject(s))return this;for(let a=0;a<kt.Properties.length;a++){const l=kt.Properties[a];l in s&&(this[l]=s[l])}}static Measure(n){if(Ms){const r=Ms.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*kt.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:fi(n.fill),o=typeof n.stroke=="string"?n.stroke:fi(n.stroke),s=new kt().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<kt.Properties.length;r++){const o=kt.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new kt(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<kt.Properties.length;o++){const s=kt.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<kt.Properties.length;r++){const o=kt.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}=kt.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,m]=r.multiply(o,a),[g,f]=r.multiply(o,l),[p,y]=r.multiply(s,a),[b,_]=r.multiply(s,l);return a=cd(m,f,y,_),o=cd(h,g,p,b),s=dd(h,g,p,b),l=dd(m,f,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}};B(kt,"Ratio",.6),B(kt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let Yi=kt;const ud={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 $t||this._fill instanceof Rt||this._fill instanceof Ke)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Rt||this._fill instanceof Ke)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Rt||this._stroke instanceof Ke)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Rt||this._stroke instanceof Ke)&&this._stroke.bind(ne.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Me.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 qp(){this._flagFill=!0}function Xp(){this._flagStroke=!0}const Dn=class Dn extends gr{constructor(n,r,o,s){super(r,o,0,0);B(this,"_flagTextures",!1);B(this,"_flagFrameRate",!1);B(this,"_flagIndex",!1);B(this,"_amount",1);B(this,"_duration",0);B(this,"_index",0);B(this,"_startTime",0);B(this,"_playing",!1);B(this,"_firstFrame",0);B(this,"_lastFrame",0);B(this,"_loop",!0);B(this,"_textures",null);B(this,"_frameRate",0);B(this,"_origin",null);this._renderer.type="image-sequence";for(let a in hd)Object.defineProperty(this,a,hd[a]);this._renderer.flagTextures=Yp.bind(this),this._renderer.bindTextures=Up.bind(this),this._renderer.unbindTextures=Kp.bind(this),this.noStroke(),this.noFill(),Array.isArray(n)?this.textures=n.map(fd.bind(this)):typeof n=="string"&&(this.textures=[fd(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=Me.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,Me.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=Me.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}};B(Dn,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),B(Dn,"DefaultFrameRate",30);let Is=Dn;const hd={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(ne.Types.insert,e).unbind(ne.Types.remove,n),this._textures=new ui((t||[]).slice(0)),this._textures.bind(ne.Types.insert,e).bind(ne.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 Yp(){this._flagTextures=!0}function Up(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Kp(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function fd(t){if(t instanceof Ke)return t;if(typeof t=="string")return new Ke(t)}const Ni=class Ni extends gr{constructor(n,r,o,s,a,l){super(r,o,0,0);B(this,"_flagTexture",!1);B(this,"_flagColumns",!1);B(this,"_flagRows",!1);B(this,"_flagFrameRate",!1);B(this,"_flagIndex",!1);B(this,"_amount",1);B(this,"_duration",0);B(this,"_startTime",0);B(this,"_playing",!1);B(this,"_firstFrame",0);B(this,"_lastFrame",0);B(this,"_loop",!0);B(this,"_texture",null);B(this,"_columns",1);B(this,"_rows",1);B(this,"_frameRate",0);B(this,"_index",0);B(this,"_origin",null);this._renderer.type="sprite";for(let c in md)Object.defineProperty(this,c,md[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 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])}return this}play(n,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=Me.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 Ni(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,m,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,m=n.image.height,s=h/r,a=m/o,c=this._amount,this.width!==s&&(this.width=s),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&(Me.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=Me.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 f=this._index%r,p=Math.floor(this._index/r),y=-s*f+(h-s)/2,b=-a*p+(m-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}};B(Ni,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let As=Ni;const md={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}}},uo=Math.min,ho=Math.max,sn=class sn extends $n{constructor(n){super();B(this,"_flagAdditions",!1);B(this,"_flagSubtractions",!1);B(this,"_flagOrder",!1);B(this,"_flagOpacity",!0);B(this,"_flagBeginning",!1);B(this,"_flagEnding",!1);B(this,"_flagLength",!1);B(this,"_flagMask",!1);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_cap","round");B(this,"_join","round");B(this,"_miter",4);B(this,"_closed",!0);B(this,"_curved",!1);B(this,"_automatic",!0);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_length",0);B(this,"_mask",null);B(this,"_strokeAttenuation",!0);for(let r in gd)Object.defineProperty(this,r,gd[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++)pd.call(this,n[r],this)}static RemoveChildren(n){for(let r=0;r<n.length;r++)pd.call(this,n[r])}static OrderChildren(n){this._flagOrder=!0}static fromObject(n){const r=new sn;for(let s=0;s<sn.Properties.length;s++){const a=sn.Properties[s];a in n&&(/(fill|stroke)/i.test(a)?r[a]=typeof n[a]=="string"?n[a]:fi(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 Ss.fromObject(s);case"circle":return Ns.fromObject(s);case"element":return fr.fromObject(s);case"ellipse":return Es.fromObject(s);case"group":return sn.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Is.fromObject(s);case"path":return Ie.fromObject(s);case"points":return co.fromObject(s);case"polygon":return Ps.fromObject(s);case"rectangle":return gr.fromObject(s);case"rounded-rectangle":return Fs.fromObject(s);case"shape":return $n.fromObject(s);case"sprite":return As.fromObject(s);case"star":return Vs.fromObject(s);case"text":return Yi.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<sn.Properties.length;r++){const o=sn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new sn,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,Me.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,m=-1/0;const g=/texture|gradient/i;o=n?this.matrix:this.worldMatrix;for(let f=0;f<this.children.length;f++){const p=this.children[f];if(!(!p.visible||g.test(p._renderer.type))&&(r=p.getBoundingClientRect(n),s=typeof r.top!="number"||Me.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||Me.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||Me.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||Me.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),[x,$]=o.multiply(r.left,r.bottom),[R,w]=o.multiply(r.right,r.bottom);h=uo(b,C,$,w,h),d=uo(y,_,x,R,d),u=ho(y,_,x,R,u),m=ho(b,C,$,w,m)}else h=uo(r.top,h),d=uo(r.left,d),u=ho(r.right,u),m=ho(r.bottom,m)}return{top:h,left:d,right:u,bottom:m,width:u-d,height:m-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}};B(sn,"Children",td),B(sn,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let Rn=sn;const gd={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=Rn.InsertChildren.bind(this),n=Rn.RemoveChildren.bind(this),r=Rn.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new td(t),this._children.bind(ne.Types.insert,e),this._children.bind(ne.Types.remove,n),this._children.bind(ne.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,Me.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 pd(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 fo extends Ie{constructor(e,n,r,o){const s=[new Fe(e,n),new Fe(r,o)];super(s);for(let a in yd)Object.defineProperty(this,a,yd[a]);this.vertices[0].command=pe.move,this.vertices[1].command=pe.line,this.automatic=!1}}B(fo,"Properties",["left","right"]);const yd={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if(Me.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=pe.move;else{const e=new oo("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(Me.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=pe.line;else{const e=new oo("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class Os{constructor(e=0,n=0){this.x=e,this.y=n}}class bn{constructor(e=10,n=0,r="A"){B(this,"start",new Os);B(this,"end",new Os);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"}},Gp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Zp(t,e){return i.openBlock(),i.createElementBlock("svg",Gp,[...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 mo=i.markRaw({name:"ion-close",render:Zp}),Qp={class:"mr-3 flex flex-col gap-2"},Jp=["onClick"],ey={class:"h-full p-2"},ty={},ny=i.defineComponent({...ty,__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 m=(g=o.value)==null?void 0:g.at(h);m&&a("init-draw-template",m,u)}),(d=n.settings.customTemplates)==null||d.forEach((u,h)=>{var g;const m=(g=s.value)==null?void 0:g.at(h);m&&a("init-draw-template",m,u)})}),i.watch(()=>[...n.settings.customTemplates],(c,d)=>{i.nextTick(()=>{c.forEach((u,h)=>{var m;if(!(d!=null&&d.includes(u))){const g=(m=s.value)==null?void 0:m.at(h);g&&a("init-draw-template",g,u)}}),d.length>c.length&&d.forEach((u,h)=>{var g;const m=(g=s.value)==null?void 0:g.at(h);m&&(m.innerHTML="",a("init-draw-template",m,u))})})},{deep:!0}),(c,d)=>{const u=mo;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",Qp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.settings.allTemplates,(h,m)=>(i.openBlock(),i.createElementBlock("div",{key:`${h.id}-${m}`,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":m===t.selectTemplateIndex}]),onClick:g=>a("template:select",m)},[i.createElementVNode("div",ey,[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,Jp)]),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(m)},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),bd=Wn(ny,[["__scopeId","data-v-afccb364"]]),iy={class:"flex gap-3 min-w-[20rem] relative"},ry={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},oy={ref:"drawing-container",class:"size-full"},sy={},_d=i.defineComponent({...sy,__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 bn(n.value.configuratorParams.linesWidths[H],D,`A-${H+1}`))),h=i.computed(()=>n.value.configuratorParams.colorSide==="bottom"),m=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 bn(L[0],L[1],`A-${A+1}`):new bn(L.width,L.angle,`A-${A+1}`))}),f=(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],Y=D[A-1]??new bn(0,L);L+=!H||A>1?Y.angle:0;const U=(!H||A>0?z.angle:0)+L;if(D[A].end.x=z.width*Math.cos(U*Math.PI/180)+D[A].start.x,D[A].end.y=z.width*Math.sin(U*Math.PI/180)+D[A].start.y,A<D.length-1){const M=A+1;D[M].start.x=D[A].end.x,D[M].start.y=D[A].end.y}}return D},p=(D,H,L,A,z=!1)=>{let Y=f([...L,...A]);H.length>0&&(Y=[...f(H),...Y]);let U=0,M=0,j=0,X=0;Y.forEach(Te=>{U=Math.min(U,Te.start.x,Te.end.x),M=Math.min(M,Te.start.y,Te.end.y),j=Math.max(j,Te.start.x,Te.end.x),X=Math.max(X,Te.start.y,Te.end.y)});let ee,ue;U===0&&M===0&&j===0&&X===0?(ee=1,ue=1):(ee=D.width/Math.abs(j-U),ue=(z?D.height:D.height-je.colorSideLabel.size)/Math.abs(X-M));const ve=Math.min(ee,ue);return U=U<0?-U*ve:0,M=M<0?-M*ve:0,[ve,U,M]},y=D=>{const H=new co([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(ne.Types.change,()=>{L.vertices[0].copy(A)});const z=y(A);H.add(z)}D.forEach((L,A)=>{const z=D[A+1],Y=new be(L.vertices[1].x,L.vertices[1].y);Y.bind(ne.Types.change,()=>{L.vertices[1].copy(Y),z!==void 0&&z.vertices[0].copy(Y)});const U=y(Y);H.add(U)})},_=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},x=(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},$=(D,H,L)=>{const A=new Rn;if(D.length===0)return A;const z=[];return[...D].reverse().forEach((Y,U)=>{U!==0&&Y.angle>0&&(Y.angle*=-1),z.push(Y)}),D=f(z,!0),x(A,H,D[0].angle),[H.vertices[0],H.vertices[1]].forEach(Y=>{Y.bind(ne.Types.change,()=>{x(A,H,D[0].angle)})}),D.forEach(Y=>{const U=Y.start.x*L,M=Y.end.x*L,j=Y.start.y*L,X=Y.end.y*L,ee=new fo(U,j,M,X);ee.linewidth=je.line.size,ee.stroke=je.line.color,A.add(ee)}),A},R=(D,H,L)=>{const A=new Rn;return D.length===0||(D=f(D,!0),C(A,H,D[0].angle),[H.vertices[0],H.vertices[1]].forEach(z=>{z.bind(ne.Types.change,()=>{C(A,H,D[0].angle)})}),D.forEach(z=>{const Y=z.start.x*L,U=z.end.x*L,M=z.start.y*L,j=z.end.y*L,X=new fo(Y,M,U,j);X.linewidth=je.line.size,X.stroke=je.line.color,A.add(X)})),A},w=(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),Y=H.vertices[0].y+(H.vertices[1].y-H.vertices[0].y)/2-8*Math.cos(D.angle*Math.PI/180),U=new Yi(D.label,z+10,Y-10);let M;U.size=je.lineLabel.size,U.weight=600,U.fill=je.lineLabel.color,U.id+=1,U.rotation=je.lineLabel.rotation,A>0&&(M=new Yi(`${D.angle}°`,H.vertices[0].x+25,H.vertices[0].y-25),M.size=je.angleLabel.size,M.weight=600,M.fill=je.angleLabel.color,M.rotation=je.angleLabel.rotation,M.id+=A,s.push(M),L.add(M)),L.add(U),k(U,H,0,M),k(U,H,1)},S=()=>{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,Y=new Rn;if(!c)return Y;const U=5,M=Math.atan2(z-A,L-H),j=[new Fe(H,A,0,0,0,0,gn.Commands.move),new Fe(L,z,0,0,0,0,gn.Commands.line),new Fe(L-U*Math.cos(M-Math.PI/4),z-U*Math.sin(M-Math.PI/4),0,0,0,0,gn.Commands.line),new Fe(L,z,0,0,0,0,gn.Commands.move),new Fe(L-U*Math.cos(M+Math.PI/4),z-U*Math.sin(M+Math.PI/4),0,0,0,0,gn.Commands.line)],X=new Ie(j,!1,!1,!0);X.noFill(),X.cap="round",X.join="round",X.linewidth=D/7,X.stroke=je.colorSideLabel.color,Y.add(X);const ee=new Yi(h.value?"Цвет снизу":"Цвет сверху",10,0);ee.size=D,ee.weight=600,ee.fill=je.colorSideLabel.color,ee.alignment="left",Y.add(ee);const ue=Y.getBoundingClientRect();return Y.position.x=(c.width-ue.width)*d+10,Y.position.y=h.value?c.height+ue.height*2:ue.height/2,Y},k=(D,H,L,A)=>{H.vertices[L].bind(ne.Types.change,()=>{const z=H.vertices.length-1,Y=Math.atan2(H.vertices[0].y-H.vertices[z].y,H.vertices[0].x-H.vertices[z].x)*180/Math.PI,U=H.vertices[0].x+(H.vertices[z].x-H.vertices[0].x)/2-8*Math.sin(Y*Math.PI/180),M=H.vertices[0].y+(H.vertices[z].y-H.vertices[0].y)/2-8*Math.cos(Y*Math.PI/180);D.position.x=U+10,D.position.y=M-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 He;if(D.clear(),L.length===0){D.update();return}const Y=f(L),[U,M,j]=p(D,H,Y,A,z),X=new Rn,ee=new Array,ue=new Array;z||(s=[],a=[]),Y.forEach((ce,mt)=>{const Ne=ce.start.x*U+M,Ft=ce.end.x*U+M,Wt=ce.start.y*U+j,an=ce.end.y*U+j,Ct=new fo(Ne,Wt,Ft,an);Ct.linewidth=z?je.previewLine.size:je.line.size,Ct.stroke=z?je.previewLine.color:je.line.color,a.push(Ct),ee.push(Ct),X.add(Ct),!z&&ce.label!==""&&w(ce,Ct,X,mt)});const ve=ee.at(-1);let Te=X.getBoundingClientRect();if(!z){const ce=S();ue.push(ce)}if(H.length>0){const ce=$(H,ee[0],U);X.add(ce)}if(A.length>0&&ve){const ce=R(A,ve,U);X.add(ce)}if(ue.push(X),D.makeGroup(ue),Te=X.getBoundingClientRect(),X.position.x=0-Te.left+(D.width-Te.width)/(2*(z?1:d)),X.position.y=0-Te.top+(D.height-Te.height)/(2*(z?1:d)),D.update(),!z){const ce=((He=n.value.configuratorParams)==null?void 0:He.colorSide)==="top";X.position.y=X.position.y+je.colorSideLabel.size*Number(ce),b(ee,X),D.update()}},N=(D,H)=>{if(D&&!H.isNewRec()){const L=new gn({width:D.scrollWidth,height:D.scrollHeight});L.appendTo(D),T(L,[],H.points,[],!0)}},E=()=>{c&&T(c,m.value,u.value,g.value,!1)},P=D=>D*(180/Math.PI),W=(D,H)=>{const L=D[1].x-D[0].x,A=D[1].y-D[0].y,z=H[1].x-H[0].x,Y=H[1].y-H[0].y;let U=Math.atan2(L*Y-A*z,L*z+A*Y);return U=P(U),Math.round(U)*-1},I=D=>{const H=a.map((L,A,z)=>{const Y=z[A-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let U=Math.ceil(L._length/D/n.settings.lineWidthStep)*n.settings.lineWidthStep;const M=s[A-1];U<(z.length>1?n.settings.minLineWidth:n.settings.stripMinWidth)&&(U=z.length>1?n.settings.minLineWidth:n.settings.stripMinWidth),U>n.settings.maxLineWidth&&(U=n.settings.maxLineWidth);const j=W(L.vertices,Y.vertices);return M&&(M.value=`${j}°`),new bn(U,j,`A-${A+1}`)});r("pointer:move",H)},Z=D=>{let H=null,L;const A=M=>{H=l.find(j=>{const X=j.renderer;return(X==null?void 0:X.elem)===M.target}),[L]=p(D,m.value,u.value.map(j=>j),g.value)},z=M=>{if(H){const j=H.renderer,X=j==null?void 0:j.elem;if(!X)return;const ee=X.getBoundingClientRect();H.vertices[0].x-=ee.x-(M instanceof MouseEvent?M.clientX:M.targetTouches[0].clientX)+je.anchorPoint.size/2,H.vertices[0].y-=ee.y-(M instanceof MouseEvent?M.clientY:M.targetTouches[0].clientY)+je.anchorPoint.size/2,I(L),D.update()}},Y=()=>{H&&r("pointer:up",u.value),H=null},U=o.value;U&&(U.addEventListener("touchstart",A,{passive:!0}),U.addEventListener("touchend",Y,{passive:!0}),U.addEventListener("mousedown",A),U.addEventListener("mouseup",Y),U.addEventListener("mousemove",z),U.addEventListener("touchmove",z,{passive:!0}))},te=(D,H)=>{r("remove-custom-template",D,H)};return i.onMounted(()=>{o.value&&(c=new gn({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),i.watch(()=>n.value,()=>{E()},{deep:!0,immediate:!0}),Z(c))}),i.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(D,H)=>(i.openBlock(),i.createElementBlock("div",iy,[i.createVNode(bd,{"select-template-index":t.selectTemplateIndex,settings:t.settings,"onTemplate:select":H[0]||(H[0]=L=>r("template:select",L)),onInitDrawTemplate:N,onRemoveCustomTemplate:te},null,8,["select-template-index","settings"]),i.createElementVNode("div",ry,[i.createElementVNode("div",oy,null,512)])]))}});class Ui extends K.Identity{constructor(n,r){super();B(this,"label","");B(this,"points",[]);B(this,"isCustom",!1);B(this,"id",-1);B(this,"guid","");n?(this.label=n.label,this.points=n.points.map((o,s)=>V.isArray(o)?new bn(o[0],o[1],`A-${s+1}`):new bn(o.width,o.angle,`A-${s+1}`)),this.isCustom=n.isCustom):(this.label="-- Новая конфигурация --",this.points=[new bn(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class zs extends Ui{constructor(n){super(n);B(this,"isDefault");this.isDefault=n.isDefault??!1}}class wd{constructor(e){B(this,"minLineWidth");B(this,"maxLineWidth");B(this,"lineWidthStep");B(this,"minLineAngle");B(this,"maxLineAngle");B(this,"lineAngleStep");B(this,"stripMinWidth");B(this,"stripMaxWidth");B(this,"stripMinLength");B(this,"stripMaxLength");B(this,"allowShowTable");B(this,"showOnlyTemplates");B(this,"templates");B(this,"customTemplates",[]);B(this,"startTailConfigs");B(this,"endTailConfigs");B(this,"bendCountForExtended");B(this,"extendedProductCatalog");B(this,"allowChangeFirstPoint");B(this,"allowSaveTemplates");B(this,"userTemplatesPrefix");B(this,"lengthStep");B(this,"canSetDopProdaga");var 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 Ui(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((n=e.startTailConfigs)==null?void 0:n.map(o=>new zs(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new zs(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 Ui(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new Ui({label:"-- Новая конфигурация --",points:[new bn(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 Ui(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 ay={class:"flex flex-col gap-3"},ly={class:"grid gap-5 md:grid-cols-5"},cy={},xd=i.defineComponent({...cy,__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 wd(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),m=i.useTemplateRef("kozyrek-configurator-params-form"),g=(k=0)=>{var N;const T=(N=c.value.allTemplates)==null?void 0:N.at(k);T!==void 0&&(h.value=k,l.value.configuratorParams.linesWidths=T.points.map(E=>V.isArray(E)?E[0]:E.width),l.value.configuratorParams.linesAngles=T.points.map(E=>V.isArray(E)?E[1]:E.angle),C()),b(l.value.configuratorParams)},f=async()=>{const k=prompt("Введите название шаблона:");if(!k)return;a.value=!0;const T={label:k,points:l.value.configuratorParams.linesWidths.map((E,P)=>[E,l.value.configuratorParams.linesAngles[P]])},N=E=>{E&&(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(k,T)=>{var P;const N=(P=c.value.allTemplates)==null?void 0:P.at(k);if(!N||!N.isCustom)return;const E=W=>{W&&(c.value.removeCustomTemplate(N.id),g()),T==null||T()};n.eventEmitter.emit("configurator:remove-template",{category:n.cartItem.category,templateId:N.id,callback:E})},y=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(h.value=c.value.allTemplates.length-1)},b=async k=>{var T,N;l.value.product=new K.ClientProduct,(N=(T=m.value)==null?void 0:T.formReference)==null||N.validate(E=>{E||(C(),o.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:k,validationFieldResultData:u.value,callback:P=>{P?l.value.product=P:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(V.noop)},_=async()=>{var k,T;(T=(k=m.value)==null?void 0:k.formReference)==null||T.validate(N=>{N||(s.value=!0,r("submit",l.value,u.value,()=>{s.value=!1,i.nextTick(()=>{var E,P;(P=(E=m.value)==null?void 0:E.formReference)==null||P.restoreValidation()})}))}).catch(V.noop)},C=()=>{const k={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach((T,N)=>{k[`lines_widths[${N+1}]`]={},k[`lines_angles[${N+1}]`]={}}),u.value=k},x=k=>{d.value.linesWidths=k.map(T=>T.width),d.value.linesAngles=k.map(T=>T.angle)},$=k=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,C(),y(),b(l.value.configuratorParams)},R=(k,T)=>{d.value.linesWidths=k,d.value.linesAngles=T},w=k=>{const T=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,N=0;l.value.configuratorParams.linesWidths.splice(k+1,0,T),l.value.configuratorParams.linesAngles.splice(k+1,0,N),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],C(),y(),b(l.value.configuratorParams)},S=k=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(k,1),l.value.configuratorParams.linesAngles.splice(k,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],C(),y(),b(l.value.configuratorParams))};return i.onBeforeMount(()=>{g()}),i.watch(()=>n.cartItem,k=>{l.value=new K.OrderItemBase(k),g()}),(k,T)=>{const N=O.NButton;return i.openBlock(),i.createElementBlock("div",ay,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(N,{key:0,type:"tertiary",class:"self-end",onClick:T[0]||(T[0]=E=>r("click:view-switch"))},{default:i.withCtx(()=>[...T[3]||(T[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",ly,[i.createVNode(_d,{value:l.value,"select-template-index":h.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":$,"onPointer:move":x,"onTemplate:select":g,onRemoveCustomTemplate:p},null,8,["value","select-template-index","settings"]),i.createVNode(ol,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":T[1]||(T[1]=E=>l.value=E),"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]=E=>b(E)),"onUpdate:preview":R,onSubmit:_,"onClick:saveTemplate":f,"onClick:addLine":w,"onClick:removeLine":S},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),dy={class:"flex flex-col items-center justify-between rounded-xl"},uy={class:"img-preview relative flex justify-center"},hy={},fy=i.defineComponent({...hy,__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=V.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",dy,[i.createElementVNode("div",uy,[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})])}}}),Ds=Wn(fy,[["__scopeId","data-v-a67fd61e"]]),my={key:0,class:"flex items-baseline gap-1"},gy={key:0,class:"flex items-baseline gap-1"},py={key:1},yy={class:"text-lg font-semibold"},by={key:2,class:"text-red-500 text-sm mb-2"},_y={class:"flex gap-3"},wy={},kd=i.defineComponent({...wy,__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 w;const r=t,o=n,s=i.computed(()=>Bt.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(V.cloneDeep(r.value)),h=i.computed(()=>r.settings.widthOverlaps[u.value.configuratorParams.mountType]??0),m=i.computed(()=>r.settings.heightOverlaps[u.value.configuratorParams.mountType]??0),g=i.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),f=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+m.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),We.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[ae.required,ae.min(r.settings.minHeight-m.value),ae.max(f.value-m.value),ae.step(1),We.serverValidation(r.validation.height.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]})),C=i.computed(()=>{var P;const S=p.value,k=y.value,{quantity:T}=r.value,N=((P=r.value.product)==null?void 0:P.costRub)||0;if(!S||!k||!T||N===0)return null;const E=S*k/1e6;return(N*T*E).toLocaleString("ru-ru",{minimumFractionDigits:2})}),x=i.computed(()=>{const S=p.value,k=y.value,T=!!(S&&S>=r.settings.minWidth&&S<=r.settings.maxWidths[u.value.configuratorParams.netType]),N=!!(k&&k>=r.settings.minHeight&&k<=r.settings.maxHeights[u.value.configuratorParams.netType]),E=!!(r.value.quantity&&r.value.quantity>0);return T&&N&&E}),$=(S,k)=>{var E,P;const T=u.value.configuratorParams;S&&S in T&&(T[S]=k);const N={...T,width:p.value??0,height:y.value??0};S==="width"&&((E=l.value)==null||E.validate().catch(V.noop)),S==="height"&&((P=c.value)==null||P.validate().catch(V.noop)),i.nextTick(()=>{var I,Z;!((I=l.value)!=null&&I.validationErrored)&&!((Z=c.value)!=null&&Z.validationErrored)&&N.height&&N.width&&o("update:params",N),R("configuratorParams",N)})},R=(S,k)=>{const T=new K.OrderItemBase(r.value);T[S]=k,S==="configuratorParams"&&(T.product=new K.ClientProduct),o("update:value",T)};return i.watch(()=>r.value,S=>{const k=V.cloneDeep(i.toRaw(S)),T=k.configuratorParams.mountType,N=r.settings.widthOverlaps[T]??0,E=r.settings.heightOverlaps[T]??0;k.configuratorParams.width&&k.configuratorParams.width>0&&(k.configuratorParams.width-=N),k.configuratorParams.height&&k.configuratorParams.height>0&&(k.configuratorParams.height-=E),u.value=k},{deep:!0}),i.onMounted(()=>{var S;(S=d.value)==null||S.select()}),e({validate:(w=a.value)==null?void 0:w.validate,formReference:a}),(S,k)=>{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:k[25]||(k[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":[k[0]||(k[0]=N=>u.value.configuratorParams.netType=N),k[1]||(k[1]=N=>$("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":[k[2]||(k[2]=N=>u.value.configuratorParams.color=N),k[3]||(k[3]=N=>$("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":[k[4]||(k[4]=N=>u.value.configuratorParams.mountType=N),k[5]||(k[5]=N=>$("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",my,[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:k[10]||(k[10]=N=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...k[26]||(k[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":[k[6]||(k[6]=N=>u.value.configuratorParams.width=N),k[9]||(k[9]=N=>$("width",N))],parse:i.unref(it),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:k[7]||(k[7]=N=>i.unref(tt)(N)),onInput:k[8]||(k[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-m.value} ${f.value?" до "+(f.value-m.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",gy,[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:k[15]||(k[15]=N=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...k[27]||(k[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":[k[11]||(k[11]=N=>u.value.configuratorParams.height=N),k[14]||(k[14]=N=>$("height",N))],parse:i.unref(it),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:k[12]||(k[12]=N=>i.unref(tt)(N)),onInput:k[13]||(k[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":[k[16]||(k[16]=N=>u.value.quantity=N),k[19]||(k[19]=N=>R("quantity",N??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:k[17]||(k[17]=N=>i.unref(tt)(N,!1)),onInput:k[18]||(k[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:k[20]||(k[20]=N=>i.unref(et)(t.validation,"marker")),"onUpdate:value":k[21]||(k[21]=N=>{u.value.marker=N??null,R("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":k[22]||(k[22]=N=>{u.value.isAdditionalSale=N??!1,R("isAdditionalSale",N??!1)})},{default:i.withCtx(()=>[...k[28]||(k[28]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(cr,{"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",py,[k[29]||(k[29]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",yy,i.toDisplayString(C.value)+" ₽",1)])):i.createCommentVNode("",!0),x.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",by," Пожалуйста, заполните все обязательные поля корректно. ")),i.createElementVNode("div",_y,[i.createVNode(i.unref(O.NButton),{loading:t.isSubmitProcessing,disabled:!x.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:k[23]||(k[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:k[24]||(k[24]=N=>o("click:show-preview-drawer"))},{default:i.withCtx(()=>[...k[30]||(k[30]=[i.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1},8,["model","rules"])}}}),xy="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",ky="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",vy="/img/configurators/mosquitto/measurement-instructions/mount.png",Cy="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",Sy="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",By={class:"flex flex-col gap-6"},Ty={class:"flex gap-4"},Ny={class:"flex flex-col gap-2"},$y={class:"flex gap-4"},Ry={class:"flex flex-col gap-2"},Ey={class:"flex gap-4"},Py={class:"flex flex-col gap-2"},Fy={},vd=i.defineComponent({...Fy,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(t,{emit:e}){const n=Bt.initRefDependingOnDeviceResolution("small","small","medium"),r=Bt.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",By,[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:xy,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:ky,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",Ty,[l[9]||(l[9]=i.createElementVNode("img",{src:vy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Ny,[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",$y,[l[15]||(l[15]=i.createElementVNode("img",{src:Cy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Ry,[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",Ey,[l[21]||(l[21]=i.createElementVNode("img",{src:Sy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Py,[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"])}}}),Vy={class:"grid md:grid-cols-2"},My={},Cd=i.defineComponent({...My,__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(()=>Bt.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),m=i.computed(()=>i.inject("debounce-input-time",300)),g=V.debounce(async p=>{var y,b;l.value.product=new K.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(V.noop)},m.value),f=()=>{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=mo;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(vd,{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",Vy,[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(Ds,{"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(Ds,{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(kd,{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]=_=>f()),"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)}}}),Iy={},Sd=i.defineComponent({...Iy,__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 m;return!((m=c.value)!=null&&m.validationErrored)}),u=m=>{l.value=m,o("update:value",m,r.index,a)},h=()=>{var m;(m=s.value)==null||m.select()};return i.watch(()=>r.value,m=>{l.value=m}),i.onMounted(()=>{r.autoFocus&&i.nextTick(()=>{h()})}),e({isValid:d,formItemReference:c}),(m,g)=>{const f=rl,p=Dr;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(cr,{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(f)]),_: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"])}}}),Ay={class:"my-2 flex w-full flex-col"},Oy={key:1},zy={class:"text-lg font-semibold"},Dy={class:"flex gap-3"},Ly={},Bd=i.defineComponent({...Ly,__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(V.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),We.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]};return V.forEach(l.value,(x,$)=>{var R;C[`configuratorParams.linesWidths.${$}`]=[ae.required,ae.min(r.settings.minLineWidth),ae.step(r.settings.lineWidthStep),We.serverValidation((R=r.validation[`linesWidths.${$}`])==null?void 0:R.feedback)]}),C}),d=i.ref(r.settings.canSetDopProdaga??!1),u=i.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((C,x)=>(C??0)+(x??0),0)),h=i.computed(()=>r.settings.width-u.value),m=i.computed(()=>!r.value.some(({product:C})=>!C||C.isNewRec())),g=i.computed(()=>r.isSubmitProcessing||!m.value||h.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(C=>C.product.isNewRec())),f=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:(V.reduce(r.value,($,R)=>{var S;const w=((S=R.product)==null?void 0:S.costRub)||0;return $+w},0)*r.value[0].quantity*C).toLocaleString("ru-ru",{minimumFractionDigits:2})}),y=(C,x,$)=>{var w,S,k;l.value[x].product.id=-1;const{configuratorParams:R}=l.value[x];R.linesWidths[x]=C,b("configuratorParams",R),(k=(S=(w=a.value)==null?void 0:w.at(x))==null?void 0:S.formItemReference)==null||k.validate().catch(V.noop),i.nextTick(()=>{var T,N;(N=(T=a.value)==null?void 0:T.at(x))!=null&&N.isValid&&o("update:params",R,x,$)})},b=(C,x)=>{l.value.forEach($=>{$[C]=x}),o("update:value",l.value)};return i.watch(()=>r.value,C=>{l.value=V.cloneDeep(C)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(C,x)=>{const $=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:x[15]||(x[15]=i.withKeys(i.withModifiers(R=>o("submit",l.value),["prevent"]),["enter"]))},{default:i.withCtx(()=>{var R;return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(w,S)=>{var k,T;return i.openBlock(),i.createBlock(Sd,{key:S,ref_for:!0,ref:"line-items-reference",value:((k=w.configuratorParams)==null?void 0:k.linesWidths.at(S))??null,"auto-focus":!0,index:S,path:`configuratorParams.linesWidths.${S}`,product:w.product,settings:t.settings,validation:t.validation,"suggestion-option":f.value(((T=w.configuratorParams)==null?void 0:T.linesWidths.at(S))??0),"add-line-button-disabled":h.value<=0||t.value.length>=t.settings.maxLinesCount||t.value.some(N=>N.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"onUpdate:value":y,"onClick:addLine":x[0]||(x[0]=N=>o("click:add-line",N)),"onClick:removeLine":x[1]||(x[1]=N=>o("click:remove-line",N))},null,8,["value","index","path","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled"])}),128)),i.createElementVNode("div",Ay,[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),m.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(()=>[...x[16]||(x[16]=[i.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",null,[x[17]||(x[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:x[2]||(x[2]=w=>o("click:add-line",l.value.length))},{default:i.withCtx(()=>[...x[18]||(x[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":[x[3]||(x[3]=w=>l.value[0].length=w),x[6]||(x[6]=w=>b("length",w))],parse:i.unref(it),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:x[4]||(x[4]=w=>i.unref(tt)(w,!1)),onInput:x[5]||(x[5]=w=>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":[x[7]||(x[7]=w=>l.value[0].quantity=w),x[10]||(x[10]=w=>b("quantity",w))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:x[8]||(x[8]=w=>i.unref(tt)(w,!1)),onInput:x[9]||(x[9]=w=>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:x[11]||(x[11]=w=>i.unref(et)(t.validation,"marker")),"onUpdate:value":x[12]||(x[12]=w=>{l.value[0].marker=w??null,b("marker",w??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock($,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":x[13]||(x[13]=w=>{l.value[0].isAdditionalSale=w??!1,b("isAdditionalSale",w??!1)})},{default:i.withCtx(()=>[...x[19]||(x[19]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),p.value?(i.openBlock(),i.createElementBlock("div",Oy,[x[20]||(x[20]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",zy,i.toDisplayString(p.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",Dy,[i.createVNode(i.unref(O.NButton),{loading:t.isSubmitProcessing,disabled:!m.value||h.value!=0||!((R=l.value[0])!=null&&R.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:x[14]||(x[14]=w=>o("submit",l.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(l.value[0].isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])}}}),Hy={class:"flex grow flex-col"},Wy=["src"],jy={class:"w-full"},qy={},Td=i.defineComponent({...qy,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",Hy,[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,Wy),i.createElementVNode("div",jy,[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)])]))}}),Xy={class:"flex flex-col gap-2"},Yy={class:"w-104 flex grow flex-col px-5"},Uy={},Nd=i.defineComponent({...Uy,__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 f;return(f=s.value[0].configuratorParams)==null?void 0:f.linesWidths.reduce((p,y)=>(p??0)+(y??0),0)}),u=f=>{f===void 0&&(f=s.value.length-1);const p=s.value.at(0);if(!p)return;p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(f+1,0,null),s.value.forEach(b=>{b.configuratorParams.linesWidths=p.configuratorParams.linesWidths});const y=new K.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(f+1,0,y)},h=f=>{const p=s.value.at(0);p&&(p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(f,1),s.value.forEach(y=>{y.configuratorParams.linesWidths=p.configuratorParams.linesWidths}),s.value=s.value.toSpliced(f,1),delete a[`linesWidths.${f}`],delete a[`linesWidths.${f}`])},m=V.debounce(async(f,p,y)=>{const b={linesWidths:f.linesWidths.at(p)};y.value=!0,a.value[`linesWidths.${p}`]={},s.value[p].product=new K.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 K.ClientProduct,a.value[`linesWidths.${p}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},y.value=!1),y.value=!1}})},c.value),g=async()=>{var f,p;(p=(f=o.value)==null?void 0:f.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(V.noop)};return i.watch(()=>n.cartItems,f=>{s.value=f.map(p=>new K.OrderItemBase(p))}),(f,p)=>{const y=O.NButton;return i.openBlock(),i.createElementBlock("div",Xy,[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",Yy,[i.createVNode(Td,{value:s.value,"onUpdate:value":p[1]||(p[1]=b=>s.value=b),settings:t.settings},null,8,["value","settings"]),i.createVNode(Bd,{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(m),onSubmit:g,"onClick:addLine":u,"onClick:removeLine":h},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),Ky={class:"flex flex-col gap-3"},Gy={},$d=i.defineComponent({...Gy,__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(V.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),We.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(1),We.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.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=(f,p)=>{const y=new K.OrderItemBase(r.value);y[f]=p,f==="configuratorParams"&&(y.product=new K.ClientProduct),o("update:value",y)},m=()=>{var f;(f=a.value)==null||f.select()};return i.watch(()=>r.value,f=>{l.value=V.cloneDeep(f)},{deep:!0}),i.onMounted(()=>{r.value.isNewRec()&&i.nextTick(()=>{m()})}),e({validate:(g=s.value)==null?void 0:g.validate,formReference:s}),(f,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(cr,{"is-product-searching":t.isProductSearching,product:t.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),i.createElementVNode("div",Ky,[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"])}}}),Zy={class:"flex flex-col gap-2 w-72"},Qy={},Rd=i.defineComponent({...Qy,__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=V.debounce(async m=>{var g,f;s.value.product=new K.ClientProduct,(f=(g=o.value)==null?void 0:g.formReference)==null||f.validate(p=>{p||(l.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:m,validationFieldResultData:a.value,callback:y=>{y?s.value.product=y:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(V.noop)},d.value),h=async()=>{var m,g;(g=(m=o.value)==null?void 0:m.formReference)==null||g.validate(f=>{f||(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(V.noop)};return i.watch(()=>n.cartItem,m=>{s.value=new K.OrderItemBase(m)},{deep:!0}),(m,g)=>{const f=O.NButton;return i.openBlock(),i.createElementBlock("div",Zy,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(f,{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($d,{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"])])}}}),Jy={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function e0(t,e){return i.openBlock(),i.createElementBlock("svg",Jy,[...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 Ed=i.markRaw({name:"ion-add",render:e0}),t0={key:0,class:"-mt-1 text-sm text-gray-500"},n0={class:"font-bold"},i0={class:"flex flex-col gap-3"},r0={key:0,class:"mt-4 flex flex-col gap-1.5"},o0={class:"flex flex-col gap-1 text-sm text-gray-700"},s0={key:0},a0={key:1},l0={"form-array-name":"items",class:"flex flex-col gap-3"},c0={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},d0={key:0,class:"flex flex-wrap items-end gap-2"},u0={class:"whitespace-nowrap text-xl font-bold"},h0={key:0,class:"whitespace-nowrap text-lg text-gray-500"},f0={class:"font-bold"},m0={class:"font-bold"},g0={class:"flex gap-3"},p0={},Pd=i.defineComponent({...p0,__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(V.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(V.noop).catch(V.noop)})},{deep:!0});const d=i.computed(()=>r.value.category),u=i.ref(null),h=i.ref(null),m=i.computed(()=>d.value.products??[]),g=i.computed(()=>m.value.map(L=>({label:L.name,value:L.id}))),f=(L,A,z)=>{const Y=L!=null&&L>0,U=A!=null&&A>0;return!Y&&!U?null:Y&&U?`от ${L} ${z} до ${A} ${z}`:Y?`от ${L} ${z}`:`до ${A} ${z}`},p=i.computed(()=>{var L,A;return f(r.settings.minWidth,(A=(L=u.value)==null?void 0:L.properties)==null?void 0:A.width,"мм")}),y=i.computed(()=>{var L,A;return f(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:[We.serverValidation((A=l.value.marker)==null?void 0:A.feedback)]};return a.value.configuratorParams.items.forEach((z,Y)=>{var U,M,j,X,ee,ue,ve;L[`configuratorParams.items.${Y}.width`]=[ae.required,ae.min(r.settings.minWidth),...(M=(U=u.value)==null?void 0:U.properties)!=null&&M.width?[ae.max(u.value.properties.width)]:[],ae.step(1),We.serverValidation((j=l.value[`items.${Y}.width`])==null?void 0:j.feedback)],L[`configuratorParams.items.${Y}.length`]=[ae.required,ae.min(r.settings.minLength),...(ee=(X=u.value)==null?void 0:X.properties)!=null&&ee.length?[ae.max(u.value.properties.length)]:[],ae.step(1),We.serverValidation((ue=l.value[`items.${Y}.length`])==null?void 0:ue.feedback)],L[`configuratorParams.items.${Y}.count`]=[ae.required,ae.min(1),ae.step(1),We.serverValidation((ve=l.value[`items.${Y}.count`])==null?void 0:ve.feedback)]}),L}),x=i.ref(r.settings.canSetDopProdaga??!1),$=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})),R=i.computed(()=>!u.value||$.value||a.value.configuratorParams.items.length===0),w=i.ref(null),S=L=>{if(!L){u.value=null,h.value=null,a.value.product=new K.ClientProduct,b.value=null;return}const A=m.value.find(z=>z.id===L);A&&(u.value=A,h.value=L,a.value.product=A,te("product",a.value.product),a.value.configuratorParams.items.forEach(z=>{var Y,U;(Y=A.properties)!=null&&Y.width&&z.width>A.properties.width&&(z.width=A.properties.width),(U=A.properties)!=null&&U.length&&z.length>A.properties.length&&(z.length=A.properties.length)}),T())};let k=!1;const T=()=>{k=!0,b.value=null,w.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},N=async()=>{var L;if(!u.value||a.value.configuratorParams.items.length===0||$.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(()=>{te("quantity",z.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,T()),te("configuratorParams",a.value.configuratorParams),E(),_.value=!1}})}).catch(()=>{T(),_.value=!1})},E=()=>{var A;if(!((A=u.value)!=null&&A.costRub)||!b.value){w.value=null;return}const L=b.value.quantity*u.value.costRub;w.value=Math.round(L*100)/100},P=L=>{var z,Y;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),(Y=u.value.properties)!=null&&Y.length&&A.length>u.value.properties.length&&(A.length=u.value.properties.length)),te("configuratorParams",a.value.configuratorParams),T()},W=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),te("configuratorParams",a.value.configuratorParams),T(),o("add-item",a.value.configuratorParams.items.length)},I=L=>{a.value.configuratorParams.items.splice(L,1),te("configuratorParams",a.value.configuratorParams),T(),o("remove-item",L)},Z=()=>{if(!(R.value||_.value||r.isSubmitProcessing)){if(!b.value){N();return}o("submit",a.value)}},te=(L,A)=>{const z=new K.OrderItemBase(r.value);z[L]=A,o("update:value",z)};i.watch(()=>r.value,L=>{const A=V.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),k?k=!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:[]},E())};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=Dr,Y=Ed;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(Z,["prevent"]),["enter"])},{default:i.withCtx(()=>{var U;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]=M=>h.value=M),S],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((U=u.value)==null?void 0:U.costRub)!=null?(i.openBlock(),i.createElementBlock("div",t0,[i.createElementVNode("span",n0,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",i0,[u.value?(i.openBlock(),i.createElementBlock("div",r0,[A[7]||(A[7]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",o0,[p.value?(i.openBlock(),i.createElementBlock("div",s0,"Ширина "+i.toDisplayString(p.value)+".",1)):i.createCommentVNode("",!0),y.value?(i.openBlock(),i.createElementBlock("div",a0,"Длина "+i.toDisplayString(y.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",l0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value.configuratorParams.items,(M,j)=>(i.openBlock(),i.createElementBlock("div",{key:j,class:"flex grow gap-2"},[i.createElementVNode("div",c0,[i.createVNode(i.unref(O.NFormItem),{path:`configuratorParams.items.${j}.width`,label:"Ширина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:a.value.configuratorParams.items[j].width,"onUpdate:value":[X=>a.value.configuratorParams.items[j].width=X,X=>P(j)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:A[1]||(A[1]=X=>i.unref(tt)(X)),onInput:X=>c(`items.${j}.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.${j}.length`,label:"Длина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:a.value.configuratorParams.items[j].length,"onUpdate:value":[X=>a.value.configuratorParams.items[j].length=X,X=>P(j)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:A[2]||(A[2]=X=>i.unref(tt)(X)),onInput:X=>c(`items.${j}.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.${j}.count`,label:"Количество, шт"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:a.value.configuratorParams.items[j].count,"onUpdate:value":[X=>a.value.configuratorParams.items[j].count=X,X=>P(j)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:A[3]||(A[3]=X=>i.unref(tt)(X,!1)),onInput:X=>c(`items.${j}.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:X=>I(j)},{default:i.withCtx(()=>[i.createVNode(z)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:1,disabled:$.value,type:"default",class:"self-center",onClick:W},{default:i.withCtx(()=>[i.createVNode(Y),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]=M=>c("marker")),"onUpdate:value":A[5]||(A[5]=M=>te("marker",M??null)),onFocus:i.unref(Le)},null,8,["value","disabled","onFocus"])]),_:1}),x.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]=M=>{a.value.isAdditionalSale=M??!1,te("isAdditionalSale",M??!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 M;return[b.value&&u.value&&w.value?(i.openBlock(),i.createElementBlock("div",d0,[i.createElementVNode("div",null,[A[10]||(A[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",u0,i.toDisplayString(w.value.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol),1)]),b.value.quantity&&u.value?(i.openBlock(),i.createElementBlock("div",h0,[i.createElementVNode("span",f0,"("+i.toDisplayString(b.value.quantity)+" шт.",1),A[11]||(A[11]=i.createTextVNode(" x ",-1)),i.createElementVNode("span",m0,i.toDisplayString((M=u.value.costRub)==null?void 0:M.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]}),_:1},8,["show"]),i.createElementVNode("div",g0,[b.value&&!_.value?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,loading:t.isSubmitProcessing,disabled:R.value||_.value,type:"primary",class:"self-start",onClick:Z},{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:R.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"])}}}),y0={class:"flex flex-col gap-2"},b0={class:"w-104 flex grow flex-col px-5"},_0={},Fd=i.defineComponent({..._0,__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,m;(m=(h=o.value)==null?void 0:h.formReference)==null||m.validate(g=>{if(!g){l.value=!0;const f=V.cloneDeep(s.value);"items"in f.configuratorParams&&delete f.configuratorParams.items,r("submit",f,a.value,()=>{l.value=!1,i.nextTick(()=>{var p,y;(y=(p=o.value)==null?void 0:p.formReference)==null||y.restoreValidation()})})}}).catch(V.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,m)=>{a.value[`items.${m}.width`]={},a.value[`items.${m}.length`]={},a.value[`items.${m}.count`]={}})}),i.watch(()=>n.cartItem,h=>{s.value=new K.OrderItemBase(h)},{deep:!0}),(h,m)=>{const g=O.NButton;return i.openBlock(),i.createElementBlock("div",y0,[t.settings.allowShowTable&&s.value.isNewRec()?(i.openBlock(),i.createBlock(g,{key:0,type:"tertiary",class:"self-center",onClick:m[0]||(m[0]=f=>r("click:view-switch"))},{default:i.withCtx(()=>[...m[2]||(m[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",b0,[i.createVNode(Pd,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":m[1]||(m[1]=f=>s.value=f),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"])])])}}}),w0={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function x0(t,e){return i.openBlock(),i.createElementBlock("svg",w0,[...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 k0=i.markRaw({name:"ion-checkmark",render:x0}),v0={key:0,class:"-mt-1 text-sm text-gray-500"},C0={class:"font-bold"},S0={class:"flex flex-col gap-3"},B0={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},T0={class:"flex flex-col gap-1 text-sm text-gray-700"},N0={key:0},$0={key:1},R0={"form-array-name":"items",class:"flex flex-col gap-3"},E0={class:"min-w-0 flex-1"},P0={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},F0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},V0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},M0={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},I0={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},A0={key:0,class:"lg:!flex-[2]"},O0={class:"font-bold"},z0={key:1,class:"lg:!flex-[3]"},D0={class:"font-bold"},L0={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"},H0={key:0},W0={class:"font-bold"},j0={key:1},q0={class:"font-bold"},X0={class:"flex flex-wrap items-center gap-3"},Y0={},Vd=i.defineComponent({...Y0,__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 U;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("widthInputs"),l=r.value==null?[]:V.cloneDeep(i.toRaw(r.value)),c=i.ref(l.map(M=>new K.OrderItemBase(M))),d=i.computed(()=>({items:c.value})),u=i.ref({...r.validation}),h=M=>{var j;delete u.value[M],(j=s.value)==null||j.restoreValidation()},m=i.ref(null),g=i.ref(null),f=i.computed(()=>{var M,j;return((j=(M=c.value[0])==null?void 0:M.category)==null?void 0:j.products)??[]}),p=i.computed(()=>f.value.map(M=>({label:M.name,value:M.id}))),y=(M,j,X)=>{const ee=M!=null&&M>0,ue=j!=null&&j>0;return!ee&&!ue?null:ee&&ue?`от ${M} ${X} до ${j} ${X}`:ee?`от ${M} ${X}`:`до ${j} ${X}`},b=i.computed(()=>{var M,j;return y(r.settings.minWidth,(j=(M=m.value)==null?void 0:M.properties)==null?void 0:j.width,"мм")}),_=i.computed(()=>{var M,j;return y(r.settings.minLength,(j=(M=m.value)==null?void 0:M.properties)==null?void 0:j.length,"мм")}),C=i.computed(()=>{const M={};return c.value.forEach((j,X)=>{var ee,ue,ve,Te,He,ce,mt,Ne;M[`items.${X}.configuratorParams.width`]=[ae.required,ae.min(r.settings.minWidth),...(ue=(ee=m.value)==null?void 0:ee.properties)!=null&&ue.width?[ae.max(m.value.properties.width)]:[],ae.step(1),We.serverValidation((ve=u.value[`items.${X}.width`])==null?void 0:ve.feedback)],M[`items.${X}.configuratorParams.length`]=[ae.required,ae.min(r.settings.minLength),...(He=(Te=m.value)==null?void 0:Te.properties)!=null&&He.length?[ae.max(m.value.properties.length)]:[],ae.step(1),We.serverValidation((ce=u.value[`items.${X}.length`])==null?void 0:ce.feedback)],M[`items.${X}.quantity`]=[ae.required,ae.min(1),ae.step(1),We.serverValidation((mt=u.value[`items.${X}.quantity`])==null?void 0:mt.feedback)],M[`items.${X}.marker`]=[We.serverValidation((Ne=u.value[`items.${X}.marker`])==null?void 0:Ne.feedback)]}),M});i.watch(()=>r.validation,M=>{u.value={...M},Object.values(M).some(X=>X==null?void 0:X.feedback)&&i.nextTick(()=>{var X;return(X=s.value)==null?void 0:X.validate(V.noop).catch(V.noop)})},{deep:!0});const x=i.ref(r.settings.canSetDopProdaga??!1),$=i.computed(()=>{const M=m.value;return M?c.value.some(j=>{var ve,Te;const X=j.configuratorParams,ee=(ve=M.properties)==null?void 0:ve.width,ue=(Te=M.properties)==null?void 0:Te.length;return X.width===0||X.width<r.settings.minWidth||ee!=null&&X.width>ee||X.length===0||X.length<r.settings.minLength||ue!=null&&X.length>ue||j.quantity===0||j.quantity<1}):!0}),R=i.computed(()=>!m.value||$.value||c.value.length===0),w=i.computed(()=>{const M=c.value[0];return M!=null&&!M.isNewRec()}),S=M=>r.itemStates[M]??"idle",k=M=>S(M)==="success",T=M=>S(M)==="loading",N=i.computed(()=>c.value.length===0?!0:c.value.every((M,j)=>{const X=S(j);return X==="success"||X==="loading"})),E=M=>M.width===0||M.length===0?0:M.width*M.length/1e6,P=M=>{var ve;const j=M.configuratorParams,X=E(j),ee=((ve=m.value)==null?void 0:ve.costRub)??0,ue=M.quantity??0;return!X||!ue?0:Math.round(X*ee*ue*100)/100},W=i.computed(()=>V.sum(c.value.map(M=>{const j=M.configuratorParams;return!j.width||j.length===0||!M.quantity?0:j.width*j.length*M.quantity/1e6}))),I=i.computed(()=>Math.round(V.sum(c.value.map(M=>P(M)))*100)/100),Z=()=>{var M,j,X;return new K.OrderItemBase({category:(M=c.value[0])==null?void 0:M.category,configurator:(j=c.value[0])==null?void 0:j.configurator,product:m.value??new K.ClientProduct,quantity:1,isAdditionalSale:(X=c.value[0])==null?void 0:X.isAdditionalSale,configuratorParams:{width:0,length:0}})},te=M=>{if(!M){m.value=null,g.value=null,c.value.forEach(X=>{X.product=new K.ClientProduct}),o("update:value",c.value);return}const j=f.value.find(X=>X.id===M);j&&(m.value=j,g.value=M,c.value.forEach((X,ee)=>{var ue,ve;X.product=j,(ue=j.properties)!=null&&ue.width&&X.configuratorParams.width>j.properties.width&&(X.configuratorParams.width=j.properties.width),(ve=j.properties)!=null&&ve.length&&X.configuratorParams.length>j.properties.length&&(X.configuratorParams.length=j.properties.length),o("item-reset",ee)}),o("update:value",c.value))},D=M=>{var ee,ue;const j=c.value[M],X=m.value;X&&((ee=X.properties)!=null&&ee.width&&j.configuratorParams.width>X.properties.width&&(j.configuratorParams.width=X.properties.width),(ue=X.properties)!=null&&ue.length&&j.configuratorParams.length>X.properties.length&&(j.configuratorParams.length=X.properties.length)),o("item-reset",M),o("update:value",c.value)},H=(M,j)=>{c.value[M].marker=j===null||j===""?void 0:j,o("item-reset",M),o("update:value",c.value)},L=M=>{c.value.forEach(j=>{j.isAdditionalSale=M}),o("update:value",c.value)},A=()=>{c.value.push(Z()),o("update:value",c.value),o("add-item",c.value.length),i.nextTick(()=>{var j,X,ee,ue;const M=c.value.length-1;(X=(j=a.value)==null?void 0:j[M])==null||X.focus(),(ue=(ee=a.value)==null?void 0:ee[M])==null||ue.select()})},z=M=>{c.value.splice(M,1),o("update:value",c.value),o("remove-item",M)};i.watch(()=>r.value,M=>{var ue;const X=(M==null?[]:V.cloneDeep(i.toRaw(M))).map(ve=>new K.OrderItemBase(ve));c.value=X.length>0?X:[Z()];const ee=(ue=c.value[0])==null?void 0:ue.product;ee&&!ee.isNewRec()?(m.value=ee,g.value=ee.id):(m.value=null,g.value=null)},{deep:!0});const Y=()=>{var j;if(m.value!==null)return;const M=(j=f.value[0])==null?void 0:j.id;M!=null&&te(M)};return i.watch(f,()=>{Y()}),i.onMounted(()=>{var j;c.value.length===0&&(c.value=[Z()]);const M=(j=c.value[0])==null?void 0:j.product;M&&!M.isNewRec()&&(m.value=M,g.value=M.id),Y()}),e({validate:(U=s.value)==null?void 0:U.validate,formReference:s}),(M,j)=>{const X=k0,ee=Dr,ue=Ed;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":[j[0]||(j[0]=He=>g.value=He),te],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((ve=m.value)==null?void 0:ve.costRub)!=null?(i.openBlock(),i.createElementBlock("div",v0,[i.createElementVNode("span",C0,i.toDisplayString(m.value.code),1),i.createTextVNode(" — "+i.toDisplayString(m.value.costRub.toLocaleString())+" "+i.toDisplayString(m.value.currency.symbol)+"/м² ",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",S0,[m.value?(i.openBlock(),i.createElementBlock("div",B0,[j[6]||(j[6]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",T0,[b.value?(i.openBlock(),i.createElementBlock("div",N0,"Ширина "+i.toDisplayString(b.value)+".",1)):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createElementBlock("div",$0,"Длина "+i.toDisplayString(_.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",R0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value.items,(He,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",k(ce)?"opacity-70":""])},[i.createElementVNode("div",E0,[i.createElementVNode("div",P0,[i.createElementVNode("div",F0,[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:!m.value||k(ce)||T(ce),placeholder:"Ширина",class:"w-full",onKeydown:j[1]||(j[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:!m.value||k(ce)||T(ce),placeholder:"Длина",class:"w-full",onKeydown:j[2]||(j[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",V0,[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:!m.value||k(ce)||T(ce),placeholder:"Кол-во",class:"w-full",onKeydown:j[3]||(j[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:!m.value||k(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)||k(ce)?(i.openBlock(),i.createElementBlock("div",M0,[T(ce)?(i.openBlock(),i.createBlock(i.unref(O.NSpin),{key:0,size:14})):k(ce)?(i.openBlock(),i.createBlock(X,{key:1,class:"text-green-600 text-xl"})):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),i.createElementVNode("div",I0,[He.configuratorParams.width>0&&He.configuratorParams.length>0?(i.openBlock(),i.createElementBlock("div",A0,[j[7]||(j[7]=i.createTextVNode(" Площадь (S) = ",-1)),i.createElementVNode("span",O0,i.toDisplayString(E(He.configuratorParams).toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),P(He)>0?(i.openBlock(),i.createElementBlock("div",z0,[j[8]||(j[8]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",D0,i.toDisplayString(P(He).toLocaleString())+" "+i.toDisplayString((mt=m.value)==null?void 0:mt.currency.symbol),1)])):i.createCommentVNode("",!0)])]),w.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(ee)]),_:1},8,["disabled","onClick"]))],2)}),128))]),m.value?(i.openBlock(),i.createElementBlock("div",L0,[W.value>0?(i.openBlock(),i.createElementBlock("div",H0,[j[9]||(j[9]=i.createTextVNode(" Общая площадь: ",-1)),i.createElementVNode("span",W0,i.toDisplayString(W.value.toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),I.value>0?(i.openBlock(),i.createElementBlock("div",j0,[j[10]||(j[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",q0,i.toDisplayString(I.value.toLocaleString())+" "+i.toDisplayString(m.value.currency.symbol),1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),x.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":j[4]||(j[4]=He=>L(He??!1))},{default:i.withCtx(()=>[...j[11]||(j[11]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createElementVNode("div",X0,[m.value&&!w.value?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,disabled:$.value,type:"default",onClick:A},{default:i.withCtx(()=>[i.createVNode(ue),j[12]||(j[12]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),i.createVNode(i.unref(O.NButton),{loading:t.isSubmitProcessing,disabled:R.value||N.value,type:"primary",class:"ml-auto",onClick:j[5]||(j[5]=He=>o("submit",c.value))},{default:i.withCtx(()=>{var He;return[i.createTextVNode(i.toDisplayString((He=c.value[0])!=null&&He.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[i.unref(Ua)]])}}}),U0={class:"flex flex-col gap-2"},K0={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},G0={},Md=i.defineComponent({...G0,__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 K.OrderItemBase(C))),a=i.ref([]),l=i.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=C=>{c.forEach(x=>{l.value[`items.${C}.${x}`]={}})},u=C=>{c.forEach(x=>{delete l.value[`items.${C}.${x}`]})},h=i.computed(()=>a.value.includes("loading")),m=()=>({width:{},length:{},quantity:{},marker:{}}),g=(C,x)=>{let $=!1;return c.forEach(R=>{var E,P;const w=`items.0.${R}`,S=(E=C[R])==null?void 0:E.feedback,T=((P=C[w])==null?void 0:P.feedback)??S,N=`items.${x}.${R}`;T?(l.value[N]=C[w]??C[R],$=!0):l.value[N]={}}),$},f=(C,x,$)=>new Promise(R=>{const w=m();let S=!1;const k=T=>{if(S)return;S=!0;const N=g(w,x),E=(T===void 0?!N:T)&&!N;a.value[x]=E?"success":"error",i.nextTick(()=>{var P,W;(W=(P=o.value)==null?void 0:P.formReference)==null||W.restoreValidation()}),R(E)};a.value[x]="loading",r("submit",[V.cloneDeep(C)],w,k,{isFinalSuccessfulCompletion:$})}),p=async()=>{var $,R;try{await((R=($=o.value)==null?void 0:$.formReference)==null?void 0:R.validate())}catch{return}const C=s.value.map((w,S)=>S).filter(w=>{const S=a.value[w]??"idle";return S!=="success"&&S!=="loading"});let x=!0;for(let w=0;w<C.length;w+=1){const S=C[w],k=s.value[S];if(!k)break;const N=w===C.length-1&&x;await f(k,S,N)||(x=!1)}},y=C=>{const x=C-1;a.value[x]="idle",d(x)},b=C=>{a.value.splice(C,1),u(C);for(let x=C;x<s.value.length;x+=1)d(x)},_=C=>{const x=a.value[C];(x==="success"||x==="error")&&(a.value[C]="idle")};return i.onMounted(()=>{(n.cartItems??[]).forEach((C,x)=>{a.value[x]="idle",d(x)})}),i.watch(()=>n.cartItems,C=>{const x=(C??[]).map($=>new K.OrderItemBase($));s.value=x,a.value=x.map(()=>"idle"),x.forEach(($,R)=>{d(R)})},{deep:!0}),(C,x)=>{var R;const $=O.NButton;return i.openBlock(),i.createElementBlock("div",U0,[t.settings.allowShowTable&&((R=s.value[0])!=null&&R.isNewRec())?(i.openBlock(),i.createBlock($,{key:0,type:"tertiary",class:"self-center",onClick:x[0]||(x[0]=w=>r("click:view-switch"))},{default:i.withCtx(()=>[...x[2]||(x[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",K0,[i.createVNode(Vd,{ref:"sandwich-m2-configurator-form",value:s.value,"onUpdate:value":x[1]||(x[1]=w=>s.value=w),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"])])])}}}),Z0={key:0,class:"flex justify-center p-4"},Q0={key:1,class:"p-4 text-center text-red-500"},J0={key:2,class:"flex justify-center"},eb={class:"!bg-white p-4 m-2 rounded-md w-max"},tb={key:3,class:"p-4 text-center text-gray-500"},nb={},Id=i.defineComponent({...nb,__name:"dynamic-configurator",props:{eventEmitter:{},settings:{},editor:{},cartItem:{},category:{}},setup(t){const e=t,n=i.ref(!1),r=i.ref(null),o=i.ref(e.cartItem??null),s=i.ref(null),a=m=>{const g=m.configuratorParams;return[new K.OrderItemBase({...m,quantity:m.quantity??1,marker:m.marker,configuratorParams:{width:(g==null?void 0:g.width)??m.width??0,length:(g==null?void 0:g.length)??m.length??0}})]},l=i.ref(e.editor===K.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var g,f,p;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const m={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 K.OrderItemBase({...m,configuratorParams:{length:y.stripMinLength,linesAngles:[],linesWidths:[],startTailType:V.some(y.startTailConfigs,b=>b.isDefault)?(f=y.startTailConfigs)==null?void 0:f.findIndex(b=>b.isDefault):void 0,endTailType:V.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 K.OrderItemBase({...m,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 K.OrderItemBase({...m,length:y.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const y=e.settings;o.value=new K.OrderItemBase({...m,configuratorParams:{width:y.minWidth,length:y.minLength}});break}case"sandwich":{o.value=new K.OrderItemBase({...m,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new K.OrderItemBase({...m,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(m,g,f)=>{const p=y=>{f==null||f(),y&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:m,callback:p,validation:g})},u=(m,g,f,p)=>{const y=m[0];if(!y){f==null||f();return}const b=(p==null?void 0:p.isFinalSuccessfulCompletion)===!0,_=C=>{f==null||f(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||c()}),(m,g)=>{const f=O.NSpin;return i.openBlock(),i.createElementBlock(i.Fragment,null,[n.value?(i.openBlock(),i.createElementBlock("div",Z0,[i.createVNode(f,{size:"large"})])):r.value?(i.openBlock(),i.createElementBlock("div",Q0,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",J0,[i.createElementVNode("div",eb,[t.editor==="kozyrek"?(i.openBlock(),i.createBlock(xd,{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(Cd,{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(Nd,{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(Rd,{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(Fd,{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(Md,{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",tb,' Конфигуратор "'+i.toDisplayString(t.editor)+'" не поддерживается. ',1))],64)}}});function Ad(t){return Object.values(K.ConfiguratorsEnum).includes(t)}function Od(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==K.ConfiguratorsEnum.Sandwich?!0:t.properties.configuratorSettings!==void 0&&V.isArray(t.products)&&t.products.length>0}const ib={key:0,class:"pt-0.5"},rb={key:0},ob={class:"line-through"},sb={key:0},ab={key:1},lb={class:"flex flex-row gap-1"},cb={key:0},db={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},ub={class:"flex flex-col gap-2.5 sm:flex-row"},hb={class:"mt-2"},fb={key:1,class:"flex flex-col"},mb={},gb=i.defineComponent({...mb,__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(sr,"medium"),r=i.computed(()=>{var U;return(U=e==null?void 0:e.filteredItems)==null?void 0:U[e.categoryItem.id]}),o=i.computed(()=>{var U,M;return V.isArray((U=e.categoryItem)==null?void 0:U.categories)&&((M=e.categoryItem.categories)==null?void 0:M.length)>0}),s=i.computed(()=>{var U;return V.isArray((U=e.categoryItem)==null?void 0:U.products)?e.categoryItem.products:[]}),a=i.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([U,M])=>`${M} руб./${N(U)}`).join(", ")),l=i.computed(()=>V.isUndefined(e.filteredItems)||r.value==="*"?s.value:s.value.filter(U=>{var j;const M=(j=r.value)==null?void 0:j.products;return V.isArray(M)&&M.includes(U.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>V.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),u=i.computed(()=>V.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),h=i.computed(()=>V.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),m=i.computed(()=>V.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),g=i.computed(()=>{var U,M,j;return((U=e.categoryItem.properties)==null?void 0:U.configurator)!==void 0&&Ad((M=e.categoryItem.properties)==null?void 0:M.configurator)&&Od(e.categoryItem)&&((j=e.categoryItem.properties)==null?void 0:j.configuratorSettings)!==void 0&&(V.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),f=i.computed(()=>g.value&&(V.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),p=i.computed(()=>V.isNil(e.categoryContextButtonsConfig)?[]:V.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),y=i.computed(()=>new K.ClientCategory(e.categoryItem)),b=i.ref(!1),_=i.ref(!1),C=i.computed(()=>!V.isUndefined(e.isCategoryItemSelected)),x=i.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),$=i.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),R=i.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),w=i.computed(()=>A.value&&Bt.getDeviceTypeByResolution()===Qe.laptop?"auto":"fixed"),S=i.useTemplateRef("collapse-item-reference"),k=i.computed(()=>{var U,M;return(M=(U=e.categoryItem.properties)==null?void 0:U.templateCost)==null?void 0:M.priceCoefficient}),T=i.computed(()=>{var U,M;return(M=(U=e.categoryItem.properties)==null?void 0:U.templateCost)==null?void 0:M.increasePercent}),N=(U,M="ru-RU")=>0 .toLocaleString(M,{style:"currency",currency:U,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),E=U=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:U,target:S.value})},P=(U,M)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:M,isLoadingState:b,target:S.value})},W=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:S.value})},I=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:S.value})},Z=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:S.value})},te=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:S.value})},D=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:S.value})},H=U=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:U,target:S.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?jm(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}):[]),Y=V.debounce(()=>{A.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",Y)}),window.addEventListener("resize",Y),Y(),(U,M)=>{const j=O.NCheckbox,X=vf,ee=O.NTooltip,ue=wf,ve=O.NTag,Te=yf,He=mf,ce=O.NButton,mt=uf,Ne=Za,Ft=Ga,Wt=Ka,an=Ho,Ct=O.NDropdown,Ln=O.NDataTable,ln=O.NAlert,Jt=O.NSpin;return i.openBlock(),i.createBlock(Qa,{ref:"collapse-item-reference",name:t.categoryItem.id,"data-id":t.categoryItem.id,"onHeader:click":P},{"pre-arrow":i.withCtx(()=>{var Ve,J;return[C.value?(i.openBlock(),i.createElementBlock("div",ib,[i.createVNode(j,{checked:x.value,indeterminate:R.value,disabled:$.value,"onUpdate:checked":E},null,8,["checked","indeterminate","disabled"])])):i.createCommentVNode("",!0),!d.value&&((Ve=y.value)!=null&&Ve.isDisabled)?(i.openBlock(),i.createBlock(ee,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(X,{class:"pt-1.5"})]),default:i.withCtx(()=>[M[1]||(M[1]=i.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):i.createCommentVNode("",!0),((J=y.value)==null?void 0:J.isFavorite)??!1?(i.openBlock(),i.createBlock(ee,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ue,{class:"pt-1.5"})]),default:i.withCtx(()=>[M[2]||(M[2]=i.createTextVNode(" Избранная категория ",-1))]),_:1})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var Ve,J,le,De,ni;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(ee,{disabled:!t.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createElementVNode("span",null,i.toDisplayString(t.categoryItem.name),1)]),default:i.withCtx(()=>[M[3]||(M[3]=i.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:M[0]||(M[0]=i.withModifiers((...nt)=>i.unref(V.noop)&&i.unref(V.noop)(...nt),["prevent","stop"]))},[(J=t.categoryItem.properties)!=null&&J.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",rb,i.toDisplayString(T.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0),i.createVNode(ve,{size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createElementVNode("span",ob,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},[k.value||T.value?(i.openBlock(),i.createBlock(ve,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>{var nt;return[k.value?(i.openBlock(),i.createElementBlock("span",sb,i.toDisplayString((nt=k.value)==null?void 0:nt.name),1)):i.createCommentVNode("",!0),T.value?(i.openBlock(),i.createElementBlock("span",ab,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&&((ni=y.value)!=null&&ni.manager)?(i.openBlock(),i.createBlock(ve,{key:3,size:i.unref(n),closable:!0,round:"",class:"align-bottom",onClose:te},{default:i.withCtx(()=>[i.createVNode(ee,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var nt,jt;return[i.createElementVNode("span",lb,[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",cb,[i.createElementVNode("ul",db,[t.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:t.categoryItem.id,slug:t.categoryItem.slug},(Ve,J)=>(i.openBlock(),i.createElementBlock("li",{key:J}," ("+i.toDisplayString(J)+"): "+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,J)=>(i.openBlock(),i.createElementBlock("li",{key:J}," ("+i.toDisplayString(J)+"): "+i.toDisplayString(Ve),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var Ve;return[i.createElementVNode("div",ub,[d.value?(i.openBlock(),i.createBlock(ee,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),onClick:W},{default:i.withCtx(()=>{var J;return[(J=y.value)!=null&&J.isDisabled?(i.openBlock(),i.createBlock(X,{key:1})):(i.openBlock(),i.createBlock(He,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var J;return[(J=y.value)!=null&&J.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(ee,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),onClick:Z},{default:i.withCtx(()=>[i.createVNode(mt)]),_:1},8,["size"])]),default:i.withCtx(()=>{var J,le,De;return[(J=y.value)!=null&&J.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(ee,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,disabled:h.value==="disabled",size:i.unref(n),onClick:I},{default:i.withCtx(()=>{var J;return[(J=y.value)!=null&&J.isRequired?(i.openBlock(),i.createBlock(Ft,{key:1})):(i.openBlock(),i.createBlock(Ne,{key:0}))]}),_:1},8,["disabled","size"])]),default:i.withCtx(()=>[M[4]||(M[4]=i.createTextVNode(" Категория, которую нужно предлагать клиенту ",-1))]),_:1})):i.createCommentVNode("",!0),m.value?(i.openBlock(),i.createBlock(ee,{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(()=>[M[5]||(M[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(an)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(U.$slots,"default",{},()=>{var Ve,J,le;return[i.createElementVNode("div",hb,[o.value?(i.openBlock(),i.createBlock(Dd,{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&&f.value?(i.openBlock(),i.createBlock(Id,{key:0,"event-emitter":t.eventEmitter,settings:(J=t.categoryItem.properties)==null?void 0:J.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",fb,[g.value?(i.openBlock(),i.createBlock(ce,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:L},{default:i.withCtx(()=>[...M[6]||(M[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":w.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(ln,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createBlock(ln,{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(()=>[...M[7]||(M[7]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),pb=Wn(gb,[["__scopeId","data-v-607a5aad"]]),yb={class:"sc-collapse flex w-full flex-col"},bb={},zd=i.defineComponent({...bb,__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",yb,[i.renderSlot(s.$slots,"default")]))}}),_b={},Dd=i.defineComponent({..._b,__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(sr,"medium"),r=i.computed(()=>V.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(V.isUndefined(a))return;const l=a[s.id];if(l==="*")return;const c={};return c[s.id]=structuredClone(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(zd,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(pb,{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)}}}),wb={},Ld=i.defineComponent({...wb,__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(()=>V.isArray(r.value)),a=new K.Reference,l=i.computed(()=>V.isNil(r.value)?s.value?[]:null:V.isArray(r.value)?r.value.map(g=>g.id):r.value.id),c=i.computed(()=>St.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue)),d=g=>{var f;if(V.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||V.isNil(g)||(f=c.value.find(y=>y.value===g))==null?void 0:f.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,f)=>(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"]))}}),xb={},kb=i.defineComponent({...xb,__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 x,$;const n=t,r=e,o=()=>{const R=K.PriceCoefficient.getRetailPriceCoefficient();return V.unset(R,"isNewRec"),R},s=R=>!R||R.id===o().id,a=i.computed(()=>{var R;return((R=n.catalogItem)==null?void 0:R.type)==="product"}),l=i.computed(()=>a.value?n.catalogItem:void 0),c=R=>{var w,S,k,T;return R.id===o().id?(w=l.value)==null?void 0:w.getRetailCost():(T=(k=(S=l.value)==null?void 0:S.priceCoefficients)==null?void 0:k.find(N=>N.coefficient.id===R.id))==null?void 0:T.cost},d=i.computed(()=>{var w;const R=[...((w=K.useReferencesStore().priceCoefficientsReference)==null?void 0:w.map(S=>structuredClone(i.toRaw(S))))??[],o()];return a.value&&R.forEach(S=>{var T;const k=c(S);k?S.name+=` (${k} ${(T=l.value)==null?void 0:T.currency.symbol})`:S.name=""}),R.filter(S=>S.name!=="")}),u=i.ref(n.value.coefficient),h=i.ref((($=(x=n.value)==null?void 0:x.value)==null?void 0:$.toString())??null),m=i.ref(null),g=i.computed(()=>{var R,w;return(w=(R=l.value)==null?void 0:R.priceCoefficients)==null?void 0:w.find(S=>S.coefficient.slug===K.PriceCoefficientEnum.K0)}),f=i.ref(void 0),p=R=>Number.parseFloat((R??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),y=()=>{var w,S;f.value=void 0;let R=p(h.value);if(R=Number.isNaN(R)?void 0:R,a.value)if(u.value||h.value){const k=o(),T=c(u.value??k)??0,N=T+T*((R??0)/100);m.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(N),N>(((w=l.value)==null?void 0:w.getRetailCost())??N)&&(f.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),g.value&&N<(((S=g.value)==null?void 0:S.cost)??0)&&(f.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else m.value=null;r("update:value",{value:Number.isNaN(R)?void 0:R,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})},b=R=>{V.isArray(R)||V.isNull(R)||(u.value=R,h.value=null,!u.value&&h.value&&(u.value=o()),y())},_=()=>{u.value||(u.value=o()),y()},C=R=>{var S,k,T,N,E;const w=p(R);if(a.value){let P=0;if(w<=0)u.value=void 0,h.value=null;else if(g.value&&w<(((S=g.value)==null?void 0:S.cost)??0))u.value=(k=g.value)==null?void 0:k.coefficient,P=(w-g.value.cost)*100/g.value.cost,f.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(w>(((T=l.value)==null?void 0:T.getRetailCost())??w)){u.value=o();const W=((N=l.value)==null?void 0:N.getRetailCost())??0;P=(w-W)*100/W,f.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const W=((E=l.value)==null?void 0:E.priceCoefficients)??[],I=V.sortBy(W,[D=>D.cost]),te=I.filter(D=>D.cost<=w).at(-1)??I.at(0);te&&(u.value=te.coefficient,P=(w-te.cost)*100/te.cost),f.value={validationStatus:void 0,feedback:void 0}}h.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:5}).format(P),r("update:value",{value:Number.isNaN(P)?void 0:P,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})}else r("update:value",{value:Number.isNaN(w)?void 0:w,coefficient:void 0})};return i.onMounted(()=>{var R,w,S,k;n.calculationType===K.CalculationTypeEnum.m2Cost?m.value=((w=(R=n.value)==null?void 0:R.value)==null?void 0:w.toString())??null:!((S=n.value)!=null&&S.coefficient)&&((k=n.value)!=null&&k.value)&&(u.value=o()),y()}),(R,w)=>{var T,N,E;const S=O.NInput,k=O.NInputGroup;return i.openBlock(),i.createBlock(i.unref(O.NFormItem),{"show-label":!i.unref(V.isNil)(t.label),label:t.label,"show-feedback":!i.unref(V.isNil)(((T=f.value)==null?void 0:T.feedback)??t.feedback),feedback:((N=f.value)==null?void 0:N.feedback)??t.feedback,"validation-status":((E=f.value)==null?void 0:E.validationStatus)??t.validationStatus},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([{"sm:grid-cols-3":a.value&&t.calculationType!==i.unref(K.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[t.calculationType!==i.unref(K.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(k,{key:0,class:i.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:i.withCtx(()=>[i.createVNode(Ld,{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(S,{value:h.value,"onUpdate:value":[w[0]||(w[0]=P=>h.value=P),_],clearable:t.clearable,disabled:t.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},i.createSlots({suffix:i.withCtx(()=>[w[3]||(w[3]=i.createTextVNode("%",-1))]),_:2},[h.value&&!h.value.startsWith("-")?{name:"prefix",fn:i.withCtx(()=>[w[2]||(w[2]=i.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):i.createCommentVNode("",!0),a.value||t.calculationType===i.unref(K.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(S,{key:1,value:m.value,"onUpdate:value":[w[1]||(w[1]=P=>m.value=P),C],clearable:t.clearable,disabled:t.disabled,placeholder:"Стоимость",class:"w-full"},i.createSlots({_:2},[a.value?{name:"suffix",fn:i.withCtx(()=>{var P;return[i.createTextVNode(i.toDisplayString((P=l.value)==null?void 0:P.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"])}}}),vb={key:0,class:"flex flex-row gap-2.5"},Cb={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},Sb={},Hd=i.defineComponent({...Sb,__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=Bt.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=Bt.initRefDependingOnDeviceResolution(r.sizes.phone.scale,r.sizes.tablet.scale,r.sizes.default.scale),d=i.computed(()=>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 f=!1;o("closing",g,()=>{f=!0}),f||(s.value=!1,o("update:show",s.value))},m=()=>{o("accept",f=>{a.value=f})};return i.watch(()=>r.show,g=>{g?u():h("other")}),i.watch(()=>r.processing,g=>{a.value=g}),e({open:u,close:h,acceptHandler:m}),(g,f)=>{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:f[1]||(f[1]=b=>h("header")),onEsc:f[2]||(f[2]=b=>h("esc")),onMaskClick:f[3]||(f[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",vb,[i.renderSlot(g.$slots,"extra-action")])):i.createCommentVNode("",!0),g.$slots.action||t.acceptButton.show||t.cancelButton.show?(i.openBlock(),i.createElementBlock("div",Cb,[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:m},{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:f[0]||(f[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"])}}}),Bb={class:"text-sm"},Tb={},Nb=i.defineComponent({...Tb,__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 w,S,k;return((w=s.value)==null?void 0:w.unit.isLinear)&&((k=(S=s.value)==null?void 0:S.properties)==null?void 0:k.isLengthConfigurator)}),l=i.ref(void 0),c=i.ref(void 0),d=i.ref(!0),u=i.ref(null),h=n,m=()=>({length:{},quantity:{},marker:{}}),g=i.ref(m()),f=i.ref(!1),p=i.computed(()=>{var N,E,P,W;if(!s.value)return{};const w=K.UnitsHelper.getProductLengthMultiplicity(s.value),S=K.UnitsHelper.getProductMultiplicity(s.value),k=((E=(N=s.value)==null?void 0:N.properties)==null?void 0:E.minLength)||w,T=(W=(P=s.value)==null?void 0:P.properties)==null?void 0:W.maxLength;return{length:[ae.required,ae.min(k??.1),ae.max(T),ae.step(w),We.serverValidation(g.value.length.feedback)],quantity:[ae.required,ae.min(S),ae.step(S),We.serverValidation(g.value.quantity.feedback)],marker:[We.serverValidation(g.value.marker.feedback)]}}),y=i.computed(()=>{var w,S,k;return s.value?((w=s.value.properties)==null?void 0:w.lengthStep)??((S=s.value.properties)!=null&&S.ignoreMinCountCheck?0:((k=s.value.properties)==null?void 0:k.minCount)??0):0}),b=i.computed(()=>{var k,T,N,E,P,W,I,Z,te;if(!s.value)return"";const w=((T=(k=s.value)==null?void 0:k.properties)==null?void 0:T.minLength)??((E=(N=s.value)==null?void 0:N.properties)!=null&&E.ignoreMinCountCheck?0:(W=(P=s.value)==null?void 0:P.properties)==null?void 0:W.minCount),S=(Z=(I=s.value)==null?void 0:I.properties)==null?void 0:Z.maxLength;return w||S?`(${w?`от ${w}`:""}${w&&S?" ":""}${S?`до ${S}`:""} ${(te=s.value)==null?void 0:te.unit.name})`:""}),_=w=>{var E,P;if(!((P=(E=s.value)==null?void 0:E.properties)!=null&&P.isLengthConfigurator)||!u.value||V.isNil(w)||y.value===0)return;const S=w/y.value,k=Math.round(S),T=K.UnitsHelper.getProductMultiplicity(s.value),N=Math.max(k,T);u.value.quantity=N},C=w=>{var N,E,P,W;if(!((E=(N=s.value)==null?void 0:N.properties)!=null&&E.isLengthConfigurator)||!u.value||V.isNil(w)||y.value===0)return;const S=w*y.value,k=((P=s.value.properties)==null?void 0:P.minLength)||K.UnitsHelper.getProductLengthMultiplicity(s.value),T=(W=s.value.properties)==null?void 0:W.maxLength;k!==void 0&&S<k?u.value.length=k:T!==void 0&&S>T?u.value.length=T:u.value.length=S},x=async w=>{var k;const S=V.cloneDeep(u.value);try{await((k=r.value)==null?void 0:k.validate(T=>{if(!T){if(!s.value||!S)return;K.UnitsHelper.productIsMeasurable(s.value)||delete S.length,a.value&&y.value&&(S.length=y.value),f.value=!0,h("submit",S,g.value,()=>{f.value=!1,w(!1),i.nextTick(()=>{var N;(N=r.value)==null||N.validate(V.noop).catch(V.noop)})})}}))}catch{}},$=()=>{s.value=null,l.value=void 0,u.value=null,g.value=m()};return e({show:(w,S)=>{var k,T,N,E,P;if(s.value=w,l.value=S==null?void 0:S.cartItemData,c.value=S==null?void 0:S.orderId,d.value=(S==null?void 0:S.canSetDopProdaga)??!1,u.value=new K.OrderItemBase((S==null?void 0:S.cartItemData)??new K.OrderItemBase({product:w,quantity:K.UnitsHelper.productIsMeasurable(s.value)?1:((k=w==null?void 0:w.properties)==null?void 0:k.minCount)??1,length:((T=w==null?void 0:w.properties)==null?void 0:T.minLength)||((N=w==null?void 0:w.properties)!=null&&N.ignoreMinCountCheck?0:(E=w==null?void 0:w.properties)==null?void 0:E.minCount)||0})),(P=w==null?void 0:w.properties)!=null&&P.isLengthConfigurator&&u.value&&y.value>0){const W=y.value,I=u.value.quantity||1;u.value.length=I*W}},closeDialog:$}),(w,S)=>{var P;const k=O.NFormItem,T=O.NInputGroupLabel,N=O.NInputGroup,E=O.NCheckbox;return i.openBlock(),i.createBlock(Hd,{ref:"base-dialog-reference",show:!i.unref(V.isNil)(s.value)&&!i.unref(V.isNil)(u.value),title:`${l.value?"Изменение":"Добавление"} товара ${(P=s.value)==null?void 0:P.name} в ${c.value?` заказ №${c.value}`:"корзину"}`,"accept-button":{show:!0,text:l.value?"Изменить":"Добавить"},processing:f.value,"modal-width":500,onAccept:x,onClosing:$},{default:i.withCtx(()=>{var W;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((W=o.value)==null?void 0:W.acceptHandler,["prevent"]),["enter"])},{default:i.withCtx(()=>[i.unref(K.UnitsHelper).productIsMeasurable(s.value)?(i.openBlock(),i.createBlock(k,{key:0,path:"length",label:`Метраж, ${b.value+s.value.unit.name}`},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:u.value.length,"onUpdate:value":[S[0]||(S[0]=I=>u.value.length=I),_],parse:i.unref(it),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:S[1]||(S[1]=I=>i.unref(Ar)(I,".",!1)),onInput:S[2]||(S[2]=I=>i.unref(et)(g.value,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"])):i.createCommentVNode("",!0),i.createVNode(k,{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":[S[3]||(S[3]=I=>u.value.quantity=I),C],parse:i.unref(it),step:i.unref(K.UnitsHelper).getProductMultiplicity(s.value),"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:S[4]||(S[4]=I=>i.unref(Ar)(I,".",!1)),onInput:S[5]||(S[5]=I=>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(K.UnitsHelper).getProductMultiplicity(s.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Bb,"Количество должно быть кратно "+i.toDisplayString(i.unref(K.UnitsHelper).getProductMultiplicity(s.value)),1)]),key:"0"}:void 0]),1024)]),_:1}),i.unref(K.UnitsHelper).productIsMeasurable(s.value)?(i.openBlock(),i.createBlock(k,{key:1,path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:S[6]||(S[6]=I=>i.unref(et)(g.value,"marker")),"onUpdate:value":S[7]||(S[7]=I=>u.value.marker=I??null),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1})):i.createCommentVNode("",!0),d.value?(i.openBlock(),i.createBlock(E,{key:2,checked:u.value.isAdditionalSale,"onUpdate:checked":S[8]||(S[8]=I=>u.value.isAdditionalSale=I),"true-value":!0,"false-value":!1},{default:i.withCtx(()=>[...S[9]||(S[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"])}}}),$b={class:"flex flex-row gap-1"},Rb={class:"sc-client-name flex flex-col gap-1 text-base"},Eb=["href"],Pb={key:1,class:"text-sc-grey"},Fb={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Vb={key:0},Mb={key:1,class:"text-sm"},Ib={},pr=i.defineComponent({...Ib,__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?Tn.format(n.client.lastLoginAt,K.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{V.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=Wo,d=O.NButton,u=O.NPopover;return i.openBlock(),i.createElementBlock("div",$b,[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(V.isNil)(t.popoverPosition),placement:t.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",Rb,[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",Pb," [ Деактивирован ] "))],8,Eb),t.showCityAndRegion&&t.client.city?(i.openBlock(),i.createElementBlock("span",Fb," г. "+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",Vb,i.toDisplayString(t.client.alternativeName),1)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("span",Mb," Последний вход: "+i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),Ab={class:"text-base"},Ob={},Wd=i.defineComponent({...Ob,__name:"contragent-with-short-info",props:{contragent:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("span",Ab,i.toDisplayString(t.contragent.name),1))}}),zb={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Db(t,e){return i.openBlock(),i.createElementBlock("svg",zb,[...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 Lb=i.markRaw({name:"tabler-mail",render:Db}),Hb=["href"],Wb={},jb=i.defineComponent({...Wb,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(t){return(e,n)=>{const r=Lb;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,Hb)],2)}}}),qb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Xb(t,e){return i.openBlock(),i.createElementBlock("svg",qb,[...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 jd=i.markRaw({name:"fa6-brands-viber",render:Xb}),Yb={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},Ub=["id"],Kb=["id"],Gb=["fill"],Zb=["fill"];function Qb(t,e){return i.openBlock(),i.createElementBlock("svg",Yb,[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,Ub),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,Kb)]),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,Gb),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,Zb),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 qd=i.markRaw({name:"logos-whatsapp-icon",render:Qb,setup(){const t=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+t(),SVGHW6lecxh:"uicons-"+t()}}}}),Jb={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},e_=["id"],t_=["fill"];function n_(t,e){return i.openBlock(),i.createElementBlock("svg",Jb,[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,e_)]),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,t_),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 Xd=i.markRaw({name:"logos-telegram",render:n_,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),i_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function r_(t,e){return i.openBlock(),i.createElementBlock("svg",i_,[...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 Yd=i.markRaw({name:"ion-call",render:r_}),o_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function s_(t,e){return i.openBlock(),i.createElementBlock("svg",o_,[...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 a_=i.markRaw({name:"tabler-phone-call",render:s_}),l_={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},c_=["href"],d_=["href"],u_=["href"],h_=["href"],f_={},m_=i.defineComponent({...f_,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(t){const e=t,n=i.computed(()=>{try{return e.phone?or.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=i.computed(()=>{var l;return V.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),o=i.computed(()=>{var l;return V.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=i.computed(()=>{var l;return V.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=a_,u=Yd,h=Xd,m=qd,g=jd;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]=f=>a.value=!a.value),onFocusout:c[1]||(c[1]=f=>a.value=!1),onMouseleave:c[2]||(c[2]=f=>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",l_,[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,d_)):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(m)],8,u_)):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,h_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),g_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function p_(t,e){return i.openBlock(),i.createElementBlock("svg",g_,[...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 y_=i.markRaw({name:"mdi-envelope",render:p_}),b_={class:"flex flex-col gap-1"},__={key:0,class:"mb-2 flex flex-col text-base"},w_={key:0,class:"text-sc-dark-grey text-sm"},x_={key:1,class:"whitespace-nowrap text-sm"},k_={key:2,class:"whitespace-nowrap text-sm"},v_={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},C_=["href"],S_=["href"],B_=["href"],T_=["href"],N_=["href"],$_={key:0,class:"flex flex-col text-base"},R_={key:0,class:"text-sc-dark-grey text-sm"},E_={key:1,class:"mt-2 text-sm"},P_={key:0,class:"-mt-1"},F_={},V_=i.defineComponent({...F_,__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(()=>{try{return e.contact.phone?or.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),r=i.computed(()=>{var c;return V.isString(n.value)?!1:((c=n.value)==null?void 0:c.isValid())??!1}),o=i.computed(()=>{var c;return V.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("INTERNATIONAL"))??""}),s=i.computed(()=>{var c;return V.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("E.164"))??""}),a=i.computed(()=>r.value||e.contact.email),l=i.ref(!1);return(c,d)=>{var y,b;const u=Yd,h=Xd,m=qd,g=jd,f=y_,p=O.NPopover;return i.openBlock(),i.createElementBlock("div",b_,[i.createVNode(p,{disabled:t.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var _,C,x,$;return[i.createElementVNode("div",{class:i.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(_=t.contact)!=null&&_.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${t.classes}`),style:i.normalizeStyle(t.styles),onMouseenter:d[0]||(d[0]=R=>l.value=!0),onFocusin:d[1]||(d[1]=R=>l.value=!0),onMouseleave:d[2]||(d[2]=R=>l.value=!1),onFocusout:d[3]||(d[3]=R=>l.value=!1)},[i.createElementVNode("div",null,[t.fullView&&(t.contact.name||(C=t.contact)!=null&&C.position)?(i.openBlock(),i.createElementBlock("div",__,[i.createTextVNode(i.toDisplayString(t.contact.name)+" ",1),(x=t.contact)!=null&&x.position?(i.openBlock(),i.createElementBlock("span",w_,i.toDisplayString(($=t.contact)==null?void 0:$.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),t.contact.phone?(i.openBlock(),i.createElementBlock("div",x_,i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("div",k_,i.toDisplayString(t.contact.email),1)):i.createCommentVNode("",!0),a.value&&l.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:text-3xl 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:text-3xl"},[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:text-3xl"},[i.createVNode(m)],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:text-3xl hover:text-purple-600"},[i.createVNode(g)],8,T_)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${t.contact.email}`,class:"hover:text-3xl"},[i.createVNode(f)],8,N_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var _,C,x,$;return[t.contact.name?(i.openBlock(),i.createElementBlock("div",$_,[i.createTextVNode(i.toDisplayString(t.contact.name)+" ",1),(_=t.contact)!=null&&_.position?(i.openBlock(),i.createElementBlock("span",R_,i.toDisplayString((C=t.contact)==null?void 0:C.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),(x=t.contact)!=null&&x.comment?(i.openBlock(),i.createElementBlock("div",E_,[d[4]||(d[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&&((y=t.contact)!=null&&y.comment)?(i.openBlock(),i.createElementBlock("div",P_,[d[5]||(d[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((b=t.contact)==null?void 0:b.comment),1)])):i.createCommentVNode("",!0)])}}});class M_{constructor(e){B(this,"minHeight");B(this,"maxHeights");B(this,"minWidth");B(this,"maxWidths");B(this,"netType");B(this,"color");B(this,"mountType");B(this,"descriptions");B(this,"crossbarCount");B(this,"heightOverlaps");B(this,"widthOverlaps");B(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=Lo.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=Lo.objectToSnake(e.heightOverlaps),this.widthOverlaps=Lo.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function I_(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==K.ConfiguratorsEnum.SandwichM2?!0:t.properties.configuratorSettings!==void 0&&V.isArray(t.products)&&t.products.length>0}const A_={class:"flex flex-wrap gap-2"},O_={class:"flex flex-col"},z_={class:"flex flex-col"},D_={},L_=i.defineComponent({...D_,__name:"date-range",props:{clearable:{type:Boolean,default:!0},dateRange:{default:void 0},dateFormat:{default:()=>K.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 V.forOwn(K.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?Tn.startOfDay(new Date(a)):void 0,to:l?Tn.endOfDay(new Date(l)):void 0})};return(a,l)=>{var u,h,m,g,f,p;const c=O.NButton,d=O.NDatePicker;return i.openBlock(),i.createElementBlock("div",A_,[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:(m=t.disabled)==null?void 0:m.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",O_,[(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,x;return s((C=y==null?void 0:y.from)==null?void 0:C.getTime(),(x=y==null?void 0:y.to)==null?void 0:x.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"]),i.createVNode(d,{value:((f=(g=t.dateRange)==null?void 0:g.to)==null?void 0:f.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",z_,[(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,x;return s((C=y==null?void 0:y.from)==null?void 0:C.getTime(),(x=y==null?void 0:y.to)==null?void 0:x.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"])])}}}),H_={class:"sc-lbl-date text-nowrap"},W_={},go=i.defineComponent({...W_,__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(()=>Tn.format(e.date,K.useBaseConfigStateStore().config.dateFormats.uiDate)),r=i.computed(()=>Tn.format(e.date,"HH:mm"));return(o,s)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-col":t.isTimeOnSecondLine})},[i.createElementVNode("span",H_,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))}}),j_={class:"flex flex-row gap-2.5"},q_={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},X_={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},Y_={class:"mb-0.5 sm:mb-0 sm:ml-3"},U_={},K_=i.defineComponent({...U_,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(t){return(e,n)=>{const r=mo,o=O.NButton,s=O.NPopover;return i.openBlock(),i.createElementBlock("div",j_,[i.createElementVNode("div",q_,[i.renderSlot(e.$slots,"main")]),i.createElementVNode("div",null,[i.createElementVNode("div",X_,[i.renderSlot(e.$slots,"extra-buttons"),i.createElementVNode("div",Y_,[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)])])])])}}}),G_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Z_(t,e){return i.openBlock(),i.createElementBlock("svg",G_,[...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 Q_=i.markRaw({name:"ion-download-outline",render:Z_}),J_={},e1=i.defineComponent({...J_,__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=Q_;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"])}}}),t1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function n1(t,e){return i.openBlock(),i.createElementBlock("svg",t1,[...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 i1=i.markRaw({name:"ion-checkmark-done-sharp",render:n1}),r1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function o1(t,e){return i.openBlock(),i.createElementBlock("svg",r1,[...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 s1=i.markRaw({name:"ion-options-outline",render:o1}),a1={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},l1={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"},d1={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"},u1={},Ls=i.defineComponent({...u1,__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=s1,h=O.NButton,m=O.NPopover,g=i1,f=mo;return i.openBlock(),i.createElementBlock("div",a1,[i.createElementVNode("div",l1,[i.renderSlot(c.$slots,"default")]),i.createElementVNode("div",null,[i.createElementVNode("div",c1,[i.createElementVNode("div",d1,[t.showEditButton?(i.openBlock(),i.createBlock(m,{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(m,{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(m,{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(f)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[2]||(d[2]=i.createTextVNode(" Отменить изменения ",-1))]),_:1})):i.createCommentVNode("",!0)]),i.renderSlot(c.$slots,"extra-buttons")])])])}}}),h1={},Ud=i.defineComponent({...h1,__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(Ls,{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(Ls,{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"]))]))}}),f1={},m1=i.defineComponent({...f1,__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=V.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"]))}}),g1={},p1=i.defineComponent({...g1,__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=V.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,f)=>(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:f[0]||(f[0]=p=>o("keydown",p)),onInput:f[1]||(f[1]=p=>o("input",p)),onFocus:f[2]||(f[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"]))}}),y1={},b1=i.defineComponent({...y1,__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=V.debounce(c=>r("update:value",c),n.debounceTime??0),a=c=>{let d="";if(V.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(V.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof or.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=or.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof or.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(Jh.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"]))}}),_1=Wn(b1,[["__scopeId","data-v-751dbb0e"]]),w1={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function x1(t,e){return i.openBlock(),i.createElementBlock("svg",w1,[...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 k1=i.markRaw({name:"tabler-external-link",render:x1}),v1={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},C1=["href"],S1={},B1=i.defineComponent({...S1,__name:"external-link",props:{text:{},url:{},description:{}},setup(t){return(e,n)=>{const r=k1,o=O.NTooltip;return i.openBlock(),i.createBlock(o,{disabled:i.unref(V.isUndefined)(t.description),placement:"top-start"},{trigger:i.withCtx(()=>[i.createElementVNode("span",v1,[i.createElementVNode("a",{href:t.url,target:"_blank",class:"no-underline"},i.toDisplayString(t.text),9,C1),i.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.description),1)]),_:1},8,["disabled"])}}}),T1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function N1(t,e){return i.openBlock(),i.createElementBlock("svg",T1,[...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 $1=i.markRaw({name:"ion-remove-circle-outline",render:N1});let po=[];const Kd=new WeakMap;function R1(){po.forEach(t=>t(...Kd.get(t))),po=[]}function Gd(t,...e){Kd.set(t,e),!po.includes(t)&&po.push(t)===1&&requestAnimationFrame(R1)}function yr(t,e){let{target:n}=t;for(;n;){if(n.dataset&&n.dataset[e]!==void 0)return!0;n=n.parentElement}return!1}function br(t){return t.composedPath()[0]||null}function _r(t){return typeof t=="string"?t.endsWith("px")?Number(t.slice(0,t.length-2)):Number(t):t}function wr(t){if(t!=null)return typeof t=="number"?`${t}px`:t.endsWith("px")?t:`${t}px`}function nn(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 Zd={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 E1(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 P1(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 _n="^\\s*",wn="\\s*$",Gn="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Ht="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",mi="([0-9A-Fa-f])",gi="([0-9A-Fa-f]{2})",Qd=new RegExp(`${_n}hsl\\s*\\(${Ht},${Gn},${Gn}\\)${wn}`),Jd=new RegExp(`${_n}hsv\\s*\\(${Ht},${Gn},${Gn}\\)${wn}`),eu=new RegExp(`${_n}hsla\\s*\\(${Ht},${Gn},${Gn},${Ht}\\)${wn}`),tu=new RegExp(`${_n}hsva\\s*\\(${Ht},${Gn},${Gn},${Ht}\\)${wn}`),F1=new RegExp(`${_n}rgb\\s*\\(${Ht},${Ht},${Ht}\\)${wn}`),V1=new RegExp(`${_n}rgba\\s*\\(${Ht},${Ht},${Ht},${Ht}\\)${wn}`),M1=new RegExp(`${_n}#${mi}${mi}${mi}${wn}`),I1=new RegExp(`${_n}#${gi}${gi}${gi}${wn}`),A1=new RegExp(`${_n}#${mi}${mi}${mi}${mi}${wn}`),O1=new RegExp(`${_n}#${gi}${gi}${gi}${gi}${wn}`);function At(t){return parseInt(t,16)}function z1(t){try{let e;if(e=eu.exec(t))return[bo(e[1]),Zn(e[5]),Zn(e[9]),yi(e[13])];if(e=Qd.exec(t))return[bo(e[1]),Zn(e[5]),Zn(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${t}.`)}catch(e){throw e}}function D1(t){try{let e;if(e=tu.exec(t))return[bo(e[1]),Zn(e[5]),Zn(e[9]),yi(e[13])];if(e=Jd.exec(t))return[bo(e[1]),Zn(e[5]),Zn(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${t}.`)}catch(e){throw e}}function pi(t){try{let e;if(e=I1.exec(t))return[At(e[1]),At(e[2]),At(e[3]),1];if(e=F1.exec(t))return[bt(e[1]),bt(e[5]),bt(e[9]),1];if(e=V1.exec(t))return[bt(e[1]),bt(e[5]),bt(e[9]),yi(e[13])];if(e=M1.exec(t))return[At(e[1]+e[1]),At(e[2]+e[2]),At(e[3]+e[3]),1];if(e=O1.exec(t))return[At(e[1]),At(e[2]),At(e[3]),yi(At(e[4])/255)];if(e=A1.exec(t))return[At(e[1]+e[1]),At(e[2]+e[2]),At(e[3]+e[3]),yi(At(e[4]+e[4])/255)];if(t in Zd)return pi(Zd[t]);if(Qd.test(t)||eu.test(t)){const[n,r,o,s]=z1(t);return[...P1(n,r,o),s]}else if(Jd.test(t)||tu.test(t)){const[n,r,o,s]=D1(t);return[...E1(n,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${t}.`)}catch(e){throw e}}function L1(t){return t>1?1:t<0?0:t}function Hs(t,e,n,r){return`rgba(${bt(t)}, ${bt(e)}, ${bt(n)}, ${L1(r)})`}function Ws(t,e,n,r,o){return bt((t*e*(1-r)+n*r)/o)}function H1(t,e){Array.isArray(t)||(t=pi(t)),Array.isArray(e)||(e=pi(e));const n=t[3],r=e[3],o=yi(n+r-n*r);return Hs(Ws(t[0],n,e[0],r,o),Ws(t[1],n,e[1],r,o),Ws(t[2],n,e[2],r,o),o)}function ze(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:pi(t);return typeof e.alpha=="number"?Hs(n,r,o,e.alpha):Hs(n,r,o,s)}function yo(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:pi(t),{lightness:a=1,alpha:l=1}=e;return W1([n*a,r*a,o*a,s*l])}function yi(t){const e=Math.round(Number(t)*100)/100;return e>1?1:e<0?0:e}function bo(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 Zn(t){const e=Math.round(Number(t));return e>100?100:e<0?0:e}function W1(t){const[e,n,r]=t;return 3 in t?`rgba(${bt(e)}, ${bt(n)}, ${bt(r)}, ${yi(t[3])})`:`rgba(${bt(e)}, ${bt(n)}, ${bt(r)}, 1)`}function j1(t=8){return Math.random().toString(16).slice(2,2+t)}function nu(t){return Array.isArray(t)?t:[t]}const js={STOP:"STOP"};function iu(t,e){const n=e(t);t.children!==void 0&&n!==js.STOP&&t.children.forEach(r=>iu(r,e))}function q1(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 X1(t,e){const{isLeaf:n}=t;return n!==void 0?n:!e(t)}function Y1(t){return t.children}function U1(t){return t.key}function K1(){return!1}function G1(t,e){const{isLeaf:n}=t;return!(n===!1&&!Array.isArray(e(t)))}function Z1(t){return t.disabled===!0}function Q1(t,e){return t.isLeaf===!1&&!Array.isArray(e(t))}function J1(t,e){if(t.isLeaf===!0){const n=e(t);if(Array.isArray(n)&&n.length>0)return!0}return!1}function qs(t){var e;return t==null?[]:Array.isArray(t)?t:(e=t.checkedKeys)!==null&&e!==void 0?e:[]}function Xs(t){var e;return t==null||Array.isArray(t)?[]:(e=t.indeterminateKeys)!==null&&e!==void 0?e:[]}function ew(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)||n.add(r)}),Array.from(n)}function tw(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)&&n.delete(r)}),Array.from(n)}function nw(t){return(t==null?void 0:t.type)==="group"}function iw(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 rw extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function ow(t,e,n,r){return _o(e.concat(t),n,r,!1)}function sw(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 aw(t,e,n,r){const o=_o(e,n,r,!1),s=_o(t,n,r,!0),a=sw(t,n),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function Ys(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:ew(n,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:tw(n,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(n),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let h;o!==void 0?h=aw(o,n,e,d):r!==void 0?h=ow(r,n,e,d):h=_o(n,e,d,!1);const m=c==="parent",g=c==="child"||l,f=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 x of C){if(x.isLeaf)continue;const{key:$,shallowLoaded:R}=x;if(g&&R&&x.children.forEach(T=>{!T.disabled&&!T.isLeaf&&T.shallowLoaded&&f.has(T.key)&&f.delete(T.key)}),x.disabled||!R)continue;let w=!0,S=!1,k=!0;for(const T of x.children){const N=T.key;if(!T.disabled){if(k&&(k=!1),f.has(N))S=!0;else if(p.has(N)){S=!0,w=!1;break}else if(w=!1,S)break}}w&&!k?(m&&x.children.forEach(T=>{!T.disabled&&f.has(T.key)&&f.delete(T.key)}),f.add($)):S&&p.add($),_&&g&&f.has($)&&f.delete($)}}return{checkedKeys:Array.from(f),indeterminateKeys:Array.from(p)}}function _o(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&&iu(d,u=>{if(u.disabled)return js.STOP;const{key:h}=u;if(!a.has(h)&&(a.add(h),l.add(h),Q1(u.rawNode,s))){if(r)return js.STOP;if(!n)throw new rw}})}),l}function lw(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 dw(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 ru(t,e,{loop:n=!1,includeDisabled:r=!1}={}){const o=e==="prev"?uw:dw,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=Us(d,s);u!==null?l=u:c(o(d,n))}else{const u=o(d,!1);if(u!==null)c(u);else{const h=hw(d);h!=null&&h.isGroup?c(o(h,n)):n&&c(o(d,!0))}}}}return c(t),l}function uw(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 hw(t){return t.parent}function Us(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=Us(d,e);if(u!==null)return u}else return d}}return null}const fw={getChild(){return this.ignored?null:Us(this)},getParent(){const{parent:t}=this;return t!=null&&t.isGroup?t.getParent():t},getNext(t={}){return ru(this,"next",t)},getPrev(t={}){return ru(this,"prev",t)}};function mw(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 gw(t,e){const n=t.key;for(;e;){if(e.key===n)return!0;e=e.parent}return!1}var pw={};function ou(t,e,n,r,o,s=null,a=0){const l=[];return t.forEach((c,d)=>{var u;pw.NODE_ENV!=="production"&&J1(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 m=o(c);Array.isArray(m)&&(h.children=ou(m,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 yw(t,e={}){var n;const r=new Map,o=new Map,{getDisabled:s=Z1,getIgnored:a=K1,getIsGroup:l=nw,getKey:c=U1}=e,d=(n=e.getChildren)!==null&&n!==void 0?n:Y1,u=e.ignoreEmptyChildren?x=>{const $=d(x);return Array.isArray($)?$.length?$:null:$}: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 X1(this.rawNode,u)},get shallowLoaded(){return G1(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(x){return gw(this,x)}},fw),m=ou(t,r,o,h,u);function g(x){if(x==null)return null;const $=r.get(x);return $&&!$.isGroup&&!$.ignored?$:null}function f(x){if(x==null)return null;const $=r.get(x);return $&&!$.ignored?$:null}function p(x,$){const R=f(x);return R?R.getPrev($):null}function y(x,$){const R=f(x);return R?R.getNext($):null}function b(x){const $=f(x);return $?$.getParent():null}function _(x){const $=f(x);return $?$.getChild():null}const C={treeNodes:m,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(x){return mw(m,x)},getNode:g,getPrev:p,getNext:y,getParent:b,getChild:_,getFirstAvailableNode(){return cw(m)},getPath(x,$={}){return lw(x,$,C)},getCheckedKeys(x,$={}){const{cascade:R=!0,leafOnly:w=!1,checkStrategy:S="all",allowNotLoaded:k=!1}=$;return Ys({checkedKeys:qs(x),indeterminateKeys:Xs(x),cascade:R,leafOnly:w,checkStrategy:S,allowNotLoaded:k},C)},check(x,$,R={}){const{cascade:w=!0,leafOnly:S=!1,checkStrategy:k="all",allowNotLoaded:T=!1}=R;return Ys({checkedKeys:qs($),indeterminateKeys:Xs($),keysToCheck:x==null?[]:nu(x),cascade:w,leafOnly:S,checkStrategy:k,allowNotLoaded:T},C)},uncheck(x,$,R={}){const{cascade:w=!0,leafOnly:S=!1,checkStrategy:k="all",allowNotLoaded:T=!1}=R;return Ys({checkedKeys:qs($),indeterminateKeys:Xs($),keysToUncheck:x==null?[]:nu(x),cascade:w,leafOnly:S,checkStrategy:k,allowNotLoaded:T},C)},getNonLeafKeys(x={}){return q1(m,x)}};return C}function wo(t){return t.composedPath()[0]}const bw={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function _w(t,e,n){if(t==="mousemoveoutside"){const r=o=>{e.contains(wo(o))||n(o)};return{mousemove:r,touchstart:r}}else if(t==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(wo(a))},s=a=>{r&&(e.contains(wo(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 su(t,e,n){const r=bw[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=_w(t,e,n)),s}function ww(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=su(t,e,n);return Object.keys(o).forEach(s=>{Et(s,document,o[s],r)}),!0}return!1}function xw(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=su(t,e,n);return Object.keys(o).forEach(s=>{at(s,document,o[s],r)}),!0}return!1}function kw(){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(w,S,k){const T=w[S];return w[S]=function(){return k.apply(w,arguments),T.apply(w,arguments)},w}function s(w,S){w[S]=Event.prototype[S]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var w;return(w=a.get(this))!==null&&w!==void 0?w:null}function d(w,S){l!==void 0&&Object.defineProperty(w,"currentTarget",{configurable:!0,enumerable:!0,get:S??l.get})}const u={bubble:{},capture:{}},h={};function m(){const w=function(S){const{type:k,eventPhase:T,bubbles:N}=S,E=wo(S);if(T===2)return;const P=T===1?"capture":"bubble";let W=E;const I=[];for(;W===null&&(W=window),I.push(W),W!==window;)W=W.parentNode||null;const Z=u.capture[k],te=u.bubble[k];if(o(S,"stopPropagation",n),o(S,"stopImmediatePropagation",r),d(S,c),P==="capture"){if(Z===void 0)return;for(let D=I.length-1;D>=0&&!t.has(S);--D){const H=I[D],L=Z.get(H);if(L!==void 0){a.set(S,H);for(const A of L){if(e.has(S))break;A(S)}}if(D===0&&!N&&te!==void 0){const A=te.get(H);if(A!==void 0)for(const z of A){if(e.has(S))break;z(S)}}}}else if(P==="bubble"){if(te===void 0)return;for(let D=0;D<I.length&&!t.has(S);++D){const H=I[D],L=te.get(H);if(L!==void 0){a.set(S,H);for(const A of L){if(e.has(S))break;A(S)}}}}s(S,"stopPropagation"),s(S,"stopImmediatePropagation"),d(S)};return w.displayName="evtdUnifiedHandler",w}function g(){const w=function(S){const{type:k,eventPhase:T}=S;if(T!==2)return;const N=h[k];N!==void 0&&N.forEach(E=>E(S))};return w.displayName="evtdUnifiedWindowEventHandler",w}const f=m(),p=g();function y(w,S){const k=u[w];return k[S]===void 0&&(k[S]=new Map,window.addEventListener(S,f,w==="capture")),k[S]}function b(w){return h[w]===void 0&&(h[w]=new Set,window.addEventListener(w,p)),h[w]}function _(w,S){let k=w.get(S);return k===void 0&&w.set(S,k=new Set),k}function C(w,S,k,T){const N=u[S][k];if(N!==void 0){const E=N.get(w);if(E!==void 0&&E.has(T))return!0}return!1}function x(w,S){const k=h[w];return!!(k!==void 0&&k.has(S))}function $(w,S,k,T){let N;if(typeof T=="object"&&T.once===!0?N=Z=>{R(w,S,N,T),k(Z)}:N=k,ww(w,S,N,T))return;const P=T===!0||typeof T=="object"&&T.capture===!0?"capture":"bubble",W=y(P,w),I=_(W,S);if(I.has(N)||I.add(N),S===window){const Z=b(w);Z.has(N)||Z.add(N)}}function R(w,S,k,T){if(xw(w,S,k,T))return;const E=T===!0||typeof T=="object"&&T.capture===!0,P=E?"capture":"bubble",W=y(P,w),I=_(W,S);if(S===window&&!C(S,E?"bubble":"capture",w,k)&&x(w,k)){const te=h[w];te.delete(k),te.size===0&&(window.removeEventListener(w,p),h[w]=void 0)}I.has(k)&&I.delete(k),I.size===0&&W.delete(S),W.size===0&&(window.removeEventListener(w,f,P==="capture"),u[P][w]=void 0)}return{on:$,off:R}}const{on:Et,off:at}=kw(),Ki="@@mmoContext",vw={mounted(t,{value:e}){t[Ki]={handler:void 0},typeof e=="function"&&(t[Ki].handler=e,Et("mousemoveoutside",t,e))},updated(t,{value:e}){const n=t[Ki];typeof e=="function"?n.handler?n.handler!==e&&(at("mousemoveoutside",t,n.handler),n.handler=e,Et("mousemoveoutside",t,e)):(t[Ki].handler=e,Et("mousemoveoutside",t,e)):n.handler&&(at("mousemoveoutside",t,n.handler),n.handler=void 0)},unmounted(t){const{handler:e}=t[Ki];e&&at("mousemoveoutside",t,e),t[Ki].handler=void 0}},Gi="@@coContext",xo={mounted(t,{value:e,modifiers:n}){t[Gi]={handler:void 0},typeof e=="function"&&(t[Gi].handler=e,Et("clickoutside",t,e,{capture:n.capture}))},updated(t,{value:e,modifiers:n}){const r=t[Gi];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[Gi].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[Gi];n&&at("clickoutside",t,n,{capture:e.capture}),t[Gi].handler=void 0}};function Cw(t,e){console.error(`[vdirs/${t}]: ${e}`)}class Sw{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&&Cw("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 Ks=new Sw,Zi="@@ziContext",au={mounted(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n;t[Zi]={enabled:!!o,initialized:!1},o&&(Ks.ensureZIndex(t,r),t[Zi].initialized=!0)},updated(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n,s=t[Zi].enabled;o&&!s&&(Ks.ensureZIndex(t,r),t[Zi].initialized=!0),t[Zi].enabled=!!o},unmounted(t,e){if(!t[Zi].initialized)return;const{value:n={}}=e,{zIndex:r}=n;Ks.unregister(t,r)}};function Bw(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 Tw=typeof window<"u";let Qi,xr;(()=>{var t,e;Qi=Tw?(e=(t=document)===null||t===void 0?void 0:t.fonts)===null||e===void 0?void 0:e.ready:void 0,xr=!1,Qi!==void 0?Qi.then(()=>{xr=!0}):xr=!0})();function Nw(t){if(xr)return;let e=!1;i.onMounted(()=>{xr||Qi==null||Qi.then(()=>{e||t()})}),i.onBeforeUnmount(()=>{e=!0})}function Gs(t,e){return i.watch(t,n=>{n!==void 0&&(e.value=n)}),i.computed(()=>t.value===void 0?e.value:t.value)}function ko(){const t=i.ref(!1);return i.onMounted(()=>{t.value=!0}),i.readonly(t)}function lu(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 $w=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function Rw(){return $w}function Zs(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);return r()}function Qs(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)){Qs(r,e,n);return}if(r.type===i.Fragment){if(r.children===null)return;Array.isArray(r.children)&&Qs(r.children,e,n)}else r.type!==i.Comment&&n.push(r)}}),n}function cu(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);const o=Qs(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${t}]: slot[${n}] should have exactly one child.`)}let Qn=null;function du(){if(Qn===null&&(Qn=document.getElementById("v-binder-view-measurer"),Qn===null)){Qn=document.createElement("div"),Qn.id="v-binder-view-measurer";const{style:t}=Qn;t.position="fixed",t.left="0",t.right="0",t.top="0",t.bottom="0",t.pointerEvents="none",t.visibility="hidden",document.body.appendChild(Qn)}return Qn.getBoundingClientRect()}function Ew(t,e){const n=du();return{top:e,left:t,height:0,width:0,right:n.width-t,bottom:n.height-e}}function Js(t){const e=t.getBoundingClientRect(),n=du();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 Pw(t){return t.nodeType===9?null:t.parentNode}function uu(t){if(t===null)return null;const e=Pw(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 uu(e)}const hu=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=uu(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=()=>{Gd(m)},m=()=>{c.forEach(b=>b())},g=new Set,f=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:f,removeResizeListener:p}},render(){return Zs("binder",this.$slots)}}),fu=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(cu("follower",this.$slots),[[e]]):cu("follower",this.$slots)}}),Fw="@css-render/vue3-ssr";function Vw(t,e){return`<style cssr-id="${t}">
103
+ `}},no=Li.Multiply,ap=[1,0,0,0,1,0,0,0,1],Kn=new un(9),lp=yt.Utils,Tc=new re,ks=new un([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 Li,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 un(9)),this._matrix.toTransformArray(!0,Kn),no(Kn,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,m,g,f,p;const y=e._renderer.vertices,b=this.canvas,_=this.ctx,C=t.renderer.ratio,x=Tc.copy(e._renderer.scale).multiply(C),$=e._stroke,R=e._linewidth,w=e._fill,S=e._renderer.opacity||e._opacity,k=e._cap,T=e._join,N=e._miter,E=e._closed,P=e.dashes,W=y.length,I=W-1;b.width=Math.max(Math.ceil(e._renderer.rect.width*x.x),1),b.height=Math.max(Math.ceil(e._renderer.rect.height*x.y),1);const Z=e._renderer.rect.centroid,te=Z.x,D=Z.y;if(_.clearRect(0,0,b.width,b.height),w)if(typeof w=="string")_.fillStyle=w;else{const X=yt.Utils.getRendererType(w._renderer.type);xe[X].render.call(w,_,e),_.fillStyle=w._renderer.effect}if($){if(typeof $=="string")_.strokeStyle=$;else{const X=yt.Utils.getRendererType($._renderer.type);xe[X].render.call($,_,e),_.strokeStyle=$._renderer.effect}R&&(_.lineWidth=hn(e)),N&&(_.miterLimit=N),T&&(_.lineJoin=T),!E&&k&&(_.lineCap=k)}typeof S=="number"&&(_.globalAlpha=S),P&&P.length>0&&(_.lineDashOffset=P.offset||0,_.setLineDash(P));let H,L,A,z,Y,U,M,j;_.save(),_.scale(x.x,x.y),_.translate(te,D),_.beginPath();for(let X=0;X<y.length;X++){const ee=y[X];switch(g=ee.x,f=ee.y,ee.command){case oe.close:_.closePath();break;case oe.arc:L=ee.rx,A=ee.ry,z=ee.xAxisRotation,Y=ee.largeArcFlag,U=ee.sweepFlag,n=E?Dt(X-1,W):Math.max(X-1,0),r=y[n],M=r.x,j=r.y,lp.renderSvgArcCommand(_,M,j,L,A,Y,U,z,g,f);break;case oe.curve:n=E?Dt(X-1,W):Math.max(X-1,0),r=y[n],d=r.controls&&r.controls.right||re.zero,u=ee.controls&&ee.controls.left||re.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),ee._relative?(s=u.x+ee.x,a=u.y+ee.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,g,f),X>=I&&E&&(o=H,h=ee.controls&&ee.controls.right||re.zero,m=o.controls&&o.controls.left||re.zero,ee._relative?(l=h.x+ee.x,c=h.y+ee.y):(l=h.x,c=h.y),o._relative?(s=m.x+o.x,a=m.y+o.y):(s=m.x,a=m.y),g=o.x,f=o.y,_.bezierCurveTo(l,c,s,a,g,f));break;case oe.line:_.lineTo(g,f);break;case oe.move:H=ee,_.moveTo(g,f);break}}E&&_.closePath(),xe.isHidden.test(w)||(p=w._renderer&&w._renderer.offset,p&&(_.save(),_.translate(-w._renderer.offset.x,-w._renderer.offset.y),_.scale(w._renderer.scale.x,w._renderer.scale.y)),_.fill(),p&&_.restore()),xe.isHidden.test($)||(p=$._renderer&&$._renderer.offset,p&&(_.save(),_.translate(-$._renderer.offset.x,-$._renderer.offset.y),_.scale($._renderer.scale.x,$._renderer.scale.y),_.lineWidth=R/$._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,m=d.controls;let g,f,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=m.left,_=m.right,!(!b||!_)&&(g=d._relative?b.x+u:b.x,f=d._relative?b.y+h:b.y,p=d._relative?_.x+u:_.x,y=d._relative?_.y+h:_.y,!(!g||!f||!p||!y)&&(s=Math.min(f,y,s),r=Math.min(g,p,r),o=Math.max(g,p,o),a=Math.max(f,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 un(9)),this._matrix.toTransformArray(!0,Kn),no(Kn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let h,m;this._scale instanceof re?(h=this._scale.x*r._renderer.scale.x,m=this._scale.y*r._renderer.scale.y):(h=this._scale*r._renderer.scale.x,m=this._scale*r._renderer.scale.y),this._renderer.scale.x=h<0?-h:h,this._renderer.scale.y=m<0?-m:m,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,ks,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 m=h;xe.isHidden.test(a)||(m+=l),r.width=pl(m),r.height=r.width;const g=m/r.width,f=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=hn(e)/g)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(f,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,m=this._renderer.vertices,g=this._renderer.collection.length,f=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 un(9)),this._matrix.toTransformArray(!0,Kn),no(Kn,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(f){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,m,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=Tc.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,m=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,f=g.x,p=g.y;let y,b,_,C,x,$,R,w,S,k,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=m,c)if(typeof c=="string")r.fillStyle=c;else{const E=yt.Utils.getRendererType(c._renderer.type);xe[E].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const E=yt.Utils.getRendererType(a._renderer.type);xe[E].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=hn(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(f,p),xe.isHidden.test(c)||(c._renderer&&c._renderer.offset?($=c._renderer.scale.x,R=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale($,R),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?($=a._renderer.scale.x,R=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale($,R),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,x=l/a._renderer.scale.x,r.lineWidth=x,r.strokeText(e.value,_,C),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(h)){const E=r.measureText(e.value);switch(h){case"underline":S=E.actualBoundingBoxDescent,T=E.actualBoundingBoxDescent;break;case"strikethrough":S=0,T=0;break}w=-E.width/2,k=E.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(w,S),r.lineTo(k,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 un(9)),this._matrix.toTransformArray(!0,Kn),no(Kn,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,ks,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 It("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 Lr};xe.ctx=xe.canvas.getContext("2d");var Nc=class extends Q{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 un(ap),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 It("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,ks,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"?Qo(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(Q.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(Nc,"Utils",xe);var cp=ie.extend({Error:It,getRatio:Qo,read:qe,xhr:xc},ie,Tt,hl,fl),Ce=class Ir{constructor(e){v(this,"_events",new Q),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:Ir.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=Ir.Types[r])}this.renderer=new Ir[this.type](this),this.setPlaying(n.autostart),this.frameCount=0,n.fullscreen?(this.fit=dp.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=up.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(Q.Types.resize,hp.bind(this)),this.scene=this.renderer.scene,Ir.Instances.push(this),n.autostart&&hr.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,hr.init(),this.trigger(Q.Types.play)}pause(){return this.playing=!1,this.trigger(Q.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(Q.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(Q.Types.render,this.frameCount++)}add(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.add(e),this}remove(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.remove(e),this}clear(){return this.scene.remove(this.scene.children),this}makeLine(e,n,r,o){const s=new Zr(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 Un(e,n,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,n,r,o,s){const a=new Ur(e,n,r,o,s);return this.scene.add(a),a}makeCircle(e,n,r,o){const s=new Xr(e,n,r,o);return this.scene.add(s),s}makeEllipse(e,n,r,o,s){const a=new Yr(e,n,r,o,s);return this.scene.add(a),a}makeStar(e,n,r,o,s){const a=new fs(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 hs(e,n,r,o);return this.scene.add(s),s}makeArcSegment(e,n,r,o,s,a,l){const c=new ss(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 us(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 fn(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 qr(e,n,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,n,r,o,s,a){const l=new kc(e,n,r,o,s,a);return this.add(l),l}makeImageSequence(e,n,r,o,s){const a=new ys(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)?(xc(e,l),r):(l(e),r)}};v(Ce,"NextFrameId",Nt.NextFrameId),v(Ce,"Types",Nt.Types),v(Ce,"Version",Nt.Version),v(Ce,"PublishDate",Nt.PublishDate),v(Ce,"Identifier",Nt.Identifier),v(Ce,"Resolution",Nt.Resolution),v(Ce,"AutoCalculateImportedMatrices",Nt.AutoCalculateImportedMatrices),v(Ce,"Instances",Nt.Instances),v(Ce,"uniqueId",Nt.uniqueId),v(Ce,"Anchor",Be),v(Ce,"Collection",qn),v(Ce,"Events",Q),v(Ce,"Group",ct),v(Ce,"Matrix",Li),v(Ce,"Path",$e),v(Ce,"Registry",Lr),v(Ce,"Element",Di),v(Ce,"Shape",Yn),v(Ce,"Text",fn),v(Ce,"Vector",re),v(Ce,"Gradient",ot),v(Ce,"Image",kc),v(Ce,"ImageSequence",ys),v(Ce,"LinearGradient",Ye),v(Ce,"RadialGradient",Ue),v(Ce,"Sprite",qr),v(Ce,"Stop",Xn),v(Ce,"Texture",Oe),v(Ce,"ArcSegment",ss),v(Ce,"Circle",Xr),v(Ce,"Ellipse",Yr),v(Ce,"Line",Zr),v(Ce,"Points",us),v(Ce,"Polygon",hs),v(Ce,"Rectangle",Un),v(Ce,"RoundedRectangle",Ur),v(Ce,"Star",fs),v(Ce,"CanvasRenderer",yt),v(Ce,"SVGRenderer",Bc),v(Ce,"WebGLRenderer",Nc),v(Ce,"Commands",oe),v(Ce,"Utils",cp);var gn=Ce;function dp(){const t=document.body.getBoundingClientRect(),e=this.width=t.width,n=this.height=t.height;this.renderer.setSize(e,n,this.ratio)}function up(){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 hp(t,e){this.width=t,this.height=e,this.trigger(Q.Types.resize,t,e)}var hr=Lt.getRequestAnimationFrame();function $c(){for(let t=0;t<gn.Instances.length;t++){const e=gn.Instances[t];e.playing&&e.update()}gn.NextFrameId=hr($c)}hr.init=function(){$c(),hr.init=function(){}};let pn;typeof window<"u"?pn=window:typeof global<"u"?pn=global:typeof self<"u"&&(pn=self);let Rc;const di=Math.PI*2,dt=Math.PI*.5;function fp(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 mp(t){Rc=t}function gp(t,e){e=e&&e.identity()||new Rc;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 ji(t,e){for(;t<0;)t+=e;return t%e}const Ec=pn.Float32Array||Array,pp=Math.floor;function yn(t){return pp(t*1e6)/1e6}const pe={move:"M",line:"L",curve:"C",close:"Z"};class ne{constructor(){B(this,"_events",{});B(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}}B(ne,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),B(ne,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Pc={x:{enumerable:!0,get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this._bound&&this.dispatchEvent(ne.Types.change))}},y:{enumerable:!0,get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this._bound&&this.dispatchEvent(ne.Types.change))}}},ht=class ht extends ne{constructor(n=0,r=0){super();B(this,"_x",0);B(this,"_y",0);for(let o in Pc)Object.defineProperty(this,o,Pc[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:yn(this.x),y:yn(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}};B(ht,"zero",new ht),B(ht,"left",new ht(-1,0)),B(ht,"right",new ht(1,0)),B(ht,"up",new ht(0,-1)),B(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);B(this,"controls",{left:new be,right:new be});B(this,"_command",pe.move);B(this,"_relative",!0);B(this,"_rx",0);B(this,"_ry",0);B(this,"_xAxisRotation",0);B(this,"_largeArcFlag",0);B(this,"_sweepFlag",1);for(let u in Fc)Object.defineProperty(this,u,Fc[u]);this.command=c,this.relative=!0;const d=Fe.makeBroadcast(this);this.controls.left.set(o,s).addEventListener(ne.Types.change,d),this.controls.right.set(a,l).addEventListener(ne.Types.change,d)}static makeBroadcast(n){return r;function r(){n._bound&&n.dispatchEvent(ne.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:yn(this.x),y:yn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:yn(this.rx),ry:yn(this.ry),xAxisRotation:yn(this.xAxisRotation),largeArcFlag:yn(this.largeArcFlag),sweepFlag:yn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const Fc={command:{enumerable:!0,get:function(){return this._command},set:function(t){this._command!==t&&(this._command=t,this._bound&&this.dispatchEvent(ne.Types.change))}},relative:{enumerable:!0,get:function(){return this._relative},set:function(t){this._relative!==!!t&&(this._relative=!!t,this._bound&&this.dispatchEvent(ne.Types.change))}},rx:{enumerable:!0,get:function(){return this._rx},set:function(t){this._rx!==t&&(this._rx=t,this._bound&&this.dispatchEvent(ne.Types.change))}},ry:{enumerable:!0,get:function(){return this._ry},set:function(t){this._ry!==t&&(this._ry=t,this._bound&&this.dispatchEvent(ne.Types.change))}},xAxisRotation:{enumerable:!0,get:function(){return this._xAxisRotation},set:function(t){this._xAxisRotation!==t&&(this._xAxisRotation=t,this._bound&&this.dispatchEvent(ne.Types.change))}},largeArcFlag:{enumerable:!0,get:function(){return this._largeArcFlag},set:function(t){this._largeArcFlag!==t&&(this._largeArcFlag=t,this._bound&&this.dispatchEvent(ne.Types.change))}},sweepFlag:{get:function(){return this._sweepFlag},set:function(t){this._sweepFlag!==t&&(this._sweepFlag=t,this._bound&&this.dispatchEvent(ne.Types.change))}}};let yp=0;const vs={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return yp++}},io={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 ro(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 Vc(t,e,n,r,o,s,a,l,c){c=c||io.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 m=h/d,g=ro(m,t,n,o,a),f=ro(m,e,r,s,l);u.push(new Fe(g,f))}return u}function bp(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),m=9*(r-s)+3*(l-e),g=6*(e+s)-12*r,f=3*(r-e);function p(y){const b=(d*y+u)*y+h,_=(m*y+g)*y+f;return Math.sqrt(b*b+_*_)}return wp(p,0,1,c||io.RecursionLimit)}function _p(t,e,n,r,o,s,a,l){const c=[],d=[[],[]];let u,h,m,g,f,p,y,b;for(let $=0;$<2;++$){if($===0?(h=6*t-12*n+6*o,u=-3*t+9*n-9*o+3*a,m=3*n-3*t):(h=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,m=3*r-3*e),Math.abs(u)<.001){if(Math.abs(h)<.001)continue;g=-m/h,0<g&&g<1&&c.push(g);continue}y=h*h-4*m*u,b=Math.sqrt(y),!(y<0)&&(f=(-h+b)/(2*u),0<f&&f<1&&c.push(f),p=(-h-b)/(2*u),0<p&&p<1&&c.push(p))}let _=c.length,C=_,x;for(;_--;)g=c[_],x=1-g,d[0][_]=x*x*x*t+3*x*x*g*n+3*x*g*g*o+g*g*g*a,d[1][_]=x*x*x*e+3*x*x*g*r+3*x*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 wp(t,e,n,r){let o=io.abscissas[r-2],s=io.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 xp(t,e){const n=t.length,r=n-1;for(let o=0;o<n;o++){const s=t[o],a=e?ji(o-1,n):Math.max(o-1,0),l=e?ji(o+1,n):Math.min(o+1,r),c=t[a],d=s,u=t[l];kp(c,d,u),d.command=o===0?pe.move:pe.curve}}function kp(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 fr=(Bi=class extends ne{constructor(){super();B(this,"_flagId",!1);B(this,"_flagClassName",!1);B(this,"_renderer",{});B(this,"_id",vs.Identifier+vs.uniqueId());B(this,"_className","");B(this,"classList",[]);for(let n in Mc)Object.defineProperty(this,n,Mc[n])}static fromObject(n){const r=new Bi().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}},B(Bi,"Properties",["renderer","id","className"]),Bi);const Mc={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 oo extends Error{constructor(n){super();B(this,"name","Two.js");B(this,"message");this.message=n}}class vp{constructor(){B(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 so;const Ic={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};pn.document&&(so=document.createElement("a"));const Ge=class Ge extends fr{constructor(n,r){super();B(this,"_flagSrc",!1);B(this,"_flagImage",!1);B(this,"_flagVideo",!1);B(this,"_flagLoaded",!1);B(this,"_flagRepeat",!1);B(this,"_flagOffset",!1);B(this,"_flagScale",!1);B(this,"_src","");B(this,"_image",null);B(this,"_loaded",!1);B(this,"_repeat","no-repeat");B(this,"_scale",1);B(this,"_offset",null);for(let o in Ac)Object.defineProperty(this,o,Ac[o]);if(this._renderer.type="texture",this._renderer.flagOffset=Cp.bind(this),this._renderer.flagScale=Sp.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new be,typeof r=="function"){const o=(function(){this.unbind(ne.Types.load,o),typeof r=="function"&&r()}).bind(this);this.bind(ne.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 so?(so.href=n,so.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 pn.document?Ic.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(ne.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Ge.load(this,(function(){this.loaded=!0,this.trigger(ne.Types.change).trigger(ne.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}};B(Ge,"Properties",["src","loaded","repeat","scale","offset","image"]),B(Ge,"RegularExpressions",Ic),B(Ge,"ImageRegistry",new vp),B(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 oo("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 oo("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 Ac={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(ne.Types.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(ne.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(ne.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof be&&this._scale.bind(ne.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Cp(){this._flagOffset=!0}function Sp(){this._flagScale=!0}class ui extends Array{constructor(){super();qa(this,ft,new ne);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 Vt(this,ft)}set _events(n){Zh(this,ft,n)}get _bound(){return Vt(this,ft)._bound}set _bound(n){Vt(this,ft)._bound=n}addEventListener(){return Vt(this,ft).addEventListener.apply(this,arguments)}on(){return Vt(this,ft).on.apply(this,arguments)}bind(){return Vt(this,ft).bind.apply(this,arguments)}removeEventListener(){return Vt(this,ft).removeEventListener.apply(this,arguments)}off(){return Vt(this,ft).off.apply(this,arguments)}unbind(){return Vt(this,ft).unbind.apply(this,arguments)}dispatchEvent(){return Vt(this,ft).dispatchEvent.apply(this,arguments)}trigger(){return Vt(this,ft).trigger.apply(this,arguments)}listen(){return Vt(this,ft).listen.apply(this,arguments)}ignore(){return Vt(this,ft).ignore.apply(this,arguments)}pop(){const n=super.pop.apply(this,arguments);return this.trigger(ne.Types.remove,[n]),n}shift(){const n=super.shift.apply(this,arguments);return this.trigger(ne.Types.remove,[n]),n}push(){const n=super.push.apply(this,arguments);return this.trigger(ne.Types.insert,arguments),n}unshift(){const n=super.unshift.apply(this,arguments);return this.trigger(ne.Types.insert,arguments),n}splice(){const n=super.splice.apply(this,arguments);if(this.trigger(ne.Types.remove,n),arguments.length>2){const r=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(ne.Types.insert,r),this.trigger(ne.Types.order)}return n}sort(){return super.sort.apply(this,arguments),this.trigger(ne.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(ne.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 Oc=Array.prototype.slice;function Bp(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}const Me={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=Oc.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=Oc.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=!Bp(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:pn.performance&&pn.performance.now?pn.performance:Date},Ot=class Ot extends fr{constructor(n,r,o){super();B(this,"_flagOffset",!0);B(this,"_flagOpacity",!0);B(this,"_flagColor",!0);B(this,"_offset",0);B(this,"_opacity",1);B(this,"_color","#fff");for(let s in zc)Object.defineProperty(this,s,zc[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 Me.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",Me.each(Ot.Properties,r=>{n[r]=this[r]},this),n}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};B(Ot,"Index",0),B(Ot,"Properties",["offset","opacity","color"]);let hi=Ot;const zc={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)}}},kn=class kn extends fr{constructor(n){super();B(this,"_flagStops",!1);B(this,"_flagSpread",!1);B(this,"_flagUnits",!1);B(this,"_spread","");B(this,"_units","");for(let r in Dc)Object.defineProperty(this,r,Dc[r]);this._renderer.type="gradient",this._renderer.flagStops=Tp.bind(this),this._renderer.bindStops=Np.bind(this),this._renderer.unbindStops=$p.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 hi?s:new hi().copy(s)));const o=new kn(r).copy(n);return"id"in n&&(o.id=n.id),o}clone(n){const r=this.stops.map(s=>s.clone()),o=new kn(r);return Me.each(kn.Properties,s=>{o[s]=this[s]},this),n&&n.add(o),o}copy(n){super.copy.call(this,n);for(let r=0;r<kn.Properties.length;r++){const o=kn.Properties[r];o in n&&(this[o]=n[o])}return this}toObject(){const n={stops:this.stops.map(r=>r.toObject())};return Me.each(kn.Properties,r=>{n[r]=this[r]},this),n}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(ne.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}};B(kn,"Stop",hi),B(kn,"Properties",["spread","stops","units"]);let st=kn;const Dc={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(ne.Types.insert,e).unbind(ne.Types.remove,n),this._stops=new ui((t||[]).slice(0)),this._stops.bind(ne.Types.insert,e).bind(ne.Types.remove,n),e(this._stops)}}};function Tp(){this._flagStops=!0}function Np(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function $p(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}const ti=class ti extends st{constructor(n,r,o,s,a){super(a);B(this,"_flagEndPoints",!1);B(this,"_left",null);B(this,"_right",null);for(let l in Lc)Object.defineProperty(this,l,Lc[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=Rp.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 ti().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<ti.Properties.length;r++){const o=ti.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 ti(this.left._x,this.left._y,this.right._x,this.right._y,r);return Me.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(ne.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};B(ti,"Stop",hi),B(ti,"Properties",["left","right"]);let $t=ti;const Lc={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof be&&this._left.unbind(ne.Types.change,this._renderer.flagEndPoints),this._left=t,this._left.bind(ne.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(ne.Types.change,this._renderer.flagEndPoints),this._right=t,this._right.bind(ne.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function Rp(){this._flagEndPoints=!0}const vn=class vn extends st{constructor(n,r,o,s,a,l){super(s);B(this,"_flagRadius",!1);B(this,"_flagCenter",!1);B(this,"_flagFocal",!1);B(this,"_radius",0);B(this,"_center",null);B(this,"_focal",null);for(let c in Hc)Object.defineProperty(this,c,Hc[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Ep.bind(this),this._renderer.flagFocal=Pp.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 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&&(/(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 vn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return Me.each(st.Properties.concat(vn.Properties),function(s){o[s]=this[s]},this),n&&n.add(o),o}toObject(){const n=super.toObject.call(this);return Me.each(vn.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(ne.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};B(vn,"Stop",hi),B(vn,"Properties",["center","radius","focal"]);let Rt=vn;const Hc={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(ne.Types.change,this._renderer.flagCenter),this._center=t,this._center.bind(ne.Types.change,this._renderer.flagCenter),this._flagCenter=!0}},focal:{enumerable:!0,get:function(){return this._focal},set:function(t){this._focal&&this._focal.unbind(ne.Types.change,this._renderer.flagFocal),this._focal=t,this._focal.bind(ne.Types.change,this._renderer.flagFocal),this._flagFocal=!0}}};function Ep(){this._flagCenter=!0}function Pp(){this._flagFocal=!0}function Wc(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 ao(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 jc(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(m||t).x,d=(m||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),m&&t._relative&&(s+=t.x,d+=t.y),bp(r,l,o,c,s,d,a,u,n)}function qc(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(m||t).x,d=(m||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),m&&t._relative&&(s+=t.x,d+=t.y),Vc(r,l,o,c,s,d,a,u,n)}function fi(t){switch(t.renderer.type){case"texture":return Ke.fromObject(t);case"gradient":return st.fromObject(t);case"linear-gradient":return $t.fromObject(t);case"radial-gradient":return Rt.fromObject(t)}return t}const Fp=Math.cos,Vp=Math.sin,Xc=Math.tan,Cs=[],Pt=class Pt extends ne{constructor(n,r,o,s,a,l){super();B(this,"elements",new Ec(9));B(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 w=n;let S,k,T;const N=r[0]||0,E=r[1]||0,P=r[2]||0;return S=w[0]*N+w[1]*E+w[2]*P,k=w[3]*N+w[4]*E+w[5]*P,T=w[6]*N+w[7]*E+w[8]*P,[S,k,T]}const s=n[0],a=n[1],l=n[2],c=n[3],d=n[4],u=n[5],h=n[6],m=n[7],g=n[8],f=r[0],p=r[1],y=r[2],b=r[3],_=r[4],C=r[5],x=r[6],$=r[7],R=r[8];return o=o||new Ec(9),o[0]=s*f+a*b+l*x,o[1]=s*p+a*_+l*$,o[2]=s*y+a*C+l*R,o[3]=c*f+d*b+u*x,o[4]=c*p+d*_+u*$,o[5]=c*y+d*C+u*R,o[6]=h*f+m*b+g*x,o[7]=h*p+m*_+g*$,o[8]=h*y+m*C+g*R,o}static fromObject(n){return new Pt().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(ne.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(ne.Types.change)}identity(){return this.elements[0]=Pt.Identity[0],this.elements[1]=Pt.Identity[1],this.elements[2]=Pt.Identity[2],this.elements[3]=Pt.Identity[3],this.elements[4]=Pt.Identity[4],this.elements[5]=Pt.Identity[5],this.elements[6]=Pt.Identity[6],this.elements[7]=Pt.Identity[7],this.elements[8]=Pt.Identity[8],this.trigger(ne.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(ne.Types.change);if(typeof o>"u"&&(o=1),typeof s>"u"){n=n||0,r=r||0,o=o||0,a=this.elements;const I=a[0]*n+a[1]*r+a[2]*o,Z=a[3]*n+a[4]*r+a[5]*o,te=a[6]*n+a[7]*r+a[8]*o;return[I,Z,te]}const h=this.elements,m=[n,r,o,s,a,l,c,d,u],g=h[0],f=h[1],p=h[2],y=h[3],b=h[4],_=h[5],C=h[6],x=h[7],$=h[8],R=m[0],w=m[1],S=m[2],k=m[3],T=m[4],N=m[5],E=m[6],P=m[7],W=m[8];return this.elements[0]=g*R+f*k+p*E,this.elements[1]=g*w+f*T+p*P,this.elements[2]=g*S+f*N+p*W,this.elements[3]=y*R+b*k+_*E,this.elements[4]=y*w+b*T+_*P,this.elements[5]=y*S+b*N+_*W,this.elements[6]=C*R+x*k+$*E,this.elements[7]=C*w+x*T+$*P,this.elements[8]=C*S+x*N+$*W,this.trigger(ne.Types.change)}inverse(n){const r=this.elements;n=n||new Pt;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],m=r[8],g=m*c-d*h,f=-m*l+d*u,p=h*l-c*u;let y=o*g+s*f+a*p;return y?(y=1/y,n.elements[0]=g*y,n.elements[1]=(-m*s+a*h)*y,n.elements[2]=(d*s-a*c)*y,n.elements[3]=f*y,n.elements[4]=(m*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=Fp(n),o=Vp(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=Xc(n);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(n){const r=Xc(n);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(n){return Cs.length=0,this.toTransformArray(n,Cs),Cs.map(yn).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 m=o[6],g=o[7],f=o[8];if(s){r[0]=a,r[1]=d,r[2]=m,r[3]=l,r[4]=u,r[5]=g,r[6]=c,r[7]=h,r[8]=f;return}return[a,d,m,l,u,g,c,h,f]}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 m=o[6],g=o[7],f=o[8];if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=h,r[6]=m,r[7]=g,r[8]=f;return}return[a,l,c,d,u,h,m,g,f]}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 Pt().copy(this)}};B(Pt,"Identity",[1,0,0,0,1,0,0,0,1]);let mr=Pt;mp(mr);const Pr=class Pr extends fr{constructor(){super();B(this,"_flagMatrix",!0);B(this,"_flagScale",!1);B(this,"_matrix",null);B(this,"_worldMatrix",null);B(this,"_position",null);B(this,"_rotation",0);B(this,"_scale",1);B(this,"_skewX",0);B(this,"_skewY",0);for(let n in lo)Object.defineProperty(this,n,lo[n]);this._renderer.flagMatrix=Yc.bind(this),this.isShape=!0,this.matrix=new mr,this.worldMatrix=new mr,this.position=new be,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(n){const r=new Pr().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 lo.position.get.apply(this,arguments)}set translation(n){lo.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 Pr;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}};B(Pr,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let $n=Pr;const lo={position:{enumerable:!0,get:function(){return this._position},set:function(t){this._position&&this._position.unbind(ne.Types.change,this._renderer.flagMatrix),this._position=t,this._position.bind(ne.Types.change,this._renderer.flagMatrix),Yc.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(ne.Types.change,this._renderer.flagMatrix),this._scale=t,this._scale instanceof be&&this._scale.bind(ne.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 gp(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function Yc(){this._flagMatrix=!0}const qi=Math.min,Xi=Math.max,Mp=Math.ceil,Ip=Math.floor,Ap=new be,on=class on extends $n{constructor(n,r,o,s){super();B(this,"_flagVertices",!0);B(this,"_flagLength",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagCap",!0);B(this,"_flagJoin",!0);B(this,"_flagMiter",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_flagMask",!1);B(this,"_flagClip",!1);B(this,"_length",0);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_cap","round");B(this,"_join","round");B(this,"_miter",4);B(this,"_closed",!0);B(this,"_curved",!1);B(this,"_automatic",!0);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_mask",null);B(this,"_clip",!1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);for(let a in Uc)Object.defineProperty(this,a,Uc[a]);this._renderer.type="path",this._renderer.flagVertices=Kc.bind(this),this._renderer.bindVertices=Gc.bind(this),this._renderer.unbindVertices=Zc.bind(this),this._renderer.flagFill=Qc.bind(this),this._renderer.flagStroke=Jc.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:fi(n.fill),o=typeof n.stroke=="string"?n.stroke:fi(n.stroke),s=new on().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<on.Properties.length;r++){const o=on.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new on;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<on.Properties.length;o++){const s=on.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()),Me.each(on.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,m=-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:f}=fp(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof g=="number"&&typeof f=="number"&&(o=Math.max(g,f)*(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,f]=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,x]=r.multiply(b,_),$=c.controls.left.x,R=c.controls.left.y;c.relative&&($+=c.x,R+=c.y);let[w,S]=r.multiply($,R);const k=_p(g,f,C,x,w,S,p,y);h=qi(k.min.y-o,h),d=qi(k.min.x-o,d),u=Xi(k.max.x+o,u),m=Xi(k.max.y+o,m)}else a<=1&&(h=qi(f-o,h),d=qi(g-o,d),u=Xi(g+o,u),m=Xi(f+o,m)),h=qi(y-o,h),d=qi(p-o,d),u=Xi(p+o,u),m=Xi(y+o,m)}return{top:h,left:d,right:u,bottom:m,width:u-d,height:m-h}}getPointAt(n,r){let o,s,a,l,c,d,u,h,m,g,f,p,y,b,_,C=this.length*Math.min(Math.max(n,0),1);const x=this.vertices.length,$=x-1;let R=null,w=null;for(let D=0,H=this._lengths.length,L=0;D<H;D++){if(L+this._lengths[D]>=C){this._closed?(o=ji(D,x),s=ji(D-1,x),D===0&&(o=s,s=D)):(o=D,s=Math.min(Math.max(D-1,0),$)),R=this.vertices[o],w=this.vertices[s],C-=L,this._lengths[D]!==0?n=C/this._lengths[D]:n=0;break}L+=this._lengths[D]}if(R===null||w===null)return null;if(R){if(!w)return R}else return w;_=w.controls&&w.controls.right,b=R.controls&&R.controls.left,c=w.x,g=w.y,d=(_||w).x,f=(_||w).y,u=(b||R).x,p=(b||R).y,h=R.x,y=R.y,_&&w.relative&&(d+=w.x,f+=w.y),b&&R.relative&&(u+=R.x,p+=R.y),l=ro(n,c,d,u,h),m=ro(n,g,f,p,y);const S=Gt(c,d,n),k=Gt(g,f,n),T=Gt(d,u,n),N=Gt(f,p,n),E=Gt(u,h,n),P=Gt(p,y,n),W=Gt(S,T,n),I=Gt(k,N,n),Z=Gt(T,E,n),te=Gt(N,P,n);return Me.isObject(r)?(r.x=l,r.y=m,r instanceof Fe&&(r.controls.left.x=W,r.controls.left.y=I,r.controls.right.x=Z,r.controls.right.y=te,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=m,r.controls.right.x-=l,r.controls.right.y-=m)),r.t=n,r):(a=new Fe(l,m,W-l,I-m,Z-l,te-m,this._curved?pe.curve:pe.line),a.t=n,a)}plot(){if(this.curved)return xp(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 Me.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=qc(c,s,n),a=a.concat(l),Me.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=qc(c,s,n),a=a.concat(l),Me.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=[]),Me.each(this.vertices,function(c,d){if(d<=0||c.command===pe.move){a=c,this._lengths[d]=0;return}this._lengths[d]=jc(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=ao(this,o*this._length),l=ao(this,s*this._length),c=Mp(a),d=Ip(l);let u,h,m,g,f,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?(f=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(s,f),f.command=this._renderer.collection[p].command,this._renderer.vertices.push(f),h=f,m=this._collection[p-1],m&&m.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f),m.relative?this._renderer.collection[p-1].controls.right.copy(m.controls.right).lerp(be.zero,1-f.t):this._renderer.collection[p-1].controls.right.copy(m.controls.right).lerp(m,1-f.t))):p>=c&&p<=d&&(f=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(f),p===d&&Wc(this,s)?(h=f,!r&&h.controls&&(h.relative?h.controls.right.clear():h.controls.right.copy(h))):p===c&&Wc(this,o)&&(u=f,u.command=pe.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(p=c-1,f=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(o,f),f.command=pe.move,this._renderer.vertices.unshift(f),g=this._collection[p+1],g&&g.controls&&(f.controls.left.clear(),g.relative?this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(be.zero,f.t):(Ap.copy(g),this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(g,f.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}};B(on,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),B(on,"Utils",{getCurveLength:jc});let Ie=on;const Uc={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 $t||this._fill instanceof Rt||this._fill instanceof Ke)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Rt||this._fill instanceof Ke)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Rt||this._stroke instanceof Ke)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Rt||this._stroke instanceof Ke)&&this._stroke.bind(ne.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";Me.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(ne.Types.insert,e).unbind(ne.Types.remove,n),t instanceof ui?this._collection=t:this._collection=new ui(t||[]),this._collection.bind(ne.Types.insert,e).bind(ne.Types.remove,n),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Me.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 Kc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Gc(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Zc(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Qc(){this._flagFill=!0}function Jc(){this._flagStroke=!0}const Op=Math.ceil,zp=Math.floor,Cn=class Cn extends $n{constructor(n){super();B(this,"_flagVertices",!0);B(this,"_flagLength",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagSize",!0);B(this,"_flagSizeAttenuation",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_length",0);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_size",1);B(this,"_sizeAttenuation",!1);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);B(this,"noFill",Ie.prototype.noFill);B(this,"noStroke",Ie.prototype.noStroke);B(this,"corner",Ie.prototype.corner);B(this,"center",Ie.prototype.center);B(this,"getBoundingClientRect",Ie.prototype.getBoundingClientRect);B(this,"_updateLength",Ie.prototype._updateLength);for(let r in ed)Object.defineProperty(this,r,ed[r]);this._renderer.type="points",this._renderer.flagVertices=Kc.bind(this),this._renderer.bindVertices=Gc.bind(this),this._renderer.unbindVertices=Zc.bind(this),this._renderer.flagFill=Qc.bind(this),this._renderer.flagStroke=Jc.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:fi(n.fill),o=typeof n.stroke=="string"?n.stroke:fi(n.stroke),s=new Cn().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<Cn.Properties.length;r++){const o=Cn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Cn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Cn.Properties.length;o++){const s=Cn.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),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()),Me.each(Cn.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=Vc(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=ao(this,n*this._length),s=ao(this,r*this._length),a=Op(o),l=zp(s);let c=0,d;this._renderer.vertices=[],this._renderer.collection=[];for(let u=0;u<this._collection.length;u++)u>=a&&u<=l&&(d=this._collection[u],this._renderer.collection.push(d),this._renderer.vertices[c*2+0]=d.x,this._renderer.vertices[c*2+1]=d.y,c++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};B(Cn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let co=Cn;const ed={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 $t||this._fill instanceof Rt||this._fill instanceof Ke)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Rt||this._fill instanceof Ke)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Rt||this._stroke instanceof Ke)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Rt||this._stroke instanceof Ke)&&this._stroke.bind(ne.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(ne.Types.insert,e).unbind(ne.Types.remove,n),t instanceof ui?this._collection=t:this._collection=new ui(t||[]),this._collection.bind(ne.Types.insert,e).bind(ne.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 td extends ui{constructor(n){n=Array.isArray(n)?n:Array.prototype.slice.call(arguments);super(n);qa(this,Ao,{});this.attach(n),this.on(ne.Types.insert,this.attach),this.on(ne.Types.remove,this.detach)}get ids(){return Vt(this,Ao)}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}}Ao=new WeakMap;const Vn=class Vn extends Ie{constructor(n,r,o,s,a,l,c){const d=c||vs.Resolution*3,u=[];for(let h=0;h<d;h++)u.push(new Fe);super(u,!0,!1,!0);B(this,"_flagStartAngle",!1);B(this,"_flagEndAngle",!1);B(this,"_flagInnerRadius",!1);B(this,"_flagOuterRadius",!1);B(this,"_startAngle",0);B(this,"_endAngle",di);B(this,"_innerRadius",0);B(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let h in nd)Object.defineProperty(this,h,nd[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=ji(n,di)===ji(r,di),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,h=0,m,g,f,p,y,b,_,C,x;for(a?d--:l||(d-=2),m=0,g=d-1;m<d;m++){switch(f=m/g,p=c[h],y=f*(r-n)+n,b=(r-n)/d,_=s*Math.cos(y),C=s*Math.sin(y),m){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&&(x=s*b/Math.PI,p.controls.left.x=x*Math.cos(y-dt),p.controls.left.y=x*Math.sin(y-dt),p.controls.right.x=x*Math.cos(y+dt),p.controls.right.y=x*Math.sin(y+dt),m===1&&p.controls.left.multiplyScalar(2),m===g&&p.controls.right.multiplyScalar(2)),h++}if(l){for(a?(c[h].command=pe.close,h++):(d--,g=d-1),m=0;m<d;m++)f=m/g,p=c[h],y=(1-f)*(r-n)+n,b=(r-n)/d,_=o*Math.cos(y),C=o*Math.sin(y),u=pe.curve,m<=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&&(x=o*b/Math.PI,p.controls.left.x=x*Math.cos(y+dt),p.controls.left.y=x*Math.sin(y+dt),p.controls.right.x=x*Math.cos(y-dt),p.controls.right.y=x*Math.sin(y-dt),m===1&&p.controls.left.multiplyScalar(2),m===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<Ie.Properties.length;d++){const u=Ie.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}};B(Vn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let Ss=Vn;const nd={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}}},Bs=Math.cos,Ts=Math.sin,Mn=class Mn extends Ie{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);B(this,"_flagRadius",!1);B(this,"_radius",0);this._renderer.type="circle";for(let c in id)Object.defineProperty(this,c,id[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 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._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*di,d=o*Bs(c),u=o*Ts(c),h=s*Bs(c-dt),m=s*Ts(c-dt),g=s*Bs(c+dt),f=s*Ts(c+dt),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(h,m),p.controls.right.set(g,f)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=new Mn(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<Ie.Properties.length;o++){const s=Ie.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<Mn.Properties.length;r++){const o=Mn.Properties[r];n[o]=this[o]}return n}};B(Mn,"Properties",["radius"]);let Ns=Mn;const id={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},$s=Math.cos,Rs=Math.sin,In=class In extends Ie{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);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_width",0);B(this,"_height",0);this._renderer.type="ellipse";for(let d in rd)Object.defineProperty(this,d,rd[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 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._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*di,d=o*$s(c),u=s*Rs(c),h=o*r*$s(c-dt),m=s*r*Rs(c-dt),g=o*r*$s(c+dt),f=s*r*Rs(c+dt),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(h,m),p.controls.right.set(g,f)}}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 In(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<Ie.Properties.length;l++){const c=Ie.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<In.Properties.length;r++){const o=In.Properties[r];n[o]=this[o]}return n}};B(In,"Properties",["width","height"]);let Es=In;const rd={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}}},Dp=Math.cos,Lp=Math.sin,An=class An extends Ie{constructor(n,r,o,s){s=Math.max(s||0,3);super();B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_flagSides",!1);B(this,"_radius",0);B(this,"_width",0);B(this,"_height",0);B(this,"_sides",0);this._renderer.type="polygon";for(let a in od)Object.defineProperty(this,a,od[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=di*a+Math.PI/2,c=this._width*Dp(l)/2,d=this._height*Lp(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<Ie.Properties.length;o++){const s=Ie.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}};B(An,"Properties",["width","height","sides"]);let Ps=An;const od={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}}},Ti=class Ti extends Ie{constructor(n,r,o,s){const a=[new Fe,new Fe,new Fe,new Fe];super(a,!0,!1,!0);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_width",0);B(this,"_height",0);B(this,"_origin",null);this._renderer.type="rectangle";for(let l in sd)Object.defineProperty(this,l,sd[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 Ti().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Ti.Properties.length;r++){const o=Ti.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 Ti(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<Ie.Properties.length;o++){const s=Ie.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}};B(Ti,"Properties",["width","height","origin"]);let gr=Ti;const sd={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(ne.Types.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(ne.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},On=class On extends Ie{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);B(this,"_flagWidth",!1);B(this,"_flagHeight",!1);B(this,"_flagRadius",!1);B(this,"_width",0);B(this,"_height",0);B(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in ad)Object.defineProperty(this,c,ad[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=Hp.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<Ie.Properties.length;l++){const c=Ie.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}};B(On,"Properties",["width","height","radius"]);let Fs=On;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}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof be&&this._radius.unbind(ne.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof be&&this._radius.bind(ne.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function Hp(){this._flagRadius=!0}const Wp=Math.cos,jp=Math.sin,zn=class zn extends Ie{constructor(n,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();B(this,"_flagInnerRadius",!1);B(this,"_flagOuterRadius",!1);B(this,"_flagSides",!1);B(this,"_innerRadius",0);B(this,"_outerRadius",0);B(this,"_sides",0);this._renderer.type="star";for(let l in ld)Object.defineProperty(this,l,ld[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=di*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*Wp(l),u=c*jp(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<Ie.Properties.length;l++){const c=Ie.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}};B(zn,"Properties",["innerRadius","outerRadius","sides"]);let Vs=zn;const ld={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 Ms;const cd=Math.min,dd=Math.max;pn.document&&(Ms=document.createElement("canvas"));const kt=class kt extends $n{constructor(n,r,o,s){super();B(this,"_flagValue",!0);B(this,"_flagFamily",!0);B(this,"_flagSize",!0);B(this,"_flagLeading",!0);B(this,"_flagAlignment",!0);B(this,"_flagBaseline",!0);B(this,"_flagStyle",!0);B(this,"_flagWeight",!0);B(this,"_flagDecoration",!0);B(this,"_flagFill",!0);B(this,"_flagStroke",!0);B(this,"_flagLinewidth",!0);B(this,"_flagOpacity",!0);B(this,"_flagVisible",!0);B(this,"_flagMask",!1);B(this,"_flagClip",!1);B(this,"_flagDirection",!0);B(this,"_flagStrokeAttenuation",!0);B(this,"_value","");B(this,"_family","sans-serif");B(this,"_size",13);B(this,"_leading",17);B(this,"_alignment","center");B(this,"_baseline","middle");B(this,"_style","normal");B(this,"_weight",500);B(this,"_decoration","none");B(this,"_direction","ltr");B(this,"_fill","#000");B(this,"_stroke","none");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_mask",null);B(this,"_clip",!1);B(this,"_dashes",null);B(this,"_strokeAttenuation",!0);for(let a in ud)Object.defineProperty(this,a,ud[a]);if(this._renderer.type="text",this._renderer.flagFill=qp.bind(this),this._renderer.flagStroke=Xp.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,!Me.isObject(s))return this;for(let a=0;a<kt.Properties.length;a++){const l=kt.Properties[a];l in s&&(this[l]=s[l])}}static Measure(n){if(Ms){const r=Ms.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*kt.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:fi(n.fill),o=typeof n.stroke=="string"?n.stroke:fi(n.stroke),s=new kt().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<kt.Properties.length;r++){const o=kt.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new kt(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<kt.Properties.length;o++){const s=kt.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<kt.Properties.length;r++){const o=kt.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}=kt.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,m]=r.multiply(o,a),[g,f]=r.multiply(o,l),[p,y]=r.multiply(s,a),[b,_]=r.multiply(s,l);return a=cd(m,f,y,_),o=cd(h,g,p,b),s=dd(h,g,p,b),l=dd(m,f,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}};B(kt,"Ratio",.6),B(kt,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let Yi=kt;const ud={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 $t||this._fill instanceof Rt||this._fill instanceof Ke)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Rt||this._fill instanceof Ke)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Rt||this._stroke instanceof Ke)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Rt||this._stroke instanceof Ke)&&this._stroke.bind(ne.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Me.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 qp(){this._flagFill=!0}function Xp(){this._flagStroke=!0}const Dn=class Dn extends gr{constructor(n,r,o,s){super(r,o,0,0);B(this,"_flagTextures",!1);B(this,"_flagFrameRate",!1);B(this,"_flagIndex",!1);B(this,"_amount",1);B(this,"_duration",0);B(this,"_index",0);B(this,"_startTime",0);B(this,"_playing",!1);B(this,"_firstFrame",0);B(this,"_lastFrame",0);B(this,"_loop",!0);B(this,"_textures",null);B(this,"_frameRate",0);B(this,"_origin",null);this._renderer.type="image-sequence";for(let a in hd)Object.defineProperty(this,a,hd[a]);this._renderer.flagTextures=Yp.bind(this),this._renderer.bindTextures=Up.bind(this),this._renderer.unbindTextures=Kp.bind(this),this.noStroke(),this.noFill(),Array.isArray(n)?this.textures=n.map(fd.bind(this)):typeof n=="string"&&(this.textures=[fd(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=Me.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,Me.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=Me.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}};B(Dn,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),B(Dn,"DefaultFrameRate",30);let Is=Dn;const hd={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(ne.Types.insert,e).unbind(ne.Types.remove,n),this._textures=new ui((t||[]).slice(0)),this._textures.bind(ne.Types.insert,e).bind(ne.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 Yp(){this._flagTextures=!0}function Up(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Kp(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function fd(t){if(t instanceof Ke)return t;if(typeof t=="string")return new Ke(t)}const Ni=class Ni extends gr{constructor(n,r,o,s,a,l){super(r,o,0,0);B(this,"_flagTexture",!1);B(this,"_flagColumns",!1);B(this,"_flagRows",!1);B(this,"_flagFrameRate",!1);B(this,"_flagIndex",!1);B(this,"_amount",1);B(this,"_duration",0);B(this,"_startTime",0);B(this,"_playing",!1);B(this,"_firstFrame",0);B(this,"_lastFrame",0);B(this,"_loop",!0);B(this,"_texture",null);B(this,"_columns",1);B(this,"_rows",1);B(this,"_frameRate",0);B(this,"_index",0);B(this,"_origin",null);this._renderer.type="sprite";for(let c in md)Object.defineProperty(this,c,md[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 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])}return this}play(n,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=Me.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 Ni(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,m,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,m=n.image.height,s=h/r,a=m/o,c=this._amount,this.width!==s&&(this.width=s),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&(Me.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=Me.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 f=this._index%r,p=Math.floor(this._index/r),y=-s*f+(h-s)/2,b=-a*p+(m-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}};B(Ni,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let As=Ni;const md={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}}},uo=Math.min,ho=Math.max,sn=class sn extends $n{constructor(n){super();B(this,"_flagAdditions",!1);B(this,"_flagSubtractions",!1);B(this,"_flagOrder",!1);B(this,"_flagOpacity",!0);B(this,"_flagBeginning",!1);B(this,"_flagEnding",!1);B(this,"_flagLength",!1);B(this,"_flagMask",!1);B(this,"_fill","#fff");B(this,"_stroke","#000");B(this,"_linewidth",1);B(this,"_opacity",1);B(this,"_visible",!0);B(this,"_cap","round");B(this,"_join","round");B(this,"_miter",4);B(this,"_closed",!0);B(this,"_curved",!1);B(this,"_automatic",!0);B(this,"_beginning",0);B(this,"_ending",1);B(this,"_length",0);B(this,"_mask",null);B(this,"_strokeAttenuation",!0);for(let r in gd)Object.defineProperty(this,r,gd[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++)pd.call(this,n[r],this)}static RemoveChildren(n){for(let r=0;r<n.length;r++)pd.call(this,n[r])}static OrderChildren(n){this._flagOrder=!0}static fromObject(n){const r=new sn;for(let s=0;s<sn.Properties.length;s++){const a=sn.Properties[s];a in n&&(/(fill|stroke)/i.test(a)?r[a]=typeof n[a]=="string"?n[a]:fi(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 Ss.fromObject(s);case"circle":return Ns.fromObject(s);case"element":return fr.fromObject(s);case"ellipse":return Es.fromObject(s);case"group":return sn.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Is.fromObject(s);case"path":return Ie.fromObject(s);case"points":return co.fromObject(s);case"polygon":return Ps.fromObject(s);case"rectangle":return gr.fromObject(s);case"rounded-rectangle":return Fs.fromObject(s);case"shape":return $n.fromObject(s);case"sprite":return As.fromObject(s);case"star":return Vs.fromObject(s);case"text":return Yi.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<sn.Properties.length;r++){const o=sn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new sn,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,Me.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,m=-1/0;const g=/texture|gradient/i;o=n?this.matrix:this.worldMatrix;for(let f=0;f<this.children.length;f++){const p=this.children[f];if(!(!p.visible||g.test(p._renderer.type))&&(r=p.getBoundingClientRect(n),s=typeof r.top!="number"||Me.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||Me.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||Me.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||Me.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),[x,$]=o.multiply(r.left,r.bottom),[R,w]=o.multiply(r.right,r.bottom);h=uo(b,C,$,w,h),d=uo(y,_,x,R,d),u=ho(y,_,x,R,u),m=ho(b,C,$,w,m)}else h=uo(r.top,h),d=uo(r.left,d),u=ho(r.right,u),m=ho(r.bottom,m)}return{top:h,left:d,right:u,bottom:m,width:u-d,height:m-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}};B(sn,"Children",td),B(sn,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let Rn=sn;const gd={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=Rn.InsertChildren.bind(this),n=Rn.RemoveChildren.bind(this),r=Rn.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new td(t),this._children.bind(ne.Types.insert,e),this._children.bind(ne.Types.remove,n),this._children.bind(ne.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,Me.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 pd(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 fo extends Ie{constructor(e,n,r,o){const s=[new Fe(e,n),new Fe(r,o)];super(s);for(let a in yd)Object.defineProperty(this,a,yd[a]);this.vertices[0].command=pe.move,this.vertices[1].command=pe.line,this.automatic=!1}}B(fo,"Properties",["left","right"]);const yd={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if(Me.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=pe.move;else{const e=new oo("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(Me.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=pe.line;else{const e=new oo("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class Os{constructor(e=0,n=0){this.x=e,this.y=n}}class bn{constructor(e=10,n=0,r="A"){B(this,"start",new Os);B(this,"end",new Os);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"}},Gp={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Zp(t,e){return i.openBlock(),i.createElementBlock("svg",Gp,[...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 mo=i.markRaw({name:"ion-close",render:Zp}),Qp={class:"mr-3 flex flex-col gap-2"},Jp=["onClick"],ey={class:"h-full p-2"},ty={},ny=i.defineComponent({...ty,__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 m=(g=o.value)==null?void 0:g.at(h);m&&a("init-draw-template",m,u)}),(d=n.settings.customTemplates)==null||d.forEach((u,h)=>{var g;const m=(g=s.value)==null?void 0:g.at(h);m&&a("init-draw-template",m,u)})}),i.watch(()=>[...n.settings.customTemplates],(c,d)=>{i.nextTick(()=>{c.forEach((u,h)=>{var m;if(!(d!=null&&d.includes(u))){const g=(m=s.value)==null?void 0:m.at(h);g&&a("init-draw-template",g,u)}}),d.length>c.length&&d.forEach((u,h)=>{var g;const m=(g=s.value)==null?void 0:g.at(h);m&&(m.innerHTML="",a("init-draw-template",m,u))})})},{deep:!0}),(c,d)=>{const u=mo;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",Qp,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.settings.allTemplates,(h,m)=>(i.openBlock(),i.createElementBlock("div",{key:`${h.id}-${m}`,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":m===t.selectTemplateIndex}]),onClick:g=>a("template:select",m)},[i.createElementVNode("div",ey,[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,Jp)]),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(m)},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),bd=Wn(ny,[["__scopeId","data-v-afccb364"]]),iy={class:"flex gap-3 min-w-[20rem] relative"},ry={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},oy={ref:"drawing-container",class:"size-full"},sy={},_d=i.defineComponent({...sy,__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 bn(n.value.configuratorParams.linesWidths[H],D,`A-${H+1}`))),h=i.computed(()=>n.value.configuratorParams.colorSide==="bottom"),m=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 bn(L[0],L[1],`A-${A+1}`):new bn(L.width,L.angle,`A-${A+1}`))}),f=(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],Y=D[A-1]??new bn(0,L);L+=!H||A>1?Y.angle:0;const U=(!H||A>0?z.angle:0)+L;if(D[A].end.x=z.width*Math.cos(U*Math.PI/180)+D[A].start.x,D[A].end.y=z.width*Math.sin(U*Math.PI/180)+D[A].start.y,A<D.length-1){const M=A+1;D[M].start.x=D[A].end.x,D[M].start.y=D[A].end.y}}return D},p=(D,H,L,A,z=!1)=>{let Y=f([...L,...A]);H.length>0&&(Y=[...f(H),...Y]);let U=0,M=0,j=0,X=0;Y.forEach(Te=>{U=Math.min(U,Te.start.x,Te.end.x),M=Math.min(M,Te.start.y,Te.end.y),j=Math.max(j,Te.start.x,Te.end.x),X=Math.max(X,Te.start.y,Te.end.y)});let ee,ue;U===0&&M===0&&j===0&&X===0?(ee=1,ue=1):(ee=D.width/Math.abs(j-U),ue=(z?D.height:D.height-je.colorSideLabel.size)/Math.abs(X-M));const ve=Math.min(ee,ue);return U=U<0?-U*ve:0,M=M<0?-M*ve:0,[ve,U,M]},y=D=>{const H=new co([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(ne.Types.change,()=>{L.vertices[0].copy(A)});const z=y(A);H.add(z)}D.forEach((L,A)=>{const z=D[A+1],Y=new be(L.vertices[1].x,L.vertices[1].y);Y.bind(ne.Types.change,()=>{L.vertices[1].copy(Y),z!==void 0&&z.vertices[0].copy(Y)});const U=y(Y);H.add(U)})},_=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},x=(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},$=(D,H,L)=>{const A=new Rn;if(D.length===0)return A;const z=[];return[...D].reverse().forEach((Y,U)=>{U!==0&&Y.angle>0&&(Y.angle*=-1),z.push(Y)}),D=f(z,!0),x(A,H,D[0].angle),[H.vertices[0],H.vertices[1]].forEach(Y=>{Y.bind(ne.Types.change,()=>{x(A,H,D[0].angle)})}),D.forEach(Y=>{const U=Y.start.x*L,M=Y.end.x*L,j=Y.start.y*L,X=Y.end.y*L,ee=new fo(U,j,M,X);ee.linewidth=je.line.size,ee.stroke=je.line.color,A.add(ee)}),A},R=(D,H,L)=>{const A=new Rn;return D.length===0||(D=f(D,!0),C(A,H,D[0].angle),[H.vertices[0],H.vertices[1]].forEach(z=>{z.bind(ne.Types.change,()=>{C(A,H,D[0].angle)})}),D.forEach(z=>{const Y=z.start.x*L,U=z.end.x*L,M=z.start.y*L,j=z.end.y*L,X=new fo(Y,M,U,j);X.linewidth=je.line.size,X.stroke=je.line.color,A.add(X)})),A},w=(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),Y=H.vertices[0].y+(H.vertices[1].y-H.vertices[0].y)/2-8*Math.cos(D.angle*Math.PI/180),U=new Yi(D.label,z+10,Y-10);let M;U.size=je.lineLabel.size,U.weight=600,U.fill=je.lineLabel.color,U.id+=1,U.rotation=je.lineLabel.rotation,A>0&&(M=new Yi(`${D.angle}°`,H.vertices[0].x+25,H.vertices[0].y-25),M.size=je.angleLabel.size,M.weight=600,M.fill=je.angleLabel.color,M.rotation=je.angleLabel.rotation,M.id+=A,s.push(M),L.add(M)),L.add(U),k(U,H,0,M),k(U,H,1)},S=()=>{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,Y=new Rn;if(!c)return Y;const U=5,M=Math.atan2(z-A,L-H),j=[new Fe(H,A,0,0,0,0,gn.Commands.move),new Fe(L,z,0,0,0,0,gn.Commands.line),new Fe(L-U*Math.cos(M-Math.PI/4),z-U*Math.sin(M-Math.PI/4),0,0,0,0,gn.Commands.line),new Fe(L,z,0,0,0,0,gn.Commands.move),new Fe(L-U*Math.cos(M+Math.PI/4),z-U*Math.sin(M+Math.PI/4),0,0,0,0,gn.Commands.line)],X=new Ie(j,!1,!1,!0);X.noFill(),X.cap="round",X.join="round",X.linewidth=D/7,X.stroke=je.colorSideLabel.color,Y.add(X);const ee=new Yi(h.value?"Цвет снизу":"Цвет сверху",10,0);ee.size=D,ee.weight=600,ee.fill=je.colorSideLabel.color,ee.alignment="left",Y.add(ee);const ue=Y.getBoundingClientRect();return Y.position.x=(c.width-ue.width)*d+10,Y.position.y=h.value?c.height+ue.height*2:ue.height/2,Y},k=(D,H,L,A)=>{H.vertices[L].bind(ne.Types.change,()=>{const z=H.vertices.length-1,Y=Math.atan2(H.vertices[0].y-H.vertices[z].y,H.vertices[0].x-H.vertices[z].x)*180/Math.PI,U=H.vertices[0].x+(H.vertices[z].x-H.vertices[0].x)/2-8*Math.sin(Y*Math.PI/180),M=H.vertices[0].y+(H.vertices[z].y-H.vertices[0].y)/2-8*Math.cos(Y*Math.PI/180);D.position.x=U+10,D.position.y=M-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 He;if(D.clear(),L.length===0){D.update();return}const Y=f(L),[U,M,j]=p(D,H,Y,A,z),X=new Rn,ee=new Array,ue=new Array;z||(s=[],a=[]),Y.forEach((ce,mt)=>{const Ne=ce.start.x*U+M,Ft=ce.end.x*U+M,Wt=ce.start.y*U+j,an=ce.end.y*U+j,Ct=new fo(Ne,Wt,Ft,an);Ct.linewidth=z?je.previewLine.size:je.line.size,Ct.stroke=z?je.previewLine.color:je.line.color,a.push(Ct),ee.push(Ct),X.add(Ct),!z&&ce.label!==""&&w(ce,Ct,X,mt)});const ve=ee.at(-1);let Te=X.getBoundingClientRect();if(!z){const ce=S();ue.push(ce)}if(H.length>0){const ce=$(H,ee[0],U);X.add(ce)}if(A.length>0&&ve){const ce=R(A,ve,U);X.add(ce)}if(ue.push(X),D.makeGroup(ue),Te=X.getBoundingClientRect(),X.position.x=0-Te.left+(D.width-Te.width)/(2*(z?1:d)),X.position.y=0-Te.top+(D.height-Te.height)/(2*(z?1:d)),D.update(),!z){const ce=((He=n.value.configuratorParams)==null?void 0:He.colorSide)==="top";X.position.y=X.position.y+je.colorSideLabel.size*Number(ce),b(ee,X),D.update()}},N=(D,H)=>{if(D&&!H.isNewRec()){const L=new gn({width:D.scrollWidth,height:D.scrollHeight});L.appendTo(D),T(L,[],H.points,[],!0)}},E=()=>{c&&T(c,m.value,u.value,g.value,!1)},P=D=>D*(180/Math.PI),W=(D,H)=>{const L=D[1].x-D[0].x,A=D[1].y-D[0].y,z=H[1].x-H[0].x,Y=H[1].y-H[0].y;let U=Math.atan2(L*Y-A*z,L*z+A*Y);return U=P(U),Math.round(U)*-1},I=D=>{const H=a.map((L,A,z)=>{const Y=z[A-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let U=Math.ceil(L._length/D/n.settings.lineWidthStep)*n.settings.lineWidthStep;const M=s[A-1];U<(z.length>1?n.settings.minLineWidth:n.settings.stripMinWidth)&&(U=z.length>1?n.settings.minLineWidth:n.settings.stripMinWidth),U>n.settings.maxLineWidth&&(U=n.settings.maxLineWidth);const j=W(L.vertices,Y.vertices);return M&&(M.value=`${j}°`),new bn(U,j,`A-${A+1}`)});r("pointer:move",H)},Z=D=>{let H=null,L;const A=M=>{H=l.find(j=>{const X=j.renderer;return(X==null?void 0:X.elem)===M.target}),[L]=p(D,m.value,u.value.map(j=>j),g.value)},z=M=>{if(H){const j=H.renderer,X=j==null?void 0:j.elem;if(!X)return;const ee=X.getBoundingClientRect();H.vertices[0].x-=ee.x-(M instanceof MouseEvent?M.clientX:M.targetTouches[0].clientX)+je.anchorPoint.size/2,H.vertices[0].y-=ee.y-(M instanceof MouseEvent?M.clientY:M.targetTouches[0].clientY)+je.anchorPoint.size/2,I(L),D.update()}},Y=()=>{H&&r("pointer:up",u.value),H=null},U=o.value;U&&(U.addEventListener("touchstart",A,{passive:!0}),U.addEventListener("touchend",Y,{passive:!0}),U.addEventListener("mousedown",A),U.addEventListener("mouseup",Y),U.addEventListener("mousemove",z),U.addEventListener("touchmove",z,{passive:!0}))},te=(D,H)=>{r("remove-custom-template",D,H)};return i.onMounted(()=>{o.value&&(c=new gn({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),i.watch(()=>n.value,()=>{E()},{deep:!0,immediate:!0}),Z(c))}),i.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(D,H)=>(i.openBlock(),i.createElementBlock("div",iy,[i.createVNode(bd,{"select-template-index":t.selectTemplateIndex,settings:t.settings,"onTemplate:select":H[0]||(H[0]=L=>r("template:select",L)),onInitDrawTemplate:N,onRemoveCustomTemplate:te},null,8,["select-template-index","settings"]),i.createElementVNode("div",ry,[i.createElementVNode("div",oy,null,512)])]))}});class Ui extends K.Identity{constructor(n,r){super();B(this,"label","");B(this,"points",[]);B(this,"isCustom",!1);B(this,"id",-1);B(this,"guid","");n?(this.label=n.label,this.points=n.points.map((o,s)=>V.isArray(o)?new bn(o[0],o[1],`A-${s+1}`):new bn(o.width,o.angle,`A-${s+1}`)),this.isCustom=n.isCustom):(this.label="-- Новая конфигурация --",this.points=[new bn(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class zs extends Ui{constructor(n){super(n);B(this,"isDefault");this.isDefault=n.isDefault??!1}}class wd{constructor(e){B(this,"minLineWidth");B(this,"maxLineWidth");B(this,"lineWidthStep");B(this,"minLineAngle");B(this,"maxLineAngle");B(this,"lineAngleStep");B(this,"stripMinWidth");B(this,"stripMaxWidth");B(this,"stripMinLength");B(this,"stripMaxLength");B(this,"allowShowTable");B(this,"showOnlyTemplates");B(this,"templates");B(this,"customTemplates",[]);B(this,"startTailConfigs");B(this,"endTailConfigs");B(this,"bendCountForExtended");B(this,"extendedProductCatalog");B(this,"allowChangeFirstPoint");B(this,"allowSaveTemplates");B(this,"userTemplatesPrefix");B(this,"lengthStep");B(this,"canSetDopProdaga");var 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 Ui(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((n=e.startTailConfigs)==null?void 0:n.map(o=>new zs(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new zs(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 Ui(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new Ui({label:"-- Новая конфигурация --",points:[new bn(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 Ui(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 ay={class:"flex flex-col gap-3"},ly={class:"grid gap-5 md:grid-cols-5"},cy={},xd=i.defineComponent({...cy,__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 wd(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),m=i.useTemplateRef("kozyrek-configurator-params-form"),g=(k=0)=>{var N;const T=(N=c.value.allTemplates)==null?void 0:N.at(k);T!==void 0&&(h.value=k,l.value.configuratorParams.linesWidths=T.points.map(E=>V.isArray(E)?E[0]:E.width),l.value.configuratorParams.linesAngles=T.points.map(E=>V.isArray(E)?E[1]:E.angle),C()),b(l.value.configuratorParams)},f=async()=>{const k=prompt("Введите название шаблона:");if(!k)return;a.value=!0;const T={label:k,points:l.value.configuratorParams.linesWidths.map((E,P)=>[E,l.value.configuratorParams.linesAngles[P]])},N=E=>{E&&(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(k,T)=>{var P;const N=(P=c.value.allTemplates)==null?void 0:P.at(k);if(!N||!N.isCustom)return;const E=W=>{W&&(c.value.removeCustomTemplate(N.id),g()),T==null||T()};n.eventEmitter.emit("configurator:remove-template",{category:n.cartItem.category,templateId:N.id,callback:E})},y=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(h.value=c.value.allTemplates.length-1)},b=async k=>{var T,N;l.value.product=new K.ClientProduct,(N=(T=m.value)==null?void 0:T.formReference)==null||N.validate(E=>{E||(C(),o.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:k,validationFieldResultData:u.value,callback:P=>{P?l.value.product=P:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(V.noop)},_=async()=>{var k,T;(T=(k=m.value)==null?void 0:k.formReference)==null||T.validate(N=>{N||(s.value=!0,r("submit",l.value,u.value,()=>{s.value=!1,i.nextTick(()=>{var E,P;(P=(E=m.value)==null?void 0:E.formReference)==null||P.restoreValidation()})}))}).catch(V.noop)},C=()=>{const k={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach((T,N)=>{k[`lines_widths[${N+1}]`]={},k[`lines_angles[${N+1}]`]={}}),u.value=k},x=k=>{d.value.linesWidths=k.map(T=>T.width),d.value.linesAngles=k.map(T=>T.angle)},$=k=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,C(),y(),b(l.value.configuratorParams)},R=(k,T)=>{d.value.linesWidths=k,d.value.linesAngles=T},w=k=>{const T=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,N=0;l.value.configuratorParams.linesWidths.splice(k+1,0,T),l.value.configuratorParams.linesAngles.splice(k+1,0,N),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],C(),y(),b(l.value.configuratorParams)},S=k=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(k,1),l.value.configuratorParams.linesAngles.splice(k,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],C(),y(),b(l.value.configuratorParams))};return i.onBeforeMount(()=>{g()}),i.watch(()=>n.cartItem,k=>{l.value=new K.OrderItemBase(k),g()}),(k,T)=>{const N=O.NButton;return i.openBlock(),i.createElementBlock("div",ay,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(N,{key:0,type:"tertiary",class:"self-end",onClick:T[0]||(T[0]=E=>r("click:view-switch"))},{default:i.withCtx(()=>[...T[3]||(T[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",ly,[i.createVNode(_d,{value:l.value,"select-template-index":h.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":$,"onPointer:move":x,"onTemplate:select":g,onRemoveCustomTemplate:p},null,8,["value","select-template-index","settings"]),i.createVNode(ol,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":T[1]||(T[1]=E=>l.value=E),"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]=E=>b(E)),"onUpdate:preview":R,onSubmit:_,"onClick:saveTemplate":f,"onClick:addLine":w,"onClick:removeLine":S},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),dy={class:"flex flex-col items-center justify-between rounded-xl"},uy={class:"img-preview relative flex justify-center"},hy={},fy=i.defineComponent({...hy,__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=V.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",dy,[i.createElementVNode("div",uy,[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})])}}}),Ds=Wn(fy,[["__scopeId","data-v-a67fd61e"]]),my={key:0,class:"flex items-baseline gap-1"},gy={key:0,class:"flex items-baseline gap-1"},py={key:1},yy={class:"text-lg font-semibold"},by={key:2,class:"text-red-500 text-sm mb-2"},_y={class:"flex gap-3"},wy={},kd=i.defineComponent({...wy,__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 w;const r=t,o=n,s=i.computed(()=>Bt.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(V.cloneDeep(r.value)),h=i.computed(()=>r.settings.widthOverlaps[u.value.configuratorParams.mountType]??0),m=i.computed(()=>r.settings.heightOverlaps[u.value.configuratorParams.mountType]??0),g=i.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),f=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+m.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),We.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[ae.required,ae.min(r.settings.minHeight-m.value),ae.max(f.value-m.value),ae.step(1),We.serverValidation(r.validation.height.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]})),C=i.computed(()=>{var P;const S=p.value,k=y.value,{quantity:T}=r.value,N=((P=r.value.product)==null?void 0:P.costRub)||0;if(!S||!k||!T||N===0)return null;const E=S*k/1e6;return(N*T*E).toLocaleString("ru-ru",{minimumFractionDigits:2})}),x=i.computed(()=>{const S=p.value,k=y.value,T=!!(S&&S>=r.settings.minWidth&&S<=r.settings.maxWidths[u.value.configuratorParams.netType]),N=!!(k&&k>=r.settings.minHeight&&k<=r.settings.maxHeights[u.value.configuratorParams.netType]),E=!!(r.value.quantity&&r.value.quantity>0);return T&&N&&E}),$=(S,k)=>{var E,P;const T=u.value.configuratorParams;S&&S in T&&(T[S]=k);const N={...T,width:p.value??0,height:y.value??0};S==="width"&&((E=l.value)==null||E.validate().catch(V.noop)),S==="height"&&((P=c.value)==null||P.validate().catch(V.noop)),i.nextTick(()=>{var I,Z;!((I=l.value)!=null&&I.validationErrored)&&!((Z=c.value)!=null&&Z.validationErrored)&&N.height&&N.width&&o("update:params",N),R("configuratorParams",N)})},R=(S,k)=>{const T=new K.OrderItemBase(r.value);T[S]=k,S==="configuratorParams"&&(T.product=new K.ClientProduct),o("update:value",T)};return i.watch(()=>r.value,S=>{const k=V.cloneDeep(i.toRaw(S)),T=k.configuratorParams.mountType,N=r.settings.widthOverlaps[T]??0,E=r.settings.heightOverlaps[T]??0;k.configuratorParams.width&&k.configuratorParams.width>0&&(k.configuratorParams.width-=N),k.configuratorParams.height&&k.configuratorParams.height>0&&(k.configuratorParams.height-=E),u.value=k},{deep:!0}),i.onMounted(()=>{var S;(S=d.value)==null||S.select()}),e({validate:(w=a.value)==null?void 0:w.validate,formReference:a}),(S,k)=>{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:k[25]||(k[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":[k[0]||(k[0]=N=>u.value.configuratorParams.netType=N),k[1]||(k[1]=N=>$("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":[k[2]||(k[2]=N=>u.value.configuratorParams.color=N),k[3]||(k[3]=N=>$("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":[k[4]||(k[4]=N=>u.value.configuratorParams.mountType=N),k[5]||(k[5]=N=>$("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",my,[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:k[10]||(k[10]=N=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...k[26]||(k[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":[k[6]||(k[6]=N=>u.value.configuratorParams.width=N),k[9]||(k[9]=N=>$("width",N))],parse:i.unref(it),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:k[7]||(k[7]=N=>i.unref(tt)(N)),onInput:k[8]||(k[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-m.value} ${f.value?" до "+(f.value-m.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",gy,[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:k[15]||(k[15]=N=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...k[27]||(k[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":[k[11]||(k[11]=N=>u.value.configuratorParams.height=N),k[14]||(k[14]=N=>$("height",N))],parse:i.unref(it),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:k[12]||(k[12]=N=>i.unref(tt)(N)),onInput:k[13]||(k[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":[k[16]||(k[16]=N=>u.value.quantity=N),k[19]||(k[19]=N=>R("quantity",N??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:k[17]||(k[17]=N=>i.unref(tt)(N,!1)),onInput:k[18]||(k[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:k[20]||(k[20]=N=>i.unref(et)(t.validation,"marker")),"onUpdate:value":k[21]||(k[21]=N=>{u.value.marker=N??null,R("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":k[22]||(k[22]=N=>{u.value.isAdditionalSale=N??!1,R("isAdditionalSale",N??!1)})},{default:i.withCtx(()=>[...k[28]||(k[28]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(cr,{"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",py,[k[29]||(k[29]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",yy,i.toDisplayString(C.value)+" ₽",1)])):i.createCommentVNode("",!0),x.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",by," Пожалуйста, заполните все обязательные поля корректно. ")),i.createElementVNode("div",_y,[i.createVNode(i.unref(O.NButton),{loading:t.isSubmitProcessing,disabled:!x.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:k[23]||(k[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:k[24]||(k[24]=N=>o("click:show-preview-drawer"))},{default:i.withCtx(()=>[...k[30]||(k[30]=[i.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1},8,["model","rules"])}}}),xy="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",ky="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",vy="/img/configurators/mosquitto/measurement-instructions/mount.png",Cy="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",Sy="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",By={class:"flex flex-col gap-6"},Ty={class:"flex gap-4"},Ny={class:"flex flex-col gap-2"},$y={class:"flex gap-4"},Ry={class:"flex flex-col gap-2"},Ey={class:"flex gap-4"},Py={class:"flex flex-col gap-2"},Fy={},vd=i.defineComponent({...Fy,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(t,{emit:e}){const n=Bt.initRefDependingOnDeviceResolution("small","small","medium"),r=Bt.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",By,[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:xy,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:ky,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",Ty,[l[9]||(l[9]=i.createElementVNode("img",{src:vy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Ny,[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",$y,[l[15]||(l[15]=i.createElementVNode("img",{src:Cy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Ry,[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",Ey,[l[21]||(l[21]=i.createElementVNode("img",{src:Sy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Py,[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"])}}}),Vy={class:"grid md:grid-cols-2"},My={},Cd=i.defineComponent({...My,__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(()=>Bt.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),m=i.computed(()=>i.inject("debounce-input-time",300)),g=V.debounce(async p=>{var y,b;l.value.product=new K.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(V.noop)},m.value),f=()=>{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=mo;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(vd,{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",Vy,[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(Ds,{"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(Ds,{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(kd,{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]=_=>f()),"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)}}}),Iy={},Sd=i.defineComponent({...Iy,__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 m;return!((m=c.value)!=null&&m.validationErrored)}),u=m=>{l.value=m,o("update:value",m,r.index,a)},h=()=>{var m;(m=s.value)==null||m.select()};return i.watch(()=>r.value,m=>{l.value=m}),i.onMounted(()=>{r.autoFocus&&i.nextTick(()=>{h()})}),e({isValid:d,formItemReference:c}),(m,g)=>{const f=rl,p=Dr;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(cr,{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(f)]),_: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"])}}}),Ay={class:"my-2 flex w-full flex-col"},Oy={key:1},zy={class:"text-lg font-semibold"},Dy={class:"flex gap-3"},Ly={},Bd=i.defineComponent({...Ly,__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(V.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),We.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]};return V.forEach(l.value,(x,$)=>{var R;C[`configuratorParams.linesWidths.${$}`]=[ae.required,ae.min(r.settings.minLineWidth),ae.step(r.settings.lineWidthStep),We.serverValidation((R=r.validation[`linesWidths.${$}`])==null?void 0:R.feedback)]}),C}),d=i.ref(r.settings.canSetDopProdaga??!1),u=i.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((C,x)=>(C??0)+(x??0),0)),h=i.computed(()=>r.settings.width-u.value),m=i.computed(()=>!r.value.some(({product:C})=>!C||C.isNewRec())),g=i.computed(()=>r.isSubmitProcessing||!m.value||h.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(C=>C.product.isNewRec())),f=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:(V.reduce(r.value,($,R)=>{var S;const w=((S=R.product)==null?void 0:S.costRub)||0;return $+w},0)*r.value[0].quantity*C).toLocaleString("ru-ru",{minimumFractionDigits:2})}),y=(C,x,$)=>{var w,S,k;l.value[x].product.id=-1;const{configuratorParams:R}=l.value[x];R.linesWidths[x]=C,b("configuratorParams",R),(k=(S=(w=a.value)==null?void 0:w.at(x))==null?void 0:S.formItemReference)==null||k.validate().catch(V.noop),i.nextTick(()=>{var T,N;(N=(T=a.value)==null?void 0:T.at(x))!=null&&N.isValid&&o("update:params",R,x,$)})},b=(C,x)=>{l.value.forEach($=>{$[C]=x}),o("update:value",l.value)};return i.watch(()=>r.value,C=>{l.value=V.cloneDeep(C)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(C,x)=>{const $=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:x[15]||(x[15]=i.withKeys(i.withModifiers(R=>o("submit",l.value),["prevent"]),["enter"]))},{default:i.withCtx(()=>{var R;return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(w,S)=>{var k,T;return i.openBlock(),i.createBlock(Sd,{key:S,ref_for:!0,ref:"line-items-reference",value:((k=w.configuratorParams)==null?void 0:k.linesWidths.at(S))??null,"auto-focus":!0,index:S,path:`configuratorParams.linesWidths.${S}`,product:w.product,settings:t.settings,validation:t.validation,"suggestion-option":f.value(((T=w.configuratorParams)==null?void 0:T.linesWidths.at(S))??0),"add-line-button-disabled":h.value<=0||t.value.length>=t.settings.maxLinesCount||t.value.some(N=>N.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"onUpdate:value":y,"onClick:addLine":x[0]||(x[0]=N=>o("click:add-line",N)),"onClick:removeLine":x[1]||(x[1]=N=>o("click:remove-line",N))},null,8,["value","index","path","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled"])}),128)),i.createElementVNode("div",Ay,[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),m.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(()=>[...x[16]||(x[16]=[i.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",null,[x[17]||(x[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:x[2]||(x[2]=w=>o("click:add-line",l.value.length))},{default:i.withCtx(()=>[...x[18]||(x[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":[x[3]||(x[3]=w=>l.value[0].length=w),x[6]||(x[6]=w=>b("length",w))],parse:i.unref(it),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:x[4]||(x[4]=w=>i.unref(tt)(w,!1)),onInput:x[5]||(x[5]=w=>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":[x[7]||(x[7]=w=>l.value[0].quantity=w),x[10]||(x[10]=w=>b("quantity",w))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:x[8]||(x[8]=w=>i.unref(tt)(w,!1)),onInput:x[9]||(x[9]=w=>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:x[11]||(x[11]=w=>i.unref(et)(t.validation,"marker")),"onUpdate:value":x[12]||(x[12]=w=>{l.value[0].marker=w??null,b("marker",w??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock($,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":x[13]||(x[13]=w=>{l.value[0].isAdditionalSale=w??!1,b("isAdditionalSale",w??!1)})},{default:i.withCtx(()=>[...x[19]||(x[19]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),p.value?(i.openBlock(),i.createElementBlock("div",Oy,[x[20]||(x[20]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",zy,i.toDisplayString(p.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",Dy,[i.createVNode(i.unref(O.NButton),{loading:t.isSubmitProcessing,disabled:!m.value||h.value!=0||!((R=l.value[0])!=null&&R.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:x[14]||(x[14]=w=>o("submit",l.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(l.value[0].isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])}}}),Hy={class:"flex grow flex-col"},Wy=["src"],jy={class:"w-full"},qy={},Td=i.defineComponent({...qy,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",Hy,[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,Wy),i.createElementVNode("div",jy,[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)])]))}}),Xy={class:"flex flex-col gap-2"},Yy={class:"w-104 flex grow flex-col px-5"},Uy={},Nd=i.defineComponent({...Uy,__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 f;return(f=s.value[0].configuratorParams)==null?void 0:f.linesWidths.reduce((p,y)=>(p??0)+(y??0),0)}),u=f=>{f===void 0&&(f=s.value.length-1);const p=s.value.at(0);if(!p)return;p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(f+1,0,null),s.value.forEach(b=>{b.configuratorParams.linesWidths=p.configuratorParams.linesWidths});const y=new K.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(f+1,0,y)},h=f=>{const p=s.value.at(0);p&&(p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(f,1),s.value.forEach(y=>{y.configuratorParams.linesWidths=p.configuratorParams.linesWidths}),s.value=s.value.toSpliced(f,1),delete a[`linesWidths.${f}`],delete a[`linesWidths.${f}`])},m=V.debounce(async(f,p,y)=>{const b={linesWidths:f.linesWidths.at(p)};y.value=!0,a.value[`linesWidths.${p}`]={},s.value[p].product=new K.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 K.ClientProduct,a.value[`linesWidths.${p}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},y.value=!1),y.value=!1}})},c.value),g=async()=>{var f,p;(p=(f=o.value)==null?void 0:f.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(V.noop)};return i.watch(()=>n.cartItems,f=>{s.value=f.map(p=>new K.OrderItemBase(p))}),(f,p)=>{const y=O.NButton;return i.openBlock(),i.createElementBlock("div",Xy,[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",Yy,[i.createVNode(Td,{value:s.value,"onUpdate:value":p[1]||(p[1]=b=>s.value=b),settings:t.settings},null,8,["value","settings"]),i.createVNode(Bd,{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(m),onSubmit:g,"onClick:addLine":u,"onClick:removeLine":h},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),Ky={class:"flex flex-col gap-3"},Gy={},$d=i.defineComponent({...Gy,__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(V.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),We.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(1),We.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.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=(f,p)=>{const y=new K.OrderItemBase(r.value);y[f]=p,f==="configuratorParams"&&(y.product=new K.ClientProduct),o("update:value",y)},m=()=>{var f;(f=a.value)==null||f.select()};return i.watch(()=>r.value,f=>{l.value=V.cloneDeep(f)},{deep:!0}),i.onMounted(()=>{r.value.isNewRec()&&i.nextTick(()=>{m()})}),e({validate:(g=s.value)==null?void 0:g.validate,formReference:s}),(f,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(cr,{"is-product-searching":t.isProductSearching,product:t.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),i.createElementVNode("div",Ky,[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"])}}}),Zy={class:"flex flex-col gap-2 w-72"},Qy={},Rd=i.defineComponent({...Qy,__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=V.debounce(async m=>{var g,f;s.value.product=new K.ClientProduct,(f=(g=o.value)==null?void 0:g.formReference)==null||f.validate(p=>{p||(l.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:m,validationFieldResultData:a.value,callback:y=>{y?s.value.product=y:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(V.noop)},d.value),h=async()=>{var m,g;(g=(m=o.value)==null?void 0:m.formReference)==null||g.validate(f=>{f||(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(V.noop)};return i.watch(()=>n.cartItem,m=>{s.value=new K.OrderItemBase(m)},{deep:!0}),(m,g)=>{const f=O.NButton;return i.openBlock(),i.createElementBlock("div",Zy,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(f,{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($d,{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"])])}}}),Jy={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function e0(t,e){return i.openBlock(),i.createElementBlock("svg",Jy,[...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 Ed=i.markRaw({name:"ion-add",render:e0}),t0={key:0,class:"-mt-1 text-sm text-gray-500"},n0={class:"font-bold"},i0={class:"flex flex-col gap-3"},r0={key:0,class:"mt-4 flex flex-col gap-1.5"},o0={class:"flex flex-col gap-1 text-sm text-gray-700"},s0={key:0},a0={key:1},l0={"form-array-name":"items",class:"flex flex-col gap-3"},c0={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},d0={key:0,class:"flex flex-wrap items-end gap-2"},u0={class:"whitespace-nowrap text-xl font-bold"},h0={key:0,class:"whitespace-nowrap text-lg text-gray-500"},f0={class:"font-bold"},m0={class:"font-bold"},g0={class:"flex gap-3"},p0={},Pd=i.defineComponent({...p0,__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(V.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(V.noop).catch(V.noop)})},{deep:!0});const d=i.computed(()=>r.value.category),u=i.ref(null),h=i.ref(null),m=i.computed(()=>d.value.products??[]),g=i.computed(()=>m.value.map(L=>({label:L.name,value:L.id}))),f=(L,A,z)=>{const Y=L!=null&&L>0,U=A!=null&&A>0;return!Y&&!U?null:Y&&U?`от ${L} ${z} до ${A} ${z}`:Y?`от ${L} ${z}`:`до ${A} ${z}`},p=i.computed(()=>{var L,A;return f(r.settings.minWidth,(A=(L=u.value)==null?void 0:L.properties)==null?void 0:A.width,"мм")}),y=i.computed(()=>{var L,A;return f(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:[We.serverValidation((A=l.value.marker)==null?void 0:A.feedback)]};return a.value.configuratorParams.items.forEach((z,Y)=>{var U,M,j,X,ee,ue,ve;L[`configuratorParams.items.${Y}.width`]=[ae.required,ae.min(r.settings.minWidth),...(M=(U=u.value)==null?void 0:U.properties)!=null&&M.width?[ae.max(u.value.properties.width)]:[],ae.step(1),We.serverValidation((j=l.value[`items.${Y}.width`])==null?void 0:j.feedback)],L[`configuratorParams.items.${Y}.length`]=[ae.required,ae.min(r.settings.minLength),...(ee=(X=u.value)==null?void 0:X.properties)!=null&&ee.length?[ae.max(u.value.properties.length)]:[],ae.step(1),We.serverValidation((ue=l.value[`items.${Y}.length`])==null?void 0:ue.feedback)],L[`configuratorParams.items.${Y}.count`]=[ae.required,ae.min(1),ae.step(1),We.serverValidation((ve=l.value[`items.${Y}.count`])==null?void 0:ve.feedback)]}),L}),x=i.ref(r.settings.canSetDopProdaga??!1),$=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})),R=i.computed(()=>!u.value||$.value||a.value.configuratorParams.items.length===0),w=i.ref(null),S=L=>{if(!L){u.value=null,h.value=null,a.value.product=new K.ClientProduct,b.value=null;return}const A=m.value.find(z=>z.id===L);A&&(u.value=A,h.value=L,a.value.product=A,te("product",a.value.product),a.value.configuratorParams.items.forEach(z=>{var Y,U;(Y=A.properties)!=null&&Y.width&&z.width>A.properties.width&&(z.width=A.properties.width),(U=A.properties)!=null&&U.length&&z.length>A.properties.length&&(z.length=A.properties.length)}),T())};let k=!1;const T=()=>{k=!0,b.value=null,w.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},N=async()=>{var L;if(!u.value||a.value.configuratorParams.items.length===0||$.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(()=>{te("quantity",z.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,T()),te("configuratorParams",a.value.configuratorParams),E(),_.value=!1}})}).catch(()=>{T(),_.value=!1})},E=()=>{var A;if(!((A=u.value)!=null&&A.costRub)||!b.value){w.value=null;return}const L=b.value.quantity*u.value.costRub;w.value=Math.round(L*100)/100},P=L=>{var z,Y;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),(Y=u.value.properties)!=null&&Y.length&&A.length>u.value.properties.length&&(A.length=u.value.properties.length)),te("configuratorParams",a.value.configuratorParams),T()},W=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),te("configuratorParams",a.value.configuratorParams),T(),o("add-item",a.value.configuratorParams.items.length)},I=L=>{a.value.configuratorParams.items.splice(L,1),te("configuratorParams",a.value.configuratorParams),T(),o("remove-item",L)},Z=()=>{if(!(R.value||_.value||r.isSubmitProcessing)){if(!b.value){N();return}o("submit",a.value)}},te=(L,A)=>{const z=new K.OrderItemBase(r.value);z[L]=A,o("update:value",z)};i.watch(()=>r.value,L=>{const A=V.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),k?k=!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:[]},E())};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=Dr,Y=Ed;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(Z,["prevent"]),["enter"])},{default:i.withCtx(()=>{var U;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]=M=>h.value=M),S],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((U=u.value)==null?void 0:U.costRub)!=null?(i.openBlock(),i.createElementBlock("div",t0,[i.createElementVNode("span",n0,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",i0,[u.value?(i.openBlock(),i.createElementBlock("div",r0,[A[7]||(A[7]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",o0,[p.value?(i.openBlock(),i.createElementBlock("div",s0,"Ширина "+i.toDisplayString(p.value)+".",1)):i.createCommentVNode("",!0),y.value?(i.openBlock(),i.createElementBlock("div",a0,"Длина "+i.toDisplayString(y.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",l0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value.configuratorParams.items,(M,j)=>(i.openBlock(),i.createElementBlock("div",{key:j,class:"flex grow gap-2"},[i.createElementVNode("div",c0,[i.createVNode(i.unref(O.NFormItem),{path:`configuratorParams.items.${j}.width`,label:"Ширина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:a.value.configuratorParams.items[j].width,"onUpdate:value":[X=>a.value.configuratorParams.items[j].width=X,X=>P(j)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:A[1]||(A[1]=X=>i.unref(tt)(X)),onInput:X=>c(`items.${j}.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.${j}.length`,label:"Длина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:a.value.configuratorParams.items[j].length,"onUpdate:value":[X=>a.value.configuratorParams.items[j].length=X,X=>P(j)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:A[2]||(A[2]=X=>i.unref(tt)(X)),onInput:X=>c(`items.${j}.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.${j}.count`,label:"Количество, шт"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:a.value.configuratorParams.items[j].count,"onUpdate:value":[X=>a.value.configuratorParams.items[j].count=X,X=>P(j)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:A[3]||(A[3]=X=>i.unref(tt)(X,!1)),onInput:X=>c(`items.${j}.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:X=>I(j)},{default:i.withCtx(()=>[i.createVNode(z)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:1,disabled:$.value,type:"default",class:"self-center",onClick:W},{default:i.withCtx(()=>[i.createVNode(Y),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]=M=>c("marker")),"onUpdate:value":A[5]||(A[5]=M=>te("marker",M??null)),onFocus:i.unref(Le)},null,8,["value","disabled","onFocus"])]),_:1}),x.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]=M=>{a.value.isAdditionalSale=M??!1,te("isAdditionalSale",M??!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 M;return[b.value&&u.value&&w.value?(i.openBlock(),i.createElementBlock("div",d0,[i.createElementVNode("div",null,[A[10]||(A[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",u0,i.toDisplayString(w.value.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol),1)]),b.value.quantity&&u.value?(i.openBlock(),i.createElementBlock("div",h0,[i.createElementVNode("span",f0,"("+i.toDisplayString(b.value.quantity)+" шт.",1),A[11]||(A[11]=i.createTextVNode(" x ",-1)),i.createElementVNode("span",m0,i.toDisplayString((M=u.value.costRub)==null?void 0:M.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]}),_:1},8,["show"]),i.createElementVNode("div",g0,[b.value&&!_.value?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,loading:t.isSubmitProcessing,disabled:R.value||_.value,type:"primary",class:"self-start",onClick:Z},{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:R.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"])}}}),y0={class:"flex flex-col gap-2"},b0={class:"w-104 flex grow flex-col px-5"},_0={},Fd=i.defineComponent({..._0,__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,m;(m=(h=o.value)==null?void 0:h.formReference)==null||m.validate(g=>{if(!g){l.value=!0;const f=V.cloneDeep(s.value);"items"in f.configuratorParams&&delete f.configuratorParams.items,r("submit",f,a.value,()=>{l.value=!1,i.nextTick(()=>{var p,y;(y=(p=o.value)==null?void 0:p.formReference)==null||y.restoreValidation()})})}}).catch(V.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,m)=>{a.value[`items.${m}.width`]={},a.value[`items.${m}.length`]={},a.value[`items.${m}.count`]={}})}),i.watch(()=>n.cartItem,h=>{s.value=new K.OrderItemBase(h)},{deep:!0}),(h,m)=>{const g=O.NButton;return i.openBlock(),i.createElementBlock("div",y0,[t.settings.allowShowTable&&s.value.isNewRec()?(i.openBlock(),i.createBlock(g,{key:0,type:"tertiary",class:"self-center",onClick:m[0]||(m[0]=f=>r("click:view-switch"))},{default:i.withCtx(()=>[...m[2]||(m[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",b0,[i.createVNode(Pd,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":m[1]||(m[1]=f=>s.value=f),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"])])])}}}),w0={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function x0(t,e){return i.openBlock(),i.createElementBlock("svg",w0,[...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 k0=i.markRaw({name:"ion-checkmark",render:x0}),v0={key:0,class:"-mt-1 text-sm text-gray-500"},C0={class:"font-bold"},S0={class:"flex flex-col gap-3"},B0={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},T0={class:"flex flex-col gap-1 text-sm text-gray-700"},N0={key:0},$0={key:1},R0={"form-array-name":"items",class:"flex flex-col gap-3"},E0={class:"min-w-0 flex-1"},P0={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},F0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},V0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},M0={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},I0={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},A0={key:0,class:"lg:!flex-[2]"},O0={class:"font-bold"},z0={key:1,class:"lg:!flex-[3]"},D0={class:"font-bold"},L0={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"},H0={key:0},W0={class:"font-bold"},j0={key:1},q0={class:"font-bold"},X0={class:"flex flex-wrap items-center gap-3"},Y0={},Vd=i.defineComponent({...Y0,__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 U;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("widthInputs"),l=r.value==null?[]:V.cloneDeep(i.toRaw(r.value)),c=i.ref(l.map(M=>new K.OrderItemBase(M))),d=i.computed(()=>({items:c.value})),u=i.ref({...r.validation}),h=M=>{var j;delete u.value[M],(j=s.value)==null||j.restoreValidation()},m=i.ref(null),g=i.ref(null),f=i.computed(()=>{var M,j;return((j=(M=c.value[0])==null?void 0:M.category)==null?void 0:j.products)??[]}),p=i.computed(()=>f.value.map(M=>({label:M.name,value:M.id}))),y=(M,j,X)=>{const ee=M!=null&&M>0,ue=j!=null&&j>0;return!ee&&!ue?null:ee&&ue?`от ${M} ${X} до ${j} ${X}`:ee?`от ${M} ${X}`:`до ${j} ${X}`},b=i.computed(()=>{var M,j;return y(r.settings.minWidth,(j=(M=m.value)==null?void 0:M.properties)==null?void 0:j.width,"мм")}),_=i.computed(()=>{var M,j;return y(r.settings.minLength,(j=(M=m.value)==null?void 0:M.properties)==null?void 0:j.length,"мм")}),C=i.computed(()=>{const M={};return c.value.forEach((j,X)=>{var ee,ue,ve,Te,He,ce,mt,Ne;M[`items.${X}.configuratorParams.width`]=[ae.required,ae.min(r.settings.minWidth),...(ue=(ee=m.value)==null?void 0:ee.properties)!=null&&ue.width?[ae.max(m.value.properties.width)]:[],ae.step(1),We.serverValidation((ve=u.value[`items.${X}.width`])==null?void 0:ve.feedback)],M[`items.${X}.configuratorParams.length`]=[ae.required,ae.min(r.settings.minLength),...(He=(Te=m.value)==null?void 0:Te.properties)!=null&&He.length?[ae.max(m.value.properties.length)]:[],ae.step(1),We.serverValidation((ce=u.value[`items.${X}.length`])==null?void 0:ce.feedback)],M[`items.${X}.quantity`]=[ae.required,ae.min(1),ae.step(1),We.serverValidation((mt=u.value[`items.${X}.quantity`])==null?void 0:mt.feedback)],M[`items.${X}.marker`]=[We.serverValidation((Ne=u.value[`items.${X}.marker`])==null?void 0:Ne.feedback)]}),M});i.watch(()=>r.validation,M=>{u.value={...M},Object.values(M).some(X=>X==null?void 0:X.feedback)&&i.nextTick(()=>{var X;return(X=s.value)==null?void 0:X.validate(V.noop).catch(V.noop)})},{deep:!0});const x=i.ref(r.settings.canSetDopProdaga??!1),$=i.computed(()=>{const M=m.value;return M?c.value.some(j=>{var ve,Te;const X=j.configuratorParams,ee=(ve=M.properties)==null?void 0:ve.width,ue=(Te=M.properties)==null?void 0:Te.length;return X.width===0||X.width<r.settings.minWidth||ee!=null&&X.width>ee||X.length===0||X.length<r.settings.minLength||ue!=null&&X.length>ue||j.quantity===0||j.quantity<1}):!0}),R=i.computed(()=>!m.value||$.value||c.value.length===0),w=i.computed(()=>{const M=c.value[0];return M!=null&&!M.isNewRec()}),S=M=>r.itemStates[M]??"idle",k=M=>S(M)==="success",T=M=>S(M)==="loading",N=i.computed(()=>c.value.length===0?!0:c.value.every((M,j)=>{const X=S(j);return X==="success"||X==="loading"})),E=M=>M.width===0||M.length===0?0:M.width*M.length/1e6,P=M=>{var ve;const j=M.configuratorParams,X=E(j),ee=((ve=m.value)==null?void 0:ve.costRub)??0,ue=M.quantity??0;return!X||!ue?0:Math.round(X*ee*ue*100)/100},W=i.computed(()=>V.sum(c.value.map(M=>{const j=M.configuratorParams;return!j.width||j.length===0||!M.quantity?0:j.width*j.length*M.quantity/1e6}))),I=i.computed(()=>Math.round(V.sum(c.value.map(M=>P(M)))*100)/100),Z=()=>{var M,j,X;return new K.OrderItemBase({category:(M=c.value[0])==null?void 0:M.category,configurator:(j=c.value[0])==null?void 0:j.configurator,product:m.value??new K.ClientProduct,quantity:1,isAdditionalSale:(X=c.value[0])==null?void 0:X.isAdditionalSale,configuratorParams:{width:0,length:0}})},te=M=>{if(!M){m.value=null,g.value=null,c.value.forEach(X=>{X.product=new K.ClientProduct}),o("update:value",c.value);return}const j=f.value.find(X=>X.id===M);j&&(m.value=j,g.value=M,c.value.forEach((X,ee)=>{var ue,ve;X.product=j,(ue=j.properties)!=null&&ue.width&&X.configuratorParams.width>j.properties.width&&(X.configuratorParams.width=j.properties.width),(ve=j.properties)!=null&&ve.length&&X.configuratorParams.length>j.properties.length&&(X.configuratorParams.length=j.properties.length),o("item-reset",ee)}),o("update:value",c.value))},D=M=>{var ee,ue;const j=c.value[M],X=m.value;X&&((ee=X.properties)!=null&&ee.width&&j.configuratorParams.width>X.properties.width&&(j.configuratorParams.width=X.properties.width),(ue=X.properties)!=null&&ue.length&&j.configuratorParams.length>X.properties.length&&(j.configuratorParams.length=X.properties.length)),o("item-reset",M),o("update:value",c.value)},H=(M,j)=>{c.value[M].marker=j===null||j===""?void 0:j,o("item-reset",M),o("update:value",c.value)},L=M=>{c.value.forEach(j=>{j.isAdditionalSale=M}),o("update:value",c.value)},A=()=>{c.value.push(Z()),o("update:value",c.value),o("add-item",c.value.length),i.nextTick(()=>{var j,X,ee,ue;const M=c.value.length-1;(X=(j=a.value)==null?void 0:j[M])==null||X.focus(),(ue=(ee=a.value)==null?void 0:ee[M])==null||ue.select()})},z=M=>{c.value.splice(M,1),o("update:value",c.value),o("remove-item",M)};i.watch(()=>r.value,M=>{var ue;const X=(M==null?[]:V.cloneDeep(i.toRaw(M))).map(ve=>new K.OrderItemBase(ve));c.value=X.length>0?X:[Z()];const ee=(ue=c.value[0])==null?void 0:ue.product;ee&&!ee.isNewRec()?(m.value=ee,g.value=ee.id):(m.value=null,g.value=null)},{deep:!0});const Y=()=>{var j;if(m.value!==null)return;const M=(j=f.value[0])==null?void 0:j.id;M!=null&&te(M)};return i.watch(f,()=>{Y()}),i.onMounted(()=>{var j;c.value.length===0&&(c.value=[Z()]);const M=(j=c.value[0])==null?void 0:j.product;M&&!M.isNewRec()&&(m.value=M,g.value=M.id),Y()}),e({validate:(U=s.value)==null?void 0:U.validate,formReference:s}),(M,j)=>{const X=k0,ee=Dr,ue=Ed;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":[j[0]||(j[0]=He=>g.value=He),te],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((ve=m.value)==null?void 0:ve.costRub)!=null?(i.openBlock(),i.createElementBlock("div",v0,[i.createElementVNode("span",C0,i.toDisplayString(m.value.code),1),i.createTextVNode(" — "+i.toDisplayString(m.value.costRub.toLocaleString())+" "+i.toDisplayString(m.value.currency.symbol)+"/м² ",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",S0,[m.value?(i.openBlock(),i.createElementBlock("div",B0,[j[6]||(j[6]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",T0,[b.value?(i.openBlock(),i.createElementBlock("div",N0,"Ширина "+i.toDisplayString(b.value)+".",1)):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createElementBlock("div",$0,"Длина "+i.toDisplayString(_.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",R0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value.items,(He,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",k(ce)?"opacity-70":""])},[i.createElementVNode("div",E0,[i.createElementVNode("div",P0,[i.createElementVNode("div",F0,[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:!m.value||k(ce)||T(ce),placeholder:"Ширина",class:"w-full",onKeydown:j[1]||(j[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:!m.value||k(ce)||T(ce),placeholder:"Длина",class:"w-full",onKeydown:j[2]||(j[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",V0,[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:!m.value||k(ce)||T(ce),placeholder:"Кол-во",class:"w-full",onKeydown:j[3]||(j[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:!m.value||k(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)||k(ce)?(i.openBlock(),i.createElementBlock("div",M0,[T(ce)?(i.openBlock(),i.createBlock(i.unref(O.NSpin),{key:0,size:14})):k(ce)?(i.openBlock(),i.createBlock(X,{key:1,class:"text-green-600 text-xl"})):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),i.createElementVNode("div",I0,[He.configuratorParams.width>0&&He.configuratorParams.length>0?(i.openBlock(),i.createElementBlock("div",A0,[j[7]||(j[7]=i.createTextVNode(" Площадь (S) = ",-1)),i.createElementVNode("span",O0,i.toDisplayString(E(He.configuratorParams).toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),P(He)>0?(i.openBlock(),i.createElementBlock("div",z0,[j[8]||(j[8]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",D0,i.toDisplayString(P(He).toLocaleString())+" "+i.toDisplayString((mt=m.value)==null?void 0:mt.currency.symbol),1)])):i.createCommentVNode("",!0)])]),w.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(ee)]),_:1},8,["disabled","onClick"]))],2)}),128))]),m.value?(i.openBlock(),i.createElementBlock("div",L0,[W.value>0?(i.openBlock(),i.createElementBlock("div",H0,[j[9]||(j[9]=i.createTextVNode(" Общая площадь: ",-1)),i.createElementVNode("span",W0,i.toDisplayString(W.value.toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),I.value>0?(i.openBlock(),i.createElementBlock("div",j0,[j[10]||(j[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",q0,i.toDisplayString(I.value.toLocaleString())+" "+i.toDisplayString(m.value.currency.symbol),1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),x.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":j[4]||(j[4]=He=>L(He??!1))},{default:i.withCtx(()=>[...j[11]||(j[11]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createElementVNode("div",X0,[m.value&&!w.value?(i.openBlock(),i.createBlock(i.unref(O.NButton),{key:0,disabled:$.value,type:"default",onClick:A},{default:i.withCtx(()=>[i.createVNode(ue),j[12]||(j[12]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),i.createVNode(i.unref(O.NButton),{loading:t.isSubmitProcessing,disabled:R.value||N.value,type:"primary",class:"ml-auto",onClick:j[5]||(j[5]=He=>o("submit",c.value))},{default:i.withCtx(()=>{var He;return[i.createTextVNode(i.toDisplayString((He=c.value[0])!=null&&He.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[i.unref(Ua)]])}}}),U0={class:"flex flex-col gap-2"},K0={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},G0={},Md=i.defineComponent({...G0,__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 K.OrderItemBase(C))),a=i.ref([]),l=i.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=C=>{c.forEach(x=>{l.value[`items.${C}.${x}`]={}})},u=C=>{c.forEach(x=>{delete l.value[`items.${C}.${x}`]})},h=i.computed(()=>a.value.includes("loading")),m=()=>({width:{},length:{},quantity:{},marker:{}}),g=(C,x)=>{let $=!1;return c.forEach(R=>{var E,P;const w=`items.0.${R}`,S=(E=C[R])==null?void 0:E.feedback,T=((P=C[w])==null?void 0:P.feedback)??S,N=`items.${x}.${R}`;T?(l.value[N]=C[w]??C[R],$=!0):l.value[N]={}}),$},f=(C,x,$)=>new Promise(R=>{const w=m();let S=!1;const k=T=>{if(S)return;S=!0;const N=g(w,x),E=(T===void 0?!N:T)&&!N;a.value[x]=E?"success":"error",i.nextTick(()=>{var P,W;(W=(P=o.value)==null?void 0:P.formReference)==null||W.restoreValidation()}),R(E)};a.value[x]="loading",r("submit",[V.cloneDeep(C)],w,k,{isFinalSuccessfulCompletion:$})}),p=async()=>{var $,R;try{await((R=($=o.value)==null?void 0:$.formReference)==null?void 0:R.validate())}catch{return}const C=s.value.map((w,S)=>S).filter(w=>{const S=a.value[w]??"idle";return S!=="success"&&S!=="loading"});let x=!0;for(let w=0;w<C.length;w+=1){const S=C[w],k=s.value[S];if(!k)break;const N=w===C.length-1&&x;await f(k,S,N)||(x=!1)}},y=C=>{const x=C-1;a.value[x]="idle",d(x)},b=C=>{a.value.splice(C,1),u(C);for(let x=C;x<s.value.length;x+=1)d(x)},_=C=>{const x=a.value[C];(x==="success"||x==="error")&&(a.value[C]="idle")};return i.onMounted(()=>{(n.cartItems??[]).forEach((C,x)=>{a.value[x]="idle",d(x)})}),i.watch(()=>n.cartItems,C=>{const x=(C??[]).map($=>new K.OrderItemBase($));s.value=x,a.value=x.map(()=>"idle"),x.forEach(($,R)=>{d(R)})},{deep:!0}),(C,x)=>{var R;const $=O.NButton;return i.openBlock(),i.createElementBlock("div",U0,[t.settings.allowShowTable&&((R=s.value[0])!=null&&R.isNewRec())?(i.openBlock(),i.createBlock($,{key:0,type:"tertiary",class:"self-center",onClick:x[0]||(x[0]=w=>r("click:view-switch"))},{default:i.withCtx(()=>[...x[2]||(x[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",K0,[i.createVNode(Vd,{ref:"sandwich-m2-configurator-form",value:s.value,"onUpdate:value":x[1]||(x[1]=w=>s.value=w),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"])])])}}}),Z0={key:0,class:"flex justify-center p-4"},Q0={key:1,class:"p-4 text-center text-red-500"},J0={key:2,class:"flex justify-center"},eb={class:"!bg-white p-4 m-2 rounded-md w-max"},tb={key:3,class:"p-4 text-center text-gray-500"},nb={},Id=i.defineComponent({...nb,__name:"dynamic-configurator",props:{eventEmitter:{},settings:{},editor:{},cartItem:{},category:{}},setup(t){const e=t,n=i.ref(!1),r=i.ref(null),o=i.ref(e.cartItem??null),s=i.ref(null),a=m=>{const g=m.configuratorParams;return[new K.OrderItemBase({...m,quantity:m.quantity??1,marker:m.marker,configuratorParams:{width:(g==null?void 0:g.width)??m.width??0,length:(g==null?void 0:g.length)??m.length??0}})]},l=i.ref(e.editor===K.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var g,f,p;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const m={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 K.OrderItemBase({...m,configuratorParams:{length:y.stripMinLength,linesAngles:[],linesWidths:[],startTailType:V.some(y.startTailConfigs,b=>b.isDefault)?(f=y.startTailConfigs)==null?void 0:f.findIndex(b=>b.isDefault):void 0,endTailType:V.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 K.OrderItemBase({...m,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 K.OrderItemBase({...m,length:y.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const y=e.settings;o.value=new K.OrderItemBase({...m,configuratorParams:{width:y.minWidth,length:y.minLength}});break}case"sandwich":{o.value=new K.OrderItemBase({...m,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new K.OrderItemBase({...m,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(m,g,f)=>{const p=y=>{f==null||f(),y&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:m,callback:p,validation:g})},u=(m,g,f,p)=>{const y=m[0];if(!y){f==null||f();return}const b=(p==null?void 0:p.isFinalSuccessfulCompletion)===!0,_=C=>{f==null||f(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||c()}),(m,g)=>{const f=O.NSpin;return i.openBlock(),i.createElementBlock(i.Fragment,null,[n.value?(i.openBlock(),i.createElementBlock("div",Z0,[i.createVNode(f,{size:"large"})])):r.value?(i.openBlock(),i.createElementBlock("div",Q0,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",J0,[i.createElementVNode("div",eb,[t.editor==="kozyrek"?(i.openBlock(),i.createBlock(xd,{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(Cd,{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(Nd,{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(Rd,{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(Fd,{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(Md,{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",tb,' Конфигуратор "'+i.toDisplayString(t.editor)+'" не поддерживается. ',1))],64)}}});function Ad(t){return Object.values(K.ConfiguratorsEnum).includes(t)}function Od(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==K.ConfiguratorsEnum.Sandwich?!0:t.properties.configuratorSettings!==void 0&&V.isArray(t.products)&&t.products.length>0}const ib={key:0,class:"pt-0.5"},rb={key:0},ob={class:"line-through"},sb={key:0},ab={key:1},lb={class:"flex flex-row gap-1"},cb={key:0},db={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},ub={class:"flex flex-col gap-2.5 sm:flex-row"},hb={class:"mt-2"},fb={key:1,class:"flex flex-col"},mb={},gb=i.defineComponent({...mb,__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(sr,"medium"),r=i.computed(()=>{var U;return(U=e==null?void 0:e.filteredItems)==null?void 0:U[e.categoryItem.id]}),o=i.computed(()=>{var U,M;return V.isArray((U=e.categoryItem)==null?void 0:U.categories)&&((M=e.categoryItem.categories)==null?void 0:M.length)>0}),s=i.computed(()=>{var U;return V.isArray((U=e.categoryItem)==null?void 0:U.products)?e.categoryItem.products:[]}),a=i.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([U,M])=>`${M} руб./${N(U)}`).join(", ")),l=i.computed(()=>V.isUndefined(e.filteredItems)||r.value==="*"?s.value:s.value.filter(U=>{var j;const M=(j=r.value)==null?void 0:j.products;return V.isArray(M)&&M.includes(U.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>V.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),u=i.computed(()=>V.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),h=i.computed(()=>V.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),m=i.computed(()=>V.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),g=i.computed(()=>{var U,M,j;return((U=e.categoryItem.properties)==null?void 0:U.configurator)!==void 0&&Ad((M=e.categoryItem.properties)==null?void 0:M.configurator)&&Od(e.categoryItem)&&((j=e.categoryItem.properties)==null?void 0:j.configuratorSettings)!==void 0&&(V.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),f=i.computed(()=>g.value&&(V.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),p=i.computed(()=>V.isNil(e.categoryContextButtonsConfig)?[]:V.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),y=i.computed(()=>new K.ClientCategory(e.categoryItem)),b=i.ref(!1),_=i.ref(!1),C=i.computed(()=>!V.isUndefined(e.isCategoryItemSelected)),x=i.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),$=i.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),R=i.computed(()=>V.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),w=i.computed(()=>A.value&&Bt.getDeviceTypeByResolution()===Qe.laptop?"auto":"fixed"),S=i.useTemplateRef("collapse-item-reference"),k=i.computed(()=>{var U,M;return(M=(U=e.categoryItem.properties)==null?void 0:U.templateCost)==null?void 0:M.priceCoefficient}),T=i.computed(()=>{var U,M;return(M=(U=e.categoryItem.properties)==null?void 0:U.templateCost)==null?void 0:M.increasePercent}),N=(U,M="ru-RU")=>0 .toLocaleString(M,{style:"currency",currency:U,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),E=U=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:U,target:S.value})},P=(U,M)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:M,isLoadingState:b,target:S.value})},W=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:S.value})},I=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:S.value})},Z=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:S.value})},te=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:S.value})},D=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:S.value})},H=U=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:U,target:S.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?jm(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}):[]),Y=V.debounce(()=>{A.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",Y)}),window.addEventListener("resize",Y),Y(),(U,M)=>{const j=O.NCheckbox,X=vf,ee=O.NTooltip,ue=wf,ve=O.NTag,Te=yf,He=mf,ce=O.NButton,mt=uf,Ne=Za,Ft=Ga,Wt=Ka,an=Ho,Ct=O.NDropdown,Ln=O.NDataTable,ln=O.NAlert,Jt=O.NSpin;return i.openBlock(),i.createBlock(Qa,{ref:"collapse-item-reference",name:t.categoryItem.id,"data-id":t.categoryItem.id,"onHeader:click":P},{"pre-arrow":i.withCtx(()=>{var Ve,J;return[C.value?(i.openBlock(),i.createElementBlock("div",ib,[i.createVNode(j,{checked:x.value,indeterminate:R.value,disabled:$.value,"onUpdate:checked":E},null,8,["checked","indeterminate","disabled"])])):i.createCommentVNode("",!0),!d.value&&((Ve=y.value)!=null&&Ve.isDisabled)?(i.openBlock(),i.createBlock(ee,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(X,{class:"pt-1.5"})]),default:i.withCtx(()=>[M[1]||(M[1]=i.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):i.createCommentVNode("",!0),((J=y.value)==null?void 0:J.isFavorite)??!1?(i.openBlock(),i.createBlock(ee,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ue,{class:"pt-1.5"})]),default:i.withCtx(()=>[M[2]||(M[2]=i.createTextVNode(" Избранная категория ",-1))]),_:1})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var Ve,J,le,De,ni;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(ee,{disabled:!t.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createElementVNode("span",null,i.toDisplayString(t.categoryItem.name),1)]),default:i.withCtx(()=>[M[3]||(M[3]=i.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:M[0]||(M[0]=i.withModifiers((...nt)=>i.unref(V.noop)&&i.unref(V.noop)(...nt),["prevent","stop"]))},[(J=t.categoryItem.properties)!=null&&J.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",rb,i.toDisplayString(T.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0),i.createVNode(ve,{size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createElementVNode("span",ob,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},[k.value||T.value?(i.openBlock(),i.createBlock(ve,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>{var nt;return[k.value?(i.openBlock(),i.createElementBlock("span",sb,i.toDisplayString((nt=k.value)==null?void 0:nt.name),1)):i.createCommentVNode("",!0),T.value?(i.openBlock(),i.createElementBlock("span",ab,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&&((ni=y.value)!=null&&ni.manager)?(i.openBlock(),i.createBlock(ve,{key:3,size:i.unref(n),closable:!0,round:"",class:"align-bottom",onClose:te},{default:i.withCtx(()=>[i.createVNode(ee,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var nt,jt;return[i.createElementVNode("span",lb,[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",cb,[i.createElementVNode("ul",db,[t.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:t.categoryItem.id,slug:t.categoryItem.slug},(Ve,J)=>(i.openBlock(),i.createElementBlock("li",{key:J}," ("+i.toDisplayString(J)+"): "+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,J)=>(i.openBlock(),i.createElementBlock("li",{key:J}," ("+i.toDisplayString(J)+"): "+i.toDisplayString(Ve),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var Ve;return[i.createElementVNode("div",ub,[d.value?(i.openBlock(),i.createBlock(ee,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),onClick:W},{default:i.withCtx(()=>{var J;return[(J=y.value)!=null&&J.isDisabled?(i.openBlock(),i.createBlock(X,{key:1})):(i.openBlock(),i.createBlock(He,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var J;return[(J=y.value)!=null&&J.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(ee,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),onClick:Z},{default:i.withCtx(()=>[i.createVNode(mt)]),_:1},8,["size"])]),default:i.withCtx(()=>{var J,le,De;return[(J=y.value)!=null&&J.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(ee,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,disabled:h.value==="disabled",size:i.unref(n),onClick:I},{default:i.withCtx(()=>{var J;return[(J=y.value)!=null&&J.isRequired?(i.openBlock(),i.createBlock(Ft,{key:1})):(i.openBlock(),i.createBlock(Ne,{key:0}))]}),_:1},8,["disabled","size"])]),default:i.withCtx(()=>[M[4]||(M[4]=i.createTextVNode(" Категория, которую нужно предлагать клиенту ",-1))]),_:1})):i.createCommentVNode("",!0),m.value?(i.openBlock(),i.createBlock(ee,{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(()=>[M[5]||(M[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(an)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(U.$slots,"default",{},()=>{var Ve,J,le;return[i.createElementVNode("div",hb,[o.value?(i.openBlock(),i.createBlock(Dd,{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&&f.value?(i.openBlock(),i.createBlock(Id,{key:0,"event-emitter":t.eventEmitter,settings:(J=t.categoryItem.properties)==null?void 0:J.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",fb,[g.value?(i.openBlock(),i.createBlock(ce,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:L},{default:i.withCtx(()=>[...M[6]||(M[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":w.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(ln,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createBlock(ln,{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(()=>[...M[7]||(M[7]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),pb=Wn(gb,[["__scopeId","data-v-607a5aad"]]),yb={class:"sc-collapse flex w-full flex-col"},bb={},zd=i.defineComponent({...bb,__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",yb,[i.renderSlot(s.$slots,"default")]))}}),_b={},Dd=i.defineComponent({..._b,__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(sr,"medium"),r=i.computed(()=>V.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(V.isUndefined(a))return;const l=a[s.id];if(l==="*")return;const c={};return c[s.id]=structuredClone(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(zd,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(pb,{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)}}}),wb={},Ld=i.defineComponent({...wb,__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(()=>V.isArray(r.value)),a=new K.Reference,l=i.computed(()=>V.isNil(r.value)?s.value?[]:null:V.isArray(r.value)?r.value.map(g=>g.id):r.value.id),c=i.computed(()=>St.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue,void 0,r.disabledItem)),d=g=>{var f;if(V.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||V.isNil(g)||(f=c.value.find(y=>y.value===g))==null?void 0:f.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,f)=>(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"]))}}),xb={},kb=i.defineComponent({...xb,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{},disabledCoefficient:{type:Function}},emits:["update:value"],setup(t,{emit:e}){var x,$;const n=t,r=e,o=()=>{const R=K.PriceCoefficient.getRetailPriceCoefficient();return V.unset(R,"isNewRec"),R},s=R=>!R||R.id===o().id,a=i.computed(()=>{var R;return((R=n.catalogItem)==null?void 0:R.type)==="product"}),l=i.computed(()=>a.value?n.catalogItem:void 0),c=R=>{var w,S,k,T;return R.id===o().id?(w=l.value)==null?void 0:w.getRetailCost():(T=(k=(S=l.value)==null?void 0:S.priceCoefficients)==null?void 0:k.find(N=>N.coefficient.id===R.id))==null?void 0:T.cost},d=i.computed(()=>{var w;const R=[...((w=K.useReferencesStore().priceCoefficientsReference)==null?void 0:w.map(S=>structuredClone(i.toRaw(S))))??[],o()];return a.value&&R.forEach(S=>{var T;const k=c(S);k?S.name+=` (${k} ${(T=l.value)==null?void 0:T.currency.symbol})`:S.name=""}),R.filter(S=>S.name!=="")}),u=i.ref(n.value.coefficient),h=i.ref((($=(x=n.value)==null?void 0:x.value)==null?void 0:$.toString())??null),m=i.ref(null),g=i.computed(()=>{var R,w;return(w=(R=l.value)==null?void 0:R.priceCoefficients)==null?void 0:w.find(S=>S.coefficient.slug===K.PriceCoefficientEnum.K0)}),f=i.ref(void 0),p=R=>Number.parseFloat((R??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),y=()=>{var w,S;f.value=void 0;let R=p(h.value);if(R=Number.isNaN(R)?void 0:R,a.value)if(u.value||h.value){const k=o(),T=c(u.value??k)??0,N=T+T*((R??0)/100);m.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(N),N>(((w=l.value)==null?void 0:w.getRetailCost())??N)&&(f.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),g.value&&N<(((S=g.value)==null?void 0:S.cost)??0)&&(f.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else m.value=null;r("update:value",{value:Number.isNaN(R)?void 0:R,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})},b=R=>{V.isArray(R)||V.isNull(R)||(u.value=R,h.value=null,!u.value&&h.value&&(u.value=o()),y())},_=()=>{u.value||(u.value=o()),y()},C=R=>{var S,k,T,N,E;const w=p(R);if(a.value){let P=0;if(w<=0)u.value=void 0,h.value=null;else if(g.value&&w<(((S=g.value)==null?void 0:S.cost)??0))u.value=(k=g.value)==null?void 0:k.coefficient,P=(w-g.value.cost)*100/g.value.cost,f.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(w>(((T=l.value)==null?void 0:T.getRetailCost())??w)){u.value=o();const W=((N=l.value)==null?void 0:N.getRetailCost())??0;P=(w-W)*100/W,f.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const W=((E=l.value)==null?void 0:E.priceCoefficients)??[],I=V.sortBy(W,[D=>D.cost]),te=I.filter(D=>D.cost<=w).at(-1)??I.at(0);te&&(u.value=te.coefficient,P=(w-te.cost)*100/te.cost),f.value={validationStatus:void 0,feedback:void 0}}h.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:5}).format(P),r("update:value",{value:Number.isNaN(P)?void 0:P,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})}else r("update:value",{value:Number.isNaN(w)?void 0:w,coefficient:void 0})};return i.onMounted(()=>{var R,w,S,k;n.calculationType===K.CalculationTypeEnum.m2Cost?m.value=((w=(R=n.value)==null?void 0:R.value)==null?void 0:w.toString())??null:!((S=n.value)!=null&&S.coefficient)&&((k=n.value)!=null&&k.value)&&(u.value=o()),y()}),(R,w)=>{var T,N,E;const S=O.NInput,k=O.NInputGroup;return i.openBlock(),i.createBlock(i.unref(O.NFormItem),{"show-label":!i.unref(V.isNil)(t.label),label:t.label,"show-feedback":!i.unref(V.isNil)(((T=f.value)==null?void 0:T.feedback)??t.feedback),feedback:((N=f.value)==null?void 0:N.feedback)??t.feedback,"validation-status":((E=f.value)==null?void 0:E.validationStatus)??t.validationStatus},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([{"sm:grid-cols-3":a.value&&t.calculationType!==i.unref(K.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[t.calculationType!==i.unref(K.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(k,{key:0,class:i.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:i.withCtx(()=>[i.createVNode(Ld,{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,"disabled-item":t.disabledCoefficient,"onUpdate:value":b},null,8,["value","reference-list","clearable","disabled","disabled-item"]),i.createVNode(S,{value:h.value,"onUpdate:value":[w[0]||(w[0]=P=>h.value=P),_],clearable:t.clearable,disabled:t.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},i.createSlots({suffix:i.withCtx(()=>[w[3]||(w[3]=i.createTextVNode("%",-1))]),_:2},[h.value&&!h.value.startsWith("-")?{name:"prefix",fn:i.withCtx(()=>[w[2]||(w[2]=i.createTextVNode(" + ",-1))]),key:"0"}:void 0]),1032,["value","clearable","disabled"])]),_:1},8,["class"])):i.createCommentVNode("",!0),a.value||t.calculationType===i.unref(K.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(S,{key:1,value:m.value,"onUpdate:value":[w[1]||(w[1]=P=>m.value=P),C],clearable:t.clearable,disabled:t.disabled,placeholder:"Стоимость",class:"w-full"},i.createSlots({_:2},[a.value?{name:"suffix",fn:i.withCtx(()=>{var P;return[i.createTextVNode(i.toDisplayString((P=l.value)==null?void 0:P.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"])}}}),vb={key:0,class:"flex flex-row gap-2.5"},Cb={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},Sb={},Hd=i.defineComponent({...Sb,__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=Bt.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=Bt.initRefDependingOnDeviceResolution(r.sizes.phone.scale,r.sizes.tablet.scale,r.sizes.default.scale),d=i.computed(()=>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 f=!1;o("closing",g,()=>{f=!0}),f||(s.value=!1,o("update:show",s.value))},m=()=>{o("accept",f=>{a.value=f})};return i.watch(()=>r.show,g=>{g?u():h("other")}),i.watch(()=>r.processing,g=>{a.value=g}),e({open:u,close:h,acceptHandler:m}),(g,f)=>{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:f[1]||(f[1]=b=>h("header")),onEsc:f[2]||(f[2]=b=>h("esc")),onMaskClick:f[3]||(f[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",vb,[i.renderSlot(g.$slots,"extra-action")])):i.createCommentVNode("",!0),g.$slots.action||t.acceptButton.show||t.cancelButton.show?(i.openBlock(),i.createElementBlock("div",Cb,[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:m},{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:f[0]||(f[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"])}}}),Bb={class:"text-sm"},Tb={},Nb=i.defineComponent({...Tb,__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 w,S,k;return((w=s.value)==null?void 0:w.unit.isLinear)&&((k=(S=s.value)==null?void 0:S.properties)==null?void 0:k.isLengthConfigurator)}),l=i.ref(void 0),c=i.ref(void 0),d=i.ref(!0),u=i.ref(null),h=n,m=()=>({length:{},quantity:{},marker:{}}),g=i.ref(m()),f=i.ref(!1),p=i.computed(()=>{var N,E,P,W;if(!s.value)return{};const w=K.UnitsHelper.getProductLengthMultiplicity(s.value),S=K.UnitsHelper.getProductMultiplicity(s.value),k=((E=(N=s.value)==null?void 0:N.properties)==null?void 0:E.minLength)||w,T=(W=(P=s.value)==null?void 0:P.properties)==null?void 0:W.maxLength;return{length:[ae.required,ae.min(k??.1),ae.max(T),ae.step(w),We.serverValidation(g.value.length.feedback)],quantity:[ae.required,ae.min(S),ae.step(S),We.serverValidation(g.value.quantity.feedback)],marker:[We.serverValidation(g.value.marker.feedback)]}}),y=i.computed(()=>{var w,S,k;return s.value?((w=s.value.properties)==null?void 0:w.lengthStep)??((S=s.value.properties)!=null&&S.ignoreMinCountCheck?0:((k=s.value.properties)==null?void 0:k.minCount)??0):0}),b=i.computed(()=>{var k,T,N,E,P,W,I,Z,te;if(!s.value)return"";const w=((T=(k=s.value)==null?void 0:k.properties)==null?void 0:T.minLength)??((E=(N=s.value)==null?void 0:N.properties)!=null&&E.ignoreMinCountCheck?0:(W=(P=s.value)==null?void 0:P.properties)==null?void 0:W.minCount),S=(Z=(I=s.value)==null?void 0:I.properties)==null?void 0:Z.maxLength;return w||S?`(${w?`от ${w}`:""}${w&&S?" ":""}${S?`до ${S}`:""} ${(te=s.value)==null?void 0:te.unit.name})`:""}),_=w=>{var E,P;if(!((P=(E=s.value)==null?void 0:E.properties)!=null&&P.isLengthConfigurator)||!u.value||V.isNil(w)||y.value===0)return;const S=w/y.value,k=Math.round(S),T=K.UnitsHelper.getProductMultiplicity(s.value),N=Math.max(k,T);u.value.quantity=N},C=w=>{var N,E,P,W;if(!((E=(N=s.value)==null?void 0:N.properties)!=null&&E.isLengthConfigurator)||!u.value||V.isNil(w)||y.value===0)return;const S=w*y.value,k=((P=s.value.properties)==null?void 0:P.minLength)||K.UnitsHelper.getProductLengthMultiplicity(s.value),T=(W=s.value.properties)==null?void 0:W.maxLength;k!==void 0&&S<k?u.value.length=k:T!==void 0&&S>T?u.value.length=T:u.value.length=S},x=async w=>{var k;const S=V.cloneDeep(u.value);try{await((k=r.value)==null?void 0:k.validate(T=>{if(!T){if(!s.value||!S)return;K.UnitsHelper.productIsMeasurable(s.value)||delete S.length,a.value&&y.value&&(S.length=y.value),f.value=!0,h("submit",S,g.value,()=>{f.value=!1,w(!1),i.nextTick(()=>{var N;(N=r.value)==null||N.validate(V.noop).catch(V.noop)})})}}))}catch{}},$=()=>{s.value=null,l.value=void 0,u.value=null,g.value=m()};return e({show:(w,S)=>{var k,T,N,E,P;if(s.value=w,l.value=S==null?void 0:S.cartItemData,c.value=S==null?void 0:S.orderId,d.value=(S==null?void 0:S.canSetDopProdaga)??!1,u.value=new K.OrderItemBase((S==null?void 0:S.cartItemData)??new K.OrderItemBase({product:w,quantity:K.UnitsHelper.productIsMeasurable(s.value)?1:((k=w==null?void 0:w.properties)==null?void 0:k.minCount)??1,length:((T=w==null?void 0:w.properties)==null?void 0:T.minLength)||((N=w==null?void 0:w.properties)!=null&&N.ignoreMinCountCheck?0:(E=w==null?void 0:w.properties)==null?void 0:E.minCount)||0})),(P=w==null?void 0:w.properties)!=null&&P.isLengthConfigurator&&u.value&&y.value>0){const W=y.value,I=u.value.quantity||1;u.value.length=I*W}},closeDialog:$}),(w,S)=>{var P;const k=O.NFormItem,T=O.NInputGroupLabel,N=O.NInputGroup,E=O.NCheckbox;return i.openBlock(),i.createBlock(Hd,{ref:"base-dialog-reference",show:!i.unref(V.isNil)(s.value)&&!i.unref(V.isNil)(u.value),title:`${l.value?"Изменение":"Добавление"} товара ${(P=s.value)==null?void 0:P.name} в ${c.value?` заказ №${c.value}`:"корзину"}`,"accept-button":{show:!0,text:l.value?"Изменить":"Добавить"},processing:f.value,"modal-width":500,onAccept:x,onClosing:$},{default:i.withCtx(()=>{var W;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((W=o.value)==null?void 0:W.acceptHandler,["prevent"]),["enter"])},{default:i.withCtx(()=>[i.unref(K.UnitsHelper).productIsMeasurable(s.value)?(i.openBlock(),i.createBlock(k,{key:0,path:"length",label:`Метраж, ${b.value+s.value.unit.name}`},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInputNumber),{value:u.value.length,"onUpdate:value":[S[0]||(S[0]=I=>u.value.length=I),_],parse:i.unref(it),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:S[1]||(S[1]=I=>i.unref(Ar)(I,".",!1)),onInput:S[2]||(S[2]=I=>i.unref(et)(g.value,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"])):i.createCommentVNode("",!0),i.createVNode(k,{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":[S[3]||(S[3]=I=>u.value.quantity=I),C],parse:i.unref(it),step:i.unref(K.UnitsHelper).getProductMultiplicity(s.value),"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:S[4]||(S[4]=I=>i.unref(Ar)(I,".",!1)),onInput:S[5]||(S[5]=I=>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(K.UnitsHelper).getProductMultiplicity(s.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Bb,"Количество должно быть кратно "+i.toDisplayString(i.unref(K.UnitsHelper).getProductMultiplicity(s.value)),1)]),key:"0"}:void 0]),1024)]),_:1}),i.unref(K.UnitsHelper).productIsMeasurable(s.value)?(i.openBlock(),i.createBlock(k,{key:1,path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(O.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:S[6]||(S[6]=I=>i.unref(et)(g.value,"marker")),"onUpdate:value":S[7]||(S[7]=I=>u.value.marker=I??null),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1})):i.createCommentVNode("",!0),d.value?(i.openBlock(),i.createBlock(E,{key:2,checked:u.value.isAdditionalSale,"onUpdate:checked":S[8]||(S[8]=I=>u.value.isAdditionalSale=I),"true-value":!0,"false-value":!1},{default:i.withCtx(()=>[...S[9]||(S[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"])}}}),$b={class:"flex flex-row gap-1"},Rb={class:"sc-client-name flex flex-col gap-1 text-base"},Eb=["href"],Pb={key:1,class:"text-sc-grey"},Fb={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Vb={key:0},Mb={key:1,class:"text-sm"},Ib={},pr=i.defineComponent({...Ib,__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?Tn.format(n.client.lastLoginAt,K.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{V.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=Wo,d=O.NButton,u=O.NPopover;return i.openBlock(),i.createElementBlock("div",$b,[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(V.isNil)(t.popoverPosition),placement:t.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",Rb,[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",Pb," [ Деактивирован ] "))],8,Eb),t.showCityAndRegion&&t.client.city?(i.openBlock(),i.createElementBlock("span",Fb," г. "+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",Vb,i.toDisplayString(t.client.alternativeName),1)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("span",Mb," Последний вход: "+i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),Ab={class:"text-base"},Ob={},Wd=i.defineComponent({...Ob,__name:"contragent-with-short-info",props:{contragent:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("span",Ab,i.toDisplayString(t.contragent.name),1))}}),zb={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Db(t,e){return i.openBlock(),i.createElementBlock("svg",zb,[...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 Lb=i.markRaw({name:"tabler-mail",render:Db}),Hb=["href"],Wb={},jb=i.defineComponent({...Wb,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(t){return(e,n)=>{const r=Lb;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,Hb)],2)}}}),qb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Xb(t,e){return i.openBlock(),i.createElementBlock("svg",qb,[...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 jd=i.markRaw({name:"fa6-brands-viber",render:Xb}),Yb={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},Ub=["id"],Kb=["id"],Gb=["fill"],Zb=["fill"];function Qb(t,e){return i.openBlock(),i.createElementBlock("svg",Yb,[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,Ub),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,Kb)]),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,Gb),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,Zb),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 qd=i.markRaw({name:"logos-whatsapp-icon",render:Qb,setup(){const t=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+t(),SVGHW6lecxh:"uicons-"+t()}}}}),Jb={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},e_=["id"],t_=["fill"];function n_(t,e){return i.openBlock(),i.createElementBlock("svg",Jb,[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,e_)]),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,t_),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 Xd=i.markRaw({name:"logos-telegram",render:n_,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),i_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function r_(t,e){return i.openBlock(),i.createElementBlock("svg",i_,[...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 Yd=i.markRaw({name:"ion-call",render:r_}),o_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function s_(t,e){return i.openBlock(),i.createElementBlock("svg",o_,[...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 a_=i.markRaw({name:"tabler-phone-call",render:s_}),l_={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},c_=["href"],d_=["href"],u_=["href"],h_=["href"],f_={},m_=i.defineComponent({...f_,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(t){const e=t,n=i.computed(()=>{try{return e.phone?or.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=i.computed(()=>{var l;return V.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),o=i.computed(()=>{var l;return V.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=i.computed(()=>{var l;return V.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=a_,u=Yd,h=Xd,m=qd,g=jd;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]=f=>a.value=!a.value),onFocusout:c[1]||(c[1]=f=>a.value=!1),onMouseleave:c[2]||(c[2]=f=>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",l_,[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,d_)):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(m)],8,u_)):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,h_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),g_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function p_(t,e){return i.openBlock(),i.createElementBlock("svg",g_,[...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 y_=i.markRaw({name:"mdi-envelope",render:p_}),b_={class:"flex flex-col gap-1"},__={key:0,class:"mb-2 flex flex-col text-base"},w_={key:0,class:"text-sc-dark-grey text-sm"},x_={key:1,class:"whitespace-nowrap text-sm"},k_={key:2,class:"whitespace-nowrap text-sm"},v_={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},C_=["href"],S_=["href"],B_=["href"],T_=["href"],N_=["href"],$_={key:0,class:"flex flex-col text-base"},R_={key:0,class:"text-sc-dark-grey text-sm"},E_={key:1,class:"mt-2 text-sm"},P_={key:0,class:"-mt-1"},F_={},V_=i.defineComponent({...F_,__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(()=>{try{return e.contact.phone?or.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),r=i.computed(()=>{var c;return V.isString(n.value)?!1:((c=n.value)==null?void 0:c.isValid())??!1}),o=i.computed(()=>{var c;return V.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("INTERNATIONAL"))??""}),s=i.computed(()=>{var c;return V.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("E.164"))??""}),a=i.computed(()=>r.value||e.contact.email),l=i.ref(!1);return(c,d)=>{var y,b;const u=Yd,h=Xd,m=qd,g=jd,f=y_,p=O.NPopover;return i.openBlock(),i.createElementBlock("div",b_,[i.createVNode(p,{disabled:t.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var _,C,x,$;return[i.createElementVNode("div",{class:i.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(_=t.contact)!=null&&_.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${t.classes}`),style:i.normalizeStyle(t.styles),onMouseenter:d[0]||(d[0]=R=>l.value=!0),onFocusin:d[1]||(d[1]=R=>l.value=!0),onMouseleave:d[2]||(d[2]=R=>l.value=!1),onFocusout:d[3]||(d[3]=R=>l.value=!1)},[i.createElementVNode("div",null,[t.fullView&&(t.contact.name||(C=t.contact)!=null&&C.position)?(i.openBlock(),i.createElementBlock("div",__,[i.createTextVNode(i.toDisplayString(t.contact.name)+" ",1),(x=t.contact)!=null&&x.position?(i.openBlock(),i.createElementBlock("span",w_,i.toDisplayString(($=t.contact)==null?void 0:$.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),t.contact.phone?(i.openBlock(),i.createElementBlock("div",x_,i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("div",k_,i.toDisplayString(t.contact.email),1)):i.createCommentVNode("",!0),a.value&&l.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:text-3xl 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:text-3xl"},[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:text-3xl"},[i.createVNode(m)],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:text-3xl hover:text-purple-600"},[i.createVNode(g)],8,T_)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${t.contact.email}`,class:"hover:text-3xl"},[i.createVNode(f)],8,N_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var _,C,x,$;return[t.contact.name?(i.openBlock(),i.createElementBlock("div",$_,[i.createTextVNode(i.toDisplayString(t.contact.name)+" ",1),(_=t.contact)!=null&&_.position?(i.openBlock(),i.createElementBlock("span",R_,i.toDisplayString((C=t.contact)==null?void 0:C.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),(x=t.contact)!=null&&x.comment?(i.openBlock(),i.createElementBlock("div",E_,[d[4]||(d[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&&((y=t.contact)!=null&&y.comment)?(i.openBlock(),i.createElementBlock("div",P_,[d[5]||(d[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((b=t.contact)==null?void 0:b.comment),1)])):i.createCommentVNode("",!0)])}}});class M_{constructor(e){B(this,"minHeight");B(this,"maxHeights");B(this,"minWidth");B(this,"maxWidths");B(this,"netType");B(this,"color");B(this,"mountType");B(this,"descriptions");B(this,"crossbarCount");B(this,"heightOverlaps");B(this,"widthOverlaps");B(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=Lo.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=Lo.objectToSnake(e.heightOverlaps),this.widthOverlaps=Lo.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function I_(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==K.ConfiguratorsEnum.SandwichM2?!0:t.properties.configuratorSettings!==void 0&&V.isArray(t.products)&&t.products.length>0}const A_={class:"flex flex-wrap gap-2"},O_={class:"flex flex-col"},z_={class:"flex flex-col"},D_={},L_=i.defineComponent({...D_,__name:"date-range",props:{clearable:{type:Boolean,default:!0},dateRange:{default:void 0},dateFormat:{default:()=>K.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 V.forOwn(K.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?Tn.startOfDay(new Date(a)):void 0,to:l?Tn.endOfDay(new Date(l)):void 0})};return(a,l)=>{var u,h,m,g,f,p;const c=O.NButton,d=O.NDatePicker;return i.openBlock(),i.createElementBlock("div",A_,[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:(m=t.disabled)==null?void 0:m.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",O_,[(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,x;return s((C=y==null?void 0:y.from)==null?void 0:C.getTime(),(x=y==null?void 0:y.to)==null?void 0:x.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"]),i.createVNode(d,{value:((f=(g=t.dateRange)==null?void 0:g.to)==null?void 0:f.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",z_,[(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,x;return s((C=y==null?void 0:y.from)==null?void 0:C.getTime(),(x=y==null?void 0:y.to)==null?void 0:x.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"])])}}}),H_={class:"sc-lbl-date text-nowrap"},W_={},go=i.defineComponent({...W_,__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(()=>Tn.format(e.date,K.useBaseConfigStateStore().config.dateFormats.uiDate)),r=i.computed(()=>Tn.format(e.date,"HH:mm"));return(o,s)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-col":t.isTimeOnSecondLine})},[i.createElementVNode("span",H_,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))}}),j_={class:"flex flex-row gap-2.5"},q_={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},X_={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},Y_={class:"mb-0.5 sm:mb-0 sm:ml-3"},U_={},K_=i.defineComponent({...U_,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(t){return(e,n)=>{const r=mo,o=O.NButton,s=O.NPopover;return i.openBlock(),i.createElementBlock("div",j_,[i.createElementVNode("div",q_,[i.renderSlot(e.$slots,"main")]),i.createElementVNode("div",null,[i.createElementVNode("div",X_,[i.renderSlot(e.$slots,"extra-buttons"),i.createElementVNode("div",Y_,[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)])])])])}}}),G_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Z_(t,e){return i.openBlock(),i.createElementBlock("svg",G_,[...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 Q_=i.markRaw({name:"ion-download-outline",render:Z_}),J_={},e1=i.defineComponent({...J_,__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=Q_;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"])}}}),t1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function n1(t,e){return i.openBlock(),i.createElementBlock("svg",t1,[...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 i1=i.markRaw({name:"ion-checkmark-done-sharp",render:n1}),r1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function o1(t,e){return i.openBlock(),i.createElementBlock("svg",r1,[...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 s1=i.markRaw({name:"ion-options-outline",render:o1}),a1={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},l1={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"},d1={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"},u1={},Ls=i.defineComponent({...u1,__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=s1,h=O.NButton,m=O.NPopover,g=i1,f=mo;return i.openBlock(),i.createElementBlock("div",a1,[i.createElementVNode("div",l1,[i.renderSlot(c.$slots,"default")]),i.createElementVNode("div",null,[i.createElementVNode("div",c1,[i.createElementVNode("div",d1,[t.showEditButton?(i.openBlock(),i.createBlock(m,{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(m,{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(m,{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(f)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[2]||(d[2]=i.createTextVNode(" Отменить изменения ",-1))]),_:1})):i.createCommentVNode("",!0)]),i.renderSlot(c.$slots,"extra-buttons")])])])}}}),h1={},Ud=i.defineComponent({...h1,__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(Ls,{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(Ls,{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"]))]))}}),f1={},m1=i.defineComponent({...f1,__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=V.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"]))}}),g1={},p1=i.defineComponent({...g1,__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=V.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,f)=>(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:f[0]||(f[0]=p=>o("keydown",p)),onInput:f[1]||(f[1]=p=>o("input",p)),onFocus:f[2]||(f[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"]))}}),y1={},b1=i.defineComponent({...y1,__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=V.debounce(c=>r("update:value",c),n.debounceTime??0),a=c=>{let d="";if(V.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(V.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof or.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=or.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof or.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(Jh.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"]))}}),_1=Wn(b1,[["__scopeId","data-v-751dbb0e"]]),w1={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function x1(t,e){return i.openBlock(),i.createElementBlock("svg",w1,[...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 k1=i.markRaw({name:"tabler-external-link",render:x1}),v1={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},C1=["href"],S1={},B1=i.defineComponent({...S1,__name:"external-link",props:{text:{},url:{},description:{}},setup(t){return(e,n)=>{const r=k1,o=O.NTooltip;return i.openBlock(),i.createBlock(o,{disabled:i.unref(V.isUndefined)(t.description),placement:"top-start"},{trigger:i.withCtx(()=>[i.createElementVNode("span",v1,[i.createElementVNode("a",{href:t.url,target:"_blank",class:"no-underline"},i.toDisplayString(t.text),9,C1),i.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.description),1)]),_:1},8,["disabled"])}}}),T1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function N1(t,e){return i.openBlock(),i.createElementBlock("svg",T1,[...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 $1=i.markRaw({name:"ion-remove-circle-outline",render:N1});let po=[];const Kd=new WeakMap;function R1(){po.forEach(t=>t(...Kd.get(t))),po=[]}function Gd(t,...e){Kd.set(t,e),!po.includes(t)&&po.push(t)===1&&requestAnimationFrame(R1)}function yr(t,e){let{target:n}=t;for(;n;){if(n.dataset&&n.dataset[e]!==void 0)return!0;n=n.parentElement}return!1}function br(t){return t.composedPath()[0]||null}function _r(t){return typeof t=="string"?t.endsWith("px")?Number(t.slice(0,t.length-2)):Number(t):t}function wr(t){if(t!=null)return typeof t=="number"?`${t}px`:t.endsWith("px")?t:`${t}px`}function nn(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 Zd={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 E1(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 P1(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 _n="^\\s*",wn="\\s*$",Gn="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Ht="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",mi="([0-9A-Fa-f])",gi="([0-9A-Fa-f]{2})",Qd=new RegExp(`${_n}hsl\\s*\\(${Ht},${Gn},${Gn}\\)${wn}`),Jd=new RegExp(`${_n}hsv\\s*\\(${Ht},${Gn},${Gn}\\)${wn}`),eu=new RegExp(`${_n}hsla\\s*\\(${Ht},${Gn},${Gn},${Ht}\\)${wn}`),tu=new RegExp(`${_n}hsva\\s*\\(${Ht},${Gn},${Gn},${Ht}\\)${wn}`),F1=new RegExp(`${_n}rgb\\s*\\(${Ht},${Ht},${Ht}\\)${wn}`),V1=new RegExp(`${_n}rgba\\s*\\(${Ht},${Ht},${Ht},${Ht}\\)${wn}`),M1=new RegExp(`${_n}#${mi}${mi}${mi}${wn}`),I1=new RegExp(`${_n}#${gi}${gi}${gi}${wn}`),A1=new RegExp(`${_n}#${mi}${mi}${mi}${mi}${wn}`),O1=new RegExp(`${_n}#${gi}${gi}${gi}${gi}${wn}`);function At(t){return parseInt(t,16)}function z1(t){try{let e;if(e=eu.exec(t))return[bo(e[1]),Zn(e[5]),Zn(e[9]),yi(e[13])];if(e=Qd.exec(t))return[bo(e[1]),Zn(e[5]),Zn(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${t}.`)}catch(e){throw e}}function D1(t){try{let e;if(e=tu.exec(t))return[bo(e[1]),Zn(e[5]),Zn(e[9]),yi(e[13])];if(e=Jd.exec(t))return[bo(e[1]),Zn(e[5]),Zn(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${t}.`)}catch(e){throw e}}function pi(t){try{let e;if(e=I1.exec(t))return[At(e[1]),At(e[2]),At(e[3]),1];if(e=F1.exec(t))return[bt(e[1]),bt(e[5]),bt(e[9]),1];if(e=V1.exec(t))return[bt(e[1]),bt(e[5]),bt(e[9]),yi(e[13])];if(e=M1.exec(t))return[At(e[1]+e[1]),At(e[2]+e[2]),At(e[3]+e[3]),1];if(e=O1.exec(t))return[At(e[1]),At(e[2]),At(e[3]),yi(At(e[4])/255)];if(e=A1.exec(t))return[At(e[1]+e[1]),At(e[2]+e[2]),At(e[3]+e[3]),yi(At(e[4]+e[4])/255)];if(t in Zd)return pi(Zd[t]);if(Qd.test(t)||eu.test(t)){const[n,r,o,s]=z1(t);return[...P1(n,r,o),s]}else if(Jd.test(t)||tu.test(t)){const[n,r,o,s]=D1(t);return[...E1(n,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${t}.`)}catch(e){throw e}}function L1(t){return t>1?1:t<0?0:t}function Hs(t,e,n,r){return`rgba(${bt(t)}, ${bt(e)}, ${bt(n)}, ${L1(r)})`}function Ws(t,e,n,r,o){return bt((t*e*(1-r)+n*r)/o)}function H1(t,e){Array.isArray(t)||(t=pi(t)),Array.isArray(e)||(e=pi(e));const n=t[3],r=e[3],o=yi(n+r-n*r);return Hs(Ws(t[0],n,e[0],r,o),Ws(t[1],n,e[1],r,o),Ws(t[2],n,e[2],r,o),o)}function ze(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:pi(t);return typeof e.alpha=="number"?Hs(n,r,o,e.alpha):Hs(n,r,o,s)}function yo(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:pi(t),{lightness:a=1,alpha:l=1}=e;return W1([n*a,r*a,o*a,s*l])}function yi(t){const e=Math.round(Number(t)*100)/100;return e>1?1:e<0?0:e}function bo(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 Zn(t){const e=Math.round(Number(t));return e>100?100:e<0?0:e}function W1(t){const[e,n,r]=t;return 3 in t?`rgba(${bt(e)}, ${bt(n)}, ${bt(r)}, ${yi(t[3])})`:`rgba(${bt(e)}, ${bt(n)}, ${bt(r)}, 1)`}function j1(t=8){return Math.random().toString(16).slice(2,2+t)}function nu(t){return Array.isArray(t)?t:[t]}const js={STOP:"STOP"};function iu(t,e){const n=e(t);t.children!==void 0&&n!==js.STOP&&t.children.forEach(r=>iu(r,e))}function q1(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 X1(t,e){const{isLeaf:n}=t;return n!==void 0?n:!e(t)}function Y1(t){return t.children}function U1(t){return t.key}function K1(){return!1}function G1(t,e){const{isLeaf:n}=t;return!(n===!1&&!Array.isArray(e(t)))}function Z1(t){return t.disabled===!0}function Q1(t,e){return t.isLeaf===!1&&!Array.isArray(e(t))}function J1(t,e){if(t.isLeaf===!0){const n=e(t);if(Array.isArray(n)&&n.length>0)return!0}return!1}function qs(t){var e;return t==null?[]:Array.isArray(t)?t:(e=t.checkedKeys)!==null&&e!==void 0?e:[]}function Xs(t){var e;return t==null||Array.isArray(t)?[]:(e=t.indeterminateKeys)!==null&&e!==void 0?e:[]}function ew(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)||n.add(r)}),Array.from(n)}function tw(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)&&n.delete(r)}),Array.from(n)}function nw(t){return(t==null?void 0:t.type)==="group"}function iw(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 rw extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function ow(t,e,n,r){return _o(e.concat(t),n,r,!1)}function sw(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 aw(t,e,n,r){const o=_o(e,n,r,!1),s=_o(t,n,r,!0),a=sw(t,n),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function Ys(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:ew(n,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:tw(n,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(n),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let h;o!==void 0?h=aw(o,n,e,d):r!==void 0?h=ow(r,n,e,d):h=_o(n,e,d,!1);const m=c==="parent",g=c==="child"||l,f=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 x of C){if(x.isLeaf)continue;const{key:$,shallowLoaded:R}=x;if(g&&R&&x.children.forEach(T=>{!T.disabled&&!T.isLeaf&&T.shallowLoaded&&f.has(T.key)&&f.delete(T.key)}),x.disabled||!R)continue;let w=!0,S=!1,k=!0;for(const T of x.children){const N=T.key;if(!T.disabled){if(k&&(k=!1),f.has(N))S=!0;else if(p.has(N)){S=!0,w=!1;break}else if(w=!1,S)break}}w&&!k?(m&&x.children.forEach(T=>{!T.disabled&&f.has(T.key)&&f.delete(T.key)}),f.add($)):S&&p.add($),_&&g&&f.has($)&&f.delete($)}}return{checkedKeys:Array.from(f),indeterminateKeys:Array.from(p)}}function _o(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&&iu(d,u=>{if(u.disabled)return js.STOP;const{key:h}=u;if(!a.has(h)&&(a.add(h),l.add(h),Q1(u.rawNode,s))){if(r)return js.STOP;if(!n)throw new rw}})}),l}function lw(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 dw(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 ru(t,e,{loop:n=!1,includeDisabled:r=!1}={}){const o=e==="prev"?uw:dw,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=Us(d,s);u!==null?l=u:c(o(d,n))}else{const u=o(d,!1);if(u!==null)c(u);else{const h=hw(d);h!=null&&h.isGroup?c(o(h,n)):n&&c(o(d,!0))}}}}return c(t),l}function uw(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 hw(t){return t.parent}function Us(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=Us(d,e);if(u!==null)return u}else return d}}return null}const fw={getChild(){return this.ignored?null:Us(this)},getParent(){const{parent:t}=this;return t!=null&&t.isGroup?t.getParent():t},getNext(t={}){return ru(this,"next",t)},getPrev(t={}){return ru(this,"prev",t)}};function mw(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 gw(t,e){const n=t.key;for(;e;){if(e.key===n)return!0;e=e.parent}return!1}var pw={};function ou(t,e,n,r,o,s=null,a=0){const l=[];return t.forEach((c,d)=>{var u;pw.NODE_ENV!=="production"&&J1(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 m=o(c);Array.isArray(m)&&(h.children=ou(m,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 yw(t,e={}){var n;const r=new Map,o=new Map,{getDisabled:s=Z1,getIgnored:a=K1,getIsGroup:l=nw,getKey:c=U1}=e,d=(n=e.getChildren)!==null&&n!==void 0?n:Y1,u=e.ignoreEmptyChildren?x=>{const $=d(x);return Array.isArray($)?$.length?$:null:$}: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 X1(this.rawNode,u)},get shallowLoaded(){return G1(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(x){return gw(this,x)}},fw),m=ou(t,r,o,h,u);function g(x){if(x==null)return null;const $=r.get(x);return $&&!$.isGroup&&!$.ignored?$:null}function f(x){if(x==null)return null;const $=r.get(x);return $&&!$.ignored?$:null}function p(x,$){const R=f(x);return R?R.getPrev($):null}function y(x,$){const R=f(x);return R?R.getNext($):null}function b(x){const $=f(x);return $?$.getParent():null}function _(x){const $=f(x);return $?$.getChild():null}const C={treeNodes:m,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(x){return mw(m,x)},getNode:g,getPrev:p,getNext:y,getParent:b,getChild:_,getFirstAvailableNode(){return cw(m)},getPath(x,$={}){return lw(x,$,C)},getCheckedKeys(x,$={}){const{cascade:R=!0,leafOnly:w=!1,checkStrategy:S="all",allowNotLoaded:k=!1}=$;return Ys({checkedKeys:qs(x),indeterminateKeys:Xs(x),cascade:R,leafOnly:w,checkStrategy:S,allowNotLoaded:k},C)},check(x,$,R={}){const{cascade:w=!0,leafOnly:S=!1,checkStrategy:k="all",allowNotLoaded:T=!1}=R;return Ys({checkedKeys:qs($),indeterminateKeys:Xs($),keysToCheck:x==null?[]:nu(x),cascade:w,leafOnly:S,checkStrategy:k,allowNotLoaded:T},C)},uncheck(x,$,R={}){const{cascade:w=!0,leafOnly:S=!1,checkStrategy:k="all",allowNotLoaded:T=!1}=R;return Ys({checkedKeys:qs($),indeterminateKeys:Xs($),keysToUncheck:x==null?[]:nu(x),cascade:w,leafOnly:S,checkStrategy:k,allowNotLoaded:T},C)},getNonLeafKeys(x={}){return q1(m,x)}};return C}function wo(t){return t.composedPath()[0]}const bw={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function _w(t,e,n){if(t==="mousemoveoutside"){const r=o=>{e.contains(wo(o))||n(o)};return{mousemove:r,touchstart:r}}else if(t==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(wo(a))},s=a=>{r&&(e.contains(wo(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 su(t,e,n){const r=bw[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=_w(t,e,n)),s}function ww(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=su(t,e,n);return Object.keys(o).forEach(s=>{Et(s,document,o[s],r)}),!0}return!1}function xw(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=su(t,e,n);return Object.keys(o).forEach(s=>{at(s,document,o[s],r)}),!0}return!1}function kw(){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(w,S,k){const T=w[S];return w[S]=function(){return k.apply(w,arguments),T.apply(w,arguments)},w}function s(w,S){w[S]=Event.prototype[S]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var w;return(w=a.get(this))!==null&&w!==void 0?w:null}function d(w,S){l!==void 0&&Object.defineProperty(w,"currentTarget",{configurable:!0,enumerable:!0,get:S??l.get})}const u={bubble:{},capture:{}},h={};function m(){const w=function(S){const{type:k,eventPhase:T,bubbles:N}=S,E=wo(S);if(T===2)return;const P=T===1?"capture":"bubble";let W=E;const I=[];for(;W===null&&(W=window),I.push(W),W!==window;)W=W.parentNode||null;const Z=u.capture[k],te=u.bubble[k];if(o(S,"stopPropagation",n),o(S,"stopImmediatePropagation",r),d(S,c),P==="capture"){if(Z===void 0)return;for(let D=I.length-1;D>=0&&!t.has(S);--D){const H=I[D],L=Z.get(H);if(L!==void 0){a.set(S,H);for(const A of L){if(e.has(S))break;A(S)}}if(D===0&&!N&&te!==void 0){const A=te.get(H);if(A!==void 0)for(const z of A){if(e.has(S))break;z(S)}}}}else if(P==="bubble"){if(te===void 0)return;for(let D=0;D<I.length&&!t.has(S);++D){const H=I[D],L=te.get(H);if(L!==void 0){a.set(S,H);for(const A of L){if(e.has(S))break;A(S)}}}}s(S,"stopPropagation"),s(S,"stopImmediatePropagation"),d(S)};return w.displayName="evtdUnifiedHandler",w}function g(){const w=function(S){const{type:k,eventPhase:T}=S;if(T!==2)return;const N=h[k];N!==void 0&&N.forEach(E=>E(S))};return w.displayName="evtdUnifiedWindowEventHandler",w}const f=m(),p=g();function y(w,S){const k=u[w];return k[S]===void 0&&(k[S]=new Map,window.addEventListener(S,f,w==="capture")),k[S]}function b(w){return h[w]===void 0&&(h[w]=new Set,window.addEventListener(w,p)),h[w]}function _(w,S){let k=w.get(S);return k===void 0&&w.set(S,k=new Set),k}function C(w,S,k,T){const N=u[S][k];if(N!==void 0){const E=N.get(w);if(E!==void 0&&E.has(T))return!0}return!1}function x(w,S){const k=h[w];return!!(k!==void 0&&k.has(S))}function $(w,S,k,T){let N;if(typeof T=="object"&&T.once===!0?N=Z=>{R(w,S,N,T),k(Z)}:N=k,ww(w,S,N,T))return;const P=T===!0||typeof T=="object"&&T.capture===!0?"capture":"bubble",W=y(P,w),I=_(W,S);if(I.has(N)||I.add(N),S===window){const Z=b(w);Z.has(N)||Z.add(N)}}function R(w,S,k,T){if(xw(w,S,k,T))return;const E=T===!0||typeof T=="object"&&T.capture===!0,P=E?"capture":"bubble",W=y(P,w),I=_(W,S);if(S===window&&!C(S,E?"bubble":"capture",w,k)&&x(w,k)){const te=h[w];te.delete(k),te.size===0&&(window.removeEventListener(w,p),h[w]=void 0)}I.has(k)&&I.delete(k),I.size===0&&W.delete(S),W.size===0&&(window.removeEventListener(w,f,P==="capture"),u[P][w]=void 0)}return{on:$,off:R}}const{on:Et,off:at}=kw(),Ki="@@mmoContext",vw={mounted(t,{value:e}){t[Ki]={handler:void 0},typeof e=="function"&&(t[Ki].handler=e,Et("mousemoveoutside",t,e))},updated(t,{value:e}){const n=t[Ki];typeof e=="function"?n.handler?n.handler!==e&&(at("mousemoveoutside",t,n.handler),n.handler=e,Et("mousemoveoutside",t,e)):(t[Ki].handler=e,Et("mousemoveoutside",t,e)):n.handler&&(at("mousemoveoutside",t,n.handler),n.handler=void 0)},unmounted(t){const{handler:e}=t[Ki];e&&at("mousemoveoutside",t,e),t[Ki].handler=void 0}},Gi="@@coContext",xo={mounted(t,{value:e,modifiers:n}){t[Gi]={handler:void 0},typeof e=="function"&&(t[Gi].handler=e,Et("clickoutside",t,e,{capture:n.capture}))},updated(t,{value:e,modifiers:n}){const r=t[Gi];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[Gi].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[Gi];n&&at("clickoutside",t,n,{capture:e.capture}),t[Gi].handler=void 0}};function Cw(t,e){console.error(`[vdirs/${t}]: ${e}`)}class Sw{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&&Cw("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 Ks=new Sw,Zi="@@ziContext",au={mounted(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n;t[Zi]={enabled:!!o,initialized:!1},o&&(Ks.ensureZIndex(t,r),t[Zi].initialized=!0)},updated(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n,s=t[Zi].enabled;o&&!s&&(Ks.ensureZIndex(t,r),t[Zi].initialized=!0),t[Zi].enabled=!!o},unmounted(t,e){if(!t[Zi].initialized)return;const{value:n={}}=e,{zIndex:r}=n;Ks.unregister(t,r)}};function Bw(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 Tw=typeof window<"u";let Qi,xr;(()=>{var t,e;Qi=Tw?(e=(t=document)===null||t===void 0?void 0:t.fonts)===null||e===void 0?void 0:e.ready:void 0,xr=!1,Qi!==void 0?Qi.then(()=>{xr=!0}):xr=!0})();function Nw(t){if(xr)return;let e=!1;i.onMounted(()=>{xr||Qi==null||Qi.then(()=>{e||t()})}),i.onBeforeUnmount(()=>{e=!0})}function Gs(t,e){return i.watch(t,n=>{n!==void 0&&(e.value=n)}),i.computed(()=>t.value===void 0?e.value:t.value)}function ko(){const t=i.ref(!1);return i.onMounted(()=>{t.value=!0}),i.readonly(t)}function lu(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 $w=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function Rw(){return $w}function Zs(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);return r()}function Qs(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)){Qs(r,e,n);return}if(r.type===i.Fragment){if(r.children===null)return;Array.isArray(r.children)&&Qs(r.children,e,n)}else r.type!==i.Comment&&n.push(r)}}),n}function cu(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);const o=Qs(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${t}]: slot[${n}] should have exactly one child.`)}let Qn=null;function du(){if(Qn===null&&(Qn=document.getElementById("v-binder-view-measurer"),Qn===null)){Qn=document.createElement("div"),Qn.id="v-binder-view-measurer";const{style:t}=Qn;t.position="fixed",t.left="0",t.right="0",t.top="0",t.bottom="0",t.pointerEvents="none",t.visibility="hidden",document.body.appendChild(Qn)}return Qn.getBoundingClientRect()}function Ew(t,e){const n=du();return{top:e,left:t,height:0,width:0,right:n.width-t,bottom:n.height-e}}function Js(t){const e=t.getBoundingClientRect(),n=du();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 Pw(t){return t.nodeType===9?null:t.parentNode}function uu(t){if(t===null)return null;const e=Pw(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 uu(e)}const hu=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=uu(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=()=>{Gd(m)},m=()=>{c.forEach(b=>b())},g=new Set,f=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:f,removeResizeListener:p}},render(){return Zs("binder",this.$slots)}}),fu=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(cu("follower",this.$slots),[[e]]):cu("follower",this.$slots)}}),Fw="@css-render/vue3-ssr";function Vw(t,e){return`<style cssr-id="${t}">
104
104
  ${e}
105
105
  </style>`}function Mw(t,e,n){const{styles:r,ids:o}=n;o.has(t)||r!==null&&(o.add(t),r.push(Vw(t,e)))}const Iw=typeof document<"u";function bi(){if(Iw)return;const t=i.inject(Fw,null);if(t!==null)return{adapter:(e,n)=>Mw(e,n,t),context:t}}function mu(t,e){console.error(`[vueuc/${t}]: ${e}`)}function Aw(t){let e=0;for(let n=0;n<t.length;++n)t[n]==="&"&&++e;return e}const gu=/\s*,(?![^(]*\))\s*/g,Ow=/\s+/g;function zw(t,e){const n=[];return e.split(gu).forEach(r=>{let o=Aw(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 Dw(t,e){const n=[];return e.split(gu).forEach(r=>{t.forEach(o=>{n.push((o&&o+" ")+r)})}),n}function Lw(t){let e=[""];return t.forEach(n=>{n=n&&n.trim(),n&&(n.includes("&")?e=zw(e,n):e=Dw(e,n))}),e.join(", ").replace(Ow," ")}function pu(t){if(!t)return;const e=t.parentElement;e&&e.removeChild(t)}function vo(t,e){return(e??document.head).querySelector(`style[cssr-id="${t}"]`)}function Hw(t){const e=document.createElement("style");return e.setAttribute("cssr-id",t),e}function Co(t){return t?/^\s*@(s|m)/.test(t):!1}const Ww=/[A-Z]/g;function yu(t){return t.replace(Ww,e=>"-"+e.toLowerCase())}function jw(t,e=" "){return typeof t=="object"&&t!==null?` {
106
106
  `+Object.entries(t).map(n=>e+` ${yu(n[0])}: ${n[1]};`).join(`