@snabcentr/vue-ui-lib 3.66.1 → 3.66.2

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
- `}},ro=Li.Multiply,_p=[1,0,0,0,1,0,0,0,1],Kn=new hn(9),wp=_t.Utils,$c=new re,Cs=new hn([0,0,1,0,0,1,0,1,1,0,1,1]),xe={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Ye.document?Ye.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 hn(9)),this._matrix.toTransformArray(!0,Kn),ro(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=_t.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=_t.Utils.getRendererType(a._renderer.type);xe[l].render.call(a,t,e)}return this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(t,e){let n,r,o,s,a,l,c,d,u,h,f,g,m,p;const b=e._renderer.vertices,y=this.canvas,_=this.ctx,C=t.renderer.ratio,x=$c.copy(e._renderer.scale).multiply(C),N=e._stroke,$=e._linewidth,w=e._fill,v=e._renderer.opacity||e._opacity,k=e._cap,B=e._join,R=e._miter,E=e._closed,P=e.dashes,W=b.length,I=W-1;y.width=Math.max(Math.ceil(e._renderer.rect.width*x.x),1),y.height=Math.max(Math.ceil(e._renderer.rect.height*x.y),1);const Z=e._renderer.rect.centroid,te=Z.x,D=Z.y;if(_.clearRect(0,0,y.width,y.height),w)if(typeof w=="string")_.fillStyle=w;else{const Y=_t.Utils.getRendererType(w._renderer.type);xe[Y].render.call(w,_,e),_.fillStyle=w._renderer.effect}if(N){if(typeof N=="string")_.strokeStyle=N;else{const Y=_t.Utils.getRendererType(N._renderer.type);xe[Y].render.call(N,_,e),_.strokeStyle=N._renderer.effect}$&&(_.lineWidth=fn(e)),R&&(_.miterLimit=R),B&&(_.lineJoin=B),!E&&k&&(_.lineCap=k)}typeof v=="number"&&(_.globalAlpha=v),P&&P.length>0&&(_.lineDashOffset=P.offset||0,_.setLineDash(P));let L,H,z,O,U,K,V,q;_.save(),_.scale(x.x,x.y),_.translate(te,D),_.beginPath();for(let Y=0;Y<b.length;Y++){const ee=b[Y];switch(g=ee.x,m=ee.y,ee.command){case oe.close:_.closePath();break;case oe.arc:H=ee.rx,z=ee.ry,O=ee.xAxisRotation,U=ee.largeArcFlag,K=ee.sweepFlag,n=E?Lt(Y-1,W):Math.max(Y-1,0),r=b[n],V=r.x,q=r.y,wp.renderSvgArcCommand(_,V,q,H,z,U,K,O,g,m);break;case oe.curve:n=E?Lt(Y-1,W):Math.max(Y-1,0),r=b[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,m),Y>=I&&E&&(o=L,h=ee.controls&&ee.controls.right||re.zero,f=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=f.x+o.x,a=f.y+o.y):(s=f.x,a=f.y),g=o.x,m=o.y,_.bezierCurveTo(l,c,s,a,g,m));break;case oe.line:_.lineTo(g,m);break;case oe.move:L=ee,_.moveTo(g,m);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(N)||(p=N._renderer&&N._renderer.offset,p&&(_.save(),_.translate(-N._renderer.offset.x,-N._renderer.offset.y),_.scale(N._renderer.scale.x,N._renderer.scale.y),_.lineWidth=$/N._renderer.scale.x),_.stroke(),p&&_.restore()),_.restore()},getBoundingClientRect:function(t,e,n){let r=1/0,o=-1/0,s=1/0,a=-1/0,l,c;t.forEach(function(d){const u=d.x,h=d.y,f=d.controls;let g,m,p,b,y,_;s=Math.min(h,s),r=Math.min(u,r),o=Math.max(u,o),a=Math.max(h,a),d.controls&&(y=f.left,_=f.right,!(!y||!_)&&(g=d._relative?y.x+u:y.x,m=d._relative?y.y+h:y.y,p=d._relative?_.x+u:_.x,b=d._relative?_.y+h:_.y,!(!g||!m||!p||!b)&&(s=Math.min(m,b,s),r=Math.min(g,p,r),o=Math.max(g,p,o),a=Math.max(m,b,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=_t.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 Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ke&&(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 Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(a||l||c){this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Kn),ro(Kn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let h,f;this._scale instanceof re?(h=this._scale.x*r._renderer.scale.x,f=this._scale.y*r._renderer.scale.y):(h=this._scale*r._renderer.scale.x,f=this._scale*r._renderer.scale.y),this._renderer.scale.x=h<0?-h:h,this._renderer.scale.y=f<0?-f:f,c&&(this._renderer.parent=r)}if(this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const h=_t.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,Cs,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const u=this._renderer.rect;return t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform4f(s.rect,u.left,u.top,u.right,u.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(t,e){let n;const r=this.canvas,o=this.ctx,s=t.renderer.ratio,a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,h=e._size*s;let f=h;xe.isHidden.test(a)||(f+=l),r.width=bl(f),r.height=r.width;const g=f/r.width,m=r.width/2,p=r.height/2;if(o.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")o.fillStyle=c;else{const b=_t.Utils.getRendererType(c._renderer.type);xe[b].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const b=_t.Utils.getRendererType(a._renderer.type);xe[b].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=fn(e)/g)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(m,p),o.scale(xe.precision,xe.precision),o.beginPath(),o.arc(0,0,h/g*.5,0,yt),o.restore(),closed&&o.closePath(),xe.isHidden.test(c)||(n=c._renderer&&c._renderer.offset,n&&(o.save(),o.translate(-c._renderer.offset.x,-c._renderer.offset.y),o.scale(c._renderer.scale.x,c._renderer.scale.y)),o.fill(),n&&o.restore()),xe.isHidden.test(a)||(n=a._renderer&&a._renderer.offset,n&&(o.save(),o.translate(-a._renderer.offset.x,-a._renderer.offset.y),o.scale(a._renderer.scale.x,a._renderer.scale.y),o.lineWidth=l/a._renderer.scale.x),o.stroke(),n&&o.restore())},render:function(t,e,n){if(!this._visible||!this._opacity)return this;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const o=n||this.parent,s=e[this._renderer.type],a=this._sizeAttenuation,l=this._stroke,c=this._linewidth,d=o._matrix.manual||o._flagMatrix,u=this._matrix.manual||this._flagMatrix,h=this._renderer.parent!==o,f=this._renderer.vertices,g=this._renderer.collection.length,m=this._flagVertices,p=this._flagFill||this._fill instanceof Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ke&&(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 Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||o._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(d||u||h){this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Kn),ro(Kn,o._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let b,y;this._scale instanceof re?(b=this._scale.x*o._renderer.scale.x,y=this._scale.y*o._renderer.scale.y):(b=this._scale*o._renderer.scale.x,y=this._scale*o._renderer.scale.y),this._renderer.scale.x=b<0?-b:b,this._renderer.scale.y=y<0?-y:y,h&&(this._renderer.parent=o)}if(m){const b=this._renderer.positionBuffer;b&&t.deleteBuffer(b),this._renderer.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this._renderer.positionBuffer),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,f,t.STATIC_DRAW)}return p?(this._renderer.opacity=this._opacity*o._renderer.opacity,xe.updateTexture.call(xe,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture?this:(xe.isHidden.test(l)||(r+=c),r/=xe.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),e.current!==s&&(t.useProgram(s),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture),t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform1f(s.size,r*e.resolution.ratio),t.drawArrays(t.POINTS,0,g),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(t,e){const n=this.canvas,r=this.ctx,o=t.renderer.ratio,s=$c.copy(e._renderer.scale).multiply(o),a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,h=e._decoration,f=e._direction;n.width=Math.max(Math.ceil(e._renderer.rect.width*s.x),1),n.height=Math.max(Math.ceil(e._renderer.rect.height*s.y),1);const g=e._renderer.rect.centroid,m=g.x,p=g.y;let b,y,_,C,x,N,$,w,v,k,B;const R=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,n.width,n.height),R||(r.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=f,c)if(typeof c=="string")r.fillStyle=c;else{const E=_t.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=_t.Utils.getRendererType(a._renderer.type);xe[E].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=fn(e))}if(typeof d=="number"&&(r.globalAlpha=d),u&&u.length>0&&(r.lineDashOffset=u.offset||0,r.setLineDash(u)),r.save(),r.scale(s.x,s.y),r.translate(m,p),xe.isHidden.test(c)||(c._renderer&&c._renderer.offset?(N=c._renderer.scale.x,$=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(N,$),b=e._size/c._renderer.scale.y,y=e._leading/c._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=c._renderer.offset.x/c._renderer.scale.x,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?(N=a._renderer.scale.x,$=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(N,$),b=e._size/a._renderer.scale.y,y=e._leading/a._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=a._renderer.offset.x/a._renderer.scale.x,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":v=E.actualBoundingBoxDescent,B=E.actualBoundingBoxDescent;break;case"strikethrough":v=0,B=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,v),r.lineTo(k,B),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=_t.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 Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ke&&(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 Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(s||a||l){this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Kn),ro(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=_t.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,Cs,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=_t.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 Wr};xe.ctx=xe.canvas.getContext("2d");var Rc=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 ut,this.scene.parent=this,this._renderer={type:"renderer",matrix:new hn(_p),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=Gt.create(e,Gt.path.vertex,Gt.types.vertex),o=Gt.create(e,Gt.path.fragment,Gt.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,Cs,e.STATIC_DRAW),r=Gt.create(e,Gt.points.vertex,Gt.types.vertex),o=Gt.create(e,Gt.points.fragment,Gt.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"?es(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}};S(Rc,"Utils",xe);var xp=ie.extend({Error:It,getRatio:es,read:Xe,xhr:vc},ie,Nt,ml,gl),Ce=class Or{constructor(e){S(this,"_events",new Q),S(this,"type",""),S(this,"renderer",null),S(this,"scene",null),S(this,"width",0),S(this,"height",0),S(this,"frameCount",0),S(this,"timeDelta",0),S(this,"playing",!1);const n=ie.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:Or.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=Or.Types[r])}this.renderer=new Or[this.type](this),this.setPlaying(n.autostart),this.frameCount=0,n.fullscreen?(this.fit=kp.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"}),Ht.bind(this.fit.domElement,"resize",this.fit),this.fit()):n.fitted?(this.fit=vp.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,Cp.bind(this)),this.scene=this.renderer.scene,Or.Instances.push(this),n.autostart&&mr.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,mr.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&&(Ht.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 Jr(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 Gr(e,n,r,o,s);return this.scene.add(a),a}makeCircle(e,n,r,o){const s=new Ur(e,n,r,o);return this.scene.add(s),s}makeEllipse(e,n,r,o,s){const a=new Kr(e,n,r,o,s);return this.scene.add(a),a}makeStar(e,n,r,o,s){const a=new gs(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 ms(e,n,r,o);return this.scene.add(s),s}makeArcSegment(e,n,r,o,s,a,l){const c=new ls(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 fs(r);return this.scene.add(o),o}makePath(e){const n=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let l=0;l<n;l+=2){const c=arguments[l];if(typeof c!="number")break;const d=arguments[l+1];r.push(new Be(c,d))}}const o=arguments[n-1],s=new $e(r,!(typeof o=="boolean"&&o)),a=s.getBoundingClientRect();return typeof a.top=="number"&&typeof a.left=="number"&&typeof a.right=="number"&&typeof a.bottom=="number"&&s.center().translation.set(a.left+a.width/2,a.top+a.height/2),this.scene.add(s),s}makeText(e,n,r,o){const s=new mn(e,n,r,o);return this.add(s),s}makeLinearGradient(e,n,r,o){const s=Array.prototype.slice.call(arguments,4),a=new Ue(e,n,r,o,s);return this.add(a),a}makeRadialGradient(e,n,r){const o=Array.prototype.slice.call(arguments,3),s=new Ke(e,n,r,o);return this.add(s),s}makeSprite(e,n,r,o,s,a,l){const c=new Yr(e,n,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,n,r,o,s,a){const l=new Cc(e,n,r,o,s,a);return this.add(l),l}makeImageSequence(e,n,r,o,s){const a=new _s(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 ut;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 Xe))return null;const s=Xe[o].call(this,e);return r?this.add(n&&s instanceof ut?s.children:s):s.parent&&s.remove(),s}load(e,n){const r=new ut;let o,s,a;const l=(function(c){for(Ht.temp.innerHTML=c,s=0;s<Ht.temp.children.length;s++)o=Ht.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof n=="function"){const d=Ht.temp.children.length<=1?Ht.temp.children[0]:Ht.temp.children;n(r,d)}}).bind(this);return/\.svg$/i.test(e)?(vc(e,l),r):(l(e),r)}};S(Ce,"NextFrameId",$t.NextFrameId),S(Ce,"Types",$t.Types),S(Ce,"Version",$t.Version),S(Ce,"PublishDate",$t.PublishDate),S(Ce,"Identifier",$t.Identifier),S(Ce,"Resolution",$t.Resolution),S(Ce,"AutoCalculateImportedMatrices",$t.AutoCalculateImportedMatrices),S(Ce,"Instances",$t.Instances),S(Ce,"uniqueId",$t.uniqueId),S(Ce,"Anchor",Be),S(Ce,"Collection",qn),S(Ce,"Events",Q),S(Ce,"Group",ut),S(Ce,"Matrix",Li),S(Ce,"Path",$e),S(Ce,"Registry",Wr),S(Ce,"Element",Di),S(Ce,"Shape",Yn),S(Ce,"Text",mn),S(Ce,"Vector",re),S(Ce,"Gradient",at),S(Ce,"Image",Cc),S(Ce,"ImageSequence",_s),S(Ce,"LinearGradient",Ue),S(Ce,"RadialGradient",Ke),S(Ce,"Sprite",Yr),S(Ce,"Stop",Xn),S(Ce,"Texture",Oe),S(Ce,"ArcSegment",ls),S(Ce,"Circle",Ur),S(Ce,"Ellipse",Kr),S(Ce,"Line",Jr),S(Ce,"Points",fs),S(Ce,"Polygon",ms),S(Ce,"Rectangle",Un),S(Ce,"RoundedRectangle",Gr),S(Ce,"Star",gs),S(Ce,"CanvasRenderer",_t),S(Ce,"SVGRenderer",Nc),S(Ce,"WebGLRenderer",Rc),S(Ce,"Commands",oe),S(Ce,"Utils",xp);var pn=Ce;function kp(){const t=document.body.getBoundingClientRect(),e=this.width=t.width,n=this.height=t.height;this.renderer.setSize(e,n,this.ratio)}function vp(){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 Cp(t,e){this.width=t,this.height=e,this.trigger(Q.Types.resize,t,e)}var mr=Ht.getRequestAnimationFrame();function Ec(){for(let t=0;t<pn.Instances.length;t++){const e=pn.Instances[t];e.playing&&e.update()}pn.NextFrameId=mr(Ec)}mr.init=function(){Ec(),mr.init=function(){}};let yn;typeof window<"u"?yn=window:typeof global<"u"?yn=global:typeof self<"u"&&(yn=self);let Pc;const di=Math.PI*2,ht=Math.PI*.5;function Sp(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 Bp(t){Pc=t}function Tp(t,e){e=e&&e.identity()||new Pc;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 Zt(t,e,n){return n*(e-t)+t}function ji(t,e){for(;t<0;)t+=e;return t%e}const Fc=yn.Float32Array||Array,Np=Math.floor;function bn(t){return Np(t*1e6)/1e6}const pe={move:"M",line:"L",curve:"C",close:"Z"};class ne{constructor(){T(this,"_events",{});T(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}}T(ne,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),T(ne,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Vc={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))}}},mt=class mt extends ne{constructor(n=0,r=0){super();T(this,"_x",0);T(this,"_y",0);for(let o in Vc)Object.defineProperty(this,o,Vc[o]);this.x=n,this.y=r}static add(n,r){return new mt(n.x+r.x,n.y+r.y)}static sub(n,r){return new mt(n.x-r.x,n.y-r.y)}static subtract(n,r){return mt.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(mt.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 mt(this.x,this.y)}add(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x+=n,this.y+=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x+=n.x,this.y+=n.y):(this.x+=n,this.y+=r),this)}addSelf(n){return this.add.apply(this,arguments)}sub(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x-=n,this.y-=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x-=n.x,this.y-=n.y):(this.x-=n,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(n){return this.sub.apply(this,arguments)}subtractSelf(n){return this.sub.apply(this,arguments)}multiply(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x*=n,this.y*=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x*=n.x,this.y*=n.y):(this.x*=n,this.y*=r),this)}multiplySelf(n){return this.multiply.apply(this,arguments)}multiplyScalar(n){return this.multiply(n)}divide(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x/=n,this.y/=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x/=n.x,this.y/=n.y):(this.x/=n,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(n){return this.divide.apply(this,arguments)}divideScalar(n){return this.divide(n)}negate(){return this.multiply(-1)}dot(n){return this.x*n.x+this.y*n.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(n){return Math.sqrt(this.distanceToSquared(n))}distanceToSquared(n){const r=this.x-n.x,o=this.y-n.y;return r*r+o*o}setLength(n){return this.normalize().multiplyScalar(n)}equals(n,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(n)<r}lerp(n,r){const o=(n.x-this.x)*r+this.x,s=(n.y-this.y)*r+this.y;return this.set(o,s)}isZero(n){return n=typeof n>"u"?1e-4:n,this.length()<n}toString(){return this.x+", "+this.y}toObject(){return{x:bn(this.x),y:bn(this.y)}}rotate(n){const r=this.x,o=this.y,s=Math.cos(n),a=Math.sin(n);return this.x=r*s-o*a,this.y=r*a+o*s,this}};T(mt,"zero",new mt),T(mt,"left",new mt(-1,0)),T(mt,"right",new mt(1,0)),T(mt,"up",new mt(0,-1)),T(mt,"down",new mt(0,1));let be=mt;class Fe extends be{constructor(n=0,r=0,o=0,s=0,a=0,l=0,c=pe.move){super(n,r);T(this,"controls",{left:new be,right:new be});T(this,"_command",pe.move);T(this,"_relative",!0);T(this,"_rx",0);T(this,"_ry",0);T(this,"_xAxisRotation",0);T(this,"_largeArcFlag",0);T(this,"_sweepFlag",1);for(let u in Mc)Object.defineProperty(this,u,Mc[u]);this.command=c,this.relative=!0;const d=Fe.makeBroadcast(this);this.controls.left.set(o,s).addEventListener(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:bn(this.x),y:bn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:bn(this.rx),ry:bn(this.ry),xAxisRotation:bn(this.xAxisRotation),largeArcFlag:bn(this.largeArcFlag),sweepFlag:bn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const Mc={command:{enumerable:!0,get:function(){return this._command},set:function(t){this._command!==t&&(this._command=t,this._bound&&this.dispatchEvent(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 $p=0;const Ss={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return $p++}},oo={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 so(t,e,n,r,o){const s=1-t;return s*s*s*e+3*s*s*t*n+3*s*t*t*r+t*t*t*o}function Ac(t,e,n,r,o,s,a,l,c){c=c||oo.RecursionLimit;const d=c+1;if(Math.abs(t-a)<.001&&Math.abs(e-l)<.001)return[new Fe(a,l)];const u=[];for(let h=0;h<d;h++){const f=h/d,g=so(f,t,n,o,a),m=so(f,e,r,s,l);u.push(new Fe(g,m))}return u}function Rp(t,e,n,r,o,s,a,l,c){if(t===n&&e===r&&o===a&&s===l){const b=a-t,y=l-e;return Math.sqrt(b*b+y*y)}const d=9*(n-o)+3*(a-t),u=6*(t+o)-12*n,h=3*(n-t),f=9*(r-s)+3*(l-e),g=6*(e+s)-12*r,m=3*(r-e);function p(b){const y=(d*b+u)*b+h,_=(f*b+g)*b+m;return Math.sqrt(y*y+_*_)}return Pp(p,0,1,c||oo.RecursionLimit)}function Ep(t,e,n,r,o,s,a,l){const c=[],d=[[],[]];let u,h,f,g,m,p,b,y;for(let N=0;N<2;++N){if(N===0?(h=6*t-12*n+6*o,u=-3*t+9*n-9*o+3*a,f=3*n-3*t):(h=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,f=3*r-3*e),Math.abs(u)<.001){if(Math.abs(h)<.001)continue;g=-f/h,0<g&&g<1&&c.push(g);continue}b=h*h-4*f*u,y=Math.sqrt(b),!(b<0)&&(m=(-h+y)/(2*u),0<m&&m<1&&c.push(m),p=(-h-y)/(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 Pp(t,e,n,r){let o=oo.abscissas[r-2],s=oo.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 Fp(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];Vp(c,d,u),d.command=o===0?pe.move:pe.curve}}function Vp(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+=ht:l-=ht,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 gr=(Bi=class extends ne{constructor(){super();T(this,"_flagId",!1);T(this,"_flagClassName",!1);T(this,"_renderer",{});T(this,"_id",Ss.Identifier+Ss.uniqueId());T(this,"_className","");T(this,"classList",[]);for(let n in Ic)Object.defineProperty(this,n,Ic[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}},T(Bi,"Properties",["renderer","id","className"]),Bi);const Ic={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 ao extends Error{constructor(n){super();T(this,"name","Two.js");T(this,"message");this.message=n}}class Mp{constructor(){T(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 lo;const Oc={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};yn.document&&(lo=document.createElement("a"));const Ze=class Ze extends gr{constructor(n,r){super();T(this,"_flagSrc",!1);T(this,"_flagImage",!1);T(this,"_flagVideo",!1);T(this,"_flagLoaded",!1);T(this,"_flagRepeat",!1);T(this,"_flagOffset",!1);T(this,"_flagScale",!1);T(this,"_src","");T(this,"_image",null);T(this,"_loaded",!1);T(this,"_repeat","no-repeat");T(this,"_scale",1);T(this,"_offset",null);for(let o in zc)Object.defineProperty(this,o,zc[o]);if(this._renderer.type="texture",this._renderer.flagOffset=Ap.bind(this),this._renderer.flagScale=Ip.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 Ze().copy(n);return"id"in n&&(r.id=n.id),r}static getAbsoluteURL(n){return lo?(lo.href=n,lo.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=Ze.getAbsoluteURL(n);if(Ze.ImageRegistry.contains(r))return Ze.ImageRegistry.get(r);let o;return yn.document?Oc.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=Ze.getTag(o);n._flagImage&&(/canvas/i.test(s)?Ze.Register.canvas(n,r):(n._src=o.getAttribute("two-src")||o.src,Ze.Register[s](n,r))),n._flagSrc&&(o||(o=Ze.getImage(n.src),n.image=o),s=Ze.getTag(o),Ze.Register[s](n,r))}clone(){const n=new Ze(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,Ze.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}};T(Ze,"Properties",["src","loaded","repeat","scale","offset","image"]),T(Ze,"RegularExpressions",Oc),T(Ze,"ImageRegistry",new Mp),T(Ze,"Register",{canvas:function(n,r){n._src="#"+n.id,Ze.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 ao("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=Ze.getAbsoluteURL(n._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",n.src),Ze.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 ao("unable to load "+n.src)};n._src=Ze.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),Ze.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 Ge=Ze;const zc={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=Ge.getTag(t);let n;switch(e){case"canvas":n="#"+t.id;break;default:n=t.src}Ge.ImageRegistry.contains(n)?this._image=Ge.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 Ap(){this._flagOffset=!0}function Ip(){this._flagScale=!0}class ui extends Array{constructor(){super();Xa(this,gt,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 Mt(this,gt)}set _events(n){of(this,gt,n)}get _bound(){return Mt(this,gt)._bound}set _bound(n){Mt(this,gt)._bound=n}addEventListener(){return Mt(this,gt).addEventListener.apply(this,arguments)}on(){return Mt(this,gt).on.apply(this,arguments)}bind(){return Mt(this,gt).bind.apply(this,arguments)}removeEventListener(){return Mt(this,gt).removeEventListener.apply(this,arguments)}off(){return Mt(this,gt).off.apply(this,arguments)}unbind(){return Mt(this,gt).unbind.apply(this,arguments)}dispatchEvent(){return Mt(this,gt).dispatchEvent.apply(this,arguments)}trigger(){return Mt(this,gt).trigger.apply(this,arguments)}listen(){return Mt(this,gt).listen.apply(this,arguments)}ignore(){return Mt(this,gt).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}}gt=new WeakMap;const Dc=Array.prototype.slice;function Op(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=Dc.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=Dc.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=!Op(t)&&Object.keys(t),s=(o||t).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,t[l],l,t)}return t},performance:yn.performance&&yn.performance.now?yn.performance:Date},zt=class zt extends gr{constructor(n,r,o){super();T(this,"_flagOffset",!0);T(this,"_flagOpacity",!0);T(this,"_flagColor",!0);T(this,"_offset",0);T(this,"_opacity",1);T(this,"_color","#fff");for(let s in Lc)Object.defineProperty(this,s,Lc[s]);this._renderer.type="stop",this.offset=typeof n=="number"?n:zt.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:zt.Index<=0?"#fff":"#000",zt.Index=(zt.Index+1)%2}static fromObject(n){const r=new zt().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<zt.Properties.length;r++){const o=zt.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new zt;return Me.each(zt.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(zt.Properties,r=>{n[r]=this[r]},this),n}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};T(zt,"Index",0),T(zt,"Properties",["offset","opacity","color"]);let hi=zt;const Lc={offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},vn=class vn extends gr{constructor(n){super();T(this,"_flagStops",!1);T(this,"_flagSpread",!1);T(this,"_flagUnits",!1);T(this,"_spread","");T(this,"_units","");for(let r in Hc)Object.defineProperty(this,r,Hc[r]);this._renderer.type="gradient",this._renderer.flagStops=zp.bind(this),this._renderer.bindStops=Dp.bind(this),this._renderer.unbindStops=Lp.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 vn(r).copy(n);return"id"in n&&(o.id=n.id),o}clone(n){const r=this.stops.map(s=>s.clone()),o=new vn(r);return Me.each(vn.Properties,s=>{o[s]=this[s]},this),n&&n.add(o),o}copy(n){super.copy.call(this,n);for(let r=0;r<vn.Properties.length;r++){const o=vn.Properties[r];o in n&&(this[o]=n[o])}return this}toObject(){const n={stops:this.stops.map(r=>r.toObject())};return Me.each(vn.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}};T(vn,"Stop",hi),T(vn,"Properties",["spread","stops","units"]);let lt=vn;const Hc={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 zp(){this._flagStops=!0}function Dp(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function Lp(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 lt{constructor(n,r,o,s,a){super(a);T(this,"_flagEndPoints",!1);T(this,"_left",null);T(this,"_right",null);for(let l in Wc)Object.defineProperty(this,l,Wc[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=Hp.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(lt.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}};T(ti,"Stop",hi),T(ti,"Properties",["left","right"]);let Rt=ti;const Wc={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 Hp(){this._flagEndPoints=!0}const Cn=class Cn extends lt{constructor(n,r,o,s,a,l){super(s);T(this,"_flagRadius",!1);T(this,"_flagCenter",!1);T(this,"_flagFocal",!1);T(this,"_radius",0);T(this,"_center",null);T(this,"_focal",null);for(let c in jc)Object.defineProperty(this,c,jc[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Wp.bind(this),this._renderer.flagFocal=jp.bind(this),this.center=new be,this.radius=typeof o=="number"?o:1,this.focal=new be,typeof n=="number"&&(this.center.x=n),typeof r=="number"&&(this.center.y=r),this.focal.copy(this.center),typeof a=="number"&&(this.focal.x=a),typeof l=="number"&&(this.focal.y=l)}static fromObject(n){const r=new Cn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Cn.Properties.length;r++){const o=Cn.Properties[r];o in n&&(/(center|focal)i/.test(o)?this[o]=n[o]instanceof be?n[o]:new be().copy(n[o]):typeof n[o]=="number"&&(this[o]=n[MediaKeySystemAccess]))}return this}clone(n){const r=this.stops.map(function(s){return s.clone()}),o=new Cn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return Me.each(lt.Properties.concat(Cn.Properties),function(s){o[s]=this[s]},this),n&&n.add(o),o}toObject(){const n=super.toObject.call(this);return Me.each(Cn.Properties,function(r){n[r]=this[r]},this),n.center=this.center.toObject(),n.focal=this.focal.toObject(),n}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(ne.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};T(Cn,"Stop",hi),T(Cn,"Properties",["center","radius","focal"]);let Et=Cn;const jc={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 Wp(){this._flagCenter=!0}function jp(){this._flagFocal=!0}function qc(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 co(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 Xc(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,f=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(f||t).x,d=(f||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),f&&t._relative&&(s+=t.x,d+=t.y),Rp(r,l,o,c,s,d,a,u,n)}function Yc(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,f=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(f||t).x,d=(f||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),f&&t._relative&&(s+=t.x,d+=t.y),Ac(r,l,o,c,s,d,a,u,n)}function fi(t){switch(t.renderer.type){case"texture":return Ge.fromObject(t);case"gradient":return lt.fromObject(t);case"linear-gradient":return Rt.fromObject(t);case"radial-gradient":return Et.fromObject(t)}return t}const qp=Math.cos,Xp=Math.sin,Uc=Math.tan,Bs=[],Ft=class Ft extends ne{constructor(n,r,o,s,a,l){super();T(this,"elements",new Fc(9));T(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 v,k,B;const R=r[0]||0,E=r[1]||0,P=r[2]||0;return v=w[0]*R+w[1]*E+w[2]*P,k=w[3]*R+w[4]*E+w[5]*P,B=w[6]*R+w[7]*E+w[8]*P,[v,k,B]}const s=n[0],a=n[1],l=n[2],c=n[3],d=n[4],u=n[5],h=n[6],f=n[7],g=n[8],m=r[0],p=r[1],b=r[2],y=r[3],_=r[4],C=r[5],x=r[6],N=r[7],$=r[8];return o=o||new Fc(9),o[0]=s*m+a*y+l*x,o[1]=s*p+a*_+l*N,o[2]=s*b+a*C+l*$,o[3]=c*m+d*y+u*x,o[4]=c*p+d*_+u*N,o[5]=c*b+d*C+u*$,o[6]=h*m+f*y+g*x,o[7]=h*p+f*_+g*N,o[8]=h*b+f*C+g*$,o}static fromObject(n){return new Ft().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]=Ft.Identity[0],this.elements[1]=Ft.Identity[1],this.elements[2]=Ft.Identity[2],this.elements[3]=Ft.Identity[3],this.elements[4]=Ft.Identity[4],this.elements[5]=Ft.Identity[5],this.elements[6]=Ft.Identity[6],this.elements[7]=Ft.Identity[7],this.elements[8]=Ft.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,f=[n,r,o,s,a,l,c,d,u],g=h[0],m=h[1],p=h[2],b=h[3],y=h[4],_=h[5],C=h[6],x=h[7],N=h[8],$=f[0],w=f[1],v=f[2],k=f[3],B=f[4],R=f[5],E=f[6],P=f[7],W=f[8];return this.elements[0]=g*$+m*k+p*E,this.elements[1]=g*w+m*B+p*P,this.elements[2]=g*v+m*R+p*W,this.elements[3]=b*$+y*k+_*E,this.elements[4]=b*w+y*B+_*P,this.elements[5]=b*v+y*R+_*W,this.elements[6]=C*$+x*k+N*E,this.elements[7]=C*w+x*B+N*P,this.elements[8]=C*v+x*R+N*W,this.trigger(ne.Types.change)}inverse(n){const r=this.elements;n=n||new Ft;const o=r[0],s=r[1],a=r[2],l=r[3],c=r[4],d=r[5],u=r[6],h=r[7],f=r[8],g=f*c-d*h,m=-f*l+d*u,p=h*l-c*u;let b=o*g+s*m+a*p;return b?(b=1/b,n.elements[0]=g*b,n.elements[1]=(-f*s+a*h)*b,n.elements[2]=(d*s-a*c)*b,n.elements[3]=m*b,n.elements[4]=(f*o-a*u)*b,n.elements[5]=(-d*o+a*l)*b,n.elements[6]=p*b,n.elements[7]=(-h*o+s*u)*b,n.elements[8]=(c*o-s*l)*b,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=qp(n),o=Xp(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=Uc(n);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(n){const r=Uc(n);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(n){return Bs.length=0,this.toTransformArray(n,Bs),Bs.map(bn).join(" ")}toTransformArray(n,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],h=o[5];if(n){const f=o[6],g=o[7],m=o[8];if(s){r[0]=a,r[1]=d,r[2]=f,r[3]=l,r[4]=u,r[5]=g,r[6]=c,r[7]=h,r[8]=m;return}return[a,d,f,l,u,g,c,h,m]}if(s){r[0]=a,r[1]=d,r[2]=l,r[3]=u,r[4]=c,r[5]=h;return}return[a,d,l,u,c,h]}toArray(n,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],h=o[5];if(n){const f=o[6],g=o[7],m=o[8];if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=h,r[6]=f,r[7]=g,r[8]=m;return}return[a,l,c,d,u,h,f,g,m]}if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=h;return}return[a,l,c,d,u,h]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Ft().copy(this)}};T(Ft,"Identity",[1,0,0,0,1,0,0,0,1]);let pr=Ft;Bp(pr);const Vr=class Vr extends gr{constructor(){super();T(this,"_flagMatrix",!0);T(this,"_flagScale",!1);T(this,"_matrix",null);T(this,"_worldMatrix",null);T(this,"_position",null);T(this,"_rotation",0);T(this,"_scale",1);T(this,"_skewX",0);T(this,"_skewY",0);for(let n in uo)Object.defineProperty(this,n,uo[n]);this._renderer.flagMatrix=Kc.bind(this),this.isShape=!0,this.matrix=new pr,this.worldMatrix=new pr,this.position=new be,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(n){const r=new Vr().copy(n);return"id"in n&&(r.id=n.id),r}get renderer(){return this._renderer}set renderer(n){this._renderer=n}get translation(){return uo.position.get.apply(this,arguments)}set translation(n){uo.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 Vr;return r.position.copy(this.position),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer={type:"shape"},n.isShape=!0,n.translation=this.translation.toObject(),n.rotation=this.translation.rotation,n.scale=this.scale instanceof 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}};T(Vr,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let Rn=Vr;const uo={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),Kc.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 Tp(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function Kc(){this._flagMatrix=!0}const qi=Math.min,Xi=Math.max,Yp=Math.ceil,Up=Math.floor,Kp=new be,sn=class sn extends Rn{constructor(n,r,o,s){super();T(this,"_flagVertices",!0);T(this,"_flagLength",!0);T(this,"_flagFill",!0);T(this,"_flagStroke",!0);T(this,"_flagLinewidth",!0);T(this,"_flagOpacity",!0);T(this,"_flagVisible",!0);T(this,"_flagCap",!0);T(this,"_flagJoin",!0);T(this,"_flagMiter",!0);T(this,"_flagStrokeAttenuation",!0);T(this,"_flagMask",!1);T(this,"_flagClip",!1);T(this,"_length",0);T(this,"_fill","#fff");T(this,"_stroke","#000");T(this,"_linewidth",1);T(this,"_opacity",1);T(this,"_visible",!0);T(this,"_cap","round");T(this,"_join","round");T(this,"_miter",4);T(this,"_closed",!0);T(this,"_curved",!1);T(this,"_automatic",!0);T(this,"_beginning",0);T(this,"_ending",1);T(this,"_mask",null);T(this,"_clip",!1);T(this,"_dashes",null);T(this,"_strokeAttenuation",!0);for(let a in Gc)Object.defineProperty(this,a,Gc[a]);this._renderer.type="path",this._renderer.flagVertices=Zc.bind(this),this._renderer.bindVertices=Qc.bind(this),this._renderer.unbindVertices=Jc.bind(this),this._renderer.flagFill=ed.bind(this),this._renderer.flagStroke=td.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 sn().copy({...n,fill:r,stroke:o});return"id"in n&&(s.id=n.id),s}copy(n){if(super.copy.call(this,n),n.vertices){this.vertices=[];for(let r=0;r<n.vertices.length;r++){const o=n.vertices[r];o instanceof Fe?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Fe().copy(o))}}for(let r=0;r<sn.Properties.length;r++){const o=sn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new sn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<sn.Properties.length;o++){const s=sn.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="path",n.vertices=this.vertices.map(r=>r.toObject()),Me.each(sn.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const n=this.getBoundingClientRect(!0),r=n.width/2,o=n.height/2,s=n.left+n.width/2,a=n.top+n.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=s,c.y-=a,c.x+=r,c.y+=o}return this.mask&&(this.mask.translation.x-=s,this.mask.translation.x+=r,this.mask.translation.y-=a,this.mask.translation.y+=o),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,o=n.top+n.height/2-this.translation.y;for(let s=0;s<this.vertices.length;s++){const a=this.vertices[s];a.x-=r,a.y-=o}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getBoundingClientRect(n){let r,o,s,a,l,c,d=1/0,u=-1/0,h=1/0,f=-1/0;if(this._update(!0),r=n?this.matrix:this.worldMatrix,o=(this.linewidth||0)/2,s=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:g,scaleY:m}=Sp(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof g=="number"&&typeof m=="number"&&(o=Math.max(g,m)*(this.linewidth||0)/2)}else o*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(s<=0)return{width:0,height:0};for(a=0;a<s;a++){c=this._renderer.vertices[a],l=this._renderer.vertices[(a+s-1)%s];const[g,m]=r.multiply(l.x,l.y),[p,b]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let y=l.controls.right.x,_=l.controls.right.y;l.relative&&(y+=l.x,_+=l.y);let[C,x]=r.multiply(y,_),N=c.controls.left.x,$=c.controls.left.y;c.relative&&(N+=c.x,$+=c.y);let[w,v]=r.multiply(N,$);const k=Ep(g,m,C,x,w,v,p,b);h=qi(k.min.y-o,h),d=qi(k.min.x-o,d),u=Xi(k.max.x+o,u),f=Xi(k.max.y+o,f)}else a<=1&&(h=qi(m-o,h),d=qi(g-o,d),u=Xi(g+o,u),f=Xi(m+o,f)),h=qi(b-o,h),d=qi(p-o,d),u=Xi(p+o,u),f=Xi(b+o,f)}return{top:h,left:d,right:u,bottom:f,width:u-d,height:f-h}}getPointAt(n,r){let o,s,a,l,c,d,u,h,f,g,m,p,b,y,_,C=this.length*Math.min(Math.max(n,0),1);const x=this.vertices.length,N=x-1;let $=null,w=null;for(let D=0,L=this._lengths.length,H=0;D<L;D++){if(H+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),N)),$=this.vertices[o],w=this.vertices[s],C-=H,this._lengths[D]!==0?n=C/this._lengths[D]:n=0;break}H+=this._lengths[D]}if($===null||w===null)return null;if($){if(!w)return $}else return w;_=w.controls&&w.controls.right,y=$.controls&&$.controls.left,c=w.x,g=w.y,d=(_||w).x,m=(_||w).y,u=(y||$).x,p=(y||$).y,h=$.x,b=$.y,_&&w.relative&&(d+=w.x,m+=w.y),y&&$.relative&&(u+=$.x,p+=$.y),l=so(n,c,d,u,h),f=so(n,g,m,p,b);const v=Zt(c,d,n),k=Zt(g,m,n),B=Zt(d,u,n),R=Zt(m,p,n),E=Zt(u,h,n),P=Zt(p,b,n),W=Zt(v,B,n),I=Zt(k,R,n),Z=Zt(B,E,n),te=Zt(R,P,n);return Me.isObject(r)?(r.x=l,r.y=f,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-=f,r.controls.right.x-=l,r.controls.right.y-=f)),r.t=n,r):(a=new Fe(l,f,W-l,I-f,Z-l,te-f,this._curved?pe.curve:pe.line),a.t=n,a)}plot(){if(this.curved)return Fp(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=Yc(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=Yc(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]=Xc(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=co(this,o*this._length),l=co(this,s*this._length),c=Yp(a),d=Up(l);let u,h,f,g,m,p;for(this._renderer.vertices.length=0,p=0;p<n;p++)this._renderer.collection.length<=p&&this._renderer.collection.push(new Fe),p>d&&!h?(m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(s,m),m.command=this._renderer.collection[p].command,this._renderer.vertices.push(m),h=m,f=this._collection[p-1],f&&f.controls&&(m.relative?m.controls.right.clear():m.controls.right.copy(m),f.relative?this._renderer.collection[p-1].controls.right.copy(f.controls.right).lerp(be.zero,1-m.t):this._renderer.collection[p-1].controls.right.copy(f.controls.right).lerp(f,1-m.t))):p>=c&&p<=d&&(m=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(m),p===d&&qc(this,s)?(h=m,!r&&h.controls&&(h.relative?h.controls.right.clear():h.controls.right.copy(h))):p===c&&qc(this,o)&&(u=m,u.command=pe.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(p=c-1,m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(o,m),m.command=pe.move,this._renderer.vertices.unshift(m),g=this._collection[p+1],g&&g.controls&&(m.controls.left.clear(),g.relative?this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(be.zero,m.t):(Kp.copy(g),this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(g,m.t))))}return Rn.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,Rn.prototype.flagReset.call(this),this}};T(sn,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),T(sn,"Utils",{getCurveLength:Xc});let Ae=sn;const Gc={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 lt||this._fill instanceof Rt||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof lt||this._fill instanceof Rt||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof lt||this._stroke instanceof Rt||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof lt||this._stroke instanceof Rt||this._stroke instanceof Et||this._stroke instanceof Ge)&&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 Zc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Qc(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Jc(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function ed(){this._flagFill=!0}function td(){this._flagStroke=!0}const Gp=Math.ceil,Zp=Math.floor,Sn=class Sn extends Rn{constructor(n){super();T(this,"_flagVertices",!0);T(this,"_flagLength",!0);T(this,"_flagFill",!0);T(this,"_flagStroke",!0);T(this,"_flagLinewidth",!0);T(this,"_flagOpacity",!0);T(this,"_flagVisible",!0);T(this,"_flagSize",!0);T(this,"_flagSizeAttenuation",!0);T(this,"_flagStrokeAttenuation",!0);T(this,"_length",0);T(this,"_fill","#fff");T(this,"_stroke","#000");T(this,"_linewidth",1);T(this,"_opacity",1);T(this,"_visible",!0);T(this,"_size",1);T(this,"_sizeAttenuation",!1);T(this,"_beginning",0);T(this,"_ending",1);T(this,"_dashes",null);T(this,"_strokeAttenuation",!0);T(this,"noFill",Ae.prototype.noFill);T(this,"noStroke",Ae.prototype.noStroke);T(this,"corner",Ae.prototype.corner);T(this,"center",Ae.prototype.center);T(this,"getBoundingClientRect",Ae.prototype.getBoundingClientRect);T(this,"_updateLength",Ae.prototype._updateLength);for(let r in nd)Object.defineProperty(this,r,nd[r]);this._renderer.type="points",this._renderer.flagVertices=Zc.bind(this),this._renderer.bindVertices=Qc.bind(this),this._renderer.unbindVertices=Jc.bind(this),this._renderer.flagFill=ed.bind(this),this._renderer.flagStroke=td.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 Sn().copy({...n,fill:r,stroke:o});return"id"in n&&(s.id=n.id),s}copy(n){super.copy.call(this,n);for(let r=0;r<n.vertices.length;r++){const o=n.vertices[r];o instanceof Fe?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Fe().copy(o))}for(let r=0;r<Sn.Properties.length;r++){const o=Sn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Sn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Sn.Properties.length;o++){const s=Sn.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="points",n.vertices=this.vertices.map(r=>r.toObject()),Me.each(Sn.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];typeof r.unbind=="function"&&r.unbind()}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}subdivide(n){this._update();let r=[];for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o],a=this.vertices[o-1];if(!a)continue;const l=s.x,c=s.y,d=a.x,u=a.y,h=Ac(l,c,l,c,d,u,d,u,n);r=r.concat(h)}return this.vertices=r,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const n=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),o=co(this,n*this._length),s=co(this,r*this._length),a=Gp(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}};T(Sn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let ho=Sn;const nd={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 lt||this._fill instanceof Rt||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof lt||this._fill instanceof Rt||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof lt||this._stroke instanceof Rt||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof lt||this._stroke instanceof Rt||this._stroke instanceof Et||this._stroke instanceof Ge)&&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 id extends ui{constructor(n){n=Array.isArray(n)?n:Array.prototype.slice.call(arguments);super(n);Xa(this,zo,{});this.attach(n),this.on(ne.Types.insert,this.attach),this.on(ne.Types.remove,this.detach)}get ids(){return Mt(this,zo)}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}}zo=new WeakMap;const Mn=class Mn extends Ae{constructor(n,r,o,s,a,l,c){const d=c||Ss.Resolution*3,u=[];for(let h=0;h<d;h++)u.push(new Fe);super(u,!0,!1,!0);T(this,"_flagStartAngle",!1);T(this,"_flagEndAngle",!1);T(this,"_flagInnerRadius",!1);T(this,"_flagOuterRadius",!1);T(this,"_startAngle",0);T(this,"_endAngle",di);T(this,"_innerRadius",0);T(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let h in rd)Object.defineProperty(this,h,rd[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 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._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,f,g,m,p,b,y,_,C,x;for(a?d--:l||(d-=2),f=0,g=d-1;f<d;f++){switch(m=f/g,p=c[h],b=m*(r-n)+n,y=(r-n)/d,_=s*Math.cos(b),C=s*Math.sin(b),f){case 0:u=pe.move;break;default:u=pe.curve}p.command=u,p.x=_,p.y=C,p.controls.left.clear(),p.controls.right.clear(),p.command===pe.curve&&(x=s*y/Math.PI,p.controls.left.x=x*Math.cos(b-ht),p.controls.left.y=x*Math.sin(b-ht),p.controls.right.x=x*Math.cos(b+ht),p.controls.right.y=x*Math.sin(b+ht),f===1&&p.controls.left.multiplyScalar(2),f===g&&p.controls.right.multiplyScalar(2)),h++}if(l){for(a?(c[h].command=pe.close,h++):(d--,g=d-1),f=0;f<d;f++)m=f/g,p=c[h],b=(1-m)*(r-n)+n,y=(r-n)/d,_=o*Math.cos(b),C=o*Math.sin(b),u=pe.curve,f<=0&&(u=a?pe.move:pe.line),p.command=u,p.x=_,p.y=C,p.controls.left.clear(),p.controls.right.clear(),p.command===pe.curve&&(x=o*y/Math.PI,p.controls.left.x=x*Math.cos(b+ht),p.controls.left.y=x*Math.sin(b+ht),p.controls.right.x=x*Math.cos(b-ht),p.controls.right.y=x*Math.sin(b-ht),f===1&&p.controls.left.multiplyScalar(2),f===g&&p.controls.right.multiplyScalar(2)),h++;c[h].copy(c[0]),c[h].command=pe.line}else a||(c[h].command=pe.line,c[h].x=0,c[h].y=0,h++,c[h].copy(c[0]),c[h].command=pe.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(n){const r=this.innerRadius,o=this.outerRadius,s=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new Mn(0,0,r,o,s,a,l);c.translation.copy(this.translation),c.rotation=this.rotation,c.scale=this.scale,c.skewX=this.skewX,c.skewY=this.skewY,this.matrix.manual&&c.matrix.copy(this.matrix);for(let d=0;d<Ae.Properties.length;d++){const u=Ae.Properties[d];c[u]=this[u]}return n&&n.add(c),c}toObject(){const n=super.toObject.call(this);n.renderer.type="arc-segment";for(let r=0;r<Mn.Properties.length;r++){const o=Mn.Properties[r];n[o]=this[o]}return n}};T(Mn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let Ts=Mn;const rd={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}}},Ns=Math.cos,$s=Math.sin,An=class An extends Ae{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);T(this,"_flagRadius",!1);T(this,"_radius",0);this._renderer.type="circle";for(let c in od)Object.defineProperty(this,c,od[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 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._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*Ns(c),u=o*$s(c),h=s*Ns(c-ht),f=s*$s(c-ht),g=s*Ns(c+ht),m=s*$s(c+ht),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(h,f),p.controls.right.set(g,m)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=new An(0,0,this.radius,this.vertices.length);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="circle";for(let r=0;r<An.Properties.length;r++){const o=An.Properties[r];n[o]=this[o]}return n}};T(An,"Properties",["radius"]);let Rs=An;const od={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},Es=Math.cos,Ps=Math.sin,In=class In extends Ae{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);T(this,"_flagWidth",!1);T(this,"_flagHeight",!1);T(this,"_width",0);T(this,"_height",0);this._renderer.type="ellipse";for(let d in sd)Object.defineProperty(this,d,sd[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*Es(c),u=s*Ps(c),h=o*r*Es(c-ht),f=s*r*Ps(c-ht),g=o*r*Es(c+ht),m=s*r*Ps(c+ht),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(h,f),p.controls.right.set(g,m)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=this.width/2,o=this.height/2,s=this.vertices.length,a=new 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<Ae.Properties.length;l++){const c=Ae.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}};T(In,"Properties",["width","height"]);let Fs=In;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}}},Qp=Math.cos,Jp=Math.sin,On=class On extends Ae{constructor(n,r,o,s){s=Math.max(s||0,3);super();T(this,"_flagWidth",!1);T(this,"_flagHeight",!1);T(this,"_flagSides",!1);T(this,"_radius",0);T(this,"_width",0);T(this,"_height",0);T(this,"_sides",0);this._renderer.type="polygon";for(let a in ad)Object.defineProperty(this,a,ad[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 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];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*Qp(l)/2,d=this._height*Jp(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 On(0,0,0,this.sides);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,r.width=this.width,r.height=this.height,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="polygon";for(let r=0;r<On.Properties.length;r++){const o=On.Properties[r];n[o]=this[o]}return n}};T(On,"Properties",["width","height","sides"]);let Vs=On;const ad={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 Ae{constructor(n,r,o,s){const a=[new Fe,new Fe,new Fe,new Fe];super(a,!0,!1,!0);T(this,"_flagWidth",!1);T(this,"_flagHeight",!1);T(this,"_width",0);T(this,"_height",0);T(this,"_origin",null);this._renderer.type="rectangle";for(let l in ld)Object.defineProperty(this,l,ld[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<Ae.Properties.length;o++){const s=Ae.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}};T(Ti,"Properties",["width","height","origin"]);let yr=Ti;const ld={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()}}},zn=class zn extends Ae{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);T(this,"_flagWidth",!1);T(this,"_flagHeight",!1);T(this,"_flagRadius",!1);T(this,"_width",0);T(this,"_height",0);T(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in cd)Object.defineProperty(this,c,cd[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=ey.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 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];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 zn(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="rounded-rectangle";for(let r=0;r<zn.Properties.length;r++){const o=zn.Properties[r];n[o]=this[o]}return n.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),n}};T(zn,"Properties",["width","height","radius"]);let Ms=zn;const cd={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},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 ey(){this._flagRadius=!0}const ty=Math.cos,ny=Math.sin,Dn=class Dn extends Ae{constructor(n,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();T(this,"_flagInnerRadius",!1);T(this,"_flagOuterRadius",!1);T(this,"_flagSides",!1);T(this,"_innerRadius",0);T(this,"_outerRadius",0);T(this,"_sides",0);this._renderer.type="star";for(let l in dd)Object.defineProperty(this,l,dd[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 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&&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*ty(l),u=c*ny(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 Dn(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="star";for(let r=0;r<Dn.Properties.length;r++){const o=Dn.Properties[r];n[o]=this[o]}return n}};T(Dn,"Properties",["innerRadius","outerRadius","sides"]);let As=Dn;const dd={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 Is;const ud=Math.min,hd=Math.max;yn.document&&(Is=document.createElement("canvas"));const St=class St extends Rn{constructor(n,r,o,s){super();T(this,"_flagValue",!0);T(this,"_flagFamily",!0);T(this,"_flagSize",!0);T(this,"_flagLeading",!0);T(this,"_flagAlignment",!0);T(this,"_flagBaseline",!0);T(this,"_flagStyle",!0);T(this,"_flagWeight",!0);T(this,"_flagDecoration",!0);T(this,"_flagFill",!0);T(this,"_flagStroke",!0);T(this,"_flagLinewidth",!0);T(this,"_flagOpacity",!0);T(this,"_flagVisible",!0);T(this,"_flagMask",!1);T(this,"_flagClip",!1);T(this,"_flagDirection",!0);T(this,"_flagStrokeAttenuation",!0);T(this,"_value","");T(this,"_family","sans-serif");T(this,"_size",13);T(this,"_leading",17);T(this,"_alignment","center");T(this,"_baseline","middle");T(this,"_style","normal");T(this,"_weight",500);T(this,"_decoration","none");T(this,"_direction","ltr");T(this,"_fill","#000");T(this,"_stroke","none");T(this,"_linewidth",1);T(this,"_opacity",1);T(this,"_visible",!0);T(this,"_mask",null);T(this,"_clip",!1);T(this,"_dashes",null);T(this,"_strokeAttenuation",!0);for(let a in fd)Object.defineProperty(this,a,fd[a]);if(this._renderer.type="text",this._renderer.flagFill=iy.bind(this),this._renderer.flagStroke=ry.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<St.Properties.length;a++){const l=St.Properties[a];l in s&&(this[l]=s[l])}}static Measure(n){if(Is){const r=Is.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*St.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 St().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<St.Properties.length;r++){const o=St.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new St(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<St.Properties.length;o++){const s=St.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<St.Properties.length;r++){const o=St.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}=St.Measure(this),u=(this._linewidth||0)/2;switch(this.alignment){case"left":o=-u,s=c+u;break;case"right":o=-(c+u),s=u;break;default:o=-(c/2+u),s=c/2+u}switch(this.baseline){case"middle":a=-(d/2+u),l=d/2+u;break;default:a=-(d+u),l=u}const[h,f]=r.multiply(o,a),[g,m]=r.multiply(o,l),[p,b]=r.multiply(s,a),[y,_]=r.multiply(s,l);return a=ud(f,m,b,_),o=ud(h,g,p,y),s=hd(h,g,p,y),l=hd(f,m,b,_),{top:a,left:o,right:s,bottom:l,width:s-o,height:l-a}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};T(St,"Ratio",.6),T(St,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let Yi=St;const fd={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 lt||this._fill instanceof Rt||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof lt||this._fill instanceof Rt||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof lt||this._stroke instanceof Rt||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof lt||this._stroke instanceof Rt||this._stroke instanceof Et||this._stroke instanceof Ge)&&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 iy(){this._flagFill=!0}function ry(){this._flagStroke=!0}const Ln=class Ln extends yr{constructor(n,r,o,s){super(r,o,0,0);T(this,"_flagTextures",!1);T(this,"_flagFrameRate",!1);T(this,"_flagIndex",!1);T(this,"_amount",1);T(this,"_duration",0);T(this,"_index",0);T(this,"_startTime",0);T(this,"_playing",!1);T(this,"_firstFrame",0);T(this,"_lastFrame",0);T(this,"_loop",!0);T(this,"_textures",null);T(this,"_frameRate",0);T(this,"_origin",null);this._renderer.type="image-sequence";for(let a in md)Object.defineProperty(this,a,md[a]);this._renderer.flagTextures=oy.bind(this),this._renderer.bindTextures=sy.bind(this),this._renderer.unbindTextures=ay.bind(this),this.noStroke(),this.noFill(),Array.isArray(n)?this.textures=n.map(gd.bind(this)):typeof n=="string"&&(this.textures=[gd(n)]),this.origin=new be,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=Ln.DefaultFrameRate,this.index=0}static fromObject(n){const r=new Ln().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Ln.Properties.length;r++){const o=Ln.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 Ln(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=Zt(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 Ge))&&(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}};T(Ln,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),T(Ln,"DefaultFrameRate",30);let Os=Ln;const md={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 oy(){this._flagTextures=!0}function sy(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function ay(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function gd(t){if(t instanceof Ge)return t;if(typeof t=="string")return new Ge(t)}const Ni=class Ni extends yr{constructor(n,r,o,s,a,l){super(r,o,0,0);T(this,"_flagTexture",!1);T(this,"_flagColumns",!1);T(this,"_flagRows",!1);T(this,"_flagFrameRate",!1);T(this,"_flagIndex",!1);T(this,"_amount",1);T(this,"_duration",0);T(this,"_startTime",0);T(this,"_playing",!1);T(this,"_firstFrame",0);T(this,"_lastFrame",0);T(this,"_loop",!0);T(this,"_texture",null);T(this,"_columns",1);T(this,"_rows",1);T(this,"_frameRate",0);T(this,"_index",0);T(this,"_origin",null);this._renderer.type="sprite";for(let c in pd)Object.defineProperty(this,c,pd[c]);this.noStroke(),this.noFill(),n instanceof Ge?this.texture=n:typeof n=="string"&&(this.texture=new Ge(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,f,g;if(n&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=n),n.loaded)){h=n.image.width,f=n.image.height,s=h/r,a=f/o,c=this._amount,this.width!==s&&(this.width=s),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&(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=Zt(this._firstFrame,g,l/d),u=Math.floor(u),u!==this._index&&(this._index=u,u>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const m=this._index%r,p=Math.floor(this._index/r),b=-s*m+(h-s)/2,y=-a*p+(f-a)/2;b!==n.offset.x&&(n.offset.x=b),y!==n.offset.y&&(n.offset.y=y)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};T(Ni,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let zs=Ni;const pd={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}}},fo=Math.min,mo=Math.max,an=class an extends Rn{constructor(n){super();T(this,"_flagAdditions",!1);T(this,"_flagSubtractions",!1);T(this,"_flagOrder",!1);T(this,"_flagOpacity",!0);T(this,"_flagBeginning",!1);T(this,"_flagEnding",!1);T(this,"_flagLength",!1);T(this,"_flagMask",!1);T(this,"_fill","#fff");T(this,"_stroke","#000");T(this,"_linewidth",1);T(this,"_opacity",1);T(this,"_visible",!0);T(this,"_cap","round");T(this,"_join","round");T(this,"_miter",4);T(this,"_closed",!0);T(this,"_curved",!1);T(this,"_automatic",!0);T(this,"_beginning",0);T(this,"_ending",1);T(this,"_length",0);T(this,"_mask",null);T(this,"_strokeAttenuation",!0);for(let r in yd)Object.defineProperty(this,r,yd[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++)bd.call(this,n[r],this)}static RemoveChildren(n){for(let r=0;r<n.length;r++)bd.call(this,n[r])}static OrderChildren(n){this._flagOrder=!0}static fromObject(n){const r=new an;for(let s=0;s<an.Properties.length;s++){const a=an.Properties[s];a in n&&(/(fill|stroke)/i.test(a)?r[a]=typeof n[a]=="string"?n[a]: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 Ts.fromObject(s);case"circle":return Rs.fromObject(s);case"element":return gr.fromObject(s);case"ellipse":return Fs.fromObject(s);case"group":return an.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Os.fromObject(s);case"path":return Ae.fromObject(s);case"points":return ho.fromObject(s);case"polygon":return Vs.fromObject(s);case"rectangle":return yr.fromObject(s);case"rounded-rectangle":return Ms.fromObject(s);case"shape":return Rn.fromObject(s);case"sprite":return zs.fromObject(s);case"star":return As.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<an.Properties.length;r++){const o=an.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new an,o=this.children.map(function(s){return s.clone()});return r.add(o),r.opacity=this.opacity,this.mask&&(r.mask=this.mask),r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.className=this.className,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="group",n.children=[],n.opacity=this.opacity,n.className=this.className,n.mask=this.mask?this.mask.toObject():null,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,f=-1/0;const g=/texture|gradient/i;o=n?this.matrix:this.worldMatrix;for(let m=0;m<this.children.length;m++){const p=this.children[m];if(!(!p.visible||g.test(p._renderer.type))&&(r=p.getBoundingClientRect(n),s=typeof r.top!="number"||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[b,y]=o.multiply(r.left,r.top),[_,C]=o.multiply(r.right,r.top),[x,N]=o.multiply(r.left,r.bottom),[$,w]=o.multiply(r.right,r.bottom);h=fo(y,C,N,w,h),d=fo(b,_,x,$,d),u=mo(b,_,x,$,u),f=mo(y,C,N,w,f)}else h=fo(r.top,h),d=fo(r.left,d),u=mo(r.right,u),f=mo(r.bottom,f)}return{top:h,left:d,right:u,bottom:f,width:u-d,height:f-h}}noFill(){return this.children.forEach(function(n){n.noFill()}),this}noStroke(){return this.children.forEach(function(n){n.noStroke()}),this}subdivide(){const n=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,n)}),this}_update(){let n,r,o;if(this._flagBeginning||this._flagEnding){const s=Math.min(this._beginning,this._ending),a=Math.max(this._beginning,this._ending),l=this.length;let c=0;const d=s*l,u=a*l;for(n=0;n<this.children.length;n++)o=this.children[n],r=o.length,d>c+r?(o.beginning=1,o.ending=1):u<c?(o.beginning=0,o.ending=0):d>c&&d<c+r?(o.beginning=(d-c)/r,o.ending=1):u>c&&u<c+r?(o.beginning=0,o.ending=(u-c)/r):(o.beginning=0,o.ending=1),c+=r}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};T(an,"Children",id),T(an,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let En=an;const yd={visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._flagVisible=this._visible!==t||this._flagVisible,this._visible=t}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!==t||this._flagOpacity,this._opacity=t}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._flagBeginning=this._beginning!==t||this._flagBeginning,this._beginning=t}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._flagEnding=this._ending!==t||this._flagEnding,this._ending=t}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let t=0;t<this.children.length;t++){const e=this.children[t];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){this._fill=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.fill=t}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){this._stroke=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.stroke=t}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.linewidth=t}}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.join=t}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.miter=t}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.cap=t}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.closed=t}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.curved=t}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){this._automatic=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.automatic=t}}},children:{enumerable:!0,get:function(){return this._children},set:function(t){const e=En.InsertChildren.bind(this),n=En.RemoveChildren.bind(this),r=En.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new id(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 bd(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 go extends Ae{constructor(e,n,r,o){const s=[new Fe(e,n),new Fe(r,o)];super(s);for(let a in _d)Object.defineProperty(this,a,_d[a]);this.vertices[0].command=pe.move,this.vertices[1].command=pe.line,this.automatic=!1}}T(go,"Properties",["left","right"]);const _d={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 ao("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 ao("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class Ds{constructor(e=0,n=0){this.x=e,this.y=n}}class _n{constructor(e=10,n=0,r="A"){T(this,"start",new Ds);T(this,"end",new Ds);this.width=e,this.angle=n,this.label=r}}const qe={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"}},ly={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function cy(t,e){return i.openBlock(),i.createElementBlock("svg",ly,[...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 po=i.markRaw({name:"ion-close",render:cy}),dy={class:"mr-3 flex flex-col gap-2"},uy=["onClick"],hy={class:"h-full p-2"},fy={},my=i.defineComponent({...fy,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(t,{emit:e}){const n=t,r=i.ref(!1),o=i.useTemplateRef("drawing-template-containers"),s=i.useTemplateRef("drawing-custom-template-containers"),a=e,l=c=>{r.value=!0,a("remove-custom-template",c,()=>{r.value=!1})};return i.onMounted(()=>{var c,d;(c=n.settings.templates)==null||c.forEach((u,h)=>{var g;const f=(g=o.value)==null?void 0:g.at(h);f&&a("init-draw-template",f,u)}),(d=n.settings.customTemplates)==null||d.forEach((u,h)=>{var g;const f=(g=s.value)==null?void 0:g.at(h);f&&a("init-draw-template",f,u)})}),i.watch(()=>[...n.settings.customTemplates],(c,d)=>{i.nextTick(()=>{c.forEach((u,h)=>{var f;if(!(d!=null&&d.includes(u))){const g=(f=s.value)==null?void 0:f.at(h);g&&a("init-draw-template",g,u)}}),d.length>c.length&&d.forEach((u,h)=>{var g;const f=(g=s.value)==null?void 0:g.at(h);f&&(f.innerHTML="",a("init-draw-template",f,u))})})},{deep:!0}),(c,d)=>{const u=po;return i.openBlock(),i.createBlock(i.unref(A.NScrollbar),{style:{width:"auto"},trigger:"none",class:"max-h-[19rem] md:max-h-[40rem] w-auto"},{default:i.withCtx(()=>[i.createElementVNode("div",dy,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.settings.allTemplates,(h,f)=>(i.openBlock(),i.createElementBlock("div",{key:`${h.id}-${f}`,class:"group relative"},[i.createVNode(i.unref(A.NPopover),{trigger:"hover",placement:"right"},{trigger:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["relative h-10 w-24 shrink-0 rounded-md border-2 border-solid border-slate-200",{"!border-green-700":f===t.selectTemplateIndex}]),onClick:g=>a("template:select",f)},[i.createElementVNode("div",hy,[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,uy)]),default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(h.label),1)]),_:2},1024),h.isCustom&&!h.isNewRec()?(i.openBlock(),i.createBlock(i.unref(A.NButton),{key:0,size:"tiny",quaternary:"",loading:r.value,disabled:r.value,circle:"",class:"!absolute right-0.5 top-0.5 !hidden group-hover:!flex",onClick:g=>l(f)},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),wd=Nn(my,[["__scopeId","data-v-afccb364"]]),gy={class:"flex gap-3 min-w-[20rem] relative"},py={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},yy={ref:"drawing-container",class:"size-full"},by={},xd=i.defineComponent({...by,__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,L)=>new _n(n.value.configuratorParams.linesWidths[L],D,`A-${L+1}`))),h=i.computed(()=>n.value.configuratorParams.colorSide==="bottom"),f=i.computed(()=>{var D,L;return n.value.configuratorParams.startTailType&&((D=n.settings.startTailConfigs)!=null&&D[n.value.configuratorParams.startTailType])?(L=n.settings.startTailConfigs)==null?void 0:L[n.value.configuratorParams.startTailType].points:[]}),g=i.computed(()=>{var L;const D=n.value.configuratorParams.endTailType!==void 0&&((L=n.settings.endTailConfigs)==null?void 0:L[n.value.configuratorParams.endTailType]);return!D||!D.points?[]:D.points.map((H,z)=>Array.isArray(H)?new _n(H[0],H[1],`A-${z+1}`):new _n(H.width,H.angle,`A-${z+1}`))}),m=(D,L=!1)=>{D[0].start.x=0,D[0].start.y=0;let H=0;for(let z=0;z<D.length;z++){const O=D[z],U=D[z-1]??new _n(0,H);H+=!L||z>1?U.angle:0;const K=(!L||z>0?O.angle:0)+H;if(D[z].end.x=O.width*Math.cos(K*Math.PI/180)+D[z].start.x,D[z].end.y=O.width*Math.sin(K*Math.PI/180)+D[z].start.y,z<D.length-1){const V=z+1;D[V].start.x=D[z].end.x,D[V].start.y=D[z].end.y}}return D},p=(D,L,H,z,O=!1)=>{let U=m([...H,...z]);L.length>0&&(U=[...m(L),...U]);let K=0,V=0,q=0,Y=0;U.forEach(Te=>{K=Math.min(K,Te.start.x,Te.end.x),V=Math.min(V,Te.start.y,Te.end.y),q=Math.max(q,Te.start.x,Te.end.x),Y=Math.max(Y,Te.start.y,Te.end.y)});let ee,ue;K===0&&V===0&&q===0&&Y===0?(ee=1,ue=1):(ee=D.width/Math.abs(q-K),ue=(O?D.height:D.height-qe.colorSideLabel.size)/Math.abs(Y-V));const ve=Math.min(ee,ue);return K=K<0?-K*ve:0,V=V<0?-V*ve:0,[ve,K,V]},b=D=>{const L=new ho([D]);return L._size=qe.anchorPoint.size,L.fill=qe.anchorPoint.color,L.stroke="transparent",L._linewidth=qe.anchorPoint.strokeSize,l.push(L),L},y=(D,L)=>{if(l=[],n.settings.allowChangeFirstPoint){const H=D[0],z=new be(H.vertices[0].x,H.vertices[0].y);z.bind(ne.Types.change,()=>{H.vertices[0].copy(z)});const O=b(z);L.add(O)}D.forEach((H,z)=>{const O=D[z+1],U=new be(H.vertices[1].x,H.vertices[1].y);U.bind(ne.Types.change,()=>{H.vertices[1].copy(U),O!==void 0&&O.vertices[0].copy(U)});const K=b(U);L.add(K)})},_=D=>D*(Math.PI/180),C=(D,L,H)=>{const z=L.vertices.length-1;D.position.x=L.vertices[z].x,D.position.y=L.vertices[z].y;const O=Math.atan2(L.vertices[z].y-L.vertices[0].y,L.vertices[z].x-L.vertices[0].x);D.rotation=_(H)+O},x=(D,L,H)=>{if(L.vertices[0]===void 0)return;D.position.x=L.vertices[0].x,D.position.y=L.vertices[0].y;const z=L.vertices.length-1,O=Math.atan2(L.vertices[z].y-L.vertices[0].y,L.vertices[z].x-L.vertices[0].x);D.rotation=_(H)+O},N=(D,L,H)=>{const z=new En;if(D.length===0)return z;const O=[];return[...D].reverse().forEach((U,K)=>{K!==0&&U.angle>0&&(U.angle*=-1),O.push(U)}),D=m(O,!0),x(z,L,D[0].angle),[L.vertices[0],L.vertices[1]].forEach(U=>{U.bind(ne.Types.change,()=>{x(z,L,D[0].angle)})}),D.forEach(U=>{const K=U.start.x*H,V=U.end.x*H,q=U.start.y*H,Y=U.end.y*H,ee=new go(K,q,V,Y);ee.linewidth=qe.line.size,ee.stroke=qe.line.color,z.add(ee)}),z},$=(D,L,H)=>{const z=new En;return D.length===0||(D=m(D,!0),C(z,L,D[0].angle),[L.vertices[0],L.vertices[1]].forEach(O=>{O.bind(ne.Types.change,()=>{C(z,L,D[0].angle)})}),D.forEach(O=>{const U=O.start.x*H,K=O.end.x*H,V=O.start.y*H,q=O.end.y*H,Y=new go(U,V,K,q);Y.linewidth=qe.line.size,Y.stroke=qe.line.color,z.add(Y)})),z},w=(D,L,H,z)=>{const O=L.vertices[0].x+(L.vertices[1].x-L.vertices[0].x)/2-8*Math.sin(D.angle*Math.PI/180),U=L.vertices[0].y+(L.vertices[1].y-L.vertices[0].y)/2-8*Math.cos(D.angle*Math.PI/180),K=new Yi(D.label,O+10,U-10);let V;K.size=qe.lineLabel.size,K.weight=600,K.fill=qe.lineLabel.color,K.id+=1,K.rotation=qe.lineLabel.rotation,z>0&&(V=new Yi(`${D.angle}°`,L.vertices[0].x+25,L.vertices[0].y-25),V.size=qe.angleLabel.size,V.weight=600,V.fill=qe.angleLabel.color,V.rotation=qe.angleLabel.rotation,V.id+=z,s.push(V),H.add(V)),H.add(K),k(K,L,0,V),k(K,L,1)},v=()=>{const{size:D}=qe.colorSideLabel,L=0,H=0,z=h.value?D/2:D/2-D,O=h.value?D/2-D:D/2,U=new En;if(!c)return U;const K=5,V=Math.atan2(O-z,H-L),q=[new Fe(L,z,0,0,0,0,pn.Commands.move),new Fe(H,O,0,0,0,0,pn.Commands.line),new Fe(H-K*Math.cos(V-Math.PI/4),O-K*Math.sin(V-Math.PI/4),0,0,0,0,pn.Commands.line),new Fe(H,O,0,0,0,0,pn.Commands.move),new Fe(H-K*Math.cos(V+Math.PI/4),O-K*Math.sin(V+Math.PI/4),0,0,0,0,pn.Commands.line)],Y=new Ae(q,!1,!1,!0);Y.noFill(),Y.cap="round",Y.join="round",Y.linewidth=D/7,Y.stroke=qe.colorSideLabel.color,U.add(Y);const ee=new Yi(h.value?"Цвет снизу":"Цвет сверху",10,0);ee.size=D,ee.weight=600,ee.fill=qe.colorSideLabel.color,ee.alignment="left",U.add(ee);const ue=U.getBoundingClientRect();return U.position.x=(c.width-ue.width)*d+10,U.position.y=h.value?c.height+ue.height*2:ue.height/2,U},k=(D,L,H,z)=>{L.vertices[H].bind(ne.Types.change,()=>{const O=L.vertices.length-1,U=Math.atan2(L.vertices[0].y-L.vertices[O].y,L.vertices[0].x-L.vertices[O].x)*180/Math.PI,K=L.vertices[0].x+(L.vertices[O].x-L.vertices[0].x)/2-8*Math.sin(U*Math.PI/180),V=L.vertices[0].y+(L.vertices[O].y-L.vertices[0].y)/2-8*Math.cos(U*Math.PI/180);D.position.x=K+10,D.position.y=V-10,D.rotation=-.5,z&&(z.position.x=L.vertices[0].x+25,z.position.y=L.vertices[0].y-25)})},B=(D,L,H,z,O=!1)=>{var We;if(D.clear(),H.length===0){D.update();return}const U=m(H),[K,V,q]=p(D,L,U,z,O),Y=new En,ee=new Array,ue=new Array;O||(s=[],a=[]),U.forEach((ce,pt)=>{const Ne=ce.start.x*K+V,Vt=ce.end.x*K+V,jt=ce.start.y*K+q,ln=ce.end.y*K+q,Bt=new go(Ne,jt,Vt,ln);Bt.linewidth=O?qe.previewLine.size:qe.line.size,Bt.stroke=O?qe.previewLine.color:qe.line.color,a.push(Bt),ee.push(Bt),Y.add(Bt),!O&&ce.label!==""&&w(ce,Bt,Y,pt)});const ve=ee.at(-1);let Te=Y.getBoundingClientRect();if(!O){const ce=v();ue.push(ce)}if(L.length>0){const ce=N(L,ee[0],K);Y.add(ce)}if(z.length>0&&ve){const ce=$(z,ve,K);Y.add(ce)}if(ue.push(Y),D.makeGroup(ue),Te=Y.getBoundingClientRect(),Y.position.x=0-Te.left+(D.width-Te.width)/(2*(O?1:d)),Y.position.y=0-Te.top+(D.height-Te.height)/(2*(O?1:d)),D.update(),!O){const ce=((We=n.value.configuratorParams)==null?void 0:We.colorSide)==="top";Y.position.y=Y.position.y+qe.colorSideLabel.size*Number(ce),y(ee,Y),D.update()}},R=(D,L)=>{if(D&&!L.isNewRec()){const H=new pn({width:D.scrollWidth,height:D.scrollHeight});H.appendTo(D),B(H,[],L.points,[],!0)}},E=()=>{c&&B(c,f.value,u.value,g.value,!1)},P=D=>D*(180/Math.PI),W=(D,L)=>{const H=D[1].x-D[0].x,z=D[1].y-D[0].y,O=L[1].x-L[0].x,U=L[1].y-L[0].y;let K=Math.atan2(H*U-z*O,H*O+z*U);return K=P(K),Math.round(K)*-1},I=D=>{const L=a.map((H,z,O)=>{const U=O[z-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let K=Math.ceil(H._length/D/n.settings.lineWidthStep)*n.settings.lineWidthStep;const V=s[z-1];K<(O.length>1?n.settings.minLineWidth:n.settings.stripMinWidth)&&(K=O.length>1?n.settings.minLineWidth:n.settings.stripMinWidth),K>n.settings.maxLineWidth&&(K=n.settings.maxLineWidth);const q=W(H.vertices,U.vertices);return V&&(V.value=`${q}°`),new _n(K,q,`A-${z+1}`)});r("pointer:move",L)},Z=D=>{let L=null,H;const z=V=>{L=l.find(q=>{const Y=q.renderer;return(Y==null?void 0:Y.elem)===V.target}),[H]=p(D,f.value,u.value.map(q=>q),g.value)},O=V=>{if(L){const q=L.renderer,Y=q==null?void 0:q.elem;if(!Y)return;const ee=Y.getBoundingClientRect();L.vertices[0].x-=ee.x-(V instanceof MouseEvent?V.clientX:V.targetTouches[0].clientX)+qe.anchorPoint.size/2,L.vertices[0].y-=ee.y-(V instanceof MouseEvent?V.clientY:V.targetTouches[0].clientY)+qe.anchorPoint.size/2,I(H),D.update()}},U=()=>{L&&r("pointer:up",u.value),L=null},K=o.value;K&&(K.addEventListener("touchstart",z,{passive:!0}),K.addEventListener("touchend",U,{passive:!0}),K.addEventListener("mousedown",z),K.addEventListener("mouseup",U),K.addEventListener("mousemove",O),K.addEventListener("touchmove",O,{passive:!0}))},te=(D,L)=>{r("remove-custom-template",D,L)};return i.onMounted(()=>{o.value&&(c=new pn({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),i.watch(()=>n.value,()=>{E()},{deep:!0,immediate:!0}),Z(c))}),i.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(D,L)=>(i.openBlock(),i.createElementBlock("div",gy,[i.createVNode(wd,{"select-template-index":t.selectTemplateIndex,settings:t.settings,"onTemplate:select":L[0]||(L[0]=H=>r("template:select",H)),onInitDrawTemplate:R,onRemoveCustomTemplate:te},null,8,["select-template-index","settings"]),i.createElementVNode("div",py,[i.createElementVNode("div",yy,null,512)])]))}});class Ui extends j.Identity{constructor(n,r){super();T(this,"label","");T(this,"points",[]);T(this,"isCustom",!1);T(this,"id",-1);T(this,"guid","");n?(this.label=n.label,this.points=n.points.map((o,s)=>M.isArray(o)?new _n(o[0],o[1],`A-${s+1}`):new _n(o.width,o.angle,`A-${s+1}`)),this.isCustom=n.isCustom):(this.label="-- Новая конфигурация --",this.points=[new _n(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class Ls extends Ui{constructor(n){super(n);T(this,"isDefault");this.isDefault=n.isDefault??!1}}class kd{constructor(e){T(this,"minLineWidth");T(this,"maxLineWidth");T(this,"lineWidthStep");T(this,"minLineAngle");T(this,"maxLineAngle");T(this,"lineAngleStep");T(this,"stripMinWidth");T(this,"stripMaxWidth");T(this,"stripMinLength");T(this,"stripMaxLength");T(this,"allowShowTable");T(this,"showOnlyTemplates");T(this,"templates");T(this,"customTemplates",[]);T(this,"startTailConfigs");T(this,"endTailConfigs");T(this,"bendCountForExtended");T(this,"extendedProductCatalog");T(this,"allowChangeFirstPoint");T(this,"allowSaveTemplates");T(this,"userTemplatesPrefix");T(this,"lengthStep");T(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 Ls(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new Ls(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 _n(this.stripMinWidth,0,"A-1")],isCustom:!0,id:-1,guid:""})))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(e){if(!this.allowSaveTemplates)return;const n=this.customTemplates.findLast(o=>!o.isNewRec()),r=new 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 _y={class:"flex flex-col gap-3"},wy={class:"grid gap-5 md:grid-cols-5"},xy={},vd=i.defineComponent({...xy,__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 kd(n.settings)),d=i.ref({linesWidths:[...n.cartItem.configuratorParams.linesWidths],linesAngles:[...n.cartItem.configuratorParams.linesAngles]}),u=i.ref({quantity:{},marker:{},length:{}}),h=i.ref(0),f=i.useTemplateRef("kozyrek-configurator-params-form"),g=(k=0)=>{var R;const B=(R=c.value.allTemplates)==null?void 0:R.at(k);B!==void 0&&(h.value=k,l.value.configuratorParams.linesWidths=B.points.map(E=>M.isArray(E)?E[0]:E.width),l.value.configuratorParams.linesAngles=B.points.map(E=>M.isArray(E)?E[1]:E.angle),C()),y(l.value.configuratorParams)},m=async()=>{const k=prompt("Введите название шаблона:");if(!k)return;a.value=!0;const B={label:k,points:l.value.configuratorParams.linesWidths.map((E,P)=>[E,l.value.configuratorParams.linesAngles[P]])},R=E=>{E&&(c.value.addCustomTemplate(B),h.value=c.value.allTemplates.length-2),a.value=!1};n.eventEmitter.emit("configurator:create-template",{category:n.cartItem.category,template:B,callback:R})},p=async(k,B)=>{var P;const R=(P=c.value.allTemplates)==null?void 0:P.at(k);if(!R||!R.isCustom)return;const E=W=>{W&&(c.value.removeCustomTemplate(R.id),g()),B==null||B()};n.eventEmitter.emit("configurator:remove-template",{category:n.cartItem.category,templateId:R.id,callback:E})},b=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(h.value=c.value.allTemplates.length-1)},y=async k=>{var B,R;l.value.product=new j.ClientProduct,(R=(B=f.value)==null?void 0:B.formReference)==null||R.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(M.noop)},_=async()=>{var k,B;(B=(k=f.value)==null?void 0:k.formReference)==null||B.validate(R=>{R||(s.value=!0,r("submit",l.value,u.value,()=>{s.value=!1,i.nextTick(()=>{var E,P;(P=(E=f.value)==null?void 0:E.formReference)==null||P.restoreValidation()})}))}).catch(M.noop)},C=()=>{const k={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach((B,R)=>{k[`lines_widths[${R+1}]`]={},k[`lines_angles[${R+1}]`]={}}),u.value=k},x=k=>{d.value.linesWidths=k.map(B=>B.width),d.value.linesAngles=k.map(B=>B.angle)},N=k=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,C(),b(),y(l.value.configuratorParams)},$=(k,B)=>{d.value.linesWidths=k,d.value.linesAngles=B},w=k=>{const B=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,R=0;l.value.configuratorParams.linesWidths.splice(k+1,0,B),l.value.configuratorParams.linesAngles.splice(k+1,0,R),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],C(),b(),y(l.value.configuratorParams)},v=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(),b(),y(l.value.configuratorParams))};return i.onBeforeMount(()=>{g()}),i.watch(()=>n.cartItem,k=>{l.value=new j.OrderItemBase(k),g()}),(k,B)=>{const R=A.NButton;return i.openBlock(),i.createElementBlock("div",_y,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(R,{key:0,type:"tertiary",class:"self-end",onClick:B[0]||(B[0]=E=>r("click:view-switch"))},{default:i.withCtx(()=>[...B[3]||(B[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",wy,[i.createVNode(xd,{value:l.value,"select-template-index":h.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":N,"onPointer:move":x,"onTemplate:select":g,onRemoveCustomTemplate:p},null,8,["value","select-template-index","settings"]),i.createVNode(al,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":B[1]||(B[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":B[2]||(B[2]=E=>y(E)),"onUpdate:preview":$,onSubmit:_,"onClick:saveTemplate":m,"onClick:addLine":w,"onClick:removeLine":v},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),ky={class:"flex flex-col items-center justify-between rounded-xl"},vy={class:"img-preview relative flex justify-center"},Cy={},Sy=i.defineComponent({...Cy,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(t,{emit:e}){const n=t,r=i.computed(()=>{const{height:s}=n.configuratorParams,a=M.keys(n.settings.crossbarCount).reverse().find(l=>{const c=n.settings.crossbarCount[Number(l)];return s>=c});if(a!==void 0)return String(Number(a)+1)}),o=e;return(s,a)=>{const l=A.NButton;return i.openBlock(),i.createElementBlock("div",ky,[i.createElementVNode("div",vy,[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})])}}}),Hs=Nn(Sy,[["__scopeId","data-v-a67fd61e"]]),By={key:0,class:"flex items-baseline gap-1"},Ty={key:0,class:"flex items-baseline gap-1"},Ny={key:1},$y={class:"text-lg font-semibold"},Ry={key:2,class:"text-red-500 text-sm mb-2"},Ey={class:"flex gap-3"},Py={},Cd=i.defineComponent({...Py,__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(()=>ot.isPhoneDevice()),a=i.useTemplateRef("form-reference"),l=i.useTemplateRef("width-form-item-reference"),c=i.useTemplateRef("height-form-item-reference"),d=i.useTemplateRef("width-input-reference"),u=i.ref(M.cloneDeep(r.value)),h=i.computed(()=>r.settings.widthOverlaps[u.value.configuratorParams.mountType]??0),f=i.computed(()=>r.settings.heightOverlaps[u.value.configuratorParams.mountType]??0),g=i.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),m=i.computed(()=>r.settings.maxHeights[u.value.configuratorParams.netType]),p=i.computed(()=>u.value.configuratorParams.width?u.value.configuratorParams.width+h.value:0),b=i.computed(()=>u.value.configuratorParams.height?u.value.configuratorParams.height+f.value:0),y=i.ref(r.settings.canSetDopProdaga??!1),_=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth-h.value),ae.max(g.value-h.value),ae.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[ae.required,ae.min(r.settings.minHeight-f.value),ae.max(m.value-f.value),ae.step(1),He.serverValidation(r.validation.height.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),C=i.computed(()=>{var P;const v=p.value,k=b.value,{quantity:B}=r.value,R=((P=r.value.product)==null?void 0:P.costRub)||0;if(!v||!k||!B||R===0)return null;const E=v*k/1e6;return(R*B*E).toLocaleString("ru-ru",{minimumFractionDigits:2})}),x=i.computed(()=>{const v=p.value,k=b.value,B=!!(v&&v>=r.settings.minWidth&&v<=r.settings.maxWidths[u.value.configuratorParams.netType]),R=!!(k&&k>=r.settings.minHeight&&k<=r.settings.maxHeights[u.value.configuratorParams.netType]),E=!!(r.value.quantity&&r.value.quantity>0);return B&&R&&E}),N=(v,k)=>{var E,P;const B=u.value.configuratorParams;v&&v in B&&(B[v]=k);const R={...B,width:p.value??0,height:b.value??0};v==="width"&&((E=l.value)==null||E.validate().catch(M.noop)),v==="height"&&((P=c.value)==null||P.validate().catch(M.noop)),i.nextTick(()=>{var I,Z;!((I=l.value)!=null&&I.validationErrored)&&!((Z=c.value)!=null&&Z.validationErrored)&&R.height&&R.width&&o("update:params",R),$("configuratorParams",R)})},$=(v,k)=>{const B=new j.OrderItemBase(r.value);B[v]=k,v==="configuratorParams"&&(B.product=new j.ClientProduct),o("update:value",B)};return i.watch(()=>r.value,v=>{const k=M.cloneDeep(i.toRaw(v)),B=k.configuratorParams.mountType,R=r.settings.widthOverlaps[B]??0,E=r.settings.heightOverlaps[B]??0;k.configuratorParams.width&&k.configuratorParams.width>0&&(k.configuratorParams.width-=R),k.configuratorParams.height&&k.configuratorParams.height>0&&(k.configuratorParams.height-=E),u.value=k},{deep:!0}),i.onMounted(()=>{var v;(v=d.value)==null||v.select()}),e({validate:(w=a.value)==null?void 0:w.validate,formReference:a}),(v,k)=>{const B=A.NCheckbox;return i.openBlock(),i.createBlock(i.unref(A.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(R=>o("submit",u.value),["prevent"]),["enter"]))},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NSelect),{value:u.value.configuratorParams.netType,"onUpdate:value":[k[0]||(k[0]=R=>u.value.configuratorParams.netType=R),k[1]||(k[1]=R=>N("netType",R))],options:t.settings.netType.map(R=>({label:t.settings.descriptions.net_type[R],value:R}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(A.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NSelect),{value:u.value.configuratorParams.color,"onUpdate:value":[k[2]||(k[2]=R=>u.value.configuratorParams.color=R),k[3]||(k[3]=R=>N("color",R))],options:t.settings.color.map(R=>({label:t.settings.descriptions.color[R],value:R}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(A.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NSelect),{value:u.value.configuratorParams.mountType,"onUpdate:value":[k[4]||(k[4]=R=>u.value.configuratorParams.mountType=R),k[5]||(k[5]=R=>N("mountType",R))],options:t.settings.mountType.map(R=>({label:t.settings.descriptions.mount_type[R],value:R}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(A.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",By,[i.createVNode(i.unref(A.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Ширина готового изделия "+i.toDisplayString(p.value),1)]),_:1}),i.createVNode(i.unref(A.NButton),{quaternary:"",type:"info",size:"tiny",onClick:k[10]||(k[10]=R=>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(A.NInputNumber),{ref:"width-input-reference",value:u.value.configuratorParams.width,"onUpdate:value":[k[6]||(k[6]=R=>u.value.configuratorParams.width=R),k[9]||(k[9]=R=>N("width",R))],parse:i.unref(rt),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:k[7]||(k[7]=R=>i.unref(nt)(R)),onInput:k[8]||(k[8]=R=>i.unref(tt)(t.validation,"width")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(A.NFormItem),{ref:"height-form-item-reference",path:"configuratorParams.height",label:`Высота светового проёма от ${t.settings.minHeight-f.value} ${m.value?" до "+(m.value-f.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.height.showFeedback&&b.value>=t.settings.minHeight&&b.value<=t.settings.maxHeights[u.value.configuratorParams.netType]?(i.openBlock(),i.createElementBlock("div",Ty,[i.createVNode(i.unref(A.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Высота готового изделия "+i.toDisplayString(b.value),1)]),_:1}),i.createVNode(i.unref(A.NButton),{quaternary:"",type:"info",size:"tiny",onClick:k[15]||(k[15]=R=>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(A.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[k[11]||(k[11]=R=>u.value.configuratorParams.height=R),k[14]||(k[14]=R=>N("height",R))],parse:i.unref(rt),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:k[12]||(k[12]=R=>i.unref(nt)(R)),onInput:k[13]||(k[13]=R=>i.unref(tt)(t.validation,"height")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(A.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:u.value.quantity,"onUpdate:value":[k[16]||(k[16]=R=>u.value.quantity=R),k[19]||(k[19]=R=>$("quantity",R??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:k[17]||(k[17]=R=>i.unref(nt)(R,!1)),onInput:k[18]||(k[18]=R=>i.unref(tt)(t.validation,"quantity")),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(A.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:k[20]||(k[20]=R=>i.unref(tt)(t.validation,"marker")),"onUpdate:value":k[21]||(k[21]=R=>{u.value.marker=R??null,$("marker",R??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),y.value?(i.openBlock(),i.createBlock(B,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":k[22]||(k[22]=R=>{u.value.isAdditionalSale=R??!1,$("isAdditionalSale",R??!1)})},{default:i.withCtx(()=>[...k[28]||(k[28]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(ur,{"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",Ny,[k[29]||(k[29]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",$y,i.toDisplayString(C.value)+" ₽",1)])):i.createCommentVNode("",!0),x.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Ry," Пожалуйста, заполните все обязательные поля корректно. ")),i.createElementVNode("div",Ey,[i.createVNode(i.unref(A.NButton),{loading:t.isSubmitProcessing,disabled:!x.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:k[23]||(k[23]=R=>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(A.NButton),{key:0,type:"default",onClick:k[24]||(k[24]=R=>o("click:show-preview-drawer"))},{default:i.withCtx(()=>[...k[30]||(k[30]=[i.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1},8,["model","rules"])}}}),Fy="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",Vy="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",My="/img/configurators/mosquitto/measurement-instructions/mount.png",Ay="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",Iy="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",Oy={class:"flex flex-col gap-6"},zy={class:"flex gap-4"},Dy={class:"flex flex-col gap-2"},Ly={class:"flex gap-4"},Hy={class:"flex flex-col gap-2"},Wy={class:"flex gap-4"},jy={class:"flex flex-col gap-2"},qy={},Sd=i.defineComponent({...qy,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(t,{emit:e}){const n=ot.initRefDependingOnDeviceResolution("small","small","medium"),r=ot.initRefDependingOnDeviceResolution(.98,.95,.8),o=i.computed(()=>window.innerWidth*r.value),s=e;return(a,l)=>{const c=A.NText;return i.openBlock(),i.createBlock(i.unref(A.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",Oy,[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:Fy,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:Vy,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",zy,[l[9]||(l[9]=i.createElementVNode("img",{src:My,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Dy,[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",Ly,[l[15]||(l[15]=i.createElementVNode("img",{src:Ay,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Hy,[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",Wy,[l[21]||(l[21]=i.createElementVNode("img",{src:Iy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",jy,[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"])}}}),Xy={class:"grid md:grid-cols-2"},Yy={},Bd=i.defineComponent({...Yy,__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(()=>ot.isPhoneDevice()),s=i.ref(!1),a=i.ref(!1),l=i.ref(n.cartItem),c=i.useTemplateRef("mosquito-configurator-form"),d=i.ref({width:{},height:{},quantity:{},marker:{}}),u=i.ref(!1),h=i.ref(!1),f=i.computed(()=>i.inject("debounce-input-time",300)),g=M.debounce(async p=>{var b,y;l.value.product=new j.ClientProduct,(y=(b=c.value)==null?void 0:b.formReference)==null||y.validate(_=>{_||(u.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:p,validationFieldResultData:d.value,callback:C=>{C?l.value.product=C:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(M.noop)},f.value),m=()=>{h.value=!0,r("submit",l.value,d.value,()=>{h.value=!1})};return i.watch(()=>n.cartItem,p=>{l.value=p},{deep:!0}),(p,b)=>{const y=po;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(Sd,{show:a.value,"onUpdate:show":b[0]||(b[0]=_=>a.value=_),"height-overlaps":t.settings.heightOverlaps,"width-overlaps":t.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),i.createElementVNode("div",Xy,[o.value?(i.openBlock(),i.createBlock(i.unref(A.NDrawer),{key:1,show:s.value,"onUpdate:show":b[4]||(b[4]=_=>s.value=_),"default-width":375,resizable:""},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NDrawerContent),null,{header:i.withCtx(()=>[i.createVNode(i.unref(A.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:b[2]||(b[2]=_=>s.value=!1)},{default:i.withCtx(()=>[i.createVNode(y)]),_:1})]),default:i.withCtx(()=>[i.createVNode(Hs,{"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:b[3]||(b[3]=_=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(i.openBlock(),i.createBlock(Hs,{key:0,"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:b[1]||(b[1]=_=>a.value=!0)},null,8,["configurator-params","settings"])),i.createVNode(Cd,{ref:"mosquito-configurator-form",value:l.value,"onUpdate:value":b[5]||(b[5]=_=>l.value=_),validation:d.value,settings:t.settings,"is-product-searching":u.value,"is-submit-processing":h.value,"onUpdate:params":b[6]||(b[6]=_=>i.unref(g)(_)),onSubmit:b[7]||(b[7]=_=>m()),"onClick:instructionsToggle":b[8]||(b[8]=_=>a.value=!a.value),"onClick:showPreviewDrawer":b[9]||(b[9]=_=>s.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),Uy={},Td=i.defineComponent({...Uy,__name:"strip-configurator-line-item",props:{value:{},index:{},path:{},settings:{},product:{default:void 0},addLineButtonDisabled:{type:Boolean,default:!1},removeLineButtonDisabled:{type:Boolean,default:!1},suggestionOption:{default:void 0},autoFocus:{type:Boolean,default:!1},validation:{}},emits:["update:value","click:add-line","click:remove-line"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.useTemplateRef("width-input-element"),a=i.ref(!1),l=i.ref(r.value),c=i.useTemplateRef("form-item-reference"),d=i.computed(()=>{var f;return!((f=c.value)!=null&&f.validationErrored)}),u=f=>{l.value=f,o("update:value",f,r.index,a)},h=()=>{var f;(f=s.value)==null||f.select()};return i.watch(()=>r.value,f=>{l.value=f}),i.onMounted(()=>{r.autoFocus&&i.nextTick(()=>{h()})}),e({isValid:d,formItemReference:c}),(f,g)=>{const m=sl,p=Hr;return i.openBlock(),i.createBlock(i.unref(A.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(ur,{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(A.NDropdown),{trigger:"click",options:t.suggestionOption,placement:"bottom-start",size:"large",onSelect:u},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{ref:"width-input-element",value:l.value??null,class:"w-full","show-button":!1,parse:i.unref(rt),placeholder:"Введите ширину",onKeydown:g[0]||(g[0]=b=>i.unref(nt)(b)),onInput:g[1]||(g[1]=b=>i.unref(tt)(t.validation,`linesWidths.${t.index}`)),onFocus:i.unref(Le),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),i.createVNode(i.unref(A.NButton),{disabled:t.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:g[2]||(g[2]=b=>o("click:add-line",t.index))},{default:i.withCtx(()=>[i.createVNode(m)]),_:1},8,["disabled"]),i.createVNode(i.unref(A.NButton),{disabled:t.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:g[3]||(g[3]=b=>o("click:remove-line",t.index))},{default:i.withCtx(()=>[i.createVNode(p)]),_:1},8,["disabled"])]),_:1},8,["path","label"])}}}),Ky={class:"my-2 flex w-full flex-col"},Gy={key:1},Zy={class:"text-lg font-semibold"},Qy={class:"flex gap-3"},Jy={},Nd=i.defineComponent({...Jy,__name:"strip-configurator-form",props:{value:{},settings:{},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:add-line","click:remove-line"],setup(t,{expose:e,emit:n}){var _;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("line-items-reference"),l=i.ref(M.cloneDeep(r.value)),c=i.computed(()=>{const C={length:[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(r.settings.lengthStep),He.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]};return M.forEach(l.value,(x,N)=>{var $;C[`configuratorParams.linesWidths.${N}`]=[ae.required,ae.min(r.settings.minLineWidth),ae.step(r.settings.lineWidthStep),He.serverValidation(($=r.validation[`linesWidths.${N}`])==null?void 0:$.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),f=i.computed(()=>!r.value.some(({product:C})=>!C||C.isNewRec())),g=i.computed(()=>r.isSubmitProcessing||!f.value||h.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(C=>C.product.isNewRec())),m=i.computed(()=>C=>h.value===0?void 0:[{label:`${(h.value>0?"Остаток +":"Излишек ")+h.value} мм.`,key:h.value+C}]),p=i.computed(()=>{const{length:C}=r.value[0];return!C||u.value!==r.settings.width?null:(M.reduce(r.value,(N,$)=>{var v;const w=((v=$.product)==null?void 0:v.costRub)||0;return N+w},0)*r.value[0].quantity*C).toLocaleString("ru-ru",{minimumFractionDigits:2})}),b=(C,x,N)=>{var w,v,k;l.value[x].product.id=-1;const{configuratorParams:$}=l.value[x];$.linesWidths[x]=C,y("configuratorParams",$),(k=(v=(w=a.value)==null?void 0:w.at(x))==null?void 0:v.formItemReference)==null||k.validate().catch(M.noop),i.nextTick(()=>{var B,R;(R=(B=a.value)==null?void 0:B.at(x))!=null&&R.isValid&&o("update:params",$,x,N)})},y=(C,x)=>{l.value.forEach(N=>{N[C]=x}),o("update:value",l.value)};return i.watch(()=>r.value,C=>{l.value=M.cloneDeep(C)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(C,x)=>{const N=A.NCheckbox;return i.openBlock(),i.createBlock(i.unref(A.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($=>o("submit",l.value),["prevent"]),["enter"]))},{default:i.withCtx(()=>{var $;return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(w,v)=>{var k,B;return i.openBlock(),i.createBlock(Td,{key:v,ref_for:!0,ref:"line-items-reference",value:((k=w.configuratorParams)==null?void 0:k.linesWidths.at(v))??null,"auto-focus":!0,index:v,path:`configuratorParams.linesWidths.${v}`,product:w.product,settings:t.settings,validation:t.validation,"suggestion-option":m.value(((B=w.configuratorParams)==null?void 0:B.linesWidths.at(v))??0),"add-line-button-disabled":h.value<=0||t.value.length>=t.settings.maxLinesCount||t.value.some(R=>R.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"onUpdate:value":b,"onClick:addLine":x[0]||(x[0]=R=>o("click:add-line",R)),"onClick:removeLine":x[1]||(x[1]=R=>o("click:remove-line",R))},null,8,["value","index","path","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled"])}),128)),i.createElementVNode("div",Ky,[h.value<0?(i.openBlock(),i.createBlock(i.unref(A.NText),{key:0,type:"error"},{default:i.withCtx(()=>[i.createTextVNode(" Сумма ширин всех полос должна быть равна "+i.toDisplayString(t.settings.width),1)]),_:1})):i.createCommentVNode("",!0),f.value&&l.value.length===t.settings.maxLinesCount&&h.value>0?(i.openBlock(),i.createBlock(i.unref(A.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(A.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(A.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(A.NFormItem),{path:"length",label:`Метраж ${t.settings.minLength?" от "+t.settings.minLength:""} ${t.settings.maxLength?" до "+t.settings.maxLength:""} м.`},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:l.value[0].length,"onUpdate:value":[x[3]||(x[3]=w=>l.value[0].length=w),x[6]||(x[6]=w=>y("length",w))],parse:i.unref(rt),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:x[4]||(x[4]=w=>i.unref(nt)(w,!1)),onInput:x[5]||(x[5]=w=>i.unref(tt)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(A.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:l.value[0].quantity,"onUpdate:value":[x[7]||(x[7]=w=>l.value[0].quantity=w),x[10]||(x[10]=w=>y("quantity",w))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:x[8]||(x[8]=w=>i.unref(nt)(w,!1)),onInput:x[9]||(x[9]=w=>i.unref(tt)(t.validation,"quantity")),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(A.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInput),{value:l.value[0].marker??null,placeholder:"Введите маркировку",onInput:x[11]||(x[11]=w=>i.unref(tt)(t.validation,"marker")),"onUpdate:value":x[12]||(x[12]=w=>{l.value[0].marker=w??null,y("marker",w??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(N,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":x[13]||(x[13]=w=>{l.value[0].isAdditionalSale=w??!1,y("isAdditionalSale",w??!1)})},{default:i.withCtx(()=>[...x[19]||(x[19]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),p.value?(i.openBlock(),i.createElementBlock("div",Gy,[x[20]||(x[20]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",Zy,i.toDisplayString(p.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",Qy,[i.createVNode(i.unref(A.NButton),{loading:t.isSubmitProcessing,disabled:!f.value||h.value!=0||!(($=l.value[0])!=null&&$.length)||l.value[0].length>t.settings.maxLength||l.value[0].length<t.settings.minLength||l.value[0].quantity===0,type:"primary",class:"self-start",onClick: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"])}}}),e0={class:"flex grow flex-col"},t0=["src"],n0={class:"w-full"},i0={},$d=i.defineComponent({...i0,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",e0,[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,t0),i.createElementVNode("div",n0,[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)])]))}}),r0={class:"flex flex-col gap-2"},o0={class:"w-104 flex grow flex-col px-5"},s0={},Rd=i.defineComponent({...s0,__name:"strip-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["submit","click:view-switch"],setup(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("strip-configurator-form"),s=i.ref(n.cartItems),a=i.ref({width:{},length:{},quantity:{},marker:{}}),l=i.ref(!1),c=i.computed(()=>i.inject("debounce-input-time",300)),d=i.computed(()=>{var m;return(m=s.value[0].configuratorParams)==null?void 0:m.linesWidths.reduce((p,b)=>(p??0)+(b??0),0)}),u=m=>{m===void 0&&(m=s.value.length-1);const p=s.value.at(0);if(!p)return;p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(m+1,0,null),s.value.forEach(y=>{y.configuratorParams.linesWidths=p.configuratorParams.linesWidths});const b=new j.OrderItemBase({quantity:(p==null?void 0:p.quantity)??1,category:p==null?void 0:p.category,length:(p==null?void 0:p.length)??n.settings.minLength,marker:p==null?void 0:p.marker,configuratorParams:{linesWidths:p==null?void 0:p.configuratorParams.linesWidths}});s.value=s.value.toSpliced(m+1,0,b)},h=m=>{const p=s.value.at(0);p&&(p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(m,1),s.value.forEach(b=>{b.configuratorParams.linesWidths=p.configuratorParams.linesWidths}),s.value=s.value.toSpliced(m,1),delete a[`linesWidths.${m}`],delete a[`linesWidths.${m}`])},f=M.debounce(async(m,p,b)=>{const y={linesWidths:m.linesWidths.at(p)};b.value=!0,a.value[`linesWidths.${p}`]={},s.value[p].product=new j.ClientProduct,n.eventEmitter.emit("configurator:search-product",{category:s.value[p].category,params:y,validationFieldResultData:a.value,callback:_=>{_?(s.value[p].product=_,p===s.value.length-1&&s.value.length<n.settings.maxLinesCount&&d.value&&d.value<n.settings.width&&u()):(s.value[p].product=new j.ClientProduct,a.value[`linesWidths.${p}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},b.value=!1),b.value=!1}})},c.value),g=async()=>{var m,p;(p=(m=o.value)==null?void 0:m.formReference)==null||p.validate(b=>{if(!b){l.value=!0;const y=s.value.at(0);if(!y)return;r("submit",y,a.value,()=>{l.value=!1,i.nextTick(()=>{var _,C;(C=(_=o.value)==null?void 0:_.formReference)==null||C.restoreValidation()})})}}).catch(M.noop)};return i.watch(()=>n.cartItems,m=>{s.value=m.map(p=>new j.OrderItemBase(p))}),(m,p)=>{const b=A.NButton;return i.openBlock(),i.createElementBlock("div",r0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(b,{key:0,type:"tertiary",class:"self-center",onClick:p[0]||(p[0]=y=>r("click:view-switch"))},{default:i.withCtx(()=>[...p[3]||(p[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",o0,[i.createVNode($d,{value:s.value,"onUpdate:value":p[1]||(p[1]=y=>s.value=y),settings:t.settings},null,8,["value","settings"]),i.createVNode(Nd,{ref:"strip-configurator-form",value:s.value,"onUpdate:value":p[2]||(p[2]=y=>s.value=y),validation:a.value,settings:t.settings,"is-submit-processing":l.value,"onUpdate:params":i.unref(f),onSubmit:g,"onClick:addLine":u,"onClick:removeLine":h},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),a0={class:"flex flex-col gap-3"},l0={},Ed=i.defineComponent({...l0,__name:"metal-for-doors-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit"],setup(t,{expose:e,emit:n}){var g;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("first-input-element"),l=i.ref(M.cloneDeep(r.value)),c=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth),...r.settings.maxWidth?[ae.max(r.settings.maxWidth)]:[],ae.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(1),He.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),d=i.ref(r.settings.canSetDopProdaga??!1),u=()=>{o("update:params",l.value.configuratorParams),h("configuratorParams",l.value.configuratorParams)},h=(m,p)=>{const b=new j.OrderItemBase(r.value);b[m]=p,m==="configuratorParams"&&(b.product=new j.ClientProduct),o("update:value",b)},f=()=>{var m;(m=a.value)==null||m.select()};return i.watch(()=>r.value,m=>{l.value=M.cloneDeep(m)},{deep:!0}),i.onMounted(()=>{r.value.isNewRec()&&i.nextTick(()=>{f()})}),e({validate:(g=s.value)==null?void 0:g.validate,formReference:s}),(m,p)=>{const b=A.NCheckbox;return i.openBlock(),i.createBlock(i.unref(A.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(y=>o("submit",l.value),["prevent"]),["enter"]))},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NFormItem),{path:"configuratorParams.width",label:`Ширина, ${t.settings.minWidth?" от "+t.settings.minWidth:""}${t.settings.maxWidth?" до "+t.settings.maxWidth:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{ref:"first-input-element",value:l.value.configuratorParams.width,"onUpdate:value":[p[0]||(p[0]=y=>l.value.configuratorParams.width=y),u],class:"w-full",parse:i.unref(rt),"show-button":!1,placeholder:"Введите ширину",onKeydown:p[1]||(p[1]=y=>i.unref(nt)(y)),onInput:p[2]||(p[2]=y=>i.unref(tt)(t.validation,"width")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(A.NFormItem),{path:"configuratorParams.length",label:`Длина, ${t.settings.minLength?" от "+t.settings.minLength:""}${t.settings.maxLength?" до "+t.settings.maxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[p[3]||(p[3]=y=>l.value.configuratorParams.length=y),u],placeholder:"Введите длину",parse:i.unref(rt),"show-button":!1,class:"w-full",onKeydown:p[4]||(p[4]=y=>i.unref(nt)(y)),onInput:p[5]||(p[5]=y=>i.unref(tt)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(A.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:t.value.quantity,placeholder:"Введите количество",min:1,"show-button":!1,class:"w-full",onKeydown:p[6]||(p[6]=y=>i.unref(nt)(y,!1)),onInput:p[7]||(p[7]=y=>i.unref(tt)(t.validation,"quantity")),"onUpdate:value":p[8]||(p[8]=y=>h("quantity",y??0)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(A.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInput),{value:t.value.marker??null,placeholder:"Введите маркировку",onInput:p[9]||(p[9]=y=>i.unref(tt)(t.validation,"marker")),"onUpdate:value":p[10]||(p[10]=y=>h("marker",y??null)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(b,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":p[11]||(p[11]=y=>{l.value.isAdditionalSale=y??!1,h("isAdditionalSale",y??!1)})},{default:i.withCtx(()=>[...p[14]||(p[14]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(ur,{"is-product-searching":t.isProductSearching,product:t.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),i.createElementVNode("div",a0,[i.createVNode(i.unref(A.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]=y=>o("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["model","rules","disabled"])}}}),c0={class:"flex flex-col gap-2 w-72"},d0={},Pd=i.defineComponent({...d0,__name:"metal-for-doors-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("metal-for-doors-configurator-form"),s=i.ref(n.cartItem),a=i.ref({width:{},length:{},quantity:{},marker:{}}),l=i.ref(!1),c=i.ref(!1),d=i.computed(()=>i.inject("debounce-input-time",300)),u=M.debounce(async f=>{var g,m;s.value.product=new j.ClientProduct,(m=(g=o.value)==null?void 0:g.formReference)==null||m.validate(p=>{p||(l.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:f,validationFieldResultData:a.value,callback:b=>{b?s.value.product=b:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(M.noop)},d.value),h=async()=>{var f,g;(g=(f=o.value)==null?void 0:f.formReference)==null||g.validate(m=>{m||(c.value=!0,r("submit",s.value,a.value,()=>{c.value=!1,i.nextTick(()=>{var p,b;(b=(p=o.value)==null?void 0:p.formReference)==null||b.restoreValidation()})}))}).catch(M.noop)};return i.watch(()=>n.cartItem,f=>{s.value=new j.OrderItemBase(f)},{deep:!0}),(f,g)=>{const m=A.NButton;return i.openBlock(),i.createElementBlock("div",c0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(m,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=p=>r("click:view-switch"))},{default:i.withCtx(()=>[...g[4]||(g[4]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Ed,{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"])])}}}),u0={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function h0(t,e){return i.openBlock(),i.createElementBlock("svg",u0,[...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 Fd=i.markRaw({name:"ion-add",render:h0}),f0={key:0,class:"-mt-1 text-sm text-gray-500"},m0={class:"font-bold"},g0={class:"flex flex-col gap-3"},p0={key:0,class:"mt-4 flex flex-col gap-1.5"},y0={class:"flex flex-col gap-1 text-sm text-gray-700"},b0={key:0},_0={key:1},w0={"form-array-name":"items",class:"flex flex-col gap-3"},x0={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},k0={key:0,class:"flex flex-wrap items-end gap-2"},v0={class:"whitespace-nowrap text-xl font-bold"},C0={key:0,class:"whitespace-nowrap text-lg text-gray-500"},S0={class:"font-bold"},B0={class:"font-bold"},T0={class:"flex gap-3"},N0={},Vd=i.defineComponent({...N0,__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 L;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.ref(M.cloneDeep(r.value)),l=i.ref({...r.validation}),c=H=>{var z;delete l.value[H],(z=s.value)==null||z.restoreValidation()};i.watch(()=>r.validation,H=>{l.value={...H},Object.values(H).some(O=>O==null?void 0:O.feedback)&&i.nextTick(()=>{var O;return(O=s.value)==null?void 0:O.validate(M.noop).catch(M.noop)})},{deep:!0});const d=i.computed(()=>r.value.category),u=i.ref(null),h=i.ref(null),f=i.computed(()=>d.value.products??[]),g=i.computed(()=>f.value.map(H=>({label:H.name,value:H.id}))),m=(H,z,O)=>{const U=H!=null&&H>0,K=z!=null&&z>0;return!U&&!K?null:U&&K?`от ${H} ${O} до ${z} ${O}`:U?`от ${H} ${O}`:`до ${z} ${O}`},p=i.computed(()=>{var H,z;return m(r.settings.minWidth,(z=(H=u.value)==null?void 0:H.properties)==null?void 0:z.width,"мм")}),b=i.computed(()=>{var H,z;return m(r.settings.minLength,(z=(H=u.value)==null?void 0:H.properties)==null?void 0:z.length,"мм")}),y=i.ref(null),_=i.ref(!1),C=i.computed(()=>{var z;const H={marker:[He.serverValidation((z=l.value.marker)==null?void 0:z.feedback)]};return a.value.configuratorParams.items.forEach((O,U)=>{var K,V,q,Y,ee,ue,ve;H[`configuratorParams.items.${U}.width`]=[ae.required,ae.min(r.settings.minWidth),...(V=(K=u.value)==null?void 0:K.properties)!=null&&V.width?[ae.max(u.value.properties.width)]:[],ae.step(1),He.serverValidation((q=l.value[`items.${U}.width`])==null?void 0:q.feedback)],H[`configuratorParams.items.${U}.length`]=[ae.required,ae.min(r.settings.minLength),...(ee=(Y=u.value)==null?void 0:Y.properties)!=null&&ee.length?[ae.max(u.value.properties.length)]:[],ae.step(1),He.serverValidation((ue=l.value[`items.${U}.length`])==null?void 0:ue.feedback)],H[`configuratorParams.items.${U}.count`]=[ae.required,ae.min(1),ae.step(1),He.serverValidation((ve=l.value[`items.${U}.count`])==null?void 0:ve.feedback)]}),H}),x=i.ref(r.settings.canSetDopProdaga??!1),N=i.computed(()=>a.value.configuratorParams.items.some(H=>{var z,O;return!u.value||!H.width||H.width<r.settings.minWidth||H.width>(((z=u.value.properties)==null?void 0:z.width)??0)||H.length===0||H.length<r.settings.minLength||H.length>(((O=u.value.properties)==null?void 0:O.length)??0)||!H.count||H.count<1})),$=i.computed(()=>!u.value||N.value||a.value.configuratorParams.items.length===0),w=i.ref(null),v=H=>{if(!H){u.value=null,h.value=null,a.value.product=new j.ClientProduct,y.value=null;return}const z=f.value.find(O=>O.id===H);z&&(u.value=z,h.value=H,a.value.product=z,te("product",a.value.product),a.value.configuratorParams.items.forEach(O=>{var U,K;(U=z.properties)!=null&&U.width&&O.width>z.properties.width&&(O.width=z.properties.width),(K=z.properties)!=null&&K.length&&O.length>z.properties.length&&(O.length=z.properties.length)}),B())};let k=!1;const B=()=>{k=!0,y.value=null,w.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},R=async()=>{var H;if(!u.value||a.value.configuratorParams.items.length===0||N.value){B();return}(H=s.value)==null||H.validate(z=>{if(z){B();return}if(_.value=!0,!u.value||!d.value){B(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:O=>{O?(y.value=O,a.value.configuratorParams.calculationId=O.id,a.value.quantity=O.quantity,i.nextTick(()=>{te("quantity",O.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,B()),te("configuratorParams",a.value.configuratorParams),E(),_.value=!1}})}).catch(()=>{B(),_.value=!1})},E=()=>{var z;if(!((z=u.value)!=null&&z.costRub)||!y.value){w.value=null;return}const H=y.value.quantity*u.value.costRub;w.value=Math.round(H*100)/100},P=H=>{var O,U;const z=a.value.configuratorParams.items[H];u.value&&((O=u.value.properties)!=null&&O.width&&z.width>u.value.properties.width&&(z.width=u.value.properties.width),(U=u.value.properties)!=null&&U.length&&z.length>u.value.properties.length&&(z.length=u.value.properties.length)),te("configuratorParams",a.value.configuratorParams),B()},W=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),te("configuratorParams",a.value.configuratorParams),B(),o("add-item",a.value.configuratorParams.items.length)},I=H=>{a.value.configuratorParams.items.splice(H,1),te("configuratorParams",a.value.configuratorParams),B(),o("remove-item",H)},Z=()=>{if(!($.value||_.value||r.isSubmitProcessing)){if(!y.value){R();return}o("submit",a.value)}},te=(H,z)=>{const O=new j.OrderItemBase(r.value);O[H]=z,o("update:value",O)};i.watch(()=>r.value,H=>{const z=M.cloneDeep(i.toRaw(H));(!z.configuratorParams.items||z.configuratorParams.items.length===0)&&(z.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=z,r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,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:H}=a.value.configuratorParams,z=a.value.quantity??0;H&&z>0&&a.value.product&&!a.value.product.isNewRec()&&(y.value={id:H,quantity:z,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:(L=s.value)==null?void 0:L.validate,formReference:s}),(H,z)=>{const O=Hr,U=Fd;return i.openBlock(),i.createBlock(i.unref(A.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 K;return[i.createVNode(i.unref(A.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NSelect),{value:h.value,"onUpdate:value":[z[0]||(z[0]=V=>h.value=V),v],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((K=u.value)==null?void 0:K.costRub)!=null?(i.openBlock(),i.createElementBlock("div",f0,[i.createElementVNode("span",m0,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",g0,[u.value?(i.openBlock(),i.createElementBlock("div",p0,[z[7]||(z[7]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",y0,[p.value?(i.openBlock(),i.createElementBlock("div",b0,"Ширина "+i.toDisplayString(p.value)+".",1)):i.createCommentVNode("",!0),b.value?(i.openBlock(),i.createElementBlock("div",_0,"Длина "+i.toDisplayString(b.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",w0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value.configuratorParams.items,(V,q)=>(i.openBlock(),i.createElementBlock("div",{key:q,class:"flex grow gap-2"},[i.createElementVNode("div",x0,[i.createVNode(i.unref(A.NFormItem),{path:`configuratorParams.items.${q}.width`,label:"Ширина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:a.value.configuratorParams.items[q].width,"onUpdate:value":[Y=>a.value.configuratorParams.items[q].width=Y,Y=>P(q)],parse:i.unref(rt),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:z[1]||(z[1]=Y=>i.unref(nt)(Y)),onInput:Y=>c(`items.${q}.width`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(A.NFormItem),{path:`configuratorParams.items.${q}.length`,label:"Длина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:a.value.configuratorParams.items[q].length,"onUpdate:value":[Y=>a.value.configuratorParams.items[q].length=Y,Y=>P(q)],parse:i.unref(rt),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:z[2]||(z[2]=Y=>i.unref(nt)(Y)),onInput:Y=>c(`items.${q}.length`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(A.NFormItem),{path:`configuratorParams.items.${q}.count`,label:"Количество, шт"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:a.value.configuratorParams.items[q].count,"onUpdate:value":[Y=>a.value.configuratorParams.items[q].count=Y,Y=>P(q)],parse:i.unref(rt),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:z[3]||(z[3]=Y=>i.unref(nt)(Y,!1)),onInput:Y=>c(`items.${q}.count`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),i.createVNode(i.unref(A.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:Y=>I(q)},{default:i.withCtx(()=>[i.createVNode(O)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(i.openBlock(),i.createBlock(i.unref(A.NButton),{key:1,disabled:N.value,type:"default",class:"self-center",onClick:W},{default:i.withCtx(()=>[i.createVNode(U),z[8]||(z[8]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0)]),i.createVNode(i.unref(A.NFormItem),{path:"marker",label:"Маркировка распила"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInput),{value:a.value.marker??null,disabled:!u.value,placeholder:"Введите маркировку распила",onInput:z[4]||(z[4]=V=>c("marker")),"onUpdate:value":z[5]||(z[5]=V=>te("marker",V??null)),onFocus:i.unref(Le)},null,8,["value","disabled","onFocus"])]),_:1}),x.value?(i.openBlock(),i.createBlock(i.unref(A.NCheckbox),{key:1,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":z[6]||(z[6]=V=>{a.value.isAdditionalSale=V??!1,te("isAdditionalSale",V??!1)})},{default:i.withCtx(()=>[...z[9]||(z[9]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(i.unref(A.NSpin),{show:_.value,size:"small",class:"grow"},{default:i.withCtx(()=>{var V;return[y.value&&u.value&&w.value?(i.openBlock(),i.createElementBlock("div",k0,[i.createElementVNode("div",null,[z[10]||(z[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",v0,i.toDisplayString(w.value.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol),1)]),y.value.quantity&&u.value?(i.openBlock(),i.createElementBlock("div",C0,[i.createElementVNode("span",S0,"("+i.toDisplayString(y.value.quantity)+" шт.",1),z[11]||(z[11]=i.createTextVNode(" x ",-1)),i.createElementVNode("span",B0,i.toDisplayString((V=u.value.costRub)==null?void 0:V.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]}),_:1},8,["show"]),i.createElementVNode("div",T0,[y.value&&!_.value?(i.openBlock(),i.createBlock(i.unref(A.NButton),{key:0,loading:t.isSubmitProcessing,disabled:$.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(A.NButton),{key:1,loading:_.value,disabled:$.value||_.value,type:"info",class:"self-start",onClick:R},{default:i.withCtx(()=>[...z[12]||(z[12]=[i.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules","onKeydown"])}}}),$0={class:"flex flex-col gap-2"},R0={class:"w-104 flex grow flex-col px-5"},E0={},Md=i.defineComponent({...E0,__name:"sandwich-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("sandwich-configurator-form"),s=i.ref(n.cartItem),a=i.ref({width:{},length:{},quantity:{},marker:{},product:{}}),l=i.ref(!1),c=async()=>{var h,f;(f=(h=o.value)==null?void 0:h.formReference)==null||f.validate(g=>{if(!g){l.value=!0;const m=M.cloneDeep(s.value);"items"in m.configuratorParams&&delete m.configuratorParams.items,r("submit",m,a.value,()=>{l.value=!1,i.nextTick(()=>{var p,b;(b=(p=o.value)==null?void 0:p.formReference)==null||b.restoreValidation()})})}}).catch(M.noop)},d=h=>{a.value[`items.${h}.width`]={},a.value[`items.${h}.length`]={},a.value[`items.${h}.count`]={}},u=h=>{delete a.value[`items.${h}.width`],delete a.value[`items.${h}.length`],delete a.value[`items.${h}.count`]};return i.onMounted(()=>{n.cartItem.configuratorParams.items.forEach((h,f)=>{a.value[`items.${f}.width`]={},a.value[`items.${f}.length`]={},a.value[`items.${f}.count`]={}})}),i.watch(()=>n.cartItem,h=>{s.value=new j.OrderItemBase(h)},{deep:!0}),(h,f)=>{const g=A.NButton;return i.openBlock(),i.createElementBlock("div",$0,[t.settings.allowShowTable&&s.value.isNewRec()?(i.openBlock(),i.createBlock(g,{key:0,type:"tertiary",class:"self-center",onClick:f[0]||(f[0]=m=>r("click:view-switch"))},{default:i.withCtx(()=>[...f[2]||(f[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",R0,[i.createVNode(Vd,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":f[1]||(f[1]=m=>s.value=m),validation:a.value,settings:t.settings,"event-emitter":t.eventEmitter,"is-submit-processing":l.value,onSubmit:c,onAddItem:d,onRemoveItem:u},null,8,["value","validation","settings","event-emitter","is-submit-processing"])])])}}}),P0={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function F0(t,e){return i.openBlock(),i.createElementBlock("svg",P0,[...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 V0=i.markRaw({name:"ion-checkmark",render:F0}),M0={key:0,class:"-mt-1 text-sm text-gray-500"},A0={class:"font-bold"},I0={class:"flex flex-col gap-3"},O0={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},z0={class:"flex flex-col gap-1 text-sm text-gray-700"},D0={key:0},L0={key:1},H0={"form-array-name":"items",class:"flex flex-col gap-3"},W0={class:"min-w-0 flex-1"},j0={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},q0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},X0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},Y0={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},U0={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},K0={key:0,class:"lg:!flex-[2]"},G0={class:"font-bold"},Z0={key:1,class:"lg:!flex-[3]"},Q0={class:"font-bold"},J0={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"},eb={key:0},tb={class:"font-bold"},nb={key:1},ib={class:"font-bold"},rb={class:"flex flex-wrap items-center gap-3"},ob={},Ad=i.defineComponent({...ob,__name:"sandwich-m2-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},itemStates:{default:()=>[]}},emits:["submit","update:value","add-item","remove-item","item-reset"],setup(t,{expose:e,emit:n}){var K;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("widthInputs"),l=r.value==null?[]:M.cloneDeep(i.toRaw(r.value)),c=i.ref(l.map(V=>new j.OrderItemBase(V))),d=i.computed(()=>({items:c.value})),u=i.ref({...r.validation}),h=V=>{var q;delete u.value[V],(q=s.value)==null||q.restoreValidation()},f=i.ref(null),g=i.ref(null),m=i.computed(()=>{var V,q;return((q=(V=c.value[0])==null?void 0:V.category)==null?void 0:q.products)??[]}),p=i.computed(()=>m.value.map(V=>({label:V.name,value:V.id}))),b=(V,q,Y)=>{const ee=V!=null&&V>0,ue=q!=null&&q>0;return!ee&&!ue?null:ee&&ue?`от ${V} ${Y} до ${q} ${Y}`:ee?`от ${V} ${Y}`:`до ${q} ${Y}`},y=i.computed(()=>{var V,q;return b(r.settings.minWidth,(q=(V=f.value)==null?void 0:V.properties)==null?void 0:q.width,"мм")}),_=i.computed(()=>{var V,q;return b(r.settings.minLength,(q=(V=f.value)==null?void 0:V.properties)==null?void 0:q.length,"мм")}),C=i.computed(()=>{const V={};return c.value.forEach((q,Y)=>{var ee,ue,ve,Te,We,ce,pt,Ne;V[`items.${Y}.configuratorParams.width`]=[ae.required,ae.min(r.settings.minWidth),...(ue=(ee=f.value)==null?void 0:ee.properties)!=null&&ue.width?[ae.max(f.value.properties.width)]:[],ae.step(1),He.serverValidation((ve=u.value[`items.${Y}.width`])==null?void 0:ve.feedback)],V[`items.${Y}.configuratorParams.length`]=[ae.required,ae.min(r.settings.minLength),...(We=(Te=f.value)==null?void 0:Te.properties)!=null&&We.length?[ae.max(f.value.properties.length)]:[],ae.step(1),He.serverValidation((ce=u.value[`items.${Y}.length`])==null?void 0:ce.feedback)],V[`items.${Y}.quantity`]=[ae.required,ae.min(1),ae.step(1),He.serverValidation((pt=u.value[`items.${Y}.quantity`])==null?void 0:pt.feedback)],V[`items.${Y}.marker`]=[He.serverValidation((Ne=u.value[`items.${Y}.marker`])==null?void 0:Ne.feedback)]}),V});i.watch(()=>r.validation,V=>{u.value={...V},Object.values(V).some(Y=>Y==null?void 0:Y.feedback)&&i.nextTick(()=>{var Y;return(Y=s.value)==null?void 0:Y.validate(M.noop).catch(M.noop)})},{deep:!0});const x=i.ref(r.settings.canSetDopProdaga??!1),N=i.computed(()=>{const V=f.value;return V?c.value.some(q=>{var ve,Te;const Y=q.configuratorParams,ee=(ve=V.properties)==null?void 0:ve.width,ue=(Te=V.properties)==null?void 0:Te.length;return Y.width===0||Y.width<r.settings.minWidth||ee!=null&&Y.width>ee||Y.length===0||Y.length<r.settings.minLength||ue!=null&&Y.length>ue||q.quantity===0||q.quantity<1}):!0}),$=i.computed(()=>!f.value||N.value||c.value.length===0),w=i.computed(()=>{const V=c.value[0];return V!=null&&!V.isNewRec()}),v=V=>r.itemStates[V]??"idle",k=V=>v(V)==="success",B=V=>v(V)==="loading",R=i.computed(()=>c.value.length===0?!0:c.value.every((V,q)=>{const Y=v(q);return Y==="success"||Y==="loading"})),E=V=>V.width===0||V.length===0?0:V.width*V.length/1e6,P=V=>{var ve;const q=V.configuratorParams,Y=E(q),ee=((ve=f.value)==null?void 0:ve.costRub)??0,ue=V.quantity??0;return!Y||!ue?0:Math.round(Y*ee*ue*100)/100},W=i.computed(()=>M.sum(c.value.map(V=>{const q=V.configuratorParams;return!q.width||q.length===0||!V.quantity?0:q.width*q.length*V.quantity/1e6}))),I=i.computed(()=>Math.round(M.sum(c.value.map(V=>P(V)))*100)/100),Z=()=>{var V,q,Y;return new j.OrderItemBase({category:(V=c.value[0])==null?void 0:V.category,configurator:(q=c.value[0])==null?void 0:q.configurator,product:f.value??new j.ClientProduct,quantity:1,isAdditionalSale:(Y=c.value[0])==null?void 0:Y.isAdditionalSale,configuratorParams:{width:0,length:0}})},te=V=>{if(!V){f.value=null,g.value=null,c.value.forEach(Y=>{Y.product=new j.ClientProduct}),o("update:value",c.value);return}const q=m.value.find(Y=>Y.id===V);q&&(f.value=q,g.value=V,c.value.forEach((Y,ee)=>{var ue,ve;Y.product=q,(ue=q.properties)!=null&&ue.width&&Y.configuratorParams.width>q.properties.width&&(Y.configuratorParams.width=q.properties.width),(ve=q.properties)!=null&&ve.length&&Y.configuratorParams.length>q.properties.length&&(Y.configuratorParams.length=q.properties.length),o("item-reset",ee)}),o("update:value",c.value))},D=V=>{var ee,ue;const q=c.value[V],Y=f.value;Y&&((ee=Y.properties)!=null&&ee.width&&q.configuratorParams.width>Y.properties.width&&(q.configuratorParams.width=Y.properties.width),(ue=Y.properties)!=null&&ue.length&&q.configuratorParams.length>Y.properties.length&&(q.configuratorParams.length=Y.properties.length)),o("item-reset",V),o("update:value",c.value)},L=(V,q)=>{c.value[V].marker=q===null||q===""?void 0:q,o("item-reset",V),o("update:value",c.value)},H=V=>{c.value.forEach(q=>{q.isAdditionalSale=V}),o("update:value",c.value)},z=()=>{c.value.push(Z()),o("update:value",c.value),o("add-item",c.value.length),i.nextTick(()=>{var q,Y,ee,ue;const V=c.value.length-1;(Y=(q=a.value)==null?void 0:q[V])==null||Y.focus(),(ue=(ee=a.value)==null?void 0:ee[V])==null||ue.select()})},O=V=>{c.value.splice(V,1),o("update:value",c.value),o("remove-item",V)};i.watch(()=>r.value,V=>{var ue;const Y=(V==null?[]:M.cloneDeep(i.toRaw(V))).map(ve=>new j.OrderItemBase(ve));c.value=Y.length>0?Y:[Z()];const ee=(ue=c.value[0])==null?void 0:ue.product;ee&&!ee.isNewRec()?(f.value=ee,g.value=ee.id):(f.value=null,g.value=null)},{deep:!0});const U=()=>{var q;if(f.value!==null)return;const V=(q=m.value[0])==null?void 0:q.id;V!=null&&te(V)};return i.watch(m,()=>{U()}),i.onMounted(()=>{var q;c.value.length===0&&(c.value=[Z()]);const V=(q=c.value[0])==null?void 0:q.product;V&&!V.isNewRec()&&(f.value=V,g.value=V.id),U()}),e({validate:(K=s.value)==null?void 0:K.validate,formReference:s}),(V,q)=>{const Y=V0,ee=Hr,ue=Fd;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(A.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(A.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NSelect),{value:g.value,"onUpdate:value":[q[0]||(q[0]=We=>g.value=We),te],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((ve=f.value)==null?void 0:ve.costRub)!=null?(i.openBlock(),i.createElementBlock("div",M0,[i.createElementVNode("span",A0,i.toDisplayString(f.value.code),1),i.createTextVNode(" — "+i.toDisplayString(f.value.costRub.toLocaleString())+" "+i.toDisplayString(f.value.currency.symbol)+"/м² ",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",I0,[f.value?(i.openBlock(),i.createElementBlock("div",O0,[q[6]||(q[6]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",z0,[y.value?(i.openBlock(),i.createElementBlock("div",D0,"Ширина "+i.toDisplayString(y.value)+".",1)):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createElementBlock("div",L0,"Длина "+i.toDisplayString(_.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",H0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value.items,(We,ce)=>{var pt;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",W0,[i.createElementVNode("div",j0,[i.createElementVNode("div",q0,[i.createVNode(i.unref(A.NFormItem),{path:`items.${ce}.configuratorParams.width`,label:"Ширина, мм",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.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(rt),"show-button":!1,disabled:!f.value||k(ce)||B(ce),placeholder:"Ширина",class:"w-full",onKeydown:q[1]||(q[1]=Ne=>i.unref(nt)(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(A.NFormItem),{path:`items.${ce}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:d.value.items[ce].configuratorParams.length,"onUpdate:value":[Ne=>d.value.items[ce].configuratorParams.length=Ne,Ne=>D(ce)],parse:i.unref(rt),"show-button":!1,disabled:!f.value||k(ce)||B(ce),placeholder:"Длина",class:"w-full",onKeydown:q[2]||(q[2]=Ne=>i.unref(nt)(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",X0,[i.createVNode(i.unref(A.NFormItem),{path:`items.${ce}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:d.value.items[ce].quantity,"onUpdate:value":[Ne=>d.value.items[ce].quantity=Ne,Ne=>D(ce)],parse:i.unref(rt),"show-button":!1,disabled:!f.value||k(ce)||B(ce),placeholder:"Кол-во",class:"w-full",onKeydown:q[3]||(q[3]=Ne=>i.unref(nt)(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(A.NFormItem),{path:`items.${ce}.marker`,label:"Маркировка",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInput),{value:d.value.items[ce].marker??null,disabled:!f.value||k(ce)||B(ce),placeholder:"Маркировка",class:"w-full",onInput:Ne=>h(`items.${ce}.marker`),"onUpdate:value":Ne=>L(ce,Ne??null),onFocus:i.unref(Le)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),B(ce)||k(ce)?(i.openBlock(),i.createElementBlock("div",Y0,[B(ce)?(i.openBlock(),i.createBlock(i.unref(A.NSpin),{key:0,size:14})):k(ce)?(i.openBlock(),i.createBlock(Y,{key:1,class:"text-green-600 text-xl"})):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),i.createElementVNode("div",U0,[We.configuratorParams.width>0&&We.configuratorParams.length>0?(i.openBlock(),i.createElementBlock("div",K0,[q[7]||(q[7]=i.createTextVNode(" Площадь (S) = ",-1)),i.createElementVNode("span",G0,i.toDisplayString(E(We.configuratorParams).toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),P(We)>0?(i.openBlock(),i.createElementBlock("div",Z0,[q[8]||(q[8]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",Q0,i.toDisplayString(P(We).toLocaleString())+" "+i.toDisplayString((pt=f.value)==null?void 0:pt.currency.symbol),1)])):i.createCommentVNode("",!0)])]),w.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(A.NButton),{key:0,disabled:B(ce)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:Ne=>O(ce)},{default:i.withCtx(()=>[i.createVNode(ee)]),_:1},8,["disabled","onClick"]))],2)}),128))]),f.value?(i.openBlock(),i.createElementBlock("div",J0,[W.value>0?(i.openBlock(),i.createElementBlock("div",eb,[q[9]||(q[9]=i.createTextVNode(" Общая площадь: ",-1)),i.createElementVNode("span",tb,i.toDisplayString(W.value.toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),I.value>0?(i.openBlock(),i.createElementBlock("div",nb,[q[10]||(q[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",ib,i.toDisplayString(I.value.toLocaleString())+" "+i.toDisplayString(f.value.currency.symbol),1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),x.value?(i.openBlock(),i.createBlock(i.unref(A.NCheckbox),{key:1,checked:((Te=c.value[0])==null?void 0:Te.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":q[4]||(q[4]=We=>H(We??!1))},{default:i.withCtx(()=>[...q[11]||(q[11]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createElementVNode("div",rb,[f.value&&!w.value?(i.openBlock(),i.createBlock(i.unref(A.NButton),{key:0,disabled:N.value,type:"default",onClick:z},{default:i.withCtx(()=>[i.createVNode(ue),q[12]||(q[12]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),i.createVNode(i.unref(A.NButton),{loading:t.isSubmitProcessing,disabled:$.value||R.value,type:"primary",class:"ml-auto",onClick:q[5]||(q[5]=We=>o("submit",c.value))},{default:i.withCtx(()=>{var We;return[i.createTextVNode(i.toDisplayString((We=c.value[0])!=null&&We.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[i.unref(Ga)]])}}}),sb={class:"flex flex-col gap-2"},ab={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},lb={},Id=i.defineComponent({...lb,__name:"sandwich-m2-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["click:view-switch","submit"],setup(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("sandwich-m2-configurator-form"),s=i.ref((n.cartItems??[]).map(C=>new j.OrderItemBase(C))),a=i.ref([]),l=i.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=C=>{c.forEach(x=>{l.value[`items.${C}.${x}`]={}})},u=C=>{c.forEach(x=>{delete l.value[`items.${C}.${x}`]})},h=i.computed(()=>a.value.includes("loading")),f=()=>({width:{},length:{},quantity:{},marker:{}}),g=(C,x)=>{let N=!1;return c.forEach($=>{var E,P;const w=`items.0.${$}`,v=(E=C[$])==null?void 0:E.feedback,B=((P=C[w])==null?void 0:P.feedback)??v,R=`items.${x}.${$}`;B?(l.value[R]=C[w]??C[$],N=!0):l.value[R]={}}),N},m=(C,x,N)=>new Promise($=>{const w=f();let v=!1;const k=B=>{if(v)return;v=!0;const R=g(w,x),E=(B===void 0?!R:B)&&!R;a.value[x]=E?"success":"error",i.nextTick(()=>{var P,W;(W=(P=o.value)==null?void 0:P.formReference)==null||W.restoreValidation()}),$(E)};a.value[x]="loading",r("submit",[M.cloneDeep(C)],w,k,{isFinalSuccessfulCompletion:N})}),p=async()=>{var N,$;try{await(($=(N=o.value)==null?void 0:N.formReference)==null?void 0:$.validate())}catch{return}const C=s.value.map((w,v)=>v).filter(w=>{const v=a.value[w]??"idle";return v!=="success"&&v!=="loading"});let x=!0;for(let w=0;w<C.length;w+=1){const v=C[w],k=s.value[v];if(!k)break;const R=w===C.length-1&&x;await m(k,v,R)||(x=!1)}},b=C=>{const x=C-1;a.value[x]="idle",d(x)},y=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(N=>new j.OrderItemBase(N));s.value=x,a.value=x.map(()=>"idle"),x.forEach((N,$)=>{d($)})},{deep:!0}),(C,x)=>{var $;const N=A.NButton;return i.openBlock(),i.createElementBlock("div",sb,[t.settings.allowShowTable&&(($=s.value[0])!=null&&$.isNewRec())?(i.openBlock(),i.createBlock(N,{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",ab,[i.createVNode(Ad,{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:b,onRemoveItem:y,onItemReset:_},null,8,["value","validation","settings","event-emitter","is-submit-processing","item-states"])])])}}}),cb={key:0,class:"flex justify-center p-4"},db={key:1,class:"p-4 text-center text-red-500"},ub={key:2,class:"flex justify-center"},hb={class:"!bg-white p-4 m-2 rounded-md w-max"},fb={key:3,class:"p-4 text-center text-gray-500"},mb={},Od=i.defineComponent({...mb,__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=f=>{const g=f.configuratorParams;return[new j.OrderItemBase({...f,quantity:f.quantity??1,marker:f.marker,configuratorParams:{width:(g==null?void 0:g.width)??f.width??0,length:(g==null?void 0:g.length)??f.length??0}})]},l=i.ref(e.editor===j.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var g,m,p;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const f={category:((g=e.cartItem)==null?void 0:g.category)??e.category,configurator:e.editor,quantity:1};switch(e.editor){case"kozyrek":{const b=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{length:b.stripMinLength,linesAngles:[],linesWidths:[],startTailType:M.some(b.startTailConfigs,y=>y.isDefault)?(m=b.startTailConfigs)==null?void 0:m.findIndex(y=>y.isDefault):void 0,endTailType:M.some(b.endTailConfigs,y=>y.isDefault)?(p=b.endTailConfigs)==null?void 0:p.findIndex(y=>y.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const b=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{width:0,height:0,netType:b.netType[0]||"",color:b.color[0]||"",mountType:b.mountType[0]||""}});break}case"strip":{const b=e.settings;s.value=[new j.OrderItemBase({...f,length:b.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const b=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{width:b.minWidth,length:b.minLength}});break}case"sandwich":{o.value=new j.OrderItemBase({...f,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new j.OrderItemBase({...f,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(f,g,m)=>{const p=b=>{m==null||m(),b&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:f,callback:p,validation:g})},u=(f,g,m,p)=>{const b=f[0];if(!b){m==null||m();return}const y=(p==null?void 0:p.isFinalSuccessfulCompletion)===!0,_=C=>{m==null||m(C),y&&C&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:b,callback:_,validation:g,additionalParams:p})},h=()=>{e.category&&e.eventEmitter.emit("configurator:click-view-switch",{category:e.category})};return i.onMounted(()=>{e.cartItem||c()}),(f,g)=>{const m=A.NSpin;return i.openBlock(),i.createElementBlock(i.Fragment,null,[n.value?(i.openBlock(),i.createElementBlock("div",cb,[i.createVNode(m,{size:"large"})])):r.value?(i.openBlock(),i.createElementBlock("div",db,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",ub,[i.createElementVNode("div",hb,[t.editor==="kozyrek"?(i.openBlock(),i.createBlock(vd,{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(Bd,{key:1,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="strip"?(i.openBlock(),i.createBlock(Rd,{key:2,"event-emitter":t.eventEmitter,settings:t.settings,"cart-items":s.value,"onClick:viewSwitch":h,onSubmit:d},null,8,["event-emitter","settings","cart-items"])):t.editor==="metal_for_doors"?(i.openBlock(),i.createBlock(Pd,{key:3,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":h,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="sandwich"?(i.openBlock(),i.createBlock(Md,{key:4,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":h,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="sandwich_m2"?(i.openBlock(),i.createBlock(Id,{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",fb,' Конфигуратор "'+i.toDisplayString(t.editor)+'" не поддерживается. ',1))],64)}}});function zd(t){return Object.values(j.ConfiguratorsEnum).includes(t)}function Dd(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.Sandwich?!0:t.properties.configuratorSettings!==void 0&&M.isArray(t.products)&&t.products.length>0}const gb={key:0,class:"pt-0.5"},pb={key:0},yb={class:"line-through"},bb={key:0},_b={key:1},wb={class:"flex flex-row gap-1"},xb={key:0},kb={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},vb={class:"flex flex-col gap-2.5 sm:flex-row"},Cb={class:"mt-2"},Sb={key:1,class:"flex flex-col"},Bb={},Tb=i.defineComponent({...Bb,__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(lr,"medium"),r=i.computed(()=>{var K;return(K=e==null?void 0:e.filteredItems)==null?void 0:K[e.categoryItem.id]}),o=i.computed(()=>{var K,V;return M.isArray((K=e.categoryItem)==null?void 0:K.categories)&&((V=e.categoryItem.categories)==null?void 0:V.length)>0}),s=i.computed(()=>{var K;return M.isArray((K=e.categoryItem)==null?void 0:K.products)?e.categoryItem.products:[]}),a=i.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([K,V])=>`${V} руб./${R(K)}`).join(", ")),l=i.computed(()=>M.isUndefined(e.filteredItems)||r.value==="*"?s.value:s.value.filter(K=>{var q;const V=(q=r.value)==null?void 0:q.products;return M.isArray(V)&&V.includes(K.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>M.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),u=i.computed(()=>M.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),h=i.computed(()=>M.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),f=i.computed(()=>M.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),g=i.computed(()=>{var K,V,q;return((K=e.categoryItem.properties)==null?void 0:K.configurator)!==void 0&&zd((V=e.categoryItem.properties)==null?void 0:V.configurator)&&Dd(e.categoryItem)&&((q=e.categoryItem.properties)==null?void 0:q.configuratorSettings)!==void 0&&(M.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),m=i.computed(()=>g.value&&(M.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),p=i.computed(()=>M.isNil(e.categoryContextButtonsConfig)?[]:M.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),b=i.computed(()=>new j.ClientCategory(e.categoryItem)),y=i.ref(!1),_=i.ref(!1),C=i.computed(()=>!M.isUndefined(e.isCategoryItemSelected)),x=i.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),N=i.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),$=i.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),w=i.computed(()=>z.value&&ot.getDeviceTypeByResolution()===Je.laptop?"auto":"fixed"),v=i.useTemplateRef("collapse-item-reference"),k=i.computed(()=>{var K,V;return(V=(K=e.categoryItem.properties)==null?void 0:K.templateCost)==null?void 0:V.priceCoefficient}),B=i.computed(()=>{var K,V;return(V=(K=e.categoryItem.properties)==null?void 0:K.templateCost)==null?void 0:V.increasePercent}),R=(K,V="ru-RU")=>0 .toLocaleString(V,{style:"currency",currency:K,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),E=K=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:K,target:v.value})},P=(K,V)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:V,isLoadingState:y,target:v.value})},W=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:v.value})},I=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:v.value})},Z=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:v.value})},te=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:v.value})},D=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:v.value})},L=K=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:K,target:v.value})},H=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},z=i.ref(0),O=i.computed(()=>z.value&&s.value.length>0?ng(s.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),U=M.debounce(()=>{z.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",U)}),window.addEventListener("resize",U),U(),(K,V)=>{const q=A.NCheckbox,Y=Mf,ee=A.NTooltip,ue=Pf,ve=A.NTag,Te=$f,We=Bf,ce=A.NButton,pt=vf,Ne=Ja,Vt=Qa,jt=Za,ln=jo,Bt=A.NDropdown,Hn=A.NDataTable,cn=A.NAlert,en=A.NSpin;return i.openBlock(),i.createBlock(el,{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",gb,[i.createVNode(q,{checked:x.value,indeterminate:$.value,disabled:N.value,"onUpdate:checked":E},null,8,["checked","indeterminate","disabled"])])):i.createCommentVNode("",!0),!d.value&&((Ve=b.value)!=null&&Ve.isDisabled)?(i.openBlock(),i.createBlock(ee,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(Y,{class:"pt-1.5"})]),default:i.withCtx(()=>[V[1]||(V[1]=i.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):i.createCommentVNode("",!0),((J=b.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(()=>[V[2]||(V[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=b.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(()=>[V[3]||(V[3]=i.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:V[0]||(V[0]=i.withModifiers((...it)=>i.unref(M.noop)&&i.unref(M.noop)(...it),["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&&B.value}),round:""},{default:i.withCtx(()=>{var it;return[i.createTextVNode(" Установленная стоимость: "+i.toDisplayString(t.categoryItem.properties.m2Price)+" руб./м2 ",1),(it=t.categoryItem.properties)!=null&&it.templateCost&&t.categoryItem.properties.m2PriceRetail&&B.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[B.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(()=>[B.value?(i.openBlock(),i.createElementBlock("span",pb,i.toDisplayString(B.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0),i.createVNode(ve,{size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createElementVNode("span",yb,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||B.value?(i.openBlock(),i.createBlock(ve,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>{var it;return[k.value?(i.openBlock(),i.createElementBlock("span",bb,i.toDisplayString((it=k.value)==null?void 0:it.name),1)):i.createCommentVNode("",!0),B.value?(i.openBlock(),i.createElementBlock("span",_b,i.toDisplayString(B.value>0?"+":"")+i.toDisplayString(B.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0)]}),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(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=b.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 it,qt;return[i.createElementVNode("span",wb,[i.createVNode(Te),i.createTextVNode(" "+i.toDisplayString((qt=(it=b.value)==null?void 0:it.manager)==null?void 0:qt.name),1)])]}),default:i.withCtx(()=>{var it,qt;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((qt=(it=b.value)==null?void 0:it.manager)==null?void 0:qt.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[t.showSlugs||t.showProperties?(i.openBlock(),i.createElementBlock("div",xb,[i.createElementVNode("ul",kb,[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",vb,[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=b.value)!=null&&J.isDisabled?(i.openBlock(),i.createBlock(Y,{key:1})):(i.openBlock(),i.createBlock(We,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var J;return[(J=b.value)!=null&&J.isDisabled?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" Скрыто для клиента"+i.toDisplayString(b.value.hidingComment?`. Причина: '${b.value.hidingComment}'`:""),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Видимо клиенту")],64))]}),_:1})):i.createCommentVNode("",!0),u.value&&!((Ve=b.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(pt)]),_:1},8,["size"])]),default:i.withCtx(()=>{var J,le,De;return[(J=b.value)!=null&&J.manager?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode('Категория закреплена за "'+i.toDisplayString(((De=(le=b.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=b.value)!=null&&J.isRequired?(i.openBlock(),i.createBlock(Vt,{key:1})):(i.openBlock(),i.createBlock(Ne,{key:0}))]}),_:1},8,["disabled","size"])]),default:i.withCtx(()=>[V[4]||(V[4]=i.createTextVNode(" Категория, которую нужно предлагать клиенту ",-1))]),_:1})):i.createCommentVNode("",!0),f.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(jt)]),_:1},8,["size"])]),default:i.withCtx(()=>[V[5]||(V[5]=i.createTextVNode(" Редактировать ",-1))]),_:1})):i.createCommentVNode("",!0),p.value.length>0?(i.openBlock(),i.createBlock(Bt,{key:4,options:p.value,size:i.unref(n),trigger:"click",onSelect:L},{default:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(ln)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(K.$slots,"default",{},()=>{var Ve,J,le;return[i.createElementVNode("div",Cb,[o.value?(i.openBlock(),i.createBlock(Hd,{key:0,"categories-items":t.categoryItem.categories??[],"has-products":c.value||y.value,"event-emitter":t.eventEmitter,"filtered-items":r.value?((Ve=r.value)==null?void 0:Ve.categories)??{}:void 0,"is-category-item-selected":t.isCategoryItemSelected,"show-slugs":t.showSlugs,"show-properties":t.showProperties,"allow-name-click":t.allowNameClick,"allow-price-click":t.allowPriceClick,"show-price-history":t.showPriceHistory,"show-cost-date":t.showCostDate,"show-category-required-button":t.showCategoryRequiredButton,"show-category-hide-for-client-button":t.showCategoryHideForClientButton,"show-category-pin-button":t.showCategoryPinButton,"show-category-edit-button":t.showCategoryEditButton,"category-context-buttons-config":t.categoryContextButtonsConfig,"is-product-item-selected":t.isProductItemSelected,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-costs":t.showProductCosts,"show-product-required-button":t.showProductRequiredButton,"show-product-edit-button":t.showProductEditButton,"product-context-buttons-config":t.productContextButtonsConfig,"show-configurator":t.showConfigurator,"can-show-configurator":t.canShowConfigurator},null,8,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"])):i.createCommentVNode("",!0)]),g.value&&m.value?(i.openBlock(),i.createBlock(Od,{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",Sb,[g.value?(i.openBlock(),i.createBlock(ce,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:H},{default:i.withCtx(()=>[...V[6]||(V[6]=[i.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Hn,{columns:O.value,data:l.value,bordered:!0,loading:y.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),!y.value&&!_.value&&!o.value&&!c.value?(i.openBlock(),i.createBlock(cn,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createBlock(cn,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),y.value?(i.openBlock(),i.createBlock(en,{key:4,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>[...V[7]||(V[7]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),Nb=Nn(Tb,[["__scopeId","data-v-607a5aad"]]),$b={class:"sc-collapse flex w-full flex-col"},Rb={},Ld=i.defineComponent({...Rb,__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",$b,[i.renderSlot(s.$slots,"default")]))}}),Eb={},Hd=i.defineComponent({...Eb,__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(lr,"medium"),r=i.computed(()=>M.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(M.isUndefined(a))return;const l=a[s.id];if(l==="*")return;const c={};return c[s.id]=structuredClone(i.toRaw(l)),c};return(s,a)=>{const l=A.NSpin,c=A.NAlert;return i.openBlock(),i.createElementBlock(i.Fragment,null,[r.value.length>0?(i.openBlock(),i.createBlock(Ld,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(Nb,{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)}}}),Pb={},Wd=i.defineComponent({...Pb,__name:"reference-select",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean},referenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1},sortOptionsByLabel:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},maxTagCount:{default:void 0},disabledItem:{type:Function,default:void 0}},emits:["update:value"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.computed(()=>M.isArray(r.value)),a=new j.Reference,l=i.computed(()=>M.isNil(r.value)?s.value?[]:null:M.isArray(r.value)?r.value.map(g=>g.id):r.value.id),c=i.computed(()=>Tt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue,void 0,r.disabledItem)),d=g=>{var m;if(M.isArray(g)){const p=g.length>0?g.map(b=>{var y;return(y=c.value.find(_=>_.value===b))==null?void 0:y.item}):[];o("update:value",p)}else{const p=g===a.id||M.isNil(g)||(m=c.value.find(b=>b.value===g))==null?void 0:m.item;o("update:value",p)}},u=i.useTemplateRef("select-component");return e({focus:()=>{var g;return(g=u.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=u.value)==null?void 0:g.blur()}}),(g,m)=>(i.openBlock(),i.createBlock(i.unref(A.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"]))}}),Fb={},Vb=i.defineComponent({...Fb,__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,N;const n=t,r=e,o=()=>{const $=j.PriceCoefficient.getRetailPriceCoefficient();return M.unset($,"isNewRec"),$},s=$=>!$||$.id===o().id,a=i.computed(()=>{var $;return(($=n.catalogItem)==null?void 0:$.type)==="product"}),l=i.computed(()=>a.value?n.catalogItem:void 0),c=$=>{var w,v,k,B;return $.id===o().id?(w=l.value)==null?void 0:w.getRetailCost():(B=(k=(v=l.value)==null?void 0:v.priceCoefficients)==null?void 0:k.find(R=>R.coefficient.id===$.id))==null?void 0:B.cost},d=i.computed(()=>{var w;const $=[...((w=j.useReferencesStore().priceCoefficientsReference)==null?void 0:w.map(v=>structuredClone(i.toRaw(v))))??[],o()];return a.value&&$.forEach(v=>{var B;const k=c(v);k?v.name+=` (${k} ${(B=l.value)==null?void 0:B.currency.symbol})`:v.name=""}),$.filter(v=>v.name!=="")}),u=i.ref(n.value.coefficient),h=i.ref(((N=(x=n.value)==null?void 0:x.value)==null?void 0:N.toString())??null),f=i.ref(null),g=i.computed(()=>{var $,w;return(w=($=l.value)==null?void 0:$.priceCoefficients)==null?void 0:w.find(v=>v.coefficient.slug===j.PriceCoefficientEnum.K0)}),m=i.ref(void 0),p=$=>Number.parseFloat(($??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),b=()=>{var w,v;m.value=void 0;let $=p(h.value);if($=Number.isNaN($)?void 0:$,a.value)if(u.value||h.value){const k=o(),B=c(u.value??k)??0,R=B+B*(($??0)/100);f.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(R),R>(((w=l.value)==null?void 0:w.getRetailCost())??R)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),g.value&&R<(((v=g.value)==null?void 0:v.cost)??0)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else f.value=null;r("update:value",{value:Number.isNaN($)?void 0:$,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})},y=$=>{M.isArray($)||M.isNull($)||(u.value=$,h.value=null,!u.value&&h.value&&(u.value=o()),b())},_=()=>{u.value||(u.value=o()),b()},C=$=>{var v,k,B,R,E;const w=p($);if(a.value){let P=0;if(w<=0)u.value=void 0,h.value=null;else if(g.value&&w<(((v=g.value)==null?void 0:v.cost)??0))u.value=(k=g.value)==null?void 0:k.coefficient,P=(w-g.value.cost)*100/g.value.cost,m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(w>(((B=l.value)==null?void 0:B.getRetailCost())??w)){u.value=o();const W=((R=l.value)==null?void 0:R.getRetailCost())??0;P=(w-W)*100/W,m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const W=((E=l.value)==null?void 0:E.priceCoefficients)??[],I=M.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),m.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 $,w,v,k;n.calculationType===j.CalculationTypeEnum.m2Cost?f.value=((w=($=n.value)==null?void 0:$.value)==null?void 0:w.toString())??null:!((v=n.value)!=null&&v.coefficient)&&((k=n.value)!=null&&k.value)&&(u.value=o()),b()}),($,w)=>{var B,R,E;const v=A.NInput,k=A.NInputGroup;return i.openBlock(),i.createBlock(i.unref(A.NFormItem),{"show-label":!i.unref(M.isNil)(t.label),label:t.label,"show-feedback":!i.unref(M.isNil)(((B=m.value)==null?void 0:B.feedback)??t.feedback),feedback:((R=m.value)==null?void 0:R.feedback)??t.feedback,"validation-status":((E=m.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(j.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[t.calculationType!==i.unref(j.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(Wd,{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":y},null,8,["value","reference-list","clearable","disabled","disabled-item"]),i.createVNode(v,{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(j.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(v,{key:1,value:f.value,"onUpdate:value":[w[1]||(w[1]=P=>f.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"])}}}),Mb={key:0,class:"flex flex-row gap-2.5"},Ab={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},Ib={},jd=i.defineComponent({...Ib,__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=ot.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=ot.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",y=>{a.value=y});return}let m=!1;o("closing",g,()=>{m=!0}),m||(s.value=!1,o("update:show",s.value))},f=()=>{o("accept",m=>{a.value=m})};return i.watch(()=>r.show,g=>{g?u():h("other")}),i.watch(()=>r.processing,g=>{a.value=g}),e({open:u,close:h,acceptHandler:f}),(g,m)=>{const p=A.NButton,b=A.NModal;return i.openBlock(),i.createBlock(b,{loading:a.value,show:s.value,"show-icon":!1,size:i.unref(l),style:i.normalizeStyle(`width: ${d.value}px`),title:t.title,"trap-focus":t.trapFocus??!0,"action-class":g.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:m[1]||(m[1]=y=>h("header")),onEsc:m[2]||(m[2]=y=>h("esc")),onMaskClick:m[3]||(m[3]=y=>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",Mb,[i.renderSlot(g.$slots,"extra-action")])):i.createCommentVNode("",!0),g.$slots.action||t.acceptButton.show||t.cancelButton.show?(i.openBlock(),i.createElementBlock("div",Ab,[i.renderSlot(g.$slots,"action",{disabled:a.value}),t.acceptButton.show??!0?(i.openBlock(),i.createBlock(p,{key:0,disabled:a.value||!t.valid,size:i.unref(l),type:"primary",onClick:f},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","size"])):i.createCommentVNode("",!0),t.cancelButton.show??!0?(i.openBlock(),i.createBlock(p,{key:1,size:i.unref(l),type:"default",onClick:m[0]||(m[0]=y=>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"])}}}),Ob={class:"text-sm"},zb={},Db=i.defineComponent({...zb,__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,v,k;return((w=s.value)==null?void 0:w.unit.isLinear)&&((k=(v=s.value)==null?void 0:v.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,f=()=>({length:{},quantity:{},marker:{}}),g=i.ref(f()),m=i.ref(!1),p=i.computed(()=>{var R,E,P,W;if(!s.value)return{};const w=j.UnitsHelper.getProductLengthMultiplicity(s.value),v=j.UnitsHelper.getProductMultiplicity(s.value),k=((E=(R=s.value)==null?void 0:R.properties)==null?void 0:E.minLength)||w,B=(W=(P=s.value)==null?void 0:P.properties)==null?void 0:W.maxLength;return{length:[ae.required,ae.min(k??.1),ae.max(B),ae.step(w),He.serverValidation(g.value.length.feedback)],quantity:[ae.required,ae.min(v),ae.step(v),He.serverValidation(g.value.quantity.feedback)],marker:[He.serverValidation(g.value.marker.feedback)]}}),b=i.computed(()=>{var w,v,k;return s.value?((w=s.value.properties)==null?void 0:w.lengthStep)??((v=s.value.properties)!=null&&v.ignoreMinCountCheck?0:((k=s.value.properties)==null?void 0:k.minCount)??0):0}),y=i.computed(()=>{var k,B,R,E,P,W,I,Z,te;if(!s.value)return"";const w=((B=(k=s.value)==null?void 0:k.properties)==null?void 0:B.minLength)??((E=(R=s.value)==null?void 0:R.properties)!=null&&E.ignoreMinCountCheck?0:(W=(P=s.value)==null?void 0:P.properties)==null?void 0:W.minCount),v=(Z=(I=s.value)==null?void 0:I.properties)==null?void 0:Z.maxLength;return w||v?`(${w?`от ${w}`:""}${w&&v?" ":""}${v?`до ${v}`:""} ${(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||M.isNil(w)||b.value===0)return;const v=w/b.value,k=Math.round(v),B=j.UnitsHelper.getProductMultiplicity(s.value),R=Math.max(k,B);u.value.quantity=R},C=w=>{var R,E,P,W;if(!((E=(R=s.value)==null?void 0:R.properties)!=null&&E.isLengthConfigurator)||!u.value||M.isNil(w)||b.value===0)return;const v=w*b.value,k=((P=s.value.properties)==null?void 0:P.minLength)||j.UnitsHelper.getProductLengthMultiplicity(s.value),B=(W=s.value.properties)==null?void 0:W.maxLength;k!==void 0&&v<k?u.value.length=k:B!==void 0&&v>B?u.value.length=B:u.value.length=v},x=async w=>{var k;const v=M.cloneDeep(u.value);try{await((k=r.value)==null?void 0:k.validate(B=>{if(!B){if(!s.value||!v)return;j.UnitsHelper.productIsMeasurable(s.value)||delete v.length,a.value&&b.value&&(v.length=b.value),m.value=!0,h("submit",v,g.value,()=>{m.value=!1,w(!1),i.nextTick(()=>{var R;(R=r.value)==null||R.validate(M.noop).catch(M.noop)})})}}))}catch{}},N=()=>{s.value=null,l.value=void 0,u.value=null,g.value=f()};return e({show:(w,v)=>{var k,B,R,E,P;if(s.value=w,l.value=v==null?void 0:v.cartItemData,c.value=v==null?void 0:v.orderId,d.value=(v==null?void 0:v.canSetDopProdaga)??!1,u.value=new j.OrderItemBase((v==null?void 0:v.cartItemData)??new j.OrderItemBase({product:w,quantity:j.UnitsHelper.productIsMeasurable(s.value)?1:((k=w==null?void 0:w.properties)==null?void 0:k.minCount)??1,length:((B=w==null?void 0:w.properties)==null?void 0:B.minLength)||((R=w==null?void 0:w.properties)!=null&&R.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&&b.value>0){const W=b.value,I=u.value.quantity||1;u.value.length=I*W}},closeDialog:N}),(w,v)=>{var P;const k=A.NFormItem,B=A.NInputGroupLabel,R=A.NInputGroup,E=A.NCheckbox;return i.openBlock(),i.createBlock(jd,{ref:"base-dialog-reference",show:!i.unref(M.isNil)(s.value)&&!i.unref(M.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:m.value,"modal-width":500,onAccept:x,onClosing:N},{default:i.withCtx(()=>{var W;return[s.value&&u.value?(i.openBlock(),i.createBlock(i.unref(A.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(j.UnitsHelper).productIsMeasurable(s.value)?(i.openBlock(),i.createBlock(k,{key:0,path:"length",label:`Метраж, ${y.value+s.value.unit.name}`},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:u.value.length,"onUpdate:value":[v[0]||(v[0]=I=>u.value.length=I),_],parse:i.unref(rt),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:v[1]||(v[1]=I=>i.unref(zr)(I,".",!1)),onInput:v[2]||(v[2]=I=>i.unref(tt)(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(R,null,i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:u.value.quantity,"onUpdate:value":[v[3]||(v[3]=I=>u.value.quantity=I),C],parse:i.unref(rt),step:i.unref(j.UnitsHelper).getProductMultiplicity(s.value),"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:v[4]||(v[4]=I=>i.unref(zr)(I,".",!1)),onInput:v[5]||(v[5]=I=>i.unref(tt)(g.value,"quantity")),onFocus:i.unref(Le)},null,8,["value","parse","step","onFocus"]),a.value?(i.openBlock(),i.createBlock(B,{key:0,class:"bg-orange-100 font-bold"},{default:i.withCtx(()=>[i.createTextVNode(" x "+i.toDisplayString(b.value)+" "+i.toDisplayString(s.value.unit.name),1)]),_:1})):i.createCommentVNode("",!0)]),_:2},[!g.value.quantity.feedback&&i.unref(j.UnitsHelper).getProductMultiplicity(s.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Ob,"Количество должно быть кратно "+i.toDisplayString(i.unref(j.UnitsHelper).getProductMultiplicity(s.value)),1)]),key:"0"}:void 0]),1024)]),_:1}),i.unref(j.UnitsHelper).productIsMeasurable(s.value)?(i.openBlock(),i.createBlock(k,{key:1,path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:v[6]||(v[6]=I=>i.unref(tt)(g.value,"marker")),"onUpdate:value":v[7]||(v[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":v[8]||(v[8]=I=>u.value.isAdditionalSale=I),"true-value":!0,"false-value":!1},{default:i.withCtx(()=>[...v[9]||(v[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"])}}}),Lb={class:"flex flex-row gap-1"},Hb={class:"sc-client-name flex flex-col gap-1 text-base"},Wb=["href"],jb={key:1,class:"text-sc-grey"},qb={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Xb={key:0},Yb={key:1,class:"text-sm"},Ub={},br=i.defineComponent({...Ub,__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?je.format(n.client.lastLoginAt,j.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{M.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=qo,d=A.NButton,u=A.NPopover;return i.openBlock(),i.createElementBlock("div",Lb,[t.showClientInfoIcon?(i.openBlock(),i.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=h=>a.$emit("click:client-info",t.client))},{default:i.withCtx(()=>[i.createVNode(c)]),_:1})):i.createCommentVNode("",!0),i.createVNode(u,{disabled:i.unref(M.isNil)(t.popoverPosition),placement:t.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",Hb,[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",jb," [ Деактивирован ] "))],8,Wb),t.showCityAndRegion&&t.client.city?(i.openBlock(),i.createElementBlock("span",qb," г. "+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",Xb,i.toDisplayString(t.client.alternativeName),1)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("span",Yb," Последний вход: "+i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),Kb={class:"text-base"},Gb={},qd=i.defineComponent({...Gb,__name:"contragent-with-short-info",props:{contragent:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("span",Kb,i.toDisplayString(t.contragent.name),1))}}),Zb={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Qb(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 Jb=i.markRaw({name:"tabler-mail",render:Qb}),e_=["href"],t_={},n_=i.defineComponent({...t_,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(t){return(e,n)=>{const r=Jb;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,e_)],2)}}}),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:"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 Xd=i.markRaw({name:"fa6-brands-viber",render:r_}),o_={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},s_=["id"],a_=["id"],l_=["fill"],c_=["fill"];function d_(t,e){return i.openBlock(),i.createElementBlock("svg",o_,[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,s_),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,a_)]),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,l_),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,c_),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 Yd=i.markRaw({name:"logos-whatsapp-icon",render:d_,setup(){const t=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+t(),SVGHW6lecxh:"uicons-"+t()}}}}),u_={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},h_=["id"],f_=["fill"];function m_(t,e){return i.openBlock(),i.createElementBlock("svg",u_,[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,h_)]),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,f_),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 Ud=i.markRaw({name:"logos-telegram",render:m_,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),g_={viewBox:"0 0 512 512",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:"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 Kd=i.markRaw({name:"ion-call",render:p_}),y_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function b_(t,e){return i.openBlock(),i.createElementBlock("svg",y_,[...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 __=i.markRaw({name:"tabler-phone-call",render:b_}),w_={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},x_=["href"],k_=["href"],v_=["href"],C_=["href"],S_={},B_=i.defineComponent({...S_,__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 M.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),o=i.computed(()=>{var l;return M.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=i.computed(()=>{var l;return M.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=__,u=Kd,h=Ud,f=Yd,g=Xd;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",{class:i.normalizeClass({"border-xl relative inline-flex items-center rounded px-2":r.value&&a.value,"min-w-10":!0}),onClick:c[0]||(c[0]=m=>a.value=!a.value),onFocusout:c[1]||(c[1]=m=>a.value=!1),onMouseleave:c[2]||(c[2]=m=>a.value=!1)},[i.createElementVNode("div",{class:i.normalizeClass({"flex flex-row items-center gap-1":t.showPhoneIcon})},[t.showPhoneIcon?(i.openBlock(),i.createBlock(d,{key:0})):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(o.value),1)],2),r.value&&a.value?(i.openBlock(),i.createElementBlock("div",w_,[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,x_)):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,k_)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${s.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(f)],8,v_)):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,C_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),T_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function N_(t,e){return i.openBlock(),i.createElementBlock("svg",T_,[...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 $_=i.markRaw({name:"mdi-envelope",render:N_}),R_={class:"flex flex-col gap-1"},E_={key:0,class:"mb-2 flex flex-col text-base"},P_={key:0,class:"text-sc-dark-grey text-sm"},F_={key:1,class:"whitespace-nowrap text-sm"},V_={key:2,class:"whitespace-nowrap text-sm"},M_={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},A_=["href"],I_=["href"],O_=["href"],z_=["href"],D_=["href"],L_={key:0,class:"flex flex-col text-base"},H_={key:0,class:"text-sc-dark-grey text-sm"},W_={key:1,class:"mt-2 text-sm"},j_={key:0,class:"-mt-1"},q_={},X_=i.defineComponent({...q_,__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 M.isString(n.value)?!1:((c=n.value)==null?void 0:c.isValid())??!1}),o=i.computed(()=>{var c;return M.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("INTERNATIONAL"))??""}),s=i.computed(()=>{var c;return M.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 b,y;const u=Kd,h=Ud,f=Yd,g=Xd,m=$_,p=A.NPopover;return i.openBlock(),i.createElementBlock("div",R_,[i.createVNode(p,{disabled:t.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var _,C,x,N;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]=$=>l.value=!0),onFocusin:d[1]||(d[1]=$=>l.value=!0),onMouseleave:d[2]||(d[2]=$=>l.value=!1),onFocusout:d[3]||(d[3]=$=>l.value=!1)},[i.createElementVNode("div",null,[t.fullView&&(t.contact.name||(C=t.contact)!=null&&C.position)?(i.openBlock(),i.createElementBlock("div",E_,[i.createTextVNode(i.toDisplayString(t.contact.name)+" ",1),(x=t.contact)!=null&&x.position?(i.openBlock(),i.createElementBlock("span",P_,i.toDisplayString((N=t.contact)==null?void 0:N.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),t.contact.phone?(i.openBlock(),i.createElementBlock("div",F_,i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("div",V_,i.toDisplayString(t.contact.email),1)):i.createCommentVNode("",!0),a.value&&l.value?(i.openBlock(),i.createElementBlock("div",M_,[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,A_)):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,I_)):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(f)],8,O_)):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,z_)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${t.contact.email}`,class:"hover:text-3xl"},[i.createVNode(m)],8,D_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var _,C,x,N;return[t.contact.name?(i.openBlock(),i.createElementBlock("div",L_,[i.createTextVNode(i.toDisplayString(t.contact.name)+" ",1),(_=t.contact)!=null&&_.position?(i.openBlock(),i.createElementBlock("span",H_,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",W_,[d[4]||(d[4]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((N=t.contact)==null?void 0:N.comment),1)])):i.createCommentVNode("",!0)]}),_:1},8,["disabled"]),t.fullView&&((b=t.contact)!=null&&b.comment)?(i.openBlock(),i.createElementBlock("div",j_,[d[5]||(d[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((y=t.contact)==null?void 0:y.comment),1)])):i.createCommentVNode("",!0)])}}});class Y_{constructor(e){T(this,"minHeight");T(this,"maxHeights");T(this,"minWidth");T(this,"maxWidths");T(this,"netType");T(this,"color");T(this,"mountType");T(this,"descriptions");T(this,"crossbarCount");T(this,"heightOverlaps");T(this,"widthOverlaps");T(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=Wo.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=Wo.objectToSnake(e.heightOverlaps),this.widthOverlaps=Wo.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function U_(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.SandwichM2?!0:t.properties.configuratorSettings!==void 0&&M.isArray(t.products)&&t.products.length>0}const K_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function G_(t,e){return i.openBlock(),i.createElementBlock("svg",K_,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M16 12a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2"},null,-1)])])}const Z_=i.markRaw({name:"mdi-dots-horizontal",render:G_}),Gd="date-range.dialog.mode",Zd=["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],Qd=(t,e,n)=>{let r=t??void 0,o=e??void 0;return r&&o&&r>o&&(n!=null&&n.from?o=r:n!=null&&n.to?r=o:[r,o]=[o,r]),{from:r?je.startOfDay(r):void 0,to:o?je.endOfDay(o):void 0}},Q_={class:"text-center font-semibold"},J_={class:"grid grid-cols-3 gap-1"},e1=["onPointerdown","onPointerenter","onKeydown"],t1={},n1=i.defineComponent({...t1,__name:"month-range-grid",props:{from:{},to:{}},emits:["select"],setup(t,{emit:e}){const n=t,r=e,o=A.useThemeVars(),s=i.computed(()=>({"--sc-primary-color":o.value.primaryColor,"--sc-primary-color-hover":o.value.primaryColorHover,"--sc-primary-color-suppl":o.value.primaryColorSuppl,"--sc-hover-color":o.value.hoverColor})),a=w=>{const v=new Date().getFullYear();return w&&je.isValid(w)?w.getFullYear():v},l=i.ref(a(n.from??n.to)),c=ot.initRefDependingOnDeviceResolution(1,3,3),d=i.computed(()=>c.value===1?[l.value]:[l.value-1,l.value,l.value+1]),u=i.ref(null),h=i.ref(null),f=i.ref(!1),g=i.ref(null),m=i.computed(()=>{const{from:w,to:v}=n;return!w||!v||!je.isSameDay(w,je.startOfMonth(w))||!je.isSameDay(v,je.endOfMonth(v))?null:[w.getFullYear()*12+w.getMonth(),v.getFullYear()*12+v.getMonth()]}),p=i.computed(()=>f.value&&h.value!==null&&g.value!==null?b(h.value,g.value):u.value!==null?g.value===null?[u.value,u.value]:b(u.value,g.value):m.value),b=(w,v)=>w<=v?[w,v]:[v,w],y=(w,v)=>{const k=w*12+v,B=p.value;return B&&k>=B[0]&&k<=B[1]?[k===B[0]||k===B[1]?"sc-month--bound":"sc-month--in-range"]:[]},_=(w,v)=>{const[k,B]=b(w,v);u.value=null,r("select",{from:new Date(Math.floor(k/12),k%12,1),to:je.endOfMonth(new Date(Math.floor(B/12),B%12,1))})},C=w=>{u.value===null?(u.value=w,r("select",{from:new Date(Math.floor(w/12),w%12,1),to:je.endOfMonth(new Date(Math.floor(w/12),w%12,1))})):_(u.value,w)},x=()=>{globalThis.removeEventListener("pointerup",x);const w=h.value;if(w!==null){if(h.value=null,f.value){f.value=!1,g.value!==null&&_(w,g.value);return}C(w)}},N=(w,v)=>{h.value=w*12+v,f.value=!1,globalThis.addEventListener("pointerup",x)},$=(w,v)=>{const k=w*12+v;g.value=k,h.value!==null&&k!==h.value&&(f.value=!0)};return i.watch(()=>[n.from,n.to],()=>{const w=n.from??n.to;if(!w||!je.isValid(w))return;const v=w.getFullYear();(v<l.value-1||v>l.value+1)&&(l.value=v)}),i.onBeforeUnmount(()=>{globalThis.removeEventListener("pointerup",x)}),(w,v)=>{const k=A.NButton;return i.openBlock(),i.createElementBlock("div",{class:"flex select-none items-start gap-2",style:i.normalizeStyle(s.value),onPointerleave:v[2]||(v[2]=B=>g.value=null)},[i.createVNode(k,{size:"small",quaternary:"",class:"mt-5",onClick:v[0]||(v[0]=B=>l.value-=1)},{default:i.withCtx(()=>[...v[3]||(v[3]=[i.createTextVNode(" ‹ ",-1)])]),_:1}),i.createElementVNode("div",{class:i.normalizeClass(["grid flex-1 gap-4 sm:gap-8",d.value.length===1?"grid-cols-1":"grid-cols-3"])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value,B=>(i.openBlock(),i.createElementBlock("div",{key:B,class:"flex flex-col gap-1"},[i.createElementVNode("div",Q_,i.toDisplayString(B),1),i.createElementVNode("div",J_,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(Zd),(R,E)=>(i.openBlock(),i.createElementBlock("button",{key:R,type:"button",class:i.normalizeClass(["sc-month cursor-pointer rounded border-0 px-1 py-1 text-sm",y(B,E)]),onPointerdown:i.withModifiers(P=>N(B,E),["prevent"]),onPointerenter:P=>$(B,E),onKeydown:[i.withKeys(i.withModifiers(P=>C(B*12+E),["prevent"]),["enter"]),i.withKeys(i.withModifiers(P=>C(B*12+E),["prevent"]),["space"])]},i.toDisplayString(R),43,e1))),128))])]))),128))],2),i.createVNode(k,{size:"small",quaternary:"",class:"mt-5",onClick:v[1]||(v[1]=B=>l.value+=1)},{default:i.withCtx(()=>[...v[4]||(v[4]=[i.createTextVNode(" › ",-1)])]),_:1})],36)}}}),i1=Nn(n1,[["__scopeId","data-v-7dd4941e"]]),r1={class:"sc-date-range-sidebar flex flex-col gap-1"},o1={class:"flex items-center justify-center gap-1"},s1={class:"min-w-12 text-center font-semibold"},a1={class:"grid grid-flow-col grid-cols-2 grid-rows-6 gap-1"},l1={},c1=i.defineComponent({...l1,__name:"month-year-sidebar",props:{year:{},month:{}},emits:["update:year","select-month","today"],setup(t,{emit:e}){const n=e;return(r,o)=>{const s=A.NButton;return i.openBlock(),i.createElementBlock("div",r1,[i.createElementVNode("div",o1,[i.createVNode(s,{size:"small",quaternary:"",onClick:o[0]||(o[0]=a=>n("update:year",t.year-1))},{default:i.withCtx(()=>[...o[3]||(o[3]=[i.createTextVNode(" ‹ ",-1)])]),_:1}),i.createElementVNode("span",s1,i.toDisplayString(t.year),1),i.createVNode(s,{size:"small",quaternary:"",onClick:o[1]||(o[1]=a=>n("update:year",t.year+1))},{default:i.withCtx(()=>[...o[4]||(o[4]=[i.createTextVNode(" › ",-1)])]),_:1})]),i.createElementVNode("div",a1,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(Zd),(a,l)=>(i.openBlock(),i.createBlock(s,{key:a,size:"small",quaternary:"",type:l===t.month?"primary":"default",onClick:c=>n("select-month",l)},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(a),1)]),_:2},1032,["type","onClick"]))),128))]),i.createVNode(s,{size:"small",text:"",type:"info",onClick:o[2]||(o[2]=a=>n("today"))},{default:i.withCtx(()=>[...o[5]||(o[5]=[i.createTextVNode(" Сегодня ",-1)])]),_:1})])}}}),d1={},Jd=i.defineComponent({...d1,__name:"date-range-input",props:{clearable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{default:void 0},value:{default:null},dateFormat:{default:()=>j.useBaseConfigStateStore().config.dateFormats.uiDate}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,o=ot.initRefDependingOnDeviceResolution(!0,!1,!1),s=i.ref(null),a=i.ref(!1),l=i.ref(0),c=i.ref(new Date),d=i.computed(()=>{const C=n.value&&je.isValid(n.value)?n.value:c.value;return C.getFullYear()===c.value.getFullYear()?C.getMonth():null});let u=0;const h=C=>{var x,N;(N=(x=C.target)==null?void 0:x.closest)!=null&&N.call(x,".n-base-clear")&&(u=performance.now())},f=C=>{C&&performance.now()-u<300||(a.value=C,C&&(c.value=n.value&&je.isValid(n.value)?n.value:new Date))},g=C=>{r("update:value",C===null?null:new Date(C))},m=(C,x)=>{const N=new Date(C,x,1);if(c.value=N,n.value&&je.isValid(n.value)){const $=Math.min(je.getDate(n.value),je.getDaysInMonth(N));r("update:value",new Date(C,x,$));return}l.value+=1,i.nextTick().then(()=>{var $;return($=s.value)==null?void 0:$.focus()})},p=(C,x)=>{c.value=je.addYears(je.addMonths(c.value,C),x)},b=C=>{m(C,c.value.getMonth())},y=C=>{m(c.value.getFullYear(),C)},_=()=>{a.value=!1,r("update:value",new Date)};return(C,x)=>{const N=A.NButton,$=A.NDatePicker;return i.openBlock(),i.createBlock($,{ref_key:"pickerReference",ref:s,key:l.value,value:n.value?n.value.getTime():null,show:a.value,clearable:t.clearable,disabled:t.disabled,placeholder:t.placeholder,format:t.dateFormat,actions:[],"default-calendar-start-time":c.value.getTime(),type:"date",class:"min-w-28",onMousedownCapture:h,"onUpdate:show":f,"onUpdate:value":g,onNextMonth:x[0]||(x[0]=w=>p(1,0)),onPrevMonth:x[1]||(x[1]=w=>p(-1,0)),onNextYear:x[2]||(x[2]=w=>p(0,1)),onPrevYear:x[3]||(x[3]=w=>p(0,-1))},{footer:i.withCtx(()=>[i.unref(o)?(i.openBlock(),i.createBlock(N,{key:1,size:"small",text:"",type:"info",onClick:_},{default:i.withCtx(()=>[...x[4]||(x[4]=[i.createTextVNode(" Сегодня ",-1)])]),_:1})):(i.openBlock(),i.createBlock(c1,{key:0,year:c.value.getFullYear(),month:d.value,"onUpdate:year":b,onSelectMonth:y,onToday:_},null,8,["year","month"]))]),_:1},8,["value","show","clearable","disabled","placeholder","format","default-calendar-start-time"])}}}),u1={class:"@container"},h1={class:"flex flex-col gap-1 @xs:flex-row @xs:items-center"},f1={},eu=i.defineComponent({...f1,__name:"date-range-fields",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},from:{default:null},to:{default:null},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:from","update:to"],setup(t,{emit:e}){const n=e;return(r,o)=>{var s,a;return i.openBlock(),i.createElementBlock("div",u1,[i.createElementVNode("div",h1,[i.createVNode(Jd,{value:t.from,clearable:t.clearable,disabled:(s=t.disabled)==null?void 0:s.from,placeholder:t.placeholderFrom,"date-format":t.dateFormat,class:"@xs:flex-1","onUpdate:value":o[0]||(o[0]=l=>n("update:from",l))},null,8,["value","clearable","disabled","placeholder","date-format"]),o[2]||(o[2]=i.createElementVNode("span",{class:"hidden text-gray-400 @xs:inline"},"–",-1)),i.createVNode(Jd,{value:t.to,clearable:t.clearable,disabled:(a=t.disabled)==null?void 0:a.to,placeholder:t.placeholderTo,"date-format":t.dateFormat,class:"@xs:flex-1","onUpdate:value":o[1]||(o[1]=l=>n("update:to",l))},null,8,["value","clearable","disabled","placeholder","date-format"])])])}}}),m1={class:"flex flex-col items-stretch gap-3 sm:flex-row"},g1={class:"order-2 flex-1 rounded-lg border border-solid border-gray-200 p-2 shadow-sm"},p1={class:"flex flex-col items-stretch pr-3"},y1={key:0,class:"px-2 pb-0.5 pt-2 text-xs text-gray-400"},b1={key:1,class:"order-2 w-44 shrink-0 rounded-lg border border-solid border-gray-200 p-1 shadow-sm"},_1={},w1=i.defineComponent({..._1,__name:"standard-periods",props:{activeKey:{},customPeriods:{}},emits:["apply","preview"],setup(t,{emit:e}){const n=t,r=e,o="custom",s=ot.initRefDependingOnDeviceResolution(!0,!1,!1),a=j.DateTimeProvider.standardPeriods(),l=i.ref(j.STANDARD_PERIOD_GROUPS[0].key),c=i.computed(()=>{const h=j.STANDARD_PERIOD_GROUPS.map(f=>({key:f.key,value:f.key,label:f.label}));return M.isEmpty(n.customPeriods)||h.push({key:o,value:o,label:"Пользовательские"}),h}),d=h=>Object.entries(h).map(([f,g])=>({value:f,label:g.label,item:g})),u=i.computed(()=>{if(l.value===o)return[{type:"group",key:o,children:d(n.customPeriods??{})}];const h=Object.entries(a).filter(([,g])=>g.group===l.value),f=Object.fromEntries(h);return l.value!=="other"?[{type:"group",key:l.value,children:d(f)}]:j.STANDARD_PERIOD_SECTIONS.map(g=>{const m=h.filter(([,p])=>p.section===g.key);return{type:"group",key:g.key,label:g.label,children:d(Object.fromEntries(m))}}).filter(g=>{var m;return(((m=g.children)==null?void 0:m.length)??0)>0})});return(h,f)=>{const g=A.NButton,m=A.NScrollbar,p=A.NSelect,b=A.NMenu;return i.openBlock(),i.createElementBlock("div",m1,[i.createElementVNode("div",g1,[i.createVNode(m,{class:"max-h-96"},{default:i.withCtx(()=>[i.createElementVNode("div",p1,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(u.value,y=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:y.key},[y.label?(i.openBlock(),i.createElementBlock("div",y1,i.toDisplayString(y.label),1)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(y.children,_=>(i.openBlock(),i.createBlock(g,{key:_.value,size:"small",quaternary:"",type:_.value===t.activeKey?"primary":"default",class:"justify-start",onClick:C=>r("apply",_),onMouseenter:C=>r("preview",_),onMouseleave:f[0]||(f[0]=C=>r("preview"))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(_.label),1)]),_:2},1032,["type","onClick","onMouseenter"]))),128))],64))),128))])]),_:1})]),i.unref(s)?(i.openBlock(),i.createBlock(p,{key:0,value:l.value,options:c.value,class:"order-1","onUpdate:value":f[1]||(f[1]=y=>l.value=y)},null,8,["value","options"])):(i.openBlock(),i.createElementBlock("div",b1,[i.createVNode(b,{value:l.value,options:c.value,mode:"vertical","onUpdate:value":f[2]||(f[2]=y=>l.value=y)},null,8,["value","options"])]))])}}}),x1={class:"flex flex-col gap-3"},k1={class:"flex flex-col gap-1 sm:flex-row sm:items-center"},v1={key:0,class:"overflow-x-auto rounded-lg border border-solid border-gray-200 p-2 shadow-sm sm:p-3"},C1={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},S1={class:"flex gap-2"},B1={},T1=i.defineComponent({...B1,__name:"date-range-dialog",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},show:{type:Boolean},dateRange:{default:void 0},customPeriods:{default:void 0},dateFormat:{default:void 0}},emits:["update:show","select"],setup(t,{emit:e}){const n=t,r=e,o=ot.initRefDependingOnDeviceResolution("100%","90%","44rem"),s=i.ref("custom"),a=()=>j.PreferencesStorageProvider.getActualDataFromStorage(Gd)==="standard"?"standard":"custom",l=i.ref({}),c=i.ref(null),d=i.ref(null),u=i.computed(()=>c.value??l.value),h=(x,N)=>{var v,k;const $=(v=n.disabled)!=null&&v.from?l.value.from:x,w=(k=n.disabled)!=null&&k.to?l.value.to:N;c.value=null,l.value=Qd($,w,n.disabled)},f=x=>{d.value=null,h(x,l.value.to)},g=x=>{d.value=null,h(l.value.from,x)},m=()=>{d.value=null,h(null,null)},p=x=>{d.value=null,h(x.from,x.to)},b=x=>{const N=x.item;h(N.from,N.to),d.value=String(x.value)},y=x=>{const N=x==null?void 0:x.item;c.value=N?{from:N.from,to:N.to}:null},_=()=>{c.value=null,s.value=s.value==="custom"?"standard":"custom";const x=Gd;j.PreferencesStorageProvider.saveActualDataToStorage(x,s.value,je.addYears(je.startOfToday(),1))},C=()=>{r("select",l.value),r("update:show",!1)};return i.watch(()=>n.show,x=>{x&&(s.value=a(),d.value=null,c.value=null,l.value={...n.dateRange})}),(x,N)=>{const $=A.NButton,w=A.NModal;return i.openBlock(),i.createBlock(w,{show:t.show,preset:"card",title:"Выберите период",closable:"",style:i.normalizeStyle({width:i.unref(o),maxWidth:"calc(100vw - 1rem)"}),class:"sc-date-range-dialog","onUpdate:show":N[1]||(N[1]=v=>r("update:show",v))},{footer:i.withCtx(()=>[i.createElementVNode("div",C1,[i.createVNode($,{text:"",type:"info",onClick:_},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(s.value==="custom"?"Показать стандартные периоды":"Показать произвольный период"),1)]),_:1}),i.createElementVNode("div",S1,[i.createVNode($,{type:"primary",onClick:C},{default:i.withCtx(()=>[...N[3]||(N[3]=[i.createTextVNode(" Выбрать ",-1)])]),_:1}),i.createVNode($,{onClick:N[0]||(N[0]=v=>r("update:show",!1))},{default:i.withCtx(()=>[...N[4]||(N[4]=[i.createTextVNode("Отмена",-1)])]),_:1})])])]),default:i.withCtx(()=>[i.createElementVNode("div",x1,[i.createElementVNode("div",k1,[i.createVNode(eu,{from:u.value.from,to:u.value.to,clearable:t.clearable,disabled:t.disabled,"date-format":t.dateFormat,class:"flex-1","onUpdate:from":f,"onUpdate:to":g},null,8,["from","to","clearable","disabled","date-format"]),t.clearable?(i.openBlock(),i.createBlock($,{key:0,text:"",type:"info",class:"sm:ml-2",onClick:m},{default:i.withCtx(()=>[...N[2]||(N[2]=[i.createTextVNode(" Очистить период ",-1)])]),_:1})):i.createCommentVNode("",!0)]),s.value==="custom"?(i.openBlock(),i.createElementBlock("div",v1,[i.createVNode(i1,{from:l.value.from,to:l.value.to,onSelect:p},null,8,["from","to"])])):(i.openBlock(),i.createBlock(w1,{key:1,"active-key":d.value,"custom-periods":t.customPeriods,onApply:b,onPreview:y},null,8,["active-key","custom-periods"]))])]),_:1},8,["show","style"])}}}),N1={class:"flex w-full min-w-28 items-center gap-1"},$1={},R1=i.defineComponent({...$1,__name:"date-range",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},dateRange:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:date-range"],setup(t,{emit:e}){const n=t,r=e,o=i.ref(!1),s=i.computed(()=>{const u={...n.useDefaultPredefinedDateRanges?j.DateTimeProvider.defaultDateRanges():{},...n.predefinedDateRanges};return M.isEmpty(u)?void 0:u}),a=(u,h)=>{r("update:date-range",Qd(u,h,n.disabled))},l=u=>{var h;a(u,(h=n.dateRange)==null?void 0:h.to)},c=u=>{var h;a((h=n.dateRange)==null?void 0:h.from,u)},d=u=>{a(u.from,u.to)};return(u,h)=>{var m,p,b,y;const f=Z_,g=A.NButton;return i.openBlock(),i.createElementBlock("div",N1,[i.createVNode(eu,{from:(m=t.dateRange)==null?void 0:m.from,to:(p=t.dateRange)==null?void 0:p.to,clearable:t.clearable,disabled:t.disabled,"placeholder-from":t.placeholderFrom,"placeholder-to":t.placeholderTo,"date-format":t.dateFormat,class:"flex-1","onUpdate:from":l,"onUpdate:to":c},null,8,["from","to","clearable","disabled","placeholder-from","placeholder-to","date-format"]),i.createVNode(g,{disabled:!!((b=t.disabled)!=null&&b.from&&((y=t.disabled)!=null&&y.to)),title:"Выбрать период","aria-label":"Выбрать период",onClick:h[0]||(h[0]=_=>o.value=!0)},{default:i.withCtx(()=>[i.createVNode(f)]),_:1},8,["disabled"]),i.createVNode(T1,{show:o.value,"onUpdate:show":h[1]||(h[1]=_=>o.value=_),"date-range":t.dateRange,clearable:t.clearable,disabled:t.disabled,"custom-periods":s.value,"date-format":t.dateFormat,onSelect:d},null,8,["show","date-range","clearable","disabled","custom-periods","date-format"])])}}}),E1={class:"sc-lbl-date text-nowrap"},P1={},yo=i.defineComponent({...P1,__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(()=>je.format(e.date,j.useBaseConfigStateStore().config.dateFormats.uiDate)),r=i.computed(()=>je.format(e.date,"HH:mm"));return(o,s)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-col":t.isTimeOnSecondLine})},[i.createElementVNode("span",E1,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))}}),F1={class:"flex flex-row gap-2.5"},V1={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},M1={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},A1={class:"mb-0.5 sm:mb-0 sm:ml-3"},I1={},O1=i.defineComponent({...I1,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(t){return(e,n)=>{const r=po,o=A.NButton,s=A.NPopover;return i.openBlock(),i.createElementBlock("div",F1,[i.createElementVNode("div",V1,[i.renderSlot(e.$slots,"main")]),i.createElementVNode("div",null,[i.createElementVNode("div",M1,[i.renderSlot(e.$slots,"extra-buttons"),i.createElementVNode("div",A1,[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)])])])])}}}),z1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function D1(t,e){return i.openBlock(),i.createElementBlock("svg",z1,[...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 L1=i.markRaw({name:"ion-download-outline",render:D1}),H1={},W1=i.defineComponent({...H1,__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=L1;return i.openBlock(),i.createBlock(i.unref(A.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(A.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"])}}}),j1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function q1(t,e){return i.openBlock(),i.createElementBlock("svg",j1,[...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 X1=i.markRaw({name:"ion-checkmark-done-sharp",render:q1}),Y1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function U1(t,e){return i.openBlock(),i.createElementBlock("svg",Y1,[...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 K1=i.markRaw({name:"ion-options-outline",render:U1}),G1={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},Z1={class:"flex-auto"},Q1={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"},J1={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"},ew={},Ws=i.defineComponent({...ew,__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=K1,h=A.NButton,f=A.NPopover,g=X1,m=po;return i.openBlock(),i.createElementBlock("div",G1,[i.createElementVNode("div",Z1,[i.renderSlot(c.$slots,"default")]),i.createElementVNode("div",null,[i.createElementVNode("div",Q1,[i.createElementVNode("div",J1,[t.showEditButton?(i.openBlock(),i.createBlock(f,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(h,{disabled:t.disabled||r.value,type:"info",ghost:"",size:"small",onClick:o},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[0]||(d[0]=i.createTextVNode(" Редактировать данные ",-1))]),_:1})):i.createCommentVNode("",!0),t.showApplyButton?(i.openBlock(),i.createBlock(f,{key:1,disabled:r.value,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(h,{disabled:t.disabled||r.value,type:"primary",size:"small",onClick:a},{default:i.withCtx(()=>[i.createVNode(g)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[1]||(d[1]=i.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),t.showCancelButton?(i.openBlock(),i.createBlock(f,{key:2,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(h,{disabled:t.disabled||r.value,type:"error",size:"small",onClick:l},{default:i.withCtx(()=>[i.createVNode(m)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[2]||(d[2]=i.createTextVNode(" Отменить изменения ",-1))]),_:1})):i.createCommentVNode("",!0)]),i.renderSlot(c.$slots,"extra-buttons")])])])}}}),tw={},tu=i.defineComponent({...tw,__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(Ws,{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(Ws,{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"]))]))}}),nw={},iw=i.defineComponent({...nw,__name:"debounced-input",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:800},placeholder:{default:""}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,o=i.ref(n.value),s=i.computed(()=>i.inject("debounce-input-time",n.debounceTime)),a=M.debounce(()=>r("update:value",o.value),s.value),l=c=>{o.value=c,a()};return i.watch(()=>n.value,c=>{o.value=c}),(c,d)=>(i.openBlock(),i.createBlock(i.unref(A.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"]))}}),rw={},ow=i.defineComponent({...rw,__name:"debounced-input-number",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:500},placeholder:{default:""},min:{default:void 0},max:{default:void 0},step:{default:1},validator:{type:Function,default:void 0},parse:{type:Function,default:void 0},showButton:{type:Boolean,default:!0}},emits:["update:value","keydown","input","focus"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.ref(r.value),a=i.computed(()=>i.inject("debounce-input-time",r.debounceTime)),l=M.debounce(()=>o("update:value",s.value),a.value),c=g=>{s.value=g,l()};i.watch(()=>r.value,g=>{s.value=g});const d=i.ref(null);return e({focus:()=>{var g;return(g=d.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=d.value)==null?void 0:g.blur()},select:()=>{var g;return(g=d.value)==null?void 0:g.select()}}),(g,m)=>(i.openBlock(),i.createBlock(i.unref(A.NInputNumber),{ref_key:"inputReference",ref:d,value:s.value??null,clearable:t.clearable,parse:t.parse,"show-button":t.showButton,placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,validator:t.validator,"onUpdate:value":c,onKeydown:m[0]||(m[0]=p=>o("keydown",p)),onInput:m[1]||(m[1]=p=>o("input",p)),onFocus:m[2]||(m[2]=p=>o("focus",p))},{prefix:i.withCtx(()=>[i.renderSlot(g.$slots,"prefix")]),_:3},8,["value","clearable","parse","show-button","placeholder","min","max","step","validator"]))}}),sw={},aw=i.defineComponent({...sw,__name:"phone-input",props:{value:{},debounceTime:{},disabled:{type:Boolean},placeholder:{},defaultCountry:{},preferredCountries:{},onlyCountries:{}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,o=i.ref((n.value??"").replaceAll(/\D*/g,"")),s=M.debounce(c=>r("update:value",c),n.debounceTime??0),a=c=>{let d="";if(M.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(M.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof 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(af.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"]))}}),lw=Nn(aw,[["__scopeId","data-v-751dbb0e"]]),cw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function dw(t,e){return i.openBlock(),i.createElementBlock("svg",cw,[...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 uw=i.markRaw({name:"tabler-external-link",render:dw}),hw={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},fw=["href"],mw={},gw=i.defineComponent({...mw,__name:"external-link",props:{text:{},url:{},description:{}},setup(t){return(e,n)=>{const r=uw,o=A.NTooltip;return i.openBlock(),i.createBlock(o,{disabled:i.unref(M.isUndefined)(t.description),placement:"top-start"},{trigger:i.withCtx(()=>[i.createElementVNode("span",hw,[i.createElementVNode("a",{href:t.url,target:"_blank",class:"no-underline"},i.toDisplayString(t.text),9,fw),i.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.description),1)]),_:1},8,["disabled"])}}}),pw={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function yw(t,e){return i.openBlock(),i.createElementBlock("svg",pw,[...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 bw=i.markRaw({name:"ion-remove-circle-outline",render:yw});let bo=[];const nu=new WeakMap;function _w(){bo.forEach(t=>t(...nu.get(t))),bo=[]}function iu(t,...e){nu.set(t,e),!bo.includes(t)&&bo.push(t)===1&&requestAnimationFrame(_w)}function _r(t,e){let{target:n}=t;for(;n;){if(n.dataset&&n.dataset[e]!==void 0)return!0;n=n.parentElement}return!1}function wr(t){return t.composedPath()[0]||null}function xr(t){return typeof t=="string"?t.endsWith("px")?Number(t.slice(0,t.length-2)):Number(t):t}function kr(t){if(t!=null)return typeof t=="number"?`${t}px`:t.endsWith("px")?t:`${t}px`}function rn(t,e){const n=t.trim().split(/\s+/g),r={top:n[0]};switch(n.length){case 1:r.right=n[0],r.bottom=n[0],r.left=n[0];break;case 2:r.right=n[1],r.left=n[1],r.bottom=n[0];break;case 3:r.right=n[1],r.bottom=n[2],r.left=n[1];break;case 4:r.right=n[1],r.bottom=n[2],r.left=n[3];break;default:throw new Error("[seemly/getMargin]:"+t+" is not a valid value.")}return e===void 0?r:r[e]}const ru={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 ww(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 xw(t,e,n){e/=100,n/=100;let r=e*Math.min(n,1-n),o=(s,a=(s+t/30)%12)=>n-r*Math.max(Math.min(a-3,9-a,1),-1);return[o(0)*255,o(8)*255,o(4)*255]}const wn="^\\s*",xn="\\s*$",Gn="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Wt="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",mi="([0-9A-Fa-f])",gi="([0-9A-Fa-f]{2})",ou=new RegExp(`${wn}hsl\\s*\\(${Wt},${Gn},${Gn}\\)${xn}`),su=new RegExp(`${wn}hsv\\s*\\(${Wt},${Gn},${Gn}\\)${xn}`),au=new RegExp(`${wn}hsla\\s*\\(${Wt},${Gn},${Gn},${Wt}\\)${xn}`),lu=new RegExp(`${wn}hsva\\s*\\(${Wt},${Gn},${Gn},${Wt}\\)${xn}`),kw=new RegExp(`${wn}rgb\\s*\\(${Wt},${Wt},${Wt}\\)${xn}`),vw=new RegExp(`${wn}rgba\\s*\\(${Wt},${Wt},${Wt},${Wt}\\)${xn}`),Cw=new RegExp(`${wn}#${mi}${mi}${mi}${xn}`),Sw=new RegExp(`${wn}#${gi}${gi}${gi}${xn}`),Bw=new RegExp(`${wn}#${mi}${mi}${mi}${mi}${xn}`),Tw=new RegExp(`${wn}#${gi}${gi}${gi}${gi}${xn}`);function Ot(t){return parseInt(t,16)}function Nw(t){try{let e;if(e=au.exec(t))return[wo(e[1]),Zn(e[5]),Zn(e[9]),yi(e[13])];if(e=ou.exec(t))return[wo(e[1]),Zn(e[5]),Zn(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${t}.`)}catch(e){throw e}}function $w(t){try{let e;if(e=lu.exec(t))return[wo(e[1]),Zn(e[5]),Zn(e[9]),yi(e[13])];if(e=su.exec(t))return[wo(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=Sw.exec(t))return[Ot(e[1]),Ot(e[2]),Ot(e[3]),1];if(e=kw.exec(t))return[wt(e[1]),wt(e[5]),wt(e[9]),1];if(e=vw.exec(t))return[wt(e[1]),wt(e[5]),wt(e[9]),yi(e[13])];if(e=Cw.exec(t))return[Ot(e[1]+e[1]),Ot(e[2]+e[2]),Ot(e[3]+e[3]),1];if(e=Tw.exec(t))return[Ot(e[1]),Ot(e[2]),Ot(e[3]),yi(Ot(e[4])/255)];if(e=Bw.exec(t))return[Ot(e[1]+e[1]),Ot(e[2]+e[2]),Ot(e[3]+e[3]),yi(Ot(e[4]+e[4])/255)];if(t in ru)return pi(ru[t]);if(ou.test(t)||au.test(t)){const[n,r,o,s]=Nw(t);return[...xw(n,r,o),s]}else if(su.test(t)||lu.test(t)){const[n,r,o,s]=$w(t);return[...ww(n,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${t}.`)}catch(e){throw e}}function Rw(t){return t>1?1:t<0?0:t}function js(t,e,n,r){return`rgba(${wt(t)}, ${wt(e)}, ${wt(n)}, ${Rw(r)})`}function qs(t,e,n,r,o){return wt((t*e*(1-r)+n*r)/o)}function Ew(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 js(qs(t[0],n,e[0],r,o),qs(t[1],n,e[1],r,o),qs(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"?js(n,r,o,e.alpha):js(n,r,o,s)}function _o(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:pi(t),{lightness:a=1,alpha:l=1}=e;return Pw([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 wo(t){const e=Math.round(Number(t));return e>=360||e<0?0:e}function wt(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 Pw(t){const[e,n,r]=t;return 3 in t?`rgba(${wt(e)}, ${wt(n)}, ${wt(r)}, ${yi(t[3])})`:`rgba(${wt(e)}, ${wt(n)}, ${wt(r)}, 1)`}function Fw(t=8){return Math.random().toString(16).slice(2,2+t)}function cu(t){return Array.isArray(t)?t:[t]}const Xs={STOP:"STOP"};function du(t,e){const n=e(t);t.children!==void 0&&n!==Xs.STOP&&t.children.forEach(r=>du(r,e))}function Vw(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 Mw(t,e){const{isLeaf:n}=t;return n!==void 0?n:!e(t)}function Aw(t){return t.children}function Iw(t){return t.key}function Ow(){return!1}function zw(t,e){const{isLeaf:n}=t;return!(n===!1&&!Array.isArray(e(t)))}function Dw(t){return t.disabled===!0}function Lw(t,e){return t.isLeaf===!1&&!Array.isArray(e(t))}function Hw(t,e){if(t.isLeaf===!0){const n=e(t);if(Array.isArray(n)&&n.length>0)return!0}return!1}function Ys(t){var e;return t==null?[]:Array.isArray(t)?t:(e=t.checkedKeys)!==null&&e!==void 0?e:[]}function Us(t){var e;return t==null||Array.isArray(t)?[]:(e=t.indeterminateKeys)!==null&&e!==void 0?e:[]}function Ww(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)||n.add(r)}),Array.from(n)}function jw(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)&&n.delete(r)}),Array.from(n)}function qw(t){return(t==null?void 0:t.type)==="group"}function Xw(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 Yw extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function Uw(t,e,n,r){return xo(e.concat(t),n,r,!1)}function Kw(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 Gw(t,e,n,r){const o=xo(e,n,r,!1),s=xo(t,n,r,!0),a=Kw(t,n),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function Ks(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:Ww(n,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:jw(n,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(n),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let h;o!==void 0?h=Gw(o,n,e,d):r!==void 0?h=Uw(r,n,e,d):h=xo(n,e,d,!1);const f=c==="parent",g=c==="child"||l,m=h,p=new Set,b=Math.max.apply(null,Array.from(u.keys()));for(let y=b;y>=0;y-=1){const _=y===0,C=u.get(y);for(const x of C){if(x.isLeaf)continue;const{key:N,shallowLoaded:$}=x;if(g&&$&&x.children.forEach(B=>{!B.disabled&&!B.isLeaf&&B.shallowLoaded&&m.has(B.key)&&m.delete(B.key)}),x.disabled||!$)continue;let w=!0,v=!1,k=!0;for(const B of x.children){const R=B.key;if(!B.disabled){if(k&&(k=!1),m.has(R))v=!0;else if(p.has(R)){v=!0,w=!1;break}else if(w=!1,v)break}}w&&!k?(f&&x.children.forEach(B=>{!B.disabled&&m.has(B.key)&&m.delete(B.key)}),m.add(N)):v&&p.add(N),_&&g&&m.has(N)&&m.delete(N)}}return{checkedKeys:Array.from(m),indeterminateKeys:Array.from(p)}}function xo(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&&du(d,u=>{if(u.disabled)return Xs.STOP;const{key:h}=u;if(!a.has(h)&&(a.add(h),l.add(h),Lw(u.rawNode,s))){if(r)return Xs.STOP;if(!n)throw new Yw}})}),l}function Zw(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 Qw(t){if(t.length===0)return null;const e=t[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function Jw(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 uu(t,e,{loop:n=!1,includeDisabled:r=!1}={}){const o=e==="prev"?ex:Jw,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=Gs(d,s);u!==null?l=u:c(o(d,n))}else{const u=o(d,!1);if(u!==null)c(u);else{const h=tx(d);h!=null&&h.isGroup?c(o(h,n)):n&&c(o(d,!0))}}}}return c(t),l}function ex(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 tx(t){return t.parent}function Gs(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=Gs(d,e);if(u!==null)return u}else return d}}return null}const nx={getChild(){return this.ignored?null:Gs(this)},getParent(){const{parent:t}=this;return t!=null&&t.isGroup?t.getParent():t},getNext(t={}){return uu(this,"next",t)},getPrev(t={}){return uu(this,"prev",t)}};function ix(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 rx(t,e){const n=t.key;for(;e;){if(e.key===n)return!0;e=e.parent}return!1}var ox={};function hu(t,e,n,r,o,s=null,a=0){const l=[];return t.forEach((c,d)=>{var u;ox.NODE_ENV!=="production"&&Hw(c,o)&&console.error("[treemate]: node",c,"is invalid");const h=Object.create(r);if(h.rawNode=c,h.siblings=l,h.level=a,h.index=d,h.isFirstChild=d===0,h.isLastChild=d+1===t.length,h.parent=s,!h.ignored){const f=o(c);Array.isArray(f)&&(h.children=hu(f,e,n,r,o,h,a+1))}l.push(h),e.set(h.key,h),n.has(a)||n.set(a,[]),(u=n.get(a))===null||u===void 0||u.push(h)}),l}function sx(t,e={}){var n;const r=new Map,o=new Map,{getDisabled:s=Dw,getIgnored:a=Ow,getIsGroup:l=qw,getKey:c=Iw}=e,d=(n=e.getChildren)!==null&&n!==void 0?n:Aw,u=e.ignoreEmptyChildren?x=>{const N=d(x);return Array.isArray(N)?N.length?N:null:N}: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 Mw(this.rawNode,u)},get shallowLoaded(){return zw(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(x){return rx(this,x)}},nx),f=hu(t,r,o,h,u);function g(x){if(x==null)return null;const N=r.get(x);return N&&!N.isGroup&&!N.ignored?N:null}function m(x){if(x==null)return null;const N=r.get(x);return N&&!N.ignored?N:null}function p(x,N){const $=m(x);return $?$.getPrev(N):null}function b(x,N){const $=m(x);return $?$.getNext(N):null}function y(x){const N=m(x);return N?N.getParent():null}function _(x){const N=m(x);return N?N.getChild():null}const C={treeNodes:f,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(x){return ix(f,x)},getNode:g,getPrev:p,getNext:b,getParent:y,getChild:_,getFirstAvailableNode(){return Qw(f)},getPath(x,N={}){return Zw(x,N,C)},getCheckedKeys(x,N={}){const{cascade:$=!0,leafOnly:w=!1,checkStrategy:v="all",allowNotLoaded:k=!1}=N;return Ks({checkedKeys:Ys(x),indeterminateKeys:Us(x),cascade:$,leafOnly:w,checkStrategy:v,allowNotLoaded:k},C)},check(x,N,$={}){const{cascade:w=!0,leafOnly:v=!1,checkStrategy:k="all",allowNotLoaded:B=!1}=$;return Ks({checkedKeys:Ys(N),indeterminateKeys:Us(N),keysToCheck:x==null?[]:cu(x),cascade:w,leafOnly:v,checkStrategy:k,allowNotLoaded:B},C)},uncheck(x,N,$={}){const{cascade:w=!0,leafOnly:v=!1,checkStrategy:k="all",allowNotLoaded:B=!1}=$;return Ks({checkedKeys:Ys(N),indeterminateKeys:Us(N),keysToUncheck:x==null?[]:cu(x),cascade:w,leafOnly:v,checkStrategy:k,allowNotLoaded:B},C)},getNonLeafKeys(x={}){return Vw(f,x)}};return C}function ko(t){return t.composedPath()[0]}const ax={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function lx(t,e,n){if(t==="mousemoveoutside"){const r=o=>{e.contains(ko(o))||n(o)};return{mousemove:r,touchstart:r}}else if(t==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(ko(a))},s=a=>{r&&(e.contains(ko(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 fu(t,e,n){const r=ax[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=lx(t,e,n)),s}function cx(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=fu(t,e,n);return Object.keys(o).forEach(s=>{Pt(s,document,o[s],r)}),!0}return!1}function dx(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=fu(t,e,n);return Object.keys(o).forEach(s=>{ct(s,document,o[s],r)}),!0}return!1}function ux(){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,v,k){const B=w[v];return w[v]=function(){return k.apply(w,arguments),B.apply(w,arguments)},w}function s(w,v){w[v]=Event.prototype[v]}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,v){l!==void 0&&Object.defineProperty(w,"currentTarget",{configurable:!0,enumerable:!0,get:v??l.get})}const u={bubble:{},capture:{}},h={};function f(){const w=function(v){const{type:k,eventPhase:B,bubbles:R}=v,E=ko(v);if(B===2)return;const P=B===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(v,"stopPropagation",n),o(v,"stopImmediatePropagation",r),d(v,c),P==="capture"){if(Z===void 0)return;for(let D=I.length-1;D>=0&&!t.has(v);--D){const L=I[D],H=Z.get(L);if(H!==void 0){a.set(v,L);for(const z of H){if(e.has(v))break;z(v)}}if(D===0&&!R&&te!==void 0){const z=te.get(L);if(z!==void 0)for(const O of z){if(e.has(v))break;O(v)}}}}else if(P==="bubble"){if(te===void 0)return;for(let D=0;D<I.length&&!t.has(v);++D){const L=I[D],H=te.get(L);if(H!==void 0){a.set(v,L);for(const z of H){if(e.has(v))break;z(v)}}}}s(v,"stopPropagation"),s(v,"stopImmediatePropagation"),d(v)};return w.displayName="evtdUnifiedHandler",w}function g(){const w=function(v){const{type:k,eventPhase:B}=v;if(B!==2)return;const R=h[k];R!==void 0&&R.forEach(E=>E(v))};return w.displayName="evtdUnifiedWindowEventHandler",w}const m=f(),p=g();function b(w,v){const k=u[w];return k[v]===void 0&&(k[v]=new Map,window.addEventListener(v,m,w==="capture")),k[v]}function y(w){return h[w]===void 0&&(h[w]=new Set,window.addEventListener(w,p)),h[w]}function _(w,v){let k=w.get(v);return k===void 0&&w.set(v,k=new Set),k}function C(w,v,k,B){const R=u[v][k];if(R!==void 0){const E=R.get(w);if(E!==void 0&&E.has(B))return!0}return!1}function x(w,v){const k=h[w];return!!(k!==void 0&&k.has(v))}function N(w,v,k,B){let R;if(typeof B=="object"&&B.once===!0?R=Z=>{$(w,v,R,B),k(Z)}:R=k,cx(w,v,R,B))return;const P=B===!0||typeof B=="object"&&B.capture===!0?"capture":"bubble",W=b(P,w),I=_(W,v);if(I.has(R)||I.add(R),v===window){const Z=y(w);Z.has(R)||Z.add(R)}}function $(w,v,k,B){if(dx(w,v,k,B))return;const E=B===!0||typeof B=="object"&&B.capture===!0,P=E?"capture":"bubble",W=b(P,w),I=_(W,v);if(v===window&&!C(v,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(v),W.size===0&&(window.removeEventListener(w,m,P==="capture"),u[P][w]=void 0)}return{on:N,off:$}}const{on:Pt,off:ct}=ux(),Ki="@@mmoContext",hx={mounted(t,{value:e}){t[Ki]={handler:void 0},typeof e=="function"&&(t[Ki].handler=e,Pt("mousemoveoutside",t,e))},updated(t,{value:e}){const n=t[Ki];typeof e=="function"?n.handler?n.handler!==e&&(ct("mousemoveoutside",t,n.handler),n.handler=e,Pt("mousemoveoutside",t,e)):(t[Ki].handler=e,Pt("mousemoveoutside",t,e)):n.handler&&(ct("mousemoveoutside",t,n.handler),n.handler=void 0)},unmounted(t){const{handler:e}=t[Ki];e&&ct("mousemoveoutside",t,e),t[Ki].handler=void 0}},Gi="@@coContext",vo={mounted(t,{value:e,modifiers:n}){t[Gi]={handler:void 0},typeof e=="function"&&(t[Gi].handler=e,Pt("clickoutside",t,e,{capture:n.capture}))},updated(t,{value:e,modifiers:n}){const r=t[Gi];typeof e=="function"?r.handler?r.handler!==e&&(ct("clickoutside",t,r.handler,{capture:n.capture}),r.handler=e,Pt("clickoutside",t,e,{capture:n.capture})):(t[Gi].handler=e,Pt("clickoutside",t,e,{capture:n.capture})):r.handler&&(ct("clickoutside",t,r.handler,{capture:n.capture}),r.handler=void 0)},unmounted(t,{modifiers:e}){const{handler:n}=t[Gi];n&&ct("clickoutside",t,n,{capture:e.capture}),t[Gi].handler=void 0}};function fx(t,e){console.error(`[vdirs/${t}]: ${e}`)}class mx{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&&fx("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 Zs=new mx,Zi="@@ziContext",mu={mounted(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n;t[Zi]={enabled:!!o,initialized:!1},o&&(Zs.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&&(Zs.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;Zs.unregister(t,r)}};function gx(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 Qt(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 px=typeof window<"u";let Qi,vr;(()=>{var t,e;Qi=px?(e=(t=document)===null||t===void 0?void 0:t.fonts)===null||e===void 0?void 0:e.ready:void 0,vr=!1,Qi!==void 0?Qi.then(()=>{vr=!0}):vr=!0})();function yx(t){if(vr)return;let e=!1;i.onMounted(()=>{vr||Qi==null||Qi.then(()=>{e||t()})}),i.onBeforeUnmount(()=>{e=!0})}function Qs(t,e){return i.watch(t,n=>{n!==void 0&&(e.value=n)}),i.computed(()=>t.value===void 0?e.value:t.value)}function Co(){const t=i.ref(!1);return i.onMounted(()=>{t.value=!0}),i.readonly(t)}function gu(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 bx=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function _x(){return bx}function Js(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);return r()}function ea(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)){ea(r,e,n);return}if(r.type===i.Fragment){if(r.children===null)return;Array.isArray(r.children)&&ea(r.children,e,n)}else r.type!==i.Comment&&n.push(r)}}),n}function pu(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);const o=ea(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${t}]: slot[${n}] should have exactly one child.`)}let Qn=null;function yu(){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 wx(t,e){const n=yu();return{top:e,left:t,height:0,width:0,right:n.width-t,bottom:n.height-e}}function ta(t){const e=t.getBoundingClientRect(),n=yu();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 xx(t){return t.nodeType===9?null:t.parentNode}function bu(t){if(t===null)return null;const e=xx(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 bu(e)}const _u=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=y=>{r.value=y,n&&t.syncTargetWithParent&&n.setTargetRef(y)};let s=[];const a=()=>{let y=r.value;for(;y=bu(y),y!==null;)s.push(y);for(const _ of s)Pt("scroll",_,h,!0)},l=()=>{for(const y of s)ct("scroll",y,h,!0);s=[]},c=new Set,d=y=>{c.size===0&&a(),c.has(y)||c.add(y)},u=y=>{c.has(y)&&c.delete(y),c.size===0&&l()},h=()=>{iu(f)},f=()=>{c.forEach(y=>y())},g=new Set,m=y=>{g.size===0&&Pt("resize",window,b),g.has(y)||g.add(y)},p=y=>{g.has(y)&&g.delete(y),g.size===0&&ct("resize",window,b)},b=()=>{g.forEach(y=>y())};return i.onBeforeUnmount(()=>{ct("resize",window,b),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:m,removeResizeListener:p}},render(){return Js("binder",this.$slots)}}),wu=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(pu("follower",this.$slots),[[e]]):pu("follower",this.$slots)}}),kx="@css-render/vue3-ssr";function vx(t,e){return`<style cssr-id="${t}">
103
+ `}},ro=Li.Multiply,_p=[1,0,0,0,1,0,0,0,1],Kn=new hn(9),wp=_t.Utils,$c=new re,Cs=new hn([0,0,1,0,0,1,0,1,1,0,1,1]),xe={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Ye.document?Ye.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 hn(9)),this._matrix.toTransformArray(!0,Kn),ro(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=_t.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=_t.Utils.getRendererType(a._renderer.type);xe[l].render.call(a,t,e)}return this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(t,e){let n,r,o,s,a,l,c,d,u,h,f,g,m,p;const b=e._renderer.vertices,y=this.canvas,_=this.ctx,C=t.renderer.ratio,x=$c.copy(e._renderer.scale).multiply(C),N=e._stroke,$=e._linewidth,w=e._fill,v=e._renderer.opacity||e._opacity,k=e._cap,B=e._join,R=e._miter,E=e._closed,P=e.dashes,W=b.length,I=W-1;y.width=Math.max(Math.ceil(e._renderer.rect.width*x.x),1),y.height=Math.max(Math.ceil(e._renderer.rect.height*x.y),1);const Z=e._renderer.rect.centroid,te=Z.x,D=Z.y;if(_.clearRect(0,0,y.width,y.height),w)if(typeof w=="string")_.fillStyle=w;else{const Y=_t.Utils.getRendererType(w._renderer.type);xe[Y].render.call(w,_,e),_.fillStyle=w._renderer.effect}if(N){if(typeof N=="string")_.strokeStyle=N;else{const Y=_t.Utils.getRendererType(N._renderer.type);xe[Y].render.call(N,_,e),_.strokeStyle=N._renderer.effect}$&&(_.lineWidth=fn(e)),R&&(_.miterLimit=R),B&&(_.lineJoin=B),!E&&k&&(_.lineCap=k)}typeof v=="number"&&(_.globalAlpha=v),P&&P.length>0&&(_.lineDashOffset=P.offset||0,_.setLineDash(P));let L,H,z,O,U,K,V,q;_.save(),_.scale(x.x,x.y),_.translate(te,D),_.beginPath();for(let Y=0;Y<b.length;Y++){const ee=b[Y];switch(g=ee.x,m=ee.y,ee.command){case oe.close:_.closePath();break;case oe.arc:H=ee.rx,z=ee.ry,O=ee.xAxisRotation,U=ee.largeArcFlag,K=ee.sweepFlag,n=E?Lt(Y-1,W):Math.max(Y-1,0),r=b[n],V=r.x,q=r.y,wp.renderSvgArcCommand(_,V,q,H,z,U,K,O,g,m);break;case oe.curve:n=E?Lt(Y-1,W):Math.max(Y-1,0),r=b[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,m),Y>=I&&E&&(o=L,h=ee.controls&&ee.controls.right||re.zero,f=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=f.x+o.x,a=f.y+o.y):(s=f.x,a=f.y),g=o.x,m=o.y,_.bezierCurveTo(l,c,s,a,g,m));break;case oe.line:_.lineTo(g,m);break;case oe.move:L=ee,_.moveTo(g,m);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(N)||(p=N._renderer&&N._renderer.offset,p&&(_.save(),_.translate(-N._renderer.offset.x,-N._renderer.offset.y),_.scale(N._renderer.scale.x,N._renderer.scale.y),_.lineWidth=$/N._renderer.scale.x),_.stroke(),p&&_.restore()),_.restore()},getBoundingClientRect:function(t,e,n){let r=1/0,o=-1/0,s=1/0,a=-1/0,l,c;t.forEach(function(d){const u=d.x,h=d.y,f=d.controls;let g,m,p,b,y,_;s=Math.min(h,s),r=Math.min(u,r),o=Math.max(u,o),a=Math.max(h,a),d.controls&&(y=f.left,_=f.right,!(!y||!_)&&(g=d._relative?y.x+u:y.x,m=d._relative?y.y+h:y.y,p=d._relative?_.x+u:_.x,b=d._relative?_.y+h:_.y,!(!g||!m||!p||!b)&&(s=Math.min(m,b,s),r=Math.min(g,p,r),o=Math.max(g,p,o),a=Math.max(m,b,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=_t.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 Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ke&&(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 Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(a||l||c){this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Kn),ro(Kn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let h,f;this._scale instanceof re?(h=this._scale.x*r._renderer.scale.x,f=this._scale.y*r._renderer.scale.y):(h=this._scale*r._renderer.scale.x,f=this._scale*r._renderer.scale.y),this._renderer.scale.x=h<0?-h:h,this._renderer.scale.y=f<0?-f:f,c&&(this._renderer.parent=r)}if(this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const h=_t.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,Cs,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const u=this._renderer.rect;return t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform4f(s.rect,u.left,u.top,u.right,u.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(t,e){let n;const r=this.canvas,o=this.ctx,s=t.renderer.ratio,a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,h=e._size*s;let f=h;xe.isHidden.test(a)||(f+=l),r.width=bl(f),r.height=r.width;const g=f/r.width,m=r.width/2,p=r.height/2;if(o.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")o.fillStyle=c;else{const b=_t.Utils.getRendererType(c._renderer.type);xe[b].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const b=_t.Utils.getRendererType(a._renderer.type);xe[b].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=fn(e)/g)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(m,p),o.scale(xe.precision,xe.precision),o.beginPath(),o.arc(0,0,h/g*.5,0,yt),o.restore(),closed&&o.closePath(),xe.isHidden.test(c)||(n=c._renderer&&c._renderer.offset,n&&(o.save(),o.translate(-c._renderer.offset.x,-c._renderer.offset.y),o.scale(c._renderer.scale.x,c._renderer.scale.y)),o.fill(),n&&o.restore()),xe.isHidden.test(a)||(n=a._renderer&&a._renderer.offset,n&&(o.save(),o.translate(-a._renderer.offset.x,-a._renderer.offset.y),o.scale(a._renderer.scale.x,a._renderer.scale.y),o.lineWidth=l/a._renderer.scale.x),o.stroke(),n&&o.restore())},render:function(t,e,n){if(!this._visible||!this._opacity)return this;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const o=n||this.parent,s=e[this._renderer.type],a=this._sizeAttenuation,l=this._stroke,c=this._linewidth,d=o._matrix.manual||o._flagMatrix,u=this._matrix.manual||this._flagMatrix,h=this._renderer.parent!==o,f=this._renderer.vertices,g=this._renderer.collection.length,m=this._flagVertices,p=this._flagFill||this._fill instanceof Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ke&&(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 Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||o._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(d||u||h){this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Kn),ro(Kn,o._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let b,y;this._scale instanceof re?(b=this._scale.x*o._renderer.scale.x,y=this._scale.y*o._renderer.scale.y):(b=this._scale*o._renderer.scale.x,y=this._scale*o._renderer.scale.y),this._renderer.scale.x=b<0?-b:b,this._renderer.scale.y=y<0?-y:y,h&&(this._renderer.parent=o)}if(m){const b=this._renderer.positionBuffer;b&&t.deleteBuffer(b),this._renderer.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this._renderer.positionBuffer),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,f,t.STATIC_DRAW)}return p?(this._renderer.opacity=this._opacity*o._renderer.opacity,xe.updateTexture.call(xe,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture?this:(xe.isHidden.test(l)||(r+=c),r/=xe.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),e.current!==s&&(t.useProgram(s),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture),t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform1f(s.size,r*e.resolution.ratio),t.drawArrays(t.POINTS,0,g),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(t,e){const n=this.canvas,r=this.ctx,o=t.renderer.ratio,s=$c.copy(e._renderer.scale).multiply(o),a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,h=e._decoration,f=e._direction;n.width=Math.max(Math.ceil(e._renderer.rect.width*s.x),1),n.height=Math.max(Math.ceil(e._renderer.rect.height*s.y),1);const g=e._renderer.rect.centroid,m=g.x,p=g.y;let b,y,_,C,x,N,$,w,v,k,B;const R=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,n.width,n.height),R||(r.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=f,c)if(typeof c=="string")r.fillStyle=c;else{const E=_t.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=_t.Utils.getRendererType(a._renderer.type);xe[E].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=fn(e))}if(typeof d=="number"&&(r.globalAlpha=d),u&&u.length>0&&(r.lineDashOffset=u.offset||0,r.setLineDash(u)),r.save(),r.scale(s.x,s.y),r.translate(m,p),xe.isHidden.test(c)||(c._renderer&&c._renderer.offset?(N=c._renderer.scale.x,$=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(N,$),b=e._size/c._renderer.scale.y,y=e._leading/c._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=c._renderer.offset.x/c._renderer.scale.x,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?(N=a._renderer.scale.x,$=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(N,$),b=e._size/a._renderer.scale.y,y=e._leading/a._renderer.scale.y,r.font=[e._style,e._weight,b+"px/",y+"px",e._family].join(" "),_=a._renderer.offset.x/a._renderer.scale.x,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":v=E.actualBoundingBoxDescent,B=E.actualBoundingBoxDescent;break;case"strikethrough":v=0,B=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,v),r.lineTo(k,B),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=_t.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 Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ke&&(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 Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(s||a||l){this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Kn),ro(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=_t.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,Cs,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=_t.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 Wr};xe.ctx=xe.canvas.getContext("2d");var Rc=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 ut,this.scene.parent=this,this._renderer={type:"renderer",matrix:new hn(_p),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=Gt.create(e,Gt.path.vertex,Gt.types.vertex),o=Gt.create(e,Gt.path.fragment,Gt.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,Cs,e.STATIC_DRAW),r=Gt.create(e,Gt.points.vertex,Gt.types.vertex),o=Gt.create(e,Gt.points.fragment,Gt.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"?es(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}};S(Rc,"Utils",xe);var xp=ie.extend({Error:It,getRatio:es,read:Xe,xhr:vc},ie,Nt,ml,gl),Ce=class Or{constructor(e){S(this,"_events",new Q),S(this,"type",""),S(this,"renderer",null),S(this,"scene",null),S(this,"width",0),S(this,"height",0),S(this,"frameCount",0),S(this,"timeDelta",0),S(this,"playing",!1);const n=ie.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:Or.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=Or.Types[r])}this.renderer=new Or[this.type](this),this.setPlaying(n.autostart),this.frameCount=0,n.fullscreen?(this.fit=kp.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"}),Ht.bind(this.fit.domElement,"resize",this.fit),this.fit()):n.fitted?(this.fit=vp.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,Cp.bind(this)),this.scene=this.renderer.scene,Or.Instances.push(this),n.autostart&&mr.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,mr.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&&(Ht.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 Jr(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 Gr(e,n,r,o,s);return this.scene.add(a),a}makeCircle(e,n,r,o){const s=new Ur(e,n,r,o);return this.scene.add(s),s}makeEllipse(e,n,r,o,s){const a=new Kr(e,n,r,o,s);return this.scene.add(a),a}makeStar(e,n,r,o,s){const a=new gs(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 ms(e,n,r,o);return this.scene.add(s),s}makeArcSegment(e,n,r,o,s,a,l){const c=new ls(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 fs(r);return this.scene.add(o),o}makePath(e){const n=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let l=0;l<n;l+=2){const c=arguments[l];if(typeof c!="number")break;const d=arguments[l+1];r.push(new Be(c,d))}}const o=arguments[n-1],s=new $e(r,!(typeof o=="boolean"&&o)),a=s.getBoundingClientRect();return typeof a.top=="number"&&typeof a.left=="number"&&typeof a.right=="number"&&typeof a.bottom=="number"&&s.center().translation.set(a.left+a.width/2,a.top+a.height/2),this.scene.add(s),s}makeText(e,n,r,o){const s=new mn(e,n,r,o);return this.add(s),s}makeLinearGradient(e,n,r,o){const s=Array.prototype.slice.call(arguments,4),a=new Ue(e,n,r,o,s);return this.add(a),a}makeRadialGradient(e,n,r){const o=Array.prototype.slice.call(arguments,3),s=new Ke(e,n,r,o);return this.add(s),s}makeSprite(e,n,r,o,s,a,l){const c=new Yr(e,n,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,n,r,o,s,a){const l=new Cc(e,n,r,o,s,a);return this.add(l),l}makeImageSequence(e,n,r,o,s){const a=new _s(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 ut;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 Xe))return null;const s=Xe[o].call(this,e);return r?this.add(n&&s instanceof ut?s.children:s):s.parent&&s.remove(),s}load(e,n){const r=new ut;let o,s,a;const l=(function(c){for(Ht.temp.innerHTML=c,s=0;s<Ht.temp.children.length;s++)o=Ht.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof n=="function"){const d=Ht.temp.children.length<=1?Ht.temp.children[0]:Ht.temp.children;n(r,d)}}).bind(this);return/\.svg$/i.test(e)?(vc(e,l),r):(l(e),r)}};S(Ce,"NextFrameId",$t.NextFrameId),S(Ce,"Types",$t.Types),S(Ce,"Version",$t.Version),S(Ce,"PublishDate",$t.PublishDate),S(Ce,"Identifier",$t.Identifier),S(Ce,"Resolution",$t.Resolution),S(Ce,"AutoCalculateImportedMatrices",$t.AutoCalculateImportedMatrices),S(Ce,"Instances",$t.Instances),S(Ce,"uniqueId",$t.uniqueId),S(Ce,"Anchor",Be),S(Ce,"Collection",qn),S(Ce,"Events",Q),S(Ce,"Group",ut),S(Ce,"Matrix",Li),S(Ce,"Path",$e),S(Ce,"Registry",Wr),S(Ce,"Element",Di),S(Ce,"Shape",Yn),S(Ce,"Text",mn),S(Ce,"Vector",re),S(Ce,"Gradient",at),S(Ce,"Image",Cc),S(Ce,"ImageSequence",_s),S(Ce,"LinearGradient",Ue),S(Ce,"RadialGradient",Ke),S(Ce,"Sprite",Yr),S(Ce,"Stop",Xn),S(Ce,"Texture",Oe),S(Ce,"ArcSegment",ls),S(Ce,"Circle",Ur),S(Ce,"Ellipse",Kr),S(Ce,"Line",Jr),S(Ce,"Points",fs),S(Ce,"Polygon",ms),S(Ce,"Rectangle",Un),S(Ce,"RoundedRectangle",Gr),S(Ce,"Star",gs),S(Ce,"CanvasRenderer",_t),S(Ce,"SVGRenderer",Nc),S(Ce,"WebGLRenderer",Rc),S(Ce,"Commands",oe),S(Ce,"Utils",xp);var pn=Ce;function kp(){const t=document.body.getBoundingClientRect(),e=this.width=t.width,n=this.height=t.height;this.renderer.setSize(e,n,this.ratio)}function vp(){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 Cp(t,e){this.width=t,this.height=e,this.trigger(Q.Types.resize,t,e)}var mr=Ht.getRequestAnimationFrame();function Ec(){for(let t=0;t<pn.Instances.length;t++){const e=pn.Instances[t];e.playing&&e.update()}pn.NextFrameId=mr(Ec)}mr.init=function(){Ec(),mr.init=function(){}};let yn;typeof window<"u"?yn=window:typeof global<"u"?yn=global:typeof self<"u"&&(yn=self);let Pc;const di=Math.PI*2,ht=Math.PI*.5;function Sp(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 Bp(t){Pc=t}function Tp(t,e){e=e&&e.identity()||new Pc;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 Zt(t,e,n){return n*(e-t)+t}function ji(t,e){for(;t<0;)t+=e;return t%e}const Fc=yn.Float32Array||Array,Np=Math.floor;function bn(t){return Np(t*1e6)/1e6}const pe={move:"M",line:"L",curve:"C",close:"Z"};class ne{constructor(){T(this,"_events",{});T(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}}T(ne,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),T(ne,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Vc={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))}}},mt=class mt extends ne{constructor(n=0,r=0){super();T(this,"_x",0);T(this,"_y",0);for(let o in Vc)Object.defineProperty(this,o,Vc[o]);this.x=n,this.y=r}static add(n,r){return new mt(n.x+r.x,n.y+r.y)}static sub(n,r){return new mt(n.x-r.x,n.y-r.y)}static subtract(n,r){return mt.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(mt.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 mt(this.x,this.y)}add(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x+=n,this.y+=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x+=n.x,this.y+=n.y):(this.x+=n,this.y+=r),this)}addSelf(n){return this.add.apply(this,arguments)}sub(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x-=n,this.y-=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x-=n.x,this.y-=n.y):(this.x-=n,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(n){return this.sub.apply(this,arguments)}subtractSelf(n){return this.sub.apply(this,arguments)}multiply(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x*=n,this.y*=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x*=n.x,this.y*=n.y):(this.x*=n,this.y*=r),this)}multiplySelf(n){return this.multiply.apply(this,arguments)}multiplyScalar(n){return this.multiply(n)}divide(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x/=n,this.y/=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x/=n.x,this.y/=n.y):(this.x/=n,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(n){return this.divide.apply(this,arguments)}divideScalar(n){return this.divide(n)}negate(){return this.multiply(-1)}dot(n){return this.x*n.x+this.y*n.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(n){return Math.sqrt(this.distanceToSquared(n))}distanceToSquared(n){const r=this.x-n.x,o=this.y-n.y;return r*r+o*o}setLength(n){return this.normalize().multiplyScalar(n)}equals(n,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(n)<r}lerp(n,r){const o=(n.x-this.x)*r+this.x,s=(n.y-this.y)*r+this.y;return this.set(o,s)}isZero(n){return n=typeof n>"u"?1e-4:n,this.length()<n}toString(){return this.x+", "+this.y}toObject(){return{x:bn(this.x),y:bn(this.y)}}rotate(n){const r=this.x,o=this.y,s=Math.cos(n),a=Math.sin(n);return this.x=r*s-o*a,this.y=r*a+o*s,this}};T(mt,"zero",new mt),T(mt,"left",new mt(-1,0)),T(mt,"right",new mt(1,0)),T(mt,"up",new mt(0,-1)),T(mt,"down",new mt(0,1));let be=mt;class Fe extends be{constructor(n=0,r=0,o=0,s=0,a=0,l=0,c=pe.move){super(n,r);T(this,"controls",{left:new be,right:new be});T(this,"_command",pe.move);T(this,"_relative",!0);T(this,"_rx",0);T(this,"_ry",0);T(this,"_xAxisRotation",0);T(this,"_largeArcFlag",0);T(this,"_sweepFlag",1);for(let u in Mc)Object.defineProperty(this,u,Mc[u]);this.command=c,this.relative=!0;const d=Fe.makeBroadcast(this);this.controls.left.set(o,s).addEventListener(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:bn(this.x),y:bn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:bn(this.rx),ry:bn(this.ry),xAxisRotation:bn(this.xAxisRotation),largeArcFlag:bn(this.largeArcFlag),sweepFlag:bn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const Mc={command:{enumerable:!0,get:function(){return this._command},set:function(t){this._command!==t&&(this._command=t,this._bound&&this.dispatchEvent(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 $p=0;const Ss={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return $p++}},oo={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 so(t,e,n,r,o){const s=1-t;return s*s*s*e+3*s*s*t*n+3*s*t*t*r+t*t*t*o}function Ac(t,e,n,r,o,s,a,l,c){c=c||oo.RecursionLimit;const d=c+1;if(Math.abs(t-a)<.001&&Math.abs(e-l)<.001)return[new Fe(a,l)];const u=[];for(let h=0;h<d;h++){const f=h/d,g=so(f,t,n,o,a),m=so(f,e,r,s,l);u.push(new Fe(g,m))}return u}function Rp(t,e,n,r,o,s,a,l,c){if(t===n&&e===r&&o===a&&s===l){const b=a-t,y=l-e;return Math.sqrt(b*b+y*y)}const d=9*(n-o)+3*(a-t),u=6*(t+o)-12*n,h=3*(n-t),f=9*(r-s)+3*(l-e),g=6*(e+s)-12*r,m=3*(r-e);function p(b){const y=(d*b+u)*b+h,_=(f*b+g)*b+m;return Math.sqrt(y*y+_*_)}return Pp(p,0,1,c||oo.RecursionLimit)}function Ep(t,e,n,r,o,s,a,l){const c=[],d=[[],[]];let u,h,f,g,m,p,b,y;for(let N=0;N<2;++N){if(N===0?(h=6*t-12*n+6*o,u=-3*t+9*n-9*o+3*a,f=3*n-3*t):(h=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,f=3*r-3*e),Math.abs(u)<.001){if(Math.abs(h)<.001)continue;g=-f/h,0<g&&g<1&&c.push(g);continue}b=h*h-4*f*u,y=Math.sqrt(b),!(b<0)&&(m=(-h+y)/(2*u),0<m&&m<1&&c.push(m),p=(-h-y)/(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 Pp(t,e,n,r){let o=oo.abscissas[r-2],s=oo.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 Fp(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];Vp(c,d,u),d.command=o===0?pe.move:pe.curve}}function Vp(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+=ht:l-=ht,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 gr=(Bi=class extends ne{constructor(){super();T(this,"_flagId",!1);T(this,"_flagClassName",!1);T(this,"_renderer",{});T(this,"_id",Ss.Identifier+Ss.uniqueId());T(this,"_className","");T(this,"classList",[]);for(let n in Ic)Object.defineProperty(this,n,Ic[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}},T(Bi,"Properties",["renderer","id","className"]),Bi);const Ic={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 ao extends Error{constructor(n){super();T(this,"name","Two.js");T(this,"message");this.message=n}}class Mp{constructor(){T(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 lo;const Oc={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};yn.document&&(lo=document.createElement("a"));const Ze=class Ze extends gr{constructor(n,r){super();T(this,"_flagSrc",!1);T(this,"_flagImage",!1);T(this,"_flagVideo",!1);T(this,"_flagLoaded",!1);T(this,"_flagRepeat",!1);T(this,"_flagOffset",!1);T(this,"_flagScale",!1);T(this,"_src","");T(this,"_image",null);T(this,"_loaded",!1);T(this,"_repeat","no-repeat");T(this,"_scale",1);T(this,"_offset",null);for(let o in zc)Object.defineProperty(this,o,zc[o]);if(this._renderer.type="texture",this._renderer.flagOffset=Ap.bind(this),this._renderer.flagScale=Ip.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 Ze().copy(n);return"id"in n&&(r.id=n.id),r}static getAbsoluteURL(n){return lo?(lo.href=n,lo.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=Ze.getAbsoluteURL(n);if(Ze.ImageRegistry.contains(r))return Ze.ImageRegistry.get(r);let o;return yn.document?Oc.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=Ze.getTag(o);n._flagImage&&(/canvas/i.test(s)?Ze.Register.canvas(n,r):(n._src=o.getAttribute("two-src")||o.src,Ze.Register[s](n,r))),n._flagSrc&&(o||(o=Ze.getImage(n.src),n.image=o),s=Ze.getTag(o),Ze.Register[s](n,r))}clone(){const n=new Ze(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,Ze.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}};T(Ze,"Properties",["src","loaded","repeat","scale","offset","image"]),T(Ze,"RegularExpressions",Oc),T(Ze,"ImageRegistry",new Mp),T(Ze,"Register",{canvas:function(n,r){n._src="#"+n.id,Ze.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 ao("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=Ze.getAbsoluteURL(n._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",n.src),Ze.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 ao("unable to load "+n.src)};n._src=Ze.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),Ze.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 Ge=Ze;const zc={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=Ge.getTag(t);let n;switch(e){case"canvas":n="#"+t.id;break;default:n=t.src}Ge.ImageRegistry.contains(n)?this._image=Ge.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 Ap(){this._flagOffset=!0}function Ip(){this._flagScale=!0}class ui extends Array{constructor(){super();Xa(this,gt,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 Mt(this,gt)}set _events(n){of(this,gt,n)}get _bound(){return Mt(this,gt)._bound}set _bound(n){Mt(this,gt)._bound=n}addEventListener(){return Mt(this,gt).addEventListener.apply(this,arguments)}on(){return Mt(this,gt).on.apply(this,arguments)}bind(){return Mt(this,gt).bind.apply(this,arguments)}removeEventListener(){return Mt(this,gt).removeEventListener.apply(this,arguments)}off(){return Mt(this,gt).off.apply(this,arguments)}unbind(){return Mt(this,gt).unbind.apply(this,arguments)}dispatchEvent(){return Mt(this,gt).dispatchEvent.apply(this,arguments)}trigger(){return Mt(this,gt).trigger.apply(this,arguments)}listen(){return Mt(this,gt).listen.apply(this,arguments)}ignore(){return Mt(this,gt).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}}gt=new WeakMap;const Dc=Array.prototype.slice;function Op(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=Dc.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=Dc.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=!Op(t)&&Object.keys(t),s=(o||t).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,t[l],l,t)}return t},performance:yn.performance&&yn.performance.now?yn.performance:Date},zt=class zt extends gr{constructor(n,r,o){super();T(this,"_flagOffset",!0);T(this,"_flagOpacity",!0);T(this,"_flagColor",!0);T(this,"_offset",0);T(this,"_opacity",1);T(this,"_color","#fff");for(let s in Lc)Object.defineProperty(this,s,Lc[s]);this._renderer.type="stop",this.offset=typeof n=="number"?n:zt.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:zt.Index<=0?"#fff":"#000",zt.Index=(zt.Index+1)%2}static fromObject(n){const r=new zt().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<zt.Properties.length;r++){const o=zt.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new zt;return Me.each(zt.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(zt.Properties,r=>{n[r]=this[r]},this),n}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};T(zt,"Index",0),T(zt,"Properties",["offset","opacity","color"]);let hi=zt;const Lc={offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},vn=class vn extends gr{constructor(n){super();T(this,"_flagStops",!1);T(this,"_flagSpread",!1);T(this,"_flagUnits",!1);T(this,"_spread","");T(this,"_units","");for(let r in Hc)Object.defineProperty(this,r,Hc[r]);this._renderer.type="gradient",this._renderer.flagStops=zp.bind(this),this._renderer.bindStops=Dp.bind(this),this._renderer.unbindStops=Lp.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 vn(r).copy(n);return"id"in n&&(o.id=n.id),o}clone(n){const r=this.stops.map(s=>s.clone()),o=new vn(r);return Me.each(vn.Properties,s=>{o[s]=this[s]},this),n&&n.add(o),o}copy(n){super.copy.call(this,n);for(let r=0;r<vn.Properties.length;r++){const o=vn.Properties[r];o in n&&(this[o]=n[o])}return this}toObject(){const n={stops:this.stops.map(r=>r.toObject())};return Me.each(vn.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}};T(vn,"Stop",hi),T(vn,"Properties",["spread","stops","units"]);let lt=vn;const Hc={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 zp(){this._flagStops=!0}function Dp(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function Lp(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 lt{constructor(n,r,o,s,a){super(a);T(this,"_flagEndPoints",!1);T(this,"_left",null);T(this,"_right",null);for(let l in Wc)Object.defineProperty(this,l,Wc[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=Hp.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(lt.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}};T(ti,"Stop",hi),T(ti,"Properties",["left","right"]);let Rt=ti;const Wc={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 Hp(){this._flagEndPoints=!0}const Cn=class Cn extends lt{constructor(n,r,o,s,a,l){super(s);T(this,"_flagRadius",!1);T(this,"_flagCenter",!1);T(this,"_flagFocal",!1);T(this,"_radius",0);T(this,"_center",null);T(this,"_focal",null);for(let c in jc)Object.defineProperty(this,c,jc[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Wp.bind(this),this._renderer.flagFocal=jp.bind(this),this.center=new be,this.radius=typeof o=="number"?o:1,this.focal=new be,typeof n=="number"&&(this.center.x=n),typeof r=="number"&&(this.center.y=r),this.focal.copy(this.center),typeof a=="number"&&(this.focal.x=a),typeof l=="number"&&(this.focal.y=l)}static fromObject(n){const r=new Cn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Cn.Properties.length;r++){const o=Cn.Properties[r];o in n&&(/(center|focal)i/.test(o)?this[o]=n[o]instanceof be?n[o]:new be().copy(n[o]):typeof n[o]=="number"&&(this[o]=n[MediaKeySystemAccess]))}return this}clone(n){const r=this.stops.map(function(s){return s.clone()}),o=new Cn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return Me.each(lt.Properties.concat(Cn.Properties),function(s){o[s]=this[s]},this),n&&n.add(o),o}toObject(){const n=super.toObject.call(this);return Me.each(Cn.Properties,function(r){n[r]=this[r]},this),n.center=this.center.toObject(),n.focal=this.focal.toObject(),n}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(ne.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};T(Cn,"Stop",hi),T(Cn,"Properties",["center","radius","focal"]);let Et=Cn;const jc={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 Wp(){this._flagCenter=!0}function jp(){this._flagFocal=!0}function qc(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 co(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 Xc(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,f=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(f||t).x,d=(f||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),f&&t._relative&&(s+=t.x,d+=t.y),Rp(r,l,o,c,s,d,a,u,n)}function Yc(t,e,n){let r,o,s,a,l,c,d,u;const h=e.controls&&e.controls.right,f=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(h||e).x,c=(h||e).y,s=(f||t).x,d=(f||t).y,a=t.x,u=t.y,h&&e._relative&&(o+=e.x,c+=e.y),f&&t._relative&&(s+=t.x,d+=t.y),Ac(r,l,o,c,s,d,a,u,n)}function fi(t){switch(t.renderer.type){case"texture":return Ge.fromObject(t);case"gradient":return lt.fromObject(t);case"linear-gradient":return Rt.fromObject(t);case"radial-gradient":return Et.fromObject(t)}return t}const qp=Math.cos,Xp=Math.sin,Uc=Math.tan,Bs=[],Ft=class Ft extends ne{constructor(n,r,o,s,a,l){super();T(this,"elements",new Fc(9));T(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 v,k,B;const R=r[0]||0,E=r[1]||0,P=r[2]||0;return v=w[0]*R+w[1]*E+w[2]*P,k=w[3]*R+w[4]*E+w[5]*P,B=w[6]*R+w[7]*E+w[8]*P,[v,k,B]}const s=n[0],a=n[1],l=n[2],c=n[3],d=n[4],u=n[5],h=n[6],f=n[7],g=n[8],m=r[0],p=r[1],b=r[2],y=r[3],_=r[4],C=r[5],x=r[6],N=r[7],$=r[8];return o=o||new Fc(9),o[0]=s*m+a*y+l*x,o[1]=s*p+a*_+l*N,o[2]=s*b+a*C+l*$,o[3]=c*m+d*y+u*x,o[4]=c*p+d*_+u*N,o[5]=c*b+d*C+u*$,o[6]=h*m+f*y+g*x,o[7]=h*p+f*_+g*N,o[8]=h*b+f*C+g*$,o}static fromObject(n){return new Ft().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]=Ft.Identity[0],this.elements[1]=Ft.Identity[1],this.elements[2]=Ft.Identity[2],this.elements[3]=Ft.Identity[3],this.elements[4]=Ft.Identity[4],this.elements[5]=Ft.Identity[5],this.elements[6]=Ft.Identity[6],this.elements[7]=Ft.Identity[7],this.elements[8]=Ft.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,f=[n,r,o,s,a,l,c,d,u],g=h[0],m=h[1],p=h[2],b=h[3],y=h[4],_=h[5],C=h[6],x=h[7],N=h[8],$=f[0],w=f[1],v=f[2],k=f[3],B=f[4],R=f[5],E=f[6],P=f[7],W=f[8];return this.elements[0]=g*$+m*k+p*E,this.elements[1]=g*w+m*B+p*P,this.elements[2]=g*v+m*R+p*W,this.elements[3]=b*$+y*k+_*E,this.elements[4]=b*w+y*B+_*P,this.elements[5]=b*v+y*R+_*W,this.elements[6]=C*$+x*k+N*E,this.elements[7]=C*w+x*B+N*P,this.elements[8]=C*v+x*R+N*W,this.trigger(ne.Types.change)}inverse(n){const r=this.elements;n=n||new Ft;const o=r[0],s=r[1],a=r[2],l=r[3],c=r[4],d=r[5],u=r[6],h=r[7],f=r[8],g=f*c-d*h,m=-f*l+d*u,p=h*l-c*u;let b=o*g+s*m+a*p;return b?(b=1/b,n.elements[0]=g*b,n.elements[1]=(-f*s+a*h)*b,n.elements[2]=(d*s-a*c)*b,n.elements[3]=m*b,n.elements[4]=(f*o-a*u)*b,n.elements[5]=(-d*o+a*l)*b,n.elements[6]=p*b,n.elements[7]=(-h*o+s*u)*b,n.elements[8]=(c*o-s*l)*b,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=qp(n),o=Xp(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=Uc(n);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(n){const r=Uc(n);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(n){return Bs.length=0,this.toTransformArray(n,Bs),Bs.map(bn).join(" ")}toTransformArray(n,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],h=o[5];if(n){const f=o[6],g=o[7],m=o[8];if(s){r[0]=a,r[1]=d,r[2]=f,r[3]=l,r[4]=u,r[5]=g,r[6]=c,r[7]=h,r[8]=m;return}return[a,d,f,l,u,g,c,h,m]}if(s){r[0]=a,r[1]=d,r[2]=l,r[3]=u,r[4]=c,r[5]=h;return}return[a,d,l,u,c,h]}toArray(n,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],h=o[5];if(n){const f=o[6],g=o[7],m=o[8];if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=h,r[6]=f,r[7]=g,r[8]=m;return}return[a,l,c,d,u,h,f,g,m]}if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=h;return}return[a,l,c,d,u,h]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Ft().copy(this)}};T(Ft,"Identity",[1,0,0,0,1,0,0,0,1]);let pr=Ft;Bp(pr);const Vr=class Vr extends gr{constructor(){super();T(this,"_flagMatrix",!0);T(this,"_flagScale",!1);T(this,"_matrix",null);T(this,"_worldMatrix",null);T(this,"_position",null);T(this,"_rotation",0);T(this,"_scale",1);T(this,"_skewX",0);T(this,"_skewY",0);for(let n in uo)Object.defineProperty(this,n,uo[n]);this._renderer.flagMatrix=Kc.bind(this),this.isShape=!0,this.matrix=new pr,this.worldMatrix=new pr,this.position=new be,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(n){const r=new Vr().copy(n);return"id"in n&&(r.id=n.id),r}get renderer(){return this._renderer}set renderer(n){this._renderer=n}get translation(){return uo.position.get.apply(this,arguments)}set translation(n){uo.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 Vr;return r.position.copy(this.position),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer={type:"shape"},n.isShape=!0,n.translation=this.translation.toObject(),n.rotation=this.translation.rotation,n.scale=this.scale instanceof 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}};T(Vr,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let Rn=Vr;const uo={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),Kc.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 Tp(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function Kc(){this._flagMatrix=!0}const qi=Math.min,Xi=Math.max,Yp=Math.ceil,Up=Math.floor,Kp=new be,sn=class sn extends Rn{constructor(n,r,o,s){super();T(this,"_flagVertices",!0);T(this,"_flagLength",!0);T(this,"_flagFill",!0);T(this,"_flagStroke",!0);T(this,"_flagLinewidth",!0);T(this,"_flagOpacity",!0);T(this,"_flagVisible",!0);T(this,"_flagCap",!0);T(this,"_flagJoin",!0);T(this,"_flagMiter",!0);T(this,"_flagStrokeAttenuation",!0);T(this,"_flagMask",!1);T(this,"_flagClip",!1);T(this,"_length",0);T(this,"_fill","#fff");T(this,"_stroke","#000");T(this,"_linewidth",1);T(this,"_opacity",1);T(this,"_visible",!0);T(this,"_cap","round");T(this,"_join","round");T(this,"_miter",4);T(this,"_closed",!0);T(this,"_curved",!1);T(this,"_automatic",!0);T(this,"_beginning",0);T(this,"_ending",1);T(this,"_mask",null);T(this,"_clip",!1);T(this,"_dashes",null);T(this,"_strokeAttenuation",!0);for(let a in Gc)Object.defineProperty(this,a,Gc[a]);this._renderer.type="path",this._renderer.flagVertices=Zc.bind(this),this._renderer.bindVertices=Qc.bind(this),this._renderer.unbindVertices=Jc.bind(this),this._renderer.flagFill=ed.bind(this),this._renderer.flagStroke=td.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 sn().copy({...n,fill:r,stroke:o});return"id"in n&&(s.id=n.id),s}copy(n){if(super.copy.call(this,n),n.vertices){this.vertices=[];for(let r=0;r<n.vertices.length;r++){const o=n.vertices[r];o instanceof Fe?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Fe().copy(o))}}for(let r=0;r<sn.Properties.length;r++){const o=sn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new sn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<sn.Properties.length;o++){const s=sn.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="path",n.vertices=this.vertices.map(r=>r.toObject()),Me.each(sn.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const n=this.getBoundingClientRect(!0),r=n.width/2,o=n.height/2,s=n.left+n.width/2,a=n.top+n.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=s,c.y-=a,c.x+=r,c.y+=o}return this.mask&&(this.mask.translation.x-=s,this.mask.translation.x+=r,this.mask.translation.y-=a,this.mask.translation.y+=o),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,o=n.top+n.height/2-this.translation.y;for(let s=0;s<this.vertices.length;s++){const a=this.vertices[s];a.x-=r,a.y-=o}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getBoundingClientRect(n){let r,o,s,a,l,c,d=1/0,u=-1/0,h=1/0,f=-1/0;if(this._update(!0),r=n?this.matrix:this.worldMatrix,o=(this.linewidth||0)/2,s=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:g,scaleY:m}=Sp(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof g=="number"&&typeof m=="number"&&(o=Math.max(g,m)*(this.linewidth||0)/2)}else o*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(s<=0)return{width:0,height:0};for(a=0;a<s;a++){c=this._renderer.vertices[a],l=this._renderer.vertices[(a+s-1)%s];const[g,m]=r.multiply(l.x,l.y),[p,b]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let y=l.controls.right.x,_=l.controls.right.y;l.relative&&(y+=l.x,_+=l.y);let[C,x]=r.multiply(y,_),N=c.controls.left.x,$=c.controls.left.y;c.relative&&(N+=c.x,$+=c.y);let[w,v]=r.multiply(N,$);const k=Ep(g,m,C,x,w,v,p,b);h=qi(k.min.y-o,h),d=qi(k.min.x-o,d),u=Xi(k.max.x+o,u),f=Xi(k.max.y+o,f)}else a<=1&&(h=qi(m-o,h),d=qi(g-o,d),u=Xi(g+o,u),f=Xi(m+o,f)),h=qi(b-o,h),d=qi(p-o,d),u=Xi(p+o,u),f=Xi(b+o,f)}return{top:h,left:d,right:u,bottom:f,width:u-d,height:f-h}}getPointAt(n,r){let o,s,a,l,c,d,u,h,f,g,m,p,b,y,_,C=this.length*Math.min(Math.max(n,0),1);const x=this.vertices.length,N=x-1;let $=null,w=null;for(let D=0,L=this._lengths.length,H=0;D<L;D++){if(H+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),N)),$=this.vertices[o],w=this.vertices[s],C-=H,this._lengths[D]!==0?n=C/this._lengths[D]:n=0;break}H+=this._lengths[D]}if($===null||w===null)return null;if($){if(!w)return $}else return w;_=w.controls&&w.controls.right,y=$.controls&&$.controls.left,c=w.x,g=w.y,d=(_||w).x,m=(_||w).y,u=(y||$).x,p=(y||$).y,h=$.x,b=$.y,_&&w.relative&&(d+=w.x,m+=w.y),y&&$.relative&&(u+=$.x,p+=$.y),l=so(n,c,d,u,h),f=so(n,g,m,p,b);const v=Zt(c,d,n),k=Zt(g,m,n),B=Zt(d,u,n),R=Zt(m,p,n),E=Zt(u,h,n),P=Zt(p,b,n),W=Zt(v,B,n),I=Zt(k,R,n),Z=Zt(B,E,n),te=Zt(R,P,n);return Me.isObject(r)?(r.x=l,r.y=f,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-=f,r.controls.right.x-=l,r.controls.right.y-=f)),r.t=n,r):(a=new Fe(l,f,W-l,I-f,Z-l,te-f,this._curved?pe.curve:pe.line),a.t=n,a)}plot(){if(this.curved)return Fp(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=Yc(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=Yc(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]=Xc(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=co(this,o*this._length),l=co(this,s*this._length),c=Yp(a),d=Up(l);let u,h,f,g,m,p;for(this._renderer.vertices.length=0,p=0;p<n;p++)this._renderer.collection.length<=p&&this._renderer.collection.push(new Fe),p>d&&!h?(m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(s,m),m.command=this._renderer.collection[p].command,this._renderer.vertices.push(m),h=m,f=this._collection[p-1],f&&f.controls&&(m.relative?m.controls.right.clear():m.controls.right.copy(m),f.relative?this._renderer.collection[p-1].controls.right.copy(f.controls.right).lerp(be.zero,1-m.t):this._renderer.collection[p-1].controls.right.copy(f.controls.right).lerp(f,1-m.t))):p>=c&&p<=d&&(m=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(m),p===d&&qc(this,s)?(h=m,!r&&h.controls&&(h.relative?h.controls.right.clear():h.controls.right.copy(h))):p===c&&qc(this,o)&&(u=m,u.command=pe.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(p=c-1,m=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(o,m),m.command=pe.move,this._renderer.vertices.unshift(m),g=this._collection[p+1],g&&g.controls&&(m.controls.left.clear(),g.relative?this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(be.zero,m.t):(Kp.copy(g),this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(g,m.t))))}return Rn.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,Rn.prototype.flagReset.call(this),this}};T(sn,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),T(sn,"Utils",{getCurveLength:Xc});let Ae=sn;const Gc={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 lt||this._fill instanceof Rt||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof lt||this._fill instanceof Rt||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof lt||this._stroke instanceof Rt||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof lt||this._stroke instanceof Rt||this._stroke instanceof Et||this._stroke instanceof Ge)&&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 Zc(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Qc(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Jc(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function ed(){this._flagFill=!0}function td(){this._flagStroke=!0}const Gp=Math.ceil,Zp=Math.floor,Sn=class Sn extends Rn{constructor(n){super();T(this,"_flagVertices",!0);T(this,"_flagLength",!0);T(this,"_flagFill",!0);T(this,"_flagStroke",!0);T(this,"_flagLinewidth",!0);T(this,"_flagOpacity",!0);T(this,"_flagVisible",!0);T(this,"_flagSize",!0);T(this,"_flagSizeAttenuation",!0);T(this,"_flagStrokeAttenuation",!0);T(this,"_length",0);T(this,"_fill","#fff");T(this,"_stroke","#000");T(this,"_linewidth",1);T(this,"_opacity",1);T(this,"_visible",!0);T(this,"_size",1);T(this,"_sizeAttenuation",!1);T(this,"_beginning",0);T(this,"_ending",1);T(this,"_dashes",null);T(this,"_strokeAttenuation",!0);T(this,"noFill",Ae.prototype.noFill);T(this,"noStroke",Ae.prototype.noStroke);T(this,"corner",Ae.prototype.corner);T(this,"center",Ae.prototype.center);T(this,"getBoundingClientRect",Ae.prototype.getBoundingClientRect);T(this,"_updateLength",Ae.prototype._updateLength);for(let r in nd)Object.defineProperty(this,r,nd[r]);this._renderer.type="points",this._renderer.flagVertices=Zc.bind(this),this._renderer.bindVertices=Qc.bind(this),this._renderer.unbindVertices=Jc.bind(this),this._renderer.flagFill=ed.bind(this),this._renderer.flagStroke=td.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 Sn().copy({...n,fill:r,stroke:o});return"id"in n&&(s.id=n.id),s}copy(n){super.copy.call(this,n);for(let r=0;r<n.vertices.length;r++){const o=n.vertices[r];o instanceof Fe?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Fe().copy(o))}for(let r=0;r<Sn.Properties.length;r++){const o=Sn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Sn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Sn.Properties.length;o++){const s=Sn.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="points",n.vertices=this.vertices.map(r=>r.toObject()),Me.each(Sn.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];typeof r.unbind=="function"&&r.unbind()}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}subdivide(n){this._update();let r=[];for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o],a=this.vertices[o-1];if(!a)continue;const l=s.x,c=s.y,d=a.x,u=a.y,h=Ac(l,c,l,c,d,u,d,u,n);r=r.concat(h)}return this.vertices=r,this}_update(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);const n=Math.min(this._beginning,this._ending),r=Math.max(this._beginning,this._ending),o=co(this,n*this._length),s=co(this,r*this._length),a=Gp(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}};T(Sn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let ho=Sn;const nd={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 lt||this._fill instanceof Rt||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof lt||this._fill instanceof Rt||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof lt||this._stroke instanceof Rt||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof lt||this._stroke instanceof Rt||this._stroke instanceof Et||this._stroke instanceof Ge)&&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 id extends ui{constructor(n){n=Array.isArray(n)?n:Array.prototype.slice.call(arguments);super(n);Xa(this,zo,{});this.attach(n),this.on(ne.Types.insert,this.attach),this.on(ne.Types.remove,this.detach)}get ids(){return Mt(this,zo)}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}}zo=new WeakMap;const Mn=class Mn extends Ae{constructor(n,r,o,s,a,l,c){const d=c||Ss.Resolution*3,u=[];for(let h=0;h<d;h++)u.push(new Fe);super(u,!0,!1,!0);T(this,"_flagStartAngle",!1);T(this,"_flagEndAngle",!1);T(this,"_flagInnerRadius",!1);T(this,"_flagOuterRadius",!1);T(this,"_startAngle",0);T(this,"_endAngle",di);T(this,"_innerRadius",0);T(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let h in rd)Object.defineProperty(this,h,rd[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 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._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,f,g,m,p,b,y,_,C,x;for(a?d--:l||(d-=2),f=0,g=d-1;f<d;f++){switch(m=f/g,p=c[h],b=m*(r-n)+n,y=(r-n)/d,_=s*Math.cos(b),C=s*Math.sin(b),f){case 0:u=pe.move;break;default:u=pe.curve}p.command=u,p.x=_,p.y=C,p.controls.left.clear(),p.controls.right.clear(),p.command===pe.curve&&(x=s*y/Math.PI,p.controls.left.x=x*Math.cos(b-ht),p.controls.left.y=x*Math.sin(b-ht),p.controls.right.x=x*Math.cos(b+ht),p.controls.right.y=x*Math.sin(b+ht),f===1&&p.controls.left.multiplyScalar(2),f===g&&p.controls.right.multiplyScalar(2)),h++}if(l){for(a?(c[h].command=pe.close,h++):(d--,g=d-1),f=0;f<d;f++)m=f/g,p=c[h],b=(1-m)*(r-n)+n,y=(r-n)/d,_=o*Math.cos(b),C=o*Math.sin(b),u=pe.curve,f<=0&&(u=a?pe.move:pe.line),p.command=u,p.x=_,p.y=C,p.controls.left.clear(),p.controls.right.clear(),p.command===pe.curve&&(x=o*y/Math.PI,p.controls.left.x=x*Math.cos(b+ht),p.controls.left.y=x*Math.sin(b+ht),p.controls.right.x=x*Math.cos(b-ht),p.controls.right.y=x*Math.sin(b-ht),f===1&&p.controls.left.multiplyScalar(2),f===g&&p.controls.right.multiplyScalar(2)),h++;c[h].copy(c[0]),c[h].command=pe.line}else a||(c[h].command=pe.line,c[h].x=0,c[h].y=0,h++,c[h].copy(c[0]),c[h].command=pe.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(n){const r=this.innerRadius,o=this.outerRadius,s=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new Mn(0,0,r,o,s,a,l);c.translation.copy(this.translation),c.rotation=this.rotation,c.scale=this.scale,c.skewX=this.skewX,c.skewY=this.skewY,this.matrix.manual&&c.matrix.copy(this.matrix);for(let d=0;d<Ae.Properties.length;d++){const u=Ae.Properties[d];c[u]=this[u]}return n&&n.add(c),c}toObject(){const n=super.toObject.call(this);n.renderer.type="arc-segment";for(let r=0;r<Mn.Properties.length;r++){const o=Mn.Properties[r];n[o]=this[o]}return n}};T(Mn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let Ts=Mn;const rd={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}}},Ns=Math.cos,$s=Math.sin,An=class An extends Ae{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);T(this,"_flagRadius",!1);T(this,"_radius",0);this._renderer.type="circle";for(let c in od)Object.defineProperty(this,c,od[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 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._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*Ns(c),u=o*$s(c),h=s*Ns(c-ht),f=s*$s(c-ht),g=s*Ns(c+ht),m=s*$s(c+ht),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(h,f),p.controls.right.set(g,m)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=new An(0,0,this.radius,this.vertices.length);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="circle";for(let r=0;r<An.Properties.length;r++){const o=An.Properties[r];n[o]=this[o]}return n}};T(An,"Properties",["radius"]);let Rs=An;const od={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},Es=Math.cos,Ps=Math.sin,In=class In extends Ae{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);T(this,"_flagWidth",!1);T(this,"_flagHeight",!1);T(this,"_width",0);T(this,"_height",0);this._renderer.type="ellipse";for(let d in sd)Object.defineProperty(this,d,sd[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*Es(c),u=s*Ps(c),h=o*r*Es(c-ht),f=s*r*Ps(c-ht),g=o*r*Es(c+ht),m=s*r*Ps(c+ht),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(h,f),p.controls.right.set(g,m)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=this.width/2,o=this.height/2,s=this.vertices.length,a=new 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<Ae.Properties.length;l++){const c=Ae.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}};T(In,"Properties",["width","height"]);let Fs=In;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}}},Qp=Math.cos,Jp=Math.sin,On=class On extends Ae{constructor(n,r,o,s){s=Math.max(s||0,3);super();T(this,"_flagWidth",!1);T(this,"_flagHeight",!1);T(this,"_flagSides",!1);T(this,"_radius",0);T(this,"_width",0);T(this,"_height",0);T(this,"_sides",0);this._renderer.type="polygon";for(let a in ad)Object.defineProperty(this,a,ad[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 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];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*Qp(l)/2,d=this._height*Jp(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 On(0,0,0,this.sides);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,r.width=this.width,r.height=this.height,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ae.Properties.length;o++){const s=Ae.Properties[o];r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="polygon";for(let r=0;r<On.Properties.length;r++){const o=On.Properties[r];n[o]=this[o]}return n}};T(On,"Properties",["width","height","sides"]);let Vs=On;const ad={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 Ae{constructor(n,r,o,s){const a=[new Fe,new Fe,new Fe,new Fe];super(a,!0,!1,!0);T(this,"_flagWidth",!1);T(this,"_flagHeight",!1);T(this,"_width",0);T(this,"_height",0);T(this,"_origin",null);this._renderer.type="rectangle";for(let l in ld)Object.defineProperty(this,l,ld[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<Ae.Properties.length;o++){const s=Ae.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}};T(Ti,"Properties",["width","height","origin"]);let yr=Ti;const ld={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()}}},zn=class zn extends Ae{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);T(this,"_flagWidth",!1);T(this,"_flagHeight",!1);T(this,"_flagRadius",!1);T(this,"_width",0);T(this,"_height",0);T(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in cd)Object.defineProperty(this,c,cd[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=ey.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 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];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 zn(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="rounded-rectangle";for(let r=0;r<zn.Properties.length;r++){const o=zn.Properties[r];n[o]=this[o]}return n.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),n}};T(zn,"Properties",["width","height","radius"]);let Ms=zn;const cd={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},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 ey(){this._flagRadius=!0}const ty=Math.cos,ny=Math.sin,Dn=class Dn extends Ae{constructor(n,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();T(this,"_flagInnerRadius",!1);T(this,"_flagOuterRadius",!1);T(this,"_flagSides",!1);T(this,"_innerRadius",0);T(this,"_outerRadius",0);T(this,"_sides",0);this._renderer.type="star";for(let l in dd)Object.defineProperty(this,l,dd[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 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&&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*ty(l),u=c*ny(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 Dn(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ae.Properties.length;l++){const c=Ae.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="star";for(let r=0;r<Dn.Properties.length;r++){const o=Dn.Properties[r];n[o]=this[o]}return n}};T(Dn,"Properties",["innerRadius","outerRadius","sides"]);let As=Dn;const dd={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 Is;const ud=Math.min,hd=Math.max;yn.document&&(Is=document.createElement("canvas"));const St=class St extends Rn{constructor(n,r,o,s){super();T(this,"_flagValue",!0);T(this,"_flagFamily",!0);T(this,"_flagSize",!0);T(this,"_flagLeading",!0);T(this,"_flagAlignment",!0);T(this,"_flagBaseline",!0);T(this,"_flagStyle",!0);T(this,"_flagWeight",!0);T(this,"_flagDecoration",!0);T(this,"_flagFill",!0);T(this,"_flagStroke",!0);T(this,"_flagLinewidth",!0);T(this,"_flagOpacity",!0);T(this,"_flagVisible",!0);T(this,"_flagMask",!1);T(this,"_flagClip",!1);T(this,"_flagDirection",!0);T(this,"_flagStrokeAttenuation",!0);T(this,"_value","");T(this,"_family","sans-serif");T(this,"_size",13);T(this,"_leading",17);T(this,"_alignment","center");T(this,"_baseline","middle");T(this,"_style","normal");T(this,"_weight",500);T(this,"_decoration","none");T(this,"_direction","ltr");T(this,"_fill","#000");T(this,"_stroke","none");T(this,"_linewidth",1);T(this,"_opacity",1);T(this,"_visible",!0);T(this,"_mask",null);T(this,"_clip",!1);T(this,"_dashes",null);T(this,"_strokeAttenuation",!0);for(let a in fd)Object.defineProperty(this,a,fd[a]);if(this._renderer.type="text",this._renderer.flagFill=iy.bind(this),this._renderer.flagStroke=ry.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<St.Properties.length;a++){const l=St.Properties[a];l in s&&(this[l]=s[l])}}static Measure(n){if(Is){const r=Is.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*St.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 St().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<St.Properties.length;r++){const o=St.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new St(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<St.Properties.length;o++){const s=St.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<St.Properties.length;r++){const o=St.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}=St.Measure(this),u=(this._linewidth||0)/2;switch(this.alignment){case"left":o=-u,s=c+u;break;case"right":o=-(c+u),s=u;break;default:o=-(c/2+u),s=c/2+u}switch(this.baseline){case"middle":a=-(d/2+u),l=d/2+u;break;default:a=-(d+u),l=u}const[h,f]=r.multiply(o,a),[g,m]=r.multiply(o,l),[p,b]=r.multiply(s,a),[y,_]=r.multiply(s,l);return a=ud(f,m,b,_),o=ud(h,g,p,y),s=hd(h,g,p,y),l=hd(f,m,b,_),{top:a,left:o,right:s,bottom:l,width:s-o,height:l-a}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};T(St,"Ratio",.6),T(St,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let Yi=St;const fd={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 lt||this._fill instanceof Rt||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof lt||this._fill instanceof Rt||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof lt||this._stroke instanceof Rt||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof lt||this._stroke instanceof Rt||this._stroke instanceof Et||this._stroke instanceof Ge)&&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 iy(){this._flagFill=!0}function ry(){this._flagStroke=!0}const Ln=class Ln extends yr{constructor(n,r,o,s){super(r,o,0,0);T(this,"_flagTextures",!1);T(this,"_flagFrameRate",!1);T(this,"_flagIndex",!1);T(this,"_amount",1);T(this,"_duration",0);T(this,"_index",0);T(this,"_startTime",0);T(this,"_playing",!1);T(this,"_firstFrame",0);T(this,"_lastFrame",0);T(this,"_loop",!0);T(this,"_textures",null);T(this,"_frameRate",0);T(this,"_origin",null);this._renderer.type="image-sequence";for(let a in md)Object.defineProperty(this,a,md[a]);this._renderer.flagTextures=oy.bind(this),this._renderer.bindTextures=sy.bind(this),this._renderer.unbindTextures=ay.bind(this),this.noStroke(),this.noFill(),Array.isArray(n)?this.textures=n.map(gd.bind(this)):typeof n=="string"&&(this.textures=[gd(n)]),this.origin=new be,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=Ln.DefaultFrameRate,this.index=0}static fromObject(n){const r=new Ln().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Ln.Properties.length;r++){const o=Ln.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 Ln(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=Zt(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 Ge))&&(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}};T(Ln,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),T(Ln,"DefaultFrameRate",30);let Os=Ln;const md={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 oy(){this._flagTextures=!0}function sy(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function ay(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function gd(t){if(t instanceof Ge)return t;if(typeof t=="string")return new Ge(t)}const Ni=class Ni extends yr{constructor(n,r,o,s,a,l){super(r,o,0,0);T(this,"_flagTexture",!1);T(this,"_flagColumns",!1);T(this,"_flagRows",!1);T(this,"_flagFrameRate",!1);T(this,"_flagIndex",!1);T(this,"_amount",1);T(this,"_duration",0);T(this,"_startTime",0);T(this,"_playing",!1);T(this,"_firstFrame",0);T(this,"_lastFrame",0);T(this,"_loop",!0);T(this,"_texture",null);T(this,"_columns",1);T(this,"_rows",1);T(this,"_frameRate",0);T(this,"_index",0);T(this,"_origin",null);this._renderer.type="sprite";for(let c in pd)Object.defineProperty(this,c,pd[c]);this.noStroke(),this.noFill(),n instanceof Ge?this.texture=n:typeof n=="string"&&(this.texture=new Ge(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,f,g;if(n&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=n),n.loaded)){h=n.image.width,f=n.image.height,s=h/r,a=f/o,c=this._amount,this.width!==s&&(this.width=s),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&(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=Zt(this._firstFrame,g,l/d),u=Math.floor(u),u!==this._index&&(this._index=u,u>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const m=this._index%r,p=Math.floor(this._index/r),b=-s*m+(h-s)/2,y=-a*p+(f-a)/2;b!==n.offset.x&&(n.offset.x=b),y!==n.offset.y&&(n.offset.y=y)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};T(Ni,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let zs=Ni;const pd={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}}},fo=Math.min,mo=Math.max,an=class an extends Rn{constructor(n){super();T(this,"_flagAdditions",!1);T(this,"_flagSubtractions",!1);T(this,"_flagOrder",!1);T(this,"_flagOpacity",!0);T(this,"_flagBeginning",!1);T(this,"_flagEnding",!1);T(this,"_flagLength",!1);T(this,"_flagMask",!1);T(this,"_fill","#fff");T(this,"_stroke","#000");T(this,"_linewidth",1);T(this,"_opacity",1);T(this,"_visible",!0);T(this,"_cap","round");T(this,"_join","round");T(this,"_miter",4);T(this,"_closed",!0);T(this,"_curved",!1);T(this,"_automatic",!0);T(this,"_beginning",0);T(this,"_ending",1);T(this,"_length",0);T(this,"_mask",null);T(this,"_strokeAttenuation",!0);for(let r in yd)Object.defineProperty(this,r,yd[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++)bd.call(this,n[r],this)}static RemoveChildren(n){for(let r=0;r<n.length;r++)bd.call(this,n[r])}static OrderChildren(n){this._flagOrder=!0}static fromObject(n){const r=new an;for(let s=0;s<an.Properties.length;s++){const a=an.Properties[s];a in n&&(/(fill|stroke)/i.test(a)?r[a]=typeof n[a]=="string"?n[a]: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 Ts.fromObject(s);case"circle":return Rs.fromObject(s);case"element":return gr.fromObject(s);case"ellipse":return Fs.fromObject(s);case"group":return an.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Os.fromObject(s);case"path":return Ae.fromObject(s);case"points":return ho.fromObject(s);case"polygon":return Vs.fromObject(s);case"rectangle":return yr.fromObject(s);case"rounded-rectangle":return Ms.fromObject(s);case"shape":return Rn.fromObject(s);case"sprite":return zs.fromObject(s);case"star":return As.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<an.Properties.length;r++){const o=an.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new an,o=this.children.map(function(s){return s.clone()});return r.add(o),r.opacity=this.opacity,this.mask&&(r.mask=this.mask),r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.className=this.className,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="group",n.children=[],n.opacity=this.opacity,n.className=this.className,n.mask=this.mask?this.mask.toObject():null,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,f=-1/0;const g=/texture|gradient/i;o=n?this.matrix:this.worldMatrix;for(let m=0;m<this.children.length;m++){const p=this.children[m];if(!(!p.visible||g.test(p._renderer.type))&&(r=p.getBoundingClientRect(n),s=typeof r.top!="number"||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[b,y]=o.multiply(r.left,r.top),[_,C]=o.multiply(r.right,r.top),[x,N]=o.multiply(r.left,r.bottom),[$,w]=o.multiply(r.right,r.bottom);h=fo(y,C,N,w,h),d=fo(b,_,x,$,d),u=mo(b,_,x,$,u),f=mo(y,C,N,w,f)}else h=fo(r.top,h),d=fo(r.left,d),u=mo(r.right,u),f=mo(r.bottom,f)}return{top:h,left:d,right:u,bottom:f,width:u-d,height:f-h}}noFill(){return this.children.forEach(function(n){n.noFill()}),this}noStroke(){return this.children.forEach(function(n){n.noStroke()}),this}subdivide(){const n=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,n)}),this}_update(){let n,r,o;if(this._flagBeginning||this._flagEnding){const s=Math.min(this._beginning,this._ending),a=Math.max(this._beginning,this._ending),l=this.length;let c=0;const d=s*l,u=a*l;for(n=0;n<this.children.length;n++)o=this.children[n],r=o.length,d>c+r?(o.beginning=1,o.ending=1):u<c?(o.beginning=0,o.ending=0):d>c&&d<c+r?(o.beginning=(d-c)/r,o.ending=1):u>c&&u<c+r?(o.beginning=0,o.ending=(u-c)/r):(o.beginning=0,o.ending=1),c+=r}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};T(an,"Children",id),T(an,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let En=an;const yd={visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._flagVisible=this._visible!==t||this._flagVisible,this._visible=t}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!==t||this._flagOpacity,this._opacity=t}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._flagBeginning=this._beginning!==t||this._flagBeginning,this._beginning=t}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._flagEnding=this._ending!==t||this._flagEnding,this._ending=t}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let t=0;t<this.children.length;t++){const e=this.children[t];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){this._fill=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.fill=t}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){this._stroke=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.stroke=t}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.linewidth=t}}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.join=t}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.miter=t}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.cap=t}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.closed=t}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.curved=t}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){this._automatic=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.automatic=t}}},children:{enumerable:!0,get:function(){return this._children},set:function(t){const e=En.InsertChildren.bind(this),n=En.RemoveChildren.bind(this),r=En.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new id(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 bd(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 go extends Ae{constructor(e,n,r,o){const s=[new Fe(e,n),new Fe(r,o)];super(s);for(let a in _d)Object.defineProperty(this,a,_d[a]);this.vertices[0].command=pe.move,this.vertices[1].command=pe.line,this.automatic=!1}}T(go,"Properties",["left","right"]);const _d={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 ao("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 ao("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class Ds{constructor(e=0,n=0){this.x=e,this.y=n}}class _n{constructor(e=10,n=0,r="A"){T(this,"start",new Ds);T(this,"end",new Ds);this.width=e,this.angle=n,this.label=r}}const qe={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"}},ly={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function cy(t,e){return i.openBlock(),i.createElementBlock("svg",ly,[...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 po=i.markRaw({name:"ion-close",render:cy}),dy={class:"mr-3 flex flex-col gap-2"},uy=["onClick"],hy={class:"h-full p-2"},fy={},my=i.defineComponent({...fy,__name:"kozyrek-configurator-templates",props:{settings:{},selectTemplateIndex:{}},emits:["template:select","init-draw-template","remove-custom-template"],setup(t,{emit:e}){const n=t,r=i.ref(!1),o=i.useTemplateRef("drawing-template-containers"),s=i.useTemplateRef("drawing-custom-template-containers"),a=e,l=c=>{r.value=!0,a("remove-custom-template",c,()=>{r.value=!1})};return i.onMounted(()=>{var c,d;(c=n.settings.templates)==null||c.forEach((u,h)=>{var g;const f=(g=o.value)==null?void 0:g.at(h);f&&a("init-draw-template",f,u)}),(d=n.settings.customTemplates)==null||d.forEach((u,h)=>{var g;const f=(g=s.value)==null?void 0:g.at(h);f&&a("init-draw-template",f,u)})}),i.watch(()=>[...n.settings.customTemplates],(c,d)=>{i.nextTick(()=>{c.forEach((u,h)=>{var f;if(!(d!=null&&d.includes(u))){const g=(f=s.value)==null?void 0:f.at(h);g&&a("init-draw-template",g,u)}}),d.length>c.length&&d.forEach((u,h)=>{var g;const f=(g=s.value)==null?void 0:g.at(h);f&&(f.innerHTML="",a("init-draw-template",f,u))})})},{deep:!0}),(c,d)=>{const u=po;return i.openBlock(),i.createBlock(i.unref(A.NScrollbar),{style:{width:"auto"},trigger:"none",class:"max-h-[19rem] md:max-h-[40rem] w-auto"},{default:i.withCtx(()=>[i.createElementVNode("div",dy,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.settings.allTemplates,(h,f)=>(i.openBlock(),i.createElementBlock("div",{key:`${h.id}-${f}`,class:"group relative"},[i.createVNode(i.unref(A.NPopover),{trigger:"hover",placement:"right"},{trigger:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["relative h-10 w-24 shrink-0 rounded-md border-2 border-solid border-slate-200",{"!border-green-700":f===t.selectTemplateIndex}]),onClick:g=>a("template:select",f)},[i.createElementVNode("div",hy,[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,uy)]),default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(h.label),1)]),_:2},1024),h.isCustom&&!h.isNewRec()?(i.openBlock(),i.createBlock(i.unref(A.NButton),{key:0,size:"tiny",quaternary:"",loading:r.value,disabled:r.value,circle:"",class:"!absolute right-0.5 top-0.5 !hidden group-hover:!flex",onClick:g=>l(f)},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),wd=Nn(my,[["__scopeId","data-v-afccb364"]]),gy={class:"flex gap-3 min-w-[20rem] relative"},py={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},yy={ref:"drawing-container",class:"size-full"},by={},xd=i.defineComponent({...by,__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,L)=>new _n(n.value.configuratorParams.linesWidths[L],D,`A-${L+1}`))),h=i.computed(()=>n.value.configuratorParams.colorSide==="bottom"),f=i.computed(()=>{var D,L;return n.value.configuratorParams.startTailType&&((D=n.settings.startTailConfigs)!=null&&D[n.value.configuratorParams.startTailType])?(L=n.settings.startTailConfigs)==null?void 0:L[n.value.configuratorParams.startTailType].points:[]}),g=i.computed(()=>{var L;const D=n.value.configuratorParams.endTailType!==void 0&&((L=n.settings.endTailConfigs)==null?void 0:L[n.value.configuratorParams.endTailType]);return!D||!D.points?[]:D.points.map((H,z)=>Array.isArray(H)?new _n(H[0],H[1],`A-${z+1}`):new _n(H.width,H.angle,`A-${z+1}`))}),m=(D,L=!1)=>{D[0].start.x=0,D[0].start.y=0;let H=0;for(let z=0;z<D.length;z++){const O=D[z],U=D[z-1]??new _n(0,H);H+=!L||z>1?U.angle:0;const K=(!L||z>0?O.angle:0)+H;if(D[z].end.x=O.width*Math.cos(K*Math.PI/180)+D[z].start.x,D[z].end.y=O.width*Math.sin(K*Math.PI/180)+D[z].start.y,z<D.length-1){const V=z+1;D[V].start.x=D[z].end.x,D[V].start.y=D[z].end.y}}return D},p=(D,L,H,z,O=!1)=>{let U=m([...H,...z]);L.length>0&&(U=[...m(L),...U]);let K=0,V=0,q=0,Y=0;U.forEach(Te=>{K=Math.min(K,Te.start.x,Te.end.x),V=Math.min(V,Te.start.y,Te.end.y),q=Math.max(q,Te.start.x,Te.end.x),Y=Math.max(Y,Te.start.y,Te.end.y)});let ee,ue;K===0&&V===0&&q===0&&Y===0?(ee=1,ue=1):(ee=D.width/Math.abs(q-K),ue=(O?D.height:D.height-qe.colorSideLabel.size)/Math.abs(Y-V));const ve=Math.min(ee,ue);return K=K<0?-K*ve:0,V=V<0?-V*ve:0,[ve,K,V]},b=D=>{const L=new ho([D]);return L._size=qe.anchorPoint.size,L.fill=qe.anchorPoint.color,L.stroke="transparent",L._linewidth=qe.anchorPoint.strokeSize,l.push(L),L},y=(D,L)=>{if(l=[],n.settings.allowChangeFirstPoint){const H=D[0],z=new be(H.vertices[0].x,H.vertices[0].y);z.bind(ne.Types.change,()=>{H.vertices[0].copy(z)});const O=b(z);L.add(O)}D.forEach((H,z)=>{const O=D[z+1],U=new be(H.vertices[1].x,H.vertices[1].y);U.bind(ne.Types.change,()=>{H.vertices[1].copy(U),O!==void 0&&O.vertices[0].copy(U)});const K=b(U);L.add(K)})},_=D=>D*(Math.PI/180),C=(D,L,H)=>{const z=L.vertices.length-1;D.position.x=L.vertices[z].x,D.position.y=L.vertices[z].y;const O=Math.atan2(L.vertices[z].y-L.vertices[0].y,L.vertices[z].x-L.vertices[0].x);D.rotation=_(H)+O},x=(D,L,H)=>{if(L.vertices[0]===void 0)return;D.position.x=L.vertices[0].x,D.position.y=L.vertices[0].y;const z=L.vertices.length-1,O=Math.atan2(L.vertices[z].y-L.vertices[0].y,L.vertices[z].x-L.vertices[0].x);D.rotation=_(H)+O},N=(D,L,H)=>{const z=new En;if(D.length===0)return z;const O=[];return[...D].reverse().forEach((U,K)=>{K!==0&&U.angle>0&&(U.angle*=-1),O.push(U)}),D=m(O,!0),x(z,L,D[0].angle),[L.vertices[0],L.vertices[1]].forEach(U=>{U.bind(ne.Types.change,()=>{x(z,L,D[0].angle)})}),D.forEach(U=>{const K=U.start.x*H,V=U.end.x*H,q=U.start.y*H,Y=U.end.y*H,ee=new go(K,q,V,Y);ee.linewidth=qe.line.size,ee.stroke=qe.line.color,z.add(ee)}),z},$=(D,L,H)=>{const z=new En;return D.length===0||(D=m(D,!0),C(z,L,D[0].angle),[L.vertices[0],L.vertices[1]].forEach(O=>{O.bind(ne.Types.change,()=>{C(z,L,D[0].angle)})}),D.forEach(O=>{const U=O.start.x*H,K=O.end.x*H,V=O.start.y*H,q=O.end.y*H,Y=new go(U,V,K,q);Y.linewidth=qe.line.size,Y.stroke=qe.line.color,z.add(Y)})),z},w=(D,L,H,z)=>{const O=L.vertices[0].x+(L.vertices[1].x-L.vertices[0].x)/2-8*Math.sin(D.angle*Math.PI/180),U=L.vertices[0].y+(L.vertices[1].y-L.vertices[0].y)/2-8*Math.cos(D.angle*Math.PI/180),K=new Yi(D.label,O+10,U-10);let V;K.size=qe.lineLabel.size,K.weight=600,K.fill=qe.lineLabel.color,K.id+=1,K.rotation=qe.lineLabel.rotation,z>0&&(V=new Yi(`${D.angle}°`,L.vertices[0].x+25,L.vertices[0].y-25),V.size=qe.angleLabel.size,V.weight=600,V.fill=qe.angleLabel.color,V.rotation=qe.angleLabel.rotation,V.id+=z,s.push(V),H.add(V)),H.add(K),k(K,L,0,V),k(K,L,1)},v=()=>{const{size:D}=qe.colorSideLabel,L=0,H=0,z=h.value?D/2:D/2-D,O=h.value?D/2-D:D/2,U=new En;if(!c)return U;const K=5,V=Math.atan2(O-z,H-L),q=[new Fe(L,z,0,0,0,0,pn.Commands.move),new Fe(H,O,0,0,0,0,pn.Commands.line),new Fe(H-K*Math.cos(V-Math.PI/4),O-K*Math.sin(V-Math.PI/4),0,0,0,0,pn.Commands.line),new Fe(H,O,0,0,0,0,pn.Commands.move),new Fe(H-K*Math.cos(V+Math.PI/4),O-K*Math.sin(V+Math.PI/4),0,0,0,0,pn.Commands.line)],Y=new Ae(q,!1,!1,!0);Y.noFill(),Y.cap="round",Y.join="round",Y.linewidth=D/7,Y.stroke=qe.colorSideLabel.color,U.add(Y);const ee=new Yi(h.value?"Цвет снизу":"Цвет сверху",10,0);ee.size=D,ee.weight=600,ee.fill=qe.colorSideLabel.color,ee.alignment="left",U.add(ee);const ue=U.getBoundingClientRect();return U.position.x=(c.width-ue.width)*d+10,U.position.y=h.value?c.height+ue.height*2:ue.height/2,U},k=(D,L,H,z)=>{L.vertices[H].bind(ne.Types.change,()=>{const O=L.vertices.length-1,U=Math.atan2(L.vertices[0].y-L.vertices[O].y,L.vertices[0].x-L.vertices[O].x)*180/Math.PI,K=L.vertices[0].x+(L.vertices[O].x-L.vertices[0].x)/2-8*Math.sin(U*Math.PI/180),V=L.vertices[0].y+(L.vertices[O].y-L.vertices[0].y)/2-8*Math.cos(U*Math.PI/180);D.position.x=K+10,D.position.y=V-10,D.rotation=-.5,z&&(z.position.x=L.vertices[0].x+25,z.position.y=L.vertices[0].y-25)})},B=(D,L,H,z,O=!1)=>{var We;if(D.clear(),H.length===0){D.update();return}const U=m(H),[K,V,q]=p(D,L,U,z,O),Y=new En,ee=new Array,ue=new Array;O||(s=[],a=[]),U.forEach((ce,pt)=>{const Ne=ce.start.x*K+V,Vt=ce.end.x*K+V,jt=ce.start.y*K+q,ln=ce.end.y*K+q,Bt=new go(Ne,jt,Vt,ln);Bt.linewidth=O?qe.previewLine.size:qe.line.size,Bt.stroke=O?qe.previewLine.color:qe.line.color,a.push(Bt),ee.push(Bt),Y.add(Bt),!O&&ce.label!==""&&w(ce,Bt,Y,pt)});const ve=ee.at(-1);let Te=Y.getBoundingClientRect();if(!O){const ce=v();ue.push(ce)}if(L.length>0){const ce=N(L,ee[0],K);Y.add(ce)}if(z.length>0&&ve){const ce=$(z,ve,K);Y.add(ce)}if(ue.push(Y),D.makeGroup(ue),Te=Y.getBoundingClientRect(),Y.position.x=0-Te.left+(D.width-Te.width)/(2*(O?1:d)),Y.position.y=0-Te.top+(D.height-Te.height)/(2*(O?1:d)),D.update(),!O){const ce=((We=n.value.configuratorParams)==null?void 0:We.colorSide)==="top";Y.position.y=Y.position.y+qe.colorSideLabel.size*Number(ce),y(ee,Y),D.update()}},R=(D,L)=>{if(D&&!L.isNewRec()){const H=new pn({width:D.scrollWidth,height:D.scrollHeight});H.appendTo(D),B(H,[],L.points,[],!0)}},E=()=>{c&&B(c,f.value,u.value,g.value,!1)},P=D=>D*(180/Math.PI),W=(D,L)=>{const H=D[1].x-D[0].x,z=D[1].y-D[0].y,O=L[1].x-L[0].x,U=L[1].y-L[0].y;let K=Math.atan2(H*U-z*O,H*O+z*U);return K=P(K),Math.round(K)*-1},I=D=>{const L=a.map((H,z,O)=>{const U=O[z-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let K=Math.ceil(H._length/D/n.settings.lineWidthStep)*n.settings.lineWidthStep;const V=s[z-1];K<(O.length>1?n.settings.minLineWidth:n.settings.stripMinWidth)&&(K=O.length>1?n.settings.minLineWidth:n.settings.stripMinWidth),K>n.settings.maxLineWidth&&(K=n.settings.maxLineWidth);const q=W(H.vertices,U.vertices);return V&&(V.value=`${q}°`),new _n(K,q,`A-${z+1}`)});r("pointer:move",L)},Z=D=>{let L=null,H;const z=V=>{L=l.find(q=>{const Y=q.renderer;return(Y==null?void 0:Y.elem)===V.target}),[H]=p(D,f.value,u.value.map(q=>q),g.value)},O=V=>{if(L){const q=L.renderer,Y=q==null?void 0:q.elem;if(!Y)return;const ee=Y.getBoundingClientRect();L.vertices[0].x-=ee.x-(V instanceof MouseEvent?V.clientX:V.targetTouches[0].clientX)+qe.anchorPoint.size/2,L.vertices[0].y-=ee.y-(V instanceof MouseEvent?V.clientY:V.targetTouches[0].clientY)+qe.anchorPoint.size/2,I(H),D.update()}},U=()=>{L&&r("pointer:up",u.value),L=null},K=o.value;K&&(K.addEventListener("touchstart",z,{passive:!0}),K.addEventListener("touchend",U,{passive:!0}),K.addEventListener("mousedown",z),K.addEventListener("mouseup",U),K.addEventListener("mousemove",O),K.addEventListener("touchmove",O,{passive:!0}))},te=(D,L)=>{r("remove-custom-template",D,L)};return i.onMounted(()=>{o.value&&(c=new pn({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),i.watch(()=>n.value,()=>{E()},{deep:!0,immediate:!0}),Z(c))}),i.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(D,L)=>(i.openBlock(),i.createElementBlock("div",gy,[i.createVNode(wd,{"select-template-index":t.selectTemplateIndex,settings:t.settings,"onTemplate:select":L[0]||(L[0]=H=>r("template:select",H)),onInitDrawTemplate:R,onRemoveCustomTemplate:te},null,8,["select-template-index","settings"]),i.createElementVNode("div",py,[i.createElementVNode("div",yy,null,512)])]))}});class Ui extends j.Identity{constructor(n,r){super();T(this,"label","");T(this,"points",[]);T(this,"isCustom",!1);T(this,"id",-1);T(this,"guid","");n?(this.label=n.label,this.points=n.points.map((o,s)=>M.isArray(o)?new _n(o[0],o[1],`A-${s+1}`):new _n(o.width,o.angle,`A-${s+1}`)),this.isCustom=n.isCustom):(this.label="-- Новая конфигурация --",this.points=[new _n(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class Ls extends Ui{constructor(n){super(n);T(this,"isDefault");this.isDefault=n.isDefault??!1}}class kd{constructor(e){T(this,"minLineWidth");T(this,"maxLineWidth");T(this,"lineWidthStep");T(this,"minLineAngle");T(this,"maxLineAngle");T(this,"lineAngleStep");T(this,"stripMinWidth");T(this,"stripMaxWidth");T(this,"stripMinLength");T(this,"stripMaxLength");T(this,"allowShowTable");T(this,"showOnlyTemplates");T(this,"templates");T(this,"customTemplates",[]);T(this,"startTailConfigs");T(this,"endTailConfigs");T(this,"bendCountForExtended");T(this,"extendedProductCatalog");T(this,"allowChangeFirstPoint");T(this,"allowSaveTemplates");T(this,"userTemplatesPrefix");T(this,"lengthStep");T(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 Ls(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new Ls(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 _n(this.stripMinWidth,0,"A-1")],isCustom:!0,id:-1,guid:""})))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(e){if(!this.allowSaveTemplates)return;const n=this.customTemplates.findLast(o=>!o.isNewRec()),r=new 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 _y={class:"flex flex-col gap-3"},wy={class:"grid gap-5 md:grid-cols-5"},xy={},vd=i.defineComponent({...xy,__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 kd(n.settings)),d=i.ref({linesWidths:[...n.cartItem.configuratorParams.linesWidths],linesAngles:[...n.cartItem.configuratorParams.linesAngles]}),u=i.ref({quantity:{},marker:{},length:{}}),h=i.ref(0),f=i.useTemplateRef("kozyrek-configurator-params-form"),g=(k=0)=>{var R;const B=(R=c.value.allTemplates)==null?void 0:R.at(k);B!==void 0&&(h.value=k,l.value.configuratorParams.linesWidths=B.points.map(E=>M.isArray(E)?E[0]:E.width),l.value.configuratorParams.linesAngles=B.points.map(E=>M.isArray(E)?E[1]:E.angle),C()),y(l.value.configuratorParams)},m=async()=>{const k=prompt("Введите название шаблона:");if(!k)return;a.value=!0;const B={label:k,points:l.value.configuratorParams.linesWidths.map((E,P)=>[E,l.value.configuratorParams.linesAngles[P]])},R=E=>{E&&(c.value.addCustomTemplate(B),h.value=c.value.allTemplates.length-2),a.value=!1};n.eventEmitter.emit("configurator:create-template",{category:n.cartItem.category,template:B,callback:R})},p=async(k,B)=>{var P;const R=(P=c.value.allTemplates)==null?void 0:P.at(k);if(!R||!R.isCustom)return;const E=W=>{W&&(c.value.removeCustomTemplate(R.id),g()),B==null||B()};n.eventEmitter.emit("configurator:remove-template",{category:n.cartItem.category,templateId:R.id,callback:E})},b=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(h.value=c.value.allTemplates.length-1)},y=async k=>{var B,R;l.value.product=new j.ClientProduct,(R=(B=f.value)==null?void 0:B.formReference)==null||R.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(M.noop)},_=async()=>{var k,B;(B=(k=f.value)==null?void 0:k.formReference)==null||B.validate(R=>{R||(s.value=!0,r("submit",l.value,u.value,()=>{s.value=!1,i.nextTick(()=>{var E,P;(P=(E=f.value)==null?void 0:E.formReference)==null||P.restoreValidation()})}))}).catch(M.noop)},C=()=>{const k={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach((B,R)=>{k[`lines_widths[${R+1}]`]={},k[`lines_angles[${R+1}]`]={}}),u.value=k},x=k=>{d.value.linesWidths=k.map(B=>B.width),d.value.linesAngles=k.map(B=>B.angle)},N=k=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,C(),b(),y(l.value.configuratorParams)},$=(k,B)=>{d.value.linesWidths=k,d.value.linesAngles=B},w=k=>{const B=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,R=0;l.value.configuratorParams.linesWidths.splice(k+1,0,B),l.value.configuratorParams.linesAngles.splice(k+1,0,R),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],C(),b(),y(l.value.configuratorParams)},v=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(),b(),y(l.value.configuratorParams))};return i.onBeforeMount(()=>{g()}),i.watch(()=>n.cartItem,k=>{l.value=new j.OrderItemBase(k),g()}),(k,B)=>{const R=A.NButton;return i.openBlock(),i.createElementBlock("div",_y,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(R,{key:0,type:"tertiary",class:"self-end",onClick:B[0]||(B[0]=E=>r("click:view-switch"))},{default:i.withCtx(()=>[...B[3]||(B[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",wy,[i.createVNode(xd,{value:l.value,"select-template-index":h.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":N,"onPointer:move":x,"onTemplate:select":g,onRemoveCustomTemplate:p},null,8,["value","select-template-index","settings"]),i.createVNode(al,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":B[1]||(B[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":B[2]||(B[2]=E=>y(E)),"onUpdate:preview":$,onSubmit:_,"onClick:saveTemplate":m,"onClick:addLine":w,"onClick:removeLine":v},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),ky={class:"flex flex-col items-center justify-between rounded-xl"},vy={class:"img-preview relative flex justify-center"},Cy={},Sy=i.defineComponent({...Cy,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(t,{emit:e}){const n=t,r=i.computed(()=>{const{height:s}=n.configuratorParams,a=M.keys(n.settings.crossbarCount).reverse().find(l=>{const c=n.settings.crossbarCount[Number(l)];return s>=c});if(a!==void 0)return String(Number(a)+1)}),o=e;return(s,a)=>{const l=A.NButton;return i.openBlock(),i.createElementBlock("div",ky,[i.createElementVNode("div",vy,[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})])}}}),Hs=Nn(Sy,[["__scopeId","data-v-a67fd61e"]]),By={key:0,class:"flex items-baseline gap-1"},Ty={key:0,class:"flex items-baseline gap-1"},Ny={key:1},$y={class:"text-lg font-semibold"},Ry={key:2,class:"text-red-500 text-sm mb-2"},Ey={class:"flex gap-3"},Py={},Cd=i.defineComponent({...Py,__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(()=>ot.isPhoneDevice()),a=i.useTemplateRef("form-reference"),l=i.useTemplateRef("width-form-item-reference"),c=i.useTemplateRef("height-form-item-reference"),d=i.useTemplateRef("width-input-reference"),u=i.ref(M.cloneDeep(r.value)),h=i.computed(()=>r.settings.widthOverlaps[u.value.configuratorParams.mountType]??0),f=i.computed(()=>r.settings.heightOverlaps[u.value.configuratorParams.mountType]??0),g=i.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),m=i.computed(()=>r.settings.maxHeights[u.value.configuratorParams.netType]),p=i.computed(()=>u.value.configuratorParams.width?u.value.configuratorParams.width+h.value:0),b=i.computed(()=>u.value.configuratorParams.height?u.value.configuratorParams.height+f.value:0),y=i.ref(r.settings.canSetDopProdaga??!1),_=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth-h.value),ae.max(g.value-h.value),ae.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[ae.required,ae.min(r.settings.minHeight-f.value),ae.max(m.value-f.value),ae.step(1),He.serverValidation(r.validation.height.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),C=i.computed(()=>{var P;const v=p.value,k=b.value,{quantity:B}=r.value,R=((P=r.value.product)==null?void 0:P.costRub)||0;if(!v||!k||!B||R===0)return null;const E=v*k/1e6;return(R*B*E).toLocaleString("ru-ru",{minimumFractionDigits:2})}),x=i.computed(()=>{const v=p.value,k=b.value,B=!!(v&&v>=r.settings.minWidth&&v<=r.settings.maxWidths[u.value.configuratorParams.netType]),R=!!(k&&k>=r.settings.minHeight&&k<=r.settings.maxHeights[u.value.configuratorParams.netType]),E=!!(r.value.quantity&&r.value.quantity>0);return B&&R&&E}),N=(v,k)=>{var E,P;const B=u.value.configuratorParams;v&&v in B&&(B[v]=k);const R={...B,width:p.value??0,height:b.value??0};v==="width"&&((E=l.value)==null||E.validate().catch(M.noop)),v==="height"&&((P=c.value)==null||P.validate().catch(M.noop)),i.nextTick(()=>{var I,Z;!((I=l.value)!=null&&I.validationErrored)&&!((Z=c.value)!=null&&Z.validationErrored)&&R.height&&R.width&&o("update:params",R),$("configuratorParams",R)})},$=(v,k)=>{const B=new j.OrderItemBase(r.value);B[v]=k,v==="configuratorParams"&&(B.product=new j.ClientProduct),o("update:value",B)};return i.watch(()=>r.value,v=>{const k=M.cloneDeep(i.toRaw(v)),B=k.configuratorParams.mountType,R=r.settings.widthOverlaps[B]??0,E=r.settings.heightOverlaps[B]??0;k.configuratorParams.width&&k.configuratorParams.width>0&&(k.configuratorParams.width-=R),k.configuratorParams.height&&k.configuratorParams.height>0&&(k.configuratorParams.height-=E),u.value=k},{deep:!0}),i.onMounted(()=>{var v;(v=d.value)==null||v.select()}),e({validate:(w=a.value)==null?void 0:w.validate,formReference:a}),(v,k)=>{const B=A.NCheckbox;return i.openBlock(),i.createBlock(i.unref(A.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(R=>o("submit",u.value),["prevent"]),["enter"]))},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NSelect),{value:u.value.configuratorParams.netType,"onUpdate:value":[k[0]||(k[0]=R=>u.value.configuratorParams.netType=R),k[1]||(k[1]=R=>N("netType",R))],options:t.settings.netType.map(R=>({label:t.settings.descriptions.net_type[R],value:R}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(A.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NSelect),{value:u.value.configuratorParams.color,"onUpdate:value":[k[2]||(k[2]=R=>u.value.configuratorParams.color=R),k[3]||(k[3]=R=>N("color",R))],options:t.settings.color.map(R=>({label:t.settings.descriptions.color[R],value:R}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(A.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NSelect),{value:u.value.configuratorParams.mountType,"onUpdate:value":[k[4]||(k[4]=R=>u.value.configuratorParams.mountType=R),k[5]||(k[5]=R=>N("mountType",R))],options:t.settings.mountType.map(R=>({label:t.settings.descriptions.mount_type[R],value:R}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(A.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",By,[i.createVNode(i.unref(A.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Ширина готового изделия "+i.toDisplayString(p.value),1)]),_:1}),i.createVNode(i.unref(A.NButton),{quaternary:"",type:"info",size:"tiny",onClick:k[10]||(k[10]=R=>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(A.NInputNumber),{ref:"width-input-reference",value:u.value.configuratorParams.width,"onUpdate:value":[k[6]||(k[6]=R=>u.value.configuratorParams.width=R),k[9]||(k[9]=R=>N("width",R))],parse:i.unref(rt),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:k[7]||(k[7]=R=>i.unref(nt)(R)),onInput:k[8]||(k[8]=R=>i.unref(tt)(t.validation,"width")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(A.NFormItem),{ref:"height-form-item-reference",path:"configuratorParams.height",label:`Высота светового проёма от ${t.settings.minHeight-f.value} ${m.value?" до "+(m.value-f.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.height.showFeedback&&b.value>=t.settings.minHeight&&b.value<=t.settings.maxHeights[u.value.configuratorParams.netType]?(i.openBlock(),i.createElementBlock("div",Ty,[i.createVNode(i.unref(A.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Высота готового изделия "+i.toDisplayString(b.value),1)]),_:1}),i.createVNode(i.unref(A.NButton),{quaternary:"",type:"info",size:"tiny",onClick:k[15]||(k[15]=R=>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(A.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[k[11]||(k[11]=R=>u.value.configuratorParams.height=R),k[14]||(k[14]=R=>N("height",R))],parse:i.unref(rt),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:k[12]||(k[12]=R=>i.unref(nt)(R)),onInput:k[13]||(k[13]=R=>i.unref(tt)(t.validation,"height")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(A.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:u.value.quantity,"onUpdate:value":[k[16]||(k[16]=R=>u.value.quantity=R),k[19]||(k[19]=R=>$("quantity",R??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:k[17]||(k[17]=R=>i.unref(nt)(R,!1)),onInput:k[18]||(k[18]=R=>i.unref(tt)(t.validation,"quantity")),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(A.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:k[20]||(k[20]=R=>i.unref(tt)(t.validation,"marker")),"onUpdate:value":k[21]||(k[21]=R=>{u.value.marker=R??null,$("marker",R??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),y.value?(i.openBlock(),i.createBlock(B,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":k[22]||(k[22]=R=>{u.value.isAdditionalSale=R??!1,$("isAdditionalSale",R??!1)})},{default:i.withCtx(()=>[...k[28]||(k[28]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(ur,{"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",Ny,[k[29]||(k[29]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",$y,i.toDisplayString(C.value)+" ₽",1)])):i.createCommentVNode("",!0),x.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Ry," Пожалуйста, заполните все обязательные поля корректно. ")),i.createElementVNode("div",Ey,[i.createVNode(i.unref(A.NButton),{loading:t.isSubmitProcessing,disabled:!x.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:k[23]||(k[23]=R=>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(A.NButton),{key:0,type:"default",onClick:k[24]||(k[24]=R=>o("click:show-preview-drawer"))},{default:i.withCtx(()=>[...k[30]||(k[30]=[i.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1},8,["model","rules"])}}}),Fy="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",Vy="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",My="/img/configurators/mosquitto/measurement-instructions/mount.png",Ay="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",Iy="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",Oy={class:"flex flex-col gap-6"},zy={class:"flex gap-4"},Dy={class:"flex flex-col gap-2"},Ly={class:"flex gap-4"},Hy={class:"flex flex-col gap-2"},Wy={class:"flex gap-4"},jy={class:"flex flex-col gap-2"},qy={},Sd=i.defineComponent({...qy,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(t,{emit:e}){const n=ot.initRefDependingOnDeviceResolution("small","small","medium"),r=ot.initRefDependingOnDeviceResolution(.98,.95,.8),o=i.computed(()=>window.innerWidth*r.value),s=e;return(a,l)=>{const c=A.NText;return i.openBlock(),i.createBlock(i.unref(A.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",Oy,[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:Fy,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:Vy,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",zy,[l[9]||(l[9]=i.createElementVNode("img",{src:My,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Dy,[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",Ly,[l[15]||(l[15]=i.createElementVNode("img",{src:Ay,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Hy,[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",Wy,[l[21]||(l[21]=i.createElementVNode("img",{src:Iy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",jy,[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"])}}}),Xy={class:"grid md:grid-cols-2"},Yy={},Bd=i.defineComponent({...Yy,__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(()=>ot.isPhoneDevice()),s=i.ref(!1),a=i.ref(!1),l=i.ref(n.cartItem),c=i.useTemplateRef("mosquito-configurator-form"),d=i.ref({width:{},height:{},quantity:{},marker:{}}),u=i.ref(!1),h=i.ref(!1),f=i.computed(()=>i.inject("debounce-input-time",300)),g=M.debounce(async p=>{var b,y;l.value.product=new j.ClientProduct,(y=(b=c.value)==null?void 0:b.formReference)==null||y.validate(_=>{_||(u.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:p,validationFieldResultData:d.value,callback:C=>{C?l.value.product=C:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(M.noop)},f.value),m=()=>{h.value=!0,r("submit",l.value,d.value,()=>{h.value=!1})};return i.watch(()=>n.cartItem,p=>{l.value=p},{deep:!0}),(p,b)=>{const y=po;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(Sd,{show:a.value,"onUpdate:show":b[0]||(b[0]=_=>a.value=_),"height-overlaps":t.settings.heightOverlaps,"width-overlaps":t.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),i.createElementVNode("div",Xy,[o.value?(i.openBlock(),i.createBlock(i.unref(A.NDrawer),{key:1,show:s.value,"onUpdate:show":b[4]||(b[4]=_=>s.value=_),"default-width":375,resizable:""},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NDrawerContent),null,{header:i.withCtx(()=>[i.createVNode(i.unref(A.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:b[2]||(b[2]=_=>s.value=!1)},{default:i.withCtx(()=>[i.createVNode(y)]),_:1})]),default:i.withCtx(()=>[i.createVNode(Hs,{"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:b[3]||(b[3]=_=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(i.openBlock(),i.createBlock(Hs,{key:0,"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:b[1]||(b[1]=_=>a.value=!0)},null,8,["configurator-params","settings"])),i.createVNode(Cd,{ref:"mosquito-configurator-form",value:l.value,"onUpdate:value":b[5]||(b[5]=_=>l.value=_),validation:d.value,settings:t.settings,"is-product-searching":u.value,"is-submit-processing":h.value,"onUpdate:params":b[6]||(b[6]=_=>i.unref(g)(_)),onSubmit:b[7]||(b[7]=_=>m()),"onClick:instructionsToggle":b[8]||(b[8]=_=>a.value=!a.value),"onClick:showPreviewDrawer":b[9]||(b[9]=_=>s.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),Uy={},Td=i.defineComponent({...Uy,__name:"strip-configurator-line-item",props:{value:{},index:{},path:{},settings:{},product:{default:void 0},addLineButtonDisabled:{type:Boolean,default:!1},removeLineButtonDisabled:{type:Boolean,default:!1},suggestionOption:{default:void 0},autoFocus:{type:Boolean,default:!1},validation:{}},emits:["update:value","click:add-line","click:remove-line"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.useTemplateRef("width-input-element"),a=i.ref(!1),l=i.ref(r.value),c=i.useTemplateRef("form-item-reference"),d=i.computed(()=>{var f;return!((f=c.value)!=null&&f.validationErrored)}),u=f=>{l.value=f,o("update:value",f,r.index,a)},h=()=>{var f;(f=s.value)==null||f.select()};return i.watch(()=>r.value,f=>{l.value=f}),i.onMounted(()=>{r.autoFocus&&i.nextTick(()=>{h()})}),e({isValid:d,formItemReference:c}),(f,g)=>{const m=sl,p=Hr;return i.openBlock(),i.createBlock(i.unref(A.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(ur,{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(A.NDropdown),{trigger:"click",options:t.suggestionOption,placement:"bottom-start",size:"large",onSelect:u},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{ref:"width-input-element",value:l.value??null,class:"w-full","show-button":!1,parse:i.unref(rt),placeholder:"Введите ширину",onKeydown:g[0]||(g[0]=b=>i.unref(nt)(b)),onInput:g[1]||(g[1]=b=>i.unref(tt)(t.validation,`linesWidths.${t.index}`)),onFocus:i.unref(Le),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),i.createVNode(i.unref(A.NButton),{disabled:t.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:g[2]||(g[2]=b=>o("click:add-line",t.index))},{default:i.withCtx(()=>[i.createVNode(m)]),_:1},8,["disabled"]),i.createVNode(i.unref(A.NButton),{disabled:t.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:g[3]||(g[3]=b=>o("click:remove-line",t.index))},{default:i.withCtx(()=>[i.createVNode(p)]),_:1},8,["disabled"])]),_:1},8,["path","label"])}}}),Ky={class:"my-2 flex w-full flex-col"},Gy={key:1},Zy={class:"text-lg font-semibold"},Qy={class:"flex gap-3"},Jy={},Nd=i.defineComponent({...Jy,__name:"strip-configurator-form",props:{value:{},settings:{},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit","click:add-line","click:remove-line"],setup(t,{expose:e,emit:n}){var _;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("line-items-reference"),l=i.ref(M.cloneDeep(r.value)),c=i.computed(()=>{const C={length:[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(r.settings.lengthStep),He.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]};return M.forEach(l.value,(x,N)=>{var $;C[`configuratorParams.linesWidths.${N}`]=[ae.required,ae.min(r.settings.minLineWidth),ae.step(r.settings.lineWidthStep),He.serverValidation(($=r.validation[`linesWidths.${N}`])==null?void 0:$.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),f=i.computed(()=>!r.value.some(({product:C})=>!C||C.isNewRec())),g=i.computed(()=>r.isSubmitProcessing||!f.value||h.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(C=>C.product.isNewRec())),m=i.computed(()=>C=>h.value===0?void 0:[{label:`${(h.value>0?"Остаток +":"Излишек ")+h.value} мм.`,key:h.value+C}]),p=i.computed(()=>{const{length:C}=r.value[0];return!C||u.value!==r.settings.width?null:(M.reduce(r.value,(N,$)=>{var v;const w=((v=$.product)==null?void 0:v.costRub)||0;return N+w},0)*r.value[0].quantity*C).toLocaleString("ru-ru",{minimumFractionDigits:2})}),b=(C,x,N)=>{var w,v,k;l.value[x].product.id=-1;const{configuratorParams:$}=l.value[x];$.linesWidths[x]=C,y("configuratorParams",$),(k=(v=(w=a.value)==null?void 0:w.at(x))==null?void 0:v.formItemReference)==null||k.validate().catch(M.noop),i.nextTick(()=>{var B,R;(R=(B=a.value)==null?void 0:B.at(x))!=null&&R.isValid&&o("update:params",$,x,N)})},y=(C,x)=>{l.value.forEach(N=>{N[C]=x}),o("update:value",l.value)};return i.watch(()=>r.value,C=>{l.value=M.cloneDeep(C)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(C,x)=>{const N=A.NCheckbox;return i.openBlock(),i.createBlock(i.unref(A.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($=>o("submit",l.value),["prevent"]),["enter"]))},{default:i.withCtx(()=>{var $;return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(w,v)=>{var k,B;return i.openBlock(),i.createBlock(Td,{key:v,ref_for:!0,ref:"line-items-reference",value:((k=w.configuratorParams)==null?void 0:k.linesWidths.at(v))??null,"auto-focus":!0,index:v,path:`configuratorParams.linesWidths.${v}`,product:w.product,settings:t.settings,validation:t.validation,"suggestion-option":m.value(((B=w.configuratorParams)==null?void 0:B.linesWidths.at(v))??0),"add-line-button-disabled":h.value<=0||t.value.length>=t.settings.maxLinesCount||t.value.some(R=>R.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"onUpdate:value":b,"onClick:addLine":x[0]||(x[0]=R=>o("click:add-line",R)),"onClick:removeLine":x[1]||(x[1]=R=>o("click:remove-line",R))},null,8,["value","index","path","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled"])}),128)),i.createElementVNode("div",Ky,[h.value<0?(i.openBlock(),i.createBlock(i.unref(A.NText),{key:0,type:"error"},{default:i.withCtx(()=>[i.createTextVNode(" Сумма ширин всех полос должна быть равна "+i.toDisplayString(t.settings.width),1)]),_:1})):i.createCommentVNode("",!0),f.value&&l.value.length===t.settings.maxLinesCount&&h.value>0?(i.openBlock(),i.createBlock(i.unref(A.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(A.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(A.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(A.NFormItem),{path:"length",label:`Метраж ${t.settings.minLength?" от "+t.settings.minLength:""} ${t.settings.maxLength?" до "+t.settings.maxLength:""} м.`},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:l.value[0].length,"onUpdate:value":[x[3]||(x[3]=w=>l.value[0].length=w),x[6]||(x[6]=w=>y("length",w))],parse:i.unref(rt),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:x[4]||(x[4]=w=>i.unref(nt)(w,!1)),onInput:x[5]||(x[5]=w=>i.unref(tt)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(A.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:l.value[0].quantity,"onUpdate:value":[x[7]||(x[7]=w=>l.value[0].quantity=w),x[10]||(x[10]=w=>y("quantity",w))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:x[8]||(x[8]=w=>i.unref(nt)(w,!1)),onInput:x[9]||(x[9]=w=>i.unref(tt)(t.validation,"quantity")),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(A.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInput),{value:l.value[0].marker??null,placeholder:"Введите маркировку",onInput:x[11]||(x[11]=w=>i.unref(tt)(t.validation,"marker")),"onUpdate:value":x[12]||(x[12]=w=>{l.value[0].marker=w??null,y("marker",w??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(N,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":x[13]||(x[13]=w=>{l.value[0].isAdditionalSale=w??!1,y("isAdditionalSale",w??!1)})},{default:i.withCtx(()=>[...x[19]||(x[19]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),p.value?(i.openBlock(),i.createElementBlock("div",Gy,[x[20]||(x[20]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",Zy,i.toDisplayString(p.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",Qy,[i.createVNode(i.unref(A.NButton),{loading:t.isSubmitProcessing,disabled:!f.value||h.value!=0||!(($=l.value[0])!=null&&$.length)||l.value[0].length>t.settings.maxLength||l.value[0].length<t.settings.minLength||l.value[0].quantity===0,type:"primary",class:"self-start",onClick: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"])}}}),e0={class:"flex grow flex-col"},t0=["src"],n0={class:"w-full"},i0={},$d=i.defineComponent({...i0,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",e0,[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,t0),i.createElementVNode("div",n0,[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)])]))}}),r0={class:"flex flex-col gap-2"},o0={class:"w-104 flex grow flex-col px-5"},s0={},Rd=i.defineComponent({...s0,__name:"strip-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["submit","click:view-switch"],setup(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("strip-configurator-form"),s=i.ref(n.cartItems),a=i.ref({width:{},length:{},quantity:{},marker:{}}),l=i.ref(!1),c=i.computed(()=>i.inject("debounce-input-time",300)),d=i.computed(()=>{var m;return(m=s.value[0].configuratorParams)==null?void 0:m.linesWidths.reduce((p,b)=>(p??0)+(b??0),0)}),u=m=>{m===void 0&&(m=s.value.length-1);const p=s.value.at(0);if(!p)return;p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(m+1,0,null),s.value.forEach(y=>{y.configuratorParams.linesWidths=p.configuratorParams.linesWidths});const b=new j.OrderItemBase({quantity:(p==null?void 0:p.quantity)??1,category:p==null?void 0:p.category,length:(p==null?void 0:p.length)??n.settings.minLength,marker:p==null?void 0:p.marker,configuratorParams:{linesWidths:p==null?void 0:p.configuratorParams.linesWidths}});s.value=s.value.toSpliced(m+1,0,b)},h=m=>{const p=s.value.at(0);p&&(p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(m,1),s.value.forEach(b=>{b.configuratorParams.linesWidths=p.configuratorParams.linesWidths}),s.value=s.value.toSpliced(m,1),delete a[`linesWidths.${m}`],delete a[`linesWidths.${m}`])},f=M.debounce(async(m,p,b)=>{const y={linesWidths:m.linesWidths.at(p)};b.value=!0,a.value[`linesWidths.${p}`]={},s.value[p].product=new j.ClientProduct,n.eventEmitter.emit("configurator:search-product",{category:s.value[p].category,params:y,validationFieldResultData:a.value,callback:_=>{_?(s.value[p].product=_,p===s.value.length-1&&s.value.length<n.settings.maxLinesCount&&d.value&&d.value<n.settings.width&&u()):(s.value[p].product=new j.ClientProduct,a.value[`linesWidths.${p}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},b.value=!1),b.value=!1}})},c.value),g=async()=>{var m,p;(p=(m=o.value)==null?void 0:m.formReference)==null||p.validate(b=>{if(!b){l.value=!0;const y=s.value.at(0);if(!y)return;r("submit",y,a.value,()=>{l.value=!1,i.nextTick(()=>{var _,C;(C=(_=o.value)==null?void 0:_.formReference)==null||C.restoreValidation()})})}}).catch(M.noop)};return i.watch(()=>n.cartItems,m=>{s.value=m.map(p=>new j.OrderItemBase(p))}),(m,p)=>{const b=A.NButton;return i.openBlock(),i.createElementBlock("div",r0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(b,{key:0,type:"tertiary",class:"self-center",onClick:p[0]||(p[0]=y=>r("click:view-switch"))},{default:i.withCtx(()=>[...p[3]||(p[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",o0,[i.createVNode($d,{value:s.value,"onUpdate:value":p[1]||(p[1]=y=>s.value=y),settings:t.settings},null,8,["value","settings"]),i.createVNode(Nd,{ref:"strip-configurator-form",value:s.value,"onUpdate:value":p[2]||(p[2]=y=>s.value=y),validation:a.value,settings:t.settings,"is-submit-processing":l.value,"onUpdate:params":i.unref(f),onSubmit:g,"onClick:addLine":u,"onClick:removeLine":h},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),a0={class:"flex flex-col gap-3"},l0={},Ed=i.defineComponent({...l0,__name:"metal-for-doors-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit"],setup(t,{expose:e,emit:n}){var g;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("first-input-element"),l=i.ref(M.cloneDeep(r.value)),c=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth),...r.settings.maxWidth?[ae.max(r.settings.maxWidth)]:[],ae.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(1),He.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),d=i.ref(r.settings.canSetDopProdaga??!1),u=()=>{o("update:params",l.value.configuratorParams),h("configuratorParams",l.value.configuratorParams)},h=(m,p)=>{const b=new j.OrderItemBase(r.value);b[m]=p,m==="configuratorParams"&&(b.product=new j.ClientProduct),o("update:value",b)},f=()=>{var m;(m=a.value)==null||m.select()};return i.watch(()=>r.value,m=>{l.value=M.cloneDeep(m)},{deep:!0}),i.onMounted(()=>{r.value.isNewRec()&&i.nextTick(()=>{f()})}),e({validate:(g=s.value)==null?void 0:g.validate,formReference:s}),(m,p)=>{const b=A.NCheckbox;return i.openBlock(),i.createBlock(i.unref(A.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(y=>o("submit",l.value),["prevent"]),["enter"]))},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NFormItem),{path:"configuratorParams.width",label:`Ширина, ${t.settings.minWidth?" от "+t.settings.minWidth:""}${t.settings.maxWidth?" до "+t.settings.maxWidth:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{ref:"first-input-element",value:l.value.configuratorParams.width,"onUpdate:value":[p[0]||(p[0]=y=>l.value.configuratorParams.width=y),u],class:"w-full",parse:i.unref(rt),"show-button":!1,placeholder:"Введите ширину",onKeydown:p[1]||(p[1]=y=>i.unref(nt)(y)),onInput:p[2]||(p[2]=y=>i.unref(tt)(t.validation,"width")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(A.NFormItem),{path:"configuratorParams.length",label:`Длина, ${t.settings.minLength?" от "+t.settings.minLength:""}${t.settings.maxLength?" до "+t.settings.maxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[p[3]||(p[3]=y=>l.value.configuratorParams.length=y),u],placeholder:"Введите длину",parse:i.unref(rt),"show-button":!1,class:"w-full",onKeydown:p[4]||(p[4]=y=>i.unref(nt)(y)),onInput:p[5]||(p[5]=y=>i.unref(tt)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(A.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:t.value.quantity,placeholder:"Введите количество",min:1,"show-button":!1,class:"w-full",onKeydown:p[6]||(p[6]=y=>i.unref(nt)(y,!1)),onInput:p[7]||(p[7]=y=>i.unref(tt)(t.validation,"quantity")),"onUpdate:value":p[8]||(p[8]=y=>h("quantity",y??0)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(A.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInput),{value:t.value.marker??null,placeholder:"Введите маркировку",onInput:p[9]||(p[9]=y=>i.unref(tt)(t.validation,"marker")),"onUpdate:value":p[10]||(p[10]=y=>h("marker",y??null)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(b,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":p[11]||(p[11]=y=>{l.value.isAdditionalSale=y??!1,h("isAdditionalSale",y??!1)})},{default:i.withCtx(()=>[...p[14]||(p[14]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(ur,{"is-product-searching":t.isProductSearching,product:t.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),i.createElementVNode("div",a0,[i.createVNode(i.unref(A.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]=y=>o("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["model","rules","disabled"])}}}),c0={class:"flex flex-col gap-2 w-72"},d0={},Pd=i.defineComponent({...d0,__name:"metal-for-doors-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("metal-for-doors-configurator-form"),s=i.ref(n.cartItem),a=i.ref({width:{},length:{},quantity:{},marker:{}}),l=i.ref(!1),c=i.ref(!1),d=i.computed(()=>i.inject("debounce-input-time",300)),u=M.debounce(async f=>{var g,m;s.value.product=new j.ClientProduct,(m=(g=o.value)==null?void 0:g.formReference)==null||m.validate(p=>{p||(l.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:f,validationFieldResultData:a.value,callback:b=>{b?s.value.product=b:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(M.noop)},d.value),h=async()=>{var f,g;(g=(f=o.value)==null?void 0:f.formReference)==null||g.validate(m=>{m||(c.value=!0,r("submit",s.value,a.value,()=>{c.value=!1,i.nextTick(()=>{var p,b;(b=(p=o.value)==null?void 0:p.formReference)==null||b.restoreValidation()})}))}).catch(M.noop)};return i.watch(()=>n.cartItem,f=>{s.value=new j.OrderItemBase(f)},{deep:!0}),(f,g)=>{const m=A.NButton;return i.openBlock(),i.createElementBlock("div",c0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(m,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=p=>r("click:view-switch"))},{default:i.withCtx(()=>[...g[4]||(g[4]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Ed,{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"])])}}}),u0={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function h0(t,e){return i.openBlock(),i.createElementBlock("svg",u0,[...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 Fd=i.markRaw({name:"ion-add",render:h0}),f0={key:0,class:"-mt-1 text-sm text-gray-500"},m0={class:"font-bold"},g0={class:"flex flex-col gap-3"},p0={key:0,class:"mt-4 flex flex-col gap-1.5"},y0={class:"flex flex-col gap-1 text-sm text-gray-700"},b0={key:0},_0={key:1},w0={"form-array-name":"items",class:"flex flex-col gap-3"},x0={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},k0={key:0,class:"flex flex-wrap items-end gap-2"},v0={class:"whitespace-nowrap text-xl font-bold"},C0={key:0,class:"whitespace-nowrap text-lg text-gray-500"},S0={class:"font-bold"},B0={class:"font-bold"},T0={class:"flex gap-3"},N0={},Vd=i.defineComponent({...N0,__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 L;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.ref(M.cloneDeep(r.value)),l=i.ref({...r.validation}),c=H=>{var z;delete l.value[H],(z=s.value)==null||z.restoreValidation()};i.watch(()=>r.validation,H=>{l.value={...H},Object.values(H).some(O=>O==null?void 0:O.feedback)&&i.nextTick(()=>{var O;return(O=s.value)==null?void 0:O.validate(M.noop).catch(M.noop)})},{deep:!0});const d=i.computed(()=>r.value.category),u=i.ref(null),h=i.ref(null),f=i.computed(()=>d.value.products??[]),g=i.computed(()=>f.value.map(H=>({label:H.name,value:H.id}))),m=(H,z,O)=>{const U=H!=null&&H>0,K=z!=null&&z>0;return!U&&!K?null:U&&K?`от ${H} ${O} до ${z} ${O}`:U?`от ${H} ${O}`:`до ${z} ${O}`},p=i.computed(()=>{var H,z;return m(r.settings.minWidth,(z=(H=u.value)==null?void 0:H.properties)==null?void 0:z.width,"мм")}),b=i.computed(()=>{var H,z;return m(r.settings.minLength,(z=(H=u.value)==null?void 0:H.properties)==null?void 0:z.length,"мм")}),y=i.ref(null),_=i.ref(!1),C=i.computed(()=>{var z;const H={marker:[He.serverValidation((z=l.value.marker)==null?void 0:z.feedback)]};return a.value.configuratorParams.items.forEach((O,U)=>{var K,V,q,Y,ee,ue,ve;H[`configuratorParams.items.${U}.width`]=[ae.required,ae.min(r.settings.minWidth),...(V=(K=u.value)==null?void 0:K.properties)!=null&&V.width?[ae.max(u.value.properties.width)]:[],ae.step(1),He.serverValidation((q=l.value[`items.${U}.width`])==null?void 0:q.feedback)],H[`configuratorParams.items.${U}.length`]=[ae.required,ae.min(r.settings.minLength),...(ee=(Y=u.value)==null?void 0:Y.properties)!=null&&ee.length?[ae.max(u.value.properties.length)]:[],ae.step(1),He.serverValidation((ue=l.value[`items.${U}.length`])==null?void 0:ue.feedback)],H[`configuratorParams.items.${U}.count`]=[ae.required,ae.min(1),ae.step(1),He.serverValidation((ve=l.value[`items.${U}.count`])==null?void 0:ve.feedback)]}),H}),x=i.ref(r.settings.canSetDopProdaga??!1),N=i.computed(()=>a.value.configuratorParams.items.some(H=>{var z,O;return!u.value||!H.width||H.width<r.settings.minWidth||H.width>(((z=u.value.properties)==null?void 0:z.width)??0)||H.length===0||H.length<r.settings.minLength||H.length>(((O=u.value.properties)==null?void 0:O.length)??0)||!H.count||H.count<1})),$=i.computed(()=>!u.value||N.value||a.value.configuratorParams.items.length===0),w=i.ref(null),v=H=>{if(!H){u.value=null,h.value=null,a.value.product=new j.ClientProduct,y.value=null;return}const z=f.value.find(O=>O.id===H);z&&(u.value=z,h.value=H,a.value.product=z,te("product",a.value.product),a.value.configuratorParams.items.forEach(O=>{var U,K;(U=z.properties)!=null&&U.width&&O.width>z.properties.width&&(O.width=z.properties.width),(K=z.properties)!=null&&K.length&&O.length>z.properties.length&&(O.length=z.properties.length)}),B())};let k=!1;const B=()=>{k=!0,y.value=null,w.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},R=async()=>{var H;if(!u.value||a.value.configuratorParams.items.length===0||N.value){B();return}(H=s.value)==null||H.validate(z=>{if(z){B();return}if(_.value=!0,!u.value||!d.value){B(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:O=>{O?(y.value=O,a.value.configuratorParams.calculationId=O.id,a.value.quantity=O.quantity,i.nextTick(()=>{te("quantity",O.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,B()),te("configuratorParams",a.value.configuratorParams),E(),_.value=!1}})}).catch(()=>{B(),_.value=!1})},E=()=>{var z;if(!((z=u.value)!=null&&z.costRub)||!y.value){w.value=null;return}const H=y.value.quantity*u.value.costRub;w.value=Math.round(H*100)/100},P=H=>{var O,U;const z=a.value.configuratorParams.items[H];u.value&&((O=u.value.properties)!=null&&O.width&&z.width>u.value.properties.width&&(z.width=u.value.properties.width),(U=u.value.properties)!=null&&U.length&&z.length>u.value.properties.length&&(z.length=u.value.properties.length)),te("configuratorParams",a.value.configuratorParams),B()},W=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),te("configuratorParams",a.value.configuratorParams),B(),o("add-item",a.value.configuratorParams.items.length)},I=H=>{a.value.configuratorParams.items.splice(H,1),te("configuratorParams",a.value.configuratorParams),B(),o("remove-item",H)},Z=()=>{if(!($.value||_.value||r.isSubmitProcessing)){if(!y.value){R();return}o("submit",a.value)}},te=(H,z)=>{const O=new j.OrderItemBase(r.value);O[H]=z,o("update:value",O)};i.watch(()=>r.value,H=>{const z=M.cloneDeep(i.toRaw(H));(!z.configuratorParams.items||z.configuratorParams.items.length===0)&&(z.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=z,r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,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:H}=a.value.configuratorParams,z=a.value.quantity??0;H&&z>0&&a.value.product&&!a.value.product.isNewRec()&&(y.value={id:H,quantity:z,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:(L=s.value)==null?void 0:L.validate,formReference:s}),(H,z)=>{const O=Hr,U=Fd;return i.openBlock(),i.createBlock(i.unref(A.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 K;return[i.createVNode(i.unref(A.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NSelect),{value:h.value,"onUpdate:value":[z[0]||(z[0]=V=>h.value=V),v],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((K=u.value)==null?void 0:K.costRub)!=null?(i.openBlock(),i.createElementBlock("div",f0,[i.createElementVNode("span",m0,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",g0,[u.value?(i.openBlock(),i.createElementBlock("div",p0,[z[7]||(z[7]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",y0,[p.value?(i.openBlock(),i.createElementBlock("div",b0,"Ширина "+i.toDisplayString(p.value)+".",1)):i.createCommentVNode("",!0),b.value?(i.openBlock(),i.createElementBlock("div",_0,"Длина "+i.toDisplayString(b.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",w0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value.configuratorParams.items,(V,q)=>(i.openBlock(),i.createElementBlock("div",{key:q,class:"flex grow gap-2"},[i.createElementVNode("div",x0,[i.createVNode(i.unref(A.NFormItem),{path:`configuratorParams.items.${q}.width`,label:"Ширина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:a.value.configuratorParams.items[q].width,"onUpdate:value":[Y=>a.value.configuratorParams.items[q].width=Y,Y=>P(q)],parse:i.unref(rt),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:z[1]||(z[1]=Y=>i.unref(nt)(Y)),onInput:Y=>c(`items.${q}.width`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(A.NFormItem),{path:`configuratorParams.items.${q}.length`,label:"Длина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:a.value.configuratorParams.items[q].length,"onUpdate:value":[Y=>a.value.configuratorParams.items[q].length=Y,Y=>P(q)],parse:i.unref(rt),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:z[2]||(z[2]=Y=>i.unref(nt)(Y)),onInput:Y=>c(`items.${q}.length`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(A.NFormItem),{path:`configuratorParams.items.${q}.count`,label:"Количество, шт"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:a.value.configuratorParams.items[q].count,"onUpdate:value":[Y=>a.value.configuratorParams.items[q].count=Y,Y=>P(q)],parse:i.unref(rt),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:z[3]||(z[3]=Y=>i.unref(nt)(Y,!1)),onInput:Y=>c(`items.${q}.count`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),i.createVNode(i.unref(A.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:Y=>I(q)},{default:i.withCtx(()=>[i.createVNode(O)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(i.openBlock(),i.createBlock(i.unref(A.NButton),{key:1,disabled:N.value,type:"default",class:"self-center",onClick:W},{default:i.withCtx(()=>[i.createVNode(U),z[8]||(z[8]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0)]),i.createVNode(i.unref(A.NFormItem),{path:"marker",label:"Маркировка распила"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInput),{value:a.value.marker??null,disabled:!u.value,placeholder:"Введите маркировку распила",onInput:z[4]||(z[4]=V=>c("marker")),"onUpdate:value":z[5]||(z[5]=V=>te("marker",V??null)),onFocus:i.unref(Le)},null,8,["value","disabled","onFocus"])]),_:1}),x.value?(i.openBlock(),i.createBlock(i.unref(A.NCheckbox),{key:1,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":z[6]||(z[6]=V=>{a.value.isAdditionalSale=V??!1,te("isAdditionalSale",V??!1)})},{default:i.withCtx(()=>[...z[9]||(z[9]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(i.unref(A.NSpin),{show:_.value,size:"small",class:"grow"},{default:i.withCtx(()=>{var V;return[y.value&&u.value&&w.value?(i.openBlock(),i.createElementBlock("div",k0,[i.createElementVNode("div",null,[z[10]||(z[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",v0,i.toDisplayString(w.value.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol),1)]),y.value.quantity&&u.value?(i.openBlock(),i.createElementBlock("div",C0,[i.createElementVNode("span",S0,"("+i.toDisplayString(y.value.quantity)+" шт.",1),z[11]||(z[11]=i.createTextVNode(" x ",-1)),i.createElementVNode("span",B0,i.toDisplayString((V=u.value.costRub)==null?void 0:V.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]}),_:1},8,["show"]),i.createElementVNode("div",T0,[y.value&&!_.value?(i.openBlock(),i.createBlock(i.unref(A.NButton),{key:0,loading:t.isSubmitProcessing,disabled:$.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(A.NButton),{key:1,loading:_.value,disabled:$.value||_.value,type:"info",class:"self-start",onClick:R},{default:i.withCtx(()=>[...z[12]||(z[12]=[i.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules","onKeydown"])}}}),$0={class:"flex flex-col gap-2"},R0={class:"w-104 flex grow flex-col px-5"},E0={},Md=i.defineComponent({...E0,__name:"sandwich-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItem:{}},emits:["submit","click:view-switch"],setup(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("sandwich-configurator-form"),s=i.ref(n.cartItem),a=i.ref({width:{},length:{},quantity:{},marker:{},product:{}}),l=i.ref(!1),c=async()=>{var h,f;(f=(h=o.value)==null?void 0:h.formReference)==null||f.validate(g=>{if(!g){l.value=!0;const m=M.cloneDeep(s.value);"items"in m.configuratorParams&&delete m.configuratorParams.items,r("submit",m,a.value,()=>{l.value=!1,i.nextTick(()=>{var p,b;(b=(p=o.value)==null?void 0:p.formReference)==null||b.restoreValidation()})})}}).catch(M.noop)},d=h=>{a.value[`items.${h}.width`]={},a.value[`items.${h}.length`]={},a.value[`items.${h}.count`]={}},u=h=>{delete a.value[`items.${h}.width`],delete a.value[`items.${h}.length`],delete a.value[`items.${h}.count`]};return i.onMounted(()=>{n.cartItem.configuratorParams.items.forEach((h,f)=>{a.value[`items.${f}.width`]={},a.value[`items.${f}.length`]={},a.value[`items.${f}.count`]={}})}),i.watch(()=>n.cartItem,h=>{s.value=new j.OrderItemBase(h)},{deep:!0}),(h,f)=>{const g=A.NButton;return i.openBlock(),i.createElementBlock("div",$0,[t.settings.allowShowTable&&s.value.isNewRec()?(i.openBlock(),i.createBlock(g,{key:0,type:"tertiary",class:"self-center",onClick:f[0]||(f[0]=m=>r("click:view-switch"))},{default:i.withCtx(()=>[...f[2]||(f[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",R0,[i.createVNode(Vd,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":f[1]||(f[1]=m=>s.value=m),validation:a.value,settings:t.settings,"event-emitter":t.eventEmitter,"is-submit-processing":l.value,onSubmit:c,onAddItem:d,onRemoveItem:u},null,8,["value","validation","settings","event-emitter","is-submit-processing"])])])}}}),P0={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function F0(t,e){return i.openBlock(),i.createElementBlock("svg",P0,[...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 V0=i.markRaw({name:"ion-checkmark",render:F0}),M0={key:0,class:"-mt-1 text-sm text-gray-500"},A0={class:"font-bold"},I0={class:"flex flex-col gap-3"},O0={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},z0={class:"flex flex-col gap-1 text-sm text-gray-700"},D0={key:0},L0={key:1},H0={"form-array-name":"items",class:"flex flex-col gap-3"},W0={class:"min-w-0 flex-1"},j0={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},q0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},X0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},Y0={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},U0={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},K0={key:0,class:"lg:!flex-[2]"},G0={class:"font-bold"},Z0={key:1,class:"lg:!flex-[3]"},Q0={class:"font-bold"},J0={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"},eb={key:0},tb={class:"font-bold"},nb={key:1},ib={class:"font-bold"},rb={class:"flex flex-wrap items-center gap-3"},ob={},Ad=i.defineComponent({...ob,__name:"sandwich-m2-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},itemStates:{default:()=>[]}},emits:["submit","update:value","add-item","remove-item","item-reset"],setup(t,{expose:e,emit:n}){var K;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("widthInputs"),l=r.value==null?[]:M.cloneDeep(i.toRaw(r.value)),c=i.ref(l.map(V=>new j.OrderItemBase(V))),d=i.computed(()=>({items:c.value})),u=i.ref({...r.validation}),h=V=>{var q;delete u.value[V],(q=s.value)==null||q.restoreValidation()},f=i.ref(null),g=i.ref(null),m=i.computed(()=>{var V,q;return((q=(V=c.value[0])==null?void 0:V.category)==null?void 0:q.products)??[]}),p=i.computed(()=>m.value.map(V=>({label:V.name,value:V.id}))),b=(V,q,Y)=>{const ee=V!=null&&V>0,ue=q!=null&&q>0;return!ee&&!ue?null:ee&&ue?`от ${V} ${Y} до ${q} ${Y}`:ee?`от ${V} ${Y}`:`до ${q} ${Y}`},y=i.computed(()=>{var V,q;return b(r.settings.minWidth,(q=(V=f.value)==null?void 0:V.properties)==null?void 0:q.width,"мм")}),_=i.computed(()=>{var V,q;return b(r.settings.minLength,(q=(V=f.value)==null?void 0:V.properties)==null?void 0:q.length,"мм")}),C=i.computed(()=>{const V={};return c.value.forEach((q,Y)=>{var ee,ue,ve,Te,We,ce,pt,Ne;V[`items.${Y}.configuratorParams.width`]=[ae.required,ae.min(r.settings.minWidth),...(ue=(ee=f.value)==null?void 0:ee.properties)!=null&&ue.width?[ae.max(f.value.properties.width)]:[],ae.step(1),He.serverValidation((ve=u.value[`items.${Y}.width`])==null?void 0:ve.feedback)],V[`items.${Y}.configuratorParams.length`]=[ae.required,ae.min(r.settings.minLength),...(We=(Te=f.value)==null?void 0:Te.properties)!=null&&We.length?[ae.max(f.value.properties.length)]:[],ae.step(1),He.serverValidation((ce=u.value[`items.${Y}.length`])==null?void 0:ce.feedback)],V[`items.${Y}.quantity`]=[ae.required,ae.min(1),ae.step(1),He.serverValidation((pt=u.value[`items.${Y}.quantity`])==null?void 0:pt.feedback)],V[`items.${Y}.marker`]=[He.serverValidation((Ne=u.value[`items.${Y}.marker`])==null?void 0:Ne.feedback)]}),V});i.watch(()=>r.validation,V=>{u.value={...V},Object.values(V).some(Y=>Y==null?void 0:Y.feedback)&&i.nextTick(()=>{var Y;return(Y=s.value)==null?void 0:Y.validate(M.noop).catch(M.noop)})},{deep:!0});const x=i.ref(r.settings.canSetDopProdaga??!1),N=i.computed(()=>{const V=f.value;return V?c.value.some(q=>{var ve,Te;const Y=q.configuratorParams,ee=(ve=V.properties)==null?void 0:ve.width,ue=(Te=V.properties)==null?void 0:Te.length;return Y.width===0||Y.width<r.settings.minWidth||ee!=null&&Y.width>ee||Y.length===0||Y.length<r.settings.minLength||ue!=null&&Y.length>ue||q.quantity===0||q.quantity<1}):!0}),$=i.computed(()=>!f.value||N.value||c.value.length===0),w=i.computed(()=>{const V=c.value[0];return V!=null&&!V.isNewRec()}),v=V=>r.itemStates[V]??"idle",k=V=>v(V)==="success",B=V=>v(V)==="loading",R=i.computed(()=>c.value.length===0?!0:c.value.every((V,q)=>{const Y=v(q);return Y==="success"||Y==="loading"})),E=V=>V.width===0||V.length===0?0:V.width*V.length/1e6,P=V=>{var ve;const q=V.configuratorParams,Y=E(q),ee=((ve=f.value)==null?void 0:ve.costRub)??0,ue=V.quantity??0;return!Y||!ue?0:Math.round(Y*ee*ue*100)/100},W=i.computed(()=>M.sum(c.value.map(V=>{const q=V.configuratorParams;return!q.width||q.length===0||!V.quantity?0:q.width*q.length*V.quantity/1e6}))),I=i.computed(()=>Math.round(M.sum(c.value.map(V=>P(V)))*100)/100),Z=()=>{var V,q,Y;return new j.OrderItemBase({category:(V=c.value[0])==null?void 0:V.category,configurator:(q=c.value[0])==null?void 0:q.configurator,product:f.value??new j.ClientProduct,quantity:1,isAdditionalSale:(Y=c.value[0])==null?void 0:Y.isAdditionalSale,configuratorParams:{width:0,length:0}})},te=V=>{if(!V){f.value=null,g.value=null,c.value.forEach(Y=>{Y.product=new j.ClientProduct}),o("update:value",c.value);return}const q=m.value.find(Y=>Y.id===V);q&&(f.value=q,g.value=V,c.value.forEach((Y,ee)=>{var ue,ve;Y.product=q,(ue=q.properties)!=null&&ue.width&&Y.configuratorParams.width>q.properties.width&&(Y.configuratorParams.width=q.properties.width),(ve=q.properties)!=null&&ve.length&&Y.configuratorParams.length>q.properties.length&&(Y.configuratorParams.length=q.properties.length),o("item-reset",ee)}),o("update:value",c.value))},D=V=>{var ee,ue;const q=c.value[V],Y=f.value;Y&&((ee=Y.properties)!=null&&ee.width&&q.configuratorParams.width>Y.properties.width&&(q.configuratorParams.width=Y.properties.width),(ue=Y.properties)!=null&&ue.length&&q.configuratorParams.length>Y.properties.length&&(q.configuratorParams.length=Y.properties.length)),o("item-reset",V),o("update:value",c.value)},L=(V,q)=>{c.value[V].marker=q===null||q===""?void 0:q,o("item-reset",V),o("update:value",c.value)},H=V=>{c.value.forEach(q=>{q.isAdditionalSale=V}),o("update:value",c.value)},z=()=>{c.value.push(Z()),o("update:value",c.value),o("add-item",c.value.length),i.nextTick(()=>{var q,Y,ee,ue;const V=c.value.length-1;(Y=(q=a.value)==null?void 0:q[V])==null||Y.focus(),(ue=(ee=a.value)==null?void 0:ee[V])==null||ue.select()})},O=V=>{c.value.splice(V,1),o("update:value",c.value),o("remove-item",V)};i.watch(()=>r.value,V=>{var ue;const Y=(V==null?[]:M.cloneDeep(i.toRaw(V))).map(ve=>new j.OrderItemBase(ve));c.value=Y.length>0?Y:[Z()];const ee=(ue=c.value[0])==null?void 0:ue.product;ee&&!ee.isNewRec()?(f.value=ee,g.value=ee.id):(f.value=null,g.value=null)},{deep:!0});const U=()=>{var q;if(f.value!==null)return;const V=(q=m.value[0])==null?void 0:q.id;V!=null&&te(V)};return i.watch(m,()=>{U()}),i.onMounted(()=>{var q;c.value.length===0&&(c.value=[Z()]);const V=(q=c.value[0])==null?void 0:q.product;V&&!V.isNewRec()&&(f.value=V,g.value=V.id),U()}),e({validate:(K=s.value)==null?void 0:K.validate,formReference:s}),(V,q)=>{const Y=V0,ee=Hr,ue=Fd;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(A.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(A.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NSelect),{value:g.value,"onUpdate:value":[q[0]||(q[0]=We=>g.value=We),te],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((ve=f.value)==null?void 0:ve.costRub)!=null?(i.openBlock(),i.createElementBlock("div",M0,[i.createElementVNode("span",A0,i.toDisplayString(f.value.code),1),i.createTextVNode(" — "+i.toDisplayString(f.value.costRub.toLocaleString())+" "+i.toDisplayString(f.value.currency.symbol)+"/м² ",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",I0,[f.value?(i.openBlock(),i.createElementBlock("div",O0,[q[6]||(q[6]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",z0,[y.value?(i.openBlock(),i.createElementBlock("div",D0,"Ширина "+i.toDisplayString(y.value)+".",1)):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createElementBlock("div",L0,"Длина "+i.toDisplayString(_.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",H0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value.items,(We,ce)=>{var pt;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",W0,[i.createElementVNode("div",j0,[i.createElementVNode("div",q0,[i.createVNode(i.unref(A.NFormItem),{path:`items.${ce}.configuratorParams.width`,label:"Ширина, мм",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.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(rt),"show-button":!1,disabled:!f.value||k(ce)||B(ce),placeholder:"Ширина",class:"w-full",onKeydown:q[1]||(q[1]=Ne=>i.unref(nt)(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(A.NFormItem),{path:`items.${ce}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:d.value.items[ce].configuratorParams.length,"onUpdate:value":[Ne=>d.value.items[ce].configuratorParams.length=Ne,Ne=>D(ce)],parse:i.unref(rt),"show-button":!1,disabled:!f.value||k(ce)||B(ce),placeholder:"Длина",class:"w-full",onKeydown:q[2]||(q[2]=Ne=>i.unref(nt)(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",X0,[i.createVNode(i.unref(A.NFormItem),{path:`items.${ce}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:d.value.items[ce].quantity,"onUpdate:value":[Ne=>d.value.items[ce].quantity=Ne,Ne=>D(ce)],parse:i.unref(rt),"show-button":!1,disabled:!f.value||k(ce)||B(ce),placeholder:"Кол-во",class:"w-full",onKeydown:q[3]||(q[3]=Ne=>i.unref(nt)(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(A.NFormItem),{path:`items.${ce}.marker`,label:"Маркировка",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInput),{value:d.value.items[ce].marker??null,disabled:!f.value||k(ce)||B(ce),placeholder:"Маркировка",class:"w-full",onInput:Ne=>h(`items.${ce}.marker`),"onUpdate:value":Ne=>L(ce,Ne??null),onFocus:i.unref(Le)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),B(ce)||k(ce)?(i.openBlock(),i.createElementBlock("div",Y0,[B(ce)?(i.openBlock(),i.createBlock(i.unref(A.NSpin),{key:0,size:14})):k(ce)?(i.openBlock(),i.createBlock(Y,{key:1,class:"text-green-600 text-xl"})):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),i.createElementVNode("div",U0,[We.configuratorParams.width>0&&We.configuratorParams.length>0?(i.openBlock(),i.createElementBlock("div",K0,[q[7]||(q[7]=i.createTextVNode(" Площадь (S) = ",-1)),i.createElementVNode("span",G0,i.toDisplayString(E(We.configuratorParams).toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),P(We)>0?(i.openBlock(),i.createElementBlock("div",Z0,[q[8]||(q[8]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",Q0,i.toDisplayString(P(We).toLocaleString())+" "+i.toDisplayString((pt=f.value)==null?void 0:pt.currency.symbol),1)])):i.createCommentVNode("",!0)])]),w.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(A.NButton),{key:0,disabled:B(ce)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:Ne=>O(ce)},{default:i.withCtx(()=>[i.createVNode(ee)]),_:1},8,["disabled","onClick"]))],2)}),128))]),f.value?(i.openBlock(),i.createElementBlock("div",J0,[W.value>0?(i.openBlock(),i.createElementBlock("div",eb,[q[9]||(q[9]=i.createTextVNode(" Общая площадь: ",-1)),i.createElementVNode("span",tb,i.toDisplayString(W.value.toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),I.value>0?(i.openBlock(),i.createElementBlock("div",nb,[q[10]||(q[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",ib,i.toDisplayString(I.value.toLocaleString())+" "+i.toDisplayString(f.value.currency.symbol),1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),x.value?(i.openBlock(),i.createBlock(i.unref(A.NCheckbox),{key:1,checked:((Te=c.value[0])==null?void 0:Te.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":q[4]||(q[4]=We=>H(We??!1))},{default:i.withCtx(()=>[...q[11]||(q[11]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createElementVNode("div",rb,[f.value&&!w.value?(i.openBlock(),i.createBlock(i.unref(A.NButton),{key:0,disabled:N.value,type:"default",onClick:z},{default:i.withCtx(()=>[i.createVNode(ue),q[12]||(q[12]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),i.createVNode(i.unref(A.NButton),{loading:t.isSubmitProcessing,disabled:$.value||R.value,type:"primary",class:"ml-auto",onClick:q[5]||(q[5]=We=>o("submit",c.value))},{default:i.withCtx(()=>{var We;return[i.createTextVNode(i.toDisplayString((We=c.value[0])!=null&&We.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[i.unref(Ga)]])}}}),sb={class:"flex flex-col gap-2"},ab={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},lb={},Id=i.defineComponent({...lb,__name:"sandwich-m2-configurator",props:{eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{type:Function},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{type:Function},settings:{},cartItems:{}},emits:["click:view-switch","submit"],setup(t,{emit:e}){const n=t,r=e,o=i.useTemplateRef("sandwich-m2-configurator-form"),s=i.ref((n.cartItems??[]).map(C=>new j.OrderItemBase(C))),a=i.ref([]),l=i.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=C=>{c.forEach(x=>{l.value[`items.${C}.${x}`]={}})},u=C=>{c.forEach(x=>{delete l.value[`items.${C}.${x}`]})},h=i.computed(()=>a.value.includes("loading")),f=()=>({width:{},length:{},quantity:{},marker:{}}),g=(C,x)=>{let N=!1;return c.forEach($=>{var E,P;const w=`items.0.${$}`,v=(E=C[$])==null?void 0:E.feedback,B=((P=C[w])==null?void 0:P.feedback)??v,R=`items.${x}.${$}`;B?(l.value[R]=C[w]??C[$],N=!0):l.value[R]={}}),N},m=(C,x,N)=>new Promise($=>{const w=f();let v=!1;const k=B=>{if(v)return;v=!0;const R=g(w,x),E=(B===void 0?!R:B)&&!R;a.value[x]=E?"success":"error",i.nextTick(()=>{var P,W;(W=(P=o.value)==null?void 0:P.formReference)==null||W.restoreValidation()}),$(E)};a.value[x]="loading",r("submit",[M.cloneDeep(C)],w,k,{isFinalSuccessfulCompletion:N})}),p=async()=>{var N,$;try{await(($=(N=o.value)==null?void 0:N.formReference)==null?void 0:$.validate())}catch{return}const C=s.value.map((w,v)=>v).filter(w=>{const v=a.value[w]??"idle";return v!=="success"&&v!=="loading"});let x=!0;for(let w=0;w<C.length;w+=1){const v=C[w],k=s.value[v];if(!k)break;const R=w===C.length-1&&x;await m(k,v,R)||(x=!1)}},b=C=>{const x=C-1;a.value[x]="idle",d(x)},y=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(N=>new j.OrderItemBase(N));s.value=x,a.value=x.map(()=>"idle"),x.forEach((N,$)=>{d($)})},{deep:!0}),(C,x)=>{var $;const N=A.NButton;return i.openBlock(),i.createElementBlock("div",sb,[t.settings.allowShowTable&&(($=s.value[0])!=null&&$.isNewRec())?(i.openBlock(),i.createBlock(N,{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",ab,[i.createVNode(Ad,{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:b,onRemoveItem:y,onItemReset:_},null,8,["value","validation","settings","event-emitter","is-submit-processing","item-states"])])])}}}),cb={key:0,class:"flex justify-center p-4"},db={key:1,class:"p-4 text-center text-red-500"},ub={key:2,class:"flex justify-center"},hb={class:"!bg-white p-4 m-2 rounded-md w-max"},fb={key:3,class:"p-4 text-center text-gray-500"},mb={},Od=i.defineComponent({...mb,__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=f=>{const g=f.configuratorParams;return[new j.OrderItemBase({...f,quantity:f.quantity??1,marker:f.marker,configuratorParams:{width:(g==null?void 0:g.width)??f.width??0,length:(g==null?void 0:g.length)??f.length??0}})]},l=i.ref(e.editor===j.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var g,m,p;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const f={category:((g=e.cartItem)==null?void 0:g.category)??e.category,configurator:e.editor,quantity:1};switch(e.editor){case"kozyrek":{const b=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{length:b.stripMinLength,linesAngles:[],linesWidths:[],startTailType:M.some(b.startTailConfigs,y=>y.isDefault)?(m=b.startTailConfigs)==null?void 0:m.findIndex(y=>y.isDefault):void 0,endTailType:M.some(b.endTailConfigs,y=>y.isDefault)?(p=b.endTailConfigs)==null?void 0:p.findIndex(y=>y.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const b=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{width:0,height:0,netType:b.netType[0]||"",color:b.color[0]||"",mountType:b.mountType[0]||""}});break}case"strip":{const b=e.settings;s.value=[new j.OrderItemBase({...f,length:b.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const b=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{width:b.minWidth,length:b.minLength}});break}case"sandwich":{o.value=new j.OrderItemBase({...f,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new j.OrderItemBase({...f,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(f,g,m)=>{const p=b=>{m==null||m(),b&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:f,callback:p,validation:g})},u=(f,g,m,p)=>{const b=f[0];if(!b){m==null||m();return}const y=(p==null?void 0:p.isFinalSuccessfulCompletion)===!0,_=C=>{m==null||m(C),y&&C&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:b,callback:_,validation:g,additionalParams:p})},h=()=>{e.category&&e.eventEmitter.emit("configurator:click-view-switch",{category:e.category})};return i.onMounted(()=>{e.cartItem||c()}),(f,g)=>{const m=A.NSpin;return i.openBlock(),i.createElementBlock(i.Fragment,null,[n.value?(i.openBlock(),i.createElementBlock("div",cb,[i.createVNode(m,{size:"large"})])):r.value?(i.openBlock(),i.createElementBlock("div",db,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",ub,[i.createElementVNode("div",hb,[t.editor==="kozyrek"?(i.openBlock(),i.createBlock(vd,{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(Bd,{key:1,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="strip"?(i.openBlock(),i.createBlock(Rd,{key:2,"event-emitter":t.eventEmitter,settings:t.settings,"cart-items":s.value,"onClick:viewSwitch":h,onSubmit:d},null,8,["event-emitter","settings","cart-items"])):t.editor==="metal_for_doors"?(i.openBlock(),i.createBlock(Pd,{key:3,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":h,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="sandwich"?(i.openBlock(),i.createBlock(Md,{key:4,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":h,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="sandwich_m2"?(i.openBlock(),i.createBlock(Id,{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",fb,' Конфигуратор "'+i.toDisplayString(t.editor)+'" не поддерживается. ',1))],64)}}});function zd(t){return Object.values(j.ConfiguratorsEnum).includes(t)}function Dd(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.Sandwich?!0:t.properties.configuratorSettings!==void 0&&M.isArray(t.products)&&t.products.length>0}const gb={key:0,class:"pt-0.5"},pb={key:0},yb={class:"line-through"},bb={key:0},_b={key:1},wb={class:"flex flex-row gap-1"},xb={key:0},kb={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},vb={class:"flex flex-col gap-2.5 sm:flex-row"},Cb={class:"mt-2"},Sb={key:1,class:"flex flex-col"},Bb={},Tb=i.defineComponent({...Bb,__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(lr,"medium"),r=i.computed(()=>{var K;return(K=e==null?void 0:e.filteredItems)==null?void 0:K[e.categoryItem.id]}),o=i.computed(()=>{var K,V;return M.isArray((K=e.categoryItem)==null?void 0:K.categories)&&((V=e.categoryItem.categories)==null?void 0:V.length)>0}),s=i.computed(()=>{var K;return M.isArray((K=e.categoryItem)==null?void 0:K.products)?e.categoryItem.products:[]}),a=i.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([K,V])=>`${V} руб./${R(K)}`).join(", ")),l=i.computed(()=>M.isUndefined(e.filteredItems)||r.value==="*"?s.value:s.value.filter(K=>{var q;const V=(q=r.value)==null?void 0:q.products;return M.isArray(V)&&V.includes(K.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>M.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),u=i.computed(()=>M.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),h=i.computed(()=>M.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),f=i.computed(()=>M.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),g=i.computed(()=>{var K,V,q;return((K=e.categoryItem.properties)==null?void 0:K.configurator)!==void 0&&zd((V=e.categoryItem.properties)==null?void 0:V.configurator)&&Dd(e.categoryItem)&&((q=e.categoryItem.properties)==null?void 0:q.configuratorSettings)!==void 0&&(M.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),m=i.computed(()=>g.value&&(M.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),p=i.computed(()=>M.isNil(e.categoryContextButtonsConfig)?[]:M.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),b=i.computed(()=>new j.ClientCategory(e.categoryItem)),y=i.ref(!1),_=i.ref(!1),C=i.computed(()=>!M.isUndefined(e.isCategoryItemSelected)),x=i.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),N=i.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),$=i.computed(()=>M.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),w=i.computed(()=>z.value&&ot.getDeviceTypeByResolution()===Je.laptop?"auto":"fixed"),v=i.useTemplateRef("collapse-item-reference"),k=i.computed(()=>{var K,V;return(V=(K=e.categoryItem.properties)==null?void 0:K.templateCost)==null?void 0:V.priceCoefficient}),B=i.computed(()=>{var K,V;return(V=(K=e.categoryItem.properties)==null?void 0:K.templateCost)==null?void 0:V.increasePercent}),R=(K,V="ru-RU")=>0 .toLocaleString(V,{style:"currency",currency:K,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),E=K=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:K,target:v.value})},P=(K,V)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:V,isLoadingState:y,target:v.value})},W=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:v.value})},I=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:v.value})},Z=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:v.value})},te=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:v.value})},D=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:v.value})},L=K=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:K,target:v.value})},H=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},z=i.ref(0),O=i.computed(()=>z.value&&s.value.length>0?ng(s.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),U=M.debounce(()=>{z.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",U)}),window.addEventListener("resize",U),U(),(K,V)=>{const q=A.NCheckbox,Y=Mf,ee=A.NTooltip,ue=Pf,ve=A.NTag,Te=$f,We=Bf,ce=A.NButton,pt=vf,Ne=Ja,Vt=Qa,jt=Za,ln=jo,Bt=A.NDropdown,Hn=A.NDataTable,cn=A.NAlert,en=A.NSpin;return i.openBlock(),i.createBlock(el,{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",gb,[i.createVNode(q,{checked:x.value,indeterminate:$.value,disabled:N.value,"onUpdate:checked":E},null,8,["checked","indeterminate","disabled"])])):i.createCommentVNode("",!0),!d.value&&((Ve=b.value)!=null&&Ve.isDisabled)?(i.openBlock(),i.createBlock(ee,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(Y,{class:"pt-1.5"})]),default:i.withCtx(()=>[V[1]||(V[1]=i.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):i.createCommentVNode("",!0),((J=b.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(()=>[V[2]||(V[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=b.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(()=>[V[3]||(V[3]=i.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:V[0]||(V[0]=i.withModifiers((...it)=>i.unref(M.noop)&&i.unref(M.noop)(...it),["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&&B.value}),round:""},{default:i.withCtx(()=>{var it;return[i.createTextVNode(" Установленная стоимость: "+i.toDisplayString(t.categoryItem.properties.m2Price)+" руб./м2 ",1),(it=t.categoryItem.properties)!=null&&it.templateCost&&t.categoryItem.properties.m2PriceRetail&&B.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[B.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(()=>[B.value?(i.openBlock(),i.createElementBlock("span",pb,i.toDisplayString(B.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0),i.createVNode(ve,{size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createElementVNode("span",yb,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||B.value?(i.openBlock(),i.createBlock(ve,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>{var it;return[k.value?(i.openBlock(),i.createElementBlock("span",bb,i.toDisplayString((it=k.value)==null?void 0:it.name),1)):i.createCommentVNode("",!0),B.value?(i.openBlock(),i.createElementBlock("span",_b,i.toDisplayString(B.value>0?"+":"")+i.toDisplayString(B.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0)]}),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(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=b.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 it,qt;return[i.createElementVNode("span",wb,[i.createVNode(Te),i.createTextVNode(" "+i.toDisplayString((qt=(it=b.value)==null?void 0:it.manager)==null?void 0:qt.name),1)])]}),default:i.withCtx(()=>{var it,qt;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((qt=(it=b.value)==null?void 0:it.manager)==null?void 0:qt.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[t.showSlugs||t.showProperties?(i.openBlock(),i.createElementBlock("div",xb,[i.createElementVNode("ul",kb,[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",vb,[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=b.value)!=null&&J.isDisabled?(i.openBlock(),i.createBlock(Y,{key:1})):(i.openBlock(),i.createBlock(We,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var J;return[(J=b.value)!=null&&J.isDisabled?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" Скрыто для клиента"+i.toDisplayString(b.value.hidingComment?`. Причина: '${b.value.hidingComment}'`:""),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Видимо клиенту")],64))]}),_:1})):i.createCommentVNode("",!0),u.value&&!((Ve=b.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(pt)]),_:1},8,["size"])]),default:i.withCtx(()=>{var J,le,De;return[(J=b.value)!=null&&J.manager?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode('Категория закреплена за "'+i.toDisplayString(((De=(le=b.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=b.value)!=null&&J.isRequired?(i.openBlock(),i.createBlock(Vt,{key:1})):(i.openBlock(),i.createBlock(Ne,{key:0}))]}),_:1},8,["disabled","size"])]),default:i.withCtx(()=>[V[4]||(V[4]=i.createTextVNode(" Категория, которую нужно предлагать клиенту ",-1))]),_:1})):i.createCommentVNode("",!0),f.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(jt)]),_:1},8,["size"])]),default:i.withCtx(()=>[V[5]||(V[5]=i.createTextVNode(" Редактировать ",-1))]),_:1})):i.createCommentVNode("",!0),p.value.length>0?(i.openBlock(),i.createBlock(Bt,{key:4,options:p.value,size:i.unref(n),trigger:"click",onSelect:L},{default:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(ln)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(K.$slots,"default",{},()=>{var Ve,J,le;return[i.createElementVNode("div",Cb,[o.value?(i.openBlock(),i.createBlock(Hd,{key:0,"categories-items":t.categoryItem.categories??[],"has-products":c.value||y.value,"event-emitter":t.eventEmitter,"filtered-items":r.value?((Ve=r.value)==null?void 0:Ve.categories)??{}:void 0,"is-category-item-selected":t.isCategoryItemSelected,"show-slugs":t.showSlugs,"show-properties":t.showProperties,"allow-name-click":t.allowNameClick,"allow-price-click":t.allowPriceClick,"show-price-history":t.showPriceHistory,"show-cost-date":t.showCostDate,"show-category-required-button":t.showCategoryRequiredButton,"show-category-hide-for-client-button":t.showCategoryHideForClientButton,"show-category-pin-button":t.showCategoryPinButton,"show-category-edit-button":t.showCategoryEditButton,"category-context-buttons-config":t.categoryContextButtonsConfig,"is-product-item-selected":t.isProductItemSelected,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-costs":t.showProductCosts,"show-product-required-button":t.showProductRequiredButton,"show-product-edit-button":t.showProductEditButton,"product-context-buttons-config":t.productContextButtonsConfig,"show-configurator":t.showConfigurator,"can-show-configurator":t.canShowConfigurator},null,8,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"])):i.createCommentVNode("",!0)]),g.value&&m.value?(i.openBlock(),i.createBlock(Od,{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",Sb,[g.value?(i.openBlock(),i.createBlock(ce,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:H},{default:i.withCtx(()=>[...V[6]||(V[6]=[i.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Hn,{columns:O.value,data:l.value,bordered:!0,loading:y.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),!y.value&&!_.value&&!o.value&&!c.value?(i.openBlock(),i.createBlock(cn,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createBlock(cn,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),y.value?(i.openBlock(),i.createBlock(en,{key:4,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>[...V[7]||(V[7]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),Nb=Nn(Tb,[["__scopeId","data-v-607a5aad"]]),$b={class:"sc-collapse flex w-full flex-col"},Rb={},Ld=i.defineComponent({...Rb,__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",$b,[i.renderSlot(s.$slots,"default")]))}}),Eb={},Hd=i.defineComponent({...Eb,__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(lr,"medium"),r=i.computed(()=>M.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(M.isUndefined(a))return;const l=a[s.id];if(l==="*")return;const c={};return c[s.id]=structuredClone(i.toRaw(l)),c};return(s,a)=>{const l=A.NSpin,c=A.NAlert;return i.openBlock(),i.createElementBlock(i.Fragment,null,[r.value.length>0?(i.openBlock(),i.createBlock(Ld,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(Nb,{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)}}}),Pb={},Wd=i.defineComponent({...Pb,__name:"reference-select",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},consistentMenuWidth:{type:Boolean,default:!0},wrapContent:{type:Boolean},referenceList:{default:()=>[]},showEmptyValue:{type:Boolean,default:!1},sortOptionsByLabel:{type:Boolean,default:!1},filterable:{type:Boolean,default:!1},maxTagCount:{default:void 0},disabledItem:{type:Function,default:void 0}},emits:["update:value"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.computed(()=>M.isArray(r.value)),a=new j.Reference,l=i.computed(()=>M.isNil(r.value)?s.value?[]:null:M.isArray(r.value)?r.value.map(g=>g.id):r.value.id),c=i.computed(()=>Tt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue,void 0,r.disabledItem)),d=g=>{var m;if(M.isArray(g)){const p=g.length>0?g.map(b=>{var y;return(y=c.value.find(_=>_.value===b))==null?void 0:y.item}):[];o("update:value",p)}else{const p=g===a.id||M.isNil(g)||(m=c.value.find(b=>b.value===g))==null?void 0:m.item;o("update:value",p)}},u=i.useTemplateRef("select-component");return e({focus:()=>{var g;return(g=u.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=u.value)==null?void 0:g.blur()}}),(g,m)=>(i.openBlock(),i.createBlock(i.unref(A.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"]))}}),Fb={},Vb=i.defineComponent({...Fb,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{},disabledCoefficient:{type:Function},visibleCoefficient:{type:Function}},emits:["update:value"],setup(t,{emit:e}){var x,N;const n=t,r=e,o=()=>{const $=j.PriceCoefficient.getRetailPriceCoefficient();return M.unset($,"isNewRec"),$},s=$=>!$||$.id===o().id,a=i.computed(()=>{var $;return(($=n.catalogItem)==null?void 0:$.type)==="product"}),l=i.computed(()=>a.value?n.catalogItem:void 0),c=$=>{var w,v,k,B;return $.id===o().id?(w=l.value)==null?void 0:w.getRetailCost():(B=(k=(v=l.value)==null?void 0:v.priceCoefficients)==null?void 0:k.find(R=>R.coefficient.id===$.id))==null?void 0:B.cost},d=i.computed(()=>{var v;const w=[...((v=j.useReferencesStore().priceCoefficientsReference)==null?void 0:v.map(k=>structuredClone(i.toRaw(k))))??[],o()].filter(k=>{var B;return((B=n.visibleCoefficient)==null?void 0:B.call(n,k))??!0});return a.value&&w.forEach(k=>{var R;const B=c(k);B?k.name+=` (${B} ${(R=l.value)==null?void 0:R.currency.symbol})`:k.name=""}),w.filter(k=>k.name!=="")}),u=i.ref(n.value.coefficient),h=i.ref(((N=(x=n.value)==null?void 0:x.value)==null?void 0:N.toString())??null),f=i.ref(null),g=i.computed(()=>{var $,w;return(w=($=l.value)==null?void 0:$.priceCoefficients)==null?void 0:w.find(v=>v.coefficient.slug===j.PriceCoefficientEnum.K0)}),m=i.ref(void 0),p=$=>Number.parseFloat(($??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),b=()=>{var w,v;m.value=void 0;let $=p(h.value);if($=Number.isNaN($)?void 0:$,a.value)if(u.value||h.value){const k=o(),B=c(u.value??k)??0,R=B+B*(($??0)/100);f.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(R),R>(((w=l.value)==null?void 0:w.getRetailCost())??R)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),g.value&&R<(((v=g.value)==null?void 0:v.cost)??0)&&(m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else f.value=null;r("update:value",{value:Number.isNaN($)?void 0:$,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})},y=$=>{M.isArray($)||M.isNull($)||(u.value=$,h.value=null,!u.value&&h.value&&(u.value=o()),b())},_=()=>{u.value||(u.value=o()),b()},C=$=>{var v,k,B,R,E;const w=p($);if(a.value){let P=0;if(w<=0)u.value=void 0,h.value=null;else if(g.value&&w<(((v=g.value)==null?void 0:v.cost)??0))u.value=(k=g.value)==null?void 0:k.coefficient,P=(w-g.value.cost)*100/g.value.cost,m.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(w>(((B=l.value)==null?void 0:B.getRetailCost())??w)){u.value=o();const W=((R=l.value)==null?void 0:R.getRetailCost())??0;P=(w-W)*100/W,m.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const W=((E=l.value)==null?void 0:E.priceCoefficients)??[],I=M.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),m.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 $,w,v,k;n.calculationType===j.CalculationTypeEnum.m2Cost?f.value=((w=($=n.value)==null?void 0:$.value)==null?void 0:w.toString())??null:!((v=n.value)!=null&&v.coefficient)&&((k=n.value)!=null&&k.value)&&(u.value=o()),b()}),($,w)=>{var B,R,E;const v=A.NInput,k=A.NInputGroup;return i.openBlock(),i.createBlock(i.unref(A.NFormItem),{"show-label":!i.unref(M.isNil)(t.label),label:t.label,"show-feedback":!i.unref(M.isNil)(((B=m.value)==null?void 0:B.feedback)??t.feedback),feedback:((R=m.value)==null?void 0:R.feedback)??t.feedback,"validation-status":((E=m.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(j.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[t.calculationType!==i.unref(j.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(Wd,{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":y},null,8,["value","reference-list","clearable","disabled","disabled-item"]),i.createVNode(v,{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(j.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(v,{key:1,value:f.value,"onUpdate:value":[w[1]||(w[1]=P=>f.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"])}}}),Mb={key:0,class:"flex flex-row gap-2.5"},Ab={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},Ib={},jd=i.defineComponent({...Ib,__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=ot.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=ot.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",y=>{a.value=y});return}let m=!1;o("closing",g,()=>{m=!0}),m||(s.value=!1,o("update:show",s.value))},f=()=>{o("accept",m=>{a.value=m})};return i.watch(()=>r.show,g=>{g?u():h("other")}),i.watch(()=>r.processing,g=>{a.value=g}),e({open:u,close:h,acceptHandler:f}),(g,m)=>{const p=A.NButton,b=A.NModal;return i.openBlock(),i.createBlock(b,{loading:a.value,show:s.value,"show-icon":!1,size:i.unref(l),style:i.normalizeStyle(`width: ${d.value}px`),title:t.title,"trap-focus":t.trapFocus??!0,"action-class":g.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:m[1]||(m[1]=y=>h("header")),onEsc:m[2]||(m[2]=y=>h("esc")),onMaskClick:m[3]||(m[3]=y=>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",Mb,[i.renderSlot(g.$slots,"extra-action")])):i.createCommentVNode("",!0),g.$slots.action||t.acceptButton.show||t.cancelButton.show?(i.openBlock(),i.createElementBlock("div",Ab,[i.renderSlot(g.$slots,"action",{disabled:a.value}),t.acceptButton.show??!0?(i.openBlock(),i.createBlock(p,{key:0,disabled:a.value||!t.valid,size:i.unref(l),type:"primary",onClick:f},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","size"])):i.createCommentVNode("",!0),t.cancelButton.show??!0?(i.openBlock(),i.createBlock(p,{key:1,size:i.unref(l),type:"default",onClick:m[0]||(m[0]=y=>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"])}}}),Ob={class:"text-sm"},zb={},Db=i.defineComponent({...zb,__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,v,k;return((w=s.value)==null?void 0:w.unit.isLinear)&&((k=(v=s.value)==null?void 0:v.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,f=()=>({length:{},quantity:{},marker:{}}),g=i.ref(f()),m=i.ref(!1),p=i.computed(()=>{var R,E,P,W;if(!s.value)return{};const w=j.UnitsHelper.getProductLengthMultiplicity(s.value),v=j.UnitsHelper.getProductMultiplicity(s.value),k=((E=(R=s.value)==null?void 0:R.properties)==null?void 0:E.minLength)||w,B=(W=(P=s.value)==null?void 0:P.properties)==null?void 0:W.maxLength;return{length:[ae.required,ae.min(k??.1),ae.max(B),ae.step(w),He.serverValidation(g.value.length.feedback)],quantity:[ae.required,ae.min(v),ae.step(v),He.serverValidation(g.value.quantity.feedback)],marker:[He.serverValidation(g.value.marker.feedback)]}}),b=i.computed(()=>{var w,v,k;return s.value?((w=s.value.properties)==null?void 0:w.lengthStep)??((v=s.value.properties)!=null&&v.ignoreMinCountCheck?0:((k=s.value.properties)==null?void 0:k.minCount)??0):0}),y=i.computed(()=>{var k,B,R,E,P,W,I,Z,te;if(!s.value)return"";const w=((B=(k=s.value)==null?void 0:k.properties)==null?void 0:B.minLength)??((E=(R=s.value)==null?void 0:R.properties)!=null&&E.ignoreMinCountCheck?0:(W=(P=s.value)==null?void 0:P.properties)==null?void 0:W.minCount),v=(Z=(I=s.value)==null?void 0:I.properties)==null?void 0:Z.maxLength;return w||v?`(${w?`от ${w}`:""}${w&&v?" ":""}${v?`до ${v}`:""} ${(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||M.isNil(w)||b.value===0)return;const v=w/b.value,k=Math.round(v),B=j.UnitsHelper.getProductMultiplicity(s.value),R=Math.max(k,B);u.value.quantity=R},C=w=>{var R,E,P,W;if(!((E=(R=s.value)==null?void 0:R.properties)!=null&&E.isLengthConfigurator)||!u.value||M.isNil(w)||b.value===0)return;const v=w*b.value,k=((P=s.value.properties)==null?void 0:P.minLength)||j.UnitsHelper.getProductLengthMultiplicity(s.value),B=(W=s.value.properties)==null?void 0:W.maxLength;k!==void 0&&v<k?u.value.length=k:B!==void 0&&v>B?u.value.length=B:u.value.length=v},x=async w=>{var k;const v=M.cloneDeep(u.value);try{await((k=r.value)==null?void 0:k.validate(B=>{if(!B){if(!s.value||!v)return;j.UnitsHelper.productIsMeasurable(s.value)||delete v.length,a.value&&b.value&&(v.length=b.value),m.value=!0,h("submit",v,g.value,()=>{m.value=!1,w(!1),i.nextTick(()=>{var R;(R=r.value)==null||R.validate(M.noop).catch(M.noop)})})}}))}catch{}},N=()=>{s.value=null,l.value=void 0,u.value=null,g.value=f()};return e({show:(w,v)=>{var k,B,R,E,P;if(s.value=w,l.value=v==null?void 0:v.cartItemData,c.value=v==null?void 0:v.orderId,d.value=(v==null?void 0:v.canSetDopProdaga)??!1,u.value=new j.OrderItemBase((v==null?void 0:v.cartItemData)??new j.OrderItemBase({product:w,quantity:j.UnitsHelper.productIsMeasurable(s.value)?1:((k=w==null?void 0:w.properties)==null?void 0:k.minCount)??1,length:((B=w==null?void 0:w.properties)==null?void 0:B.minLength)||((R=w==null?void 0:w.properties)!=null&&R.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&&b.value>0){const W=b.value,I=u.value.quantity||1;u.value.length=I*W}},closeDialog:N}),(w,v)=>{var P;const k=A.NFormItem,B=A.NInputGroupLabel,R=A.NInputGroup,E=A.NCheckbox;return i.openBlock(),i.createBlock(jd,{ref:"base-dialog-reference",show:!i.unref(M.isNil)(s.value)&&!i.unref(M.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:m.value,"modal-width":500,onAccept:x,onClosing:N},{default:i.withCtx(()=>{var W;return[s.value&&u.value?(i.openBlock(),i.createBlock(i.unref(A.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(j.UnitsHelper).productIsMeasurable(s.value)?(i.openBlock(),i.createBlock(k,{key:0,path:"length",label:`Метраж, ${y.value+s.value.unit.name}`},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:u.value.length,"onUpdate:value":[v[0]||(v[0]=I=>u.value.length=I),_],parse:i.unref(rt),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:v[1]||(v[1]=I=>i.unref(zr)(I,".",!1)),onInput:v[2]||(v[2]=I=>i.unref(tt)(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(R,null,i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(A.NInputNumber),{value:u.value.quantity,"onUpdate:value":[v[3]||(v[3]=I=>u.value.quantity=I),C],parse:i.unref(rt),step:i.unref(j.UnitsHelper).getProductMultiplicity(s.value),"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:v[4]||(v[4]=I=>i.unref(zr)(I,".",!1)),onInput:v[5]||(v[5]=I=>i.unref(tt)(g.value,"quantity")),onFocus:i.unref(Le)},null,8,["value","parse","step","onFocus"]),a.value?(i.openBlock(),i.createBlock(B,{key:0,class:"bg-orange-100 font-bold"},{default:i.withCtx(()=>[i.createTextVNode(" x "+i.toDisplayString(b.value)+" "+i.toDisplayString(s.value.unit.name),1)]),_:1})):i.createCommentVNode("",!0)]),_:2},[!g.value.quantity.feedback&&i.unref(j.UnitsHelper).getProductMultiplicity(s.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",Ob,"Количество должно быть кратно "+i.toDisplayString(i.unref(j.UnitsHelper).getProductMultiplicity(s.value)),1)]),key:"0"}:void 0]),1024)]),_:1}),i.unref(j.UnitsHelper).productIsMeasurable(s.value)?(i.openBlock(),i.createBlock(k,{key:1,path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(A.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:v[6]||(v[6]=I=>i.unref(tt)(g.value,"marker")),"onUpdate:value":v[7]||(v[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":v[8]||(v[8]=I=>u.value.isAdditionalSale=I),"true-value":!0,"false-value":!1},{default:i.withCtx(()=>[...v[9]||(v[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"])}}}),Lb={class:"flex flex-row gap-1"},Hb={class:"sc-client-name flex flex-col gap-1 text-base"},Wb=["href"],jb={key:1,class:"text-sc-grey"},qb={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Xb={key:0},Yb={key:1,class:"text-sm"},Ub={},br=i.defineComponent({...Ub,__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?je.format(n.client.lastLoginAt,j.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{M.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=qo,d=A.NButton,u=A.NPopover;return i.openBlock(),i.createElementBlock("div",Lb,[t.showClientInfoIcon?(i.openBlock(),i.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=h=>a.$emit("click:client-info",t.client))},{default:i.withCtx(()=>[i.createVNode(c)]),_:1})):i.createCommentVNode("",!0),i.createVNode(u,{disabled:i.unref(M.isNil)(t.popoverPosition),placement:t.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",Hb,[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",jb," [ Деактивирован ] "))],8,Wb),t.showCityAndRegion&&t.client.city?(i.openBlock(),i.createElementBlock("span",qb," г. "+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",Xb,i.toDisplayString(t.client.alternativeName),1)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("span",Yb," Последний вход: "+i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),Kb={class:"text-base"},Gb={},qd=i.defineComponent({...Gb,__name:"contragent-with-short-info",props:{contragent:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("span",Kb,i.toDisplayString(t.contragent.name),1))}}),Zb={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Qb(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 Jb=i.markRaw({name:"tabler-mail",render:Qb}),e_=["href"],t_={},n_=i.defineComponent({...t_,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(t){return(e,n)=>{const r=Jb;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,e_)],2)}}}),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:"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 Xd=i.markRaw({name:"fa6-brands-viber",render:r_}),o_={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},s_=["id"],a_=["id"],l_=["fill"],c_=["fill"];function d_(t,e){return i.openBlock(),i.createElementBlock("svg",o_,[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,s_),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,a_)]),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,l_),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,c_),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 Yd=i.markRaw({name:"logos-whatsapp-icon",render:d_,setup(){const t=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+t(),SVGHW6lecxh:"uicons-"+t()}}}}),u_={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},h_=["id"],f_=["fill"];function m_(t,e){return i.openBlock(),i.createElementBlock("svg",u_,[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,h_)]),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,f_),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 Ud=i.markRaw({name:"logos-telegram",render:m_,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),g_={viewBox:"0 0 512 512",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:"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 Kd=i.markRaw({name:"ion-call",render:p_}),y_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function b_(t,e){return i.openBlock(),i.createElementBlock("svg",y_,[...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 __=i.markRaw({name:"tabler-phone-call",render:b_}),w_={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},x_=["href"],k_=["href"],v_=["href"],C_=["href"],S_={},B_=i.defineComponent({...S_,__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 M.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),o=i.computed(()=>{var l;return M.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=i.computed(()=>{var l;return M.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=__,u=Kd,h=Ud,f=Yd,g=Xd;return i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",{class:i.normalizeClass({"border-xl relative inline-flex items-center rounded px-2":r.value&&a.value,"min-w-10":!0}),onClick:c[0]||(c[0]=m=>a.value=!a.value),onFocusout:c[1]||(c[1]=m=>a.value=!1),onMouseleave:c[2]||(c[2]=m=>a.value=!1)},[i.createElementVNode("div",{class:i.normalizeClass({"flex flex-row items-center gap-1":t.showPhoneIcon})},[t.showPhoneIcon?(i.openBlock(),i.createBlock(d,{key:0})):i.createCommentVNode("",!0),i.createTextVNode(" "+i.toDisplayString(o.value),1)],2),r.value&&a.value?(i.openBlock(),i.createElementBlock("div",w_,[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,x_)):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,k_)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${s.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(f)],8,v_)):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,C_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),T_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function N_(t,e){return i.openBlock(),i.createElementBlock("svg",T_,[...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 $_=i.markRaw({name:"mdi-envelope",render:N_}),R_={class:"flex flex-col gap-1"},E_={key:0,class:"mb-2 flex flex-col text-base"},P_={key:0,class:"text-sc-dark-grey text-sm"},F_={key:1,class:"whitespace-nowrap text-sm"},V_={key:2,class:"whitespace-nowrap text-sm"},M_={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},A_=["href"],I_=["href"],O_=["href"],z_=["href"],D_=["href"],L_={key:0,class:"flex flex-col text-base"},H_={key:0,class:"text-sc-dark-grey text-sm"},W_={key:1,class:"mt-2 text-sm"},j_={key:0,class:"-mt-1"},q_={},X_=i.defineComponent({...q_,__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 M.isString(n.value)?!1:((c=n.value)==null?void 0:c.isValid())??!1}),o=i.computed(()=>{var c;return M.isString(n.value)?n.value:((c=n.value)==null?void 0:c.format("INTERNATIONAL"))??""}),s=i.computed(()=>{var c;return M.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 b,y;const u=Kd,h=Ud,f=Yd,g=Xd,m=$_,p=A.NPopover;return i.openBlock(),i.createElementBlock("div",R_,[i.createVNode(p,{disabled:t.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var _,C,x,N;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]=$=>l.value=!0),onFocusin:d[1]||(d[1]=$=>l.value=!0),onMouseleave:d[2]||(d[2]=$=>l.value=!1),onFocusout:d[3]||(d[3]=$=>l.value=!1)},[i.createElementVNode("div",null,[t.fullView&&(t.contact.name||(C=t.contact)!=null&&C.position)?(i.openBlock(),i.createElementBlock("div",E_,[i.createTextVNode(i.toDisplayString(t.contact.name)+" ",1),(x=t.contact)!=null&&x.position?(i.openBlock(),i.createElementBlock("span",P_,i.toDisplayString((N=t.contact)==null?void 0:N.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),t.contact.phone?(i.openBlock(),i.createElementBlock("div",F_,i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("div",V_,i.toDisplayString(t.contact.email),1)):i.createCommentVNode("",!0),a.value&&l.value?(i.openBlock(),i.createElementBlock("div",M_,[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,A_)):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,I_)):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(f)],8,O_)):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,z_)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${t.contact.email}`,class:"hover:text-3xl"},[i.createVNode(m)],8,D_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var _,C,x,N;return[t.contact.name?(i.openBlock(),i.createElementBlock("div",L_,[i.createTextVNode(i.toDisplayString(t.contact.name)+" ",1),(_=t.contact)!=null&&_.position?(i.openBlock(),i.createElementBlock("span",H_,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",W_,[d[4]||(d[4]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((N=t.contact)==null?void 0:N.comment),1)])):i.createCommentVNode("",!0)]}),_:1},8,["disabled"]),t.fullView&&((b=t.contact)!=null&&b.comment)?(i.openBlock(),i.createElementBlock("div",j_,[d[5]||(d[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((y=t.contact)==null?void 0:y.comment),1)])):i.createCommentVNode("",!0)])}}});class Y_{constructor(e){T(this,"minHeight");T(this,"maxHeights");T(this,"minWidth");T(this,"maxWidths");T(this,"netType");T(this,"color");T(this,"mountType");T(this,"descriptions");T(this,"crossbarCount");T(this,"heightOverlaps");T(this,"widthOverlaps");T(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=Wo.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=Wo.objectToSnake(e.heightOverlaps),this.widthOverlaps=Wo.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function U_(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.SandwichM2?!0:t.properties.configuratorSettings!==void 0&&M.isArray(t.products)&&t.products.length>0}const K_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function G_(t,e){return i.openBlock(),i.createElementBlock("svg",K_,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M16 12a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2"},null,-1)])])}const Z_=i.markRaw({name:"mdi-dots-horizontal",render:G_}),Gd="date-range.dialog.mode",Zd=["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],Qd=(t,e,n)=>{let r=t??void 0,o=e??void 0;return r&&o&&r>o&&(n!=null&&n.from?o=r:n!=null&&n.to?r=o:[r,o]=[o,r]),{from:r?je.startOfDay(r):void 0,to:o?je.endOfDay(o):void 0}},Q_={class:"text-center font-semibold"},J_={class:"grid grid-cols-3 gap-1"},e1=["onPointerdown","onPointerenter","onKeydown"],t1={},n1=i.defineComponent({...t1,__name:"month-range-grid",props:{from:{},to:{}},emits:["select"],setup(t,{emit:e}){const n=t,r=e,o=A.useThemeVars(),s=i.computed(()=>({"--sc-primary-color":o.value.primaryColor,"--sc-primary-color-hover":o.value.primaryColorHover,"--sc-primary-color-suppl":o.value.primaryColorSuppl,"--sc-hover-color":o.value.hoverColor})),a=w=>{const v=new Date().getFullYear();return w&&je.isValid(w)?w.getFullYear():v},l=i.ref(a(n.from??n.to)),c=ot.initRefDependingOnDeviceResolution(1,3,3),d=i.computed(()=>c.value===1?[l.value]:[l.value-1,l.value,l.value+1]),u=i.ref(null),h=i.ref(null),f=i.ref(!1),g=i.ref(null),m=i.computed(()=>{const{from:w,to:v}=n;return!w||!v||!je.isSameDay(w,je.startOfMonth(w))||!je.isSameDay(v,je.endOfMonth(v))?null:[w.getFullYear()*12+w.getMonth(),v.getFullYear()*12+v.getMonth()]}),p=i.computed(()=>f.value&&h.value!==null&&g.value!==null?b(h.value,g.value):u.value!==null?g.value===null?[u.value,u.value]:b(u.value,g.value):m.value),b=(w,v)=>w<=v?[w,v]:[v,w],y=(w,v)=>{const k=w*12+v,B=p.value;return B&&k>=B[0]&&k<=B[1]?[k===B[0]||k===B[1]?"sc-month--bound":"sc-month--in-range"]:[]},_=(w,v)=>{const[k,B]=b(w,v);u.value=null,r("select",{from:new Date(Math.floor(k/12),k%12,1),to:je.endOfMonth(new Date(Math.floor(B/12),B%12,1))})},C=w=>{u.value===null?(u.value=w,r("select",{from:new Date(Math.floor(w/12),w%12,1),to:je.endOfMonth(new Date(Math.floor(w/12),w%12,1))})):_(u.value,w)},x=()=>{globalThis.removeEventListener("pointerup",x);const w=h.value;if(w!==null){if(h.value=null,f.value){f.value=!1,g.value!==null&&_(w,g.value);return}C(w)}},N=(w,v)=>{h.value=w*12+v,f.value=!1,globalThis.addEventListener("pointerup",x)},$=(w,v)=>{const k=w*12+v;g.value=k,h.value!==null&&k!==h.value&&(f.value=!0)};return i.watch(()=>[n.from,n.to],()=>{const w=n.from??n.to;if(!w||!je.isValid(w))return;const v=w.getFullYear();(v<l.value-1||v>l.value+1)&&(l.value=v)}),i.onBeforeUnmount(()=>{globalThis.removeEventListener("pointerup",x)}),(w,v)=>{const k=A.NButton;return i.openBlock(),i.createElementBlock("div",{class:"flex select-none items-start gap-2",style:i.normalizeStyle(s.value),onPointerleave:v[2]||(v[2]=B=>g.value=null)},[i.createVNode(k,{size:"small",quaternary:"",class:"mt-5",onClick:v[0]||(v[0]=B=>l.value-=1)},{default:i.withCtx(()=>[...v[3]||(v[3]=[i.createTextVNode(" ‹ ",-1)])]),_:1}),i.createElementVNode("div",{class:i.normalizeClass(["grid flex-1 gap-4 sm:gap-8",d.value.length===1?"grid-cols-1":"grid-cols-3"])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value,B=>(i.openBlock(),i.createElementBlock("div",{key:B,class:"flex flex-col gap-1"},[i.createElementVNode("div",Q_,i.toDisplayString(B),1),i.createElementVNode("div",J_,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(Zd),(R,E)=>(i.openBlock(),i.createElementBlock("button",{key:R,type:"button",class:i.normalizeClass(["sc-month cursor-pointer rounded border-0 px-1 py-1 text-sm",y(B,E)]),onPointerdown:i.withModifiers(P=>N(B,E),["prevent"]),onPointerenter:P=>$(B,E),onKeydown:[i.withKeys(i.withModifiers(P=>C(B*12+E),["prevent"]),["enter"]),i.withKeys(i.withModifiers(P=>C(B*12+E),["prevent"]),["space"])]},i.toDisplayString(R),43,e1))),128))])]))),128))],2),i.createVNode(k,{size:"small",quaternary:"",class:"mt-5",onClick:v[1]||(v[1]=B=>l.value+=1)},{default:i.withCtx(()=>[...v[4]||(v[4]=[i.createTextVNode(" › ",-1)])]),_:1})],36)}}}),i1=Nn(n1,[["__scopeId","data-v-7dd4941e"]]),r1={class:"sc-date-range-sidebar flex flex-col gap-1"},o1={class:"flex items-center justify-center gap-1"},s1={class:"min-w-12 text-center font-semibold"},a1={class:"grid grid-flow-col grid-cols-2 grid-rows-6 gap-1"},l1={},c1=i.defineComponent({...l1,__name:"month-year-sidebar",props:{year:{},month:{}},emits:["update:year","select-month","today"],setup(t,{emit:e}){const n=e;return(r,o)=>{const s=A.NButton;return i.openBlock(),i.createElementBlock("div",r1,[i.createElementVNode("div",o1,[i.createVNode(s,{size:"small",quaternary:"",onClick:o[0]||(o[0]=a=>n("update:year",t.year-1))},{default:i.withCtx(()=>[...o[3]||(o[3]=[i.createTextVNode(" ‹ ",-1)])]),_:1}),i.createElementVNode("span",s1,i.toDisplayString(t.year),1),i.createVNode(s,{size:"small",quaternary:"",onClick:o[1]||(o[1]=a=>n("update:year",t.year+1))},{default:i.withCtx(()=>[...o[4]||(o[4]=[i.createTextVNode(" › ",-1)])]),_:1})]),i.createElementVNode("div",a1,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(Zd),(a,l)=>(i.openBlock(),i.createBlock(s,{key:a,size:"small",quaternary:"",type:l===t.month?"primary":"default",onClick:c=>n("select-month",l)},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(a),1)]),_:2},1032,["type","onClick"]))),128))]),i.createVNode(s,{size:"small",text:"",type:"info",onClick:o[2]||(o[2]=a=>n("today"))},{default:i.withCtx(()=>[...o[5]||(o[5]=[i.createTextVNode(" Сегодня ",-1)])]),_:1})])}}}),d1={},Jd=i.defineComponent({...d1,__name:"date-range-input",props:{clearable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},placeholder:{default:void 0},value:{default:null},dateFormat:{default:()=>j.useBaseConfigStateStore().config.dateFormats.uiDate}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,o=ot.initRefDependingOnDeviceResolution(!0,!1,!1),s=i.ref(null),a=i.ref(!1),l=i.ref(0),c=i.ref(new Date),d=i.computed(()=>{const C=n.value&&je.isValid(n.value)?n.value:c.value;return C.getFullYear()===c.value.getFullYear()?C.getMonth():null});let u=0;const h=C=>{var x,N;(N=(x=C.target)==null?void 0:x.closest)!=null&&N.call(x,".n-base-clear")&&(u=performance.now())},f=C=>{C&&performance.now()-u<300||(a.value=C,C&&(c.value=n.value&&je.isValid(n.value)?n.value:new Date))},g=C=>{r("update:value",C===null?null:new Date(C))},m=(C,x)=>{const N=new Date(C,x,1);if(c.value=N,n.value&&je.isValid(n.value)){const $=Math.min(je.getDate(n.value),je.getDaysInMonth(N));r("update:value",new Date(C,x,$));return}l.value+=1,i.nextTick().then(()=>{var $;return($=s.value)==null?void 0:$.focus()})},p=(C,x)=>{c.value=je.addYears(je.addMonths(c.value,C),x)},b=C=>{m(C,c.value.getMonth())},y=C=>{m(c.value.getFullYear(),C)},_=()=>{a.value=!1,r("update:value",new Date)};return(C,x)=>{const N=A.NButton,$=A.NDatePicker;return i.openBlock(),i.createBlock($,{ref_key:"pickerReference",ref:s,key:l.value,value:n.value?n.value.getTime():null,show:a.value,clearable:t.clearable,disabled:t.disabled,placeholder:t.placeholder,format:t.dateFormat,actions:[],"default-calendar-start-time":c.value.getTime(),type:"date",class:"min-w-28",onMousedownCapture:h,"onUpdate:show":f,"onUpdate:value":g,onNextMonth:x[0]||(x[0]=w=>p(1,0)),onPrevMonth:x[1]||(x[1]=w=>p(-1,0)),onNextYear:x[2]||(x[2]=w=>p(0,1)),onPrevYear:x[3]||(x[3]=w=>p(0,-1))},{footer:i.withCtx(()=>[i.unref(o)?(i.openBlock(),i.createBlock(N,{key:1,size:"small",text:"",type:"info",onClick:_},{default:i.withCtx(()=>[...x[4]||(x[4]=[i.createTextVNode(" Сегодня ",-1)])]),_:1})):(i.openBlock(),i.createBlock(c1,{key:0,year:c.value.getFullYear(),month:d.value,"onUpdate:year":b,onSelectMonth:y,onToday:_},null,8,["year","month"]))]),_:1},8,["value","show","clearable","disabled","placeholder","format","default-calendar-start-time"])}}}),u1={class:"@container"},h1={class:"flex flex-col gap-1 @xs:flex-row @xs:items-center"},f1={},eu=i.defineComponent({...f1,__name:"date-range-fields",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},from:{default:null},to:{default:null},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:from","update:to"],setup(t,{emit:e}){const n=e;return(r,o)=>{var s,a;return i.openBlock(),i.createElementBlock("div",u1,[i.createElementVNode("div",h1,[i.createVNode(Jd,{value:t.from,clearable:t.clearable,disabled:(s=t.disabled)==null?void 0:s.from,placeholder:t.placeholderFrom,"date-format":t.dateFormat,class:"@xs:flex-1","onUpdate:value":o[0]||(o[0]=l=>n("update:from",l))},null,8,["value","clearable","disabled","placeholder","date-format"]),o[2]||(o[2]=i.createElementVNode("span",{class:"hidden text-gray-400 @xs:inline"},"–",-1)),i.createVNode(Jd,{value:t.to,clearable:t.clearable,disabled:(a=t.disabled)==null?void 0:a.to,placeholder:t.placeholderTo,"date-format":t.dateFormat,class:"@xs:flex-1","onUpdate:value":o[1]||(o[1]=l=>n("update:to",l))},null,8,["value","clearable","disabled","placeholder","date-format"])])])}}}),m1={class:"flex flex-col items-stretch gap-3 sm:flex-row"},g1={class:"order-2 flex-1 rounded-lg border border-solid border-gray-200 p-2 shadow-sm"},p1={class:"flex flex-col items-stretch pr-3"},y1={key:0,class:"px-2 pb-0.5 pt-2 text-xs text-gray-400"},b1={key:1,class:"order-2 w-44 shrink-0 rounded-lg border border-solid border-gray-200 p-1 shadow-sm"},_1={},w1=i.defineComponent({..._1,__name:"standard-periods",props:{activeKey:{},customPeriods:{}},emits:["apply","preview"],setup(t,{emit:e}){const n=t,r=e,o="custom",s=ot.initRefDependingOnDeviceResolution(!0,!1,!1),a=j.DateTimeProvider.standardPeriods(),l=i.ref(j.STANDARD_PERIOD_GROUPS[0].key),c=i.computed(()=>{const h=j.STANDARD_PERIOD_GROUPS.map(f=>({key:f.key,value:f.key,label:f.label}));return M.isEmpty(n.customPeriods)||h.push({key:o,value:o,label:"Пользовательские"}),h}),d=h=>Object.entries(h).map(([f,g])=>({value:f,label:g.label,item:g})),u=i.computed(()=>{if(l.value===o)return[{type:"group",key:o,children:d(n.customPeriods??{})}];const h=Object.entries(a).filter(([,g])=>g.group===l.value),f=Object.fromEntries(h);return l.value!=="other"?[{type:"group",key:l.value,children:d(f)}]:j.STANDARD_PERIOD_SECTIONS.map(g=>{const m=h.filter(([,p])=>p.section===g.key);return{type:"group",key:g.key,label:g.label,children:d(Object.fromEntries(m))}}).filter(g=>{var m;return(((m=g.children)==null?void 0:m.length)??0)>0})});return(h,f)=>{const g=A.NButton,m=A.NScrollbar,p=A.NSelect,b=A.NMenu;return i.openBlock(),i.createElementBlock("div",m1,[i.createElementVNode("div",g1,[i.createVNode(m,{class:"max-h-96"},{default:i.withCtx(()=>[i.createElementVNode("div",p1,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(u.value,y=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:y.key},[y.label?(i.openBlock(),i.createElementBlock("div",y1,i.toDisplayString(y.label),1)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(y.children,_=>(i.openBlock(),i.createBlock(g,{key:_.value,size:"small",quaternary:"",type:_.value===t.activeKey?"primary":"default",class:"justify-start",onClick:C=>r("apply",_),onMouseenter:C=>r("preview",_),onMouseleave:f[0]||(f[0]=C=>r("preview"))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(_.label),1)]),_:2},1032,["type","onClick","onMouseenter"]))),128))],64))),128))])]),_:1})]),i.unref(s)?(i.openBlock(),i.createBlock(p,{key:0,value:l.value,options:c.value,class:"order-1","onUpdate:value":f[1]||(f[1]=y=>l.value=y)},null,8,["value","options"])):(i.openBlock(),i.createElementBlock("div",b1,[i.createVNode(b,{value:l.value,options:c.value,mode:"vertical","onUpdate:value":f[2]||(f[2]=y=>l.value=y)},null,8,["value","options"])]))])}}}),x1={class:"flex flex-col gap-3"},k1={class:"flex flex-col gap-1 sm:flex-row sm:items-center"},v1={key:0,class:"overflow-x-auto rounded-lg border border-solid border-gray-200 p-2 shadow-sm sm:p-3"},C1={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},S1={class:"flex gap-2"},B1={},T1=i.defineComponent({...B1,__name:"date-range-dialog",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},show:{type:Boolean},dateRange:{default:void 0},customPeriods:{default:void 0},dateFormat:{default:void 0}},emits:["update:show","select"],setup(t,{emit:e}){const n=t,r=e,o=ot.initRefDependingOnDeviceResolution("100%","90%","44rem"),s=i.ref("custom"),a=()=>j.PreferencesStorageProvider.getActualDataFromStorage(Gd)==="standard"?"standard":"custom",l=i.ref({}),c=i.ref(null),d=i.ref(null),u=i.computed(()=>c.value??l.value),h=(x,N)=>{var v,k;const $=(v=n.disabled)!=null&&v.from?l.value.from:x,w=(k=n.disabled)!=null&&k.to?l.value.to:N;c.value=null,l.value=Qd($,w,n.disabled)},f=x=>{d.value=null,h(x,l.value.to)},g=x=>{d.value=null,h(l.value.from,x)},m=()=>{d.value=null,h(null,null)},p=x=>{d.value=null,h(x.from,x.to)},b=x=>{const N=x.item;h(N.from,N.to),d.value=String(x.value)},y=x=>{const N=x==null?void 0:x.item;c.value=N?{from:N.from,to:N.to}:null},_=()=>{c.value=null,s.value=s.value==="custom"?"standard":"custom";const x=Gd;j.PreferencesStorageProvider.saveActualDataToStorage(x,s.value,je.addYears(je.startOfToday(),1))},C=()=>{r("select",l.value),r("update:show",!1)};return i.watch(()=>n.show,x=>{x&&(s.value=a(),d.value=null,c.value=null,l.value={...n.dateRange})}),(x,N)=>{const $=A.NButton,w=A.NModal;return i.openBlock(),i.createBlock(w,{show:t.show,preset:"card",title:"Выберите период",closable:"",style:i.normalizeStyle({width:i.unref(o),maxWidth:"calc(100vw - 1rem)"}),class:"sc-date-range-dialog","onUpdate:show":N[1]||(N[1]=v=>r("update:show",v))},{footer:i.withCtx(()=>[i.createElementVNode("div",C1,[i.createVNode($,{text:"",type:"info",onClick:_},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(s.value==="custom"?"Показать стандартные периоды":"Показать произвольный период"),1)]),_:1}),i.createElementVNode("div",S1,[i.createVNode($,{type:"primary",onClick:C},{default:i.withCtx(()=>[...N[3]||(N[3]=[i.createTextVNode(" Выбрать ",-1)])]),_:1}),i.createVNode($,{onClick:N[0]||(N[0]=v=>r("update:show",!1))},{default:i.withCtx(()=>[...N[4]||(N[4]=[i.createTextVNode("Отмена",-1)])]),_:1})])])]),default:i.withCtx(()=>[i.createElementVNode("div",x1,[i.createElementVNode("div",k1,[i.createVNode(eu,{from:u.value.from,to:u.value.to,clearable:t.clearable,disabled:t.disabled,"date-format":t.dateFormat,class:"flex-1","onUpdate:from":f,"onUpdate:to":g},null,8,["from","to","clearable","disabled","date-format"]),t.clearable?(i.openBlock(),i.createBlock($,{key:0,text:"",type:"info",class:"sm:ml-2",onClick:m},{default:i.withCtx(()=>[...N[2]||(N[2]=[i.createTextVNode(" Очистить период ",-1)])]),_:1})):i.createCommentVNode("",!0)]),s.value==="custom"?(i.openBlock(),i.createElementBlock("div",v1,[i.createVNode(i1,{from:l.value.from,to:l.value.to,onSelect:p},null,8,["from","to"])])):(i.openBlock(),i.createBlock(w1,{key:1,"active-key":d.value,"custom-periods":t.customPeriods,onApply:b,onPreview:y},null,8,["active-key","custom-periods"]))])]),_:1},8,["show","style"])}}}),N1={class:"flex w-full min-w-28 items-center gap-1"},$1={},R1=i.defineComponent({...$1,__name:"date-range",props:{clearable:{type:Boolean,default:!0},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},dateRange:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1},placeholderFrom:{default:"Дата начала"},placeholderTo:{default:"Дата окончания"},dateFormat:{default:void 0}},emits:["update:date-range"],setup(t,{emit:e}){const n=t,r=e,o=i.ref(!1),s=i.computed(()=>{const u={...n.useDefaultPredefinedDateRanges?j.DateTimeProvider.defaultDateRanges():{},...n.predefinedDateRanges};return M.isEmpty(u)?void 0:u}),a=(u,h)=>{r("update:date-range",Qd(u,h,n.disabled))},l=u=>{var h;a(u,(h=n.dateRange)==null?void 0:h.to)},c=u=>{var h;a((h=n.dateRange)==null?void 0:h.from,u)},d=u=>{a(u.from,u.to)};return(u,h)=>{var m,p,b,y;const f=Z_,g=A.NButton;return i.openBlock(),i.createElementBlock("div",N1,[i.createVNode(eu,{from:(m=t.dateRange)==null?void 0:m.from,to:(p=t.dateRange)==null?void 0:p.to,clearable:t.clearable,disabled:t.disabled,"placeholder-from":t.placeholderFrom,"placeholder-to":t.placeholderTo,"date-format":t.dateFormat,class:"flex-1","onUpdate:from":l,"onUpdate:to":c},null,8,["from","to","clearable","disabled","placeholder-from","placeholder-to","date-format"]),i.createVNode(g,{disabled:!!((b=t.disabled)!=null&&b.from&&((y=t.disabled)!=null&&y.to)),title:"Выбрать период","aria-label":"Выбрать период",onClick:h[0]||(h[0]=_=>o.value=!0)},{default:i.withCtx(()=>[i.createVNode(f)]),_:1},8,["disabled"]),i.createVNode(T1,{show:o.value,"onUpdate:show":h[1]||(h[1]=_=>o.value=_),"date-range":t.dateRange,clearable:t.clearable,disabled:t.disabled,"custom-periods":s.value,"date-format":t.dateFormat,onSelect:d},null,8,["show","date-range","clearable","disabled","custom-periods","date-format"])])}}}),E1={class:"sc-lbl-date text-nowrap"},P1={},yo=i.defineComponent({...P1,__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(()=>je.format(e.date,j.useBaseConfigStateStore().config.dateFormats.uiDate)),r=i.computed(()=>je.format(e.date,"HH:mm"));return(o,s)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-col":t.isTimeOnSecondLine})},[i.createElementVNode("span",E1,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))}}),F1={class:"flex flex-row gap-2.5"},V1={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},M1={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},A1={class:"mb-0.5 sm:mb-0 sm:ml-3"},I1={},O1=i.defineComponent({...I1,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(t){return(e,n)=>{const r=po,o=A.NButton,s=A.NPopover;return i.openBlock(),i.createElementBlock("div",F1,[i.createElementVNode("div",V1,[i.renderSlot(e.$slots,"main")]),i.createElementVNode("div",null,[i.createElementVNode("div",M1,[i.renderSlot(e.$slots,"extra-buttons"),i.createElementVNode("div",A1,[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)])])])])}}}),z1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function D1(t,e){return i.openBlock(),i.createElementBlock("svg",z1,[...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 L1=i.markRaw({name:"ion-download-outline",render:D1}),H1={},W1=i.defineComponent({...H1,__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=L1;return i.openBlock(),i.createBlock(i.unref(A.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(A.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"])}}}),j1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function q1(t,e){return i.openBlock(),i.createElementBlock("svg",j1,[...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 X1=i.markRaw({name:"ion-checkmark-done-sharp",render:q1}),Y1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function U1(t,e){return i.openBlock(),i.createElementBlock("svg",Y1,[...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 K1=i.markRaw({name:"ion-options-outline",render:U1}),G1={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},Z1={class:"flex-auto"},Q1={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"},J1={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"},ew={},Ws=i.defineComponent({...ew,__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=K1,h=A.NButton,f=A.NPopover,g=X1,m=po;return i.openBlock(),i.createElementBlock("div",G1,[i.createElementVNode("div",Z1,[i.renderSlot(c.$slots,"default")]),i.createElementVNode("div",null,[i.createElementVNode("div",Q1,[i.createElementVNode("div",J1,[t.showEditButton?(i.openBlock(),i.createBlock(f,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(h,{disabled:t.disabled||r.value,type:"info",ghost:"",size:"small",onClick:o},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[0]||(d[0]=i.createTextVNode(" Редактировать данные ",-1))]),_:1})):i.createCommentVNode("",!0),t.showApplyButton?(i.openBlock(),i.createBlock(f,{key:1,disabled:r.value,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(h,{disabled:t.disabled||r.value,type:"primary",size:"small",onClick:a},{default:i.withCtx(()=>[i.createVNode(g)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[1]||(d[1]=i.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),t.showCancelButton?(i.openBlock(),i.createBlock(f,{key:2,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(h,{disabled:t.disabled||r.value,type:"error",size:"small",onClick:l},{default:i.withCtx(()=>[i.createVNode(m)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[2]||(d[2]=i.createTextVNode(" Отменить изменения ",-1))]),_:1})):i.createCommentVNode("",!0)]),i.renderSlot(c.$slots,"extra-buttons")])])])}}}),tw={},tu=i.defineComponent({...tw,__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(Ws,{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(Ws,{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"]))]))}}),nw={},iw=i.defineComponent({...nw,__name:"debounced-input",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:800},placeholder:{default:""}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,o=i.ref(n.value),s=i.computed(()=>i.inject("debounce-input-time",n.debounceTime)),a=M.debounce(()=>r("update:value",o.value),s.value),l=c=>{o.value=c,a()};return i.watch(()=>n.value,c=>{o.value=c}),(c,d)=>(i.openBlock(),i.createBlock(i.unref(A.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"]))}}),rw={},ow=i.defineComponent({...rw,__name:"debounced-input-number",props:{value:{default:void 0},clearable:{type:Boolean,default:!1},debounceTime:{default:500},placeholder:{default:""},min:{default:void 0},max:{default:void 0},step:{default:1},validator:{type:Function,default:void 0},parse:{type:Function,default:void 0},showButton:{type:Boolean,default:!0}},emits:["update:value","keydown","input","focus"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.ref(r.value),a=i.computed(()=>i.inject("debounce-input-time",r.debounceTime)),l=M.debounce(()=>o("update:value",s.value),a.value),c=g=>{s.value=g,l()};i.watch(()=>r.value,g=>{s.value=g});const d=i.ref(null);return e({focus:()=>{var g;return(g=d.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=d.value)==null?void 0:g.blur()},select:()=>{var g;return(g=d.value)==null?void 0:g.select()}}),(g,m)=>(i.openBlock(),i.createBlock(i.unref(A.NInputNumber),{ref_key:"inputReference",ref:d,value:s.value??null,clearable:t.clearable,parse:t.parse,"show-button":t.showButton,placeholder:t.placeholder,min:t.min,max:t.max,step:t.step,validator:t.validator,"onUpdate:value":c,onKeydown:m[0]||(m[0]=p=>o("keydown",p)),onInput:m[1]||(m[1]=p=>o("input",p)),onFocus:m[2]||(m[2]=p=>o("focus",p))},{prefix:i.withCtx(()=>[i.renderSlot(g.$slots,"prefix")]),_:3},8,["value","clearable","parse","show-button","placeholder","min","max","step","validator"]))}}),sw={},aw=i.defineComponent({...sw,__name:"phone-input",props:{value:{},debounceTime:{},disabled:{type:Boolean},placeholder:{},defaultCountry:{},preferredCountries:{},onlyCountries:{}},emits:["update:value"],setup(t,{emit:e}){const n=t,r=e,o=i.ref((n.value??"").replaceAll(/\D*/g,"")),s=M.debounce(c=>r("update:value",c),n.debounceTime??0),a=c=>{let d="";if(M.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(M.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof 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(af.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"]))}}),lw=Nn(aw,[["__scopeId","data-v-751dbb0e"]]),cw={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function dw(t,e){return i.openBlock(),i.createElementBlock("svg",cw,[...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 uw=i.markRaw({name:"tabler-external-link",render:dw}),hw={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},fw=["href"],mw={},gw=i.defineComponent({...mw,__name:"external-link",props:{text:{},url:{},description:{}},setup(t){return(e,n)=>{const r=uw,o=A.NTooltip;return i.openBlock(),i.createBlock(o,{disabled:i.unref(M.isUndefined)(t.description),placement:"top-start"},{trigger:i.withCtx(()=>[i.createElementVNode("span",hw,[i.createElementVNode("a",{href:t.url,target:"_blank",class:"no-underline"},i.toDisplayString(t.text),9,fw),i.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.description),1)]),_:1},8,["disabled"])}}}),pw={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function yw(t,e){return i.openBlock(),i.createElementBlock("svg",pw,[...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 bw=i.markRaw({name:"ion-remove-circle-outline",render:yw});let bo=[];const nu=new WeakMap;function _w(){bo.forEach(t=>t(...nu.get(t))),bo=[]}function iu(t,...e){nu.set(t,e),!bo.includes(t)&&bo.push(t)===1&&requestAnimationFrame(_w)}function _r(t,e){let{target:n}=t;for(;n;){if(n.dataset&&n.dataset[e]!==void 0)return!0;n=n.parentElement}return!1}function wr(t){return t.composedPath()[0]||null}function xr(t){return typeof t=="string"?t.endsWith("px")?Number(t.slice(0,t.length-2)):Number(t):t}function kr(t){if(t!=null)return typeof t=="number"?`${t}px`:t.endsWith("px")?t:`${t}px`}function rn(t,e){const n=t.trim().split(/\s+/g),r={top:n[0]};switch(n.length){case 1:r.right=n[0],r.bottom=n[0],r.left=n[0];break;case 2:r.right=n[1],r.left=n[1],r.bottom=n[0];break;case 3:r.right=n[1],r.bottom=n[2],r.left=n[1];break;case 4:r.right=n[1],r.bottom=n[2],r.left=n[3];break;default:throw new Error("[seemly/getMargin]:"+t+" is not a valid value.")}return e===void 0?r:r[e]}const ru={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 ww(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 xw(t,e,n){e/=100,n/=100;let r=e*Math.min(n,1-n),o=(s,a=(s+t/30)%12)=>n-r*Math.max(Math.min(a-3,9-a,1),-1);return[o(0)*255,o(8)*255,o(4)*255]}const wn="^\\s*",xn="\\s*$",Gn="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Wt="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",mi="([0-9A-Fa-f])",gi="([0-9A-Fa-f]{2})",ou=new RegExp(`${wn}hsl\\s*\\(${Wt},${Gn},${Gn}\\)${xn}`),su=new RegExp(`${wn}hsv\\s*\\(${Wt},${Gn},${Gn}\\)${xn}`),au=new RegExp(`${wn}hsla\\s*\\(${Wt},${Gn},${Gn},${Wt}\\)${xn}`),lu=new RegExp(`${wn}hsva\\s*\\(${Wt},${Gn},${Gn},${Wt}\\)${xn}`),kw=new RegExp(`${wn}rgb\\s*\\(${Wt},${Wt},${Wt}\\)${xn}`),vw=new RegExp(`${wn}rgba\\s*\\(${Wt},${Wt},${Wt},${Wt}\\)${xn}`),Cw=new RegExp(`${wn}#${mi}${mi}${mi}${xn}`),Sw=new RegExp(`${wn}#${gi}${gi}${gi}${xn}`),Bw=new RegExp(`${wn}#${mi}${mi}${mi}${mi}${xn}`),Tw=new RegExp(`${wn}#${gi}${gi}${gi}${gi}${xn}`);function Ot(t){return parseInt(t,16)}function Nw(t){try{let e;if(e=au.exec(t))return[wo(e[1]),Zn(e[5]),Zn(e[9]),yi(e[13])];if(e=ou.exec(t))return[wo(e[1]),Zn(e[5]),Zn(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${t}.`)}catch(e){throw e}}function $w(t){try{let e;if(e=lu.exec(t))return[wo(e[1]),Zn(e[5]),Zn(e[9]),yi(e[13])];if(e=su.exec(t))return[wo(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=Sw.exec(t))return[Ot(e[1]),Ot(e[2]),Ot(e[3]),1];if(e=kw.exec(t))return[wt(e[1]),wt(e[5]),wt(e[9]),1];if(e=vw.exec(t))return[wt(e[1]),wt(e[5]),wt(e[9]),yi(e[13])];if(e=Cw.exec(t))return[Ot(e[1]+e[1]),Ot(e[2]+e[2]),Ot(e[3]+e[3]),1];if(e=Tw.exec(t))return[Ot(e[1]),Ot(e[2]),Ot(e[3]),yi(Ot(e[4])/255)];if(e=Bw.exec(t))return[Ot(e[1]+e[1]),Ot(e[2]+e[2]),Ot(e[3]+e[3]),yi(Ot(e[4]+e[4])/255)];if(t in ru)return pi(ru[t]);if(ou.test(t)||au.test(t)){const[n,r,o,s]=Nw(t);return[...xw(n,r,o),s]}else if(su.test(t)||lu.test(t)){const[n,r,o,s]=$w(t);return[...ww(n,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${t}.`)}catch(e){throw e}}function Rw(t){return t>1?1:t<0?0:t}function js(t,e,n,r){return`rgba(${wt(t)}, ${wt(e)}, ${wt(n)}, ${Rw(r)})`}function qs(t,e,n,r,o){return wt((t*e*(1-r)+n*r)/o)}function Ew(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 js(qs(t[0],n,e[0],r,o),qs(t[1],n,e[1],r,o),qs(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"?js(n,r,o,e.alpha):js(n,r,o,s)}function _o(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:pi(t),{lightness:a=1,alpha:l=1}=e;return Pw([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 wo(t){const e=Math.round(Number(t));return e>=360||e<0?0:e}function wt(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 Pw(t){const[e,n,r]=t;return 3 in t?`rgba(${wt(e)}, ${wt(n)}, ${wt(r)}, ${yi(t[3])})`:`rgba(${wt(e)}, ${wt(n)}, ${wt(r)}, 1)`}function Fw(t=8){return Math.random().toString(16).slice(2,2+t)}function cu(t){return Array.isArray(t)?t:[t]}const Xs={STOP:"STOP"};function du(t,e){const n=e(t);t.children!==void 0&&n!==Xs.STOP&&t.children.forEach(r=>du(r,e))}function Vw(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 Mw(t,e){const{isLeaf:n}=t;return n!==void 0?n:!e(t)}function Aw(t){return t.children}function Iw(t){return t.key}function Ow(){return!1}function zw(t,e){const{isLeaf:n}=t;return!(n===!1&&!Array.isArray(e(t)))}function Dw(t){return t.disabled===!0}function Lw(t,e){return t.isLeaf===!1&&!Array.isArray(e(t))}function Hw(t,e){if(t.isLeaf===!0){const n=e(t);if(Array.isArray(n)&&n.length>0)return!0}return!1}function Ys(t){var e;return t==null?[]:Array.isArray(t)?t:(e=t.checkedKeys)!==null&&e!==void 0?e:[]}function Us(t){var e;return t==null||Array.isArray(t)?[]:(e=t.indeterminateKeys)!==null&&e!==void 0?e:[]}function Ww(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)||n.add(r)}),Array.from(n)}function jw(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)&&n.delete(r)}),Array.from(n)}function qw(t){return(t==null?void 0:t.type)==="group"}function Xw(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 Yw extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function Uw(t,e,n,r){return xo(e.concat(t),n,r,!1)}function Kw(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 Gw(t,e,n,r){const o=xo(e,n,r,!1),s=xo(t,n,r,!0),a=Kw(t,n),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function Ks(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:Ww(n,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:jw(n,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(n),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let h;o!==void 0?h=Gw(o,n,e,d):r!==void 0?h=Uw(r,n,e,d):h=xo(n,e,d,!1);const f=c==="parent",g=c==="child"||l,m=h,p=new Set,b=Math.max.apply(null,Array.from(u.keys()));for(let y=b;y>=0;y-=1){const _=y===0,C=u.get(y);for(const x of C){if(x.isLeaf)continue;const{key:N,shallowLoaded:$}=x;if(g&&$&&x.children.forEach(B=>{!B.disabled&&!B.isLeaf&&B.shallowLoaded&&m.has(B.key)&&m.delete(B.key)}),x.disabled||!$)continue;let w=!0,v=!1,k=!0;for(const B of x.children){const R=B.key;if(!B.disabled){if(k&&(k=!1),m.has(R))v=!0;else if(p.has(R)){v=!0,w=!1;break}else if(w=!1,v)break}}w&&!k?(f&&x.children.forEach(B=>{!B.disabled&&m.has(B.key)&&m.delete(B.key)}),m.add(N)):v&&p.add(N),_&&g&&m.has(N)&&m.delete(N)}}return{checkedKeys:Array.from(m),indeterminateKeys:Array.from(p)}}function xo(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&&du(d,u=>{if(u.disabled)return Xs.STOP;const{key:h}=u;if(!a.has(h)&&(a.add(h),l.add(h),Lw(u.rawNode,s))){if(r)return Xs.STOP;if(!n)throw new Yw}})}),l}function Zw(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 Qw(t){if(t.length===0)return null;const e=t[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function Jw(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 uu(t,e,{loop:n=!1,includeDisabled:r=!1}={}){const o=e==="prev"?ex:Jw,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=Gs(d,s);u!==null?l=u:c(o(d,n))}else{const u=o(d,!1);if(u!==null)c(u);else{const h=tx(d);h!=null&&h.isGroup?c(o(h,n)):n&&c(o(d,!0))}}}}return c(t),l}function ex(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 tx(t){return t.parent}function Gs(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=Gs(d,e);if(u!==null)return u}else return d}}return null}const nx={getChild(){return this.ignored?null:Gs(this)},getParent(){const{parent:t}=this;return t!=null&&t.isGroup?t.getParent():t},getNext(t={}){return uu(this,"next",t)},getPrev(t={}){return uu(this,"prev",t)}};function ix(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 rx(t,e){const n=t.key;for(;e;){if(e.key===n)return!0;e=e.parent}return!1}var ox={};function hu(t,e,n,r,o,s=null,a=0){const l=[];return t.forEach((c,d)=>{var u;ox.NODE_ENV!=="production"&&Hw(c,o)&&console.error("[treemate]: node",c,"is invalid");const h=Object.create(r);if(h.rawNode=c,h.siblings=l,h.level=a,h.index=d,h.isFirstChild=d===0,h.isLastChild=d+1===t.length,h.parent=s,!h.ignored){const f=o(c);Array.isArray(f)&&(h.children=hu(f,e,n,r,o,h,a+1))}l.push(h),e.set(h.key,h),n.has(a)||n.set(a,[]),(u=n.get(a))===null||u===void 0||u.push(h)}),l}function sx(t,e={}){var n;const r=new Map,o=new Map,{getDisabled:s=Dw,getIgnored:a=Ow,getIsGroup:l=qw,getKey:c=Iw}=e,d=(n=e.getChildren)!==null&&n!==void 0?n:Aw,u=e.ignoreEmptyChildren?x=>{const N=d(x);return Array.isArray(N)?N.length?N:null:N}: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 Mw(this.rawNode,u)},get shallowLoaded(){return zw(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(x){return rx(this,x)}},nx),f=hu(t,r,o,h,u);function g(x){if(x==null)return null;const N=r.get(x);return N&&!N.isGroup&&!N.ignored?N:null}function m(x){if(x==null)return null;const N=r.get(x);return N&&!N.ignored?N:null}function p(x,N){const $=m(x);return $?$.getPrev(N):null}function b(x,N){const $=m(x);return $?$.getNext(N):null}function y(x){const N=m(x);return N?N.getParent():null}function _(x){const N=m(x);return N?N.getChild():null}const C={treeNodes:f,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(x){return ix(f,x)},getNode:g,getPrev:p,getNext:b,getParent:y,getChild:_,getFirstAvailableNode(){return Qw(f)},getPath(x,N={}){return Zw(x,N,C)},getCheckedKeys(x,N={}){const{cascade:$=!0,leafOnly:w=!1,checkStrategy:v="all",allowNotLoaded:k=!1}=N;return Ks({checkedKeys:Ys(x),indeterminateKeys:Us(x),cascade:$,leafOnly:w,checkStrategy:v,allowNotLoaded:k},C)},check(x,N,$={}){const{cascade:w=!0,leafOnly:v=!1,checkStrategy:k="all",allowNotLoaded:B=!1}=$;return Ks({checkedKeys:Ys(N),indeterminateKeys:Us(N),keysToCheck:x==null?[]:cu(x),cascade:w,leafOnly:v,checkStrategy:k,allowNotLoaded:B},C)},uncheck(x,N,$={}){const{cascade:w=!0,leafOnly:v=!1,checkStrategy:k="all",allowNotLoaded:B=!1}=$;return Ks({checkedKeys:Ys(N),indeterminateKeys:Us(N),keysToUncheck:x==null?[]:cu(x),cascade:w,leafOnly:v,checkStrategy:k,allowNotLoaded:B},C)},getNonLeafKeys(x={}){return Vw(f,x)}};return C}function ko(t){return t.composedPath()[0]}const ax={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function lx(t,e,n){if(t==="mousemoveoutside"){const r=o=>{e.contains(ko(o))||n(o)};return{mousemove:r,touchstart:r}}else if(t==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(ko(a))},s=a=>{r&&(e.contains(ko(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 fu(t,e,n){const r=ax[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=lx(t,e,n)),s}function cx(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=fu(t,e,n);return Object.keys(o).forEach(s=>{Pt(s,document,o[s],r)}),!0}return!1}function dx(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=fu(t,e,n);return Object.keys(o).forEach(s=>{ct(s,document,o[s],r)}),!0}return!1}function ux(){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,v,k){const B=w[v];return w[v]=function(){return k.apply(w,arguments),B.apply(w,arguments)},w}function s(w,v){w[v]=Event.prototype[v]}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,v){l!==void 0&&Object.defineProperty(w,"currentTarget",{configurable:!0,enumerable:!0,get:v??l.get})}const u={bubble:{},capture:{}},h={};function f(){const w=function(v){const{type:k,eventPhase:B,bubbles:R}=v,E=ko(v);if(B===2)return;const P=B===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(v,"stopPropagation",n),o(v,"stopImmediatePropagation",r),d(v,c),P==="capture"){if(Z===void 0)return;for(let D=I.length-1;D>=0&&!t.has(v);--D){const L=I[D],H=Z.get(L);if(H!==void 0){a.set(v,L);for(const z of H){if(e.has(v))break;z(v)}}if(D===0&&!R&&te!==void 0){const z=te.get(L);if(z!==void 0)for(const O of z){if(e.has(v))break;O(v)}}}}else if(P==="bubble"){if(te===void 0)return;for(let D=0;D<I.length&&!t.has(v);++D){const L=I[D],H=te.get(L);if(H!==void 0){a.set(v,L);for(const z of H){if(e.has(v))break;z(v)}}}}s(v,"stopPropagation"),s(v,"stopImmediatePropagation"),d(v)};return w.displayName="evtdUnifiedHandler",w}function g(){const w=function(v){const{type:k,eventPhase:B}=v;if(B!==2)return;const R=h[k];R!==void 0&&R.forEach(E=>E(v))};return w.displayName="evtdUnifiedWindowEventHandler",w}const m=f(),p=g();function b(w,v){const k=u[w];return k[v]===void 0&&(k[v]=new Map,window.addEventListener(v,m,w==="capture")),k[v]}function y(w){return h[w]===void 0&&(h[w]=new Set,window.addEventListener(w,p)),h[w]}function _(w,v){let k=w.get(v);return k===void 0&&w.set(v,k=new Set),k}function C(w,v,k,B){const R=u[v][k];if(R!==void 0){const E=R.get(w);if(E!==void 0&&E.has(B))return!0}return!1}function x(w,v){const k=h[w];return!!(k!==void 0&&k.has(v))}function N(w,v,k,B){let R;if(typeof B=="object"&&B.once===!0?R=Z=>{$(w,v,R,B),k(Z)}:R=k,cx(w,v,R,B))return;const P=B===!0||typeof B=="object"&&B.capture===!0?"capture":"bubble",W=b(P,w),I=_(W,v);if(I.has(R)||I.add(R),v===window){const Z=y(w);Z.has(R)||Z.add(R)}}function $(w,v,k,B){if(dx(w,v,k,B))return;const E=B===!0||typeof B=="object"&&B.capture===!0,P=E?"capture":"bubble",W=b(P,w),I=_(W,v);if(v===window&&!C(v,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(v),W.size===0&&(window.removeEventListener(w,m,P==="capture"),u[P][w]=void 0)}return{on:N,off:$}}const{on:Pt,off:ct}=ux(),Ki="@@mmoContext",hx={mounted(t,{value:e}){t[Ki]={handler:void 0},typeof e=="function"&&(t[Ki].handler=e,Pt("mousemoveoutside",t,e))},updated(t,{value:e}){const n=t[Ki];typeof e=="function"?n.handler?n.handler!==e&&(ct("mousemoveoutside",t,n.handler),n.handler=e,Pt("mousemoveoutside",t,e)):(t[Ki].handler=e,Pt("mousemoveoutside",t,e)):n.handler&&(ct("mousemoveoutside",t,n.handler),n.handler=void 0)},unmounted(t){const{handler:e}=t[Ki];e&&ct("mousemoveoutside",t,e),t[Ki].handler=void 0}},Gi="@@coContext",vo={mounted(t,{value:e,modifiers:n}){t[Gi]={handler:void 0},typeof e=="function"&&(t[Gi].handler=e,Pt("clickoutside",t,e,{capture:n.capture}))},updated(t,{value:e,modifiers:n}){const r=t[Gi];typeof e=="function"?r.handler?r.handler!==e&&(ct("clickoutside",t,r.handler,{capture:n.capture}),r.handler=e,Pt("clickoutside",t,e,{capture:n.capture})):(t[Gi].handler=e,Pt("clickoutside",t,e,{capture:n.capture})):r.handler&&(ct("clickoutside",t,r.handler,{capture:n.capture}),r.handler=void 0)},unmounted(t,{modifiers:e}){const{handler:n}=t[Gi];n&&ct("clickoutside",t,n,{capture:e.capture}),t[Gi].handler=void 0}};function fx(t,e){console.error(`[vdirs/${t}]: ${e}`)}class mx{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&&fx("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 Zs=new mx,Zi="@@ziContext",mu={mounted(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n;t[Zi]={enabled:!!o,initialized:!1},o&&(Zs.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&&(Zs.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;Zs.unregister(t,r)}};function gx(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 Qt(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 px=typeof window<"u";let Qi,vr;(()=>{var t,e;Qi=px?(e=(t=document)===null||t===void 0?void 0:t.fonts)===null||e===void 0?void 0:e.ready:void 0,vr=!1,Qi!==void 0?Qi.then(()=>{vr=!0}):vr=!0})();function yx(t){if(vr)return;let e=!1;i.onMounted(()=>{vr||Qi==null||Qi.then(()=>{e||t()})}),i.onBeforeUnmount(()=>{e=!0})}function Qs(t,e){return i.watch(t,n=>{n!==void 0&&(e.value=n)}),i.computed(()=>t.value===void 0?e.value:t.value)}function Co(){const t=i.ref(!1);return i.onMounted(()=>{t.value=!0}),i.readonly(t)}function gu(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 bx=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function _x(){return bx}function Js(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);return r()}function ea(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)){ea(r,e,n);return}if(r.type===i.Fragment){if(r.children===null)return;Array.isArray(r.children)&&ea(r.children,e,n)}else r.type!==i.Comment&&n.push(r)}}),n}function pu(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);const o=ea(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${t}]: slot[${n}] should have exactly one child.`)}let Qn=null;function yu(){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 wx(t,e){const n=yu();return{top:e,left:t,height:0,width:0,right:n.width-t,bottom:n.height-e}}function ta(t){const e=t.getBoundingClientRect(),n=yu();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 xx(t){return t.nodeType===9?null:t.parentNode}function bu(t){if(t===null)return null;const e=xx(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 bu(e)}const _u=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=y=>{r.value=y,n&&t.syncTargetWithParent&&n.setTargetRef(y)};let s=[];const a=()=>{let y=r.value;for(;y=bu(y),y!==null;)s.push(y);for(const _ of s)Pt("scroll",_,h,!0)},l=()=>{for(const y of s)ct("scroll",y,h,!0);s=[]},c=new Set,d=y=>{c.size===0&&a(),c.has(y)||c.add(y)},u=y=>{c.has(y)&&c.delete(y),c.size===0&&l()},h=()=>{iu(f)},f=()=>{c.forEach(y=>y())},g=new Set,m=y=>{g.size===0&&Pt("resize",window,b),g.has(y)||g.add(y)},p=y=>{g.has(y)&&g.delete(y),g.size===0&&ct("resize",window,b)},b=()=>{g.forEach(y=>y())};return i.onBeforeUnmount(()=>{ct("resize",window,b),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:m,removeResizeListener:p}},render(){return Js("binder",this.$slots)}}),wu=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(pu("follower",this.$slots),[[e]]):pu("follower",this.$slots)}}),kx="@css-render/vue3-ssr";function vx(t,e){return`<style cssr-id="${t}">
104
104
  ${e}
105
105
  </style>`}function Cx(t,e,n){const{styles:r,ids:o}=n;o.has(t)||r!==null&&(o.add(t),r.push(vx(t,e)))}const Sx=typeof document<"u";function bi(){if(Sx)return;const t=i.inject(kx,null);if(t!==null)return{adapter:(e,n)=>Cx(e,n,t),context:t}}function xu(t,e){console.error(`[vueuc/${t}]: ${e}`)}function Bx(t){let e=0;for(let n=0;n<t.length;++n)t[n]==="&"&&++e;return e}const ku=/\s*,(?![^(]*\))\s*/g,Tx=/\s+/g;function Nx(t,e){const n=[];return e.split(ku).forEach(r=>{let o=Bx(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 $x(t,e){const n=[];return e.split(ku).forEach(r=>{t.forEach(o=>{n.push((o&&o+" ")+r)})}),n}function Rx(t){let e=[""];return t.forEach(n=>{n=n&&n.trim(),n&&(n.includes("&")?e=Nx(e,n):e=$x(e,n))}),e.join(", ").replace(Tx," ")}function vu(t){if(!t)return;const e=t.parentElement;e&&e.removeChild(t)}function So(t,e){return(e??document.head).querySelector(`style[cssr-id="${t}"]`)}function Ex(t){const e=document.createElement("style");return e.setAttribute("cssr-id",t),e}function Bo(t){return t?/^\s*@(s|m)/.test(t):!1}const Px=/[A-Z]/g;function Cu(t){return t.replace(Px,e=>"-"+e.toLowerCase())}function Fx(t,e=" "){return typeof t=="object"&&t!==null?` {
106
106
  `+Object.entries(t).map(n=>e+` ${Cu(n[0])}: ${n[1]};`).join(`