@snabcentr/vue-ui-lib 4.19.1 → 4.19.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.
- package/dist/manifest.json +1 -1
- package/dist/release_notes.tmp +3 -4
- package/dist/sc-vue-ui-lib.js +1264 -1260
- package/dist/sc-vue-ui-lib.js.map +1 -1
- package/dist/sc-vue-ui-lib.umd.cjs +1 -1
- package/dist/sc-vue-ui-lib.umd.cjs.map +1 -1
- package/dist/src/components/catalog/forms/set-client-price-form-item.vue.d.ts +10 -0
- package/package.json +1 -1
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
}
|
|
101
101
|
gl_FragColor = texel;
|
|
102
102
|
}
|
|
103
|
-
`}},Co=wi.Multiply,Sy=[1,0,0,0,1,0,0,0,1],si=new _n(9),By=vt.Utils,rd=new re,Ks=new _n([0,0,1,0,0,1,0,1,1,0,1,1]),Ce={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Ue.document?Ue.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new wi,group:{removeChild:function(t,e){if(t.children)for(let n=0;n<t.children.length;n++)Ce.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;oe.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 _n(9)),this._matrix.toTransformArray(!0,si),Co(si,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=vt.Utils.getRendererType(this._mask._renderer.type);Ce[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++)Ce.group.removeChild(this.subtractions[s],t);for(s=0;s<this.children.length;s++){const a=this.children[s],l=vt.Utils.getRendererType(a._renderer.type);Ce[l].render.call(a,t,e)}return this._mask&&t.disable(t.STENCIL_TEST),oe.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,m,p,g;const y=e._renderer.vertices,b=this.canvas,_=this.ctx,k=t.renderer.ratio,x=rd.copy(e._renderer.scale).multiply(k),C=e._stroke,N=e._linewidth,w=e._fill,S=e._renderer.opacity||e._opacity,v=e._cap,$=e._join,E=e._miter,A=e._closed,R=e.dashes,F=y.length,H=F-1;b.width=Math.max(Math.ceil(e._renderer.rect.width*x.x),1),b.height=Math.max(Math.ceil(e._renderer.rect.height*x.y),1);const Q=e._renderer.rect.centroid,Z=Q.x,O=Q.y;if(_.clearRect(0,0,b.width,b.height),w)if(typeof w=="string")_.fillStyle=w;else{const W=vt.Utils.getRendererType(w._renderer.type);Ce[W].render.call(w,_,e),_.fillStyle=w._renderer.effect}if(C){if(typeof C=="string")_.strokeStyle=C;else{const W=vt.Utils.getRendererType(C._renderer.type);Ce[W].render.call(C,_,e),_.strokeStyle=C._renderer.effect}N&&(_.lineWidth=wn(e)),E&&(_.miterLimit=E),$&&(_.lineJoin=$),!A&&v&&(_.lineCap=v)}typeof S=="number"&&(_.globalAlpha=S),R&&R.length>0&&(_.lineDashOffset=R.offset||0,_.setLineDash(R));let P,V,M,L,Y,U,G,q;_.save(),_.scale(x.x,x.y),_.translate(Z,O),_.beginPath();for(let W=0;W<y.length;W++){const K=y[W];switch(m=K.x,p=K.y,K.command){case ie.close:_.closePath();break;case ie.arc:V=K.rx,M=K.ry,L=K.xAxisRotation,Y=K.largeArcFlag,U=K.sweepFlag,n=A?rt(W-1,F):Math.max(W-1,0),r=y[n],G=r.x,q=r.y,By.renderSvgArcCommand(_,G,q,V,M,Y,U,L,m,p);break;case ie.curve:n=A?rt(W-1,F):Math.max(W-1,0),r=y[n],d=r.controls&&r.controls.right||re.zero,u=K.controls&&K.controls.left||re.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),K._relative?(s=u.x+K.x,a=u.y+K.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,m,p),W>=H&&A&&(o=P,h=K.controls&&K.controls.right||re.zero,f=o.controls&&o.controls.left||re.zero,K._relative?(l=h.x+K.x,c=h.y+K.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),m=o.x,p=o.y,_.bezierCurveTo(l,c,s,a,m,p));break;case ie.line:_.lineTo(m,p);break;case ie.move:P=K,_.moveTo(m,p);break}}A&&_.closePath(),Ce.isHidden.test(w)||(g=w._renderer&&w._renderer.offset,g&&(_.save(),_.translate(-w._renderer.offset.x,-w._renderer.offset.y),_.scale(w._renderer.scale.x,w._renderer.scale.y)),_.fill(),g&&_.restore()),Ce.isHidden.test(C)||(g=C._renderer&&C._renderer.offset,g&&(_.save(),_.translate(-C._renderer.offset.x,-C._renderer.offset.y),_.scale(C._renderer.scale.x,C._renderer.scale.y),_.lineWidth=N/C._renderer.scale.x),_.stroke(),g&&_.restore()),_.restore()},getBoundingClientRect:function(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 m,p,g,y,b,_;s=Math.min(h,s),r=Math.min(u,r),o=Math.max(u,o),a=Math.max(h,a),d.controls&&(b=f.left,_=f.right,!(!b||!_)&&(m=d._relative?b.x+u:b.x,p=d._relative?b.y+h:b.y,g=d._relative?_.x+u:_.x,y=d._relative?_.y+h:_.y,!(!m||!p||!g||!y)&&(s=Math.min(p,y,s),r=Math.min(m,g,r),o=Math.max(m,g,o),a=Math.max(p,y,a))))}),typeof e=="number"&&(s-=e,r-=e,o+=e,a+=e),l=o-r,c=a-s,n.top=s,n.left=r,n.right=o,n.bottom=a,n.width=l,n.height=c,n.centroid||(n.centroid={}),n.centroid.x=-r,n.centroid.y=-s},render:function(t,e,n){if(!this._visible||!this._opacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,o=vt.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 Ke&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ge&&(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 Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ge&&(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 _n(9)),this._matrix.toTransformArray(!0,si),Co(si,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=vt.Utils.getRendererType(this._mask._renderer.type);Ce[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,Ce.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),Ce.updateTexture.call(Ce,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==s&&(t.useProgram(s),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,Ks,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const u=this._renderer.rect;return t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform4f(s.rect,u.left,u.top,u.right,u.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),oe.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;Ce.isHidden.test(a)||(f+=l),r.width=jl(f),r.height=r.width;const m=f/r.width,p=r.width/2,g=r.height/2;if(o.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")o.fillStyle=c;else{const y=vt.Utils.getRendererType(c._renderer.type);Ce[y].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const y=vt.Utils.getRendererType(a._renderer.type);Ce[y].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=wn(e)/m)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(p,g),o.scale(Ce.precision,Ce.precision),o.beginPath(),o.arc(0,0,h/m*.5,0,et),o.restore(),closed&&o.closePath(),Ce.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()),Ce.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;oe.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,m=this._renderer.collection.length,p=this._flagVertices,g=this._flagFill||this._fill instanceof Ke&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ge&&(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 Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ge&&(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 _n(9)),this._matrix.toTransformArray(!0,si),Co(si,o._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let y,b;this._scale instanceof re?(y=this._scale.x*o._renderer.scale.x,b=this._scale.y*o._renderer.scale.y):(y=this._scale*o._renderer.scale.x,b=this._scale*o._renderer.scale.y),this._renderer.scale.x=y<0?-y:y,this._renderer.scale.y=b<0?-b:b,h&&(this._renderer.parent=o)}if(p){const y=this._renderer.positionBuffer;y&&t.deleteBuffer(y),this._renderer.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this._renderer.positionBuffer),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,f,t.STATIC_DRAW)}return g?(this._renderer.opacity=this._opacity*o._renderer.opacity,Ce.updateTexture.call(Ce,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:(Ce.isHidden.test(l)||(r+=c),r/=Ce.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,m),oe.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=rd.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 m=e._renderer.rect.centroid,p=m.x,g=m.y;let y,b,_,k,x,C,N,w,S,v,$;const E=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,n.width,n.height),E||(r.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=f,c)if(typeof c=="string")r.fillStyle=c;else{const A=vt.Utils.getRendererType(c._renderer.type);Ce[A].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const A=vt.Utils.getRendererType(a._renderer.type);Ce[A].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=wn(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(p,g),Ce.isHidden.test(c)||(c._renderer&&c._renderer.offset?(C=c._renderer.scale.x,N=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(C,N),y=e._size/c._renderer.scale.y,b=e._leading/c._renderer.scale.y,r.font=[e._style,e._weight,y+"px/",b+"px",e._family].join(" "),_=c._renderer.offset.x/c._renderer.scale.x,k=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,k),r.restore()):r.fillText(e.value,0,0)),Ce.isHidden.test(a)||(a._renderer&&a._renderer.offset?(C=a._renderer.scale.x,N=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(C,N),y=e._size/a._renderer.scale.y,b=e._leading/a._renderer.scale.y,r.font=[e._style,e._weight,y+"px/",b+"px",e._family].join(" "),_=a._renderer.offset.x/a._renderer.scale.x,k=a._renderer.offset.y/a._renderer.scale.y,x=l/a._renderer.scale.x,r.lineWidth=x,r.strokeText(e.value,_,k),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(h)){const A=r.measureText(e.value);switch(h){case"underline":S=A.actualBoundingBoxDescent,$=A.actualBoundingBoxDescent;break;case"strikethrough":S=0,$=0;break}w=-A.width/2,v=A.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(w,S),r.lineTo(v,$),r.stroke()}r.restore()},getBoundingClientRect:function(t,e){const n=Ce.ctx;n.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" "),n.textAlign="center",n.textBaseline=vt.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&&!Ce.isHidden.test(this._stroke)&&(o+=this._linewidth*2,s+=this._linewidth*2);const a=o/2,l=s/2;switch(Ce.alignments[t._alignment]||t._alignment){case Ce.alignments.left:t.direction==="ltr"?(e.left=0,e.right=o):(e.left=-o,e.right=0);break;case Ce.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;oe.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 Ke&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ge&&(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 Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ge&&(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 _n(9)),this._matrix.toTransformArray(!0,si),Co(si,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=vt.Utils.getRendererType(this._mask._renderer.type);Ce[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,Ce.text.getBoundingClientRect(this,this._renderer.rect),Ce.updateTexture.call(Ce,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==o&&(t.useProgram(o),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(o.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o.position),t.bufferData(t.ARRAY_BUFFER,Ks,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return t.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),t.uniform4f(o.rect,d.left,d.top,d.right,d.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let 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 oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let 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 oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(t,e){if(!t.canvas.getContext("2d"))return;oe.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 oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(t,e){const n=vt.Utils.getRendererType(e._renderer.type);if(this[n].updateCanvas.call(Ce,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(),oe.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 Dt("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]=Ce.extensions.get(t,o)}return e},get:function(t,e){return t.getExtension(e)||t.getExtension(`MOZ_${e}`)||t.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new ro};Ce.ctx=Ce.canvas.getContext("2d");var od=class extends ee{constructor(t){super();let e,n,r,o;if(this.domElement=t.domElement||document.createElement("canvas"),typeof t.offscreenElement<"u"&&(Ce.canvas=t.offscreenElement,Ce.ctx=Ce.canvas.getContext("2d")),this.scene=new mt,this.scene.parent=this,this._renderer={type:"renderer",matrix:new _n(Sy),scale:1,opacity:1},this._flagMatrix=!0,t=oe.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 Dt("unable to create a webgl context. Try using another renderer.");r=nn.create(e,nn.path.vertex,nn.types.vertex),o=nn.create(e,nn.path.fragment,nn.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},n=this.programs.path=Ce.program.create(e,[r,o]),this.programs.text=this.programs.path,e.extensions=Ce.extensions.init(e),e.renderer=this,n.position=e.getAttribLocation(n,"a_position"),n.matrix=e.getUniformLocation(n,"u_matrix"),n.rect=e.getUniformLocation(n,"u_rect");const s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(n.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n.position),e.bufferData(e.ARRAY_BUFFER,Ks,e.STATIC_DRAW),r=nn.create(e,nn.points.vertex,nn.types.vertex),o=nn.create(e,nn.points.fragment,nn.types.fragment),n=this.programs.points=Ce.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"?vs(s):n,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,oe.isObject(this.domElement.style)&&oe.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(ee.Types.resize,t,e,n)}render(){const t=this.ctx;return this.overdraw||t.clear(t.COLOR_BUFFER_BIT),Ce.group.render.call(this.scene,t,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};B(od,"Utils",Ce);var Ty=oe.extend({Error:Dt,getRatio:vs,read:Ye,xhr:Qc},oe,Et,Dl,Ll),Be=class Qr{constructor(e){B(this,"_events",new ee),B(this,"type",""),B(this,"renderer",null),B(this,"scene",null),B(this,"width",0),B(this,"height",0),B(this,"frameCount",0),B(this,"timeDelta",0),B(this,"playing",!1);const n=oe.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:Qr.Types.svg,autostart:!1});if(oe.each(n,function(r,o){/fullscreen/i.test(o)||/autostart/i.test(o)||(this[o]=r)},this),oe.isElement(n.domElement)){const r=n.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=Qr.Types[r])}this.renderer=new Qr[this.type](this),this.setPlaying(n.autostart),this.frameCount=0,n.fullscreen?(this.fit=Ny.bind(this),this.fit.domElement=window,this.fit.attached=!0,oe.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),oe.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),Yt.bind(this.fit.domElement,"resize",this.fit),this.fit()):n.fitted?(this.fit=$y.bind(this),oe.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(ee.Types.resize,Ry.bind(this)),this.scene=this.renderer.scene,Qr.Instances.push(this),n.autostart&&Nr.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=this._events.listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=this._events.ignore)==null?void 0:e.apply(this,arguments)}appendTo(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,Nr.init(),this.trigger(ee.Types.play)}pause(){return this.playing=!1,this.trigger(ee.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"&&typeof e.fill.unbind=="function"&&e.fill.unbind(),typeof e.stroke=="object"&&typeof e.stroke.unbind=="function"&&e.stroke.unbind(),e.vertices){if(typeof e.vertices.unbind=="function")try{e.vertices.unbind()}catch{}for(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}getShapesAtPoint(e,n,r){return this.scene&&typeof this.scene.getShapesAtPoint=="function"?this.scene.getShapesAtPoint(e,n,r):[]}update(){const e=!!this._lastFrame,n=oe.performance.now();e&&(this.timeDelta=parseFloat((n-this._lastFrame).toFixed(3))),this._lastFrame=n,this.fit&&this.fit.domElement&&!this.fit.attached&&(Yt.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());const r=this.width,o=this.height,s=this.renderer;return(r!==s.width||o!==s.height)&&s.setSize(r,o,this.ratio),this.trigger(ee.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(ee.Types.render,this.frameCount++)}add(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.add(e),this}remove(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.remove(e),this}clear(){return this.scene.remove(this.scene.children),this}makeLine(e,n,r,o){const s=new _o(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 Ne(e,n,void 0,void 0,void 0,void 0,ie.move),new Ne(r,o,void 0,void 0,void 0,void 0,ie.line),new Ne(r-a*Math.cos(l-Math.PI/4),o-a*Math.sin(l-Math.PI/4),void 0,void 0,void 0,void 0,ie.line),new Ne(r,o,void 0,void 0,void 0,void 0,ie.move),new Ne(r-a*Math.cos(l+Math.PI/4),o-a*Math.sin(l+Math.PI/4),void 0,void 0,void 0,void 0,ie.line)],d=new Re(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 oi(e,n,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,n,r,o,s){const a=new go(e,n,r,o,s);return this.scene.add(a),a}makeCircle(e,n,r,o){const s=new mo(e,n,r,o);return this.scene.add(s),s}makeEllipse(e,n,r,o,s){const a=new po(e,n,r,o,s);return this.scene.add(a),a}makeStar(e,n,r,o,s){const a=new Ds(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 Ne(l,c))}}const r=arguments[n-1],o=new Re(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 zs(e,n,r,o);return this.scene.add(s),s}makeArcSegment(e,n,r,o,s,a,l){const c=new Fs(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 Os(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 Ne(c,d))}}const o=arguments[n-1],s=new Re(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 xn(e,n,r,o);return this.add(s),s}makeLinearGradient(e,n,r,o){const s=Array.prototype.slice.call(arguments,4),a=new Ke(e,n,r,o,s);return this.add(a),a}makeRadialGradient(e,n,r){const o=Array.prototype.slice.call(arguments,3),s=new Ge(e,n,r,o);return this.add(s),s}makeSprite(e,n,r,o,s,a,l){const c=new ho(e,n,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,n,r,o,s,a){const l=new Jc(e,n,r,o,s,a);return this.add(l),l}makeImageSequence(e,n,r,o,s){const a=new js(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 mt;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 Ye))return null;const s=Ye[o].call(this,e);return r?this.add(n&&s instanceof mt?s.children:s):s.parent&&s.remove(),s}load(e,n){const r=new mt;let o,s,a;const l=(function(c){for(Yt.temp.innerHTML=c,s=0;s<Yt.temp.children.length;s++)o=Yt.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof n=="function"){const d=Yt.temp.children.length<=1?Yt.temp.children[0]:Yt.temp.children;n(r,d)}}).bind(this);return/\.svg$/i.test(e)?(Qc(e,l),r):(l(e),r)}};B(Be,"NextFrameId",xt.NextFrameId),B(Be,"Types",xt.Types),B(Be,"Version",xt.Version),B(Be,"PublishDate",xt.PublishDate),B(Be,"Identifier",xt.Identifier),B(Be,"Resolution",xt.Resolution),B(Be,"AutoCalculateImportedMatrices",xt.AutoCalculateImportedMatrices),B(Be,"Instances",xt.Instances),B(Be,"uniqueId",xt.uniqueId),B(Be,"Anchor",Ne),B(Be,"Collection",ii),B(Be,"Events",ee),B(Be,"Group",mt),B(Be,"Matrix",wi),B(Be,"Path",Re),B(Be,"Registry",ro),B(Be,"Element",Gi),B(Be,"Shape",On),B(Be,"Text",xn),B(Be,"Vector",re),B(Be,"Gradient",dt),B(Be,"Image",Jc),B(Be,"ImageSequence",js),B(Be,"LinearGradient",Ke),B(Be,"RadialGradient",Ge),B(Be,"Sprite",ho),B(Be,"Stop",ri),B(Be,"Texture",Oe),B(Be,"ArcSegment",Fs),B(Be,"Circle",mo),B(Be,"Ellipse",po),B(Be,"Line",_o),B(Be,"Points",Os),B(Be,"Polygon",zs),B(Be,"Rectangle",oi),B(Be,"RoundedRectangle",go),B(Be,"Star",Ds),B(Be,"CanvasRenderer",vt),B(Be,"SVGRenderer",id),B(Be,"WebGLRenderer",od),B(Be,"Commands",ie),B(Be,"Utils",Ty);var vn=Be;function Ny(){const t=document.body.getBoundingClientRect(),e=this.width=t.width,n=this.height=t.height;this.renderer.setSize(e,n,this.ratio)}function $y(){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 Ry(t,e){this.width=t,this.height=e,this.trigger(ee.Types.resize,t,e)}var Nr=Yt.getRequestAnimationFrame();function sd(){for(let t=0;t<vn.Instances.length;t++){const e=vn.Instances[t];e.playing&&e.update()}vn.NextFrameId=Nr(sd)}Nr.init=function(){sd(),Nr.init=function(){}};let Cn;typeof window<"u"?Cn=window:typeof global<"u"?Cn=global:typeof self<"u"&&(Cn=self);let ad;const Ut=Math.PI*2,pt=Math.PI*.5;function Ey(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 Py(t){ad=t}function Fy(t,e){e=e&&e.identity()||new ad;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 Ht(t,e,n){return n*(e-t)+t}function Wt(t,e){for(;t<0;)t+=e;return t%e}const ld=Cn.Float32Array||Array,Vy=Math.floor;function Sn(t){return Vy(t*1e6)/1e6}const de={move:"M",line:"L",curve:"C",arc:"A",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 cd={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))}}},bt=class bt extends ne{constructor(n=0,r=0){super();T(this,"_x",0);T(this,"_y",0);for(let o in cd)Object.defineProperty(this,o,cd[o]);this.x=n,this.y=r}static add(n,r){return new bt(n.x+r.x,n.y+r.y)}static sub(n,r){return new bt(n.x-r.x,n.y-r.y)}static subtract(n,r){return bt.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(bt.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 bt(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:Sn(this.x),y:Sn(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(bt,"zero",new bt),T(bt,"left",new bt(-1,0)),T(bt,"right",new bt(1,0)),T(bt,"up",new bt(0,-1)),T(bt,"down",new bt(0,1));let me=bt;class Me extends me{constructor(n=0,r=0,o=0,s=0,a=0,l=0,c=de.move){super(n,r);T(this,"controls",{left:new me,right:new me});T(this,"_command",de.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 dd)Object.defineProperty(this,u,dd[u]);this.command=c,this.relative=!0;const d=Me.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 Me().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 Me().copy(this)}toObject(){return{x:Sn(this.x),y:Sn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Sn(this.rx),ry:Sn(this.ry),xAxisRotation:Sn(this.xAxisRotation),largeArcFlag:Sn(this.largeArcFlag),sweepFlag:Sn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const dd={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 My=0;const So={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return My++}},Bo={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 To(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 ud(t,e,n,r,o,s,a,l,c){c=c||Bo.RecursionLimit;const d=c+1;if(Math.abs(t-a)<.001&&Math.abs(e-l)<.001)return[new Me(a,l)];const u=[];for(let h=0;h<d;h++){const f=h/d,m=To(f,t,n,o,a),p=To(f,e,r,s,l);u.push(new Me(m,p))}return u}function Ay(t,e,n,r,o,s,a,l,c){if(t===n&&e===r&&o===a&&s===l){const y=a-t,b=l-e;return Math.sqrt(y*y+b*b)}const d=9*(n-o)+3*(a-t),u=6*(t+o)-12*n,h=3*(n-t),f=9*(r-s)+3*(l-e),m=6*(e+s)-12*r,p=3*(r-e);function g(y){const b=(d*y+u)*y+h,_=(f*y+m)*y+p;return Math.sqrt(b*b+_*_)}return Oy(g,0,1,c||Bo.RecursionLimit)}function Iy(t,e,n,r,o,s,a,l){const c=[],d=[[],[]];let u,h,f,m,p,g,y,b;for(let C=0;C<2;++C){if(C===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;m=-f/h,0<m&&m<1&&c.push(m);continue}y=h*h-4*f*u,b=Math.sqrt(y),!(y<0)&&(p=(-h+b)/(2*u),0<p&&p<1&&c.push(p),g=(-h-b)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,k=_,x;for(;_--;)m=c[_],x=1-m,d[0][_]=x*x*x*t+3*x*x*m*n+3*x*m*m*o+m*m*m*a,d[1][_]=x*x*x*e+3*x*x*m*r+3*x*m*m*s+m*m*m*l;return d[0][k]=t,d[1][k]=e,d[0][k+1]=a,d[1][k+1]=l,d[0].length=d[1].length=k+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function Oy(t,e,n,r){let o=Bo.abscissas[r-2],s=Bo.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 zy(t,e){const n=t.length,r=n-1;for(let o=0;o<n;o++){const s=t[o],a=e?Wt(o-1,n):Math.max(o-1,0),l=e?Wt(o+1,n):Math.min(o+1,r),c=t[a],d=s,u=t[l];Dy(c,d,u),d.command=o===0?de.move:de.curve}}function Dy(t,e,n){const r=me.angleBetween(t,e),o=me.angleBetween(n,e);let s=me.distanceBetween(t,e),a=me.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+=pt:l-=pt,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 $r=(Ai=class extends ne{constructor(){super();T(this,"_flagId",!1);T(this,"_flagClassName",!1);T(this,"_renderer",{});T(this,"_id",So.Identifier+So.uniqueId());T(this,"_className","");T(this,"classList",[]);for(let n in fd)Object.defineProperty(this,n,fd[n])}static fromObject(n){const r=new Ai().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(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const r=this.renderer.ctx;this._renderer.texture&&(r.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(r.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const n=this._renderer.type;return this._renderer={type:n},this}},T(Ai,"Properties",["renderer","id","className"]),Ai);const fd={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 No extends Error{constructor(n){super();T(this,"name","Two.js");T(this,"message");this.message=n}}class Ly{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 $o;const hd={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Cn.document&&($o=document.createElement("a"));const Qe=class Qe extends $r{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 md)Object.defineProperty(this,o,md[o]);if(this._renderer.type="texture",this._renderer.flagOffset=Hy.bind(this),this._renderer.flagScale=Wy.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new me,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 Qe().copy(n);return"id"in n&&(r.id=n.id),r}static getAbsoluteURL(n){return $o?($o.href=n,$o.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=Qe.getAbsoluteURL(n);if(Qe.ImageRegistry.contains(r))return Qe.ImageRegistry.get(r);let o;return Cn.document?hd.video.test(r)?o=document.createElement("video"):o=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),o.crossOrigin="anonymous",o.referrerPolicy="no-referrer",o}static load(n,r){let o=n.image,s=Qe.getTag(o);n._flagImage&&(/canvas/i.test(s)?Qe.Register.canvas(n,r):(n._src=o.getAttribute("two-src")||o.src,Qe.Register[s](n,r))),n._flagSrc&&(o||(o=Qe.getImage(n.src),n.image=o),s=Qe.getTag(o),Qe.Register[s](n,r))}clone(){const n=new Qe(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 me?n.offset:new me().copy(n.offset),this.scale=typeof n.scale=="number"||n.scale instanceof me?n.scale:new me().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,Qe.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(Qe,"Properties",["src","loaded","repeat","scale","offset","image"]),T(Qe,"RegularExpressions",hd),T(Qe,"ImageRegistry",new Ly),T(Qe,"Register",{canvas:function(n,r){n._src="#"+n.id,Qe.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 No("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=Qe.getAbsoluteURL(n._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",n.src),Qe.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 No("unable to load "+n.src)};n._src=Qe.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),Qe.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 Ze=Qe;const md={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=Ze.getTag(t);let n;switch(e){case"canvas":n="#"+t.id;break;default:n=t.src}Ze.ImageRegistry.contains(n)?this._image=Ze.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 me&&this._scale.unbind(ne.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof me&&this._scale.bind(ne.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Hy(){this._flagOffset=!0}function Wy(){this._flagScale=!0}class xi extends Array{constructor(){super();yl(this,_t,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 Ot(this,_t)}set _events(n){zh(this,_t,n)}get _bound(){return Ot(this,_t)._bound}set _bound(n){Ot(this,_t)._bound=n}addEventListener(){var n;return(n=Ot(this,_t).addEventListener)==null?void 0:n.apply(this,arguments)}on(){var n;return(n=Ot(this,_t).on)==null?void 0:n.apply(this,arguments)}bind(){var n;return(n=Ot(this,_t).bind)==null?void 0:n.apply(this,arguments)}removeEventListener(){var n;return(n=Ot(this,_t).removeEventListener)==null?void 0:n.apply(this,arguments)}off(){var n;return(n=Ot(this,_t).off)==null?void 0:n.apply(this,arguments)}unbind(){var n;return(n=Ot(this,_t).unbind)==null?void 0:n.apply(this,arguments)}dispatchEvent(){var n;return(n=Ot(this,_t).dispatchEvent)==null?void 0:n.apply(this,arguments)}trigger(){var n;return(n=Ot(this,_t).trigger)==null?void 0:n.apply(this,arguments)}listen(){var n;return(n=Ot(this,_t).listen)==null?void 0:n.apply(this,arguments)}ignore(){var n;return(n=Ot(this,_t).ignore)==null?void 0:n.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}}_t=new WeakMap;const pd=Array.prototype.slice;function jy(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}const je={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=pd.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=pd.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=!jy(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:Cn.performance&&Cn.performance.now?Cn.performance:Date},Xt=class Xt extends $r{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 gd)Object.defineProperty(this,s,gd[s]);this._renderer.type="stop",this.offset=typeof n=="number"?n:Xt.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:Xt.Index<=0?"#fff":"#000",Xt.Index=(Xt.Index+1)%2}static fromObject(n){const r=new Xt().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Xt.Properties.length;r++){const o=Xt.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Xt;return je.each(Xt.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",je.each(Xt.Properties,r=>{n[r]=this[r]},this),n}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};T(Xt,"Index",0),T(Xt,"Properties",["offset","opacity","color"]);let ki=Xt;const gd={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)}}},En=class En extends $r{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 yd)Object.defineProperty(this,r,yd[r]);this._renderer.type="gradient",this._renderer.flagStops=qy.bind(this),this._renderer.bindStops=Xy.bind(this),this._renderer.unbindStops=Yy.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 ki?s:new ki().copy(s)));const o=new En(r).copy(n);return"id"in n&&(o.id=n.id),o}clone(n){const r=this.stops.map(s=>s.clone()),o=new En(r);return je.each(En.Properties,s=>{o[s]=this[s]},this),n&&n.add(o),o}copy(n){super.copy.call(this,n);for(let r=0;r<En.Properties.length;r++){const o=En.Properties[r];o in n&&(this[o]=n[o])}return this}toObject(){const n={stops:this.stops.map(r=>r.toObject())};return je.each(En.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(En,"Stop",ki),T(En,"Properties",["spread","stops","units"]);let ut=En;const yd={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 xi((t||[]).slice(0)),this._stops.bind(ne.Types.insert,e).bind(ne.Types.remove,n),e(this._stops)}}};function qy(){this._flagStops=!0}function Xy(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function Yy(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}const fi=class fi extends ut{constructor(n,r,o,s,a){super(a);T(this,"_flagEndPoints",!1);T(this,"_left",null);T(this,"_right",null);for(let l in bd)Object.defineProperty(this,l,bd[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=Uy.bind(this),this.left=new me,this.right=new me,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 fi().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<fi.Properties.length;r++){const o=fi.Properties[r];o in n&&(this[o]=n[o]instanceof me?n[o]:new me().copy(n[o]))}return this}clone(n){const r=this.stops.map(function(s){return s.clone()}),o=new fi(this.left._x,this.left._y,this.right._x,this.right._y,r);return je.each(ut.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(fi,"Stop",ki),T(fi,"Properties",["left","right"]);let Ft=fi;const bd={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof me&&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 me&&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 Uy(){this._flagEndPoints=!0}const Pn=class Pn extends ut{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 _d)Object.defineProperty(this,c,_d[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Ky.bind(this),this._renderer.flagFocal=Gy.bind(this),this.center=new me,this.radius=typeof o=="number"?o:1,this.focal=new me,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 Pn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Pn.Properties.length;r++){const o=Pn.Properties[r];o in n&&(/(center|focal)i/.test(o)?this[o]=n[o]instanceof me?n[o]:new me().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 Pn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return je.each(ut.Properties.concat(Pn.Properties),function(s){o[s]=this[s]},this),n&&n.add(o),o}toObject(){const n=super.toObject.call(this);return je.each(Pn.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(Pn,"Stop",ki),T(Pn,"Properties",["center","radius","focal"]);let Vt=Pn;const _d={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 Ky(){this._flagCenter=!0}function Gy(){this._flagFocal=!0}function wd(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 Ro(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 xd(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),Ay(r,l,o,c,s,d,a,u,n)}function Gs(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),ud(r,l,o,c,s,d,a,u,n)}function vi(t){switch(t.renderer.type){case"texture":return Ze.fromObject(t);case"gradient":return ut.fromObject(t);case"linear-gradient":return Ft.fromObject(t);case"radial-gradient":return Vt.fromObject(t)}return t}const Zy=Math.cos,Qy=Math.sin,kd=Math.tan,Zs=[],At=class At extends ne{constructor(n,r,o,s,a,l){super();T(this,"elements",new ld(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 S,v,$;const E=r[0]||0,A=r[1]||0,R=r[2]||0;return S=w[0]*E+w[1]*A+w[2]*R,v=w[3]*E+w[4]*A+w[5]*R,$=w[6]*E+w[7]*A+w[8]*R,[S,v,$]}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],m=n[8],p=r[0],g=r[1],y=r[2],b=r[3],_=r[4],k=r[5],x=r[6],C=r[7],N=r[8];return o=o||new ld(9),o[0]=s*p+a*b+l*x,o[1]=s*g+a*_+l*C,o[2]=s*y+a*k+l*N,o[3]=c*p+d*b+u*x,o[4]=c*g+d*_+u*C,o[5]=c*y+d*k+u*N,o[6]=h*p+f*b+m*x,o[7]=h*g+f*_+m*C,o[8]=h*y+f*k+m*N,o}static fromObject(n){return new At().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]=At.Identity[0],this.elements[1]=At.Identity[1],this.elements[2]=At.Identity[2],this.elements[3]=At.Identity[3],this.elements[4]=At.Identity[4],this.elements[5]=At.Identity[5],this.elements[6]=At.Identity[6],this.elements[7]=At.Identity[7],this.elements[8]=At.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 H=a[0]*n+a[1]*r+a[2]*o,Q=a[3]*n+a[4]*r+a[5]*o,Z=a[6]*n+a[7]*r+a[8]*o;return[H,Q,Z]}const h=this.elements,f=[n,r,o,s,a,l,c,d,u],m=h[0],p=h[1],g=h[2],y=h[3],b=h[4],_=h[5],k=h[6],x=h[7],C=h[8],N=f[0],w=f[1],S=f[2],v=f[3],$=f[4],E=f[5],A=f[6],R=f[7],F=f[8];return this.elements[0]=m*N+p*v+g*A,this.elements[1]=m*w+p*$+g*R,this.elements[2]=m*S+p*E+g*F,this.elements[3]=y*N+b*v+_*A,this.elements[4]=y*w+b*$+_*R,this.elements[5]=y*S+b*E+_*F,this.elements[6]=k*N+x*v+C*A,this.elements[7]=k*w+x*$+C*R,this.elements[8]=k*S+x*E+C*F,this.trigger(ne.Types.change)}inverse(n){const r=this.elements;n=n||new At;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],m=f*c-d*h,p=-f*l+d*u,g=h*l-c*u;let y=o*m+s*p+a*g;return y?(y=1/y,n.elements[0]=m*y,n.elements[1]=(-f*s+a*h)*y,n.elements[2]=(d*s-a*c)*y,n.elements[3]=p*y,n.elements[4]=(f*o-a*u)*y,n.elements[5]=(-d*o+a*l)*y,n.elements[6]=g*y,n.elements[7]=(-h*o+s*u)*y,n.elements[8]=(c*o-s*l)*y,n):null}scale(n,r){return arguments.length<=1&&(r=n),this.multiply(n,0,0,0,r,0,0,0,1)}rotate(n){const r=Zy(n),o=Qy(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=kd(n);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(n){const r=kd(n);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(n){return Zs.length=0,this.toTransformArray(n,Zs),Zs.map(Sn).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],m=o[7],p=o[8];if(s){r[0]=a,r[1]=d,r[2]=f,r[3]=l,r[4]=u,r[5]=m,r[6]=c,r[7]=h,r[8]=p;return}return[a,d,f,l,u,m,c,h,p]}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],m=o[7],p=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]=m,r[8]=p;return}return[a,l,c,d,u,h,f,m,p]}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 At().copy(this)}};T(At,"Identity",[1,0,0,0,1,0,0,0,1]);let tr=At;Py(tr);const Ur=class Ur extends $r{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 Eo)Object.defineProperty(this,n,Eo[n]);this._renderer.flagMatrix=vd.bind(this),this.isShape=!0,this.matrix=new tr,this.worldMatrix=new tr,this.position=new me,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(n){const r=new Ur().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 Eo.position.get.apply(this,arguments)}set translation(n){Eo.position.set.apply(this,arguments)}addTo(n){return n.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(n,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&"visible"in this&&this.visible===!1||!a&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();return c?n>=c.left-l&&n<=c.right+l&&r>=c.top-l&&r<=c.bottom+l:!1}copy(n){return super.copy.call(this,n),"position"in n&&(n.position instanceof me?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 me?n.scale:new me(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 Ur;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 me?this.scale.toObject():this.scale,n.skewX=this.skewX,n.skewY=this.skewY,n.matrix=this.matrix.toObject(),n}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(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 me?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(Ur,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let Bn=Ur;const Eo={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),vd.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 me&&this._scale.unbind(ne.Types.change,this._renderer.flagMatrix),this._scale=t,this._scale instanceof me&&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 Fy(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function vd(){this._flagMatrix=!0}const Cd=/^(?:none|transparent)$/i,Jy=8,Qs=Number.EPSILON;function Dn(t,e){return{x:t,y:e}}function Po(t,e,n=Qs){return Math.abs(t.x-e.x)<=n&&Math.abs(t.y-e.y)<=n}function Sd(t,e,n,r){const o=t*n+e*r,s=Math.sqrt(t*t+e*e)*Math.sqrt(n*n+r*r)||1e-12;let a=Math.acos(Math.max(-1,Math.min(1,o/s)));return t*r-e*n<0&&(a=-a),a}function e0(t,e,n){if(!t)return[Dn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[Dn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,a=e.largeArcFlag?1:0,l=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=t.x,d=t.y,u=e.x,h=e.y,f=(c-u)/2,m=(d-h)/2,p=Math.cos(s),g=Math.sin(s);let y=p*f+g*m,b=-g*f+p*m,_=r*r,k=o*o;const x=y*y/_+b*b/k;if(x>1){const P=Math.sqrt(x);r*=P,o*=P,_=r*r,k=o*o}const C=_*b*b+k*y*y,N=C===0?0:(_*k-C)/C;let w=Math.sqrt(Math.max(0,N));a===l&&(w=-w);const S=w*r*b/o,v=-w*o*y/r,$=p*S-g*v+(c+u)/2,E=g*S+p*v+(d+h)/2,A=Sd(1,0,(y-S)/r,(b-v)/o),R=Sd((y-S)/r,(b-v)/o,(-y-S)/r,(-b-v)/o)%Ut,F=A+R,H=l===0,Q=(()=>{const P=F-A,V=Math.abs(P)<Number.EPSILON;let M=Wt(P,Ut);return M<Number.EPSILON&&(M=V?0:Ut),H&&!V&&(M=M===Ut?-Ut:M-Ut),M})(),Z=Math.max(So.Resolution,Math.max(n*2,1)),O=[];for(let P=1;P<=Z;P++){const V=P/Z,M=A+V*Q;let L=$+r*Math.cos(M),Y=E+o*Math.sin(M);if(s!==0){const U=L-$,G=Y-E,q=Math.cos(s),W=Math.sin(s);L=U*q-G*W+$,Y=U*W+G*q+E}O.push(Dn(L,Y))}return O}function t0(t,e=Jy){const n=[],r=[],o=t._renderer&&t._renderer.vertices&&t._renderer.vertices.length>0?t._renderer.vertices:t.vertices;if(!o||o.length===0)return{polygons:n,segments:r};const s=Math.max(1,Math.floor(e));let a=null,l=null,c=null,d=null;const u=(f=!1)=>{if(a){if(f&&l&&c&&!Po(l,c)){const m=Dn(l.x,l.y);r.push({a:c,b:m}),a.push(m),c=m}a.length>=3&&l&&c&&Po(l,c)&&n.push(a),a=null,l=null,c=null}},h=f=>{if(!c){c=f,a&&a.push(f);return}Po(c,f)||(r.push({a:c,b:f}),a&&a.push(f),c=f)};for(let f=0;f<o.length;f++){const m=o[f],p=m.command||(f===0?de.move:de.line);if(p===de.move){u(!1);const g=Dn(m.x,m.y);a=[g],l=g,c=g,d=m;continue}if(d||(d=o[Math.max(f-1,0)]),p===de.line)h(Dn(m.x,m.y));else if(p===de.curve){const g=Gs(m,d,s);for(let y=1;y<g.length;y++){const b=g[y];h(Dn(b.x,b.y))}h(Dn(m.x,m.y))}else if(p===de.arc){const g=e0(d,m,s);for(let y=0;y<g.length;y++)h(g[y])}else if(p===de.close){u(!0),d=m;continue}else h(Dn(m.x,m.y));d=m}if(a){const f=!!t._closed||!!t.closed||l&&c&&!Po(l,c);u(f)}return{polygons:n,segments:r}}function n0(t,e,n){let r=!1;for(let o=0;o<t.length;o++){const s=t[o];if(!s||s.length<3)continue;let a=s.length-1;for(let l=0;l<s.length;l++){const c=s[a],d=s[l];d.y>n!=c.y>n&&e<(c.x-d.x)*(n-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),a=l}}return r}function i0(t,e,n,r){const o=r.x-n.x,s=r.y-n.y;if(Math.abs(o)<Qs&&Math.abs(s)<Qs){const f=t-n.x,m=e-n.y;return f*f+m*m}const a=((t-n.x)*o+(e-n.y)*s)/(o*o+s*s),l=Math.max(0,Math.min(1,a)),c=n.x+l*o,d=n.y+l*s,u=t-c,h=e-d;return u*u+h*h}function r0(t,e,n){if(!t||t.length===0)return 1/0;let r=1/0;for(let o=0;o<t.length;o++){const s=t[o],a=i0(e,n,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function o0(t,e){if(typeof e=="boolean")return e;const n=t.fill;return!n&&n!==0?!1:typeof n=="string"?!Cd.test(n):!0}function s0(t,e){const n=typeof t.linewidth=="number"?t.linewidth:t._linewidth||0;if(typeof e=="boolean")return e&&n>0;if(!(n>0))return!1;const r=t.stroke;return!r&&r!==0?!1:typeof r=="string"?!Cd.test(r):!0}function a0(t,e,n,r=0){if(!t)return!1;const o=t.left-r,s=t.right+r,a=t.top-r,l=t.bottom+r;return e>=o&&e<=s&&n>=a&&n<=l}const Fo=Number.EPSILON;function Vo(t){return typeof t.relative!="boolean"||!!t.relative}function un(t,e,n,r){const o=t.controls;if(!(!o||!o[e])){if(Math.abs(n)<Fo&&Math.abs(r)<Fo){Vo(t)?o[e].clear():o[e].set(t.x,t.y);return}Vo(t)?o[e].set(n,r):o[e].set(t.x+n,t.y+r)}}function jt(t,e){un(t,e,0,0)}function l0(t,e){const n=t.controls;return!n||!n[e]?{x:0,y:0}:Vo(t)?{x:n[e].x,y:n[e].y}:{x:n[e].x-t.x,y:n[e].y-t.y}}function nr(t,e){const n=l0(t,e);return Math.abs(n.x)>Fo||Math.abs(n.y)>Fo}function Mo(t){t.command===de.move||t.command===de.close||(t.command=nr(t,"left")||nr(t,"right")?de.curve:de.line)}function Bd(t,e){typeof e.relative=="boolean"&&(t.relative=e.relative)}function c0(t,e){return nr(e,"right")||nr(t,"left")||nr(t,"right")||nr(e,"left")||t.command===de.curve||e.command===de.curve}function ir(t,e,n){return{x:Ht(t.x,e.x,n),y:Ht(t.y,e.y,n)}}function Td(t,e){const n=t.controls&&t.controls[e];return n?Vo(t)?{x:t.x+n.x,y:t.y+n.y}:{x:n.x,y:n.y}:{x:t.x,y:t.y}}function d0(t,e,n){const r=t.controls&&t.controls.right,o=e.controls&&e.controls.left,s={x:t.x,y:t.y},a=r?Td(t,"right"):{...s},l={x:e.x,y:e.y},c=o?Td(e,"left"):{...l},d=ir(s,a,n),u=ir(a,c,n),h=ir(c,l,n),f=ir(d,u,n),m=ir(u,h,n),p=ir(f,m,n),g=new Me(p.x,p.y);return Bd(g,t),un(g,"left",f.x-p.x,f.y-p.y),un(g,"right",m.x-p.x,m.y-p.y),g.command=de.curve,{anchor:g,startOut:d,endIn:h}}function u0(t,e,n,r,o,s){const a=t.length,l=n-e+1;let c=l-1,d=o?Math.min(l,4):1,u=d,h=d;if(r||(u=Math.min(1,e),h=Math.min(1,a-n-1)),c+=u+h,c<=1)return;const f=new Array(c+1);for(let w=0,S=e-u;w<=c;w+=1,S+=1){const v=Wt(S,a);f[w]=t[v]}let m=f[0].x+2*f[1].x,p=f[0].y+2*f[1].y,g=2;const y=c-1,b=[m],_=[p],k=[g],x=new Array(c+1),C=new Array(c+1);for(let w=1;w<c;w+=1){const S=w<y,v=S||s?1:2,$=S?4:s?2:7,E=S?4:s?3:8,A=S?2:s?0:1,R=v/g;g=k[w]=$-R,m=b[w]=E*f[w].x+A*f[w+1].x-R*m,p=_[w]=E*f[w].y+A*f[w+1].y-R*p}x[y]=b[y]/k[y],C[y]=_[y]/k[y];for(let w=c-2;w>=0;w-=1)x[w]=(b[w]-x[w+1])/k[w],C[w]=(_[w]-C[w+1])/k[w];x[c]=(3*f[c].x-x[y])/2,C[c]=(3*f[c].y-C[y])/2;const N=c-h;for(let w=u,S=e;w<=N;w+=1,S+=1){const v=Wt(S,a),$=t[v],E=x[w]-$.x,A=C[w]-$.y;o||w<N?un($,"right",E,A):jt($,"right"),o||w>u?un($,"left",-E,-A):jt($,"left"),Mo($)}}function f0(t,e,n,r,o,s){const a=e||t,l=t,c=n||t,d=me.distanceBetween(a,l),u=me.distanceBetween(l,c),h=r===void 0?.5:r,f=Math.pow(d,h),m=Math.pow(u,h),p=f*f,g=m*m;if(!o&&e){const y=2*g+3*m*f+p,b=3*m*(m+f);if(b!==0){const _=(g*a.x+y*l.x-p*c.x)/b-l.x,k=(g*a.y+y*l.y-p*c.y)/b-l.y;un(t,"left",_,k)}else jt(t,"left")}else jt(t,"left");if(!s&&n){const y=2*p+3*f*m+g,b=3*f*(f+m);if(b!==0){const _=(p*c.x+y*l.x-g*a.x)/b-l.x,k=(p*c.y+y*l.y-g*a.y)/b-l.y;un(t,"right",_,k)}else jt(t,"right")}else jt(t,"right");Mo(t)}function h0(t,e,n,r,o,s){if(!(e&&n)){e||jt(t,"left"),n||jt(t,"right"),Mo(t);return}const a=e,l=t,c=n,d=me.distanceBetween(a,l),u=me.distanceBetween(l,c),h=d+u,f=r===void 0?.4:r,m={x:a.x-c.x,y:a.y-c.y};if(!o&&h!==0){const p=f*d/h;un(t,"left",m.x*p,m.y*p)}else jt(t,"left");if(!s&&h!==0){const p=f*d/h-f;un(t,"right",m.x*p,m.y*p)}else jt(t,"right");Mo(t)}function m0(t,e,n,r,o,s){const a=s.type,l=s.factor,c=t.length;for(let d=e;d<=n;d+=1){const u=Wt(d,c),h=t[u];if(h.command===de.move){jt(h,"left"),jt(h,"right");continue}const f=d===e&&!o?null:d-1,m=d===n&&!o?null:d+1,p=f===null?null:t[Wt(f,c)],g=m===null?null:t[Wt(m,c)],y=f===null,b=m===null;a==="geometric"?h0(h,p,g,l,y,b):f0(h,p,g,l,y,b)}}const rr=Math.min,or=Math.max,p0=Math.ceil,g0=Math.floor,y0=new me,b0=new tr,mn=class mn extends Bn{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 Nd)Object.defineProperty(this,a,Nd[a]);this._renderer.type="path",this._renderer.flagVertices=$d.bind(this),this._renderer.bindVertices=Rd.bind(this),this._renderer.unbindVertices=Ed.bind(this),this._renderer.flagFill=Pd.bind(this),this._renderer.flagStroke=Fd.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:vi(n.fill),o=typeof n.stroke=="string"?n.stroke:vi(n.stroke),s=new mn().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 Me?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Me().copy(o))}}for(let r=0;r<mn.Properties.length;r++){const o=mn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new mn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<mn.Properties.length;o++){const s=mn.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()),je.each(mn.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"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const 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:m,scaleY:p}=Ey(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof m=="number"&&typeof p=="number"&&(o=Math.max(m,p)*(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[m,p]=r.multiply(l.x,l.y),[g,y]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let b=l.controls.right.x,_=l.controls.right.y;l.relative&&(b+=l.x,_+=l.y);let[k,x]=r.multiply(b,_),C=c.controls.left.x,N=c.controls.left.y;c.relative&&(C+=c.x,N+=c.y);let[w,S]=r.multiply(C,N);const v=Iy(m,p,k,x,w,S,g,y);h=rr(v.min.y-o,h),d=rr(v.min.x-o,d),u=or(v.max.x+o,u),f=or(v.max.y+o,f)}else a<=1&&(h=rr(p-o,h),d=rr(m-o,d),u=or(m+o,u),f=or(p+o,f)),h=rr(y-o,h),d=rr(g-o,d),u=or(g+o,u),f=or(y+o,f)}return{top:h,left:d,right:u,bottom:f,width:u-d,height:f-h}}contains(n,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&this.visible===!1||!a&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();if(!c||n<c.left-l||n>c.right+l||r<c.top-l||r>c.bottom+l)return!1;const d=this.worldMatrix,u=d&&d.inverse(b0);if(!u)return super.contains(n,r,s);const[h,f]=u.multiply(n,r,1),m=typeof s.precision=="number"&&!Number.isNaN(s.precision)?Math.max(1,Math.floor(s.precision)):8,p=o0(this,s.fill),g=s0(this,s.stroke),{polygons:y,segments:b}=t0(this,m);if(p&&y.length>0&&n0(y,h,f))return!0;if(g&&b.length>0){const _=typeof this.linewidth=="number"?this.linewidth:0;if(_>0&&r0(b,h,f)<=_/2+l)return!0}return!p&&!g?super.contains(n,r,s):p&&y.length===0?super.contains(n,r,s):!1}getPointAt(n,r){let o,s,a,l,c,d,u,h,f,m,p,g,y,b,_,k=this.length*Math.min(Math.max(n,0),1);const x=this.vertices.length,C=x-1;let N=null,w=null;for(let O=0,P=this._lengths.length,V=0;O<P;O++){if(V+this._lengths[O]>=k){this._closed?(o=Wt(O,x),s=Wt(O-1,x),O===0&&(o=s,s=O)):(o=O,s=Math.min(Math.max(O-1,0),C)),N=this.vertices[o],w=this.vertices[s],k-=V,this._lengths[O]!==0?n=k/this._lengths[O]:n=0;break}V+=this._lengths[O]}if(N===null||w===null)return null;if(N){if(!w)return N}else return w;_=w.controls&&w.controls.right,b=N.controls&&N.controls.left,c=w.x,m=w.y,d=(_||w).x,p=(_||w).y,u=(b||N).x,g=(b||N).y,h=N.x,y=N.y,_&&w.relative&&(d+=w.x,p+=w.y),b&&N.relative&&(u+=N.x,g+=N.y),l=To(n,c,d,u,h),f=To(n,m,p,g,y);const S=Ht(c,d,n),v=Ht(m,p,n),$=Ht(d,u,n),E=Ht(p,g,n),A=Ht(u,h,n),R=Ht(g,y,n),F=Ht(S,$,n),H=Ht(v,E,n),Q=Ht($,A,n),Z=Ht(E,R,n);return je.isObject(r)?(r.x=l,r.y=f,r instanceof Me&&(r.controls.left.x=F,r.controls.left.y=H,r.controls.right.x=Q,r.controls.right.y=Z,(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 Me(l,f,F-l,H-f,Q-l,Z-f,this._curved?de.curve:de.line),a.t=n,a)}plot(){if(this.curved)return zy(this._collection,this.closed),this;for(let n=0;n<this._collection.length;n++)this._collection[n].command=n===0?de.move:de.line;return this}smooth(n){const r=n||{},o=r.type||"continuous",s=this._collection,a=s.length;if(a<2)return this;const l=this._closed||a>0&&s[a-1]&&s[a-1].command===de.close,c=(m,p)=>{if(m==null)return p;if(typeof m=="number"){if(l)return Wt(m,a);let y=m;return y<0&&(y+=a),Math.min(Math.max(y,0),a-1)}const g=s.indexOf(m);return g!==-1?g:p},d=l&&r.from===void 0&&r.to===void 0;let u=c(r.from,0),h=c(r.to,a-1);if(u>h)if(l)u-=a;else{const m=u;u=h,h=m}const f=h-u+1;for(let m=0;m<f;m+=1){const p=Wt(u+m,a),g=s[p],y=!l&&p===0;g.command===de.move&&!y&&(g.command=de.line)}if(o==="continuous"||o==="asymmetric")u0(s,u,h,l,d,o==="asymmetric");else if(o==="catmull-rom"||o==="geometric"){const m={type:o,factor:r.factor};m0(s,u,h,l,d,m)}else throw new Error(`Path.smooth does not support type "${o}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(n){this._update();const r=this.vertices,o=r.length;if(o<2)return this;const s=[];let a=null,l=null;for(let c=0;c<o;c+=1){const d=r[c];if(!a||d.command===de.move){const h=d.clone();s.push(h),a=d,l=d;continue}if(c0(d,a)){const f=Gs(d,a,n).length,m=s[s.length-1];let p=m.clone(),g=d.clone(),y=m,b=0;if(f<=1){const _=d.clone();s.push(_)}else{for(let k=1;k<f;k+=1){const x=k/f,C=1-b,N=C<=Number.EPSILON?x:(x-b)/C,w=d0(p,g,N);un(y,"right",w.startOut.x-y.x,w.startOut.y-y.y);const S=w.anchor;s.push(S),y=S,p=S.clone(),b=x,un(g,"left",w.endIn.x-g.x,w.endIn.y-g.y)}const _=d.clone();_.controls.left.copy(g.controls.left),s.push(_)}}else{const h=Gs(d,a,n);for(let m=1;m<h.length;m+=1){const p=h[m];Bd(p,a),jt(p,"left"),jt(p,"right"),p.command=de.line,s.push(p)}const f=d.clone();s.push(f)}a=d,d.command===de.close&&(a=l)}return this._automatic=!1,this._curved=!1,this.vertices=s,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=[]),je.each(this.vertices,function(c,d){if(d<=0||c.command===de.move){a=c,this._lengths[d]=0;return}this._lengths[d]=xd(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=Ro(this,o*this._length),l=Ro(this,s*this._length),c=p0(a),d=g0(l);let u,h,f,m,p,g;for(this._renderer.vertices.length=0,g=0;g<n;g++)this._renderer.collection.length<=g&&this._renderer.collection.push(new Me),g>d&&!h?(p=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(s,p),p.command=this._renderer.collection[g].command,this._renderer.vertices.push(p),h=p,f=this._collection[g-1],f&&f.controls&&(p.relative?p.controls.right.clear():p.controls.right.copy(p),f.relative?this._renderer.collection[g-1].controls.right.copy(f.controls.right).lerp(me.zero,1-p.t):this._renderer.collection[g-1].controls.right.copy(f.controls.right).lerp(f,1-p.t))):g>=c&&g<=d&&(p=this._renderer.collection[g].copy(this._collection[g]),this._renderer.vertices.push(p),g===d&&wd(this,s)?(h=p,!r&&h.controls&&(h.relative?h.controls.right.clear():h.controls.right.copy(h))):g===c&&wd(this,o)&&(u=p,u.command=de.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(g=c-1,p=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(o,p),p.command=de.move,this._renderer.vertices.unshift(p),m=this._collection[g+1],m&&m.controls&&(p.controls.left.clear(),m.relative?this._renderer.collection[g+1].controls.left.copy(m.controls.left).lerp(me.zero,p.t):(y0.copy(m),this._renderer.collection[g+1].controls.left.copy(m.controls.left).lerp(m,p.t))))}return Bn.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,Bn.prototype.flagReset.call(this),this}};T(mn,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),T(mn,"Utils",{getCurveLength:xd});let Ae=mn;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}},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 ut||this._fill instanceof Ft||this._fill instanceof Vt||this._fill instanceof Ze)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ft||this._fill instanceof Vt||this._fill instanceof Ze)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof ut||this._stroke instanceof Ft||this._stroke instanceof Vt||this._stroke instanceof Ze)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ft||this._stroke instanceof Vt||this._stroke instanceof Ze)&&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";je.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 xi?this._collection=t:this._collection=new xi(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,je.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 $d(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Rd(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Ed(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Pd(){this._flagFill=!0}function Fd(){this._flagStroke=!0}const _0=Math.ceil,w0=Math.floor,Fn=class Fn extends Bn{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 Vd)Object.defineProperty(this,r,Vd[r]);this._renderer.type="points",this._renderer.flagVertices=$d.bind(this),this._renderer.bindVertices=Rd.bind(this),this._renderer.unbindVertices=Ed.bind(this),this._renderer.flagFill=Pd.bind(this),this._renderer.flagStroke=Fd.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:vi(n.fill),o=typeof n.stroke=="string"?n.stroke:vi(n.stroke),s=new Fn().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 Me?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Me().copy(o))}for(let r=0;r<Fn.Properties.length;r++){const o=Fn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Fn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Fn.Properties.length;o++){const s=Fn.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()),je.each(Fn.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"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(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=ud(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=Ro(this,n*this._length),s=Ro(this,r*this._length),a=_0(o),l=w0(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(Fn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let Ao=Fn;const Vd={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 ut||this._fill instanceof Ft||this._fill instanceof Vt||this._fill instanceof Ze)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ft||this._fill instanceof Vt||this._fill instanceof Ze)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof ut||this._stroke instanceof Ft||this._stroke instanceof Vt||this._stroke instanceof Ze)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ft||this._stroke instanceof Vt||this._stroke instanceof Ze)&&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 xi?this._collection=t:this._collection=new xi(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 Md extends xi{constructor(n){n=Array.isArray(n)?n:Array.prototype.slice.call(arguments);super(n);yl(this,cs,{});this.attach(n),this.on(ne.Types.insert,this.attach),this.on(ne.Types.remove,this.detach)}get ids(){return Ot(this,cs)}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}}cs=new WeakMap;const qn=class qn extends Ae{constructor(n,r,o,s,a,l,c){const d=c||So.Resolution*3,u=[];for(let h=0;h<d;h++)u.push(new Me);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",Ut);T(this,"_innerRadius",0);T(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let h in Ad)Object.defineProperty(this,h,Ad[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 qn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<qn.Properties.length;r++){const o=qn.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=Wt(n,Ut)===Wt(r,Ut),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,h=0,f,m,p,g,y,b,_,k,x;for(a?d--:l||(d-=2),f=0,m=d-1;f<d;f++){switch(p=f/m,g=c[h],y=p*(r-n)+n,b=(r-n)/d,_=s*Math.cos(y),k=s*Math.sin(y),f){case 0:u=de.move;break;default:u=de.curve}g.command=u,g.x=_,g.y=k,g.controls.left.clear(),g.controls.right.clear(),g.command===de.curve&&(x=s*b/Math.PI,g.controls.left.x=x*Math.cos(y-pt),g.controls.left.y=x*Math.sin(y-pt),g.controls.right.x=x*Math.cos(y+pt),g.controls.right.y=x*Math.sin(y+pt),f===1&&g.controls.left.multiplyScalar(2),f===m&&g.controls.right.multiplyScalar(2)),h++}if(l){for(a?(c[h].command=de.close,h++):(d--,m=d-1),f=0;f<d;f++)p=f/m,g=c[h],y=(1-p)*(r-n)+n,b=(r-n)/d,_=o*Math.cos(y),k=o*Math.sin(y),u=de.curve,f<=0&&(u=a?de.move:de.line),g.command=u,g.x=_,g.y=k,g.controls.left.clear(),g.controls.right.clear(),g.command===de.curve&&(x=o*b/Math.PI,g.controls.left.x=x*Math.cos(y+pt),g.controls.left.y=x*Math.sin(y+pt),g.controls.right.x=x*Math.cos(y-pt),g.controls.right.y=x*Math.sin(y-pt),f===1&&g.controls.left.multiplyScalar(2),f===m&&g.controls.right.multiplyScalar(2)),h++;c[h].copy(c[0]),c[h].command=de.line}else a||(c[h].command=de.line,c[h].x=0,c[h].y=0,h++,c[h].copy(c[0]),c[h].command=de.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 qn(0,0,r,o,s,a,l);c.translation.copy(this.translation),c.rotation=this.rotation,c.scale=this.scale,c.skewX=this.skewX,c.skewY=this.skewY,this.matrix.manual&&c.matrix.copy(this.matrix);for(let d=0;d<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<qn.Properties.length;r++){const o=qn.Properties[r];n[o]=this[o]}return n}};T(qn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let Js=qn;const Ad={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}}},ea=Math.cos,ta=Math.sin,Xn=class Xn 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 Me(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 Id)Object.defineProperty(this,c,Id[c]);typeof o=="number"&&(this.radius=o),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Xn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Xn.Properties.length;r++){const o=Xn.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*Ut,d=o*ea(c),u=o*ta(c),h=s*ea(c-pt),f=s*ta(c-pt),m=s*ea(c+pt),p=s*ta(c+pt),g=this.vertices[a];g.command=a===0?de.move:de.curve,g.set(d,u),g.controls.left.set(h,f),g.controls.right.set(m,p)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=new Xn(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<Xn.Properties.length;r++){const o=Xn.Properties[r];n[o]=this[o]}return n}};T(Xn,"Properties",["radius"]);let na=Xn;const Id={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},ia=Math.cos,ra=Math.sin,Yn=class Yn 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 Me);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 Od)Object.defineProperty(this,d,Od[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 Yn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Yn.Properties.length;r++){const o=Yn.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*Ut,d=o*ia(c),u=s*ra(c),h=o*r*ia(c-pt),f=s*r*ra(c-pt),m=o*r*ia(c+pt),p=s*r*ra(c+pt),g=this.vertices[a];g.command=a===0?de.move:de.curve,g.set(d,u),g.controls.left.set(h,f),g.controls.right.set(m,p)}}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 Yn(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<Yn.Properties.length;r++){const o=Yn.Properties[r];n[o]=this[o]}return n}};T(Yn,"Properties",["width","height"]);let oa=Yn;const Od={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}}},x0=Math.cos,k0=Math.sin,Un=class Un 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 zd)Object.defineProperty(this,a,zd[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 Un().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Un.Properties.length;r++){const o=Un.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=Ut*a+Math.PI/2,c=this._width*x0(l)/2,d=this._height*k0(l)/2;s>=o?this.vertices.push(new Me(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?de.move:de.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 Un(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<Un.Properties.length;r++){const o=Un.Properties[r];n[o]=this[o]}return n}};T(Un,"Properties",["width","height","sides"]);let sa=Un;const zd={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}}},Ii=class Ii extends Ae{constructor(n,r,o,s){const a=[new Me,new Me,new Me,new Me];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 Dd)Object.defineProperty(this,l,Dd[l]);this.width=typeof o=="number"?o:1,this.height=typeof s=="number"?s:1,this.origin=new me,typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(n){const r=new Ii().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Ii.Properties.length;r++){const o=Ii.Properties[r];o in n&&(typeof n[o]=="number"?this[o]=n[o]:this[o]instanceof me&&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 Me),this.vertices[0].set(-n,-r).sub(this._origin).command=de.move,this.vertices[1].set(n,-r).sub(this._origin).command=de.line,this.vertices[2].set(n,r).sub(this._origin).command=de.line,this.vertices[3].set(-n,r).sub(this._origin).command=de.line,this.vertices[4]&&(this.vertices[4].set(-n,-r).sub(this._origin).command=de.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=new Ii(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 me?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(Ii,"Properties",["width","height","origin"]);let Rr=Ii;const Dd={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},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()}}},Kn=class Kn 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 Me(0,0,0,0,0,0,c===0?de.move:de.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 Ld)Object.defineProperty(this,c,Ld[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=v0.bind(this),typeof o=="number"&&(this.width=o),typeof s=="number"&&(this.height=s),(typeof a=="number"||a instanceof me)&&(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 Kn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Kn.Properties.length;r++){const o=Kn.Properties[r];if(o in n){const s=n[o];/radius/i.test(o)?this[o]=typeof s=="number"||s instanceof me?s:new me().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 me?(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 Kn(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<Kn.Properties.length;r++){const o=Kn.Properties[r];n[o]=this[o]}return n.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),n}};T(Kn,"Properties",["width","height","radius"]);let aa=Kn;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}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof me&&this._radius.unbind(ne.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof me&&this._radius.bind(ne.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function v0(){this._flagRadius=!0}const C0=Math.cos,S0=Math.sin,Gn=class Gn 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 Hd)Object.defineProperty(this,l,Hd[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 Gn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Gn.Properties.length;r++){const o=Gn.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=Ut*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*C0(l),u=c*S0(l);s>=o?this.vertices.push(new Me(d,u)):this.vertices[s].set(d,u),this.vertices[s].command=s===0?de.move:de.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 Gn(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<Gn.Properties.length;r++){const o=Gn.Properties[r];n[o]=this[o]}return n}};T(Gn,"Properties",["innerRadius","outerRadius","sides"]);let la=Gn;const Hd={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 ca;const Wd=Math.min,jd=Math.max;Cn.document&&(ca=document.createElement("canvas"));const $t=class $t extends Bn{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 qd)Object.defineProperty(this,a,qd[a]);if(this._renderer.type="text",this._renderer.flagFill=B0.bind(this),this._renderer.flagStroke=T0.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,!je.isObject(s))return this;for(let a=0;a<$t.Properties.length;a++){const l=$t.Properties[a];l in s&&(this[l]=s[l])}}static Measure(n){if(ca){const r=ca.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*$t.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:vi(n.fill),o=typeof n.stroke=="string"?n.stroke:vi(n.stroke),s=new $t().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<$t.Properties.length;r++){const o=$t.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new $t(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<$t.Properties.length;o++){const s=$t.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<$t.Properties.length;r++){const o=$t.Properties[r];n[o]=this[o]}return n}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(n){let r,o,s,a,l;this._update(!0),r=n?this.matrix:this.worldMatrix;const{width:c,height:d}=$t.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),[m,p]=r.multiply(o,l),[g,y]=r.multiply(s,a),[b,_]=r.multiply(s,l);return a=Wd(f,p,y,_),o=Wd(h,m,g,b),s=jd(h,m,g,b),l=jd(f,p,y,_),{top:a,left:o,right:s,bottom:l,width:s-o,height:l-a}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};T($t,"Ratio",.6),T($t,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let sr=$t;const qd={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 ut||this._fill instanceof Ft||this._fill instanceof Vt||this._fill instanceof Ze)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ft||this._fill instanceof Vt||this._fill instanceof Ze)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof ut||this._stroke instanceof Ft||this._stroke instanceof Vt||this._stroke instanceof Ze)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ft||this._stroke instanceof Vt||this._stroke instanceof Ze)&&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,je.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 B0(){this._flagFill=!0}function T0(){this._flagStroke=!0}const Zn=class Zn extends Rr{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 Xd)Object.defineProperty(this,a,Xd[a]);this._renderer.flagTextures=N0.bind(this),this._renderer.bindTextures=$0.bind(this),this._renderer.unbindTextures=R0.bind(this),this.noStroke(),this.noFill(),Array.isArray(n)?this.textures=n.map(Yd.bind(this)):typeof n=="string"&&(this.textures=[Yd(n)]),this.origin=new me,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=Zn.DefaultFrameRate,this.index=0}static fromObject(n){const r=new Zn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Zn.Properties.length;r++){const o=Zn.Properties[r];o in n&&(this[o]=n[o])}return this}play(n,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=je.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 Zn(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,je.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=je.performance.now()-this._startTime,u=this._lastFrame+1,l=1e3*(u-this._firstFrame)/this._frameRate,this._loop?s=s%l:s=Math.min(s,l),d=Ht(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 Ze))&&(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(Zn,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),T(Zn,"DefaultFrameRate",30);let da=Zn;const Xd={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 xi((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 N0(){this._flagTextures=!0}function $0(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function R0(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Yd(t){if(t instanceof Ze)return t;if(typeof t=="string")return new Ze(t)}const Oi=class Oi extends Rr{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 Ud)Object.defineProperty(this,c,Ud[c]);this.noStroke(),this.noFill(),n instanceof Ze?this.texture=n:typeof n=="string"&&(this.texture=new Ze(n)),this.origin=new me,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 Oi().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Oi.Properties.length;r++){const o=Oi.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=je.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 Oi(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,m;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&&(je.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=je.performance.now()-this._startTime,m=this._lastFrame+1,d=1e3*(m-this._firstFrame)/this._frameRate,this._loop?l=l%d:l=Math.min(l,d),u=Ht(this._firstFrame,m,l/d),u=Math.floor(u),u!==this._index&&(this._index=u,u>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const p=this._index%r,g=Math.floor(this._index/r),y=-s*p+(h-s)/2,b=-a*g+(f-a)/2;y!==n.offset.x&&(n.offset.x=y),b!==n.offset.y&&(n.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};T(Oi,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let ua=Oi;const Ud={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}}},Io=Math.min,Oo=Math.max,E0={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},It=class It extends Bn{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 Kd)Object.defineProperty(this,r,Kd[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++)Gd.call(this,n[r],this)}static RemoveChildren(n){for(let r=0;r<n.length;r++)Gd.call(this,n[r])}static OrderChildren(n){this._flagOrder=!0}static fromObject(n){const r=new It;for(let s=0;s<It.Properties.length;s++){const a=It.Properties[s];a in n&&(/(fill|stroke)/i.test(a)?r[a]=typeof n[a]=="string"?n[a]:vi(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 Js.fromObject(s);case"circle":return na.fromObject(s);case"element":return $r.fromObject(s);case"ellipse":return oa.fromObject(s);case"group":return It.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return da.fromObject(s);case"path":return Ae.fromObject(s);case"points":return Ao.fromObject(s);case"polygon":return sa.fromObject(s);case"rectangle":return Rr.fromObject(s);case"rounded-rectangle":return aa.fromObject(s);case"shape":return Bn.fromObject(s);case"sprite":return ua.fromObject(s);case"star":return la.fromObject(s);case"text":return sr.fromObject(s)}return s}}static IsVisible(n,r){if(!r)return!0;let o=n;for(;o;){if(typeof o.visible=="boolean"&&!o.visible||typeof o.opacity=="number"&&o.opacity<=0)return!1;o=o.parent}return!0}static VisitForHitTest(n,r,o,s,a,l,c){const d=n&&n.children;if(!d)return!1;const u=r.results;for(let h=d.length-1;h>=0;h--){const f=d[h];if(!f||!It.IsVisible(f,r.visibleOnly))continue;const m=typeof f.getBoundingClientRect=="function"?f.getBoundingClientRect():null;if(!(m&&!a0(m,r.x,r.y,l))){if(f instanceof It){if(o&&(!s||s(f))&&typeof f.contains=="function"&&f.contains(r.x,r.y,a)&&(u.push(f),c)||It.VisitForHitTest(f,r,o,s,a,l,c))return!0;continue}if(f instanceof Bn&&!(s&&!s(f))&&typeof f.contains=="function"&&f.contains(r.x,r.y,a)&&(u.push(f),c))return!0}}return!1}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<It.Properties.length;r++){const o=It.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new It,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,je.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}getShapesAtPoint(n,r,o){const s=o||{},{results:a,hitOptions:l,context:c,single:d,empty:u}=E0.getShapesAtPoint;a.length=0;const h=s.mode==="deepest"||s.deepest?"deepest":"all",f=s.visibleOnly!==!1,m=!!s.includeGroups,p=typeof s.filter=="function"?s.filter:null,g=typeof s.tolerance=="number"?s.tolerance:0;typeof s.precision=="number"?l.precision=s.precision:delete l.precision,typeof s.fill<"u"?l.fill=s.fill:delete l.fill,typeof s.stroke<"u"?l.stroke=s.stroke:delete l.stroke,l.tolerance=g,l.ignoreVisibility=!f;const y=h==="deepest";if(c.x=n,c.y=r,c.visibleOnly=f,c.results=a,It.VisitForHitTest(this,c,m,p,l,g,y),y){if(a.length>0){const _=a[0];return a.length=0,d[0]=_,d.length=1,d}return u.length=0,u}const b=a.slice();return a.length=0,b}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 m=/texture|gradient/i;o=n?this.matrix:this.worldMatrix;for(let p=0;p<this.children.length;p++){const g=this.children[p];if(!(!g.visible||m.test(g._renderer.type))&&(r=g.getBoundingClientRect(n),s=typeof r.top!="number"||je.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||je.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||je.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||je.isNaN(r.bottom)||!isFinite(r.bottom),!(s||a||l||c)))if(n){const[y,b]=o.multiply(r.left,r.top),[_,k]=o.multiply(r.right,r.top),[x,C]=o.multiply(r.left,r.bottom),[N,w]=o.multiply(r.right,r.bottom);h=Io(b,k,C,w,h),d=Io(y,_,x,N,d),u=Oo(y,_,x,N,u),f=Oo(b,k,C,w,f)}else h=Io(r.top,h),d=Io(r.left,d),u=Oo(r.right,u),f=Oo(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(It,"Children",Md),T(It,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let Ln=It;const Kd={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=Ln.InsertChildren.bind(this),n=Ln.RemoveChildren.bind(this),r=Ln.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new Md(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,je.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 Gd(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 zo extends Ae{constructor(e,n,r,o){const s=[new Me(e,n),new Me(r,o)];super(s);for(let a in Zd)Object.defineProperty(this,a,Zd[a]);this.vertices[0].command=de.move,this.vertices[1].command=de.line,this.automatic=!1}}T(zo,"Properties",["left","right"]);const Zd={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if(je.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=de.move;else{const e=new No("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(je.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=de.line;else{const e=new No("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class fa{constructor(e=0,n=0){this.x=e,this.y=n}}class Tn{constructor(e=10,n=0,r="A"){T(this,"start",new fa);T(this,"end",new fa);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"}},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:"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 Do=i.markRaw({name:"ion-close",render:F0}),V0={class:"mr-3 flex flex-col gap-2"},M0=["onClick"],A0={class:"h-full p-2"},I0={},O0=i.defineComponent({...I0,__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 m;const f=(m=o.value)==null?void 0:m.at(h);f&&a("init-draw-template",f,u)}),(d=n.settings.customTemplates)==null||d.forEach((u,h)=>{var m;const f=(m=s.value)==null?void 0:m.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 m=(f=s.value)==null?void 0:f.at(h);m&&a("init-draw-template",m,u)}}),d.length>c.length&&d.forEach((u,h)=>{var m;const f=(m=s.value)==null?void 0:m.at(h);f&&(f.innerHTML="",a("init-draw-template",f,u))})})},{deep:!0}),(c,d)=>{const u=Do;return i.openBlock(),i.createBlock(i.unref(z.NScrollbar),{style:{width:"auto"},trigger:"none",class:"max-h-[19rem] md:max-h-[40rem] w-auto"},{default:i.withCtx(()=>[i.createElementVNode("div",V0,[(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(z.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:m=>a("template:select",f)},[i.createElementVNode("div",A0,[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,M0)]),default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(h.label),1)]),_:2},1024),h.isCustom&&!h.isNewRec()?(i.openBlock(),i.createBlock(i.unref(z.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:m=>l(f)},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),Qd=An(O0,[["__scopeId","data-v-afccb364"]]),z0={class:"flex gap-3 min-w-[20rem] relative"},D0={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},L0={ref:"drawing-container",class:"size-full"},H0={},Jd=i.defineComponent({...H0,__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((O,P)=>new Tn(n.value.configuratorParams.linesWidths[P],O,`A-${P+1}`))),h=i.computed(()=>n.value.configuratorParams.colorSide==="bottom"),f=i.computed(()=>{var O,P;return n.value.configuratorParams.startTailType&&((O=n.settings.startTailConfigs)!=null&&O[n.value.configuratorParams.startTailType])?(P=n.settings.startTailConfigs)==null?void 0:P[n.value.configuratorParams.startTailType].points:[]}),m=i.computed(()=>{var P;const O=n.value.configuratorParams.endTailType!==void 0&&((P=n.settings.endTailConfigs)==null?void 0:P[n.value.configuratorParams.endTailType]);return!O||!O.points?[]:O.points.map((V,M)=>Array.isArray(V)?new Tn(V[0],V[1],`A-${M+1}`):new Tn(V.width,V.angle,`A-${M+1}`))}),p=(O,P=!1)=>{O[0].start.x=0,O[0].start.y=0;let V=0;for(let M=0;M<O.length;M++){const L=O[M],Y=O[M-1]??new Tn(0,V);V+=!P||M>1?Y.angle:0;const U=(!P||M>0?L.angle:0)+V;if(O[M].end.x=L.width*Math.cos(U*Math.PI/180)+O[M].start.x,O[M].end.y=L.width*Math.sin(U*Math.PI/180)+O[M].start.y,M<O.length-1){const G=M+1;O[G].start.x=O[M].end.x,O[G].start.y=O[M].end.y}}return O},g=(O,P,V,M,L=!1)=>{let Y=p([...V,...M]);P.length>0&&(Y=[...p(P),...Y]);let U=0,G=0,q=0,W=0;Y.forEach(ve=>{U=Math.min(U,ve.start.x,ve.end.x),G=Math.min(G,ve.start.y,ve.end.y),q=Math.max(q,ve.start.x,ve.end.x),W=Math.max(W,ve.start.y,ve.end.y)});let K,ue;U===0&&G===0&&q===0&&W===0?(K=1,ue=1):(K=O.width/Math.abs(q-U),ue=(L?O.height:O.height-qe.colorSideLabel.size)/Math.abs(W-G));const ye=Math.min(K,ue);return U=U<0?-U*ye:0,G=G<0?-G*ye:0,[ye,U,G]},y=O=>{const P=new Ao([O]);return P._size=qe.anchorPoint.size,P.fill=qe.anchorPoint.color,P.stroke="transparent",P._linewidth=qe.anchorPoint.strokeSize,l.push(P),P},b=(O,P)=>{if(l=[],n.settings.allowChangeFirstPoint){const V=O[0],M=new me(V.vertices[0].x,V.vertices[0].y);M.bind(ne.Types.change,()=>{V.vertices[0].copy(M)});const L=y(M);P.add(L)}O.forEach((V,M)=>{const L=O[M+1],Y=new me(V.vertices[1].x,V.vertices[1].y);Y.bind(ne.Types.change,()=>{V.vertices[1].copy(Y),L!==void 0&&L.vertices[0].copy(Y)});const U=y(Y);P.add(U)})},_=O=>O*(Math.PI/180),k=(O,P,V)=>{const M=P.vertices.length-1;O.position.x=P.vertices[M].x,O.position.y=P.vertices[M].y;const L=Math.atan2(P.vertices[M].y-P.vertices[0].y,P.vertices[M].x-P.vertices[0].x);O.rotation=_(V)+L},x=(O,P,V)=>{if(P.vertices[0]===void 0)return;O.position.x=P.vertices[0].x,O.position.y=P.vertices[0].y;const M=P.vertices.length-1,L=Math.atan2(P.vertices[M].y-P.vertices[0].y,P.vertices[M].x-P.vertices[0].x);O.rotation=_(V)+L},C=(O,P,V)=>{const M=new Ln;if(O.length===0)return M;const L=[];return[...O].reverse().forEach((Y,U)=>{U!==0&&Y.angle>0&&(Y.angle*=-1),L.push(Y)}),O=p(L,!0),x(M,P,O[0].angle),[P.vertices[0],P.vertices[1]].forEach(Y=>{Y.bind(ne.Types.change,()=>{x(M,P,O[0].angle)})}),O.forEach(Y=>{const U=Y.start.x*V,G=Y.end.x*V,q=Y.start.y*V,W=Y.end.y*V,K=new zo(U,q,G,W);K.linewidth=qe.line.size,K.stroke=qe.line.color,M.add(K)}),M},N=(O,P,V)=>{const M=new Ln;return O.length===0||(O=p(O,!0),k(M,P,O[0].angle),[P.vertices[0],P.vertices[1]].forEach(L=>{L.bind(ne.Types.change,()=>{k(M,P,O[0].angle)})}),O.forEach(L=>{const Y=L.start.x*V,U=L.end.x*V,G=L.start.y*V,q=L.end.y*V,W=new zo(Y,G,U,q);W.linewidth=qe.line.size,W.stroke=qe.line.color,M.add(W)})),M},w=(O,P,V,M)=>{const L=P.vertices[0].x+(P.vertices[1].x-P.vertices[0].x)/2-8*Math.sin(O.angle*Math.PI/180),Y=P.vertices[0].y+(P.vertices[1].y-P.vertices[0].y)/2-8*Math.cos(O.angle*Math.PI/180),U=new sr(O.label,L+10,Y-10);let G;U.size=qe.lineLabel.size,U.weight=600,U.fill=qe.lineLabel.color,U.id+=1,U.rotation=qe.lineLabel.rotation,M>0&&(G=new sr(`${O.angle}°`,P.vertices[0].x+25,P.vertices[0].y-25),G.size=qe.angleLabel.size,G.weight=600,G.fill=qe.angleLabel.color,G.rotation=qe.angleLabel.rotation,G.id+=M,s.push(G),V.add(G)),V.add(U),v(U,P,0,G),v(U,P,1)},S=()=>{const{size:O}=qe.colorSideLabel,P=0,V=0,M=h.value?O/2:O/2-O,L=h.value?O/2-O:O/2,Y=new Ln;if(!c)return Y;const U=5,G=Math.atan2(L-M,V-P),q=[new Me(P,M,0,0,0,0,vn.Commands.move),new Me(V,L,0,0,0,0,vn.Commands.line),new Me(V-U*Math.cos(G-Math.PI/4),L-U*Math.sin(G-Math.PI/4),0,0,0,0,vn.Commands.line),new Me(V,L,0,0,0,0,vn.Commands.move),new Me(V-U*Math.cos(G+Math.PI/4),L-U*Math.sin(G+Math.PI/4),0,0,0,0,vn.Commands.line)],W=new Ae(q,!1,!1,!0);W.noFill(),W.cap="round",W.join="round",W.linewidth=O/7,W.stroke=qe.colorSideLabel.color,Y.add(W);const K=new sr(h.value?"Цвет снизу":"Цвет сверху",10,0);K.size=O,K.weight=600,K.fill=qe.colorSideLabel.color,K.alignment="left",Y.add(K);const ue=Y.getBoundingClientRect();return Y.position.x=(c.width-ue.width)*d+10,Y.position.y=h.value?c.height+ue.height*2:ue.height/2,Y},v=(O,P,V,M)=>{P.vertices[V].bind(ne.Types.change,()=>{const L=P.vertices.length-1,Y=Math.atan2(P.vertices[0].y-P.vertices[L].y,P.vertices[0].x-P.vertices[L].x)*180/Math.PI,U=P.vertices[0].x+(P.vertices[L].x-P.vertices[0].x)/2-8*Math.sin(Y*Math.PI/180),G=P.vertices[0].y+(P.vertices[L].y-P.vertices[0].y)/2-8*Math.cos(Y*Math.PI/180);O.position.x=U+10,O.position.y=G-10,O.rotation=-.5,M&&(M.position.x=P.vertices[0].x+25,M.position.y=P.vertices[0].y-25)})},$=(O,P,V,M,L=!1)=>{var ot;if(O.clear(),V.length===0){O.update();return}const Y=p(V),[U,G,q]=g(O,P,Y,M,L),W=new Ln,K=new Array,ue=new Array;L||(s=[],a=[]),Y.forEach((_e,we)=>{const wt=_e.start.x*U+G,$e=_e.end.x*U+G,Gt=_e.start.y*U+q,pn=_e.end.y*U+q,Rt=new zo(wt,Gt,$e,pn);Rt.linewidth=L?qe.previewLine.size:qe.line.size,Rt.stroke=L?qe.previewLine.color:qe.line.color,a.push(Rt),K.push(Rt),W.add(Rt),!L&&_e.label!==""&&w(_e,Rt,W,we)});const ye=K.at(-1);let ve=W.getBoundingClientRect();if(!L){const _e=S();ue.push(_e)}if(P.length>0){const _e=C(P,K[0],U);W.add(_e)}if(M.length>0&&ye){const _e=N(M,ye,U);W.add(_e)}if(ue.push(W),O.makeGroup(ue),ve=W.getBoundingClientRect(),W.position.x=0-ve.left+(O.width-ve.width)/(2*(L?1:d)),W.position.y=0-ve.top+(O.height-ve.height)/(2*(L?1:d)),O.update(),!L){const _e=((ot=n.value.configuratorParams)==null?void 0:ot.colorSide)==="top";W.position.y=W.position.y+qe.colorSideLabel.size*Number(_e),b(K,W),O.update()}},E=(O,P)=>{if(O&&!P.isNewRec()){const V=new vn({width:O.scrollWidth,height:O.scrollHeight});V.appendTo(O),$(V,[],P.points,[],!0)}},A=()=>{c&&$(c,f.value,u.value,m.value,!1)},R=O=>O*(180/Math.PI),F=(O,P)=>{const V=O[1].x-O[0].x,M=O[1].y-O[0].y,L=P[1].x-P[0].x,Y=P[1].y-P[0].y;let U=Math.atan2(V*Y-M*L,V*L+M*Y);return U=R(U),Math.round(U)*-1},H=O=>{const P=a.map((V,M,L)=>{const Y=L[M-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let U=Math.ceil(V._length/O/n.settings.lineWidthStep)*n.settings.lineWidthStep;const G=s[M-1];U<(L.length>1?n.settings.minLineWidth:n.settings.stripMinWidth)&&(U=L.length>1?n.settings.minLineWidth:n.settings.stripMinWidth),U>n.settings.maxLineWidth&&(U=n.settings.maxLineWidth);const q=F(V.vertices,Y.vertices);return G&&(G.value=`${q}°`),new Tn(U,q,`A-${M+1}`)});r("pointer:move",P)},Q=O=>{let P=null,V;const M=G=>{P=l.find(q=>{const W=q.renderer;return(W==null?void 0:W.elem)===G.target}),[V]=g(O,f.value,u.value.map(q=>q),m.value)},L=G=>{if(P){const q=P.renderer,W=q==null?void 0:q.elem;if(!W)return;const K=W.getBoundingClientRect();P.vertices[0].x-=K.x-(G instanceof MouseEvent?G.clientX:G.targetTouches[0].clientX)+qe.anchorPoint.size/2,P.vertices[0].y-=K.y-(G instanceof MouseEvent?G.clientY:G.targetTouches[0].clientY)+qe.anchorPoint.size/2,H(V),O.update()}},Y=()=>{P&&r("pointer:up",u.value),P=null},U=o.value;U&&(U.addEventListener("touchstart",M,{passive:!0}),U.addEventListener("touchend",Y,{passive:!0}),U.addEventListener("mousedown",M),U.addEventListener("mouseup",Y),U.addEventListener("mousemove",L),U.addEventListener("touchmove",L,{passive:!0}))},Z=(O,P)=>{r("remove-custom-template",O,P)};return i.onMounted(()=>{o.value&&(c=new vn({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),i.watch(()=>n.value,()=>{A()},{deep:!0,immediate:!0}),Q(c))}),i.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(O,P)=>(i.openBlock(),i.createElementBlock("div",z0,[i.createVNode(Qd,{"select-template-index":t.selectTemplateIndex,settings:t.settings,"onTemplate:select":P[0]||(P[0]=V=>r("template:select",V)),onInitDrawTemplate:E,onRemoveCustomTemplate:Z},null,8,["select-template-index","settings"]),i.createElementVNode("div",D0,[i.createElementVNode("div",L0,null,512)])]))}});class ar 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)=>D.isArray(o)?new Tn(o[0],o[1],`A-${s+1}`):new Tn(o.width,o.angle,`A-${s+1}`)),this.isCustom=n.isCustom):(this.label="-- Новая конфигурация --",this.points=[new Tn(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class ha extends ar{constructor(n){super(n);T(this,"isDefault");this.isDefault=n.isDefault??!1}}class eu{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 ar(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((n=e.startTailConfigs)==null?void 0:n.map(o=>new ha(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new ha(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 ar(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new ar({label:"-- Новая конфигурация --",points:[new Tn(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 ar(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 W0={class:"flex flex-col gap-3"},j0={class:"grid gap-5 md:grid-cols-5"},q0={},tu=i.defineComponent({...q0,__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 eu(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"),m=(v=0)=>{var E;const $=(E=c.value.allTemplates)==null?void 0:E.at(v);$!==void 0&&(h.value=v,l.value.configuratorParams.linesWidths=$.points.map(A=>D.isArray(A)?A[0]:A.width),l.value.configuratorParams.linesAngles=$.points.map(A=>D.isArray(A)?A[1]:A.angle),k()),b(l.value.configuratorParams)},p=async()=>{const v=prompt("Введите название шаблона:");if(!v)return;a.value=!0;const $={label:v,points:l.value.configuratorParams.linesWidths.map((A,R)=>[A,l.value.configuratorParams.linesAngles[R]])},E=A=>{A&&(c.value.addCustomTemplate($),h.value=c.value.allTemplates.length-2),a.value=!1};n.eventEmitter.emit("configurator:create-template",{category:n.cartItem.category,template:$,callback:E})},g=async(v,$)=>{var R;const E=(R=c.value.allTemplates)==null?void 0:R.at(v);if(!E||!E.isCustom)return;const A=F=>{F&&(c.value.removeCustomTemplate(E.id),m()),$==null||$()};n.eventEmitter.emit("configurator:remove-template",{category:n.cartItem.category,templateId:E.id,callback:A})},y=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(h.value=c.value.allTemplates.length-1)},b=async v=>{var $,E;l.value.product=new j.ClientProduct,(E=($=f.value)==null?void 0:$.formReference)==null||E.validate(A=>{A||(k(),o.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:v,validationFieldResultData:u.value,callback:R=>{R?l.value.product=R:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(D.noop)},_=async()=>{var v,$;($=(v=f.value)==null?void 0:v.formReference)==null||$.validate(E=>{var A,R;if(!E){s.value=!0;const F=new j.OrderItemBase(l.value);(A=c.value.startTailConfigs)!=null&&A.length||delete F.configuratorParams.startTailType,(R=c.value.endTailConfigs)!=null&&R.length||delete F.configuratorParams.endTailType,r("submit",F,u.value,()=>{s.value=!1,i.nextTick(()=>{var H,Q;(Q=(H=f.value)==null?void 0:H.formReference)==null||Q.restoreValidation()})})}}).catch(D.noop)},k=()=>{const v={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach(($,E)=>{v[`lines_widths[${E+1}]`]={},v[`lines_angles[${E+1}]`]={}}),u.value=v},x=v=>{d.value.linesWidths=v.map($=>$.width),d.value.linesAngles=v.map($=>$.angle)},C=v=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,k(),y(),b(l.value.configuratorParams)},N=(v,$)=>{d.value.linesWidths=v,d.value.linesAngles=$},w=v=>{const $=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,E=0;l.value.configuratorParams.linesWidths.splice(v+1,0,$),l.value.configuratorParams.linesAngles.splice(v+1,0,E),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],k(),y(),b(l.value.configuratorParams)},S=v=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(v,1),l.value.configuratorParams.linesAngles.splice(v,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],k(),y(),b(l.value.configuratorParams))};return i.onMounted(()=>{n.cartItem.isNewRec()?m():(k(),h.value=-1,b(l.value.configuratorParams))}),i.watch(()=>n.cartItem,v=>{l.value=new j.OrderItemBase(v),v.isNewRec()?m():(k(),h.value=-1,b(l.value.configuratorParams))}),(v,$)=>{const E=z.NButton;return i.openBlock(),i.createElementBlock("div",W0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(E,{key:0,type:"tertiary",class:"self-end",onClick:$[0]||($[0]=A=>r("click:view-switch"))},{default:i.withCtx(()=>[...$[3]||($[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",j0,[i.createVNode(Jd,{value:l.value,"select-template-index":h.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":C,"onPointer:move":x,"onTemplate:select":m,onRemoveCustomTemplate:g},null,8,["value","select-template-index","settings"]),i.createVNode(Fl,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":$[1]||($[1]=A=>l.value=A),"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":$[2]||($[2]=A=>b(A)),"onUpdate:preview":N,onSubmit:_,"onClick:saveTemplate":p,"onClick:addLine":w,"onClick:removeLine":S},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),X0={class:"flex flex-col items-center justify-between rounded-xl"},Y0={class:"img-preview relative flex justify-center"},U0={},K0=i.defineComponent({...U0,__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;return D.keys(n.settings.crossbarCount).reverse().find(a=>s>=n.settings.crossbarCount[Number(a)])}),o=e;return(s,a)=>{const l=z.NButton;return i.openBlock(),i.createElementBlock("div",X0,[i.createElementVNode("div",Y0,[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})])}}}),ma=An(K0,[["__scopeId","data-v-2a790a20"]]),G0={key:0,class:"flex items-baseline gap-1"},Z0={key:0,class:"flex items-baseline gap-1"},Q0={key:1},J0={class:"text-lg font-semibold"},eb={key:2,class:"text-red-500 text-sm mb-2"},tb={class:"flex gap-3"},nb={},nu=i.defineComponent({...nb,__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(()=>it.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(D.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),m=i.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),p=i.computed(()=>r.settings.maxHeights[u.value.configuratorParams.netType]),g=i.computed(()=>u.value.configuratorParams.width?u.value.configuratorParams.width+h.value:0),y=i.computed(()=>u.value.configuratorParams.height?u.value.configuratorParams.height+f.value:0),b=i.ref(r.settings.canSetDopProdaga??!1),_=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth-h.value),ae.max(m.value-h.value),ae.step(1),We.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[ae.required,ae.min(r.settings.minHeight-f.value),ae.max(p.value-f.value),ae.step(1),We.serverValidation(r.validation.height.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]})),k=i.computed(()=>{var R;const S=g.value,v=y.value,{quantity:$}=r.value,E=((R=r.value.product)==null?void 0:R.costRub)||0;if(!S||!v||!$||E===0)return null;const A=S*v/1e6;return(E*$*A).toLocaleString("ru-ru",{minimumFractionDigits:2})}),x=i.computed(()=>{const S=g.value,v=y.value,$=!!(S&&S>=r.settings.minWidth&&S<=r.settings.maxWidths[u.value.configuratorParams.netType]),E=!!(v&&v>=r.settings.minHeight&&v<=r.settings.maxHeights[u.value.configuratorParams.netType]),A=!!(r.value.quantity&&r.value.quantity>0);return $&&E&&A}),C=(S,v)=>{var A,R;const $=u.value.configuratorParams;S&&S in $&&($[S]=v);const E={...$,width:g.value??0,height:y.value??0};S==="width"&&((A=l.value)==null||A.validate().catch(D.noop)),S==="height"&&((R=c.value)==null||R.validate().catch(D.noop)),i.nextTick(()=>{var H,Q;!((H=l.value)!=null&&H.validationErrored)&&!((Q=c.value)!=null&&Q.validationErrored)&&E.height&&E.width&&o("update:params",E),N("configuratorParams",E)})},N=(S,v)=>{const $=new j.OrderItemBase(r.value);$[S]=v,S==="configuratorParams"&&($.product=new j.ClientProduct),o("update:value",$)};return i.watch(()=>r.value,S=>{const v=D.cloneDeep(i.toRaw(S)),$=v.configuratorParams.mountType,E=r.settings.widthOverlaps[$]??0,A=r.settings.heightOverlaps[$]??0;v.configuratorParams.width&&v.configuratorParams.width>0&&(v.configuratorParams.width-=E),v.configuratorParams.height&&v.configuratorParams.height>0&&(v.configuratorParams.height-=A),u.value=v},{deep:!0,immediate:!0}),i.onMounted(()=>{var S;(S=d.value)==null||S.select()}),e({validate:(w=a.value)==null?void 0:w.validate,formReference:a}),(S,v)=>{const $=z.NCheckbox;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:u.value,rules:_.value,class:"flex flex-col gap-2 px-4 md:max-w-96 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:u.value.configuratorParams.netType,"onUpdate:value":[v[0]||(v[0]=E=>u.value.configuratorParams.netType=E),v[1]||(v[1]=E=>C("netType",E))],options:t.settings.netType.map(E=>({label:t.settings.descriptions.net_type[E],value:E}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:u.value.configuratorParams.color,"onUpdate:value":[v[2]||(v[2]=E=>u.value.configuratorParams.color=E),v[3]||(v[3]=E=>C("color",E))],options:t.settings.color.map(E=>({label:t.settings.descriptions.color[E],value:E}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:u.value.configuratorParams.mountType,"onUpdate:value":[v[4]||(v[4]=E=>u.value.configuratorParams.mountType=E),v[5]||(v[5]=E=>C("mountType",E))],options:t.settings.mountType.map(E=>({label:t.settings.descriptions.mount_type[E],value:E}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{ref:"width-form-item-reference",path:"configuratorParams.width",label:`Ширина светового проёма от ${t.settings.minWidth-h.value} ${m.value?" до "+(m.value-h.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.width.showFeedback&&g.value>=t.settings.minWidth&&g.value<=t.settings.maxWidths[u.value.configuratorParams.netType]?(i.openBlock(),i.createElementBlock("div",G0,[i.createVNode(i.unref(z.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Ширина готового изделия "+i.toDisplayString(g.value),1)]),_:1}),i.createVNode(i.unref(z.NButton),{quaternary:"",type:"info",size:"tiny",onClick:v[10]||(v[10]=E=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...v[25]||(v[25]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{ref:"width-input-reference",value:u.value.configuratorParams.width,"onUpdate:value":[v[6]||(v[6]=E=>u.value.configuratorParams.width=E),v[9]||(v[9]=E=>C("width",E))],parse:i.unref(lt),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:v[7]||(v[7]=E=>i.unref(st)(E)),onInput:v[8]||(v[8]=E=>i.unref(nt)(t.validation,"width")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(z.NFormItem),{ref:"height-form-item-reference",path:"configuratorParams.height",label:`Высота светового проёма от ${t.settings.minHeight-f.value} ${p.value?" до "+(p.value-f.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.height.showFeedback&&y.value>=t.settings.minHeight&&y.value<=t.settings.maxHeights[u.value.configuratorParams.netType]?(i.openBlock(),i.createElementBlock("div",Z0,[i.createVNode(i.unref(z.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Высота готового изделия "+i.toDisplayString(y.value),1)]),_:1}),i.createVNode(i.unref(z.NButton),{quaternary:"",type:"info",size:"tiny",onClick:v[15]||(v[15]=E=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...v[26]||(v[26]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[v[11]||(v[11]=E=>u.value.configuratorParams.height=E),v[14]||(v[14]=E=>C("height",E))],parse:i.unref(lt),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:v[12]||(v[12]=E=>i.unref(st)(E)),onInput:v[13]||(v[13]=E=>i.unref(nt)(t.validation,"height")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(z.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:u.value.quantity,"onUpdate:value":[v[16]||(v[16]=E=>u.value.quantity=E),v[19]||(v[19]=E=>N("quantity",E??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:v[17]||(v[17]=E=>i.unref(st)(E,!1)),onInput:v[18]||(v[18]=E=>i.unref(nt)(t.validation,"quantity")),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:v[20]||(v[20]=E=>i.unref(nt)(t.validation,"marker")),"onUpdate:value":v[21]||(v[21]=E=>{u.value.marker=E??null,N("marker",E??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),b.value?(i.openBlock(),i.createBlock($,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":v[22]||(v[22]=E=>{u.value.isAdditionalSale=E??!1,N("isAdditionalSale",E??!1)})},{default:i.withCtx(()=>[...v[27]||(v[27]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(Cr,{"is-product-searching":t.isProductSearching,product:u.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),k.value?(i.openBlock(),i.createElementBlock("div",Q0,[v[28]||(v[28]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",J0,i.toDisplayString(k.value)+" ₽",1)])):i.createCommentVNode("",!0),x.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",eb," Пожалуйста, заполните все обязательные поля корректно. ")),i.createElementVNode("div",tb,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!x.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:v[23]||(v[23]=E=>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(z.NButton),{key:0,type:"default",onClick:v[24]||(v[24]=E=>o("click:show-preview-drawer"))},{default:i.withCtx(()=>[...v[29]||(v[29]=[i.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1},8,["model","rules"])),[[i.unref(ei),()=>o("submit",u.value)]])}}}),ib="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",rb="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",ob="/img/configurators/mosquitto/measurement-instructions/mount.png",sb="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",ab="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",lb={class:"flex flex-col gap-6"},cb={class:"flex gap-4"},db={class:"flex flex-col gap-2"},ub={class:"flex gap-4"},fb={class:"flex flex-col gap-2"},hb={class:"flex gap-4"},mb={class:"flex flex-col gap-2"},pb={},iu=i.defineComponent({...pb,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(t,{emit:e}){const n=it.initRefDependingOnDeviceResolution("small","small","medium"),r=it.initRefDependingOnDeviceResolution(.98,.95,.8),o=i.computed(()=>window.innerWidth*r.value),s=e;return(a,l)=>{const c=z.NText;return i.openBlock(),i.createBlock(i.unref(z.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",lb,[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:ib,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:rb,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",cb,[l[9]||(l[9]=i.createElementVNode("img",{src:ob,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",db,[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",ub,[l[15]||(l[15]=i.createElementVNode("img",{src:sb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",fb,[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",hb,[l[21]||(l[21]=i.createElementVNode("img",{src:ab,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",mb,[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"])}}}),gb={class:"grid md:grid-cols-2"},yb={},ru=i.defineComponent({...yb,__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(()=>it.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)),m=D.debounce(async g=>{var y,b;l.value.product=new j.ClientProduct,(b=(y=c.value)==null?void 0:y.formReference)==null||b.validate(_=>{_||(u.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:g,validationFieldResultData:d.value,callback:k=>{k?l.value.product=k:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(D.noop)},f.value),p=()=>{h.value=!0,r("submit",l.value,d.value,()=>{h.value=!1})};return i.watch(()=>n.cartItem,g=>{l.value=g},{deep:!0}),(g,y)=>{const b=Do;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(iu,{show:a.value,"onUpdate:show":y[0]||(y[0]=_=>a.value=_),"height-overlaps":t.settings.heightOverlaps,"width-overlaps":t.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),i.createElementVNode("div",gb,[o.value?(i.openBlock(),i.createBlock(i.unref(z.NDrawer),{key:1,show:s.value,"onUpdate:show":y[4]||(y[4]=_=>s.value=_),"default-width":375,resizable:""},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NDrawerContent),null,{header:i.withCtx(()=>[i.createVNode(i.unref(z.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:y[2]||(y[2]=_=>s.value=!1)},{default:i.withCtx(()=>[i.createVNode(b)]),_:1})]),default:i.withCtx(()=>[i.createVNode(ma,{"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:y[3]||(y[3]=_=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(i.openBlock(),i.createBlock(ma,{key:0,"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:y[1]||(y[1]=_=>a.value=!0)},null,8,["configurator-params","settings"])),i.createVNode(nu,{ref:"mosquito-configurator-form",value:l.value,"onUpdate:value":y[5]||(y[5]=_=>l.value=_),validation:d.value,settings:t.settings,"is-product-searching":u.value,"is-submit-processing":h.value,"onUpdate:params":y[6]||(y[6]=_=>i.unref(m)(_)),onSubmit:y[7]||(y[7]=_=>p()),"onClick:instructionsToggle":y[8]||(y[8]=_=>a.value=!a.value),"onClick:showPreviewDrawer":y[9]||(y[9]=_=>s.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),bb={},ou=i.defineComponent({...bb,__name:"strip-configurator-line-item",props:{value:{},index:{},path:{},settings:{},product:{default:void 0},addLineButtonDisabled:{type:Boolean,default:!1},removeLineButtonDisabled:{type:Boolean,default:!1},suggestionOption:{default:void 0},autoFocus:{type:Boolean,default:!1},isLastLine:{type:Boolean,default:!1},validation:{}},emits:["update:value","click:add-line","click:remove-line"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.useTemplateRef("width-input-element"),a=i.ref(!1),l=i.ref(r.value),c=i.useTemplateRef("form-item-reference"),d=i.computed(()=>{var m;return!((m=c.value)!=null&&m.validationErrored)}),u=m=>{l.value=m,o("update:value",m,r.index,a)},h=m=>{st(m),(m.key==="Enter"||m.code==="Enter")&&!r.isLastLine&&(m.preventDefault(),m.stopPropagation())},f=()=>{var m;(m=s.value)==null||m.select()};return i.watch(()=>r.value,m=>{l.value=m}),i.onMounted(()=>{r.autoFocus&&i.nextTick(()=>{f()})}),e({isValid:d,formItemReference:c}),(m,p)=>{const g=Pl,y=io;return i.openBlock(),i.createBlock(i.unref(z.NFormItem),{ref:"form-item-reference",path:t.path,label:`Полоса №${t.index+1}, мм`,class:"sc-hide-empty-feedback-message"},{feedback:i.withCtx(()=>[d.value?(i.openBlock(),i.createBlock(Cr,{key:0,"is-product-searching":a.value,product:t.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(i.unref(z.NDropdown),{trigger:"click",options:t.suggestionOption,placement:"bottom-start",size:"large",onSelect:u},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{ref:"width-input-element",value:l.value??null,class:"w-full","show-button":!1,parse:i.unref(lt),placeholder:"Введите ширину",onKeydown:h,onInput:p[0]||(p[0]=b=>i.unref(nt)(t.validation,`linesWidths.${t.index}`)),onFocus:i.unref(Le),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),i.createVNode(i.unref(z.NButton),{disabled:t.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:p[1]||(p[1]=b=>o("click:add-line",t.index))},{default:i.withCtx(()=>[i.createVNode(g)]),_:1},8,["disabled"]),i.createVNode(i.unref(z.NButton),{disabled:t.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:p[2]||(p[2]=b=>o("click:remove-line",t.index))},{default:i.withCtx(()=>[i.createVNode(y)]),_:1},8,["disabled"])]),_:1},8,["path","label"])}}}),_b={class:"my-2 flex w-full flex-col"},wb={key:1},xb={class:"text-lg font-semibold"},kb={class:"flex gap-3"},vb={},su=i.defineComponent({...vb,__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(D.cloneDeep(r.value)),c=i.computed(()=>{const k={length:[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(r.settings.lengthStep),We.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]};return D.forEach(l.value,(x,C)=>{var N;k[`configuratorParams.linesWidths.${C}`]=[ae.required,ae.min(r.settings.minLineWidth),ae.step(r.settings.lineWidthStep),We.serverValidation((N=r.validation[`linesWidths.${C}`])==null?void 0:N.feedback)]}),k}),d=i.ref(r.settings.canSetDopProdaga??!1),u=i.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((k,x)=>(k??0)+(x??0),0)),h=i.computed(()=>r.settings.width-u.value),f=i.computed(()=>!r.value.some(({product:k})=>!k||k.isNewRec())),m=i.computed(()=>r.isSubmitProcessing||!f.value||h.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(k=>k.product.isNewRec())),p=i.computed(()=>k=>h.value===0?void 0:[{label:`${(h.value>0?"Остаток +":"Излишек ")+h.value} мм.`,key:h.value+k}]),g=i.computed(()=>{const{length:k}=r.value[0];return!k||u.value!==r.settings.width?null:(D.reduce(r.value,(C,N)=>{var S;const w=((S=N.product)==null?void 0:S.costRub)||0;return C+w},0)*r.value[0].quantity*k).toLocaleString("ru-ru",{minimumFractionDigits:2})}),y=(k,x,C)=>{var w,S,v;l.value[x].product.id=-1;const{configuratorParams:N}=l.value[x];N.linesWidths[x]=k,b("configuratorParams",N),(v=(S=(w=a.value)==null?void 0:w.at(x))==null?void 0:S.formItemReference)==null||v.validate().catch(D.noop),i.nextTick(()=>{var $,E;(E=($=a.value)==null?void 0:$.at(x))!=null&&E.isValid&&o("update:params",N,x,C)})},b=(k,x)=>{l.value.forEach(C=>{C[k]=x}),o("update:value",l.value)};return i.watch(()=>r.value,k=>{l.value=D.cloneDeep(k)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(k,x)=>{const C=z.NCheckbox;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:l.value[0],rules:c.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>{var N;return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(w,S)=>{var v,$,E;return i.openBlock(),i.createBlock(ou,{key:S,ref_for:!0,ref:"line-items-reference",value:((v=w.configuratorParams)==null?void 0:v.linesWidths.at(S))??null,"auto-focus":((($=w.configuratorParams)==null?void 0:$.linesWidths.at(S))??0)===0,index:S,path:`configuratorParams.linesWidths.${S}`,product:w.product,settings:t.settings,validation:t.validation,"suggestion-option":p.value(((E=w.configuratorParams)==null?void 0:E.linesWidths.at(S))??0),"add-line-button-disabled":h.value<=0||t.value.length>=t.settings.maxLinesCount||t.value.some(A=>A.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"is-last-line":S===l.value.length-1&&h.value===0,"onUpdate:value":y,"onClick:addLine":x[0]||(x[0]=A=>o("click:add-line",A)),"onClick:removeLine":x[1]||(x[1]=A=>o("click:remove-line",A))},null,8,["value","auto-focus","index","path","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled","is-last-line"])}),128)),i.createElementVNode("div",_b,[h.value<0?(i.openBlock(),i.createBlock(i.unref(z.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(z.NText),{key:1,type:"error"},{default:i.withCtx(()=>[...x[15]||(x[15]=[i.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",null,[x[16]||(x[16]=i.createTextVNode(" Остаток для резки: ",-1)),i.createVNode(i.unref(z.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(z.NButton),{disabled:m.value,type:"primary",class:"self-center",onClick:x[2]||(x[2]=w=>o("click:add-line",l.value.length))},{default:i.withCtx(()=>[...x[17]||(x[17]=[i.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["disabled"]),i.createVNode(i.unref(z.NFormItem),{path:"length",label:`Метраж ${t.settings.minLength?" от "+t.settings.minLength:""} ${t.settings.maxLength?" до "+t.settings.maxLength:""} м.`},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:l.value[0].length,"onUpdate:value":[x[3]||(x[3]=w=>l.value[0].length=w),x[6]||(x[6]=w=>b("length",w))],parse:i.unref(lt),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:x[4]||(x[4]=w=>i.unref(st)(w,!1)),onInput:x[5]||(x[5]=w=>i.unref(nt)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(z.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:l.value[0].quantity,"onUpdate:value":[x[7]||(x[7]=w=>l.value[0].quantity=w),x[10]||(x[10]=w=>b("quantity",w))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:x[8]||(x[8]=w=>i.unref(st)(w,!1)),onInput:x[9]||(x[9]=w=>i.unref(nt)(t.validation,"quantity")),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:l.value[0].marker??null,placeholder:"Введите маркировку",onInput:x[11]||(x[11]=w=>i.unref(nt)(t.validation,"marker")),"onUpdate:value":x[12]||(x[12]=w=>{l.value[0].marker=w??null,b("marker",w??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(C,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":x[13]||(x[13]=w=>{l.value[0].isAdditionalSale=w??!1,b("isAdditionalSale",w??!1)})},{default:i.withCtx(()=>[...x[18]||(x[18]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),g.value?(i.openBlock(),i.createElementBlock("div",wb,[x[19]||(x[19]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",xb,i.toDisplayString(g.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",kb,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!f.value||h.value!=0||!((N=l.value[0])!=null&&N.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"])),[[i.unref(ei),()=>o("submit",l.value)]])}}}),Cb={class:"flex grow flex-col"},Sb=["src"],Bb={class:"w-full"},Tb={},au=i.defineComponent({...Tb,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",Cb,[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,Sb),i.createElementVNode("div",Bb,[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)])]))}}),Nb={class:"flex flex-col gap-2"},$b={class:"w-104 flex grow flex-col px-5"},Rb={},lu=i.defineComponent({...Rb,__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 p;return(p=s.value[0].configuratorParams)==null?void 0:p.linesWidths.reduce((g,y)=>(g??0)+(y??0),0)}),u=p=>{p===void 0&&(p=s.value.length-1);const g=s.value.at(0);if(!g)return;g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(p+1,0,null),s.value.forEach(b=>{b.configuratorParams.linesWidths=g.configuratorParams.linesWidths});const y=new j.OrderItemBase({quantity:(g==null?void 0:g.quantity)??1,category:g==null?void 0:g.category,length:(g==null?void 0:g.length)??n.settings.minLength,marker:g==null?void 0:g.marker,configuratorParams:{linesWidths:g==null?void 0:g.configuratorParams.linesWidths}});s.value=s.value.toSpliced(p+1,0,y)},h=p=>{const g=s.value.at(0);g&&(g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(p,1),s.value.forEach(y=>{y.configuratorParams.linesWidths=g.configuratorParams.linesWidths}),s.value=s.value.toSpliced(p,1),delete a[`linesWidths.${p}`],delete a[`linesWidths.${p}`])},f=D.debounce(async(p,g,y)=>{const b={linesWidths:p.linesWidths.at(g)};y.value=!0,a.value[`linesWidths.${g}`]={},s.value[g].product=new j.ClientProduct,n.eventEmitter.emit("configurator:search-product",{category:s.value[g].category,params:b,validationFieldResultData:a.value,callback:_=>{_?(s.value[g].product=_,g===s.value.length-1&&s.value.length<n.settings.maxLinesCount&&d.value&&d.value<n.settings.width&&u()):(s.value[g].product=new j.ClientProduct,a.value[`linesWidths.${g}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},y.value=!1),y.value=!1}})},c.value),m=async()=>{var p,g;(g=(p=o.value)==null?void 0:p.formReference)==null||g.validate(y=>{if(!y){l.value=!0;const b=s.value.at(0);if(!b)return;r("submit",b,a.value,()=>{l.value=!1,i.nextTick(()=>{var _,k;(k=(_=o.value)==null?void 0:_.formReference)==null||k.restoreValidation()})})}}).catch(D.noop)};return i.watch(()=>n.cartItems,p=>{s.value=p.map(g=>new j.OrderItemBase(g))}),(p,g)=>{const y=z.NButton;return i.openBlock(),i.createElementBlock("div",Nb,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(y,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=b=>r("click:view-switch"))},{default:i.withCtx(()=>[...g[3]||(g[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",$b,[i.createVNode(au,{value:s.value,"onUpdate:value":g[1]||(g[1]=b=>s.value=b),settings:t.settings},null,8,["value","settings"]),i.createVNode(su,{ref:"strip-configurator-form",value:s.value,"onUpdate:value":g[2]||(g[2]=b=>s.value=b),validation:a.value,settings:t.settings,"is-submit-processing":l.value,"onUpdate:params":i.unref(f),onSubmit:m,"onClick:addLine":u,"onClick:removeLine":h},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),Eb={class:"flex flex-col gap-3"},Pb={},cu=i.defineComponent({...Pb,__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 m;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("first-input-element"),l=i.ref(D.cloneDeep(r.value)),c=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth),...r.settings.maxWidth?[ae.max(r.settings.maxWidth)]:[],ae.step(1),We.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(1),We.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]})),d=i.ref(r.settings.canSetDopProdaga??!1),u=()=>{o("update:params",l.value.configuratorParams),h("configuratorParams",l.value.configuratorParams)},h=(p,g)=>{const y=new j.OrderItemBase(r.value);y[p]=g,p==="configuratorParams"&&(y.product=new j.ClientProduct),o("update:value",y)},f=()=>{var p;(p=a.value)==null||p.select()};return i.watch(()=>r.value,p=>{l.value=D.cloneDeep(p)},{deep:!0}),i.onMounted(()=>{r.value.isNewRec()&&i.nextTick(()=>{f()})}),e({validate:(m=s.value)==null?void 0:m.validate,formReference:s}),(p,g)=>{const y=z.NCheckbox;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:l.value,rules:c.value,disabled:t.isSubmitProcessing,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NFormItem),{path:"configuratorParams.width",label:`Ширина, ${t.settings.minWidth?" от "+t.settings.minWidth:""}${t.settings.maxWidth?" до "+t.settings.maxWidth:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{ref:"first-input-element",value:l.value.configuratorParams.width,"onUpdate:value":[g[0]||(g[0]=b=>l.value.configuratorParams.width=b),u],class:"w-full",parse:i.unref(lt),"show-button":!1,placeholder:"Введите ширину",onKeydown:g[1]||(g[1]=b=>i.unref(st)(b)),onInput:g[2]||(g[2]=b=>i.unref(nt)(t.validation,"width")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(z.NFormItem),{path:"configuratorParams.length",label:`Длина, ${t.settings.minLength?" от "+t.settings.minLength:""}${t.settings.maxLength?" до "+t.settings.maxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[g[3]||(g[3]=b=>l.value.configuratorParams.length=b),u],placeholder:"Введите длину",parse:i.unref(lt),"show-button":!1,class:"w-full",onKeydown:g[4]||(g[4]=b=>i.unref(st)(b)),onInput:g[5]||(g[5]=b=>i.unref(nt)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(z.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:t.value.quantity,placeholder:"Введите количество",min:1,"show-button":!1,class:"w-full",onKeydown:g[6]||(g[6]=b=>i.unref(st)(b,!1)),onInput:g[7]||(g[7]=b=>i.unref(nt)(t.validation,"quantity")),"onUpdate:value":g[8]||(g[8]=b=>h("quantity",b??0)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:t.value.marker??null,placeholder:"Введите маркировку",onInput:g[9]||(g[9]=b=>i.unref(nt)(t.validation,"marker")),"onUpdate:value":g[10]||(g[10]=b=>h("marker",b??null)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(y,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":g[11]||(g[11]=b=>{l.value.isAdditionalSale=b??!1,h("isAdditionalSale",b??!1)})},{default:i.withCtx(()=>[...g[13]||(g[13]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(Cr,{"is-product-searching":t.isProductSearching,product:t.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),i.createElementVNode("div",Eb,[i.createVNode(i.unref(z.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:g[12]||(g[12]=b=>o("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["model","rules","disabled"])),[[i.unref(ei),()=>o("submit",l.value)]])}}}),Fb={class:"flex flex-col gap-2 w-72"},Vb={},du=i.defineComponent({...Vb,__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=D.debounce(async f=>{var m,p;s.value.product=new j.ClientProduct,(p=(m=o.value)==null?void 0:m.formReference)==null||p.validate(g=>{g||(l.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:f,validationFieldResultData:a.value,callback:y=>{y?s.value.product=y:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(D.noop)},d.value),h=async()=>{var f,m;(m=(f=o.value)==null?void 0:f.formReference)==null||m.validate(p=>{p||(c.value=!0,r("submit",s.value,a.value,()=>{c.value=!1,i.nextTick(()=>{var g,y;(y=(g=o.value)==null?void 0:g.formReference)==null||y.restoreValidation()})}))}).catch(D.noop)};return i.watch(()=>n.cartItem,f=>{s.value=new j.OrderItemBase(f)},{deep:!0}),(f,m)=>{const p=z.NButton;return i.openBlock(),i.createElementBlock("div",Fb,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(p,{key:0,type:"tertiary",class:"self-center",onClick:m[0]||(m[0]=g=>r("click:view-switch"))},{default:i.withCtx(()=>[...m[4]||(m[4]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(cu,{ref:"metal-for-doors-configurator-form",value:s.value,"onUpdate:value":m[1]||(m[1]=g=>s.value=g),validation:a.value,settings:t.settings,"is-submit-processing":c.value,"is-product-searching":l.value,"onUpdate:params":m[2]||(m[2]=g=>i.unref(u)(g)),onSubmit:m[3]||(m[3]=g=>h())},null,8,["value","validation","settings","is-submit-processing","is-product-searching"])])}}}),Mb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Ab(t,e){return i.openBlock(),i.createElementBlock("svg",Mb,[...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 uu=i.markRaw({name:"ion-add",render:Ab}),Ib={key:0,class:"-mt-1 text-sm text-gray-500"},Ob={class:"font-bold"},zb={class:"flex flex-col gap-3"},Db={key:0,class:"mt-4 flex flex-col gap-1.5"},Lb={class:"flex flex-col gap-1 text-sm text-gray-700"},Hb={key:0},Wb={key:1},jb={"form-array-name":"items",class:"flex flex-col gap-3"},qb={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},Xb={key:0,class:"flex flex-wrap items-end gap-2"},Yb={class:"whitespace-nowrap text-xl font-bold"},Ub={key:0,class:"whitespace-nowrap text-lg text-gray-500"},Kb={class:"font-bold"},Gb={class:"font-bold"},Zb={class:"flex gap-3"},Qb={},fu=i.defineComponent({...Qb,__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 P;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.ref(D.cloneDeep(r.value)),l=i.ref({...r.validation}),c=V=>{var M;delete l.value[V],(M=s.value)==null||M.restoreValidation()};i.watch(()=>r.validation,V=>{l.value={...V},Object.values(V).some(L=>L==null?void 0:L.feedback)&&i.nextTick(()=>{var L;return(L=s.value)==null?void 0:L.validate(D.noop).catch(D.noop)})},{deep:!0});const d=i.computed(()=>r.value.category),u=i.ref(null),h=i.ref(null),f=i.computed(()=>d.value.products??[]),m=i.computed(()=>f.value.map(V=>({label:V.name,value:V.id}))),p=(V,M,L)=>{const Y=V!=null&&V>0,U=M!=null&&M>0;return!Y&&!U?null:Y&&U?`от ${V} ${L} до ${M} ${L}`:Y?`от ${V} ${L}`:`до ${M} ${L}`},g=i.computed(()=>{var V,M;return p(r.settings.minWidth,(M=(V=u.value)==null?void 0:V.properties)==null?void 0:M.width,"мм")}),y=i.computed(()=>{var V,M;return p(r.settings.minLength,(M=(V=u.value)==null?void 0:V.properties)==null?void 0:M.length,"мм")}),b=i.ref(null),_=i.ref(!1),k=i.computed(()=>{var M;const V={marker:[We.serverValidation((M=l.value.marker)==null?void 0:M.feedback)]};return a.value.configuratorParams.items.forEach((L,Y)=>{var U,G,q,W,K,ue,ye;V[`configuratorParams.items.${Y}.width`]=[ae.required,ae.min(r.settings.minWidth),...(G=(U=u.value)==null?void 0:U.properties)!=null&&G.width?[ae.max(u.value.properties.width)]:[],ae.step(1),We.serverValidation((q=l.value[`items.${Y}.width`])==null?void 0:q.feedback)],V[`configuratorParams.items.${Y}.length`]=[ae.required,ae.min(r.settings.minLength),...(K=(W=u.value)==null?void 0:W.properties)!=null&&K.length?[ae.max(u.value.properties.length)]:[],ae.step(1),We.serverValidation((ue=l.value[`items.${Y}.length`])==null?void 0:ue.feedback)],V[`configuratorParams.items.${Y}.count`]=[ae.required,ae.min(1),ae.step(1),We.serverValidation((ye=l.value[`items.${Y}.count`])==null?void 0:ye.feedback)]}),V}),x=i.ref(r.settings.canSetDopProdaga??!1),C=i.computed(()=>a.value.configuratorParams.items.some(V=>{var M,L;return!u.value||!V.width||V.width<r.settings.minWidth||V.width>(((M=u.value.properties)==null?void 0:M.width)??0)||V.length===0||V.length<r.settings.minLength||V.length>(((L=u.value.properties)==null?void 0:L.length)??0)||!V.count||V.count<1})),N=i.computed(()=>!u.value||C.value||a.value.configuratorParams.items.length===0),w=i.ref(null),S=V=>{if(!V){u.value=null,h.value=null,a.value.product=new j.ClientProduct,b.value=null;return}const M=f.value.find(L=>L.id===V);M&&(u.value=M,h.value=V,a.value.product=M,Z("product",a.value.product),a.value.configuratorParams.items.forEach(L=>{var Y,U;(Y=M.properties)!=null&&Y.width&&L.width>M.properties.width&&(L.width=M.properties.width),(U=M.properties)!=null&&U.length&&L.length>M.properties.length&&(L.length=M.properties.length)}),$())};let v=!1;const $=()=>{v=!0,b.value=null,w.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},E=async()=>{var V;if(!u.value||a.value.configuratorParams.items.length===0||C.value){$();return}(V=s.value)==null||V.validate(M=>{if(M){$();return}if(_.value=!0,!u.value||!d.value){$(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:L=>{L?(b.value=L,a.value.configuratorParams.calculationId=L.id,a.value.quantity=L.quantity,i.nextTick(()=>{Z("quantity",L.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,$()),Z("configuratorParams",a.value.configuratorParams),A(),_.value=!1}})}).catch(()=>{$(),_.value=!1})},A=()=>{var M;if(!((M=u.value)!=null&&M.costRub)||!b.value){w.value=null;return}const V=b.value.quantity*u.value.costRub;w.value=Math.round(V*100)/100},R=V=>{var L,Y;const M=a.value.configuratorParams.items[V];u.value&&((L=u.value.properties)!=null&&L.width&&M.width>u.value.properties.width&&(M.width=u.value.properties.width),(Y=u.value.properties)!=null&&Y.length&&M.length>u.value.properties.length&&(M.length=u.value.properties.length)),Z("configuratorParams",a.value.configuratorParams),$()},F=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),Z("configuratorParams",a.value.configuratorParams),$(),o("add-item",a.value.configuratorParams.items.length)},H=V=>{a.value.configuratorParams.items.splice(V,1),Z("configuratorParams",a.value.configuratorParams),$(),o("remove-item",V)},Q=()=>{if(!(N.value||_.value||r.isSubmitProcessing)){if(!b.value){E();return}o("submit",a.value)}},Z=(V,M)=>{const L=new j.OrderItemBase(r.value);L[V]=M,o("update:value",L)};i.watch(()=>r.value,V=>{const M=D.cloneDeep(i.toRaw(V));(!M.configuratorParams.items||M.configuratorParams.items.length===0)&&(M.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=M,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),v?v=!1:O()},{deep:!0});const O=()=>{const{calculationId:V}=a.value.configuratorParams,M=a.value.quantity??0;V&&M>0&&a.value.product&&!a.value.product.isNewRec()&&(b.value={id:V,quantity:M,sheets:[]},A())};return i.onMounted(()=>{r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,h.value=r.value.product.id),O()}),e({validate:(P=s.value)==null?void 0:P.validate,formReference:s}),(V,M)=>{const L=io,Y=uu;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:a.value,rules:k.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>{var U;return[i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:h.value,"onUpdate:value":[M[0]||(M[0]=G=>h.value=G),S],options:m.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((U=u.value)==null?void 0:U.costRub)!=null?(i.openBlock(),i.createElementBlock("div",Ib,[i.createElementVNode("span",Ob,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",zb,[u.value?(i.openBlock(),i.createElementBlock("div",Db,[M[7]||(M[7]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",Lb,[g.value?(i.openBlock(),i.createElementBlock("div",Hb,"Ширина "+i.toDisplayString(g.value)+".",1)):i.createCommentVNode("",!0),y.value?(i.openBlock(),i.createElementBlock("div",Wb,"Длина "+i.toDisplayString(y.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",jb,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value.configuratorParams.items,(G,q)=>(i.openBlock(),i.createElementBlock("div",{key:q,class:"flex grow gap-2"},[i.createElementVNode("div",qb,[i.createVNode(i.unref(z.NFormItem),{path:`configuratorParams.items.${q}.width`,label:"Ширина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:a.value.configuratorParams.items[q].width,"onUpdate:value":[W=>a.value.configuratorParams.items[q].width=W,W=>R(q)],parse:i.unref(lt),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:M[1]||(M[1]=W=>i.unref(st)(W)),onInput:W=>c(`items.${q}.width`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(z.NFormItem),{path:`configuratorParams.items.${q}.length`,label:"Длина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:a.value.configuratorParams.items[q].length,"onUpdate:value":[W=>a.value.configuratorParams.items[q].length=W,W=>R(q)],parse:i.unref(lt),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:M[2]||(M[2]=W=>i.unref(st)(W)),onInput:W=>c(`items.${q}.length`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(z.NFormItem),{path:`configuratorParams.items.${q}.count`,label:"Количество, шт"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:a.value.configuratorParams.items[q].count,"onUpdate:value":[W=>a.value.configuratorParams.items[q].count=W,W=>R(q)],parse:i.unref(lt),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:M[3]||(M[3]=W=>i.unref(st)(W,!1)),onInput:W=>c(`items.${q}.count`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),i.createVNode(i.unref(z.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:W=>H(q)},{default:i.withCtx(()=>[i.createVNode(L)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:1,disabled:C.value,type:"default",class:"self-center",onClick:F},{default:i.withCtx(()=>[i.createVNode(Y),M[8]||(M[8]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0)]),i.createVNode(i.unref(z.NFormItem),{path:"marker",label:"Маркировка распила"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:a.value.marker??null,disabled:!u.value,placeholder:"Введите маркировку распила",onInput:M[4]||(M[4]=G=>c("marker")),"onUpdate:value":M[5]||(M[5]=G=>Z("marker",G??null)),onFocus:i.unref(Le)},null,8,["value","disabled","onFocus"])]),_:1}),x.value?(i.openBlock(),i.createBlock(i.unref(z.NCheckbox),{key:1,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":M[6]||(M[6]=G=>{a.value.isAdditionalSale=G??!1,Z("isAdditionalSale",G??!1)})},{default:i.withCtx(()=>[...M[9]||(M[9]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(i.unref(z.NSpin),{show:_.value,size:"small",class:"grow"},{default:i.withCtx(()=>{var G;return[b.value&&u.value&&w.value?(i.openBlock(),i.createElementBlock("div",Xb,[i.createElementVNode("div",null,[M[10]||(M[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",Yb,i.toDisplayString(w.value.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol),1)]),b.value.quantity&&u.value?(i.openBlock(),i.createElementBlock("div",Ub,[i.createElementVNode("span",Kb,"("+i.toDisplayString(b.value.quantity)+" шт.",1),M[11]||(M[11]=i.createTextVNode(" x ",-1)),i.createElementVNode("span",Gb,i.toDisplayString((G=u.value.costRub)==null?void 0:G.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]}),_:1},8,["show"]),i.createElementVNode("div",Zb,[b.value&&!_.value?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,loading:t.isSubmitProcessing,disabled:N.value||_.value,type:"primary",class:"self-start",onClick:Q},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(a.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])):(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:1,loading:_.value,disabled:N.value||_.value,type:"info",class:"self-start",onClick:E},{default:i.withCtx(()=>[...M[12]||(M[12]=[i.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules"])),[[i.unref(ei),Q]])}}}),Jb={class:"flex flex-col gap-2"},e1={class:"w-104 flex grow flex-col px-5"},t1={},hu=i.defineComponent({...t1,__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(m=>{if(!m){l.value=!0;const p=D.cloneDeep(s.value);"items"in p.configuratorParams&&delete p.configuratorParams.items,r("submit",p,a.value,()=>{l.value=!1,i.nextTick(()=>{var g,y;(y=(g=o.value)==null?void 0:g.formReference)==null||y.restoreValidation()})})}}).catch(D.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 m=z.NButton;return i.openBlock(),i.createElementBlock("div",Jb,[t.settings.allowShowTable&&s.value.isNewRec()?(i.openBlock(),i.createBlock(m,{key:0,type:"tertiary",class:"self-center",onClick:f[0]||(f[0]=p=>r("click:view-switch"))},{default:i.withCtx(()=>[...f[2]||(f[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",e1,[i.createVNode(fu,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":f[1]||(f[1]=p=>s.value=p),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"])])])}}}),n1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function i1(t,e){return i.openBlock(),i.createElementBlock("svg",n1,[...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 r1=i.markRaw({name:"ion-checkmark",render:i1}),o1={key:0,class:"-mt-1 text-sm text-gray-500"},s1={class:"font-bold"},a1={class:"flex flex-col gap-3"},l1={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},c1={class:"flex flex-col gap-1 text-sm text-gray-700"},d1={key:0},u1={key:1},f1={"form-array-name":"items",class:"flex flex-col gap-3"},h1={class:"min-w-0 flex-1"},m1={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},p1={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},g1={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},y1={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},b1={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},_1={key:0,class:"lg:!flex-[2]"},w1={class:"font-bold"},x1={key:1,class:"lg:!flex-[3]"},k1={class:"font-bold"},v1={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"},C1={key:0},S1={class:"font-bold"},B1={key:1},T1={class:"font-bold"},N1={class:"flex flex-wrap items-center gap-3"},$1={},mu=i.defineComponent({...$1,__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 G;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("widthInputs"),l=r.value==null?[]:D.cloneDeep(i.toRaw(r.value)),c=i.ref(l.map(q=>new j.OrderItemBase(q))),d=i.computed(()=>({items:c.value})),u=i.ref({...r.validation}),h=q=>{var W;delete u.value[q],(W=s.value)==null||W.restoreValidation()},f=i.ref(null),m=i.ref(null),p=i.computed(()=>{var q,W;return((W=(q=c.value[0])==null?void 0:q.category)==null?void 0:W.products)??[]}),g=i.computed(()=>p.value.map(q=>({label:q.name,value:q.id}))),y=(q,W,K)=>{const ue=q!=null&&q>0,ye=W!=null&&W>0;return!ue&&!ye?null:ue&&ye?`от ${q} ${K} до ${W} ${K}`:ue?`от ${q} ${K}`:`до ${W} ${K}`},b=i.computed(()=>{var q,W;return y(r.settings.minWidth,(W=(q=f.value)==null?void 0:q.properties)==null?void 0:W.width,"мм")}),_=i.computed(()=>{var q,W;return y(r.settings.minLength,(W=(q=f.value)==null?void 0:q.properties)==null?void 0:W.length,"мм")}),k=i.computed(()=>{const q={};return c.value.forEach((W,K)=>{var ue,ye,ve,ot,_e,we,wt,$e;q[`items.${K}.configuratorParams.width`]=[ae.required,ae.min(r.settings.minWidth),...(ye=(ue=f.value)==null?void 0:ue.properties)!=null&&ye.width?[ae.max(f.value.properties.width)]:[],ae.step(1),We.serverValidation((ve=u.value[`items.${K}.width`])==null?void 0:ve.feedback)],q[`items.${K}.configuratorParams.length`]=[ae.required,ae.min(r.settings.minLength),...(_e=(ot=f.value)==null?void 0:ot.properties)!=null&&_e.length?[ae.max(f.value.properties.length)]:[],ae.step(1),We.serverValidation((we=u.value[`items.${K}.length`])==null?void 0:we.feedback)],q[`items.${K}.quantity`]=[ae.required,ae.min(1),ae.step(1),We.serverValidation((wt=u.value[`items.${K}.quantity`])==null?void 0:wt.feedback)],q[`items.${K}.marker`]=[We.serverValidation(($e=u.value[`items.${K}.marker`])==null?void 0:$e.feedback)]}),q});i.watch(()=>r.validation,q=>{u.value={...q},Object.values(q).some(K=>K==null?void 0:K.feedback)&&i.nextTick(()=>{var K;return(K=s.value)==null?void 0:K.validate(D.noop).catch(D.noop)})},{deep:!0});const x=i.ref(r.settings.canSetDopProdaga??!1),C=i.computed(()=>{const q=f.value;return q?c.value.some(W=>{var ve,ot;const K=W.configuratorParams,ue=(ve=q.properties)==null?void 0:ve.width,ye=(ot=q.properties)==null?void 0:ot.length;return K.width===0||K.width<r.settings.minWidth||ue!=null&&K.width>ue||K.length===0||K.length<r.settings.minLength||ye!=null&&K.length>ye||W.quantity===0||W.quantity<1}):!0}),N=i.computed(()=>!f.value||C.value||c.value.length===0),w=i.computed(()=>{const q=c.value[0];return q!=null&&!q.isNewRec()}),S=q=>r.itemStates[q]??"idle",v=q=>S(q)==="success",$=q=>S(q)==="loading",E=i.computed(()=>c.value.length===0?!0:c.value.every((q,W)=>{const K=S(W);return K==="success"||K==="loading"})),A=q=>q.width===0||q.length===0?0:q.width*q.length/1e6,R=q=>A(q).toLocaleString(void 0,{maximumFractionDigits:4}),F=q=>{var ve;const W=q.configuratorParams,K=A(W),ue=((ve=f.value)==null?void 0:ve.costRub)??0,ye=q.quantity??0;return!K||!ye?0:Math.round(K*ue*ye*100)/100},H=i.computed(()=>D.sum(c.value.map(q=>{const W=q.configuratorParams;return!W.width||W.length===0||!q.quantity?0:W.width*W.length*q.quantity/1e6}))),Q=i.computed(()=>Math.round(D.sum(c.value.map(q=>F(q)))*100)/100),Z=()=>{var q,W,K;return new j.OrderItemBase({category:(q=c.value[0])==null?void 0:q.category,configurator:(W=c.value[0])==null?void 0:W.configurator,product:f.value??new j.ClientProduct,quantity:1,isAdditionalSale:(K=c.value[0])==null?void 0:K.isAdditionalSale,configuratorParams:{width:0,length:0}})},O=q=>{if(!q){f.value=null,m.value=null,c.value.forEach(K=>{K.product=new j.ClientProduct}),o("update:value",c.value);return}const W=p.value.find(K=>K.id===q);W&&(f.value=W,m.value=q,c.value.forEach((K,ue)=>{var ye,ve;K.product=W,(ye=W.properties)!=null&&ye.width&&K.configuratorParams.width>W.properties.width&&(K.configuratorParams.width=W.properties.width),(ve=W.properties)!=null&&ve.length&&K.configuratorParams.length>W.properties.length&&(K.configuratorParams.length=W.properties.length),o("item-reset",ue)}),o("update:value",c.value))},P=q=>{var ue,ye;const W=c.value[q],K=f.value;K&&((ue=K.properties)!=null&&ue.width&&W.configuratorParams.width>K.properties.width&&(W.configuratorParams.width=K.properties.width),(ye=K.properties)!=null&&ye.length&&W.configuratorParams.length>K.properties.length&&(W.configuratorParams.length=K.properties.length)),o("item-reset",q),o("update:value",c.value)},V=(q,W)=>{c.value[q].marker=W===null||W===""?void 0:W,o("item-reset",q),o("update:value",c.value)},M=q=>{c.value.forEach(W=>{W.isAdditionalSale=q}),o("update:value",c.value)},L=()=>{c.value.push(Z()),o("update:value",c.value),o("add-item",c.value.length),i.nextTick(()=>{var W,K,ue,ye;const q=c.value.length-1;(K=(W=a.value)==null?void 0:W[q])==null||K.focus(),(ye=(ue=a.value)==null?void 0:ue[q])==null||ye.select()})},Y=q=>{c.value.splice(q,1),o("update:value",c.value),o("remove-item",q)};i.watch(()=>r.value,q=>{var ye;const K=(q==null?[]:D.cloneDeep(i.toRaw(q))).map(ve=>new j.OrderItemBase(ve));c.value=K.length>0?K:[Z()];const ue=(ye=c.value[0])==null?void 0:ye.product;ue&&!ue.isNewRec()?(f.value=ue,m.value=ue.id):(f.value=null,m.value=null)},{deep:!0});const U=()=>{var W;if(f.value!==null)return;const q=(W=p.value[0])==null?void 0:W.id;q!=null&&O(q)};return i.watch(p,()=>{U()}),i.onMounted(()=>{var W;c.value.length===0&&(c.value=[Z()]);const q=(W=c.value[0])==null?void 0:W.product;q&&!q.isNewRec()&&(f.value=q,m.value=q.id),U()}),e({validate:(G=s.value)==null?void 0:G.validate,formReference:s}),(q,W)=>{const K=r1,ue=io,ye=uu;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:d.value,rules:k.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>{var ve,ot;return[i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:m.value,"onUpdate:value":[W[0]||(W[0]=_e=>m.value=_e),O],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((ve=f.value)==null?void 0:ve.costRub)!=null?(i.openBlock(),i.createElementBlock("div",o1,[i.createElementVNode("span",s1,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",a1,[f.value?(i.openBlock(),i.createElementBlock("div",l1,[W[6]||(W[6]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",c1,[b.value?(i.openBlock(),i.createElementBlock("div",d1,"Ширина "+i.toDisplayString(b.value)+".",1)):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createElementBlock("div",u1,"Длина "+i.toDisplayString(_.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",f1,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value.items,(_e,we)=>{var wt;return i.openBlock(),i.createElementBlock("div",{key:we,class:i.normalizeClass(["flex min-w-0 items-start gap-2 border-b border-gray-100 last:border-0",v(we)?"opacity-70":""])},[i.createElementVNode("div",h1,[i.createElementVNode("div",m1,[i.createElementVNode("div",p1,[i.createVNode(i.unref(z.NFormItem),{path:`items.${we}.configuratorParams.width`,label:"Ширина, мм",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{ref_for:!0,ref:"widthInputs",value:d.value.items[we].configuratorParams.width,"onUpdate:value":[$e=>d.value.items[we].configuratorParams.width=$e,$e=>P(we)],parse:i.unref(lt),"show-button":!1,disabled:!f.value||v(we)||$(we),placeholder:"Ширина",class:"w-full",onKeydown:W[1]||(W[1]=$e=>i.unref(st)($e)),onInput:$e=>h(`items.${we}.width`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(z.NFormItem),{path:`items.${we}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:d.value.items[we].configuratorParams.length,"onUpdate:value":[$e=>d.value.items[we].configuratorParams.length=$e,$e=>P(we)],parse:i.unref(lt),"show-button":!1,disabled:!f.value||v(we)||$(we),placeholder:"Длина",class:"w-full",onKeydown:W[2]||(W[2]=$e=>i.unref(st)($e)),onInput:$e=>h(`items.${we}.length`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),i.createElementVNode("div",g1,[i.createVNode(i.unref(z.NFormItem),{path:`items.${we}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:d.value.items[we].quantity,"onUpdate:value":[$e=>d.value.items[we].quantity=$e,$e=>P(we)],parse:i.unref(lt),"show-button":!1,disabled:!f.value||v(we)||$(we),placeholder:"Кол-во",class:"w-full",onKeydown:W[3]||(W[3]=$e=>i.unref(st)($e,!1)),onInput:$e=>h(`items.${we}.quantity`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(z.NFormItem),{path:`items.${we}.marker`,label:"Маркировка",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:d.value.items[we].marker??null,disabled:!f.value||v(we)||$(we),placeholder:"Маркировка",class:"w-full",onInput:$e=>h(`items.${we}.marker`),"onUpdate:value":$e=>V(we,$e??null),onFocus:i.unref(Le)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),$(we)||v(we)?(i.openBlock(),i.createElementBlock("div",y1,[$(we)?(i.openBlock(),i.createBlock(i.unref(z.NSpin),{key:0,size:14})):v(we)?(i.openBlock(),i.createBlock(K,{key:1,class:"text-green-600 text-xl"})):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),i.createElementVNode("div",b1,[_e.configuratorParams.width>0&&_e.configuratorParams.length>0?(i.openBlock(),i.createElementBlock("div",_1,[W[7]||(W[7]=i.createTextVNode(" Площадь (S) = ",-1)),i.createElementVNode("span",w1,i.toDisplayString(R(_e.configuratorParams))+" м²",1)])):i.createCommentVNode("",!0),F(_e)>0?(i.openBlock(),i.createElementBlock("div",x1,[W[8]||(W[8]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",k1,i.toDisplayString(F(_e).toLocaleString())+" "+i.toDisplayString((wt=f.value)==null?void 0:wt.currency.symbol),1)])):i.createCommentVNode("",!0)])]),w.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,disabled:$(we)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:$e=>Y(we)},{default:i.withCtx(()=>[i.createVNode(ue)]),_:1},8,["disabled","onClick"]))],2)}),128))]),f.value?(i.openBlock(),i.createElementBlock("div",v1,[H.value>0?(i.openBlock(),i.createElementBlock("div",C1,[W[9]||(W[9]=i.createTextVNode(" Общая площадь: ",-1)),i.createElementVNode("span",S1,i.toDisplayString(H.value.toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),Q.value>0?(i.openBlock(),i.createElementBlock("div",B1,[W[10]||(W[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",T1,i.toDisplayString(Q.value.toLocaleString())+" "+i.toDisplayString(f.value.currency.symbol),1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),x.value?(i.openBlock(),i.createBlock(i.unref(z.NCheckbox),{key:1,checked:((ot=c.value[0])==null?void 0:ot.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":W[4]||(W[4]=_e=>M(_e??!1))},{default:i.withCtx(()=>[...W[11]||(W[11]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createElementVNode("div",N1,[f.value&&!w.value?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,disabled:C.value,type:"default",onClick:L},{default:i.withCtx(()=>[i.createVNode(ye),W[12]||(W[12]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:N.value||E.value,type:"primary",class:"ml-auto",onClick:W[5]||(W[5]=_e=>o("submit",c.value))},{default:i.withCtx(()=>{var _e;return[i.createTextVNode(i.toDisplayString((_e=c.value[0])!=null&&_e.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[i.unref(ei),()=>o("submit",c.value)]])}}}),R1={class:"flex flex-col gap-2"},E1={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},P1={},pu=i.defineComponent({...P1,__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(k=>new j.OrderItemBase(k))),a=i.ref([]),l=i.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=k=>{c.forEach(x=>{l.value[`items.${k}.${x}`]={}})},u=k=>{c.forEach(x=>{delete l.value[`items.${k}.${x}`]})},h=i.computed(()=>a.value.includes("loading")),f=()=>({width:{},length:{},quantity:{},marker:{}}),m=(k,x)=>{let C=!1;return c.forEach(N=>{var A,R;const w=`items.0.${N}`,S=(A=k[N])==null?void 0:A.feedback,$=((R=k[w])==null?void 0:R.feedback)??S,E=`items.${x}.${N}`;$?(l.value[E]=k[w]??k[N],C=!0):l.value[E]={}}),C},p=(k,x,C)=>new Promise(N=>{const w=f();let S=!1;const v=$=>{if(S)return;S=!0;const E=m(w,x),A=($===void 0?!E:$)&&!E;a.value[x]=A?"success":"error",i.nextTick(()=>{var R,F;(F=(R=o.value)==null?void 0:R.formReference)==null||F.restoreValidation()}),N(A)};a.value[x]="loading",r("submit",[D.cloneDeep(k)],w,v,{isFinalSuccessfulCompletion:C})}),g=async()=>{var C,N;try{await((N=(C=o.value)==null?void 0:C.formReference)==null?void 0:N.validate())}catch{return}const k=s.value.map((w,S)=>S).filter(w=>{const S=a.value[w]??"idle";return S!=="success"&&S!=="loading"});let x=!0;for(let w=0;w<k.length;w+=1){const S=k[w],v=s.value[S];if(!v)break;const E=w===k.length-1&&x;await p(v,S,E)||(x=!1)}},y=k=>{const x=k-1;a.value[x]="idle",d(x)},b=k=>{a.value.splice(k,1),u(k);for(let x=k;x<s.value.length;x+=1)d(x)},_=k=>{const x=a.value[k];(x==="success"||x==="error")&&(a.value[k]="idle")};return i.onMounted(()=>{(n.cartItems??[]).forEach((k,x)=>{a.value[x]="idle",d(x)})}),i.watch(()=>n.cartItems,k=>{const x=(k??[]).map(C=>new j.OrderItemBase(C));s.value=x,a.value=x.map(()=>"idle"),x.forEach((C,N)=>{d(N)})},{deep:!0}),(k,x)=>{var N;const C=z.NButton;return i.openBlock(),i.createElementBlock("div",R1,[t.settings.allowShowTable&&((N=s.value[0])!=null&&N.isNewRec())?(i.openBlock(),i.createBlock(C,{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",E1,[i.createVNode(mu,{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:g,onAddItem:y,onRemoveItem:b,onItemReset:_},null,8,["value","validation","settings","event-emitter","is-submit-processing","item-states"])])])}}}),F1={key:0,class:"flex justify-center p-4"},V1={key:1,class:"p-4 text-center text-red-500"},M1={key:2,class:"flex justify-center"},A1={class:"!bg-white p-4 m-2 rounded-md w-max"},I1={key:3,class:"p-4 text-center text-gray-500"},O1={},gu=i.defineComponent({...O1,__name:"dynamic-configurator",props:{eventEmitter:{},settings:{},editor:{},cartItem:{},cartItems:{},category:{}},setup(t){const e=t,n=i.ref(!1),r=i.ref(null),o=i.ref(e.cartItem??null),s=i.ref(e.cartItems??null),a=f=>{const m=f.configuratorParams;return[new j.OrderItemBase({...f,quantity:f.quantity??1,marker:f.marker,configuratorParams:{width:(m==null?void 0:m.width)??f.width??0,length:(m==null?void 0:m.length)??f.length??0}})]},l=i.ref(e.editor===j.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var m,p,g;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const f={category:((m=e.cartItem)==null?void 0:m.category)??e.category,configurator:e.editor,quantity:1};switch(e.editor){case"kozyrek":{const y=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{length:y.stripMinLength,linesAngles:[],linesWidths:[],startTailType:D.some(y.startTailConfigs,b=>b.isDefault)?(p=y.startTailConfigs)==null?void 0:p.findIndex(b=>b.isDefault):void 0,endTailType:D.some(y.endTailConfigs,b=>b.isDefault)?(g=y.endTailConfigs)==null?void 0:g.findIndex(b=>b.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const y=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{width:0,height:0,netType:y.netType[0]||"",color:y.color[0]||"",mountType:y.mountType[0]||""}});break}case"strip":{const y=e.settings;s.value=[new j.OrderItemBase({...f,length:y.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const y=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{width:y.minWidth,length:y.minLength}});break}case"sandwich":{o.value=new j.OrderItemBase({...f,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new j.OrderItemBase({...f,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(f,m,p)=>{const g=y=>{p==null||p(),y&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:f,callback:g,validation:m})},u=(f,m,p,g)=>{const y=f[0];if(!y){p==null||p();return}const b=(g==null?void 0:g.isFinalSuccessfulCompletion)===!0,_=k=>{p==null||p(k),b&&k&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:y,callback:_,validation:m,additionalParams:g})},h=()=>{e.category&&e.eventEmitter.emit("configurator:click-view-switch",{category:e.category})};return i.onMounted(()=>{!e.cartItem&&!e.cartItems&&c()}),(f,m)=>{const p=z.NSpin;return i.openBlock(),i.createElementBlock(i.Fragment,null,[n.value?(i.openBlock(),i.createElementBlock("div",F1,[i.createVNode(p,{size:"large"})])):r.value?(i.openBlock(),i.createElementBlock("div",V1,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",M1,[i.createElementVNode("div",A1,[t.editor==="kozyrek"?(i.openBlock(),i.createBlock(tu,{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(ru,{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(lu,{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(du,{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(hu,{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(pu,{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",I1,' Конфигуратор "'+i.toDisplayString(t.editor)+'" не поддерживается. ',1))],64)}}});function yu(t){return Object.values(j.ConfiguratorsEnum).includes(t)}function bu(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.Sandwich?!0:t.properties.configuratorSettings!==void 0&&D.isArray(t.products)&&t.products.length>0}const z1={key:0,class:"pt-0.5"},D1={key:0},L1={class:"line-through"},H1={key:0},W1={key:1},j1={class:"flex flex-row gap-1"},q1={key:0},X1={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},Y1={class:"flex flex-col gap-2.5 sm:flex-row"},U1={class:"mt-2"},K1={key:1,class:"flex flex-col"},G1={},Z1=i.defineComponent({...G1,__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(xr,"medium"),r=i.computed(()=>{var U;return(U=e==null?void 0:e.filteredItems)==null?void 0:U[e.categoryItem.id]}),o=i.computed(()=>{var U,G;return D.isArray((U=e.categoryItem)==null?void 0:U.categories)&&((G=e.categoryItem.categories)==null?void 0:G.length)>0}),s=i.computed(()=>{var U;return D.isArray((U=e.categoryItem)==null?void 0:U.products)?e.categoryItem.products:[]}),a=i.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([U,G])=>`${G} руб./${E(U)}`).join(", ")),l=i.computed(()=>D.isUndefined(e.filteredItems)||r.value==="*"?s.value:s.value.filter(U=>{var q;const G=(q=r.value)==null?void 0:q.products;return D.isArray(G)&&G.includes(U.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>D.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),u=i.computed(()=>D.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),h=i.computed(()=>D.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),f=i.computed(()=>D.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),m=i.computed(()=>{var U,G,q;return((U=e.categoryItem.properties)==null?void 0:U.configurator)!==void 0&&yu((G=e.categoryItem.properties)==null?void 0:G.configurator)&&bu(e.categoryItem)&&((q=e.categoryItem.properties)==null?void 0:q.configuratorSettings)!==void 0&&(D.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),p=i.computed(()=>m.value&&(D.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),g=i.computed(()=>D.isNil(e.categoryContextButtonsConfig)?[]:D.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),y=i.computed(()=>new j.ClientCategory(e.categoryItem)),b=i.ref(!1),_=i.ref(!1),k=i.computed(()=>!D.isUndefined(e.isCategoryItemSelected)),x=i.computed(()=>D.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),C=i.computed(()=>D.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),N=i.computed(()=>D.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),w=i.computed(()=>M.value&&it.getDeviceTypeByResolution()===Xe.laptop?"auto":"fixed"),S=i.useTemplateRef("collapse-item-reference"),v=i.computed(()=>{var U,G;return(G=(U=e.categoryItem.properties)==null?void 0:U.templateCost)==null?void 0:G.priceCoefficient}),$=i.computed(()=>{var U,G;return(G=(U=e.categoryItem.properties)==null?void 0:U.templateCost)==null?void 0:G.increasePercent}),E=(U,G="ru-RU")=>0 .toLocaleString(G,{style:"currency",currency:U,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),A=U=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:U,target:S.value})},R=(U,G)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:G,isLoadingState:b,target:S.value})},F=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:S.value})},H=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:S.value})},Q=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:S.value})},Z=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:S.value})},O=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:S.value})},P=U=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:U,target:S.value})},V=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},M=i.ref(0),L=i.computed(()=>M.value&&s.value.length>0?jp(s.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),Y=D.debounce(()=>{M.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",Y)}),window.addEventListener("resize",Y),Y(),(U,G)=>{const q=z.NCheckbox,W=wm,K=z.NTooltip,ue=ym,ye=z.NTag,ve=mm,ot=um,_e=z.NButton,we=lm,wt=Sl,$e=Cl,Gt=vl,pn=ms,Rt=z.NDropdown,Qn=z.NDataTable,gn=z.NAlert,sn=z.NSpin;return i.openBlock(),i.createBlock(Bl,{ref:"collapse-item-reference",name:t.categoryItem.id,"data-id":t.categoryItem.id,"onHeader:click":R},{"pre-arrow":i.withCtx(()=>{var Ve,te;return[k.value?(i.openBlock(),i.createElementBlock("div",z1,[i.createVNode(q,{checked:x.value,indeterminate:N.value,disabled:C.value,"onUpdate:checked":A},null,8,["checked","indeterminate","disabled"])])):i.createCommentVNode("",!0),!d.value&&((Ve=y.value)!=null&&Ve.isDisabled)?(i.openBlock(),i.createBlock(K,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(W,{class:"pt-1.5"})]),default:i.withCtx(()=>[G[1]||(G[1]=i.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):i.createCommentVNode("",!0),((te=y.value)==null?void 0:te.isFavorite)??!1?(i.openBlock(),i.createBlock(K,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ue,{class:"pt-1.5"})]),default:i.withCtx(()=>[G[2]||(G[2]=i.createTextVNode(" Избранная категория ",-1))]),_:1})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var Ve,te,le,De,hi;return[i.createElementVNode("div",{class:i.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":t.categoryItem.isHidden,"text-gray-400":(Ve=y.value)==null?void 0:Ve.isDisabled})},[i.createVNode(K,{disabled:!t.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createElementVNode("span",null,i.toDisplayString(t.categoryItem.name),1)]),default:i.withCtx(()=>[G[3]||(G[3]=i.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:G[0]||(G[0]=i.withModifiers((...at)=>i.unref(D.noop)&&i.unref(D.noop)(...at),["prevent","stop"]))},[(te=t.categoryItem.properties)!=null&&te.m2Price?(i.openBlock(),i.createBlock(ye,{key:0,size:i.unref(n),class:i.normalizeClass({"!pr-0":((le=t.categoryItem.properties)==null?void 0:le.templateCost)&&t.categoryItem.properties.m2PriceRetail&&$.value}),round:""},{default:i.withCtx(()=>{var at;return[i.createTextVNode(" Установленная стоимость: "+i.toDisplayString(t.categoryItem.properties.m2Price)+" руб./м2 ",1),(at=t.categoryItem.properties)!=null&&at.templateCost&&t.categoryItem.properties.m2PriceRetail&&$.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[$.value?(i.openBlock(),i.createBlock(ye,{key:0,type:"success",bordered:!1,size:i.unref(n),class:"ml-2 !pr-0",round:""},{default:i.withCtx(()=>[$.value?(i.openBlock(),i.createElementBlock("span",D1,i.toDisplayString($.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0),i.createVNode(ye,{size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createElementVNode("span",L1,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},[v.value||$.value?(i.openBlock(),i.createBlock(ye,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>{var at;return[v.value?(i.openBlock(),i.createElementBlock("span",H1,i.toDisplayString((at=v.value)==null?void 0:at.name),1)):i.createCommentVNode("",!0),$.value?(i.openBlock(),i.createElementBlock("span",W1,i.toDisplayString($.value>0?"+":"")+i.toDisplayString($.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0)]}),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(ye,{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&&((hi=y.value)!=null&&hi.manager)?(i.openBlock(),i.createBlock(ye,{key:3,size:i.unref(n),closable:!0,round:"",class:"align-bottom",onClose:Z},{default:i.withCtx(()=>[i.createVNode(K,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var at,Zt;return[i.createElementVNode("span",j1,[i.createVNode(ve),i.createTextVNode(" "+i.toDisplayString((Zt=(at=y.value)==null?void 0:at.manager)==null?void 0:Zt.name),1)])]}),default:i.withCtx(()=>{var at,Zt;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((Zt=(at=y.value)==null?void 0:at.manager)==null?void 0:Zt.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[t.showSlugs||t.showProperties?(i.openBlock(),i.createElementBlock("div",q1,[i.createElementVNode("ul",X1,[t.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:t.categoryItem.id,slug:t.categoryItem.slug},(Ve,te)=>(i.openBlock(),i.createElementBlock("li",{key:te}," ("+i.toDisplayString(te)+"): "+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,te)=>(i.openBlock(),i.createElementBlock("li",{key:te}," ("+i.toDisplayString(te)+"): "+i.toDisplayString(Ve),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var Ve;return[i.createElementVNode("div",Y1,[d.value?(i.openBlock(),i.createBlock(K,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(_e,{ghost:!0,size:i.unref(n),onClick:F},{default:i.withCtx(()=>{var te;return[(te=y.value)!=null&&te.isDisabled?(i.openBlock(),i.createBlock(W,{key:1})):(i.openBlock(),i.createBlock(ot,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var te;return[(te=y.value)!=null&&te.isDisabled?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" Скрыто для клиента"+i.toDisplayString(y.value.hidingComment?`. Причина: '${y.value.hidingComment}'`:""),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Видимо клиенту")],64))]}),_:1})):i.createCommentVNode("",!0),u.value&&!((Ve=y.value)!=null&&Ve.manager)?(i.openBlock(),i.createBlock(K,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(_e,{ghost:!0,size:i.unref(n),onClick:Q},{default:i.withCtx(()=>[i.createVNode(we)]),_:1},8,["size"])]),default:i.withCtx(()=>{var te,le,De;return[(te=y.value)!=null&&te.manager?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode('Категория закреплена за "'+i.toDisplayString(((De=(le=y.value)==null?void 0:le.manager)==null?void 0:De.name)??"-")+'"',1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode("Закрепить")],64))]}),_:1})):i.createCommentVNode("",!0),h.value?(i.openBlock(),i.createBlock(K,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(_e,{ghost:!0,disabled:h.value==="disabled",size:i.unref(n),onClick:H},{default:i.withCtx(()=>{var te;return[(te=y.value)!=null&&te.isRequired?(i.openBlock(),i.createBlock($e,{key:1})):(i.openBlock(),i.createBlock(wt,{key:0}))]}),_:1},8,["disabled","size"])]),default:i.withCtx(()=>[G[4]||(G[4]=i.createTextVNode(" Категория, которую нужно предлагать клиенту ",-1))]),_:1})):i.createCommentVNode("",!0),f.value?(i.openBlock(),i.createBlock(K,{key:3,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(_e,{ghost:!0,size:i.unref(n),type:"primary",onClick:O},{default:i.withCtx(()=>[i.createVNode(Gt)]),_:1},8,["size"])]),default:i.withCtx(()=>[G[5]||(G[5]=i.createTextVNode(" Редактировать ",-1))]),_:1})):i.createCommentVNode("",!0),g.value.length>0?(i.openBlock(),i.createBlock(Rt,{key:4,options:g.value,size:i.unref(n),trigger:"click",onSelect:P},{default:i.withCtx(()=>[i.createVNode(_e,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(pn)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(U.$slots,"default",{},()=>{var Ve,te,le;return[i.createElementVNode("div",U1,[o.value?(i.openBlock(),i.createBlock(wu,{key:0,"categories-items":t.categoryItem.categories??[],"has-products":c.value||b.value,"event-emitter":t.eventEmitter,"filtered-items":r.value?((Ve=r.value)==null?void 0:Ve.categories)??{}:void 0,"is-category-item-selected":t.isCategoryItemSelected,"show-slugs":t.showSlugs,"show-properties":t.showProperties,"allow-name-click":t.allowNameClick,"allow-price-click":t.allowPriceClick,"show-price-history":t.showPriceHistory,"show-cost-date":t.showCostDate,"show-category-required-button":t.showCategoryRequiredButton,"show-category-hide-for-client-button":t.showCategoryHideForClientButton,"show-category-pin-button":t.showCategoryPinButton,"show-category-edit-button":t.showCategoryEditButton,"category-context-buttons-config":t.categoryContextButtonsConfig,"is-product-item-selected":t.isProductItemSelected,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-costs":t.showProductCosts,"show-product-required-button":t.showProductRequiredButton,"show-product-edit-button":t.showProductEditButton,"product-context-buttons-config":t.productContextButtonsConfig,"show-configurator":t.showConfigurator,"can-show-configurator":t.canShowConfigurator},null,8,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"])):i.createCommentVNode("",!0)]),m.value&&p.value?(i.openBlock(),i.createBlock(gu,{key:0,"event-emitter":t.eventEmitter,settings:(te=t.categoryItem.properties)==null?void 0:te.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",K1,[m.value?(i.openBlock(),i.createBlock(_e,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:V},{default:i.withCtx(()=>[...G[6]||(G[6]=[i.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Qn,{columns:L.value,data:l.value,bordered:!0,loading:b.value,remote:!0,"row-key":De=>De.id,"table-layout":w.value,class:"mt-2"},null,8,["columns","data","loading","row-key","table-layout"])])):i.createCommentVNode("",!0),!b.value&&!_.value&&!o.value&&!c.value?(i.openBlock(),i.createBlock(gn,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createBlock(gn,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),b.value?(i.openBlock(),i.createBlock(sn,{key:4,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>[...G[7]||(G[7]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),Q1=An(Z1,[["__scopeId","data-v-607a5aad"]]),J1={class:"sc-collapse flex w-full flex-col"},e_={},_u=i.defineComponent({...e_,__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",J1,[i.renderSlot(s.$slots,"default")]))}}),t_={},wu=i.defineComponent({...t_,__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(xr,"medium"),r=i.computed(()=>D.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(D.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=z.NSpin,c=z.NAlert;return i.openBlock(),i.createElementBlock(i.Fragment,null,[r.value.length>0?(i.openBlock(),i.createBlock(_u,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(Q1,{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)}}}),n_={},xu=i.defineComponent({...n_,__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(()=>D.isArray(r.value)),a=new j.Reference,l=i.computed(()=>D.isNil(r.value)?s.value?[]:null:D.isArray(r.value)?r.value.filter(m=>!D.isNil(m)).map(m=>m.id):r.value.id),c=i.computed(()=>yt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue,void 0,r.disabledItem)),d=m=>{var p;if(D.isArray(m)){const g=m.length>0?m.map(y=>{var b;return(b=c.value.find(_=>_.value===y))==null?void 0:b.item}).filter(y=>!D.isNil(y)):[];o("update:value",g)}else{const g=m===a.id||D.isNil(m)||(p=c.value.find(y=>y.value===m))==null?void 0:p.item;o("update:value",g)}},u=i.useTemplateRef("select-component");return e({focus:()=>{var m;return(m=u.value)==null?void 0:m.focus()},blur:()=>{var m;return(m=u.value)==null?void 0:m.blur()}}),(m,p)=>(i.openBlock(),i.createBlock(i.unref(z.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"]))}}),i_={},r_=i.defineComponent({...i_,__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,C;const n=t,r=e,o=()=>{const N=j.PriceCoefficient.getRetailPriceCoefficient();return D.unset(N,"isNewRec"),N},s=N=>!N||N.id===o().id,a=i.computed(()=>{var N;return((N=n.catalogItem)==null?void 0:N.type)==="product"}),l=i.computed(()=>a.value?n.catalogItem:void 0),c=N=>{var w,S,v,$;return N.id===o().id?(w=l.value)==null?void 0:w.getRetailCost():($=(v=(S=l.value)==null?void 0:S.priceCoefficients)==null?void 0:v.find(E=>E.coefficient.id===N.id))==null?void 0:$.cost},d=i.computed(()=>{var w;const N=[...((w=j.useReferencesStore().priceCoefficientsReference)==null?void 0:w.map(S=>structuredClone(i.toRaw(S))))??[],o()];return a.value&&N.forEach(S=>{var $;const v=c(S);v?S.name+=` (${v} ${($=l.value)==null?void 0:$.currency.symbol})`:S.name=""}),N.filter(S=>S.name!=="")}),u=i.ref(n.value.coefficient),h=i.ref(((C=(x=n.value)==null?void 0:x.value)==null?void 0:C.toString())??null),f=i.ref(null),m=i.computed(()=>{var N,w;return(w=(N=l.value)==null?void 0:N.priceCoefficients)==null?void 0:w.find(S=>S.coefficient.slug===j.PriceCoefficientEnum.K0)}),p=i.ref(void 0),g=N=>Number.parseFloat((N??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),y=()=>{var w,S;p.value=void 0;let N=g(h.value);if(N=Number.isNaN(N)?void 0:N,a.value)if(u.value||h.value){const v=o(),$=c(u.value??v)??0,E=$+$*((N??0)/100);f.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(E),E>(((w=l.value)==null?void 0:w.getRetailCost())??E)&&(p.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),m.value&&E<(((S=m.value)==null?void 0:S.cost)??0)&&(p.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else f.value=null;r("update:value",{value:Number.isNaN(N)?void 0:N,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})},b=N=>{D.isArray(N)||D.isNull(N)||(u.value=N,h.value=null,!u.value&&h.value&&(u.value=o()),y())},_=()=>{u.value||(u.value=o()),y()},k=N=>{var S,v,$,E,A;const w=g(N);if(a.value){if(Number.isNaN(w)){u.value=void 0,h.value=null,r("update:value",{value:void 0,coefficient:void 0});return}let R=0;if(w<=0)u.value=void 0,h.value=null;else if(m.value&&w<(((S=m.value)==null?void 0:S.cost)??0))u.value=(v=m.value)==null?void 0:v.coefficient,R=(w-m.value.cost)*100/m.value.cost,p.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(w>((($=l.value)==null?void 0:$.getRetailCost())??w)){u.value=o();const F=((E=l.value)==null?void 0:E.getRetailCost())??0;R=(w-F)*100/F,p.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const F=((A=l.value)==null?void 0:A.priceCoefficients)??[],H=D.sortBy(F,[O=>O.cost]),Z=H.filter(O=>O.cost<=w).at(-1)??H.at(0);Z&&(u.value=Z.coefficient,R=(w-Z.cost)*100/Z.cost),p.value={validationStatus:void 0,feedback:void 0}}h.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:5}).format(R),r("update:value",{value:Number.isNaN(R)?void 0:R,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})}else r("update:value",{value:Number.isNaN(w)?void 0:w,coefficient:void 0})};return i.onMounted(()=>{var N,w,S,v;n.calculationType===j.CalculationTypeEnum.m2Cost?f.value=((w=(N=n.value)==null?void 0:N.value)==null?void 0:w.toString())??null:!((S=n.value)!=null&&S.coefficient)&&((v=n.value)!=null&&v.value)&&(u.value=o()),y()}),(N,w)=>{var $,E,A;const S=z.NInput,v=z.NInputGroup;return i.openBlock(),i.createBlock(i.unref(z.NFormItem),{"show-label":!i.unref(D.isNil)(t.label),label:t.label,"show-feedback":!i.unref(D.isNil)((($=p.value)==null?void 0:$.feedback)??t.feedback),feedback:((E=p.value)==null?void 0:E.feedback)??t.feedback,"validation-status":((A=p.value)==null?void 0:A.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(v,{key:0,class:i.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:i.withCtx(()=>[i.createVNode(xu,{class:"w-full min-w-0 flex-1",value:u.value,"reference-list":d.value,clearable:t.clearable,disabled:t.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"disabled-item":t.disabledCoefficient,"onUpdate:value":b},null,8,["value","reference-list","clearable","disabled","disabled-item"]),i.createVNode(S,{value:h.value,"onUpdate:value":[w[0]||(w[0]=R=>h.value=R),_],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(S,{key:1,value:f.value,"onUpdate:value":[w[1]||(w[1]=R=>f.value=R),k],clearable:t.clearable,disabled:t.disabled,placeholder:"Стоимость",class:"w-full"},i.createSlots({_:2},[a.value?{name:"suffix",fn:i.withCtx(()=>{var R;return[i.createTextVNode(i.toDisplayString((R=l.value)==null?void 0:R.currency.symbol),1)]}),key:"0"}:void 0]),1032,["value","clearable","disabled"])):i.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),o_={key:0,class:"flex flex-row gap-2.5"},s_={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},a_={},ku=i.defineComponent({...a_,__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=it.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=it.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=(m="other",p=!1)=>{if(a.value&&!p){o("processing:cancel",_=>{a.value=_});return}let g=!1;o("closing",m,()=>{g=!0}),g||(s.value=!1,o("update:show",s.value))},f=()=>{o("accept",p=>{a.value=p})};return i.watch(()=>r.show,m=>{m?u():h("other",!0)}),i.watch(()=>r.processing,m=>{a.value=m}),e({open:u,close:h,acceptHandler:f}),(m,p)=>{const g=z.NButton,y=z.NModal;return i.openBlock(),i.createBlock(y,{loading:a.value,show:s.value,"show-icon":!1,size:i.unref(l),style:i.normalizeStyle(`width: ${d.value}px`),title:t.title,"trap-focus":t.trapFocus??!0,"action-class":m.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:p[1]||(p[1]=b=>h("header")),onEsc:p[2]||(p[2]=b=>h("esc")),onMaskClick:p[3]||(p[3]=b=>h("mask"))},i.createSlots({default:i.withCtx(()=>[i.renderSlot(m.$slots,"default")]),_:2},[m.$slots.header?{name:"header",fn:i.withCtx(()=>[i.renderSlot(m.$slots,"header")]),key:"0"}:void 0,m.$slots.action||m.$slots["extra-action"]||t.acceptButton.show||t.cancelButton.show?{name:"action",fn:i.withCtx(()=>[m.$slots["extra-action"]?(i.openBlock(),i.createElementBlock("div",o_,[i.renderSlot(m.$slots,"extra-action")])):i.createCommentVNode("",!0),m.$slots.action||t.acceptButton.show||t.cancelButton.show?(i.openBlock(),i.createElementBlock("div",s_,[i.renderSlot(m.$slots,"action",{disabled:a.value}),t.acceptButton.show??!0?(i.openBlock(),i.createBlock(g,{key:0,disabled:a.value||!t.valid,loading:a.value,size:i.unref(l),type:"primary",onClick:f},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","loading","size"])):i.createCommentVNode("",!0),t.cancelButton.show??!0?(i.openBlock(),i.createBlock(g,{key:1,disabled:a.value,size:i.unref(l),type:"default",onClick:p[0]||(p[0]=b=>h("footer"))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.cancelButton.text??"Отмена"),1)]),_:1},8,["disabled","size"])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["loading","show","size","style","title","trap-focus","action-class"])}}}),l_={class:"text-sm"},c_={class:"text-sm"},d_={},u_=i.defineComponent({...d_,__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(!1),a=i.ref(null),l=i.computed(()=>{var R,F,H;return((R=a.value)==null?void 0:R.unit.isLinear)&&((H=(F=a.value)==null?void 0:F.properties)==null?void 0:H.isLengthConfigurator)}),c=i.computed(()=>a.value?j.UnitsHelper.productIsMeasurable(a.value)||l.value?"шт.":a.value.unit.name:"шт."),d=i.ref(void 0),u=i.ref(void 0),h=i.ref(!0),f=i.ref(null),m=i.computed({get:()=>{var R;return((R=f.value)==null?void 0:R.quantity)??null},set:R=>{f.value&&(f.value.quantity=R??0)}}),p=i.computed({get:()=>{var R;return((R=f.value)==null?void 0:R.length)??null},set:R=>{f.value&&(f.value.length=R??void 0)}}),g=R=>{f.value&&(f.value.marker=R??null)},y=n,b=()=>({length:{},quantity:{},marker:{}}),_=i.ref(b()),k=i.ref(!1),x=i.computed(()=>{var Z,O,P,V;if(!a.value)return{};const R=j.UnitsHelper.getProductLengthMultiplicity(a.value),F=j.UnitsHelper.getProductMultiplicity(a.value),H=((O=(Z=a.value)==null?void 0:Z.properties)==null?void 0:O.minLength)||R,Q=(V=(P=a.value)==null?void 0:P.properties)==null?void 0:V.maxLength;return{length:[ae.required,ae.min(H??.1),ae.max(Q),ae.step(R),We.serverValidation(_.value.length.feedback)],quantity:[ae.required,ae.min(F),ae.step(F),We.serverValidation(_.value.quantity.feedback)],marker:[We.serverValidation(_.value.marker.feedback)]}}),C=i.computed(()=>{var R,F,H;return a.value?((R=a.value.properties)==null?void 0:R.lengthStep)??((F=a.value.properties)!=null&&F.ignoreMinCountCheck?0:((H=a.value.properties)==null?void 0:H.minCount)??0):0}),N=i.computed(()=>{var H,Q,Z,O,P,V,M,L,Y;if(!a.value)return"";const R=((Q=(H=a.value)==null?void 0:H.properties)==null?void 0:Q.minLength)??((O=(Z=a.value)==null?void 0:Z.properties)!=null&&O.ignoreMinCountCheck?0:(V=(P=a.value)==null?void 0:P.properties)==null?void 0:V.minCount),F=(L=(M=a.value)==null?void 0:M.properties)==null?void 0:L.maxLength;return R||F?`(${R?`от ${R}`:""}${R&&F?" ":""}${F?`до ${F}`:""} ${(Y=a.value)==null?void 0:Y.unit.name})`:""}),w=R=>{var O,P;if(!((P=(O=a.value)==null?void 0:O.properties)!=null&&P.isLengthConfigurator)||!f.value||D.isNil(R)||C.value===0)return;const F=R/C.value,H=Math.round(F),Q=j.UnitsHelper.getProductMultiplicity(a.value),Z=Math.max(H,Q);f.value.quantity=Z},S=R=>{var Z,O,P,V;if(!((O=(Z=a.value)==null?void 0:Z.properties)!=null&&O.isLengthConfigurator)||!f.value||D.isNil(R)||C.value===0)return;const F=R*C.value,H=((P=a.value.properties)==null?void 0:P.minLength)||j.UnitsHelper.getProductLengthMultiplicity(a.value),Q=(V=a.value.properties)==null?void 0:V.maxLength;H!==void 0&&F<H?f.value.length=H:Q!==void 0&&F>Q?f.value.length=Q:f.value.length=F},v=async R=>{var H;const F=D.cloneDeep(f.value);try{await((H=r.value)==null?void 0:H.validate(Q=>{if(!Q){if(!a.value||!F)return;j.UnitsHelper.productIsMeasurable(a.value)||delete F.length,l.value&&C.value&&(F.length=C.value),k.value=!0,y("submit",F,_.value,()=>{k.value=!1,R(!1),i.nextTick(()=>{var Z;(Z=r.value)==null||Z.validate(D.noop).catch(D.noop)})})}}))}catch{}},$=()=>{a.value=null,d.value=void 0,f.value=null,_.value=b()},E=()=>{s.value=!1};return e({show:(R,F)=>{var H,Q,Z,O,P;if($(),s.value=!0,a.value=R,d.value=F==null?void 0:F.cartItemData,u.value=F==null?void 0:F.orderId,h.value=(F==null?void 0:F.canSetDopProdaga)??!1,f.value=new j.OrderItemBase((F==null?void 0:F.cartItemData)??new j.OrderItemBase({product:R,quantity:j.UnitsHelper.productIsMeasurable(a.value)?1:((H=R==null?void 0:R.properties)==null?void 0:H.minCount)??1,length:((Q=R==null?void 0:R.properties)==null?void 0:Q.minLength)||((Z=R==null?void 0:R.properties)!=null&&Z.ignoreMinCountCheck?0:(O=R==null?void 0:R.properties)==null?void 0:O.minCount)||0})),(P=R==null?void 0:R.properties)!=null&&P.isLengthConfigurator&&f.value&&C.value>0){const V=C.value,M=f.value.quantity||1;f.value.length=M*V}},closeDialog:E}),(R,F)=>{var P;const H=z.NFormItem,Q=z.NInputGroupLabel,Z=z.NInputGroup,O=z.NCheckbox;return i.openBlock(),i.createBlock(ku,{ref:"base-dialog-reference",show:s.value,title:`${d.value?"Изменение":"Добавление"} товара ${(P=a.value)==null?void 0:P.name} в ${u.value?` заказ №${u.value}`:"корзину"}`,"accept-button":{show:!0,text:d.value?"Изменить":"Добавить"},processing:k.value,"modal-width":500,onAccept:v,onClosing:E},{default:i.withCtx(()=>[a.value&&f.value?i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{key:0,ref:"form-reference",model:f.value,rules:x.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>[i.unref(j.UnitsHelper).productIsMeasurable(a.value)?(i.openBlock(),i.createBlock(H,{key:0,path:"length",label:`Метраж, ${N.value+a.value.unit.name}`},i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:p.value,"onUpdate:value":[F[0]||(F[0]=V=>p.value=V),w],parse:i.unref(lt),step:i.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:F[1]||(F[1]=V=>i.unref(eo)(V,".",!1)),onInput:F[2]||(F[2]=V=>i.unref(nt)(_.value,"length")),onFocus:i.unref(Le)},null,8,["value","parse","step","onFocus"])]),_:2},[!_.value.length.feedback&&i.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",l_,"Метраж должно быть кратно "+i.toDisplayString(i.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)),1)]),key:"0"}:void 0]),1032,["label"])):i.createCommentVNode("",!0),i.createVNode(H,{path:"quantity",label:`Количество, ${c.value}`},{default:i.withCtx(()=>[i.createVNode(Z,null,i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:m.value,"onUpdate:value":[F[3]||(F[3]=V=>m.value=V),S],parse:i.unref(lt),step:i.unref(j.UnitsHelper).getProductMultiplicity(a.value),"show-button":i.unref(j.UnitsHelper).getProductMultiplicity(a.value)>1,"button-placement":"both",placeholder:"Введите количество",class:"w-full",onKeydown:F[4]||(F[4]=V=>i.unref(eo)(V,".",!1)),onInput:F[5]||(F[5]=V=>i.unref(nt)(_.value,"quantity")),onFocus:i.unref(Le)},null,8,["value","parse","step","show-button","onFocus"]),l.value?(i.openBlock(),i.createBlock(Q,{key:0,class:"bg-orange-100 font-bold"},{default:i.withCtx(()=>[i.createTextVNode(" x "+i.toDisplayString(C.value)+" "+i.toDisplayString(a.value.unit.name),1)]),_:1})):i.createCommentVNode("",!0)]),_:2},[!_.value.quantity.feedback&&i.unref(j.UnitsHelper).getProductMultiplicity(a.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",c_,"Количество должно быть кратно "+i.toDisplayString(i.unref(j.UnitsHelper).getProductMultiplicity(a.value)),1)]),key:"0"}:void 0]),1024)]),_:1},8,["label"]),i.unref(j.UnitsHelper).productIsMeasurable(a.value)?(i.openBlock(),i.createBlock(H,{key:1,path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:f.value.marker??null,placeholder:"Введите маркировку",onInput:F[6]||(F[6]=V=>i.unref(nt)(_.value,"marker")),"onUpdate:value":F[7]||(F[7]=V=>g(V)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1})):i.createCommentVNode("",!0),h.value?(i.openBlock(),i.createBlock(O,{key:2,checked:f.value.isAdditionalSale,"onUpdate:checked":F[8]||(F[8]=V=>f.value.isAdditionalSale=V),"true-value":!0,"false-value":!1},{default:i.withCtx(()=>[...F[9]||(F[9]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0)]),_:1},8,["model","rules"])),[[i.unref(ei),()=>{var V,M;return(M=(V=o.value)==null?void 0:V.acceptHandler)==null?void 0:M.call(V)}]]):i.createCommentVNode("",!0)]),_:1},8,["show","title","accept-button","processing"])}}}),f_={class:"flex flex-row gap-1"},h_={class:"sc-client-name flex flex-col gap-1 text-base"},m_=["href"],p_={key:1,class:"text-sc-grey"},g_={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},y_={key:0},b_={key:1,class:"text-sm"},__={},Er=i.defineComponent({...__,__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?He.format(n.client.lastLoginAt,j.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{D.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=ps,d=z.NButton,u=z.NPopover;return i.openBlock(),i.createElementBlock("div",f_,[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(D.isNil)(t.popoverPosition),placement:t.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",h_,[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",p_," [ Деактивирован ] "))],8,m_),t.showCityAndRegion&&t.client.city?(i.openBlock(),i.createElementBlock("span",g_," г. "+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",y_,i.toDisplayString(t.client.alternativeName),1)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("span",b_," Последний вход: "+i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),w_={class:"text-base"},x_={},vu=i.defineComponent({...x_,__name:"contragent-with-short-info",props:{contragent:{}},setup(t){const e=t,n=i.computed(()=>ti.getFormatEntityName(e.contragent));return(r,o)=>(i.openBlock(),i.createElementBlock("span",w_,i.toDisplayString(n.value),1))}}),k_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function v_(t,e){return i.openBlock(),i.createElementBlock("svg",k_,[...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 C_=i.markRaw({name:"tabler-mail",render:v_}),S_=["href"],B_={},T_=i.defineComponent({...B_,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(t){return(e,n)=>{const r=C_;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,S_)],2)}}}),N_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function $_(t,e){return i.openBlock(),i.createElementBlock("svg",N_,[...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 Cu=i.markRaw({name:"fa6-brands-viber",render:$_}),R_={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},E_=["id"],P_=["id"],F_=["fill"],V_=["fill"];function M_(t,e){return i.openBlock(),i.createElementBlock("svg",R_,[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,E_),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,P_)]),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,F_),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,V_),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 Su=i.markRaw({name:"logos-whatsapp-icon",render:M_,setup(){const t=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+t(),SVGHW6lecxh:"uicons-"+t()}}}}),A_={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},I_=["id"],O_=["fill"];function z_(t,e){return i.openBlock(),i.createElementBlock("svg",A_,[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,I_)]),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,O_),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 Bu=i.markRaw({name:"logos-telegram",render:z_,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),D_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function L_(t,e){return i.openBlock(),i.createElementBlock("svg",D_,[...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 Tu=i.markRaw({name:"ion-call",render:L_}),H_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function W_(t,e){return i.openBlock(),i.createElementBlock("svg",H_,[...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 j_=i.markRaw({name:"tabler-phone-call",render:W_}),q_={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},X_=["href"],Y_=["href"],U_=["href"],K_=["href"],G_={},Z_=i.defineComponent({...G_,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(t){const e=t,n=i.computed(()=>{try{return e.phone?br.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=i.computed(()=>{var l;return D.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),o=i.computed(()=>{var l;return D.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=i.computed(()=>{var l;return D.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=j_,u=Tu,h=Bu,f=Su,m=Cu;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]=p=>a.value=!a.value),onFocusout:c[1]||(c[1]=p=>a.value=!1),onMouseleave:c[2]||(c[2]=p=>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",q_,[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,Y_)):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,U_)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${s.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[i.createVNode(m)],8,K_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),Q_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function J_(t,e){return i.openBlock(),i.createElementBlock("svg",Q_,[...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 ew=i.markRaw({name:"mdi-envelope",render:J_}),tw={class:"flex flex-col gap-1"},nw={key:0,class:"mb-2 flex flex-col text-base"},iw={key:0,class:"text-sc-dark-grey text-sm"},rw={key:1,class:"whitespace-nowrap text-sm"},ow={key:2,class:"whitespace-nowrap text-sm"},sw={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},aw=["href"],lw=["href"],cw=["href"],dw=["href"],uw=["href"],fw={key:0,class:"flex flex-col text-base"},hw={key:0,class:"text-sc-dark-grey text-sm"},mw={key:1,class:"mt-2 text-sm"},pw={key:0,class:"-mt-1"},gw={},yw=i.defineComponent({...gw,__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(()=>ti.getFormatEntityName(e.contact)),r=i.computed(()=>{try{return e.contact.phone?br.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),o=i.computed(()=>{var d;return D.isString(r.value)?!1:((d=r.value)==null?void 0:d.isValid())??!1}),s=i.computed(()=>{var d;return D.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("INTERNATIONAL"))??""}),a=i.computed(()=>{var d;return D.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("E.164"))??""}),l=i.computed(()=>o.value||e.contact.email),c=i.ref(!1);return(d,u)=>{var b,_;const h=Tu,f=Bu,m=Su,p=Cu,g=ew,y=z.NPopover;return i.openBlock(),i.createElementBlock("div",tw,[i.createVNode(y,{disabled:t.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var k,x,C,N;return[i.createElementVNode("div",{class:i.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(k=t.contact)!=null&&k.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${t.classes}`),style:i.normalizeStyle(t.styles),onMouseenter:u[0]||(u[0]=w=>c.value=!0),onFocusin:u[1]||(u[1]=w=>c.value=!0),onMouseleave:u[2]||(u[2]=w=>c.value=!1),onFocusout:u[3]||(u[3]=w=>c.value=!1)},[i.createElementVNode("div",null,[t.fullView&&(t.contact.name||(x=t.contact)!=null&&x.position)?(i.openBlock(),i.createElementBlock("div",nw,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),(C=t.contact)!=null&&C.position?(i.openBlock(),i.createElementBlock("span",iw,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",rw,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("div",ow,i.toDisplayString(t.contact.email),1)):i.createCommentVNode("",!0),l.value&&c.value?(i.openBlock(),i.createElementBlock("div",sw,[o.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:`tel:${a.value}`,class:"text-blue-600 hover:text-3xl hover:text-blue-600"},[i.createVNode(h)],8,aw)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("a",{key:1,href:`https://t.me/${a.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(f)],8,lw)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${a.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(m)],8,cw)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${a.value}`,class:"text-purple-600 hover:text-3xl hover:text-purple-600"},[i.createVNode(p)],8,dw)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${t.contact.email}`,class:"hover:text-3xl"},[i.createVNode(g)],8,uw)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var k,x,C,N;return[t.contact.name?(i.openBlock(),i.createElementBlock("div",fw,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),(k=t.contact)!=null&&k.position?(i.openBlock(),i.createElementBlock("span",hw,i.toDisplayString((x=t.contact)==null?void 0:x.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),(C=t.contact)!=null&&C.comment?(i.openBlock(),i.createElementBlock("div",mw,[u[4]||(u[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",pw,[u[5]||(u[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((_=t.contact)==null?void 0:_.comment),1)])):i.createCommentVNode("",!0)])}}});class bw{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=hs.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=hs.objectToSnake(e.heightOverlaps),this.widthOverlaps=hs.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function _w(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.SandwichM2?!0:t.properties.configuratorSettings!==void 0&&D.isArray(t.products)&&t.products.length>0}const ww={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function xw(t,e){return i.openBlock(),i.createElementBlock("svg",ww,[...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 kw=i.markRaw({name:"mdi-dots-horizontal",render:xw}),Nu="date-range.dialog.mode",$u=["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],Ru=(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?He.startOfDay(r):void 0,to:o?He.endOfDay(o):void 0}},vw={class:"text-center font-semibold"},Cw={class:"grid grid-cols-3 gap-1"},Sw=["onPointerdown","onPointerenter","onKeydown"],Bw={},Tw=i.defineComponent({...Bw,__name:"month-range-grid",props:{from:{},to:{}},emits:["select"],setup(t,{emit:e}){const n=t,r=e,o=z.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 S=new Date().getFullYear();return w&&He.isValid(w)?w.getFullYear():S},l=i.ref(a(n.from??n.to)),c=it.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),m=i.ref(null),p=i.computed(()=>{const{from:w,to:S}=n;return!w||!S||!He.isSameDay(w,He.startOfMonth(w))||!He.isSameDay(S,He.endOfMonth(S))?null:[w.getFullYear()*12+w.getMonth(),S.getFullYear()*12+S.getMonth()]}),g=i.computed(()=>f.value&&h.value!==null&&m.value!==null?y(h.value,m.value):u.value!==null?m.value===null?[u.value,u.value]:y(u.value,m.value):p.value),y=(w,S)=>w<=S?[w,S]:[S,w],b=(w,S)=>{const v=w*12+S,$=g.value;return $&&v>=$[0]&&v<=$[1]?[v===$[0]||v===$[1]?"sc-month--bound":"sc-month--in-range"]:[]},_=(w,S)=>{const[v,$]=y(w,S);u.value=null,r("select",{from:new Date(Math.floor(v/12),v%12,1),to:He.endOfMonth(new Date(Math.floor($/12),$%12,1))})},k=w=>{u.value===null?(u.value=w,r("select",{from:new Date(Math.floor(w/12),w%12,1),to:He.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,m.value!==null&&_(w,m.value);return}k(w)}},C=(w,S)=>{h.value=w*12+S,f.value=!1,globalThis.addEventListener("pointerup",x)},N=(w,S)=>{const v=w*12+S;m.value=v,h.value!==null&&v!==h.value&&(f.value=!0)};return i.watch(()=>[n.from,n.to],()=>{const w=n.from??n.to;if(!w||!He.isValid(w))return;const S=w.getFullYear();(S<l.value-1||S>l.value+1)&&(l.value=S)}),i.onBeforeUnmount(()=>{globalThis.removeEventListener("pointerup",x)}),(w,S)=>{const v=z.NButton;return i.openBlock(),i.createElementBlock("div",{class:"flex select-none items-start gap-2",style:i.normalizeStyle(s.value),onPointerleave:S[2]||(S[2]=$=>m.value=null)},[i.createVNode(v,{size:"small",quaternary:"",class:"mt-5",onClick:S[0]||(S[0]=$=>l.value-=1)},{default:i.withCtx(()=>[...S[3]||(S[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,$=>(i.openBlock(),i.createElementBlock("div",{key:$,class:"flex flex-col gap-1"},[i.createElementVNode("div",vw,i.toDisplayString($),1),i.createElementVNode("div",Cw,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref($u),(E,A)=>(i.openBlock(),i.createElementBlock("button",{key:E,type:"button",class:i.normalizeClass(["sc-month cursor-pointer rounded border-0 px-1 py-1 text-sm",b($,A)]),onPointerdown:i.withModifiers(R=>C($,A),["prevent"]),onPointerenter:R=>N($,A),onKeydown:[i.withKeys(i.withModifiers(R=>k($*12+A),["prevent"]),["enter"]),i.withKeys(i.withModifiers(R=>k($*12+A),["prevent"]),["space"])]},i.toDisplayString(E),43,Sw))),128))])]))),128))],2),i.createVNode(v,{size:"small",quaternary:"",class:"mt-5",onClick:S[1]||(S[1]=$=>l.value+=1)},{default:i.withCtx(()=>[...S[4]||(S[4]=[i.createTextVNode(" › ",-1)])]),_:1})],36)}}}),Nw=An(Tw,[["__scopeId","data-v-7dd4941e"]]),$w={class:"sc-date-range-sidebar flex flex-col gap-1"},Rw={class:"flex items-center justify-center gap-1"},Ew={class:"min-w-12 text-center font-semibold"},Pw={class:"grid grid-flow-col grid-cols-2 grid-rows-6 gap-1"},Fw={},Vw=i.defineComponent({...Fw,__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=z.NButton;return i.openBlock(),i.createElementBlock("div",$w,[i.createElementVNode("div",Rw,[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",Ew,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",Pw,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref($u),(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})])}}}),Mw={},Eu=i.defineComponent({...Mw,__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=it.initRefDependingOnDeviceResolution(!0,!1,!1),s=i.ref(null),a=i.ref(!1),l=i.ref(0),c=i.ref(n.value&&He.isValid(n.value)?n.value:new Date),d=i.computed(()=>{const k=n.value&&He.isValid(n.value)?n.value:c.value;return k.getFullYear()===c.value.getFullYear()?k.getMonth():null});let u=0;const h=k=>{var x,C;(C=(x=k.target)==null?void 0:x.closest)!=null&&C.call(x,".n-base-clear")&&(u=performance.now())},f=k=>{k&&performance.now()-u<300||(a.value=k,k&&(c.value=n.value&&He.isValid(n.value)?n.value:new Date))},m=k=>{r("update:value",k===null?null:new Date(k))},p=(k,x)=>{const C=new Date(k,x,1);if(c.value=C,n.value&&He.isValid(n.value)){const N=Math.min(He.getDate(n.value),He.getDaysInMonth(C));r("update:value",new Date(k,x,N));return}l.value+=1,i.nextTick().then(()=>{var N;return(N=s.value)==null?void 0:N.focus()})},g=(k,x)=>{c.value=He.addYears(He.addMonths(c.value,k),x)},y=k=>{p(k,c.value.getMonth())},b=k=>{p(c.value.getFullYear(),k)},_=()=>{a.value=!1,r("update:value",new Date)};return(k,x)=>{const C=z.NButton,N=z.NDatePicker;return i.openBlock(),i.createBlock(N,{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":m,onNextMonth:x[0]||(x[0]=w=>g(1,0)),onPrevMonth:x[1]||(x[1]=w=>g(-1,0)),onNextYear:x[2]||(x[2]=w=>g(0,1)),onPrevYear:x[3]||(x[3]=w=>g(0,-1))},{footer:i.withCtx(()=>[i.unref(o)?(i.openBlock(),i.createBlock(C,{key:1,size:"small",text:"",type:"info",onClick:_},{default:i.withCtx(()=>[...x[4]||(x[4]=[i.createTextVNode(" Сегодня ",-1)])]),_:1})):(i.openBlock(),i.createBlock(Vw,{key:0,year:c.value.getFullYear(),month:d.value,"onUpdate:year":y,onSelectMonth:b,onToday:_},null,8,["year","month"]))]),_:1},8,["value","show","clearable","disabled","placeholder","format","default-calendar-start-time"])}}}),Aw={class:"@container"},Iw={class:"flex flex-col gap-1 @xs:flex-row @xs:items-center"},Ow={},Pu=i.defineComponent({...Ow,__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",Aw,[i.createElementVNode("div",Iw,[i.createVNode(Eu,{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(Eu,{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"])])])}}}),zw={class:"flex flex-col items-stretch gap-3 sm:flex-row"},Dw={class:"order-2 flex-1 rounded-lg border border-solid border-gray-200 p-2 shadow-sm"},Lw={class:"flex flex-col items-stretch pr-3"},Hw={key:0,class:"px-2 pb-0.5 pt-2 text-xs text-gray-400"},Ww={key:1,class:"order-2 w-44 shrink-0 rounded-lg border border-solid border-gray-200 p-1 shadow-sm"},jw={},qw=i.defineComponent({...jw,__name:"standard-periods",props:{activeKey:{},customPeriods:{}},emits:["apply","preview"],setup(t,{emit:e}){const n=t,r=e,o="custom",s=it.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 D.isEmpty(n.customPeriods)||h.push({key:o,value:o,label:"Пользовательские"}),h}),d=h=>Object.entries(h).map(([f,m])=>({value:f,label:m.label,item:m})),u=i.computed(()=>{if(l.value===o)return[{type:"group",key:o,children:d(n.customPeriods??{})}];const h=Object.entries(a).filter(([,m])=>m.group===l.value),f=Object.fromEntries(h);return l.value!=="other"?[{type:"group",key:l.value,children:d(f)}]:j.STANDARD_PERIOD_SECTIONS.map(m=>{const p=h.filter(([,g])=>g.section===m.key);return{type:"group",key:m.key,label:m.label,children:d(Object.fromEntries(p))}}).filter(m=>{var p;return(((p=m.children)==null?void 0:p.length)??0)>0})});return(h,f)=>{const m=z.NButton,p=z.NScrollbar,g=z.NSelect,y=z.NMenu;return i.openBlock(),i.createElementBlock("div",zw,[i.createElementVNode("div",Dw,[i.createVNode(p,{class:"max-h-96"},{default:i.withCtx(()=>[i.createElementVNode("div",Lw,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(u.value,b=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:b.key},[b.label?(i.openBlock(),i.createElementBlock("div",Hw,i.toDisplayString(b.label),1)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(b.children,_=>(i.openBlock(),i.createBlock(m,{key:_.value,size:"small",quaternary:"",type:_.value===t.activeKey?"primary":"default",class:"justify-start",onClick:k=>r("apply",_),onMouseenter:k=>r("preview",_),onMouseleave:f[0]||(f[0]=k=>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(g,{key:0,value:l.value,options:c.value,class:"order-1","onUpdate:value":f[1]||(f[1]=b=>l.value=b)},null,8,["value","options"])):(i.openBlock(),i.createElementBlock("div",Ww,[i.createVNode(y,{value:l.value,options:c.value,mode:"vertical","onUpdate:value":f[2]||(f[2]=b=>l.value=b)},null,8,["value","options"])]))])}}}),Xw={class:"flex flex-col gap-3"},Yw={class:"flex flex-col gap-1 sm:flex-row sm:items-center"},Uw={key:0,class:"overflow-x-auto rounded-lg border border-solid border-gray-200 p-2 shadow-sm sm:p-3"},Kw={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},Gw={class:"flex gap-2"},Zw={},Qw=i.defineComponent({...Zw,__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=it.initRefDependingOnDeviceResolution("100%","90%","44rem"),s=i.ref("custom"),a=()=>j.PreferencesStorageProvider.getActualDataFromStorage(Nu)==="standard"?"standard":"custom",l=i.ref({}),c=i.ref(null),d=i.ref(null),u=i.computed(()=>c.value??l.value),h=(x,C)=>{var S,v;const N=(S=n.disabled)!=null&&S.from?l.value.from:x,w=(v=n.disabled)!=null&&v.to?l.value.to:C;c.value=null,l.value=Ru(N,w,n.disabled)},f=x=>{d.value=null,h(x,l.value.to)},m=x=>{d.value=null,h(l.value.from,x)},p=()=>{d.value=null,h(null,null)},g=x=>{d.value=null,h(x.from,x.to)},y=x=>{const C=x.item;h(C.from,C.to),d.value=String(x.value)},b=x=>{const C=x==null?void 0:x.item;c.value=C?{from:C.from,to:C.to}:null},_=()=>{c.value=null,s.value=s.value==="custom"?"standard":"custom";const x=Nu;j.PreferencesStorageProvider.saveActualDataToStorage(x,s.value,He.addYears(He.startOfToday(),1))},k=()=>{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,C)=>{const N=z.NButton,w=z.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":C[1]||(C[1]=S=>r("update:show",S))},{footer:i.withCtx(()=>[i.createElementVNode("div",Kw,[i.createVNode(N,{text:"",type:"info",onClick:_},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(s.value==="custom"?"Показать стандартные периоды":"Показать произвольный период"),1)]),_:1}),i.createElementVNode("div",Gw,[i.createVNode(N,{type:"primary",onClick:k},{default:i.withCtx(()=>[...C[3]||(C[3]=[i.createTextVNode(" Выбрать ",-1)])]),_:1}),i.createVNode(N,{onClick:C[0]||(C[0]=S=>r("update:show",!1))},{default:i.withCtx(()=>[...C[4]||(C[4]=[i.createTextVNode("Отмена",-1)])]),_:1})])])]),default:i.withCtx(()=>[i.createElementVNode("div",Xw,[i.createElementVNode("div",Yw,[i.createVNode(Pu,{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":m},null,8,["from","to","clearable","disabled","date-format"]),t.clearable?(i.openBlock(),i.createBlock(N,{key:0,text:"",type:"info",class:"sm:ml-2",onClick:p},{default:i.withCtx(()=>[...C[2]||(C[2]=[i.createTextVNode(" Очистить период ",-1)])]),_:1})):i.createCommentVNode("",!0)]),s.value==="custom"?(i.openBlock(),i.createElementBlock("div",Uw,[i.createVNode(Nw,{from:l.value.from,to:l.value.to,onSelect:g},null,8,["from","to"])])):(i.openBlock(),i.createBlock(qw,{key:1,"active-key":d.value,"custom-periods":t.customPeriods,onApply:y,onPreview:b},null,8,["active-key","custom-periods"]))])]),_:1},8,["show","style"])}}}),Jw={class:"flex w-full min-w-28 items-center gap-1"},ex={},tx=i.defineComponent({...ex,__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 D.isEmpty(u)?void 0:u}),a=(u,h)=>{r("update:date-range",Ru(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 p,g,y,b;const f=kw,m=z.NButton;return i.openBlock(),i.createElementBlock("div",Jw,[i.createVNode(Pu,{from:(p=t.dateRange)==null?void 0:p.from,to:(g=t.dateRange)==null?void 0:g.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(m,{disabled:!!((y=t.disabled)!=null&&y.from&&((b=t.disabled)!=null&&b.to)),title:"Выбрать период","aria-label":"Выбрать период",onClick:h[0]||(h[0]=_=>o.value=!0)},{default:i.withCtx(()=>[i.createVNode(f)]),_:1},8,["disabled"]),i.createVNode(Qw,{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"])])}}}),nx={class:"sc-lbl-date text-nowrap"},ix={},Lo=i.defineComponent({...ix,__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(()=>He.format(e.date,j.useBaseConfigStateStore().config.dateFormats.uiDate)),r=i.computed(()=>He.format(e.date,"HH:mm"));return(o,s)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-col":t.isTimeOnSecondLine})},[i.createElementVNode("span",nx,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))}}),rx={},ox=i.defineComponent({...rx,__name:"debt",props:{debt:{default:0},showLabel:{type:Boolean,default:!1},wrapAsSmall:{type:Boolean,default:!1}},setup(t){const e=t,n=i.computed(()=>{let r="";return(e.showLabel??!1)&&(e.debt>0?r="Переплата: ":e.debt<0&&(r="Задолженность: ")),r});return(r,o)=>t.debt!==0?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass({"text-sm":t.wrapAsSmall})},[i.createTextVNode(i.toDisplayString(n.value)+" ",1),i.createElementVNode("span",{class:i.normalizeClass({"text-green-700":t.debt>0,"text-red-700":t.debt<0})},i.toDisplayString(t.debt)+" ₽ ",3)],2)):i.createCommentVNode("",!0)}}),sx={class:"flex flex-row gap-2.5"},ax={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},lx={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},cx={class:"mb-0.5 sm:mb-0 sm:ml-3"},dx={},ux=i.defineComponent({...dx,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(t){return(e,n)=>{const r=Do,o=z.NButton,s=z.NPopover;return i.openBlock(),i.createElementBlock("div",sx,[i.createElementVNode("div",ax,[i.renderSlot(e.$slots,"main")]),i.createElementVNode("div",null,[i.createElementVNode("div",lx,[i.renderSlot(e.$slots,"extra-buttons"),i.createElementVNode("div",cx,[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)])])])])}}}),fx={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function hx(t,e){return i.openBlock(),i.createElementBlock("svg",fx,[...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 mx=i.markRaw({name:"ion-checkmark-done-sharp",render:hx}),px={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function gx(t,e){return i.openBlock(),i.createElementBlock("svg",px,[...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 yx=i.markRaw({name:"ion-options-outline",render:gx}),bx={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},_x={class:"flex-auto"},wx={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"},xx={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"},kx={},pa=i.defineComponent({...kx,__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=yx,h=z.NButton,f=z.NPopover,m=mx,p=Do;return i.openBlock(),i.createElementBlock("div",bx,[i.createElementVNode("div",_x,[i.renderSlot(c.$slots,"default")]),i.createElementVNode("div",null,[i.createElementVNode("div",wx,[i.createElementVNode("div",xx,[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(m)]),_: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(p)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[2]||(d[2]=i.createTextVNode(" Отменить изменения ",-1))]),_:1})):i.createCommentVNode("",!0)]),i.renderSlot(c.$slots,"extra-buttons")])])])}}}),vx={},Fu=i.defineComponent({...vx,__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(pa,{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(pa,{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"]))]))}}),Cx={key:0,class:"whitespace-pre-line"},Sx={key:1,class:"text-sc-dark-grey"},Bx={},Tx=i.defineComponent({...Bx,__name:"comment-editor",props:{disabled:{type:Boolean,default:!1},comment:{default:""}},emits:["update:comment"],setup(t,{emit:e}){const n=t,r=e,o=i.ref(n.comment);i.watch(()=>o.value,l=>{o.value=l});const s=l=>{r("update:comment",o.value,l)},a=()=>{o.value=n.comment};return(l,c)=>{const d=z.NInput;return i.openBlock(),i.createBlock(Fu,{disabled:t.disabled,"onEditor:apply":s,"onEditor:cancel":a},{viewer:i.withCtx(()=>[i.createElementVNode("div",null,[t.comment?(i.openBlock(),i.createElementBlock("span",Cx,i.toDisplayString(t.comment),1)):(i.openBlock(),i.createElementBlock("span",Sx," - Комментарий отсутствует - "))])]),editor:i.withCtx(()=>[i.createVNode(d,{value:o.value,"onUpdate:value":c[0]||(c[0]=u=>o.value=u),clearable:!0,type:"textarea"},null,8,["value"])]),_:1},8,["disabled"])}}}),Nx={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function $x(t,e){return i.openBlock(),i.createElementBlock("svg",Nx,[...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 Rx=i.markRaw({name:"ion-download-outline",render:$x}),Ex={},Px=i.defineComponent({...Ex,__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=Rx;return i.openBlock(),i.createBlock(i.unref(z.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(z.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"])}}}),Fx={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Vx(t,e){return i.openBlock(),i.createElementBlock("svg",Fx,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0 0 80 446.25h340.89a32 32 0 0 0 28.18-47.17m-198.6-1.83a20 20 0 1 1 20-20a20 20 0 0 1-20 20m21.72-201.15l-5.74 122a16 16 0 0 1-32 0l-5.74-121.95a21.73 21.73 0 0 1 21.5-22.69h.21a21.74 21.74 0 0 1 21.73 22.7Z"},null,-1)])])}const Mx=i.markRaw({name:"ion-warning",render:Vx}),Ax={},Ix=i.defineComponent({...Ax,__name:"warning-icon",props:{popoverText:{default:""},iconClass:{default:"text-sc-warning"}},setup(t){return(e,n)=>{const r=Mx,o=z.NPopover;return i.openBlock(),i.createBlock(o,{disabled:t.popoverText.length===0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(r,{class:i.normalizeClass(`ml-0.5 ${t.iconClass}`)},null,8,["class"])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.popoverText),1)]),_:1},8,["disabled"])}}}),Ox={},zx=i.defineComponent({...Ox,__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=D.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(z.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"]))}}),Dx={},Lx=i.defineComponent({...Dx,__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=D.debounce(()=>o("update:value",s.value),a.value),c=m=>{s.value=m,l()};i.watch(()=>r.value,m=>{s.value=m});const d=i.ref(null);return e({focus:()=>{var m;return(m=d.value)==null?void 0:m.focus()},blur:()=>{var m;return(m=d.value)==null?void 0:m.blur()},select:()=>{var m;return(m=d.value)==null?void 0:m.select()}}),(m,p)=>(i.openBlock(),i.createBlock(i.unref(z.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:p[0]||(p[0]=g=>o("keydown",g)),onInput:p[1]||(p[1]=g=>o("input",g)),onFocus:p[2]||(p[2]=g=>o("focus",g))},{prefix:i.withCtx(()=>[i.renderSlot(m.$slots,"prefix")]),_:3},8,["value","clearable","parse","show-button","placeholder","min","max","step","validator"]))}}),Hx={},Wx=i.defineComponent({...Hx,__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=D.debounce(c=>r("update:value",c),n.debounceTime??0),a=c=>{let d="";if(D.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(D.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof br.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=br.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof br.ParseError)o.value=d;else throw u}};return 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(Lh.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"]))}}),jx=An(Wx,[["__scopeId","data-v-751dbb0e"]]),qx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Xx(t,e){return i.openBlock(),i.createElementBlock("svg",qx,[...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 Yx=i.markRaw({name:"tabler-external-link",render:Xx}),Ux={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},Kx=["href"],Gx={},Zx=i.defineComponent({...Gx,__name:"external-link",props:{text:{},url:{},description:{}},setup(t){return(e,n)=>{const r=Yx,o=z.NTooltip;return i.openBlock(),i.createBlock(o,{disabled:i.unref(D.isUndefined)(t.description),placement:"top-start"},{trigger:i.withCtx(()=>[i.createElementVNode("span",Ux,[i.createElementVNode("a",{href:t.url,target:"_blank",class:"no-underline"},i.toDisplayString(t.text),9,Kx),i.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.description),1)]),_:1},8,["disabled"])}}}),Qx={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Jx(t,e){return i.openBlock(),i.createElementBlock("svg",Qx,[...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 ek=i.markRaw({name:"ion-remove-circle-outline",render:Jx});let Ho=[];const Vu=new WeakMap;function tk(){Ho.forEach(t=>t(...Vu.get(t))),Ho=[]}function Mu(t,...e){Vu.set(t,e),!Ho.includes(t)&&Ho.push(t)===1&&requestAnimationFrame(tk)}function Pr(t,e){let{target:n}=t;for(;n;){if(n.dataset&&n.dataset[e]!==void 0)return!0;n=n.parentElement}return!1}function Fr(t){return t.composedPath()[0]||null}function Vr(t){return typeof t=="string"?t.endsWith("px")?Number(t.slice(0,t.length-2)):Number(t):t}function Mr(t){if(t!=null)return typeof t=="number"?`${t}px`:t.endsWith("px")?t:`${t}px`}function fn(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 Au={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 nk(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 ik(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 Nn="^\\s*",$n="\\s*$",ai="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Kt="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",Ci="([0-9A-Fa-f])",Si="([0-9A-Fa-f]{2})",Iu=new RegExp(`${Nn}hsl\\s*\\(${Kt},${ai},${ai}\\)${$n}`),Ou=new RegExp(`${Nn}hsv\\s*\\(${Kt},${ai},${ai}\\)${$n}`),zu=new RegExp(`${Nn}hsla\\s*\\(${Kt},${ai},${ai},${Kt}\\)${$n}`),Du=new RegExp(`${Nn}hsva\\s*\\(${Kt},${ai},${ai},${Kt}\\)${$n}`),rk=new RegExp(`${Nn}rgb\\s*\\(${Kt},${Kt},${Kt}\\)${$n}`),ok=new RegExp(`${Nn}rgba\\s*\\(${Kt},${Kt},${Kt},${Kt}\\)${$n}`),sk=new RegExp(`${Nn}#${Ci}${Ci}${Ci}${$n}`),ak=new RegExp(`${Nn}#${Si}${Si}${Si}${$n}`),lk=new RegExp(`${Nn}#${Ci}${Ci}${Ci}${Ci}${$n}`),ck=new RegExp(`${Nn}#${Si}${Si}${Si}${Si}${$n}`);function qt(t){return parseInt(t,16)}function dk(t){try{let e;if(e=zu.exec(t))return[jo(e[1]),li(e[5]),li(e[9]),Ti(e[13])];if(e=Iu.exec(t))return[jo(e[1]),li(e[5]),li(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${t}.`)}catch(e){throw e}}function uk(t){try{let e;if(e=Du.exec(t))return[jo(e[1]),li(e[5]),li(e[9]),Ti(e[13])];if(e=Ou.exec(t))return[jo(e[1]),li(e[5]),li(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${t}.`)}catch(e){throw e}}function Bi(t){try{let e;if(e=ak.exec(t))return[qt(e[1]),qt(e[2]),qt(e[3]),1];if(e=rk.exec(t))return[Ct(e[1]),Ct(e[5]),Ct(e[9]),1];if(e=ok.exec(t))return[Ct(e[1]),Ct(e[5]),Ct(e[9]),Ti(e[13])];if(e=sk.exec(t))return[qt(e[1]+e[1]),qt(e[2]+e[2]),qt(e[3]+e[3]),1];if(e=ck.exec(t))return[qt(e[1]),qt(e[2]),qt(e[3]),Ti(qt(e[4])/255)];if(e=lk.exec(t))return[qt(e[1]+e[1]),qt(e[2]+e[2]),qt(e[3]+e[3]),Ti(qt(e[4]+e[4])/255)];if(t in Au)return Bi(Au[t]);if(Iu.test(t)||zu.test(t)){const[n,r,o,s]=dk(t);return[...ik(n,r,o),s]}else if(Ou.test(t)||Du.test(t)){const[n,r,o,s]=uk(t);return[...nk(n,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${t}.`)}catch(e){throw e}}function fk(t){return t>1?1:t<0?0:t}function ga(t,e,n,r){return`rgba(${Ct(t)}, ${Ct(e)}, ${Ct(n)}, ${fk(r)})`}function ya(t,e,n,r,o){return Ct((t*e*(1-r)+n*r)/o)}function hk(t,e){Array.isArray(t)||(t=Bi(t)),Array.isArray(e)||(e=Bi(e));const n=t[3],r=e[3],o=Ti(n+r-n*r);return ga(ya(t[0],n,e[0],r,o),ya(t[1],n,e[1],r,o),ya(t[2],n,e[2],r,o),o)}function ze(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:Bi(t);return typeof e.alpha=="number"?ga(n,r,o,e.alpha):ga(n,r,o,s)}function Wo(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:Bi(t),{lightness:a=1,alpha:l=1}=e;return mk([n*a,r*a,o*a,s*l])}function Ti(t){const e=Math.round(Number(t)*100)/100;return e>1?1:e<0?0:e}function jo(t){const e=Math.round(Number(t));return e>=360||e<0?0:e}function Ct(t){const e=Math.round(Number(t));return e>255?255:e<0?0:e}function li(t){const e=Math.round(Number(t));return e>100?100:e<0?0:e}function mk(t){const[e,n,r]=t;return 3 in t?`rgba(${Ct(e)}, ${Ct(n)}, ${Ct(r)}, ${Ti(t[3])})`:`rgba(${Ct(e)}, ${Ct(n)}, ${Ct(r)}, 1)`}function pk(t=8){return Math.random().toString(16).slice(2,2+t)}function Lu(t){return Array.isArray(t)?t:[t]}const ba={STOP:"STOP"};function Hu(t,e){const n=e(t);t.children!==void 0&&n!==ba.STOP&&t.children.forEach(r=>Hu(r,e))}function gk(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 yk(t,e){const{isLeaf:n}=t;return n!==void 0?n:!e(t)}function bk(t){return t.children}function _k(t){return t.key}function wk(){return!1}function xk(t,e){const{isLeaf:n}=t;return!(n===!1&&!Array.isArray(e(t)))}function kk(t){return t.disabled===!0}function vk(t,e){return t.isLeaf===!1&&!Array.isArray(e(t))}function Ck(t,e){if(t.isLeaf===!0){const n=e(t);if(Array.isArray(n)&&n.length>0)return!0}return!1}function _a(t){var e;return t==null?[]:Array.isArray(t)?t:(e=t.checkedKeys)!==null&&e!==void 0?e:[]}function wa(t){var e;return t==null||Array.isArray(t)?[]:(e=t.indeterminateKeys)!==null&&e!==void 0?e:[]}function Sk(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)||n.add(r)}),Array.from(n)}function Bk(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)&&n.delete(r)}),Array.from(n)}function Tk(t){return(t==null?void 0:t.type)==="group"}function Nk(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 $k extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function Rk(t,e,n,r){return qo(e.concat(t),n,r,!1)}function Ek(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 Pk(t,e,n,r){const o=qo(e,n,r,!1),s=qo(t,n,r,!0),a=Ek(t,n),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function xa(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:Sk(n,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:Bk(n,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(n),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let h;o!==void 0?h=Pk(o,n,e,d):r!==void 0?h=Rk(r,n,e,d):h=qo(n,e,d,!1);const f=c==="parent",m=c==="child"||l,p=h,g=new Set,y=Math.max.apply(null,Array.from(u.keys()));for(let b=y;b>=0;b-=1){const _=b===0,k=u.get(b);for(const x of k){if(x.isLeaf)continue;const{key:C,shallowLoaded:N}=x;if(m&&N&&x.children.forEach($=>{!$.disabled&&!$.isLeaf&&$.shallowLoaded&&p.has($.key)&&p.delete($.key)}),x.disabled||!N)continue;let w=!0,S=!1,v=!0;for(const $ of x.children){const E=$.key;if(!$.disabled){if(v&&(v=!1),p.has(E))S=!0;else if(g.has(E)){S=!0,w=!1;break}else if(w=!1,S)break}}w&&!v?(f&&x.children.forEach($=>{!$.disabled&&p.has($.key)&&p.delete($.key)}),p.add(C)):S&&g.add(C),_&&m&&p.has(C)&&p.delete(C)}}return{checkedKeys:Array.from(p),indeterminateKeys:Array.from(g)}}function qo(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&&Hu(d,u=>{if(u.disabled)return ba.STOP;const{key:h}=u;if(!a.has(h)&&(a.add(h),l.add(h),vk(u.rawNode,s))){if(r)return ba.STOP;if(!n)throw new $k}})}),l}function Fk(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 Vk(t){if(t.length===0)return null;const e=t[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function Mk(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 Wu(t,e,{loop:n=!1,includeDisabled:r=!1}={}){const o=e==="prev"?Ak:Mk,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=ka(d,s);u!==null?l=u:c(o(d,n))}else{const u=o(d,!1);if(u!==null)c(u);else{const h=Ik(d);h!=null&&h.isGroup?c(o(h,n)):n&&c(o(d,!0))}}}}return c(t),l}function Ak(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 Ik(t){return t.parent}function ka(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=ka(d,e);if(u!==null)return u}else return d}}return null}const Ok={getChild(){return this.ignored?null:ka(this)},getParent(){const{parent:t}=this;return t!=null&&t.isGroup?t.getParent():t},getNext(t={}){return Wu(this,"next",t)},getPrev(t={}){return Wu(this,"prev",t)}};function zk(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 Dk(t,e){const n=t.key;for(;e;){if(e.key===n)return!0;e=e.parent}return!1}var Lk={};function ju(t,e,n,r,o,s=null,a=0){const l=[];return t.forEach((c,d)=>{var u;Lk.NODE_ENV!=="production"&&Ck(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=ju(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 Hk(t,e={}){var n;const r=new Map,o=new Map,{getDisabled:s=kk,getIgnored:a=wk,getIsGroup:l=Tk,getKey:c=_k}=e,d=(n=e.getChildren)!==null&&n!==void 0?n:bk,u=e.ignoreEmptyChildren?x=>{const C=d(x);return Array.isArray(C)?C.length?C:null:C}: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 yk(this.rawNode,u)},get shallowLoaded(){return xk(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(x){return Dk(this,x)}},Ok),f=ju(t,r,o,h,u);function m(x){if(x==null)return null;const C=r.get(x);return C&&!C.isGroup&&!C.ignored?C:null}function p(x){if(x==null)return null;const C=r.get(x);return C&&!C.ignored?C:null}function g(x,C){const N=p(x);return N?N.getPrev(C):null}function y(x,C){const N=p(x);return N?N.getNext(C):null}function b(x){const C=p(x);return C?C.getParent():null}function _(x){const C=p(x);return C?C.getChild():null}const k={treeNodes:f,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(x){return zk(f,x)},getNode:m,getPrev:g,getNext:y,getParent:b,getChild:_,getFirstAvailableNode(){return Vk(f)},getPath(x,C={}){return Fk(x,C,k)},getCheckedKeys(x,C={}){const{cascade:N=!0,leafOnly:w=!1,checkStrategy:S="all",allowNotLoaded:v=!1}=C;return xa({checkedKeys:_a(x),indeterminateKeys:wa(x),cascade:N,leafOnly:w,checkStrategy:S,allowNotLoaded:v},k)},check(x,C,N={}){const{cascade:w=!0,leafOnly:S=!1,checkStrategy:v="all",allowNotLoaded:$=!1}=N;return xa({checkedKeys:_a(C),indeterminateKeys:wa(C),keysToCheck:x==null?[]:Lu(x),cascade:w,leafOnly:S,checkStrategy:v,allowNotLoaded:$},k)},uncheck(x,C,N={}){const{cascade:w=!0,leafOnly:S=!1,checkStrategy:v="all",allowNotLoaded:$=!1}=N;return xa({checkedKeys:_a(C),indeterminateKeys:wa(C),keysToUncheck:x==null?[]:Lu(x),cascade:w,leafOnly:S,checkStrategy:v,allowNotLoaded:$},k)},getNonLeafKeys(x={}){return gk(f,x)}};return k}function Xo(t){return t.composedPath()[0]}const Wk={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function jk(t,e,n){if(t==="mousemoveoutside"){const r=o=>{e.contains(Xo(o))||n(o)};return{mousemove:r,touchstart:r}}else if(t==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(Xo(a))},s=a=>{r&&(e.contains(Xo(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 qu(t,e,n){const r=Wk[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=jk(t,e,n)),s}function qk(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=qu(t,e,n);return Object.keys(o).forEach(s=>{Mt(s,document,o[s],r)}),!0}return!1}function Xk(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=qu(t,e,n);return Object.keys(o).forEach(s=>{ft(s,document,o[s],r)}),!0}return!1}function Yk(){if(typeof window>"u")return{on:()=>{},off:()=>{}};const t=new WeakMap,e=new WeakMap;function n(){t.set(this,!0)}function r(){t.set(this,!0),e.set(this,!0)}function o(w,S,v){const $=w[S];return w[S]=function(){return v.apply(w,arguments),$.apply(w,arguments)},w}function s(w,S){w[S]=Event.prototype[S]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var w;return(w=a.get(this))!==null&&w!==void 0?w:null}function d(w,S){l!==void 0&&Object.defineProperty(w,"currentTarget",{configurable:!0,enumerable:!0,get:S??l.get})}const u={bubble:{},capture:{}},h={};function f(){const w=function(S){const{type:v,eventPhase:$,bubbles:E}=S,A=Xo(S);if($===2)return;const R=$===1?"capture":"bubble";let F=A;const H=[];for(;F===null&&(F=window),H.push(F),F!==window;)F=F.parentNode||null;const Q=u.capture[v],Z=u.bubble[v];if(o(S,"stopPropagation",n),o(S,"stopImmediatePropagation",r),d(S,c),R==="capture"){if(Q===void 0)return;for(let O=H.length-1;O>=0&&!t.has(S);--O){const P=H[O],V=Q.get(P);if(V!==void 0){a.set(S,P);for(const M of V){if(e.has(S))break;M(S)}}if(O===0&&!E&&Z!==void 0){const M=Z.get(P);if(M!==void 0)for(const L of M){if(e.has(S))break;L(S)}}}}else if(R==="bubble"){if(Z===void 0)return;for(let O=0;O<H.length&&!t.has(S);++O){const P=H[O],V=Z.get(P);if(V!==void 0){a.set(S,P);for(const M of V){if(e.has(S))break;M(S)}}}}s(S,"stopPropagation"),s(S,"stopImmediatePropagation"),d(S)};return w.displayName="evtdUnifiedHandler",w}function m(){const w=function(S){const{type:v,eventPhase:$}=S;if($!==2)return;const E=h[v];E!==void 0&&E.forEach(A=>A(S))};return w.displayName="evtdUnifiedWindowEventHandler",w}const p=f(),g=m();function y(w,S){const v=u[w];return v[S]===void 0&&(v[S]=new Map,window.addEventListener(S,p,w==="capture")),v[S]}function b(w){return h[w]===void 0&&(h[w]=new Set,window.addEventListener(w,g)),h[w]}function _(w,S){let v=w.get(S);return v===void 0&&w.set(S,v=new Set),v}function k(w,S,v,$){const E=u[S][v];if(E!==void 0){const A=E.get(w);if(A!==void 0&&A.has($))return!0}return!1}function x(w,S){const v=h[w];return!!(v!==void 0&&v.has(S))}function C(w,S,v,$){let E;if(typeof $=="object"&&$.once===!0?E=Q=>{N(w,S,E,$),v(Q)}:E=v,qk(w,S,E,$))return;const R=$===!0||typeof $=="object"&&$.capture===!0?"capture":"bubble",F=y(R,w),H=_(F,S);if(H.has(E)||H.add(E),S===window){const Q=b(w);Q.has(E)||Q.add(E)}}function N(w,S,v,$){if(Xk(w,S,v,$))return;const A=$===!0||typeof $=="object"&&$.capture===!0,R=A?"capture":"bubble",F=y(R,w),H=_(F,S);if(S===window&&!k(S,A?"bubble":"capture",w,v)&&x(w,v)){const Z=h[w];Z.delete(v),Z.size===0&&(window.removeEventListener(w,g),h[w]=void 0)}H.has(v)&&H.delete(v),H.size===0&&F.delete(S),F.size===0&&(window.removeEventListener(w,p,R==="capture"),u[R][w]=void 0)}return{on:C,off:N}}const{on:Mt,off:ft}=Yk(),lr="@@mmoContext",Uk={mounted(t,{value:e}){t[lr]={handler:void 0},typeof e=="function"&&(t[lr].handler=e,Mt("mousemoveoutside",t,e))},updated(t,{value:e}){const n=t[lr];typeof e=="function"?n.handler?n.handler!==e&&(ft("mousemoveoutside",t,n.handler),n.handler=e,Mt("mousemoveoutside",t,e)):(t[lr].handler=e,Mt("mousemoveoutside",t,e)):n.handler&&(ft("mousemoveoutside",t,n.handler),n.handler=void 0)},unmounted(t){const{handler:e}=t[lr];e&&ft("mousemoveoutside",t,e),t[lr].handler=void 0}},cr="@@coContext",Yo={mounted(t,{value:e,modifiers:n}){t[cr]={handler:void 0},typeof e=="function"&&(t[cr].handler=e,Mt("clickoutside",t,e,{capture:n.capture}))},updated(t,{value:e,modifiers:n}){const r=t[cr];typeof e=="function"?r.handler?r.handler!==e&&(ft("clickoutside",t,r.handler,{capture:n.capture}),r.handler=e,Mt("clickoutside",t,e,{capture:n.capture})):(t[cr].handler=e,Mt("clickoutside",t,e,{capture:n.capture})):r.handler&&(ft("clickoutside",t,r.handler,{capture:n.capture}),r.handler=void 0)},unmounted(t,{modifiers:e}){const{handler:n}=t[cr];n&&ft("clickoutside",t,n,{capture:e.capture}),t[cr].handler=void 0}};function Kk(t,e){console.error(`[vdirs/${t}]: ${e}`)}class Gk{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&&Kk("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 va=new Gk,dr="@@ziContext",Xu={mounted(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n;t[dr]={enabled:!!o,initialized:!1},o&&(va.ensureZIndex(t,r),t[dr].initialized=!0)},updated(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n,s=t[dr].enabled;o&&!s&&(va.ensureZIndex(t,r),t[dr].initialized=!0),t[dr].enabled=!!o},unmounted(t,e){if(!t[dr].initialized)return;const{value:n={}}=e,{zIndex:r}=n;va.unregister(t,r)}};function Zk(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 rn(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 Qk=typeof window<"u";let ur,Ar;(()=>{var t,e;ur=Qk?(e=(t=document)===null||t===void 0?void 0:t.fonts)===null||e===void 0?void 0:e.ready:void 0,Ar=!1,ur!==void 0?ur.then(()=>{Ar=!0}):Ar=!0})();function Jk(t){if(Ar)return;let e=!1;i.onMounted(()=>{Ar||ur==null||ur.then(()=>{e||t()})}),i.onBeforeUnmount(()=>{e=!0})}function Ca(t,e){return i.watch(t,n=>{n!==void 0&&(e.value=n)}),i.computed(()=>t.value===void 0?e.value:t.value)}function Uo(){const t=i.ref(!1);return i.onMounted(()=>{t.value=!0}),i.readonly(t)}function Yu(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 ev=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function tv(){return ev}function Sa(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);return r()}function Ba(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)){Ba(r,e,n);return}if(r.type===i.Fragment){if(r.children===null)return;Array.isArray(r.children)&&Ba(r.children,e,n)}else r.type!==i.Comment&&n.push(r)}}),n}function Uu(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);const o=Ba(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${t}]: slot[${n}] should have exactly one child.`)}let ci=null;function Ku(){if(ci===null&&(ci=document.getElementById("v-binder-view-measurer"),ci===null)){ci=document.createElement("div"),ci.id="v-binder-view-measurer";const{style:t}=ci;t.position="fixed",t.left="0",t.right="0",t.top="0",t.bottom="0",t.pointerEvents="none",t.visibility="hidden",document.body.appendChild(ci)}return ci.getBoundingClientRect()}function nv(t,e){const n=Ku();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=Ku();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 iv(t){return t.nodeType===9?null:t.parentNode}function Gu(t){if(t===null)return null;const e=iv(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 Gu(e)}const Zu=i.defineComponent({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(t){var e;i.provide("VBinder",(e=i.getCurrentInstance())===null||e===void 0?void 0:e.proxy);const n=i.inject("VBinder",null),r=i.ref(null),o=b=>{r.value=b,n&&t.syncTargetWithParent&&n.setTargetRef(b)};let s=[];const a=()=>{let b=r.value;for(;b=Gu(b),b!==null;)s.push(b);for(const _ of s)Mt("scroll",_,h,!0)},l=()=>{for(const b of s)ft("scroll",b,h,!0);s=[]},c=new Set,d=b=>{c.size===0&&a(),c.has(b)||c.add(b)},u=b=>{c.has(b)&&c.delete(b),c.size===0&&l()},h=()=>{Mu(f)},f=()=>{c.forEach(b=>b())},m=new Set,p=b=>{m.size===0&&Mt("resize",window,y),m.has(b)||m.add(b)},g=b=>{m.has(b)&&m.delete(b),m.size===0&&ft("resize",window,y)},y=()=>{m.forEach(b=>b())};return i.onBeforeUnmount(()=>{ft("resize",window,y),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:p,removeResizeListener:g}},render(){return Sa("binder",this.$slots)}}),Qu=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(Uu("follower",this.$slots),[[e]]):Uu("follower",this.$slots)}}),rv="@css-render/vue3-ssr";function ov(t,e){return`<style cssr-id="${t}">
|
|
103
|
+
`}},Co=wi.Multiply,Sy=[1,0,0,0,1,0,0,0,1],si=new _n(9),By=vt.Utils,rd=new re,Ks=new _n([0,0,1,0,0,1,0,1,1,0,1,1]),Ce={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Ue.document?Ue.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new wi,group:{removeChild:function(t,e){if(t.children)for(let n=0;n<t.children.length;n++)Ce.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;oe.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 _n(9)),this._matrix.toTransformArray(!0,si),Co(si,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=vt.Utils.getRendererType(this._mask._renderer.type);Ce[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++)Ce.group.removeChild(this.subtractions[s],t);for(s=0;s<this.children.length;s++){const a=this.children[s],l=vt.Utils.getRendererType(a._renderer.type);Ce[l].render.call(a,t,e)}return this._mask&&t.disable(t.STENCIL_TEST),oe.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,m,p,g;const y=e._renderer.vertices,b=this.canvas,_=this.ctx,k=t.renderer.ratio,x=rd.copy(e._renderer.scale).multiply(k),C=e._stroke,N=e._linewidth,w=e._fill,S=e._renderer.opacity||e._opacity,v=e._cap,$=e._join,E=e._miter,A=e._closed,R=e.dashes,F=y.length,H=F-1;b.width=Math.max(Math.ceil(e._renderer.rect.width*x.x),1),b.height=Math.max(Math.ceil(e._renderer.rect.height*x.y),1);const Q=e._renderer.rect.centroid,Z=Q.x,O=Q.y;if(_.clearRect(0,0,b.width,b.height),w)if(typeof w=="string")_.fillStyle=w;else{const W=vt.Utils.getRendererType(w._renderer.type);Ce[W].render.call(w,_,e),_.fillStyle=w._renderer.effect}if(C){if(typeof C=="string")_.strokeStyle=C;else{const W=vt.Utils.getRendererType(C._renderer.type);Ce[W].render.call(C,_,e),_.strokeStyle=C._renderer.effect}N&&(_.lineWidth=wn(e)),E&&(_.miterLimit=E),$&&(_.lineJoin=$),!A&&v&&(_.lineCap=v)}typeof S=="number"&&(_.globalAlpha=S),R&&R.length>0&&(_.lineDashOffset=R.offset||0,_.setLineDash(R));let P,V,M,L,Y,U,G,q;_.save(),_.scale(x.x,x.y),_.translate(Z,O),_.beginPath();for(let W=0;W<y.length;W++){const K=y[W];switch(m=K.x,p=K.y,K.command){case ie.close:_.closePath();break;case ie.arc:V=K.rx,M=K.ry,L=K.xAxisRotation,Y=K.largeArcFlag,U=K.sweepFlag,n=A?rt(W-1,F):Math.max(W-1,0),r=y[n],G=r.x,q=r.y,By.renderSvgArcCommand(_,G,q,V,M,Y,U,L,m,p);break;case ie.curve:n=A?rt(W-1,F):Math.max(W-1,0),r=y[n],d=r.controls&&r.controls.right||re.zero,u=K.controls&&K.controls.left||re.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),K._relative?(s=u.x+K.x,a=u.y+K.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,m,p),W>=H&&A&&(o=P,h=K.controls&&K.controls.right||re.zero,f=o.controls&&o.controls.left||re.zero,K._relative?(l=h.x+K.x,c=h.y+K.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),m=o.x,p=o.y,_.bezierCurveTo(l,c,s,a,m,p));break;case ie.line:_.lineTo(m,p);break;case ie.move:P=K,_.moveTo(m,p);break}}A&&_.closePath(),Ce.isHidden.test(w)||(g=w._renderer&&w._renderer.offset,g&&(_.save(),_.translate(-w._renderer.offset.x,-w._renderer.offset.y),_.scale(w._renderer.scale.x,w._renderer.scale.y)),_.fill(),g&&_.restore()),Ce.isHidden.test(C)||(g=C._renderer&&C._renderer.offset,g&&(_.save(),_.translate(-C._renderer.offset.x,-C._renderer.offset.y),_.scale(C._renderer.scale.x,C._renderer.scale.y),_.lineWidth=N/C._renderer.scale.x),_.stroke(),g&&_.restore()),_.restore()},getBoundingClientRect:function(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 m,p,g,y,b,_;s=Math.min(h,s),r=Math.min(u,r),o=Math.max(u,o),a=Math.max(h,a),d.controls&&(b=f.left,_=f.right,!(!b||!_)&&(m=d._relative?b.x+u:b.x,p=d._relative?b.y+h:b.y,g=d._relative?_.x+u:_.x,y=d._relative?_.y+h:_.y,!(!m||!p||!g||!y)&&(s=Math.min(p,y,s),r=Math.min(m,g,r),o=Math.max(m,g,o),a=Math.max(p,y,a))))}),typeof e=="number"&&(s-=e,r-=e,o+=e,a+=e),l=o-r,c=a-s,n.top=s,n.left=r,n.right=o,n.bottom=a,n.width=l,n.height=c,n.centroid||(n.centroid={}),n.centroid.x=-r,n.centroid.y=-s},render:function(t,e,n){if(!this._visible||!this._opacity)return this;oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,o=vt.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 Ke&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ge&&(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 Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ge&&(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 _n(9)),this._matrix.toTransformArray(!0,si),Co(si,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=vt.Utils.getRendererType(this._mask._renderer.type);Ce[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,Ce.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),Ce.updateTexture.call(Ce,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==s&&(t.useProgram(s),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,Ks,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const u=this._renderer.rect;return t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform4f(s.rect,u.left,u.top,u.right,u.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),oe.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;Ce.isHidden.test(a)||(f+=l),r.width=jl(f),r.height=r.width;const m=f/r.width,p=r.width/2,g=r.height/2;if(o.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")o.fillStyle=c;else{const y=vt.Utils.getRendererType(c._renderer.type);Ce[y].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const y=vt.Utils.getRendererType(a._renderer.type);Ce[y].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=wn(e)/m)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(p,g),o.scale(Ce.precision,Ce.precision),o.beginPath(),o.arc(0,0,h/m*.5,0,et),o.restore(),closed&&o.closePath(),Ce.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()),Ce.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;oe.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,m=this._renderer.collection.length,p=this._flagVertices,g=this._flagFill||this._fill instanceof Ke&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ge&&(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 Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ge&&(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 _n(9)),this._matrix.toTransformArray(!0,si),Co(si,o._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let y,b;this._scale instanceof re?(y=this._scale.x*o._renderer.scale.x,b=this._scale.y*o._renderer.scale.y):(y=this._scale*o._renderer.scale.x,b=this._scale*o._renderer.scale.y),this._renderer.scale.x=y<0?-y:y,this._renderer.scale.y=b<0?-b:b,h&&(this._renderer.parent=o)}if(p){const y=this._renderer.positionBuffer;y&&t.deleteBuffer(y),this._renderer.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this._renderer.positionBuffer),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,f,t.STATIC_DRAW)}return g?(this._renderer.opacity=this._opacity*o._renderer.opacity,Ce.updateTexture.call(Ce,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:(Ce.isHidden.test(l)||(r+=c),r/=Ce.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,m),oe.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=rd.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 m=e._renderer.rect.centroid,p=m.x,g=m.y;let y,b,_,k,x,C,N,w,S,v,$;const E=c._renderer&&c._renderer.offset&&a._renderer&&a._renderer.offset;if(r.clearRect(0,0,n.width,n.height),E||(r.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),r.textAlign="center",r.textBaseline="middle",r.textDirection=f,c)if(typeof c=="string")r.fillStyle=c;else{const A=vt.Utils.getRendererType(c._renderer.type);Ce[A].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const A=vt.Utils.getRendererType(a._renderer.type);Ce[A].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=wn(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(p,g),Ce.isHidden.test(c)||(c._renderer&&c._renderer.offset?(C=c._renderer.scale.x,N=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(C,N),y=e._size/c._renderer.scale.y,b=e._leading/c._renderer.scale.y,r.font=[e._style,e._weight,y+"px/",b+"px",e._family].join(" "),_=c._renderer.offset.x/c._renderer.scale.x,k=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,k),r.restore()):r.fillText(e.value,0,0)),Ce.isHidden.test(a)||(a._renderer&&a._renderer.offset?(C=a._renderer.scale.x,N=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(C,N),y=e._size/a._renderer.scale.y,b=e._leading/a._renderer.scale.y,r.font=[e._style,e._weight,y+"px/",b+"px",e._family].join(" "),_=a._renderer.offset.x/a._renderer.scale.x,k=a._renderer.offset.y/a._renderer.scale.y,x=l/a._renderer.scale.x,r.lineWidth=x,r.strokeText(e.value,_,k),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(h)){const A=r.measureText(e.value);switch(h){case"underline":S=A.actualBoundingBoxDescent,$=A.actualBoundingBoxDescent;break;case"strikethrough":S=0,$=0;break}w=-A.width/2,v=A.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(w,S),r.lineTo(v,$),r.stroke()}r.restore()},getBoundingClientRect:function(t,e){const n=Ce.ctx;n.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" "),n.textAlign="center",n.textBaseline=vt.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&&!Ce.isHidden.test(this._stroke)&&(o+=this._linewidth*2,s+=this._linewidth*2);const a=o/2,l=s/2;switch(Ce.alignments[t._alignment]||t._alignment){case Ce.alignments.left:t.direction==="ltr"?(e.left=0,e.right=o):(e.left=-o,e.right=0);break;case Ce.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;oe.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 Ke&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ge&&(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 Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ge&&(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 _n(9)),this._matrix.toTransformArray(!0,si),Co(si,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=vt.Utils.getRendererType(this._mask._renderer.type);Ce[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,Ce.text.getBoundingClientRect(this,this._renderer.rect),Ce.updateTexture.call(Ce,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==o&&(t.useProgram(o),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(o.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o.position),t.bufferData(t.ARRAY_BUFFER,Ks,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return t.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),t.uniform4f(o.rect,d.left,d.top,d.right,d.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let 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 oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(oe.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let 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 oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(t,e){if(!t.canvas.getContext("2d"))return;oe.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 oe.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(t,e){const n=vt.Utils.getRendererType(e._renderer.type);if(this[n].updateCanvas.call(Ce,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(),oe.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 Dt("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]=Ce.extensions.get(t,o)}return e},get:function(t,e){return t.getExtension(e)||t.getExtension(`MOZ_${e}`)||t.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new ro};Ce.ctx=Ce.canvas.getContext("2d");var od=class extends ee{constructor(t){super();let e,n,r,o;if(this.domElement=t.domElement||document.createElement("canvas"),typeof t.offscreenElement<"u"&&(Ce.canvas=t.offscreenElement,Ce.ctx=Ce.canvas.getContext("2d")),this.scene=new mt,this.scene.parent=this,this._renderer={type:"renderer",matrix:new _n(Sy),scale:1,opacity:1},this._flagMatrix=!0,t=oe.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 Dt("unable to create a webgl context. Try using another renderer.");r=nn.create(e,nn.path.vertex,nn.types.vertex),o=nn.create(e,nn.path.fragment,nn.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},n=this.programs.path=Ce.program.create(e,[r,o]),this.programs.text=this.programs.path,e.extensions=Ce.extensions.init(e),e.renderer=this,n.position=e.getAttribLocation(n,"a_position"),n.matrix=e.getUniformLocation(n,"u_matrix"),n.rect=e.getUniformLocation(n,"u_rect");const s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(n.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n.position),e.bufferData(e.ARRAY_BUFFER,Ks,e.STATIC_DRAW),r=nn.create(e,nn.points.vertex,nn.types.vertex),o=nn.create(e,nn.points.fragment,nn.types.fragment),n=this.programs.points=Ce.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"?vs(s):n,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,oe.isObject(this.domElement.style)&&oe.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(ee.Types.resize,t,e,n)}render(){const t=this.ctx;return this.overdraw||t.clear(t.COLOR_BUFFER_BIT),Ce.group.render.call(this.scene,t,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};B(od,"Utils",Ce);var Ty=oe.extend({Error:Dt,getRatio:vs,read:Ye,xhr:Qc},oe,Et,Dl,Ll),Be=class Qr{constructor(e){B(this,"_events",new ee),B(this,"type",""),B(this,"renderer",null),B(this,"scene",null),B(this,"width",0),B(this,"height",0),B(this,"frameCount",0),B(this,"timeDelta",0),B(this,"playing",!1);const n=oe.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:Qr.Types.svg,autostart:!1});if(oe.each(n,function(r,o){/fullscreen/i.test(o)||/autostart/i.test(o)||(this[o]=r)},this),oe.isElement(n.domElement)){const r=n.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=Qr.Types[r])}this.renderer=new Qr[this.type](this),this.setPlaying(n.autostart),this.frameCount=0,n.fullscreen?(this.fit=Ny.bind(this),this.fit.domElement=window,this.fit.attached=!0,oe.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),oe.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),Yt.bind(this.fit.domElement,"resize",this.fit),this.fit()):n.fitted?(this.fit=$y.bind(this),oe.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(ee.Types.resize,Ry.bind(this)),this.scene=this.renderer.scene,Qr.Instances.push(this),n.autostart&&Nr.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}on(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}bind(){var e;return(e=this._events.addEventListener)==null?void 0:e.apply(this,arguments)}removeEventListener(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}off(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}unbind(){var e;return(e=this._events.removeEventListener)==null?void 0:e.apply(this,arguments)}dispatchEvent(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}trigger(){var e;return(e=this._events.dispatchEvent)==null?void 0:e.apply(this,arguments)}listen(){var e;return(e=this._events.listen)==null?void 0:e.apply(this,arguments)}ignore(){var e;return(e=this._events.ignore)==null?void 0:e.apply(this,arguments)}appendTo(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,Nr.init(),this.trigger(ee.Types.play)}pause(){return this.playing=!1,this.trigger(ee.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"&&typeof e.fill.unbind=="function"&&e.fill.unbind(),typeof e.stroke=="object"&&typeof e.stroke.unbind=="function"&&e.stroke.unbind(),e.vertices){if(typeof e.vertices.unbind=="function")try{e.vertices.unbind()}catch{}for(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}getShapesAtPoint(e,n,r){return this.scene&&typeof this.scene.getShapesAtPoint=="function"?this.scene.getShapesAtPoint(e,n,r):[]}update(){const e=!!this._lastFrame,n=oe.performance.now();e&&(this.timeDelta=parseFloat((n-this._lastFrame).toFixed(3))),this._lastFrame=n,this.fit&&this.fit.domElement&&!this.fit.attached&&(Yt.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());const r=this.width,o=this.height,s=this.renderer;return(r!==s.width||o!==s.height)&&s.setSize(r,o,this.ratio),this.trigger(ee.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(ee.Types.render,this.frameCount++)}add(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.add(e),this}remove(e){return e instanceof Array||(e=Array.prototype.slice.call(arguments)),this.scene.remove(e),this}clear(){return this.scene.remove(this.scene.children),this}makeLine(e,n,r,o){const s=new _o(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 Ne(e,n,void 0,void 0,void 0,void 0,ie.move),new Ne(r,o,void 0,void 0,void 0,void 0,ie.line),new Ne(r-a*Math.cos(l-Math.PI/4),o-a*Math.sin(l-Math.PI/4),void 0,void 0,void 0,void 0,ie.line),new Ne(r,o,void 0,void 0,void 0,void 0,ie.move),new Ne(r-a*Math.cos(l+Math.PI/4),o-a*Math.sin(l+Math.PI/4),void 0,void 0,void 0,void 0,ie.line)],d=new Re(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 oi(e,n,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,n,r,o,s){const a=new go(e,n,r,o,s);return this.scene.add(a),a}makeCircle(e,n,r,o){const s=new mo(e,n,r,o);return this.scene.add(s),s}makeEllipse(e,n,r,o,s){const a=new po(e,n,r,o,s);return this.scene.add(a),a}makeStar(e,n,r,o,s){const a=new Ds(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 Ne(l,c))}}const r=arguments[n-1],o=new Re(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 zs(e,n,r,o);return this.scene.add(s),s}makeArcSegment(e,n,r,o,s,a,l){const c=new Fs(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 Os(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 Ne(c,d))}}const o=arguments[n-1],s=new Re(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 xn(e,n,r,o);return this.add(s),s}makeLinearGradient(e,n,r,o){const s=Array.prototype.slice.call(arguments,4),a=new Ke(e,n,r,o,s);return this.add(a),a}makeRadialGradient(e,n,r){const o=Array.prototype.slice.call(arguments,3),s=new Ge(e,n,r,o);return this.add(s),s}makeSprite(e,n,r,o,s,a,l){const c=new ho(e,n,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,n,r,o,s,a){const l=new Jc(e,n,r,o,s,a);return this.add(l),l}makeImageSequence(e,n,r,o,s){const a=new js(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 mt;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 Ye))return null;const s=Ye[o].call(this,e);return r?this.add(n&&s instanceof mt?s.children:s):s.parent&&s.remove(),s}load(e,n){const r=new mt;let o,s,a;const l=(function(c){for(Yt.temp.innerHTML=c,s=0;s<Yt.temp.children.length;s++)o=Yt.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof n=="function"){const d=Yt.temp.children.length<=1?Yt.temp.children[0]:Yt.temp.children;n(r,d)}}).bind(this);return/\.svg$/i.test(e)?(Qc(e,l),r):(l(e),r)}};B(Be,"NextFrameId",xt.NextFrameId),B(Be,"Types",xt.Types),B(Be,"Version",xt.Version),B(Be,"PublishDate",xt.PublishDate),B(Be,"Identifier",xt.Identifier),B(Be,"Resolution",xt.Resolution),B(Be,"AutoCalculateImportedMatrices",xt.AutoCalculateImportedMatrices),B(Be,"Instances",xt.Instances),B(Be,"uniqueId",xt.uniqueId),B(Be,"Anchor",Ne),B(Be,"Collection",ii),B(Be,"Events",ee),B(Be,"Group",mt),B(Be,"Matrix",wi),B(Be,"Path",Re),B(Be,"Registry",ro),B(Be,"Element",Gi),B(Be,"Shape",On),B(Be,"Text",xn),B(Be,"Vector",re),B(Be,"Gradient",dt),B(Be,"Image",Jc),B(Be,"ImageSequence",js),B(Be,"LinearGradient",Ke),B(Be,"RadialGradient",Ge),B(Be,"Sprite",ho),B(Be,"Stop",ri),B(Be,"Texture",Oe),B(Be,"ArcSegment",Fs),B(Be,"Circle",mo),B(Be,"Ellipse",po),B(Be,"Line",_o),B(Be,"Points",Os),B(Be,"Polygon",zs),B(Be,"Rectangle",oi),B(Be,"RoundedRectangle",go),B(Be,"Star",Ds),B(Be,"CanvasRenderer",vt),B(Be,"SVGRenderer",id),B(Be,"WebGLRenderer",od),B(Be,"Commands",ie),B(Be,"Utils",Ty);var vn=Be;function Ny(){const t=document.body.getBoundingClientRect(),e=this.width=t.width,n=this.height=t.height;this.renderer.setSize(e,n,this.ratio)}function $y(){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 Ry(t,e){this.width=t,this.height=e,this.trigger(ee.Types.resize,t,e)}var Nr=Yt.getRequestAnimationFrame();function sd(){for(let t=0;t<vn.Instances.length;t++){const e=vn.Instances[t];e.playing&&e.update()}vn.NextFrameId=Nr(sd)}Nr.init=function(){sd(),Nr.init=function(){}};let Cn;typeof window<"u"?Cn=window:typeof global<"u"?Cn=global:typeof self<"u"&&(Cn=self);let ad;const Ut=Math.PI*2,pt=Math.PI*.5;function Ey(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 Py(t){ad=t}function Fy(t,e){e=e&&e.identity()||new ad;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 Ht(t,e,n){return n*(e-t)+t}function Wt(t,e){for(;t<0;)t+=e;return t%e}const ld=Cn.Float32Array||Array,Vy=Math.floor;function Sn(t){return Vy(t*1e6)/1e6}const de={move:"M",line:"L",curve:"C",arc:"A",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 cd={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))}}},bt=class bt extends ne{constructor(n=0,r=0){super();T(this,"_x",0);T(this,"_y",0);for(let o in cd)Object.defineProperty(this,o,cd[o]);this.x=n,this.y=r}static add(n,r){return new bt(n.x+r.x,n.y+r.y)}static sub(n,r){return new bt(n.x-r.x,n.y-r.y)}static subtract(n,r){return bt.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(bt.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 bt(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:Sn(this.x),y:Sn(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(bt,"zero",new bt),T(bt,"left",new bt(-1,0)),T(bt,"right",new bt(1,0)),T(bt,"up",new bt(0,-1)),T(bt,"down",new bt(0,1));let me=bt;class Me extends me{constructor(n=0,r=0,o=0,s=0,a=0,l=0,c=de.move){super(n,r);T(this,"controls",{left:new me,right:new me});T(this,"_command",de.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 dd)Object.defineProperty(this,u,dd[u]);this.command=c,this.relative=!0;const d=Me.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 Me().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 Me().copy(this)}toObject(){return{x:Sn(this.x),y:Sn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:Sn(this.rx),ry:Sn(this.ry),xAxisRotation:Sn(this.xAxisRotation),largeArcFlag:Sn(this.largeArcFlag),sweepFlag:Sn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const dd={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 My=0;const So={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return My++}},Bo={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 To(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 ud(t,e,n,r,o,s,a,l,c){c=c||Bo.RecursionLimit;const d=c+1;if(Math.abs(t-a)<.001&&Math.abs(e-l)<.001)return[new Me(a,l)];const u=[];for(let h=0;h<d;h++){const f=h/d,m=To(f,t,n,o,a),p=To(f,e,r,s,l);u.push(new Me(m,p))}return u}function Ay(t,e,n,r,o,s,a,l,c){if(t===n&&e===r&&o===a&&s===l){const y=a-t,b=l-e;return Math.sqrt(y*y+b*b)}const d=9*(n-o)+3*(a-t),u=6*(t+o)-12*n,h=3*(n-t),f=9*(r-s)+3*(l-e),m=6*(e+s)-12*r,p=3*(r-e);function g(y){const b=(d*y+u)*y+h,_=(f*y+m)*y+p;return Math.sqrt(b*b+_*_)}return Oy(g,0,1,c||Bo.RecursionLimit)}function Iy(t,e,n,r,o,s,a,l){const c=[],d=[[],[]];let u,h,f,m,p,g,y,b;for(let C=0;C<2;++C){if(C===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;m=-f/h,0<m&&m<1&&c.push(m);continue}y=h*h-4*f*u,b=Math.sqrt(y),!(y<0)&&(p=(-h+b)/(2*u),0<p&&p<1&&c.push(p),g=(-h-b)/(2*u),0<g&&g<1&&c.push(g))}let _=c.length,k=_,x;for(;_--;)m=c[_],x=1-m,d[0][_]=x*x*x*t+3*x*x*m*n+3*x*m*m*o+m*m*m*a,d[1][_]=x*x*x*e+3*x*x*m*r+3*x*m*m*s+m*m*m*l;return d[0][k]=t,d[1][k]=e,d[0][k+1]=a,d[1][k+1]=l,d[0].length=d[1].length=k+2,{min:{x:Math.min.apply(0,d[0]),y:Math.min.apply(0,d[1])},max:{x:Math.max.apply(0,d[0]),y:Math.max.apply(0,d[1])}}}function Oy(t,e,n,r){let o=Bo.abscissas[r-2],s=Bo.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 zy(t,e){const n=t.length,r=n-1;for(let o=0;o<n;o++){const s=t[o],a=e?Wt(o-1,n):Math.max(o-1,0),l=e?Wt(o+1,n):Math.min(o+1,r),c=t[a],d=s,u=t[l];Dy(c,d,u),d.command=o===0?de.move:de.curve}}function Dy(t,e,n){const r=me.angleBetween(t,e),o=me.angleBetween(n,e);let s=me.distanceBetween(t,e),a=me.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+=pt:l-=pt,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 $r=(Ai=class extends ne{constructor(){super();T(this,"_flagId",!1);T(this,"_flagClassName",!1);T(this,"_renderer",{});T(this,"_id",So.Identifier+So.uniqueId());T(this,"_className","");T(this,"classList",[]);for(let n in fd)Object.defineProperty(this,n,fd[n])}static fromObject(n){const r=new Ai().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(){if(typeof this.unbind=="function"&&this.unbind(),this._renderer){if(this._renderer.elem&&this._renderer.elem.parentNode&&(this._renderer.elem.parentNode.removeChild(this._renderer.elem),delete this._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const r=this.renderer.ctx;this._renderer.texture&&(r.deleteTexture(this._renderer.texture),delete this._renderer.texture),this._renderer.positionBuffer&&(r.deleteBuffer(this._renderer.positionBuffer),delete this._renderer.positionBuffer),this._renderer.effect&&(this._renderer.effect=null)}this.type==="CanvasRenderer"&&this._renderer.context&&delete this._renderer.context}const n=this._renderer.type;return this._renderer={type:n},this}},T(Ai,"Properties",["renderer","id","className"]),Ai);const fd={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 No extends Error{constructor(n){super();T(this,"name","Two.js");T(this,"message");this.message=n}}class Ly{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 $o;const hd={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};Cn.document&&($o=document.createElement("a"));const Qe=class Qe extends $r{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 md)Object.defineProperty(this,o,md[o]);if(this._renderer.type="texture",this._renderer.flagOffset=Hy.bind(this),this._renderer.flagScale=Wy.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new me,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 Qe().copy(n);return"id"in n&&(r.id=n.id),r}static getAbsoluteURL(n){return $o?($o.href=n,$o.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=Qe.getAbsoluteURL(n);if(Qe.ImageRegistry.contains(r))return Qe.ImageRegistry.get(r);let o;return Cn.document?hd.video.test(r)?o=document.createElement("video"):o=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),o.crossOrigin="anonymous",o.referrerPolicy="no-referrer",o}static load(n,r){let o=n.image,s=Qe.getTag(o);n._flagImage&&(/canvas/i.test(s)?Qe.Register.canvas(n,r):(n._src=o.getAttribute("two-src")||o.src,Qe.Register[s](n,r))),n._flagSrc&&(o||(o=Qe.getImage(n.src),n.image=o),s=Qe.getTag(o),Qe.Register[s](n,r))}clone(){const n=new Qe(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 me?n.offset:new me().copy(n.offset),this.scale=typeof n.scale=="number"||n.scale instanceof me?n.scale:new me().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,Qe.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(Qe,"Properties",["src","loaded","repeat","scale","offset","image"]),T(Qe,"RegularExpressions",hd),T(Qe,"ImageRegistry",new Ly),T(Qe,"Register",{canvas:function(n,r){n._src="#"+n.id,Qe.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 No("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=Qe.getAbsoluteURL(n._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",n.src),Qe.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 No("unable to load "+n.src)};n._src=Qe.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),Qe.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 Ze=Qe;const md={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=Ze.getTag(t);let n;switch(e){case"canvas":n="#"+t.id;break;default:n=t.src}Ze.ImageRegistry.contains(n)?this._image=Ze.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 me&&this._scale.unbind(ne.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof me&&this._scale.bind(ne.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Hy(){this._flagOffset=!0}function Wy(){this._flagScale=!0}class xi extends Array{constructor(){super();yl(this,_t,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 Ot(this,_t)}set _events(n){zh(this,_t,n)}get _bound(){return Ot(this,_t)._bound}set _bound(n){Ot(this,_t)._bound=n}addEventListener(){var n;return(n=Ot(this,_t).addEventListener)==null?void 0:n.apply(this,arguments)}on(){var n;return(n=Ot(this,_t).on)==null?void 0:n.apply(this,arguments)}bind(){var n;return(n=Ot(this,_t).bind)==null?void 0:n.apply(this,arguments)}removeEventListener(){var n;return(n=Ot(this,_t).removeEventListener)==null?void 0:n.apply(this,arguments)}off(){var n;return(n=Ot(this,_t).off)==null?void 0:n.apply(this,arguments)}unbind(){var n;return(n=Ot(this,_t).unbind)==null?void 0:n.apply(this,arguments)}dispatchEvent(){var n;return(n=Ot(this,_t).dispatchEvent)==null?void 0:n.apply(this,arguments)}trigger(){var n;return(n=Ot(this,_t).trigger)==null?void 0:n.apply(this,arguments)}listen(){var n;return(n=Ot(this,_t).listen)==null?void 0:n.apply(this,arguments)}ignore(){var n;return(n=Ot(this,_t).ignore)==null?void 0:n.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}}_t=new WeakMap;const pd=Array.prototype.slice;function jy(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}const je={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=pd.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=pd.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=!jy(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:Cn.performance&&Cn.performance.now?Cn.performance:Date},Xt=class Xt extends $r{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 gd)Object.defineProperty(this,s,gd[s]);this._renderer.type="stop",this.offset=typeof n=="number"?n:Xt.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:Xt.Index<=0?"#fff":"#000",Xt.Index=(Xt.Index+1)%2}static fromObject(n){const r=new Xt().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Xt.Properties.length;r++){const o=Xt.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Xt;return je.each(Xt.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",je.each(Xt.Properties,r=>{n[r]=this[r]},this),n}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};T(Xt,"Index",0),T(Xt,"Properties",["offset","opacity","color"]);let ki=Xt;const gd={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)}}},En=class En extends $r{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 yd)Object.defineProperty(this,r,yd[r]);this._renderer.type="gradient",this._renderer.flagStops=qy.bind(this),this._renderer.bindStops=Xy.bind(this),this._renderer.unbindStops=Yy.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 ki?s:new ki().copy(s)));const o=new En(r).copy(n);return"id"in n&&(o.id=n.id),o}clone(n){const r=this.stops.map(s=>s.clone()),o=new En(r);return je.each(En.Properties,s=>{o[s]=this[s]},this),n&&n.add(o),o}copy(n){super.copy.call(this,n);for(let r=0;r<En.Properties.length;r++){const o=En.Properties[r];o in n&&(this[o]=n[o])}return this}toObject(){const n={stops:this.stops.map(r=>r.toObject())};return je.each(En.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(En,"Stop",ki),T(En,"Properties",["spread","stops","units"]);let ut=En;const yd={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 xi((t||[]).slice(0)),this._stops.bind(ne.Types.insert,e).bind(ne.Types.remove,n),e(this._stops)}}};function qy(){this._flagStops=!0}function Xy(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function Yy(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}const fi=class fi extends ut{constructor(n,r,o,s,a){super(a);T(this,"_flagEndPoints",!1);T(this,"_left",null);T(this,"_right",null);for(let l in bd)Object.defineProperty(this,l,bd[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=Uy.bind(this),this.left=new me,this.right=new me,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 fi().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<fi.Properties.length;r++){const o=fi.Properties[r];o in n&&(this[o]=n[o]instanceof me?n[o]:new me().copy(n[o]))}return this}clone(n){const r=this.stops.map(function(s){return s.clone()}),o=new fi(this.left._x,this.left._y,this.right._x,this.right._y,r);return je.each(ut.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(fi,"Stop",ki),T(fi,"Properties",["left","right"]);let Ft=fi;const bd={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof me&&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 me&&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 Uy(){this._flagEndPoints=!0}const Pn=class Pn extends ut{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 _d)Object.defineProperty(this,c,_d[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Ky.bind(this),this._renderer.flagFocal=Gy.bind(this),this.center=new me,this.radius=typeof o=="number"?o:1,this.focal=new me,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 Pn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Pn.Properties.length;r++){const o=Pn.Properties[r];o in n&&(/(center|focal)i/.test(o)?this[o]=n[o]instanceof me?n[o]:new me().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 Pn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return je.each(ut.Properties.concat(Pn.Properties),function(s){o[s]=this[s]},this),n&&n.add(o),o}toObject(){const n=super.toObject.call(this);return je.each(Pn.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(Pn,"Stop",ki),T(Pn,"Properties",["center","radius","focal"]);let Vt=Pn;const _d={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 Ky(){this._flagCenter=!0}function Gy(){this._flagFocal=!0}function wd(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 Ro(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 xd(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),Ay(r,l,o,c,s,d,a,u,n)}function Gs(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),ud(r,l,o,c,s,d,a,u,n)}function vi(t){switch(t.renderer.type){case"texture":return Ze.fromObject(t);case"gradient":return ut.fromObject(t);case"linear-gradient":return Ft.fromObject(t);case"radial-gradient":return Vt.fromObject(t)}return t}const Zy=Math.cos,Qy=Math.sin,kd=Math.tan,Zs=[],At=class At extends ne{constructor(n,r,o,s,a,l){super();T(this,"elements",new ld(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 S,v,$;const E=r[0]||0,A=r[1]||0,R=r[2]||0;return S=w[0]*E+w[1]*A+w[2]*R,v=w[3]*E+w[4]*A+w[5]*R,$=w[6]*E+w[7]*A+w[8]*R,[S,v,$]}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],m=n[8],p=r[0],g=r[1],y=r[2],b=r[3],_=r[4],k=r[5],x=r[6],C=r[7],N=r[8];return o=o||new ld(9),o[0]=s*p+a*b+l*x,o[1]=s*g+a*_+l*C,o[2]=s*y+a*k+l*N,o[3]=c*p+d*b+u*x,o[4]=c*g+d*_+u*C,o[5]=c*y+d*k+u*N,o[6]=h*p+f*b+m*x,o[7]=h*g+f*_+m*C,o[8]=h*y+f*k+m*N,o}static fromObject(n){return new At().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]=At.Identity[0],this.elements[1]=At.Identity[1],this.elements[2]=At.Identity[2],this.elements[3]=At.Identity[3],this.elements[4]=At.Identity[4],this.elements[5]=At.Identity[5],this.elements[6]=At.Identity[6],this.elements[7]=At.Identity[7],this.elements[8]=At.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 H=a[0]*n+a[1]*r+a[2]*o,Q=a[3]*n+a[4]*r+a[5]*o,Z=a[6]*n+a[7]*r+a[8]*o;return[H,Q,Z]}const h=this.elements,f=[n,r,o,s,a,l,c,d,u],m=h[0],p=h[1],g=h[2],y=h[3],b=h[4],_=h[5],k=h[6],x=h[7],C=h[8],N=f[0],w=f[1],S=f[2],v=f[3],$=f[4],E=f[5],A=f[6],R=f[7],F=f[8];return this.elements[0]=m*N+p*v+g*A,this.elements[1]=m*w+p*$+g*R,this.elements[2]=m*S+p*E+g*F,this.elements[3]=y*N+b*v+_*A,this.elements[4]=y*w+b*$+_*R,this.elements[5]=y*S+b*E+_*F,this.elements[6]=k*N+x*v+C*A,this.elements[7]=k*w+x*$+C*R,this.elements[8]=k*S+x*E+C*F,this.trigger(ne.Types.change)}inverse(n){const r=this.elements;n=n||new At;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],m=f*c-d*h,p=-f*l+d*u,g=h*l-c*u;let y=o*m+s*p+a*g;return y?(y=1/y,n.elements[0]=m*y,n.elements[1]=(-f*s+a*h)*y,n.elements[2]=(d*s-a*c)*y,n.elements[3]=p*y,n.elements[4]=(f*o-a*u)*y,n.elements[5]=(-d*o+a*l)*y,n.elements[6]=g*y,n.elements[7]=(-h*o+s*u)*y,n.elements[8]=(c*o-s*l)*y,n):null}scale(n,r){return arguments.length<=1&&(r=n),this.multiply(n,0,0,0,r,0,0,0,1)}rotate(n){const r=Zy(n),o=Qy(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=kd(n);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(n){const r=kd(n);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(n){return Zs.length=0,this.toTransformArray(n,Zs),Zs.map(Sn).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],m=o[7],p=o[8];if(s){r[0]=a,r[1]=d,r[2]=f,r[3]=l,r[4]=u,r[5]=m,r[6]=c,r[7]=h,r[8]=p;return}return[a,d,f,l,u,m,c,h,p]}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],m=o[7],p=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]=m,r[8]=p;return}return[a,l,c,d,u,h,f,m,p]}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 At().copy(this)}};T(At,"Identity",[1,0,0,0,1,0,0,0,1]);let tr=At;Py(tr);const Ur=class Ur extends $r{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 Eo)Object.defineProperty(this,n,Eo[n]);this._renderer.flagMatrix=vd.bind(this),this.isShape=!0,this.matrix=new tr,this.worldMatrix=new tr,this.position=new me,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(n){const r=new Ur().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 Eo.position.get.apply(this,arguments)}set translation(n){Eo.position.set.apply(this,arguments)}addTo(n){return n.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}contains(n,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&"visible"in this&&this.visible===!1||!a&&"opacity"in this&&typeof this.opacity=="number"&&this.opacity<=0||typeof this.getBoundingClientRect!="function")return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();return c?n>=c.left-l&&n<=c.right+l&&r>=c.top-l&&r<=c.bottom+l:!1}copy(n){return super.copy.call(this,n),"position"in n&&(n.position instanceof me?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 me?n.scale:new me(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 Ur;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 me?this.scale.toObject():this.scale,n.skewX=this.skewX,n.skewY=this.skewY,n.matrix=this.matrix.toObject(),n}dispose(){super.dispose(),typeof this.translation=="object"&&typeof this.translation.unbind=="function"&&this.translation.unbind(),typeof this.scale=="object"&&typeof this.scale.unbind=="function"&&this.scale.unbind()}_update(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 me?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(Ur,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let Bn=Ur;const Eo={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),vd.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 me&&this._scale.unbind(ne.Types.change,this._renderer.flagMatrix),this._scale=t,this._scale instanceof me&&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 Fy(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function vd(){this._flagMatrix=!0}const Cd=/^(?:none|transparent)$/i,Jy=8,Qs=Number.EPSILON;function Dn(t,e){return{x:t,y:e}}function Po(t,e,n=Qs){return Math.abs(t.x-e.x)<=n&&Math.abs(t.y-e.y)<=n}function Sd(t,e,n,r){const o=t*n+e*r,s=Math.sqrt(t*t+e*e)*Math.sqrt(n*n+r*r)||1e-12;let a=Math.acos(Math.max(-1,Math.min(1,o/s)));return t*r-e*n<0&&(a=-a),a}function e0(t,e,n){if(!t)return[Dn(e.x,e.y)];let r=e.rx,o=e.ry;if(!(r&&o))return[Dn(e.x,e.y)];const s=(e.xAxisRotation||0)*Math.PI/180,a=e.largeArcFlag?1:0,l=e.sweepFlag?1:0;r=Math.abs(r),o=Math.abs(o);const c=t.x,d=t.y,u=e.x,h=e.y,f=(c-u)/2,m=(d-h)/2,p=Math.cos(s),g=Math.sin(s);let y=p*f+g*m,b=-g*f+p*m,_=r*r,k=o*o;const x=y*y/_+b*b/k;if(x>1){const P=Math.sqrt(x);r*=P,o*=P,_=r*r,k=o*o}const C=_*b*b+k*y*y,N=C===0?0:(_*k-C)/C;let w=Math.sqrt(Math.max(0,N));a===l&&(w=-w);const S=w*r*b/o,v=-w*o*y/r,$=p*S-g*v+(c+u)/2,E=g*S+p*v+(d+h)/2,A=Sd(1,0,(y-S)/r,(b-v)/o),R=Sd((y-S)/r,(b-v)/o,(-y-S)/r,(-b-v)/o)%Ut,F=A+R,H=l===0,Q=(()=>{const P=F-A,V=Math.abs(P)<Number.EPSILON;let M=Wt(P,Ut);return M<Number.EPSILON&&(M=V?0:Ut),H&&!V&&(M=M===Ut?-Ut:M-Ut),M})(),Z=Math.max(So.Resolution,Math.max(n*2,1)),O=[];for(let P=1;P<=Z;P++){const V=P/Z,M=A+V*Q;let L=$+r*Math.cos(M),Y=E+o*Math.sin(M);if(s!==0){const U=L-$,G=Y-E,q=Math.cos(s),W=Math.sin(s);L=U*q-G*W+$,Y=U*W+G*q+E}O.push(Dn(L,Y))}return O}function t0(t,e=Jy){const n=[],r=[],o=t._renderer&&t._renderer.vertices&&t._renderer.vertices.length>0?t._renderer.vertices:t.vertices;if(!o||o.length===0)return{polygons:n,segments:r};const s=Math.max(1,Math.floor(e));let a=null,l=null,c=null,d=null;const u=(f=!1)=>{if(a){if(f&&l&&c&&!Po(l,c)){const m=Dn(l.x,l.y);r.push({a:c,b:m}),a.push(m),c=m}a.length>=3&&l&&c&&Po(l,c)&&n.push(a),a=null,l=null,c=null}},h=f=>{if(!c){c=f,a&&a.push(f);return}Po(c,f)||(r.push({a:c,b:f}),a&&a.push(f),c=f)};for(let f=0;f<o.length;f++){const m=o[f],p=m.command||(f===0?de.move:de.line);if(p===de.move){u(!1);const g=Dn(m.x,m.y);a=[g],l=g,c=g,d=m;continue}if(d||(d=o[Math.max(f-1,0)]),p===de.line)h(Dn(m.x,m.y));else if(p===de.curve){const g=Gs(m,d,s);for(let y=1;y<g.length;y++){const b=g[y];h(Dn(b.x,b.y))}h(Dn(m.x,m.y))}else if(p===de.arc){const g=e0(d,m,s);for(let y=0;y<g.length;y++)h(g[y])}else if(p===de.close){u(!0),d=m;continue}else h(Dn(m.x,m.y));d=m}if(a){const f=!!t._closed||!!t.closed||l&&c&&!Po(l,c);u(f)}return{polygons:n,segments:r}}function n0(t,e,n){let r=!1;for(let o=0;o<t.length;o++){const s=t[o];if(!s||s.length<3)continue;let a=s.length-1;for(let l=0;l<s.length;l++){const c=s[a],d=s[l];d.y>n!=c.y>n&&e<(c.x-d.x)*(n-d.y)/(c.y-d.y||1e-12)+d.x&&(r=!r),a=l}}return r}function i0(t,e,n,r){const o=r.x-n.x,s=r.y-n.y;if(Math.abs(o)<Qs&&Math.abs(s)<Qs){const f=t-n.x,m=e-n.y;return f*f+m*m}const a=((t-n.x)*o+(e-n.y)*s)/(o*o+s*s),l=Math.max(0,Math.min(1,a)),c=n.x+l*o,d=n.y+l*s,u=t-c,h=e-d;return u*u+h*h}function r0(t,e,n){if(!t||t.length===0)return 1/0;let r=1/0;for(let o=0;o<t.length;o++){const s=t[o],a=i0(e,n,s.a,s.b);a<r&&(r=a)}return Math.sqrt(r)}function o0(t,e){if(typeof e=="boolean")return e;const n=t.fill;return!n&&n!==0?!1:typeof n=="string"?!Cd.test(n):!0}function s0(t,e){const n=typeof t.linewidth=="number"?t.linewidth:t._linewidth||0;if(typeof e=="boolean")return e&&n>0;if(!(n>0))return!1;const r=t.stroke;return!r&&r!==0?!1:typeof r=="string"?!Cd.test(r):!0}function a0(t,e,n,r=0){if(!t)return!1;const o=t.left-r,s=t.right+r,a=t.top-r,l=t.bottom+r;return e>=o&&e<=s&&n>=a&&n<=l}const Fo=Number.EPSILON;function Vo(t){return typeof t.relative!="boolean"||!!t.relative}function un(t,e,n,r){const o=t.controls;if(!(!o||!o[e])){if(Math.abs(n)<Fo&&Math.abs(r)<Fo){Vo(t)?o[e].clear():o[e].set(t.x,t.y);return}Vo(t)?o[e].set(n,r):o[e].set(t.x+n,t.y+r)}}function jt(t,e){un(t,e,0,0)}function l0(t,e){const n=t.controls;return!n||!n[e]?{x:0,y:0}:Vo(t)?{x:n[e].x,y:n[e].y}:{x:n[e].x-t.x,y:n[e].y-t.y}}function nr(t,e){const n=l0(t,e);return Math.abs(n.x)>Fo||Math.abs(n.y)>Fo}function Mo(t){t.command===de.move||t.command===de.close||(t.command=nr(t,"left")||nr(t,"right")?de.curve:de.line)}function Bd(t,e){typeof e.relative=="boolean"&&(t.relative=e.relative)}function c0(t,e){return nr(e,"right")||nr(t,"left")||nr(t,"right")||nr(e,"left")||t.command===de.curve||e.command===de.curve}function ir(t,e,n){return{x:Ht(t.x,e.x,n),y:Ht(t.y,e.y,n)}}function Td(t,e){const n=t.controls&&t.controls[e];return n?Vo(t)?{x:t.x+n.x,y:t.y+n.y}:{x:n.x,y:n.y}:{x:t.x,y:t.y}}function d0(t,e,n){const r=t.controls&&t.controls.right,o=e.controls&&e.controls.left,s={x:t.x,y:t.y},a=r?Td(t,"right"):{...s},l={x:e.x,y:e.y},c=o?Td(e,"left"):{...l},d=ir(s,a,n),u=ir(a,c,n),h=ir(c,l,n),f=ir(d,u,n),m=ir(u,h,n),p=ir(f,m,n),g=new Me(p.x,p.y);return Bd(g,t),un(g,"left",f.x-p.x,f.y-p.y),un(g,"right",m.x-p.x,m.y-p.y),g.command=de.curve,{anchor:g,startOut:d,endIn:h}}function u0(t,e,n,r,o,s){const a=t.length,l=n-e+1;let c=l-1,d=o?Math.min(l,4):1,u=d,h=d;if(r||(u=Math.min(1,e),h=Math.min(1,a-n-1)),c+=u+h,c<=1)return;const f=new Array(c+1);for(let w=0,S=e-u;w<=c;w+=1,S+=1){const v=Wt(S,a);f[w]=t[v]}let m=f[0].x+2*f[1].x,p=f[0].y+2*f[1].y,g=2;const y=c-1,b=[m],_=[p],k=[g],x=new Array(c+1),C=new Array(c+1);for(let w=1;w<c;w+=1){const S=w<y,v=S||s?1:2,$=S?4:s?2:7,E=S?4:s?3:8,A=S?2:s?0:1,R=v/g;g=k[w]=$-R,m=b[w]=E*f[w].x+A*f[w+1].x-R*m,p=_[w]=E*f[w].y+A*f[w+1].y-R*p}x[y]=b[y]/k[y],C[y]=_[y]/k[y];for(let w=c-2;w>=0;w-=1)x[w]=(b[w]-x[w+1])/k[w],C[w]=(_[w]-C[w+1])/k[w];x[c]=(3*f[c].x-x[y])/2,C[c]=(3*f[c].y-C[y])/2;const N=c-h;for(let w=u,S=e;w<=N;w+=1,S+=1){const v=Wt(S,a),$=t[v],E=x[w]-$.x,A=C[w]-$.y;o||w<N?un($,"right",E,A):jt($,"right"),o||w>u?un($,"left",-E,-A):jt($,"left"),Mo($)}}function f0(t,e,n,r,o,s){const a=e||t,l=t,c=n||t,d=me.distanceBetween(a,l),u=me.distanceBetween(l,c),h=r===void 0?.5:r,f=Math.pow(d,h),m=Math.pow(u,h),p=f*f,g=m*m;if(!o&&e){const y=2*g+3*m*f+p,b=3*m*(m+f);if(b!==0){const _=(g*a.x+y*l.x-p*c.x)/b-l.x,k=(g*a.y+y*l.y-p*c.y)/b-l.y;un(t,"left",_,k)}else jt(t,"left")}else jt(t,"left");if(!s&&n){const y=2*p+3*f*m+g,b=3*f*(f+m);if(b!==0){const _=(p*c.x+y*l.x-g*a.x)/b-l.x,k=(p*c.y+y*l.y-g*a.y)/b-l.y;un(t,"right",_,k)}else jt(t,"right")}else jt(t,"right");Mo(t)}function h0(t,e,n,r,o,s){if(!(e&&n)){e||jt(t,"left"),n||jt(t,"right"),Mo(t);return}const a=e,l=t,c=n,d=me.distanceBetween(a,l),u=me.distanceBetween(l,c),h=d+u,f=r===void 0?.4:r,m={x:a.x-c.x,y:a.y-c.y};if(!o&&h!==0){const p=f*d/h;un(t,"left",m.x*p,m.y*p)}else jt(t,"left");if(!s&&h!==0){const p=f*d/h-f;un(t,"right",m.x*p,m.y*p)}else jt(t,"right");Mo(t)}function m0(t,e,n,r,o,s){const a=s.type,l=s.factor,c=t.length;for(let d=e;d<=n;d+=1){const u=Wt(d,c),h=t[u];if(h.command===de.move){jt(h,"left"),jt(h,"right");continue}const f=d===e&&!o?null:d-1,m=d===n&&!o?null:d+1,p=f===null?null:t[Wt(f,c)],g=m===null?null:t[Wt(m,c)],y=f===null,b=m===null;a==="geometric"?h0(h,p,g,l,y,b):f0(h,p,g,l,y,b)}}const rr=Math.min,or=Math.max,p0=Math.ceil,g0=Math.floor,y0=new me,b0=new tr,mn=class mn extends Bn{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 Nd)Object.defineProperty(this,a,Nd[a]);this._renderer.type="path",this._renderer.flagVertices=$d.bind(this),this._renderer.bindVertices=Rd.bind(this),this._renderer.unbindVertices=Ed.bind(this),this._renderer.flagFill=Pd.bind(this),this._renderer.flagStroke=Fd.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:vi(n.fill),o=typeof n.stroke=="string"?n.stroke:vi(n.stroke),s=new mn().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 Me?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Me().copy(o))}}for(let r=0;r<mn.Properties.length;r++){const o=mn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new mn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<mn.Properties.length;o++){const s=mn.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()),je.each(mn.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"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const 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:m,scaleY:p}=Ey(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof m=="number"&&typeof p=="number"&&(o=Math.max(m,p)*(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[m,p]=r.multiply(l.x,l.y),[g,y]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let b=l.controls.right.x,_=l.controls.right.y;l.relative&&(b+=l.x,_+=l.y);let[k,x]=r.multiply(b,_),C=c.controls.left.x,N=c.controls.left.y;c.relative&&(C+=c.x,N+=c.y);let[w,S]=r.multiply(C,N);const v=Iy(m,p,k,x,w,S,g,y);h=rr(v.min.y-o,h),d=rr(v.min.x-o,d),u=or(v.max.x+o,u),f=or(v.max.y+o,f)}else a<=1&&(h=rr(p-o,h),d=rr(m-o,d),u=or(m+o,u),f=or(p+o,f)),h=rr(y-o,h),d=rr(g-o,d),u=or(g+o,u),f=or(y+o,f)}return{top:h,left:d,right:u,bottom:f,width:u-d,height:f-h}}contains(n,r,o){const s=o||{},a=s.ignoreVisibility===!0;if(!a&&this.visible===!1||!a&&typeof this.opacity=="number"&&this.opacity<=0)return!1;const l=typeof s.tolerance=="number"?s.tolerance:0;this._update(!0);const c=this.getBoundingClientRect();if(!c||n<c.left-l||n>c.right+l||r<c.top-l||r>c.bottom+l)return!1;const d=this.worldMatrix,u=d&&d.inverse(b0);if(!u)return super.contains(n,r,s);const[h,f]=u.multiply(n,r,1),m=typeof s.precision=="number"&&!Number.isNaN(s.precision)?Math.max(1,Math.floor(s.precision)):8,p=o0(this,s.fill),g=s0(this,s.stroke),{polygons:y,segments:b}=t0(this,m);if(p&&y.length>0&&n0(y,h,f))return!0;if(g&&b.length>0){const _=typeof this.linewidth=="number"?this.linewidth:0;if(_>0&&r0(b,h,f)<=_/2+l)return!0}return!p&&!g?super.contains(n,r,s):p&&y.length===0?super.contains(n,r,s):!1}getPointAt(n,r){let o,s,a,l,c,d,u,h,f,m,p,g,y,b,_,k=this.length*Math.min(Math.max(n,0),1);const x=this.vertices.length,C=x-1;let N=null,w=null;for(let O=0,P=this._lengths.length,V=0;O<P;O++){if(V+this._lengths[O]>=k){this._closed?(o=Wt(O,x),s=Wt(O-1,x),O===0&&(o=s,s=O)):(o=O,s=Math.min(Math.max(O-1,0),C)),N=this.vertices[o],w=this.vertices[s],k-=V,this._lengths[O]!==0?n=k/this._lengths[O]:n=0;break}V+=this._lengths[O]}if(N===null||w===null)return null;if(N){if(!w)return N}else return w;_=w.controls&&w.controls.right,b=N.controls&&N.controls.left,c=w.x,m=w.y,d=(_||w).x,p=(_||w).y,u=(b||N).x,g=(b||N).y,h=N.x,y=N.y,_&&w.relative&&(d+=w.x,p+=w.y),b&&N.relative&&(u+=N.x,g+=N.y),l=To(n,c,d,u,h),f=To(n,m,p,g,y);const S=Ht(c,d,n),v=Ht(m,p,n),$=Ht(d,u,n),E=Ht(p,g,n),A=Ht(u,h,n),R=Ht(g,y,n),F=Ht(S,$,n),H=Ht(v,E,n),Q=Ht($,A,n),Z=Ht(E,R,n);return je.isObject(r)?(r.x=l,r.y=f,r instanceof Me&&(r.controls.left.x=F,r.controls.left.y=H,r.controls.right.x=Q,r.controls.right.y=Z,(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 Me(l,f,F-l,H-f,Q-l,Z-f,this._curved?de.curve:de.line),a.t=n,a)}plot(){if(this.curved)return zy(this._collection,this.closed),this;for(let n=0;n<this._collection.length;n++)this._collection[n].command=n===0?de.move:de.line;return this}smooth(n){const r=n||{},o=r.type||"continuous",s=this._collection,a=s.length;if(a<2)return this;const l=this._closed||a>0&&s[a-1]&&s[a-1].command===de.close,c=(m,p)=>{if(m==null)return p;if(typeof m=="number"){if(l)return Wt(m,a);let y=m;return y<0&&(y+=a),Math.min(Math.max(y,0),a-1)}const g=s.indexOf(m);return g!==-1?g:p},d=l&&r.from===void 0&&r.to===void 0;let u=c(r.from,0),h=c(r.to,a-1);if(u>h)if(l)u-=a;else{const m=u;u=h,h=m}const f=h-u+1;for(let m=0;m<f;m+=1){const p=Wt(u+m,a),g=s[p],y=!l&&p===0;g.command===de.move&&!y&&(g.command=de.line)}if(o==="continuous"||o==="asymmetric")u0(s,u,h,l,d,o==="asymmetric");else if(o==="catmull-rom"||o==="geometric"){const m={type:o,factor:r.factor};m0(s,u,h,l,d,m)}else throw new Error(`Path.smooth does not support type "${o}". Try 'continuous', 'asymmetric', 'catmull-rom', or 'geometric'.`);return this._automatic=!1,this._flagVertices=!0,this._flagLength=!0,this}subdivide(n){this._update();const r=this.vertices,o=r.length;if(o<2)return this;const s=[];let a=null,l=null;for(let c=0;c<o;c+=1){const d=r[c];if(!a||d.command===de.move){const h=d.clone();s.push(h),a=d,l=d;continue}if(c0(d,a)){const f=Gs(d,a,n).length,m=s[s.length-1];let p=m.clone(),g=d.clone(),y=m,b=0;if(f<=1){const _=d.clone();s.push(_)}else{for(let k=1;k<f;k+=1){const x=k/f,C=1-b,N=C<=Number.EPSILON?x:(x-b)/C,w=d0(p,g,N);un(y,"right",w.startOut.x-y.x,w.startOut.y-y.y);const S=w.anchor;s.push(S),y=S,p=S.clone(),b=x,un(g,"left",w.endIn.x-g.x,w.endIn.y-g.y)}const _=d.clone();_.controls.left.copy(g.controls.left),s.push(_)}}else{const h=Gs(d,a,n);for(let m=1;m<h.length;m+=1){const p=h[m];Bd(p,a),jt(p,"left"),jt(p,"right"),p.command=de.line,s.push(p)}const f=d.clone();s.push(f)}a=d,d.command===de.close&&(a=l)}return this._automatic=!1,this._curved=!1,this.vertices=s,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=[]),je.each(this.vertices,function(c,d){if(d<=0||c.command===de.move){a=c,this._lengths[d]=0;return}this._lengths[d]=xd(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=Ro(this,o*this._length),l=Ro(this,s*this._length),c=p0(a),d=g0(l);let u,h,f,m,p,g;for(this._renderer.vertices.length=0,g=0;g<n;g++)this._renderer.collection.length<=g&&this._renderer.collection.push(new Me),g>d&&!h?(p=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(s,p),p.command=this._renderer.collection[g].command,this._renderer.vertices.push(p),h=p,f=this._collection[g-1],f&&f.controls&&(p.relative?p.controls.right.clear():p.controls.right.copy(p),f.relative?this._renderer.collection[g-1].controls.right.copy(f.controls.right).lerp(me.zero,1-p.t):this._renderer.collection[g-1].controls.right.copy(f.controls.right).lerp(f,1-p.t))):g>=c&&g<=d&&(p=this._renderer.collection[g].copy(this._collection[g]),this._renderer.vertices.push(p),g===d&&wd(this,s)?(h=p,!r&&h.controls&&(h.relative?h.controls.right.clear():h.controls.right.copy(h))):g===c&&wd(this,o)&&(u=p,u.command=de.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(g=c-1,p=this._renderer.collection[g].copy(this._collection[g]),this.getPointAt(o,p),p.command=de.move,this._renderer.vertices.unshift(p),m=this._collection[g+1],m&&m.controls&&(p.controls.left.clear(),m.relative?this._renderer.collection[g+1].controls.left.copy(m.controls.left).lerp(me.zero,p.t):(y0.copy(m),this._renderer.collection[g+1].controls.left.copy(m.controls.left).lerp(m,p.t))))}return Bn.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,Bn.prototype.flagReset.call(this),this}};T(mn,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),T(mn,"Utils",{getCurveLength:xd});let Ae=mn;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}},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 ut||this._fill instanceof Ft||this._fill instanceof Vt||this._fill instanceof Ze)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ft||this._fill instanceof Vt||this._fill instanceof Ze)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof ut||this._stroke instanceof Ft||this._stroke instanceof Vt||this._stroke instanceof Ze)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ft||this._stroke instanceof Vt||this._stroke instanceof Ze)&&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";je.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 xi?this._collection=t:this._collection=new xi(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,je.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 $d(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function Rd(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Ed(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function Pd(){this._flagFill=!0}function Fd(){this._flagStroke=!0}const _0=Math.ceil,w0=Math.floor,Fn=class Fn extends Bn{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 Vd)Object.defineProperty(this,r,Vd[r]);this._renderer.type="points",this._renderer.flagVertices=$d.bind(this),this._renderer.bindVertices=Rd.bind(this),this._renderer.unbindVertices=Ed.bind(this),this._renderer.flagFill=Pd.bind(this),this._renderer.flagStroke=Fd.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:vi(n.fill),o=typeof n.stroke=="string"?n.stroke:vi(n.stroke),s=new Fn().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 Me?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Me().copy(o))}for(let r=0;r<Fn.Properties.length;r++){const o=Fn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Fn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Fn.Properties.length;o++){const s=Fn.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()),je.each(Fn.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"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}subdivide(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=ud(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=Ro(this,n*this._length),s=Ro(this,r*this._length),a=_0(o),l=w0(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(Fn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let Ao=Fn;const Vd={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 ut||this._fill instanceof Ft||this._fill instanceof Vt||this._fill instanceof Ze)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ft||this._fill instanceof Vt||this._fill instanceof Ze)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof ut||this._stroke instanceof Ft||this._stroke instanceof Vt||this._stroke instanceof Ze)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ft||this._stroke instanceof Vt||this._stroke instanceof Ze)&&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 xi?this._collection=t:this._collection=new xi(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 Md extends xi{constructor(n){n=Array.isArray(n)?n:Array.prototype.slice.call(arguments);super(n);yl(this,cs,{});this.attach(n),this.on(ne.Types.insert,this.attach),this.on(ne.Types.remove,this.detach)}get ids(){return Ot(this,cs)}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}}cs=new WeakMap;const qn=class qn extends Ae{constructor(n,r,o,s,a,l,c){const d=c||So.Resolution*3,u=[];for(let h=0;h<d;h++)u.push(new Me);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",Ut);T(this,"_innerRadius",0);T(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let h in Ad)Object.defineProperty(this,h,Ad[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 qn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<qn.Properties.length;r++){const o=qn.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=Wt(n,Ut)===Wt(r,Ut),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,h=0,f,m,p,g,y,b,_,k,x;for(a?d--:l||(d-=2),f=0,m=d-1;f<d;f++){switch(p=f/m,g=c[h],y=p*(r-n)+n,b=(r-n)/d,_=s*Math.cos(y),k=s*Math.sin(y),f){case 0:u=de.move;break;default:u=de.curve}g.command=u,g.x=_,g.y=k,g.controls.left.clear(),g.controls.right.clear(),g.command===de.curve&&(x=s*b/Math.PI,g.controls.left.x=x*Math.cos(y-pt),g.controls.left.y=x*Math.sin(y-pt),g.controls.right.x=x*Math.cos(y+pt),g.controls.right.y=x*Math.sin(y+pt),f===1&&g.controls.left.multiplyScalar(2),f===m&&g.controls.right.multiplyScalar(2)),h++}if(l){for(a?(c[h].command=de.close,h++):(d--,m=d-1),f=0;f<d;f++)p=f/m,g=c[h],y=(1-p)*(r-n)+n,b=(r-n)/d,_=o*Math.cos(y),k=o*Math.sin(y),u=de.curve,f<=0&&(u=a?de.move:de.line),g.command=u,g.x=_,g.y=k,g.controls.left.clear(),g.controls.right.clear(),g.command===de.curve&&(x=o*b/Math.PI,g.controls.left.x=x*Math.cos(y+pt),g.controls.left.y=x*Math.sin(y+pt),g.controls.right.x=x*Math.cos(y-pt),g.controls.right.y=x*Math.sin(y-pt),f===1&&g.controls.left.multiplyScalar(2),f===m&&g.controls.right.multiplyScalar(2)),h++;c[h].copy(c[0]),c[h].command=de.line}else a||(c[h].command=de.line,c[h].x=0,c[h].y=0,h++,c[h].copy(c[0]),c[h].command=de.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 qn(0,0,r,o,s,a,l);c.translation.copy(this.translation),c.rotation=this.rotation,c.scale=this.scale,c.skewX=this.skewX,c.skewY=this.skewY,this.matrix.manual&&c.matrix.copy(this.matrix);for(let d=0;d<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<qn.Properties.length;r++){const o=qn.Properties[r];n[o]=this[o]}return n}};T(qn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let Js=qn;const Ad={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}}},ea=Math.cos,ta=Math.sin,Xn=class Xn 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 Me(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 Id)Object.defineProperty(this,c,Id[c]);typeof o=="number"&&(this.radius=o),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Xn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Xn.Properties.length;r++){const o=Xn.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*Ut,d=o*ea(c),u=o*ta(c),h=s*ea(c-pt),f=s*ta(c-pt),m=s*ea(c+pt),p=s*ta(c+pt),g=this.vertices[a];g.command=a===0?de.move:de.curve,g.set(d,u),g.controls.left.set(h,f),g.controls.right.set(m,p)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=new Xn(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<Xn.Properties.length;r++){const o=Xn.Properties[r];n[o]=this[o]}return n}};T(Xn,"Properties",["radius"]);let na=Xn;const Id={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},ia=Math.cos,ra=Math.sin,Yn=class Yn 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 Me);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 Od)Object.defineProperty(this,d,Od[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 Yn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Yn.Properties.length;r++){const o=Yn.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*Ut,d=o*ia(c),u=s*ra(c),h=o*r*ia(c-pt),f=s*r*ra(c-pt),m=o*r*ia(c+pt),p=s*r*ra(c+pt),g=this.vertices[a];g.command=a===0?de.move:de.curve,g.set(d,u),g.controls.left.set(h,f),g.controls.right.set(m,p)}}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 Yn(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<Yn.Properties.length;r++){const o=Yn.Properties[r];n[o]=this[o]}return n}};T(Yn,"Properties",["width","height"]);let oa=Yn;const Od={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}}},x0=Math.cos,k0=Math.sin,Un=class Un 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 zd)Object.defineProperty(this,a,zd[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 Un().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Un.Properties.length;r++){const o=Un.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=Ut*a+Math.PI/2,c=this._width*x0(l)/2,d=this._height*k0(l)/2;s>=o?this.vertices.push(new Me(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?de.move:de.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 Un(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<Un.Properties.length;r++){const o=Un.Properties[r];n[o]=this[o]}return n}};T(Un,"Properties",["width","height","sides"]);let sa=Un;const zd={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}}},Ii=class Ii extends Ae{constructor(n,r,o,s){const a=[new Me,new Me,new Me,new Me];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 Dd)Object.defineProperty(this,l,Dd[l]);this.width=typeof o=="number"?o:1,this.height=typeof s=="number"?s:1,this.origin=new me,typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(n){const r=new Ii().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Ii.Properties.length;r++){const o=Ii.Properties[r];o in n&&(typeof n[o]=="number"?this[o]=n[o]:this[o]instanceof me&&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 Me),this.vertices[0].set(-n,-r).sub(this._origin).command=de.move,this.vertices[1].set(n,-r).sub(this._origin).command=de.line,this.vertices[2].set(n,r).sub(this._origin).command=de.line,this.vertices[3].set(-n,r).sub(this._origin).command=de.line,this.vertices[4]&&(this.vertices[4].set(-n,-r).sub(this._origin).command=de.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=new Ii(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 me?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(Ii,"Properties",["width","height","origin"]);let Rr=Ii;const Dd={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},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()}}},Kn=class Kn 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 Me(0,0,0,0,0,0,c===0?de.move:de.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 Ld)Object.defineProperty(this,c,Ld[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=v0.bind(this),typeof o=="number"&&(this.width=o),typeof s=="number"&&(this.height=s),(typeof a=="number"||a instanceof me)&&(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 Kn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Kn.Properties.length;r++){const o=Kn.Properties[r];if(o in n){const s=n[o];/radius/i.test(o)?this[o]=typeof s=="number"||s instanceof me?s:new me().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 me?(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 Kn(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<Kn.Properties.length;r++){const o=Kn.Properties[r];n[o]=this[o]}return n.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),n}};T(Kn,"Properties",["width","height","radius"]);let aa=Kn;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}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof me&&this._radius.unbind(ne.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof me&&this._radius.bind(ne.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function v0(){this._flagRadius=!0}const C0=Math.cos,S0=Math.sin,Gn=class Gn 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 Hd)Object.defineProperty(this,l,Hd[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 Gn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Gn.Properties.length;r++){const o=Gn.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=Ut*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*C0(l),u=c*S0(l);s>=o?this.vertices.push(new Me(d,u)):this.vertices[s].set(d,u),this.vertices[s].command=s===0?de.move:de.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 Gn(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<Gn.Properties.length;r++){const o=Gn.Properties[r];n[o]=this[o]}return n}};T(Gn,"Properties",["innerRadius","outerRadius","sides"]);let la=Gn;const Hd={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 ca;const Wd=Math.min,jd=Math.max;Cn.document&&(ca=document.createElement("canvas"));const $t=class $t extends Bn{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 qd)Object.defineProperty(this,a,qd[a]);if(this._renderer.type="text",this._renderer.flagFill=B0.bind(this),this._renderer.flagStroke=T0.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,!je.isObject(s))return this;for(let a=0;a<$t.Properties.length;a++){const l=$t.Properties[a];l in s&&(this[l]=s[l])}}static Measure(n){if(ca){const r=ca.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*$t.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:vi(n.fill),o=typeof n.stroke=="string"?n.stroke:vi(n.stroke),s=new $t().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<$t.Properties.length;r++){const o=$t.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new $t(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<$t.Properties.length;o++){const s=$t.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<$t.Properties.length;r++){const o=$t.Properties[r];n[o]=this[o]}return n}dispose(){return super.dispose(),typeof this.fill=="object"&&typeof this.fill.dispose=="function"?this.fill.dispose():typeof this.fill=="object"&&typeof this.fill.unbind=="function"&&this.fill.unbind(),typeof this.stroke=="object"&&typeof this.stroke.dispose=="function"?this.stroke.dispose():typeof this.stroke=="object"&&typeof this.stroke.unbind=="function"&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(n){let r,o,s,a,l;this._update(!0),r=n?this.matrix:this.worldMatrix;const{width:c,height:d}=$t.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),[m,p]=r.multiply(o,l),[g,y]=r.multiply(s,a),[b,_]=r.multiply(s,l);return a=Wd(f,p,y,_),o=Wd(h,m,g,b),s=jd(h,m,g,b),l=jd(f,p,y,_),{top:a,left:o,right:s,bottom:l,width:s-o,height:l-a}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};T($t,"Ratio",.6),T($t,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let sr=$t;const qd={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 ut||this._fill instanceof Ft||this._fill instanceof Vt||this._fill instanceof Ze)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof ut||this._fill instanceof Ft||this._fill instanceof Vt||this._fill instanceof Ze)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof ut||this._stroke instanceof Ft||this._stroke instanceof Vt||this._stroke instanceof Ze)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof ut||this._stroke instanceof Ft||this._stroke instanceof Vt||this._stroke instanceof Ze)&&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,je.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 B0(){this._flagFill=!0}function T0(){this._flagStroke=!0}const Zn=class Zn extends Rr{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 Xd)Object.defineProperty(this,a,Xd[a]);this._renderer.flagTextures=N0.bind(this),this._renderer.bindTextures=$0.bind(this),this._renderer.unbindTextures=R0.bind(this),this.noStroke(),this.noFill(),Array.isArray(n)?this.textures=n.map(Yd.bind(this)):typeof n=="string"&&(this.textures=[Yd(n)]),this.origin=new me,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=Zn.DefaultFrameRate,this.index=0}static fromObject(n){const r=new Zn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Zn.Properties.length;r++){const o=Zn.Properties[r];o in n&&(this[o]=n[o])}return this}play(n,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=je.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 Zn(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,je.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=je.performance.now()-this._startTime,u=this._lastFrame+1,l=1e3*(u-this._firstFrame)/this._frameRate,this._loop?s=s%l:s=Math.min(s,l),d=Ht(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 Ze))&&(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(Zn,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),T(Zn,"DefaultFrameRate",30);let da=Zn;const Xd={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 xi((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 N0(){this._flagTextures=!0}function $0(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function R0(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function Yd(t){if(t instanceof Ze)return t;if(typeof t=="string")return new Ze(t)}const Oi=class Oi extends Rr{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 Ud)Object.defineProperty(this,c,Ud[c]);this.noStroke(),this.noFill(),n instanceof Ze?this.texture=n:typeof n=="string"&&(this.texture=new Ze(n)),this.origin=new me,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 Oi().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Oi.Properties.length;r++){const o=Oi.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=je.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 Oi(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,m;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&&(je.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=je.performance.now()-this._startTime,m=this._lastFrame+1,d=1e3*(m-this._firstFrame)/this._frameRate,this._loop?l=l%d:l=Math.min(l,d),u=Ht(this._firstFrame,m,l/d),u=Math.floor(u),u!==this._index&&(this._index=u,u>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const p=this._index%r,g=Math.floor(this._index/r),y=-s*p+(h-s)/2,b=-a*g+(f-a)/2;y!==n.offset.x&&(n.offset.x=y),b!==n.offset.y&&(n.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};T(Oi,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let ua=Oi;const Ud={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}}},Io=Math.min,Oo=Math.max,E0={getShapesAtPoint:{results:[],hitOptions:{},context:{x:0,y:0,visibleOnly:!0,results:null},single:[],empty:[]}},It=class It extends Bn{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 Kd)Object.defineProperty(this,r,Kd[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++)Gd.call(this,n[r],this)}static RemoveChildren(n){for(let r=0;r<n.length;r++)Gd.call(this,n[r])}static OrderChildren(n){this._flagOrder=!0}static fromObject(n){const r=new It;for(let s=0;s<It.Properties.length;s++){const a=It.Properties[s];a in n&&(/(fill|stroke)/i.test(a)?r[a]=typeof n[a]=="string"?n[a]:vi(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 Js.fromObject(s);case"circle":return na.fromObject(s);case"element":return $r.fromObject(s);case"ellipse":return oa.fromObject(s);case"group":return It.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return da.fromObject(s);case"path":return Ae.fromObject(s);case"points":return Ao.fromObject(s);case"polygon":return sa.fromObject(s);case"rectangle":return Rr.fromObject(s);case"rounded-rectangle":return aa.fromObject(s);case"shape":return Bn.fromObject(s);case"sprite":return ua.fromObject(s);case"star":return la.fromObject(s);case"text":return sr.fromObject(s)}return s}}static IsVisible(n,r){if(!r)return!0;let o=n;for(;o;){if(typeof o.visible=="boolean"&&!o.visible||typeof o.opacity=="number"&&o.opacity<=0)return!1;o=o.parent}return!0}static VisitForHitTest(n,r,o,s,a,l,c){const d=n&&n.children;if(!d)return!1;const u=r.results;for(let h=d.length-1;h>=0;h--){const f=d[h];if(!f||!It.IsVisible(f,r.visibleOnly))continue;const m=typeof f.getBoundingClientRect=="function"?f.getBoundingClientRect():null;if(!(m&&!a0(m,r.x,r.y,l))){if(f instanceof It){if(o&&(!s||s(f))&&typeof f.contains=="function"&&f.contains(r.x,r.y,a)&&(u.push(f),c)||It.VisitForHitTest(f,r,o,s,a,l,c))return!0;continue}if(f instanceof Bn&&!(s&&!s(f))&&typeof f.contains=="function"&&f.contains(r.x,r.y,a)&&(u.push(f),c))return!0}}return!1}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<It.Properties.length;r++){const o=It.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new It,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,je.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}getShapesAtPoint(n,r,o){const s=o||{},{results:a,hitOptions:l,context:c,single:d,empty:u}=E0.getShapesAtPoint;a.length=0;const h=s.mode==="deepest"||s.deepest?"deepest":"all",f=s.visibleOnly!==!1,m=!!s.includeGroups,p=typeof s.filter=="function"?s.filter:null,g=typeof s.tolerance=="number"?s.tolerance:0;typeof s.precision=="number"?l.precision=s.precision:delete l.precision,typeof s.fill<"u"?l.fill=s.fill:delete l.fill,typeof s.stroke<"u"?l.stroke=s.stroke:delete l.stroke,l.tolerance=g,l.ignoreVisibility=!f;const y=h==="deepest";if(c.x=n,c.y=r,c.visibleOnly=f,c.results=a,It.VisitForHitTest(this,c,m,p,l,g,y),y){if(a.length>0){const _=a[0];return a.length=0,d[0]=_,d.length=1,d}return u.length=0,u}const b=a.slice();return a.length=0,b}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 m=/texture|gradient/i;o=n?this.matrix:this.worldMatrix;for(let p=0;p<this.children.length;p++){const g=this.children[p];if(!(!g.visible||m.test(g._renderer.type))&&(r=g.getBoundingClientRect(n),s=typeof r.top!="number"||je.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||je.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||je.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||je.isNaN(r.bottom)||!isFinite(r.bottom),!(s||a||l||c)))if(n){const[y,b]=o.multiply(r.left,r.top),[_,k]=o.multiply(r.right,r.top),[x,C]=o.multiply(r.left,r.bottom),[N,w]=o.multiply(r.right,r.bottom);h=Io(b,k,C,w,h),d=Io(y,_,x,N,d),u=Oo(y,_,x,N,u),f=Oo(b,k,C,w,f)}else h=Io(r.top,h),d=Io(r.left,d),u=Oo(r.right,u),f=Oo(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(It,"Children",Md),T(It,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let Ln=It;const Kd={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=Ln.InsertChildren.bind(this),n=Ln.RemoveChildren.bind(this),r=Ln.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new Md(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,je.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 Gd(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 zo extends Ae{constructor(e,n,r,o){const s=[new Me(e,n),new Me(r,o)];super(s);for(let a in Zd)Object.defineProperty(this,a,Zd[a]);this.vertices[0].command=de.move,this.vertices[1].command=de.line,this.automatic=!1}}T(zo,"Properties",["left","right"]);const Zd={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if(je.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=de.move;else{const e=new No("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(je.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=de.line;else{const e=new No("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class fa{constructor(e=0,n=0){this.x=e,this.y=n}}class Tn{constructor(e=10,n=0,r="A"){T(this,"start",new fa);T(this,"end",new fa);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"}},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:"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 Do=i.markRaw({name:"ion-close",render:F0}),V0={class:"mr-3 flex flex-col gap-2"},M0=["onClick"],A0={class:"h-full p-2"},I0={},O0=i.defineComponent({...I0,__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 m;const f=(m=o.value)==null?void 0:m.at(h);f&&a("init-draw-template",f,u)}),(d=n.settings.customTemplates)==null||d.forEach((u,h)=>{var m;const f=(m=s.value)==null?void 0:m.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 m=(f=s.value)==null?void 0:f.at(h);m&&a("init-draw-template",m,u)}}),d.length>c.length&&d.forEach((u,h)=>{var m;const f=(m=s.value)==null?void 0:m.at(h);f&&(f.innerHTML="",a("init-draw-template",f,u))})})},{deep:!0}),(c,d)=>{const u=Do;return i.openBlock(),i.createBlock(i.unref(z.NScrollbar),{style:{width:"auto"},trigger:"none",class:"max-h-[19rem] md:max-h-[40rem] w-auto"},{default:i.withCtx(()=>[i.createElementVNode("div",V0,[(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(z.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:m=>a("template:select",f)},[i.createElementVNode("div",A0,[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,M0)]),default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(h.label),1)]),_:2},1024),h.isCustom&&!h.isNewRec()?(i.openBlock(),i.createBlock(i.unref(z.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:m=>l(f)},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),Qd=An(O0,[["__scopeId","data-v-afccb364"]]),z0={class:"flex gap-3 min-w-[20rem] relative"},D0={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},L0={ref:"drawing-container",class:"size-full"},H0={},Jd=i.defineComponent({...H0,__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((O,P)=>new Tn(n.value.configuratorParams.linesWidths[P],O,`A-${P+1}`))),h=i.computed(()=>n.value.configuratorParams.colorSide==="bottom"),f=i.computed(()=>{var O,P;return n.value.configuratorParams.startTailType&&((O=n.settings.startTailConfigs)!=null&&O[n.value.configuratorParams.startTailType])?(P=n.settings.startTailConfigs)==null?void 0:P[n.value.configuratorParams.startTailType].points:[]}),m=i.computed(()=>{var P;const O=n.value.configuratorParams.endTailType!==void 0&&((P=n.settings.endTailConfigs)==null?void 0:P[n.value.configuratorParams.endTailType]);return!O||!O.points?[]:O.points.map((V,M)=>Array.isArray(V)?new Tn(V[0],V[1],`A-${M+1}`):new Tn(V.width,V.angle,`A-${M+1}`))}),p=(O,P=!1)=>{O[0].start.x=0,O[0].start.y=0;let V=0;for(let M=0;M<O.length;M++){const L=O[M],Y=O[M-1]??new Tn(0,V);V+=!P||M>1?Y.angle:0;const U=(!P||M>0?L.angle:0)+V;if(O[M].end.x=L.width*Math.cos(U*Math.PI/180)+O[M].start.x,O[M].end.y=L.width*Math.sin(U*Math.PI/180)+O[M].start.y,M<O.length-1){const G=M+1;O[G].start.x=O[M].end.x,O[G].start.y=O[M].end.y}}return O},g=(O,P,V,M,L=!1)=>{let Y=p([...V,...M]);P.length>0&&(Y=[...p(P),...Y]);let U=0,G=0,q=0,W=0;Y.forEach(ve=>{U=Math.min(U,ve.start.x,ve.end.x),G=Math.min(G,ve.start.y,ve.end.y),q=Math.max(q,ve.start.x,ve.end.x),W=Math.max(W,ve.start.y,ve.end.y)});let K,ue;U===0&&G===0&&q===0&&W===0?(K=1,ue=1):(K=O.width/Math.abs(q-U),ue=(L?O.height:O.height-qe.colorSideLabel.size)/Math.abs(W-G));const ye=Math.min(K,ue);return U=U<0?-U*ye:0,G=G<0?-G*ye:0,[ye,U,G]},y=O=>{const P=new Ao([O]);return P._size=qe.anchorPoint.size,P.fill=qe.anchorPoint.color,P.stroke="transparent",P._linewidth=qe.anchorPoint.strokeSize,l.push(P),P},b=(O,P)=>{if(l=[],n.settings.allowChangeFirstPoint){const V=O[0],M=new me(V.vertices[0].x,V.vertices[0].y);M.bind(ne.Types.change,()=>{V.vertices[0].copy(M)});const L=y(M);P.add(L)}O.forEach((V,M)=>{const L=O[M+1],Y=new me(V.vertices[1].x,V.vertices[1].y);Y.bind(ne.Types.change,()=>{V.vertices[1].copy(Y),L!==void 0&&L.vertices[0].copy(Y)});const U=y(Y);P.add(U)})},_=O=>O*(Math.PI/180),k=(O,P,V)=>{const M=P.vertices.length-1;O.position.x=P.vertices[M].x,O.position.y=P.vertices[M].y;const L=Math.atan2(P.vertices[M].y-P.vertices[0].y,P.vertices[M].x-P.vertices[0].x);O.rotation=_(V)+L},x=(O,P,V)=>{if(P.vertices[0]===void 0)return;O.position.x=P.vertices[0].x,O.position.y=P.vertices[0].y;const M=P.vertices.length-1,L=Math.atan2(P.vertices[M].y-P.vertices[0].y,P.vertices[M].x-P.vertices[0].x);O.rotation=_(V)+L},C=(O,P,V)=>{const M=new Ln;if(O.length===0)return M;const L=[];return[...O].reverse().forEach((Y,U)=>{U!==0&&Y.angle>0&&(Y.angle*=-1),L.push(Y)}),O=p(L,!0),x(M,P,O[0].angle),[P.vertices[0],P.vertices[1]].forEach(Y=>{Y.bind(ne.Types.change,()=>{x(M,P,O[0].angle)})}),O.forEach(Y=>{const U=Y.start.x*V,G=Y.end.x*V,q=Y.start.y*V,W=Y.end.y*V,K=new zo(U,q,G,W);K.linewidth=qe.line.size,K.stroke=qe.line.color,M.add(K)}),M},N=(O,P,V)=>{const M=new Ln;return O.length===0||(O=p(O,!0),k(M,P,O[0].angle),[P.vertices[0],P.vertices[1]].forEach(L=>{L.bind(ne.Types.change,()=>{k(M,P,O[0].angle)})}),O.forEach(L=>{const Y=L.start.x*V,U=L.end.x*V,G=L.start.y*V,q=L.end.y*V,W=new zo(Y,G,U,q);W.linewidth=qe.line.size,W.stroke=qe.line.color,M.add(W)})),M},w=(O,P,V,M)=>{const L=P.vertices[0].x+(P.vertices[1].x-P.vertices[0].x)/2-8*Math.sin(O.angle*Math.PI/180),Y=P.vertices[0].y+(P.vertices[1].y-P.vertices[0].y)/2-8*Math.cos(O.angle*Math.PI/180),U=new sr(O.label,L+10,Y-10);let G;U.size=qe.lineLabel.size,U.weight=600,U.fill=qe.lineLabel.color,U.id+=1,U.rotation=qe.lineLabel.rotation,M>0&&(G=new sr(`${O.angle}°`,P.vertices[0].x+25,P.vertices[0].y-25),G.size=qe.angleLabel.size,G.weight=600,G.fill=qe.angleLabel.color,G.rotation=qe.angleLabel.rotation,G.id+=M,s.push(G),V.add(G)),V.add(U),v(U,P,0,G),v(U,P,1)},S=()=>{const{size:O}=qe.colorSideLabel,P=0,V=0,M=h.value?O/2:O/2-O,L=h.value?O/2-O:O/2,Y=new Ln;if(!c)return Y;const U=5,G=Math.atan2(L-M,V-P),q=[new Me(P,M,0,0,0,0,vn.Commands.move),new Me(V,L,0,0,0,0,vn.Commands.line),new Me(V-U*Math.cos(G-Math.PI/4),L-U*Math.sin(G-Math.PI/4),0,0,0,0,vn.Commands.line),new Me(V,L,0,0,0,0,vn.Commands.move),new Me(V-U*Math.cos(G+Math.PI/4),L-U*Math.sin(G+Math.PI/4),0,0,0,0,vn.Commands.line)],W=new Ae(q,!1,!1,!0);W.noFill(),W.cap="round",W.join="round",W.linewidth=O/7,W.stroke=qe.colorSideLabel.color,Y.add(W);const K=new sr(h.value?"Цвет снизу":"Цвет сверху",10,0);K.size=O,K.weight=600,K.fill=qe.colorSideLabel.color,K.alignment="left",Y.add(K);const ue=Y.getBoundingClientRect();return Y.position.x=(c.width-ue.width)*d+10,Y.position.y=h.value?c.height+ue.height*2:ue.height/2,Y},v=(O,P,V,M)=>{P.vertices[V].bind(ne.Types.change,()=>{const L=P.vertices.length-1,Y=Math.atan2(P.vertices[0].y-P.vertices[L].y,P.vertices[0].x-P.vertices[L].x)*180/Math.PI,U=P.vertices[0].x+(P.vertices[L].x-P.vertices[0].x)/2-8*Math.sin(Y*Math.PI/180),G=P.vertices[0].y+(P.vertices[L].y-P.vertices[0].y)/2-8*Math.cos(Y*Math.PI/180);O.position.x=U+10,O.position.y=G-10,O.rotation=-.5,M&&(M.position.x=P.vertices[0].x+25,M.position.y=P.vertices[0].y-25)})},$=(O,P,V,M,L=!1)=>{var ot;if(O.clear(),V.length===0){O.update();return}const Y=p(V),[U,G,q]=g(O,P,Y,M,L),W=new Ln,K=new Array,ue=new Array;L||(s=[],a=[]),Y.forEach((_e,we)=>{const wt=_e.start.x*U+G,$e=_e.end.x*U+G,Gt=_e.start.y*U+q,pn=_e.end.y*U+q,Rt=new zo(wt,Gt,$e,pn);Rt.linewidth=L?qe.previewLine.size:qe.line.size,Rt.stroke=L?qe.previewLine.color:qe.line.color,a.push(Rt),K.push(Rt),W.add(Rt),!L&&_e.label!==""&&w(_e,Rt,W,we)});const ye=K.at(-1);let ve=W.getBoundingClientRect();if(!L){const _e=S();ue.push(_e)}if(P.length>0){const _e=C(P,K[0],U);W.add(_e)}if(M.length>0&&ye){const _e=N(M,ye,U);W.add(_e)}if(ue.push(W),O.makeGroup(ue),ve=W.getBoundingClientRect(),W.position.x=0-ve.left+(O.width-ve.width)/(2*(L?1:d)),W.position.y=0-ve.top+(O.height-ve.height)/(2*(L?1:d)),O.update(),!L){const _e=((ot=n.value.configuratorParams)==null?void 0:ot.colorSide)==="top";W.position.y=W.position.y+qe.colorSideLabel.size*Number(_e),b(K,W),O.update()}},E=(O,P)=>{if(O&&!P.isNewRec()){const V=new vn({width:O.scrollWidth,height:O.scrollHeight});V.appendTo(O),$(V,[],P.points,[],!0)}},A=()=>{c&&$(c,f.value,u.value,m.value,!1)},R=O=>O*(180/Math.PI),F=(O,P)=>{const V=O[1].x-O[0].x,M=O[1].y-O[0].y,L=P[1].x-P[0].x,Y=P[1].y-P[0].y;let U=Math.atan2(V*Y-M*L,V*L+M*Y);return U=R(U),Math.round(U)*-1},H=O=>{const P=a.map((V,M,L)=>{const Y=L[M-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let U=Math.ceil(V._length/O/n.settings.lineWidthStep)*n.settings.lineWidthStep;const G=s[M-1];U<(L.length>1?n.settings.minLineWidth:n.settings.stripMinWidth)&&(U=L.length>1?n.settings.minLineWidth:n.settings.stripMinWidth),U>n.settings.maxLineWidth&&(U=n.settings.maxLineWidth);const q=F(V.vertices,Y.vertices);return G&&(G.value=`${q}°`),new Tn(U,q,`A-${M+1}`)});r("pointer:move",P)},Q=O=>{let P=null,V;const M=G=>{P=l.find(q=>{const W=q.renderer;return(W==null?void 0:W.elem)===G.target}),[V]=g(O,f.value,u.value.map(q=>q),m.value)},L=G=>{if(P){const q=P.renderer,W=q==null?void 0:q.elem;if(!W)return;const K=W.getBoundingClientRect();P.vertices[0].x-=K.x-(G instanceof MouseEvent?G.clientX:G.targetTouches[0].clientX)+qe.anchorPoint.size/2,P.vertices[0].y-=K.y-(G instanceof MouseEvent?G.clientY:G.targetTouches[0].clientY)+qe.anchorPoint.size/2,H(V),O.update()}},Y=()=>{P&&r("pointer:up",u.value),P=null},U=o.value;U&&(U.addEventListener("touchstart",M,{passive:!0}),U.addEventListener("touchend",Y,{passive:!0}),U.addEventListener("mousedown",M),U.addEventListener("mouseup",Y),U.addEventListener("mousemove",L),U.addEventListener("touchmove",L,{passive:!0}))},Z=(O,P)=>{r("remove-custom-template",O,P)};return i.onMounted(()=>{o.value&&(c=new vn({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),i.watch(()=>n.value,()=>{A()},{deep:!0,immediate:!0}),Q(c))}),i.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(O,P)=>(i.openBlock(),i.createElementBlock("div",z0,[i.createVNode(Qd,{"select-template-index":t.selectTemplateIndex,settings:t.settings,"onTemplate:select":P[0]||(P[0]=V=>r("template:select",V)),onInitDrawTemplate:E,onRemoveCustomTemplate:Z},null,8,["select-template-index","settings"]),i.createElementVNode("div",D0,[i.createElementVNode("div",L0,null,512)])]))}});class ar 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)=>D.isArray(o)?new Tn(o[0],o[1],`A-${s+1}`):new Tn(o.width,o.angle,`A-${s+1}`)),this.isCustom=n.isCustom):(this.label="-- Новая конфигурация --",this.points=[new Tn(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class ha extends ar{constructor(n){super(n);T(this,"isDefault");this.isDefault=n.isDefault??!1}}class eu{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 ar(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((n=e.startTailConfigs)==null?void 0:n.map(o=>new ha(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new ha(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 ar(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new ar({label:"-- Новая конфигурация --",points:[new Tn(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 ar(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 W0={class:"flex flex-col gap-3"},j0={class:"grid gap-5 md:grid-cols-5"},q0={},tu=i.defineComponent({...q0,__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 eu(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"),m=(v=0)=>{var E;const $=(E=c.value.allTemplates)==null?void 0:E.at(v);$!==void 0&&(h.value=v,l.value.configuratorParams.linesWidths=$.points.map(A=>D.isArray(A)?A[0]:A.width),l.value.configuratorParams.linesAngles=$.points.map(A=>D.isArray(A)?A[1]:A.angle),k()),b(l.value.configuratorParams)},p=async()=>{const v=prompt("Введите название шаблона:");if(!v)return;a.value=!0;const $={label:v,points:l.value.configuratorParams.linesWidths.map((A,R)=>[A,l.value.configuratorParams.linesAngles[R]])},E=A=>{A&&(c.value.addCustomTemplate($),h.value=c.value.allTemplates.length-2),a.value=!1};n.eventEmitter.emit("configurator:create-template",{category:n.cartItem.category,template:$,callback:E})},g=async(v,$)=>{var R;const E=(R=c.value.allTemplates)==null?void 0:R.at(v);if(!E||!E.isCustom)return;const A=F=>{F&&(c.value.removeCustomTemplate(E.id),m()),$==null||$()};n.eventEmitter.emit("configurator:remove-template",{category:n.cartItem.category,templateId:E.id,callback:A})},y=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(h.value=c.value.allTemplates.length-1)},b=async v=>{var $,E;l.value.product=new j.ClientProduct,(E=($=f.value)==null?void 0:$.formReference)==null||E.validate(A=>{A||(k(),o.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:v,validationFieldResultData:u.value,callback:R=>{R?l.value.product=R:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(D.noop)},_=async()=>{var v,$;($=(v=f.value)==null?void 0:v.formReference)==null||$.validate(E=>{var A,R;if(!E){s.value=!0;const F=new j.OrderItemBase(l.value);(A=c.value.startTailConfigs)!=null&&A.length||delete F.configuratorParams.startTailType,(R=c.value.endTailConfigs)!=null&&R.length||delete F.configuratorParams.endTailType,r("submit",F,u.value,()=>{s.value=!1,i.nextTick(()=>{var H,Q;(Q=(H=f.value)==null?void 0:H.formReference)==null||Q.restoreValidation()})})}}).catch(D.noop)},k=()=>{const v={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach(($,E)=>{v[`lines_widths[${E+1}]`]={},v[`lines_angles[${E+1}]`]={}}),u.value=v},x=v=>{d.value.linesWidths=v.map($=>$.width),d.value.linesAngles=v.map($=>$.angle)},C=v=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,k(),y(),b(l.value.configuratorParams)},N=(v,$)=>{d.value.linesWidths=v,d.value.linesAngles=$},w=v=>{const $=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,E=0;l.value.configuratorParams.linesWidths.splice(v+1,0,$),l.value.configuratorParams.linesAngles.splice(v+1,0,E),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],k(),y(),b(l.value.configuratorParams)},S=v=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(v,1),l.value.configuratorParams.linesAngles.splice(v,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],k(),y(),b(l.value.configuratorParams))};return i.onMounted(()=>{n.cartItem.isNewRec()?m():(k(),h.value=-1,b(l.value.configuratorParams))}),i.watch(()=>n.cartItem,v=>{l.value=new j.OrderItemBase(v),v.isNewRec()?m():(k(),h.value=-1,b(l.value.configuratorParams))}),(v,$)=>{const E=z.NButton;return i.openBlock(),i.createElementBlock("div",W0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(E,{key:0,type:"tertiary",class:"self-end",onClick:$[0]||($[0]=A=>r("click:view-switch"))},{default:i.withCtx(()=>[...$[3]||($[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",j0,[i.createVNode(Jd,{value:l.value,"select-template-index":h.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":C,"onPointer:move":x,"onTemplate:select":m,onRemoveCustomTemplate:g},null,8,["value","select-template-index","settings"]),i.createVNode(Fl,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":$[1]||($[1]=A=>l.value=A),"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":$[2]||($[2]=A=>b(A)),"onUpdate:preview":N,onSubmit:_,"onClick:saveTemplate":p,"onClick:addLine":w,"onClick:removeLine":S},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),X0={class:"flex flex-col items-center justify-between rounded-xl"},Y0={class:"img-preview relative flex justify-center"},U0={},K0=i.defineComponent({...U0,__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;return D.keys(n.settings.crossbarCount).reverse().find(a=>s>=n.settings.crossbarCount[Number(a)])}),o=e;return(s,a)=>{const l=z.NButton;return i.openBlock(),i.createElementBlock("div",X0,[i.createElementVNode("div",Y0,[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})])}}}),ma=An(K0,[["__scopeId","data-v-2a790a20"]]),G0={key:0,class:"flex items-baseline gap-1"},Z0={key:0,class:"flex items-baseline gap-1"},Q0={key:1},J0={class:"text-lg font-semibold"},eb={key:2,class:"text-red-500 text-sm mb-2"},tb={class:"flex gap-3"},nb={},nu=i.defineComponent({...nb,__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(()=>it.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(D.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),m=i.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),p=i.computed(()=>r.settings.maxHeights[u.value.configuratorParams.netType]),g=i.computed(()=>u.value.configuratorParams.width?u.value.configuratorParams.width+h.value:0),y=i.computed(()=>u.value.configuratorParams.height?u.value.configuratorParams.height+f.value:0),b=i.ref(r.settings.canSetDopProdaga??!1),_=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth-h.value),ae.max(m.value-h.value),ae.step(1),We.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[ae.required,ae.min(r.settings.minHeight-f.value),ae.max(p.value-f.value),ae.step(1),We.serverValidation(r.validation.height.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]})),k=i.computed(()=>{var R;const S=g.value,v=y.value,{quantity:$}=r.value,E=((R=r.value.product)==null?void 0:R.costRub)||0;if(!S||!v||!$||E===0)return null;const A=S*v/1e6;return(E*$*A).toLocaleString("ru-ru",{minimumFractionDigits:2})}),x=i.computed(()=>{const S=g.value,v=y.value,$=!!(S&&S>=r.settings.minWidth&&S<=r.settings.maxWidths[u.value.configuratorParams.netType]),E=!!(v&&v>=r.settings.minHeight&&v<=r.settings.maxHeights[u.value.configuratorParams.netType]),A=!!(r.value.quantity&&r.value.quantity>0);return $&&E&&A}),C=(S,v)=>{var A,R;const $=u.value.configuratorParams;S&&S in $&&($[S]=v);const E={...$,width:g.value??0,height:y.value??0};S==="width"&&((A=l.value)==null||A.validate().catch(D.noop)),S==="height"&&((R=c.value)==null||R.validate().catch(D.noop)),i.nextTick(()=>{var H,Q;!((H=l.value)!=null&&H.validationErrored)&&!((Q=c.value)!=null&&Q.validationErrored)&&E.height&&E.width&&o("update:params",E),N("configuratorParams",E)})},N=(S,v)=>{const $=new j.OrderItemBase(r.value);$[S]=v,S==="configuratorParams"&&($.product=new j.ClientProduct),o("update:value",$)};return i.watch(()=>r.value,S=>{const v=D.cloneDeep(i.toRaw(S)),$=v.configuratorParams.mountType,E=r.settings.widthOverlaps[$]??0,A=r.settings.heightOverlaps[$]??0;v.configuratorParams.width&&v.configuratorParams.width>0&&(v.configuratorParams.width-=E),v.configuratorParams.height&&v.configuratorParams.height>0&&(v.configuratorParams.height-=A),u.value=v},{deep:!0,immediate:!0}),i.onMounted(()=>{var S;(S=d.value)==null||S.select()}),e({validate:(w=a.value)==null?void 0:w.validate,formReference:a}),(S,v)=>{const $=z.NCheckbox;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:u.value,rules:_.value,class:"flex flex-col gap-2 px-4 md:max-w-96 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Тип сетки"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:u.value.configuratorParams.netType,"onUpdate:value":[v[0]||(v[0]=E=>u.value.configuratorParams.netType=E),v[1]||(v[1]=E=>C("netType",E))],options:t.settings.netType.map(E=>({label:t.settings.descriptions.net_type[E],value:E}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Цвет профиля"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:u.value.configuratorParams.color,"onUpdate:value":[v[2]||(v[2]=E=>u.value.configuratorParams.color=E),v[3]||(v[3]=E=>C("color",E))],options:t.settings.color.map(E=>({label:t.settings.descriptions.color[E],value:E}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Вид крепления"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:u.value.configuratorParams.mountType,"onUpdate:value":[v[4]||(v[4]=E=>u.value.configuratorParams.mountType=E),v[5]||(v[5]=E=>C("mountType",E))],options:t.settings.mountType.map(E=>({label:t.settings.descriptions.mount_type[E],value:E}))},null,8,["value","options"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{ref:"width-form-item-reference",path:"configuratorParams.width",label:`Ширина светового проёма от ${t.settings.minWidth-h.value} ${m.value?" до "+(m.value-h.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.width.showFeedback&&g.value>=t.settings.minWidth&&g.value<=t.settings.maxWidths[u.value.configuratorParams.netType]?(i.openBlock(),i.createElementBlock("div",G0,[i.createVNode(i.unref(z.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Ширина готового изделия "+i.toDisplayString(g.value),1)]),_:1}),i.createVNode(i.unref(z.NButton),{quaternary:"",type:"info",size:"tiny",onClick:v[10]||(v[10]=E=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...v[25]||(v[25]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{ref:"width-input-reference",value:u.value.configuratorParams.width,"onUpdate:value":[v[6]||(v[6]=E=>u.value.configuratorParams.width=E),v[9]||(v[9]=E=>C("width",E))],parse:i.unref(lt),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:v[7]||(v[7]=E=>i.unref(st)(E)),onInput:v[8]||(v[8]=E=>i.unref(nt)(t.validation,"width")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(z.NFormItem),{ref:"height-form-item-reference",path:"configuratorParams.height",label:`Высота светового проёма от ${t.settings.minHeight-f.value} ${p.value?" до "+(p.value-f.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.height.showFeedback&&y.value>=t.settings.minHeight&&y.value<=t.settings.maxHeights[u.value.configuratorParams.netType]?(i.openBlock(),i.createElementBlock("div",Z0,[i.createVNode(i.unref(z.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Высота готового изделия "+i.toDisplayString(y.value),1)]),_:1}),i.createVNode(i.unref(z.NButton),{quaternary:"",type:"info",size:"tiny",onClick:v[15]||(v[15]=E=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...v[26]||(v[26]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[v[11]||(v[11]=E=>u.value.configuratorParams.height=E),v[14]||(v[14]=E=>C("height",E))],parse:i.unref(lt),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:v[12]||(v[12]=E=>i.unref(st)(E)),onInput:v[13]||(v[13]=E=>i.unref(nt)(t.validation,"height")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(z.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:u.value.quantity,"onUpdate:value":[v[16]||(v[16]=E=>u.value.quantity=E),v[19]||(v[19]=E=>N("quantity",E??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:v[17]||(v[17]=E=>i.unref(st)(E,!1)),onInput:v[18]||(v[18]=E=>i.unref(nt)(t.validation,"quantity")),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:u.value.marker??null,placeholder:"Введите маркировку",onInput:v[20]||(v[20]=E=>i.unref(nt)(t.validation,"marker")),"onUpdate:value":v[21]||(v[21]=E=>{u.value.marker=E??null,N("marker",E??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),b.value?(i.openBlock(),i.createBlock($,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":v[22]||(v[22]=E=>{u.value.isAdditionalSale=E??!1,N("isAdditionalSale",E??!1)})},{default:i.withCtx(()=>[...v[27]||(v[27]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(Cr,{"is-product-searching":t.isProductSearching,product:u.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),k.value?(i.openBlock(),i.createElementBlock("div",Q0,[v[28]||(v[28]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",J0,i.toDisplayString(k.value)+" ₽",1)])):i.createCommentVNode("",!0),x.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",eb," Пожалуйста, заполните все обязательные поля корректно. ")),i.createElementVNode("div",tb,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!x.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:v[23]||(v[23]=E=>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(z.NButton),{key:0,type:"default",onClick:v[24]||(v[24]=E=>o("click:show-preview-drawer"))},{default:i.withCtx(()=>[...v[29]||(v[29]=[i.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1},8,["model","rules"])),[[i.unref(ei),()=>o("submit",u.value)]])}}}),ib="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",rb="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",ob="/img/configurators/mosquitto/measurement-instructions/mount.png",sb="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",ab="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",lb={class:"flex flex-col gap-6"},cb={class:"flex gap-4"},db={class:"flex flex-col gap-2"},ub={class:"flex gap-4"},fb={class:"flex flex-col gap-2"},hb={class:"flex gap-4"},mb={class:"flex flex-col gap-2"},pb={},iu=i.defineComponent({...pb,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(t,{emit:e}){const n=it.initRefDependingOnDeviceResolution("small","small","medium"),r=it.initRefDependingOnDeviceResolution(.98,.95,.8),o=i.computed(()=>window.innerWidth*r.value),s=e;return(a,l)=>{const c=z.NText;return i.openBlock(),i.createBlock(i.unref(z.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",lb,[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:ib,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:rb,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",cb,[l[9]||(l[9]=i.createElementVNode("img",{src:ob,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",db,[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",ub,[l[15]||(l[15]=i.createElementVNode("img",{src:sb,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",fb,[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",hb,[l[21]||(l[21]=i.createElementVNode("img",{src:ab,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",mb,[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"])}}}),gb={class:"grid md:grid-cols-2"},yb={},ru=i.defineComponent({...yb,__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(()=>it.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)),m=D.debounce(async g=>{var y,b;l.value.product=new j.ClientProduct,(b=(y=c.value)==null?void 0:y.formReference)==null||b.validate(_=>{_||(u.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:g,validationFieldResultData:d.value,callback:k=>{k?l.value.product=k:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(D.noop)},f.value),p=()=>{h.value=!0,r("submit",l.value,d.value,()=>{h.value=!1})};return i.watch(()=>n.cartItem,g=>{l.value=g},{deep:!0}),(g,y)=>{const b=Do;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(iu,{show:a.value,"onUpdate:show":y[0]||(y[0]=_=>a.value=_),"height-overlaps":t.settings.heightOverlaps,"width-overlaps":t.settings.widthOverlaps},null,8,["show","height-overlaps","width-overlaps"]),i.createElementVNode("div",gb,[o.value?(i.openBlock(),i.createBlock(i.unref(z.NDrawer),{key:1,show:s.value,"onUpdate:show":y[4]||(y[4]=_=>s.value=_),"default-width":375,resizable:""},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NDrawerContent),null,{header:i.withCtx(()=>[i.createVNode(i.unref(z.NButton),{size:"small",type:"primary",class:"block justify-self-end",onClick:y[2]||(y[2]=_=>s.value=!1)},{default:i.withCtx(()=>[i.createVNode(b)]),_:1})]),default:i.withCtx(()=>[i.createVNode(ma,{"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:y[3]||(y[3]=_=>a.value=!0)},null,8,["configurator-params","settings"])]),_:1})]),_:1},8,["show"])):(i.openBlock(),i.createBlock(ma,{key:0,"configurator-params":l.value.configuratorParams,settings:t.settings,onOpenInstructions:y[1]||(y[1]=_=>a.value=!0)},null,8,["configurator-params","settings"])),i.createVNode(nu,{ref:"mosquito-configurator-form",value:l.value,"onUpdate:value":y[5]||(y[5]=_=>l.value=_),validation:d.value,settings:t.settings,"is-product-searching":u.value,"is-submit-processing":h.value,"onUpdate:params":y[6]||(y[6]=_=>i.unref(m)(_)),onSubmit:y[7]||(y[7]=_=>p()),"onClick:instructionsToggle":y[8]||(y[8]=_=>a.value=!a.value),"onClick:showPreviewDrawer":y[9]||(y[9]=_=>s.value=!0)},null,8,["value","validation","settings","is-product-searching","is-submit-processing"])])],64)}}}),bb={},ou=i.defineComponent({...bb,__name:"strip-configurator-line-item",props:{value:{},index:{},path:{},settings:{},product:{default:void 0},addLineButtonDisabled:{type:Boolean,default:!1},removeLineButtonDisabled:{type:Boolean,default:!1},suggestionOption:{default:void 0},autoFocus:{type:Boolean,default:!1},isLastLine:{type:Boolean,default:!1},validation:{}},emits:["update:value","click:add-line","click:remove-line"],setup(t,{expose:e,emit:n}){const r=t,o=n,s=i.useTemplateRef("width-input-element"),a=i.ref(!1),l=i.ref(r.value),c=i.useTemplateRef("form-item-reference"),d=i.computed(()=>{var m;return!((m=c.value)!=null&&m.validationErrored)}),u=m=>{l.value=m,o("update:value",m,r.index,a)},h=m=>{st(m),(m.key==="Enter"||m.code==="Enter")&&!r.isLastLine&&(m.preventDefault(),m.stopPropagation())},f=()=>{var m;(m=s.value)==null||m.select()};return i.watch(()=>r.value,m=>{l.value=m}),i.onMounted(()=>{r.autoFocus&&i.nextTick(()=>{f()})}),e({isValid:d,formItemReference:c}),(m,p)=>{const g=Pl,y=io;return i.openBlock(),i.createBlock(i.unref(z.NFormItem),{ref:"form-item-reference",path:t.path,label:`Полоса №${t.index+1}, мм`,class:"sc-hide-empty-feedback-message"},{feedback:i.withCtx(()=>[d.value?(i.openBlock(),i.createBlock(Cr,{key:0,"is-product-searching":a.value,product:t.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(i.unref(z.NDropdown),{trigger:"click",options:t.suggestionOption,placement:"bottom-start",size:"large",onSelect:u},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{ref:"width-input-element",value:l.value??null,class:"w-full","show-button":!1,parse:i.unref(lt),placeholder:"Введите ширину",onKeydown:h,onInput:p[0]||(p[0]=b=>i.unref(nt)(t.validation,`linesWidths.${t.index}`)),onFocus:i.unref(Le),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),i.createVNode(i.unref(z.NButton),{disabled:t.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:p[1]||(p[1]=b=>o("click:add-line",t.index))},{default:i.withCtx(()=>[i.createVNode(g)]),_:1},8,["disabled"]),i.createVNode(i.unref(z.NButton),{disabled:t.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:p[2]||(p[2]=b=>o("click:remove-line",t.index))},{default:i.withCtx(()=>[i.createVNode(y)]),_:1},8,["disabled"])]),_:1},8,["path","label"])}}}),_b={class:"my-2 flex w-full flex-col"},wb={key:1},xb={class:"text-lg font-semibold"},kb={class:"flex gap-3"},vb={},su=i.defineComponent({...vb,__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(D.cloneDeep(r.value)),c=i.computed(()=>{const k={length:[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(r.settings.lengthStep),We.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]};return D.forEach(l.value,(x,C)=>{var N;k[`configuratorParams.linesWidths.${C}`]=[ae.required,ae.min(r.settings.minLineWidth),ae.step(r.settings.lineWidthStep),We.serverValidation((N=r.validation[`linesWidths.${C}`])==null?void 0:N.feedback)]}),k}),d=i.ref(r.settings.canSetDopProdaga??!1),u=i.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((k,x)=>(k??0)+(x??0),0)),h=i.computed(()=>r.settings.width-u.value),f=i.computed(()=>!r.value.some(({product:k})=>!k||k.isNewRec())),m=i.computed(()=>r.isSubmitProcessing||!f.value||h.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(k=>k.product.isNewRec())),p=i.computed(()=>k=>h.value===0?void 0:[{label:`${(h.value>0?"Остаток +":"Излишек ")+h.value} мм.`,key:h.value+k}]),g=i.computed(()=>{const{length:k}=r.value[0];return!k||u.value!==r.settings.width?null:(D.reduce(r.value,(C,N)=>{var S;const w=((S=N.product)==null?void 0:S.costRub)||0;return C+w},0)*r.value[0].quantity*k).toLocaleString("ru-ru",{minimumFractionDigits:2})}),y=(k,x,C)=>{var w,S,v;l.value[x].product.id=-1;const{configuratorParams:N}=l.value[x];N.linesWidths[x]=k,b("configuratorParams",N),(v=(S=(w=a.value)==null?void 0:w.at(x))==null?void 0:S.formItemReference)==null||v.validate().catch(D.noop),i.nextTick(()=>{var $,E;(E=($=a.value)==null?void 0:$.at(x))!=null&&E.isValid&&o("update:params",N,x,C)})},b=(k,x)=>{l.value.forEach(C=>{C[k]=x}),o("update:value",l.value)};return i.watch(()=>r.value,k=>{l.value=D.cloneDeep(k)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(k,x)=>{const C=z.NCheckbox;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:l.value[0],rules:c.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>{var N;return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(w,S)=>{var v,$,E;return i.openBlock(),i.createBlock(ou,{key:S,ref_for:!0,ref:"line-items-reference",value:((v=w.configuratorParams)==null?void 0:v.linesWidths.at(S))??null,"auto-focus":((($=w.configuratorParams)==null?void 0:$.linesWidths.at(S))??0)===0,index:S,path:`configuratorParams.linesWidths.${S}`,product:w.product,settings:t.settings,validation:t.validation,"suggestion-option":p.value(((E=w.configuratorParams)==null?void 0:E.linesWidths.at(S))??0),"add-line-button-disabled":h.value<=0||t.value.length>=t.settings.maxLinesCount||t.value.some(A=>A.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"is-last-line":S===l.value.length-1&&h.value===0,"onUpdate:value":y,"onClick:addLine":x[0]||(x[0]=A=>o("click:add-line",A)),"onClick:removeLine":x[1]||(x[1]=A=>o("click:remove-line",A))},null,8,["value","auto-focus","index","path","product","settings","validation","suggestion-option","add-line-button-disabled","remove-line-button-disabled","is-last-line"])}),128)),i.createElementVNode("div",_b,[h.value<0?(i.openBlock(),i.createBlock(i.unref(z.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(z.NText),{key:1,type:"error"},{default:i.withCtx(()=>[...x[15]||(x[15]=[i.createTextVNode(" Остаток резки должен быть равен 0 ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",null,[x[16]||(x[16]=i.createTextVNode(" Остаток для резки: ",-1)),i.createVNode(i.unref(z.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(z.NButton),{disabled:m.value,type:"primary",class:"self-center",onClick:x[2]||(x[2]=w=>o("click:add-line",l.value.length))},{default:i.withCtx(()=>[...x[17]||(x[17]=[i.createTextVNode(" Добавить полосу ",-1)])]),_:1},8,["disabled"]),i.createVNode(i.unref(z.NFormItem),{path:"length",label:`Метраж ${t.settings.minLength?" от "+t.settings.minLength:""} ${t.settings.maxLength?" до "+t.settings.maxLength:""} м.`},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:l.value[0].length,"onUpdate:value":[x[3]||(x[3]=w=>l.value[0].length=w),x[6]||(x[6]=w=>b("length",w))],parse:i.unref(lt),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:x[4]||(x[4]=w=>i.unref(st)(w,!1)),onInput:x[5]||(x[5]=w=>i.unref(nt)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(z.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:l.value[0].quantity,"onUpdate:value":[x[7]||(x[7]=w=>l.value[0].quantity=w),x[10]||(x[10]=w=>b("quantity",w))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:x[8]||(x[8]=w=>i.unref(st)(w,!1)),onInput:x[9]||(x[9]=w=>i.unref(nt)(t.validation,"quantity")),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:l.value[0].marker??null,placeholder:"Введите маркировку",onInput:x[11]||(x[11]=w=>i.unref(nt)(t.validation,"marker")),"onUpdate:value":x[12]||(x[12]=w=>{l.value[0].marker=w??null,b("marker",w??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(C,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":x[13]||(x[13]=w=>{l.value[0].isAdditionalSale=w??!1,b("isAdditionalSale",w??!1)})},{default:i.withCtx(()=>[...x[18]||(x[18]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),g.value?(i.openBlock(),i.createElementBlock("div",wb,[x[19]||(x[19]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",xb,i.toDisplayString(g.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",kb,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!f.value||h.value!=0||!((N=l.value[0])!=null&&N.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"])),[[i.unref(ei),()=>o("submit",l.value)]])}}}),Cb={class:"flex grow flex-col"},Sb=["src"],Bb={class:"w-full"},Tb={},au=i.defineComponent({...Tb,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",Cb,[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,Sb),i.createElementVNode("div",Bb,[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)])]))}}),Nb={class:"flex flex-col gap-2"},$b={class:"w-104 flex grow flex-col px-5"},Rb={},lu=i.defineComponent({...Rb,__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 p;return(p=s.value[0].configuratorParams)==null?void 0:p.linesWidths.reduce((g,y)=>(g??0)+(y??0),0)}),u=p=>{p===void 0&&(p=s.value.length-1);const g=s.value.at(0);if(!g)return;g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(p+1,0,null),s.value.forEach(b=>{b.configuratorParams.linesWidths=g.configuratorParams.linesWidths});const y=new j.OrderItemBase({quantity:(g==null?void 0:g.quantity)??1,category:g==null?void 0:g.category,length:(g==null?void 0:g.length)??n.settings.minLength,marker:g==null?void 0:g.marker,configuratorParams:{linesWidths:g==null?void 0:g.configuratorParams.linesWidths}});s.value=s.value.toSpliced(p+1,0,y)},h=p=>{const g=s.value.at(0);g&&(g.configuratorParams.linesWidths=g.configuratorParams.linesWidths.toSpliced(p,1),s.value.forEach(y=>{y.configuratorParams.linesWidths=g.configuratorParams.linesWidths}),s.value=s.value.toSpliced(p,1),delete a[`linesWidths.${p}`],delete a[`linesWidths.${p}`])},f=D.debounce(async(p,g,y)=>{const b={linesWidths:p.linesWidths.at(g)};y.value=!0,a.value[`linesWidths.${g}`]={},s.value[g].product=new j.ClientProduct,n.eventEmitter.emit("configurator:search-product",{category:s.value[g].category,params:b,validationFieldResultData:a.value,callback:_=>{_?(s.value[g].product=_,g===s.value.length-1&&s.value.length<n.settings.maxLinesCount&&d.value&&d.value<n.settings.width&&u()):(s.value[g].product=new j.ClientProduct,a.value[`linesWidths.${g}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},y.value=!1),y.value=!1}})},c.value),m=async()=>{var p,g;(g=(p=o.value)==null?void 0:p.formReference)==null||g.validate(y=>{if(!y){l.value=!0;const b=s.value.at(0);if(!b)return;r("submit",b,a.value,()=>{l.value=!1,i.nextTick(()=>{var _,k;(k=(_=o.value)==null?void 0:_.formReference)==null||k.restoreValidation()})})}}).catch(D.noop)};return i.watch(()=>n.cartItems,p=>{s.value=p.map(g=>new j.OrderItemBase(g))}),(p,g)=>{const y=z.NButton;return i.openBlock(),i.createElementBlock("div",Nb,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(y,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=b=>r("click:view-switch"))},{default:i.withCtx(()=>[...g[3]||(g[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",$b,[i.createVNode(au,{value:s.value,"onUpdate:value":g[1]||(g[1]=b=>s.value=b),settings:t.settings},null,8,["value","settings"]),i.createVNode(su,{ref:"strip-configurator-form",value:s.value,"onUpdate:value":g[2]||(g[2]=b=>s.value=b),validation:a.value,settings:t.settings,"is-submit-processing":l.value,"onUpdate:params":i.unref(f),onSubmit:m,"onClick:addLine":u,"onClick:removeLine":h},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),Eb={class:"flex flex-col gap-3"},Pb={},cu=i.defineComponent({...Pb,__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 m;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("first-input-element"),l=i.ref(D.cloneDeep(r.value)),c=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth),...r.settings.maxWidth?[ae.max(r.settings.maxWidth)]:[],ae.step(1),We.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(1),We.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),We.serverValidation(r.validation.quantity.feedback)],marker:[We.serverValidation(r.validation.marker.feedback)]})),d=i.ref(r.settings.canSetDopProdaga??!1),u=()=>{o("update:params",l.value.configuratorParams),h("configuratorParams",l.value.configuratorParams)},h=(p,g)=>{const y=new j.OrderItemBase(r.value);y[p]=g,p==="configuratorParams"&&(y.product=new j.ClientProduct),o("update:value",y)},f=()=>{var p;(p=a.value)==null||p.select()};return i.watch(()=>r.value,p=>{l.value=D.cloneDeep(p)},{deep:!0}),i.onMounted(()=>{r.value.isNewRec()&&i.nextTick(()=>{f()})}),e({validate:(m=s.value)==null?void 0:m.validate,formReference:s}),(p,g)=>{const y=z.NCheckbox;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:l.value,rules:c.value,disabled:t.isSubmitProcessing,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NFormItem),{path:"configuratorParams.width",label:`Ширина, ${t.settings.minWidth?" от "+t.settings.minWidth:""}${t.settings.maxWidth?" до "+t.settings.maxWidth:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{ref:"first-input-element",value:l.value.configuratorParams.width,"onUpdate:value":[g[0]||(g[0]=b=>l.value.configuratorParams.width=b),u],class:"w-full",parse:i.unref(lt),"show-button":!1,placeholder:"Введите ширину",onKeydown:g[1]||(g[1]=b=>i.unref(st)(b)),onInput:g[2]||(g[2]=b=>i.unref(nt)(t.validation,"width")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(z.NFormItem),{path:"configuratorParams.length",label:`Длина, ${t.settings.minLength?" от "+t.settings.minLength:""}${t.settings.maxLength?" до "+t.settings.maxLength:""} мм`},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:l.value.configuratorParams.length,"onUpdate:value":[g[3]||(g[3]=b=>l.value.configuratorParams.length=b),u],placeholder:"Введите длину",parse:i.unref(lt),"show-button":!1,class:"w-full",onKeydown:g[4]||(g[4]=b=>i.unref(st)(b)),onInput:g[5]||(g[5]=b=>i.unref(nt)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(z.NFormItem),{path:"quantity",label:"Количество"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:t.value.quantity,placeholder:"Введите количество",min:1,"show-button":!1,class:"w-full",onKeydown:g[6]||(g[6]=b=>i.unref(st)(b,!1)),onInput:g[7]||(g[7]=b=>i.unref(nt)(t.validation,"quantity")),"onUpdate:value":g[8]||(g[8]=b=>h("quantity",b??0)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),i.createVNode(i.unref(z.NFormItem),{path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:t.value.marker??null,placeholder:"Введите маркировку",onInput:g[9]||(g[9]=b=>i.unref(nt)(t.validation,"marker")),"onUpdate:value":g[10]||(g[10]=b=>h("marker",b??null)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(y,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":g[11]||(g[11]=b=>{l.value.isAdditionalSale=b??!1,h("isAdditionalSale",b??!1)})},{default:i.withCtx(()=>[...g[13]||(g[13]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(Cr,{"is-product-searching":t.isProductSearching,product:t.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),i.createElementVNode("div",Eb,[i.createVNode(i.unref(z.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:g[12]||(g[12]=b=>o("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["model","rules","disabled"])),[[i.unref(ei),()=>o("submit",l.value)]])}}}),Fb={class:"flex flex-col gap-2 w-72"},Vb={},du=i.defineComponent({...Vb,__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=D.debounce(async f=>{var m,p;s.value.product=new j.ClientProduct,(p=(m=o.value)==null?void 0:m.formReference)==null||p.validate(g=>{g||(l.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:f,validationFieldResultData:a.value,callback:y=>{y?s.value.product=y:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(D.noop)},d.value),h=async()=>{var f,m;(m=(f=o.value)==null?void 0:f.formReference)==null||m.validate(p=>{p||(c.value=!0,r("submit",s.value,a.value,()=>{c.value=!1,i.nextTick(()=>{var g,y;(y=(g=o.value)==null?void 0:g.formReference)==null||y.restoreValidation()})}))}).catch(D.noop)};return i.watch(()=>n.cartItem,f=>{s.value=new j.OrderItemBase(f)},{deep:!0}),(f,m)=>{const p=z.NButton;return i.openBlock(),i.createElementBlock("div",Fb,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(p,{key:0,type:"tertiary",class:"self-center",onClick:m[0]||(m[0]=g=>r("click:view-switch"))},{default:i.withCtx(()=>[...m[4]||(m[4]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(cu,{ref:"metal-for-doors-configurator-form",value:s.value,"onUpdate:value":m[1]||(m[1]=g=>s.value=g),validation:a.value,settings:t.settings,"is-submit-processing":c.value,"is-product-searching":l.value,"onUpdate:params":m[2]||(m[2]=g=>i.unref(u)(g)),onSubmit:m[3]||(m[3]=g=>h())},null,8,["value","validation","settings","is-submit-processing","is-product-searching"])])}}}),Mb={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Ab(t,e){return i.openBlock(),i.createElementBlock("svg",Mb,[...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 uu=i.markRaw({name:"ion-add",render:Ab}),Ib={key:0,class:"-mt-1 text-sm text-gray-500"},Ob={class:"font-bold"},zb={class:"flex flex-col gap-3"},Db={key:0,class:"mt-4 flex flex-col gap-1.5"},Lb={class:"flex flex-col gap-1 text-sm text-gray-700"},Hb={key:0},Wb={key:1},jb={"form-array-name":"items",class:"flex flex-col gap-3"},qb={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},Xb={key:0,class:"flex flex-wrap items-end gap-2"},Yb={class:"whitespace-nowrap text-xl font-bold"},Ub={key:0,class:"whitespace-nowrap text-lg text-gray-500"},Kb={class:"font-bold"},Gb={class:"font-bold"},Zb={class:"flex gap-3"},Qb={},fu=i.defineComponent({...Qb,__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 P;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.ref(D.cloneDeep(r.value)),l=i.ref({...r.validation}),c=V=>{var M;delete l.value[V],(M=s.value)==null||M.restoreValidation()};i.watch(()=>r.validation,V=>{l.value={...V},Object.values(V).some(L=>L==null?void 0:L.feedback)&&i.nextTick(()=>{var L;return(L=s.value)==null?void 0:L.validate(D.noop).catch(D.noop)})},{deep:!0});const d=i.computed(()=>r.value.category),u=i.ref(null),h=i.ref(null),f=i.computed(()=>d.value.products??[]),m=i.computed(()=>f.value.map(V=>({label:V.name,value:V.id}))),p=(V,M,L)=>{const Y=V!=null&&V>0,U=M!=null&&M>0;return!Y&&!U?null:Y&&U?`от ${V} ${L} до ${M} ${L}`:Y?`от ${V} ${L}`:`до ${M} ${L}`},g=i.computed(()=>{var V,M;return p(r.settings.minWidth,(M=(V=u.value)==null?void 0:V.properties)==null?void 0:M.width,"мм")}),y=i.computed(()=>{var V,M;return p(r.settings.minLength,(M=(V=u.value)==null?void 0:V.properties)==null?void 0:M.length,"мм")}),b=i.ref(null),_=i.ref(!1),k=i.computed(()=>{var M;const V={marker:[We.serverValidation((M=l.value.marker)==null?void 0:M.feedback)]};return a.value.configuratorParams.items.forEach((L,Y)=>{var U,G,q,W,K,ue,ye;V[`configuratorParams.items.${Y}.width`]=[ae.required,ae.min(r.settings.minWidth),...(G=(U=u.value)==null?void 0:U.properties)!=null&&G.width?[ae.max(u.value.properties.width)]:[],ae.step(1),We.serverValidation((q=l.value[`items.${Y}.width`])==null?void 0:q.feedback)],V[`configuratorParams.items.${Y}.length`]=[ae.required,ae.min(r.settings.minLength),...(K=(W=u.value)==null?void 0:W.properties)!=null&&K.length?[ae.max(u.value.properties.length)]:[],ae.step(1),We.serverValidation((ue=l.value[`items.${Y}.length`])==null?void 0:ue.feedback)],V[`configuratorParams.items.${Y}.count`]=[ae.required,ae.min(1),ae.step(1),We.serverValidation((ye=l.value[`items.${Y}.count`])==null?void 0:ye.feedback)]}),V}),x=i.ref(r.settings.canSetDopProdaga??!1),C=i.computed(()=>a.value.configuratorParams.items.some(V=>{var M,L;return!u.value||!V.width||V.width<r.settings.minWidth||V.width>(((M=u.value.properties)==null?void 0:M.width)??0)||V.length===0||V.length<r.settings.minLength||V.length>(((L=u.value.properties)==null?void 0:L.length)??0)||!V.count||V.count<1})),N=i.computed(()=>!u.value||C.value||a.value.configuratorParams.items.length===0),w=i.ref(null),S=V=>{if(!V){u.value=null,h.value=null,a.value.product=new j.ClientProduct,b.value=null;return}const M=f.value.find(L=>L.id===V);M&&(u.value=M,h.value=V,a.value.product=M,Z("product",a.value.product),a.value.configuratorParams.items.forEach(L=>{var Y,U;(Y=M.properties)!=null&&Y.width&&L.width>M.properties.width&&(L.width=M.properties.width),(U=M.properties)!=null&&U.length&&L.length>M.properties.length&&(L.length=M.properties.length)}),$())};let v=!1;const $=()=>{v=!0,b.value=null,w.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},E=async()=>{var V;if(!u.value||a.value.configuratorParams.items.length===0||C.value){$();return}(V=s.value)==null||V.validate(M=>{if(M){$();return}if(_.value=!0,!u.value||!d.value){$(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:L=>{L?(b.value=L,a.value.configuratorParams.calculationId=L.id,a.value.quantity=L.quantity,i.nextTick(()=>{Z("quantity",L.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,$()),Z("configuratorParams",a.value.configuratorParams),A(),_.value=!1}})}).catch(()=>{$(),_.value=!1})},A=()=>{var M;if(!((M=u.value)!=null&&M.costRub)||!b.value){w.value=null;return}const V=b.value.quantity*u.value.costRub;w.value=Math.round(V*100)/100},R=V=>{var L,Y;const M=a.value.configuratorParams.items[V];u.value&&((L=u.value.properties)!=null&&L.width&&M.width>u.value.properties.width&&(M.width=u.value.properties.width),(Y=u.value.properties)!=null&&Y.length&&M.length>u.value.properties.length&&(M.length=u.value.properties.length)),Z("configuratorParams",a.value.configuratorParams),$()},F=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),Z("configuratorParams",a.value.configuratorParams),$(),o("add-item",a.value.configuratorParams.items.length)},H=V=>{a.value.configuratorParams.items.splice(V,1),Z("configuratorParams",a.value.configuratorParams),$(),o("remove-item",V)},Q=()=>{if(!(N.value||_.value||r.isSubmitProcessing)){if(!b.value){E();return}o("submit",a.value)}},Z=(V,M)=>{const L=new j.OrderItemBase(r.value);L[V]=M,o("update:value",L)};i.watch(()=>r.value,V=>{const M=D.cloneDeep(i.toRaw(V));(!M.configuratorParams.items||M.configuratorParams.items.length===0)&&(M.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=M,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),v?v=!1:O()},{deep:!0});const O=()=>{const{calculationId:V}=a.value.configuratorParams,M=a.value.quantity??0;V&&M>0&&a.value.product&&!a.value.product.isNewRec()&&(b.value={id:V,quantity:M,sheets:[]},A())};return i.onMounted(()=>{r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,h.value=r.value.product.id),O()}),e({validate:(P=s.value)==null?void 0:P.validate,formReference:s}),(V,M)=>{const L=io,Y=uu;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:a.value,rules:k.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>{var U;return[i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:h.value,"onUpdate:value":[M[0]||(M[0]=G=>h.value=G),S],options:m.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((U=u.value)==null?void 0:U.costRub)!=null?(i.openBlock(),i.createElementBlock("div",Ib,[i.createElementVNode("span",Ob,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",zb,[u.value?(i.openBlock(),i.createElementBlock("div",Db,[M[7]||(M[7]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",Lb,[g.value?(i.openBlock(),i.createElementBlock("div",Hb,"Ширина "+i.toDisplayString(g.value)+".",1)):i.createCommentVNode("",!0),y.value?(i.openBlock(),i.createElementBlock("div",Wb,"Длина "+i.toDisplayString(y.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",jb,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value.configuratorParams.items,(G,q)=>(i.openBlock(),i.createElementBlock("div",{key:q,class:"flex grow gap-2"},[i.createElementVNode("div",qb,[i.createVNode(i.unref(z.NFormItem),{path:`configuratorParams.items.${q}.width`,label:"Ширина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:a.value.configuratorParams.items[q].width,"onUpdate:value":[W=>a.value.configuratorParams.items[q].width=W,W=>R(q)],parse:i.unref(lt),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:M[1]||(M[1]=W=>i.unref(st)(W)),onInput:W=>c(`items.${q}.width`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(z.NFormItem),{path:`configuratorParams.items.${q}.length`,label:"Длина, мм"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:a.value.configuratorParams.items[q].length,"onUpdate:value":[W=>a.value.configuratorParams.items[q].length=W,W=>R(q)],parse:i.unref(lt),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:M[2]||(M[2]=W=>i.unref(st)(W)),onInput:W=>c(`items.${q}.length`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(z.NFormItem),{path:`configuratorParams.items.${q}.count`,label:"Количество, шт"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:a.value.configuratorParams.items[q].count,"onUpdate:value":[W=>a.value.configuratorParams.items[q].count=W,W=>R(q)],parse:i.unref(lt),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:M[3]||(M[3]=W=>i.unref(st)(W,!1)),onInput:W=>c(`items.${q}.count`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),i.createVNode(i.unref(z.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:W=>H(q)},{default:i.withCtx(()=>[i.createVNode(L)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:1,disabled:C.value,type:"default",class:"self-center",onClick:F},{default:i.withCtx(()=>[i.createVNode(Y),M[8]||(M[8]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0)]),i.createVNode(i.unref(z.NFormItem),{path:"marker",label:"Маркировка распила"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:a.value.marker??null,disabled:!u.value,placeholder:"Введите маркировку распила",onInput:M[4]||(M[4]=G=>c("marker")),"onUpdate:value":M[5]||(M[5]=G=>Z("marker",G??null)),onFocus:i.unref(Le)},null,8,["value","disabled","onFocus"])]),_:1}),x.value?(i.openBlock(),i.createBlock(i.unref(z.NCheckbox),{key:1,checked:a.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":M[6]||(M[6]=G=>{a.value.isAdditionalSale=G??!1,Z("isAdditionalSale",G??!1)})},{default:i.withCtx(()=>[...M[9]||(M[9]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(i.unref(z.NSpin),{show:_.value,size:"small",class:"grow"},{default:i.withCtx(()=>{var G;return[b.value&&u.value&&w.value?(i.openBlock(),i.createElementBlock("div",Xb,[i.createElementVNode("div",null,[M[10]||(M[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",Yb,i.toDisplayString(w.value.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol),1)]),b.value.quantity&&u.value?(i.openBlock(),i.createElementBlock("div",Ub,[i.createElementVNode("span",Kb,"("+i.toDisplayString(b.value.quantity)+" шт.",1),M[11]||(M[11]=i.createTextVNode(" x ",-1)),i.createElementVNode("span",Gb,i.toDisplayString((G=u.value.costRub)==null?void 0:G.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]}),_:1},8,["show"]),i.createElementVNode("div",Zb,[b.value&&!_.value?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,loading:t.isSubmitProcessing,disabled:N.value||_.value,type:"primary",class:"self-start",onClick:Q},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(a.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["loading","disabled"])):(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:1,loading:_.value,disabled:N.value||_.value,type:"info",class:"self-start",onClick:E},{default:i.withCtx(()=>[...M[12]||(M[12]=[i.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules"])),[[i.unref(ei),Q]])}}}),Jb={class:"flex flex-col gap-2"},e1={class:"w-104 flex grow flex-col px-5"},t1={},hu=i.defineComponent({...t1,__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(m=>{if(!m){l.value=!0;const p=D.cloneDeep(s.value);"items"in p.configuratorParams&&delete p.configuratorParams.items,r("submit",p,a.value,()=>{l.value=!1,i.nextTick(()=>{var g,y;(y=(g=o.value)==null?void 0:g.formReference)==null||y.restoreValidation()})})}}).catch(D.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 m=z.NButton;return i.openBlock(),i.createElementBlock("div",Jb,[t.settings.allowShowTable&&s.value.isNewRec()?(i.openBlock(),i.createBlock(m,{key:0,type:"tertiary",class:"self-center",onClick:f[0]||(f[0]=p=>r("click:view-switch"))},{default:i.withCtx(()=>[...f[2]||(f[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",e1,[i.createVNode(fu,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":f[1]||(f[1]=p=>s.value=p),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"])])])}}}),n1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function i1(t,e){return i.openBlock(),i.createElementBlock("svg",n1,[...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 r1=i.markRaw({name:"ion-checkmark",render:i1}),o1={key:0,class:"-mt-1 text-sm text-gray-500"},s1={class:"font-bold"},a1={class:"flex flex-col gap-3"},l1={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},c1={class:"flex flex-col gap-1 text-sm text-gray-700"},d1={key:0},u1={key:1},f1={"form-array-name":"items",class:"flex flex-col gap-3"},h1={class:"min-w-0 flex-1"},m1={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},p1={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},g1={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},y1={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},b1={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},_1={key:0,class:"lg:!flex-[2]"},w1={class:"font-bold"},x1={key:1,class:"lg:!flex-[3]"},k1={class:"font-bold"},v1={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"},C1={key:0},S1={class:"font-bold"},B1={key:1},T1={class:"font-bold"},N1={class:"flex flex-wrap items-center gap-3"},$1={},mu=i.defineComponent({...$1,__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 G;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("widthInputs"),l=r.value==null?[]:D.cloneDeep(i.toRaw(r.value)),c=i.ref(l.map(q=>new j.OrderItemBase(q))),d=i.computed(()=>({items:c.value})),u=i.ref({...r.validation}),h=q=>{var W;delete u.value[q],(W=s.value)==null||W.restoreValidation()},f=i.ref(null),m=i.ref(null),p=i.computed(()=>{var q,W;return((W=(q=c.value[0])==null?void 0:q.category)==null?void 0:W.products)??[]}),g=i.computed(()=>p.value.map(q=>({label:q.name,value:q.id}))),y=(q,W,K)=>{const ue=q!=null&&q>0,ye=W!=null&&W>0;return!ue&&!ye?null:ue&&ye?`от ${q} ${K} до ${W} ${K}`:ue?`от ${q} ${K}`:`до ${W} ${K}`},b=i.computed(()=>{var q,W;return y(r.settings.minWidth,(W=(q=f.value)==null?void 0:q.properties)==null?void 0:W.width,"мм")}),_=i.computed(()=>{var q,W;return y(r.settings.minLength,(W=(q=f.value)==null?void 0:q.properties)==null?void 0:W.length,"мм")}),k=i.computed(()=>{const q={};return c.value.forEach((W,K)=>{var ue,ye,ve,ot,_e,we,wt,$e;q[`items.${K}.configuratorParams.width`]=[ae.required,ae.min(r.settings.minWidth),...(ye=(ue=f.value)==null?void 0:ue.properties)!=null&&ye.width?[ae.max(f.value.properties.width)]:[],ae.step(1),We.serverValidation((ve=u.value[`items.${K}.width`])==null?void 0:ve.feedback)],q[`items.${K}.configuratorParams.length`]=[ae.required,ae.min(r.settings.minLength),...(_e=(ot=f.value)==null?void 0:ot.properties)!=null&&_e.length?[ae.max(f.value.properties.length)]:[],ae.step(1),We.serverValidation((we=u.value[`items.${K}.length`])==null?void 0:we.feedback)],q[`items.${K}.quantity`]=[ae.required,ae.min(1),ae.step(1),We.serverValidation((wt=u.value[`items.${K}.quantity`])==null?void 0:wt.feedback)],q[`items.${K}.marker`]=[We.serverValidation(($e=u.value[`items.${K}.marker`])==null?void 0:$e.feedback)]}),q});i.watch(()=>r.validation,q=>{u.value={...q},Object.values(q).some(K=>K==null?void 0:K.feedback)&&i.nextTick(()=>{var K;return(K=s.value)==null?void 0:K.validate(D.noop).catch(D.noop)})},{deep:!0});const x=i.ref(r.settings.canSetDopProdaga??!1),C=i.computed(()=>{const q=f.value;return q?c.value.some(W=>{var ve,ot;const K=W.configuratorParams,ue=(ve=q.properties)==null?void 0:ve.width,ye=(ot=q.properties)==null?void 0:ot.length;return K.width===0||K.width<r.settings.minWidth||ue!=null&&K.width>ue||K.length===0||K.length<r.settings.minLength||ye!=null&&K.length>ye||W.quantity===0||W.quantity<1}):!0}),N=i.computed(()=>!f.value||C.value||c.value.length===0),w=i.computed(()=>{const q=c.value[0];return q!=null&&!q.isNewRec()}),S=q=>r.itemStates[q]??"idle",v=q=>S(q)==="success",$=q=>S(q)==="loading",E=i.computed(()=>c.value.length===0?!0:c.value.every((q,W)=>{const K=S(W);return K==="success"||K==="loading"})),A=q=>q.width===0||q.length===0?0:q.width*q.length/1e6,R=q=>A(q).toLocaleString(void 0,{maximumFractionDigits:4}),F=q=>{var ve;const W=q.configuratorParams,K=A(W),ue=((ve=f.value)==null?void 0:ve.costRub)??0,ye=q.quantity??0;return!K||!ye?0:Math.round(K*ue*ye*100)/100},H=i.computed(()=>D.sum(c.value.map(q=>{const W=q.configuratorParams;return!W.width||W.length===0||!q.quantity?0:W.width*W.length*q.quantity/1e6}))),Q=i.computed(()=>Math.round(D.sum(c.value.map(q=>F(q)))*100)/100),Z=()=>{var q,W,K;return new j.OrderItemBase({category:(q=c.value[0])==null?void 0:q.category,configurator:(W=c.value[0])==null?void 0:W.configurator,product:f.value??new j.ClientProduct,quantity:1,isAdditionalSale:(K=c.value[0])==null?void 0:K.isAdditionalSale,configuratorParams:{width:0,length:0}})},O=q=>{if(!q){f.value=null,m.value=null,c.value.forEach(K=>{K.product=new j.ClientProduct}),o("update:value",c.value);return}const W=p.value.find(K=>K.id===q);W&&(f.value=W,m.value=q,c.value.forEach((K,ue)=>{var ye,ve;K.product=W,(ye=W.properties)!=null&&ye.width&&K.configuratorParams.width>W.properties.width&&(K.configuratorParams.width=W.properties.width),(ve=W.properties)!=null&&ve.length&&K.configuratorParams.length>W.properties.length&&(K.configuratorParams.length=W.properties.length),o("item-reset",ue)}),o("update:value",c.value))},P=q=>{var ue,ye;const W=c.value[q],K=f.value;K&&((ue=K.properties)!=null&&ue.width&&W.configuratorParams.width>K.properties.width&&(W.configuratorParams.width=K.properties.width),(ye=K.properties)!=null&&ye.length&&W.configuratorParams.length>K.properties.length&&(W.configuratorParams.length=K.properties.length)),o("item-reset",q),o("update:value",c.value)},V=(q,W)=>{c.value[q].marker=W===null||W===""?void 0:W,o("item-reset",q),o("update:value",c.value)},M=q=>{c.value.forEach(W=>{W.isAdditionalSale=q}),o("update:value",c.value)},L=()=>{c.value.push(Z()),o("update:value",c.value),o("add-item",c.value.length),i.nextTick(()=>{var W,K,ue,ye;const q=c.value.length-1;(K=(W=a.value)==null?void 0:W[q])==null||K.focus(),(ye=(ue=a.value)==null?void 0:ue[q])==null||ye.select()})},Y=q=>{c.value.splice(q,1),o("update:value",c.value),o("remove-item",q)};i.watch(()=>r.value,q=>{var ye;const K=(q==null?[]:D.cloneDeep(i.toRaw(q))).map(ve=>new j.OrderItemBase(ve));c.value=K.length>0?K:[Z()];const ue=(ye=c.value[0])==null?void 0:ye.product;ue&&!ue.isNewRec()?(f.value=ue,m.value=ue.id):(f.value=null,m.value=null)},{deep:!0});const U=()=>{var W;if(f.value!==null)return;const q=(W=p.value[0])==null?void 0:W.id;q!=null&&O(q)};return i.watch(p,()=>{U()}),i.onMounted(()=>{var W;c.value.length===0&&(c.value=[Z()]);const q=(W=c.value[0])==null?void 0:W.product;q&&!q.isNewRec()&&(f.value=q,m.value=q.id),U()}),e({validate:(G=s.value)==null?void 0:G.validate,formReference:s}),(q,W)=>{const K=r1,ue=io,ye=uu;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:d.value,rules:k.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>{var ve,ot;return[i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:m.value,"onUpdate:value":[W[0]||(W[0]=_e=>m.value=_e),O],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((ve=f.value)==null?void 0:ve.costRub)!=null?(i.openBlock(),i.createElementBlock("div",o1,[i.createElementVNode("span",s1,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",a1,[f.value?(i.openBlock(),i.createElementBlock("div",l1,[W[6]||(W[6]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",c1,[b.value?(i.openBlock(),i.createElementBlock("div",d1,"Ширина "+i.toDisplayString(b.value)+".",1)):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createElementBlock("div",u1,"Длина "+i.toDisplayString(_.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",f1,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value.items,(_e,we)=>{var wt;return i.openBlock(),i.createElementBlock("div",{key:we,class:i.normalizeClass(["flex min-w-0 items-start gap-2 border-b border-gray-100 last:border-0",v(we)?"opacity-70":""])},[i.createElementVNode("div",h1,[i.createElementVNode("div",m1,[i.createElementVNode("div",p1,[i.createVNode(i.unref(z.NFormItem),{path:`items.${we}.configuratorParams.width`,label:"Ширина, мм",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{ref_for:!0,ref:"widthInputs",value:d.value.items[we].configuratorParams.width,"onUpdate:value":[$e=>d.value.items[we].configuratorParams.width=$e,$e=>P(we)],parse:i.unref(lt),"show-button":!1,disabled:!f.value||v(we)||$(we),placeholder:"Ширина",class:"w-full",onKeydown:W[1]||(W[1]=$e=>i.unref(st)($e)),onInput:$e=>h(`items.${we}.width`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(z.NFormItem),{path:`items.${we}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:d.value.items[we].configuratorParams.length,"onUpdate:value":[$e=>d.value.items[we].configuratorParams.length=$e,$e=>P(we)],parse:i.unref(lt),"show-button":!1,disabled:!f.value||v(we)||$(we),placeholder:"Длина",class:"w-full",onKeydown:W[2]||(W[2]=$e=>i.unref(st)($e)),onInput:$e=>h(`items.${we}.length`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),i.createElementVNode("div",g1,[i.createVNode(i.unref(z.NFormItem),{path:`items.${we}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:d.value.items[we].quantity,"onUpdate:value":[$e=>d.value.items[we].quantity=$e,$e=>P(we)],parse:i.unref(lt),"show-button":!1,disabled:!f.value||v(we)||$(we),placeholder:"Кол-во",class:"w-full",onKeydown:W[3]||(W[3]=$e=>i.unref(st)($e,!1)),onInput:$e=>h(`items.${we}.quantity`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(z.NFormItem),{path:`items.${we}.marker`,label:"Маркировка",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:d.value.items[we].marker??null,disabled:!f.value||v(we)||$(we),placeholder:"Маркировка",class:"w-full",onInput:$e=>h(`items.${we}.marker`),"onUpdate:value":$e=>V(we,$e??null),onFocus:i.unref(Le)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),$(we)||v(we)?(i.openBlock(),i.createElementBlock("div",y1,[$(we)?(i.openBlock(),i.createBlock(i.unref(z.NSpin),{key:0,size:14})):v(we)?(i.openBlock(),i.createBlock(K,{key:1,class:"text-green-600 text-xl"})):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),i.createElementVNode("div",b1,[_e.configuratorParams.width>0&&_e.configuratorParams.length>0?(i.openBlock(),i.createElementBlock("div",_1,[W[7]||(W[7]=i.createTextVNode(" Площадь (S) = ",-1)),i.createElementVNode("span",w1,i.toDisplayString(R(_e.configuratorParams))+" м²",1)])):i.createCommentVNode("",!0),F(_e)>0?(i.openBlock(),i.createElementBlock("div",x1,[W[8]||(W[8]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",k1,i.toDisplayString(F(_e).toLocaleString())+" "+i.toDisplayString((wt=f.value)==null?void 0:wt.currency.symbol),1)])):i.createCommentVNode("",!0)])]),w.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,disabled:$(we)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:$e=>Y(we)},{default:i.withCtx(()=>[i.createVNode(ue)]),_:1},8,["disabled","onClick"]))],2)}),128))]),f.value?(i.openBlock(),i.createElementBlock("div",v1,[H.value>0?(i.openBlock(),i.createElementBlock("div",C1,[W[9]||(W[9]=i.createTextVNode(" Общая площадь: ",-1)),i.createElementVNode("span",S1,i.toDisplayString(H.value.toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),Q.value>0?(i.openBlock(),i.createElementBlock("div",B1,[W[10]||(W[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",T1,i.toDisplayString(Q.value.toLocaleString())+" "+i.toDisplayString(f.value.currency.symbol),1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),x.value?(i.openBlock(),i.createBlock(i.unref(z.NCheckbox),{key:1,checked:((ot=c.value[0])==null?void 0:ot.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":W[4]||(W[4]=_e=>M(_e??!1))},{default:i.withCtx(()=>[...W[11]||(W[11]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createElementVNode("div",N1,[f.value&&!w.value?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,disabled:C.value,type:"default",onClick:L},{default:i.withCtx(()=>[i.createVNode(ye),W[12]||(W[12]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:N.value||E.value,type:"primary",class:"ml-auto",onClick:W[5]||(W[5]=_e=>o("submit",c.value))},{default:i.withCtx(()=>{var _e;return[i.createTextVNode(i.toDisplayString((_e=c.value[0])!=null&&_e.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[i.unref(ei),()=>o("submit",c.value)]])}}}),R1={class:"flex flex-col gap-2"},E1={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},P1={},pu=i.defineComponent({...P1,__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(k=>new j.OrderItemBase(k))),a=i.ref([]),l=i.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=k=>{c.forEach(x=>{l.value[`items.${k}.${x}`]={}})},u=k=>{c.forEach(x=>{delete l.value[`items.${k}.${x}`]})},h=i.computed(()=>a.value.includes("loading")),f=()=>({width:{},length:{},quantity:{},marker:{}}),m=(k,x)=>{let C=!1;return c.forEach(N=>{var A,R;const w=`items.0.${N}`,S=(A=k[N])==null?void 0:A.feedback,$=((R=k[w])==null?void 0:R.feedback)??S,E=`items.${x}.${N}`;$?(l.value[E]=k[w]??k[N],C=!0):l.value[E]={}}),C},p=(k,x,C)=>new Promise(N=>{const w=f();let S=!1;const v=$=>{if(S)return;S=!0;const E=m(w,x),A=($===void 0?!E:$)&&!E;a.value[x]=A?"success":"error",i.nextTick(()=>{var R,F;(F=(R=o.value)==null?void 0:R.formReference)==null||F.restoreValidation()}),N(A)};a.value[x]="loading",r("submit",[D.cloneDeep(k)],w,v,{isFinalSuccessfulCompletion:C})}),g=async()=>{var C,N;try{await((N=(C=o.value)==null?void 0:C.formReference)==null?void 0:N.validate())}catch{return}const k=s.value.map((w,S)=>S).filter(w=>{const S=a.value[w]??"idle";return S!=="success"&&S!=="loading"});let x=!0;for(let w=0;w<k.length;w+=1){const S=k[w],v=s.value[S];if(!v)break;const E=w===k.length-1&&x;await p(v,S,E)||(x=!1)}},y=k=>{const x=k-1;a.value[x]="idle",d(x)},b=k=>{a.value.splice(k,1),u(k);for(let x=k;x<s.value.length;x+=1)d(x)},_=k=>{const x=a.value[k];(x==="success"||x==="error")&&(a.value[k]="idle")};return i.onMounted(()=>{(n.cartItems??[]).forEach((k,x)=>{a.value[x]="idle",d(x)})}),i.watch(()=>n.cartItems,k=>{const x=(k??[]).map(C=>new j.OrderItemBase(C));s.value=x,a.value=x.map(()=>"idle"),x.forEach((C,N)=>{d(N)})},{deep:!0}),(k,x)=>{var N;const C=z.NButton;return i.openBlock(),i.createElementBlock("div",R1,[t.settings.allowShowTable&&((N=s.value[0])!=null&&N.isNewRec())?(i.openBlock(),i.createBlock(C,{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",E1,[i.createVNode(mu,{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:g,onAddItem:y,onRemoveItem:b,onItemReset:_},null,8,["value","validation","settings","event-emitter","is-submit-processing","item-states"])])])}}}),F1={key:0,class:"flex justify-center p-4"},V1={key:1,class:"p-4 text-center text-red-500"},M1={key:2,class:"flex justify-center"},A1={class:"!bg-white p-4 m-2 rounded-md w-max"},I1={key:3,class:"p-4 text-center text-gray-500"},O1={},gu=i.defineComponent({...O1,__name:"dynamic-configurator",props:{eventEmitter:{},settings:{},editor:{},cartItem:{},cartItems:{},category:{}},setup(t){const e=t,n=i.ref(!1),r=i.ref(null),o=i.ref(e.cartItem??null),s=i.ref(e.cartItems??null),a=f=>{const m=f.configuratorParams;return[new j.OrderItemBase({...f,quantity:f.quantity??1,marker:f.marker,configuratorParams:{width:(m==null?void 0:m.width)??f.width??0,length:(m==null?void 0:m.length)??f.length??0}})]},l=i.ref(e.editor===j.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var m,p,g;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const f={category:((m=e.cartItem)==null?void 0:m.category)??e.category,configurator:e.editor,quantity:1};switch(e.editor){case"kozyrek":{const y=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{length:y.stripMinLength,linesAngles:[],linesWidths:[],startTailType:D.some(y.startTailConfigs,b=>b.isDefault)?(p=y.startTailConfigs)==null?void 0:p.findIndex(b=>b.isDefault):void 0,endTailType:D.some(y.endTailConfigs,b=>b.isDefault)?(g=y.endTailConfigs)==null?void 0:g.findIndex(b=>b.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const y=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{width:0,height:0,netType:y.netType[0]||"",color:y.color[0]||"",mountType:y.mountType[0]||""}});break}case"strip":{const y=e.settings;s.value=[new j.OrderItemBase({...f,length:y.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const y=e.settings;o.value=new j.OrderItemBase({...f,configuratorParams:{width:y.minWidth,length:y.minLength}});break}case"sandwich":{o.value=new j.OrderItemBase({...f,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new j.OrderItemBase({...f,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(f,m,p)=>{const g=y=>{p==null||p(),y&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:f,callback:g,validation:m})},u=(f,m,p,g)=>{const y=f[0];if(!y){p==null||p();return}const b=(g==null?void 0:g.isFinalSuccessfulCompletion)===!0,_=k=>{p==null||p(k),b&&k&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:y,callback:_,validation:m,additionalParams:g})},h=()=>{e.category&&e.eventEmitter.emit("configurator:click-view-switch",{category:e.category})};return i.onMounted(()=>{!e.cartItem&&!e.cartItems&&c()}),(f,m)=>{const p=z.NSpin;return i.openBlock(),i.createElementBlock(i.Fragment,null,[n.value?(i.openBlock(),i.createElementBlock("div",F1,[i.createVNode(p,{size:"large"})])):r.value?(i.openBlock(),i.createElementBlock("div",V1,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",M1,[i.createElementVNode("div",A1,[t.editor==="kozyrek"?(i.openBlock(),i.createBlock(tu,{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(ru,{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(lu,{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(du,{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(hu,{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(pu,{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",I1,' Конфигуратор "'+i.toDisplayString(t.editor)+'" не поддерживается. ',1))],64)}}});function yu(t){return Object.values(j.ConfiguratorsEnum).includes(t)}function bu(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.Sandwich?!0:t.properties.configuratorSettings!==void 0&&D.isArray(t.products)&&t.products.length>0}const z1={key:0,class:"pt-0.5"},D1={key:0},L1={class:"line-through"},H1={key:0},W1={key:1},j1={class:"flex flex-row gap-1"},q1={key:0},X1={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},Y1={class:"flex flex-col gap-2.5 sm:flex-row"},U1={class:"mt-2"},K1={key:1,class:"flex flex-col"},G1={},Z1=i.defineComponent({...G1,__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(xr,"medium"),r=i.computed(()=>{var U;return(U=e==null?void 0:e.filteredItems)==null?void 0:U[e.categoryItem.id]}),o=i.computed(()=>{var U,G;return D.isArray((U=e.categoryItem)==null?void 0:U.categories)&&((G=e.categoryItem.categories)==null?void 0:G.length)>0}),s=i.computed(()=>{var U;return D.isArray((U=e.categoryItem)==null?void 0:U.products)?e.categoryItem.products:[]}),a=i.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([U,G])=>`${G} руб./${E(U)}`).join(", ")),l=i.computed(()=>D.isUndefined(e.filteredItems)||r.value==="*"?s.value:s.value.filter(U=>{var q;const G=(q=r.value)==null?void 0:q.products;return D.isArray(G)&&G.includes(U.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>D.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),u=i.computed(()=>D.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),h=i.computed(()=>D.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),f=i.computed(()=>D.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),m=i.computed(()=>{var U,G,q;return((U=e.categoryItem.properties)==null?void 0:U.configurator)!==void 0&&yu((G=e.categoryItem.properties)==null?void 0:G.configurator)&&bu(e.categoryItem)&&((q=e.categoryItem.properties)==null?void 0:q.configuratorSettings)!==void 0&&(D.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),p=i.computed(()=>m.value&&(D.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),g=i.computed(()=>D.isNil(e.categoryContextButtonsConfig)?[]:D.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),y=i.computed(()=>new j.ClientCategory(e.categoryItem)),b=i.ref(!1),_=i.ref(!1),k=i.computed(()=>!D.isUndefined(e.isCategoryItemSelected)),x=i.computed(()=>D.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),C=i.computed(()=>D.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),N=i.computed(()=>D.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),w=i.computed(()=>M.value&&it.getDeviceTypeByResolution()===Xe.laptop?"auto":"fixed"),S=i.useTemplateRef("collapse-item-reference"),v=i.computed(()=>{var U,G;return(G=(U=e.categoryItem.properties)==null?void 0:U.templateCost)==null?void 0:G.priceCoefficient}),$=i.computed(()=>{var U,G;return(G=(U=e.categoryItem.properties)==null?void 0:U.templateCost)==null?void 0:G.increasePercent}),E=(U,G="ru-RU")=>0 .toLocaleString(G,{style:"currency",currency:U,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),A=U=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:U,target:S.value})},R=(U,G)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:G,isLoadingState:b,target:S.value})},F=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:S.value})},H=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:S.value})},Q=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:S.value})},Z=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:S.value})},O=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:S.value})},P=U=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:U,target:S.value})},V=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},M=i.ref(0),L=i.computed(()=>M.value&&s.value.length>0?jp(s.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),Y=D.debounce(()=>{M.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",Y)}),window.addEventListener("resize",Y),Y(),(U,G)=>{const q=z.NCheckbox,W=wm,K=z.NTooltip,ue=ym,ye=z.NTag,ve=mm,ot=um,_e=z.NButton,we=lm,wt=Sl,$e=Cl,Gt=vl,pn=ms,Rt=z.NDropdown,Qn=z.NDataTable,gn=z.NAlert,sn=z.NSpin;return i.openBlock(),i.createBlock(Bl,{ref:"collapse-item-reference",name:t.categoryItem.id,"data-id":t.categoryItem.id,"onHeader:click":R},{"pre-arrow":i.withCtx(()=>{var Ve,te;return[k.value?(i.openBlock(),i.createElementBlock("div",z1,[i.createVNode(q,{checked:x.value,indeterminate:N.value,disabled:C.value,"onUpdate:checked":A},null,8,["checked","indeterminate","disabled"])])):i.createCommentVNode("",!0),!d.value&&((Ve=y.value)!=null&&Ve.isDisabled)?(i.openBlock(),i.createBlock(K,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(W,{class:"pt-1.5"})]),default:i.withCtx(()=>[G[1]||(G[1]=i.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):i.createCommentVNode("",!0),((te=y.value)==null?void 0:te.isFavorite)??!1?(i.openBlock(),i.createBlock(K,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ue,{class:"pt-1.5"})]),default:i.withCtx(()=>[G[2]||(G[2]=i.createTextVNode(" Избранная категория ",-1))]),_:1})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var Ve,te,le,De,hi;return[i.createElementVNode("div",{class:i.normalizeClass({"text-base font-semibold uppercase":!0,"text-gray-400 line-through":t.categoryItem.isHidden,"text-gray-400":(Ve=y.value)==null?void 0:Ve.isDisabled})},[i.createVNode(K,{disabled:!t.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createElementVNode("span",null,i.toDisplayString(t.categoryItem.name),1)]),default:i.withCtx(()=>[G[3]||(G[3]=i.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:G[0]||(G[0]=i.withModifiers((...at)=>i.unref(D.noop)&&i.unref(D.noop)(...at),["prevent","stop"]))},[(te=t.categoryItem.properties)!=null&&te.m2Price?(i.openBlock(),i.createBlock(ye,{key:0,size:i.unref(n),class:i.normalizeClass({"!pr-0":((le=t.categoryItem.properties)==null?void 0:le.templateCost)&&t.categoryItem.properties.m2PriceRetail&&$.value}),round:""},{default:i.withCtx(()=>{var at;return[i.createTextVNode(" Установленная стоимость: "+i.toDisplayString(t.categoryItem.properties.m2Price)+" руб./м2 ",1),(at=t.categoryItem.properties)!=null&&at.templateCost&&t.categoryItem.properties.m2PriceRetail&&$.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[$.value?(i.openBlock(),i.createBlock(ye,{key:0,type:"success",bordered:!1,size:i.unref(n),class:"ml-2 !pr-0",round:""},{default:i.withCtx(()=>[$.value?(i.openBlock(),i.createElementBlock("span",D1,i.toDisplayString($.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0),i.createVNode(ye,{size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createElementVNode("span",L1,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},[v.value||$.value?(i.openBlock(),i.createBlock(ye,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>{var at;return[v.value?(i.openBlock(),i.createElementBlock("span",H1,i.toDisplayString((at=v.value)==null?void 0:at.name),1)):i.createCommentVNode("",!0),$.value?(i.openBlock(),i.createElementBlock("span",W1,i.toDisplayString($.value>0?"+":"")+i.toDisplayString($.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0)]}),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(ye,{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&&((hi=y.value)!=null&&hi.manager)?(i.openBlock(),i.createBlock(ye,{key:3,size:i.unref(n),closable:!0,round:"",class:"align-bottom",onClose:Z},{default:i.withCtx(()=>[i.createVNode(K,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var at,Zt;return[i.createElementVNode("span",j1,[i.createVNode(ve),i.createTextVNode(" "+i.toDisplayString((Zt=(at=y.value)==null?void 0:at.manager)==null?void 0:Zt.name),1)])]}),default:i.withCtx(()=>{var at,Zt;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((Zt=(at=y.value)==null?void 0:at.manager)==null?void 0:Zt.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[t.showSlugs||t.showProperties?(i.openBlock(),i.createElementBlock("div",q1,[i.createElementVNode("ul",X1,[t.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:t.categoryItem.id,slug:t.categoryItem.slug},(Ve,te)=>(i.openBlock(),i.createElementBlock("li",{key:te}," ("+i.toDisplayString(te)+"): "+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,te)=>(i.openBlock(),i.createElementBlock("li",{key:te}," ("+i.toDisplayString(te)+"): "+i.toDisplayString(Ve),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var Ve;return[i.createElementVNode("div",Y1,[d.value?(i.openBlock(),i.createBlock(K,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(_e,{ghost:!0,size:i.unref(n),onClick:F},{default:i.withCtx(()=>{var te;return[(te=y.value)!=null&&te.isDisabled?(i.openBlock(),i.createBlock(W,{key:1})):(i.openBlock(),i.createBlock(ot,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var te;return[(te=y.value)!=null&&te.isDisabled?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode(" Скрыто для клиента"+i.toDisplayString(y.value.hidingComment?`. Причина: '${y.value.hidingComment}'`:""),1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode("Видимо клиенту")],64))]}),_:1})):i.createCommentVNode("",!0),u.value&&!((Ve=y.value)!=null&&Ve.manager)?(i.openBlock(),i.createBlock(K,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(_e,{ghost:!0,size:i.unref(n),onClick:Q},{default:i.withCtx(()=>[i.createVNode(we)]),_:1},8,["size"])]),default:i.withCtx(()=>{var te,le,De;return[(te=y.value)!=null&&te.manager?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode('Категория закреплена за "'+i.toDisplayString(((De=(le=y.value)==null?void 0:le.manager)==null?void 0:De.name)??"-")+'"',1)],64)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[i.createTextVNode("Закрепить")],64))]}),_:1})):i.createCommentVNode("",!0),h.value?(i.openBlock(),i.createBlock(K,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(_e,{ghost:!0,disabled:h.value==="disabled",size:i.unref(n),onClick:H},{default:i.withCtx(()=>{var te;return[(te=y.value)!=null&&te.isRequired?(i.openBlock(),i.createBlock($e,{key:1})):(i.openBlock(),i.createBlock(wt,{key:0}))]}),_:1},8,["disabled","size"])]),default:i.withCtx(()=>[G[4]||(G[4]=i.createTextVNode(" Категория, которую нужно предлагать клиенту ",-1))]),_:1})):i.createCommentVNode("",!0),f.value?(i.openBlock(),i.createBlock(K,{key:3,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(_e,{ghost:!0,size:i.unref(n),type:"primary",onClick:O},{default:i.withCtx(()=>[i.createVNode(Gt)]),_:1},8,["size"])]),default:i.withCtx(()=>[G[5]||(G[5]=i.createTextVNode(" Редактировать ",-1))]),_:1})):i.createCommentVNode("",!0),g.value.length>0?(i.openBlock(),i.createBlock(Rt,{key:4,options:g.value,size:i.unref(n),trigger:"click",onSelect:P},{default:i.withCtx(()=>[i.createVNode(_e,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(pn)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(U.$slots,"default",{},()=>{var Ve,te,le;return[i.createElementVNode("div",U1,[o.value?(i.openBlock(),i.createBlock(wu,{key:0,"categories-items":t.categoryItem.categories??[],"has-products":c.value||b.value,"event-emitter":t.eventEmitter,"filtered-items":r.value?((Ve=r.value)==null?void 0:Ve.categories)??{}:void 0,"is-category-item-selected":t.isCategoryItemSelected,"show-slugs":t.showSlugs,"show-properties":t.showProperties,"allow-name-click":t.allowNameClick,"allow-price-click":t.allowPriceClick,"show-price-history":t.showPriceHistory,"show-cost-date":t.showCostDate,"show-category-required-button":t.showCategoryRequiredButton,"show-category-hide-for-client-button":t.showCategoryHideForClientButton,"show-category-pin-button":t.showCategoryPinButton,"show-category-edit-button":t.showCategoryEditButton,"category-context-buttons-config":t.categoryContextButtonsConfig,"is-product-item-selected":t.isProductItemSelected,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-costs":t.showProductCosts,"show-product-required-button":t.showProductRequiredButton,"show-product-edit-button":t.showProductEditButton,"product-context-buttons-config":t.productContextButtonsConfig,"show-configurator":t.showConfigurator,"can-show-configurator":t.canShowConfigurator},null,8,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"])):i.createCommentVNode("",!0)]),m.value&&p.value?(i.openBlock(),i.createBlock(gu,{key:0,"event-emitter":t.eventEmitter,settings:(te=t.categoryItem.properties)==null?void 0:te.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",K1,[m.value?(i.openBlock(),i.createBlock(_e,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:V},{default:i.withCtx(()=>[...G[6]||(G[6]=[i.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Qn,{columns:L.value,data:l.value,bordered:!0,loading:b.value,remote:!0,"row-key":De=>De.id,"table-layout":w.value,class:"mt-2"},null,8,["columns","data","loading","row-key","table-layout"])])):i.createCommentVNode("",!0),!b.value&&!_.value&&!o.value&&!c.value?(i.openBlock(),i.createBlock(gn,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createBlock(gn,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),b.value?(i.openBlock(),i.createBlock(sn,{key:4,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>[...G[7]||(G[7]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),Q1=An(Z1,[["__scopeId","data-v-607a5aad"]]),J1={class:"sc-collapse flex w-full flex-col"},e_={},_u=i.defineComponent({...e_,__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",J1,[i.renderSlot(s.$slots,"default")]))}}),t_={},wu=i.defineComponent({...t_,__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(xr,"medium"),r=i.computed(()=>D.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(D.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=z.NSpin,c=z.NAlert;return i.openBlock(),i.createElementBlock(i.Fragment,null,[r.value.length>0?(i.openBlock(),i.createBlock(_u,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(Q1,{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)}}}),n_={},xu=i.defineComponent({...n_,__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(()=>D.isArray(r.value)),a=new j.Reference,l=i.computed(()=>D.isNil(r.value)?s.value?[]:null:D.isArray(r.value)?r.value.filter(m=>!D.isNil(m)).map(m=>m.id):r.value.id),c=i.computed(()=>yt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue,void 0,r.disabledItem)),d=m=>{var p;if(D.isArray(m)){const g=m.length>0?m.map(y=>{var b;return(b=c.value.find(_=>_.value===y))==null?void 0:b.item}).filter(y=>!D.isNil(y)):[];o("update:value",g)}else{const g=m===a.id||D.isNil(m)||(p=c.value.find(y=>y.value===m))==null?void 0:p.item;o("update:value",g)}},u=i.useTemplateRef("select-component");return e({focus:()=>{var m;return(m=u.value)==null?void 0:m.focus()},blur:()=>{var m;return(m=u.value)==null?void 0:m.blur()}}),(m,p)=>(i.openBlock(),i.createBlock(i.unref(z.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"]))}}),i_={},r_=i.defineComponent({...i_,__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,C;const n=t,r=e,o=()=>{const N=j.PriceCoefficient.getRetailPriceCoefficient();return D.unset(N,"isNewRec"),N},s=N=>!N||N.id===o().id,a=i.computed(()=>{var N;return((N=n.catalogItem)==null?void 0:N.type)==="product"}),l=i.computed(()=>a.value?n.catalogItem:void 0),c=N=>{var w,S,v,$;return N.id===o().id?(w=l.value)==null?void 0:w.getRetailCost():($=(v=(S=l.value)==null?void 0:S.priceCoefficients)==null?void 0:v.find(E=>E.coefficient.id===N.id))==null?void 0:$.cost},d=i.computed(()=>{var S;const w=[...((S=j.useReferencesStore().priceCoefficientsReference)==null?void 0:S.map(v=>structuredClone(i.toRaw(v))))??[],o()].filter(v=>{var $;return(($=n.visibleCoefficient)==null?void 0:$.call(n,v))??!0});return a.value&&w.forEach(v=>{var E;const $=c(v);$?v.name+=` (${$} ${(E=l.value)==null?void 0:E.currency.symbol})`:v.name=""}),w.filter(v=>v.name!=="")}),u=i.ref(n.value.coefficient),h=i.ref(((C=(x=n.value)==null?void 0:x.value)==null?void 0:C.toString())??null),f=i.ref(null),m=i.computed(()=>{var N,w;return(w=(N=l.value)==null?void 0:N.priceCoefficients)==null?void 0:w.find(S=>S.coefficient.slug===j.PriceCoefficientEnum.K0)}),p=i.ref(void 0),g=N=>Number.parseFloat((N??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),y=()=>{var w,S;p.value=void 0;let N=g(h.value);if(N=Number.isNaN(N)?void 0:N,a.value)if(u.value||h.value){const v=o(),$=c(u.value??v)??0,E=$+$*((N??0)/100);f.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(E),E>(((w=l.value)==null?void 0:w.getRetailCost())??E)&&(p.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),m.value&&E<(((S=m.value)==null?void 0:S.cost)??0)&&(p.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else f.value=null;r("update:value",{value:Number.isNaN(N)?void 0:N,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})},b=N=>{D.isArray(N)||D.isNull(N)||(u.value=N,h.value=null,!u.value&&h.value&&(u.value=o()),y())},_=()=>{u.value||(u.value=o()),y()},k=N=>{var S,v,$,E,A;const w=g(N);if(a.value){if(Number.isNaN(w)){u.value=void 0,h.value=null,r("update:value",{value:void 0,coefficient:void 0});return}let R=0;if(w<=0)u.value=void 0,h.value=null;else if(m.value&&w<(((S=m.value)==null?void 0:S.cost)??0))u.value=(v=m.value)==null?void 0:v.coefficient,R=(w-m.value.cost)*100/m.value.cost,p.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(w>((($=l.value)==null?void 0:$.getRetailCost())??w)){u.value=o();const F=((E=l.value)==null?void 0:E.getRetailCost())??0;R=(w-F)*100/F,p.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const F=((A=l.value)==null?void 0:A.priceCoefficients)??[],H=D.sortBy(F,[O=>O.cost]),Z=H.filter(O=>O.cost<=w).at(-1)??H.at(0);Z&&(u.value=Z.coefficient,R=(w-Z.cost)*100/Z.cost),p.value={validationStatus:void 0,feedback:void 0}}h.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:5}).format(R),r("update:value",{value:Number.isNaN(R)?void 0:R,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})}else r("update:value",{value:Number.isNaN(w)?void 0:w,coefficient:void 0})};return i.onMounted(()=>{var N,w,S,v;n.calculationType===j.CalculationTypeEnum.m2Cost?f.value=((w=(N=n.value)==null?void 0:N.value)==null?void 0:w.toString())??null:!((S=n.value)!=null&&S.coefficient)&&((v=n.value)!=null&&v.value)&&(u.value=o()),y()}),(N,w)=>{var $,E,A;const S=z.NInput,v=z.NInputGroup;return i.openBlock(),i.createBlock(i.unref(z.NFormItem),{"show-label":!i.unref(D.isNil)(t.label),label:t.label,"show-feedback":!i.unref(D.isNil)((($=p.value)==null?void 0:$.feedback)??t.feedback),feedback:((E=p.value)==null?void 0:E.feedback)??t.feedback,"validation-status":((A=p.value)==null?void 0:A.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(v,{key:0,class:i.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:i.withCtx(()=>[i.createVNode(xu,{class:"w-full min-w-0 flex-1",value:u.value,"reference-list":d.value,clearable:t.clearable,disabled:t.disabled,"consistent-menu-width":!1,"show-empty-value":!0,"disabled-item":t.disabledCoefficient,"onUpdate:value":b},null,8,["value","reference-list","clearable","disabled","disabled-item"]),i.createVNode(S,{value:h.value,"onUpdate:value":[w[0]||(w[0]=R=>h.value=R),_],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(S,{key:1,value:f.value,"onUpdate:value":[w[1]||(w[1]=R=>f.value=R),k],clearable:t.clearable,disabled:t.disabled,placeholder:"Стоимость",class:"w-full"},i.createSlots({_:2},[a.value?{name:"suffix",fn:i.withCtx(()=>{var R;return[i.createTextVNode(i.toDisplayString((R=l.value)==null?void 0:R.currency.symbol),1)]}),key:"0"}:void 0]),1032,["value","clearable","disabled"])):i.createCommentVNode("",!0)],2)]),_:1},8,["show-label","label","show-feedback","feedback","validation-status"])}}}),o_={key:0,class:"flex flex-row gap-2.5"},s_={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},a_={},ku=i.defineComponent({...a_,__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=it.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=it.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=(m="other",p=!1)=>{if(a.value&&!p){o("processing:cancel",_=>{a.value=_});return}let g=!1;o("closing",m,()=>{g=!0}),g||(s.value=!1,o("update:show",s.value))},f=()=>{o("accept",p=>{a.value=p})};return i.watch(()=>r.show,m=>{m?u():h("other",!0)}),i.watch(()=>r.processing,m=>{a.value=m}),e({open:u,close:h,acceptHandler:f}),(m,p)=>{const g=z.NButton,y=z.NModal;return i.openBlock(),i.createBlock(y,{loading:a.value,show:s.value,"show-icon":!1,size:i.unref(l),style:i.normalizeStyle(`width: ${d.value}px`),title:t.title,"trap-focus":t.trapFocus??!0,"action-class":m.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:p[1]||(p[1]=b=>h("header")),onEsc:p[2]||(p[2]=b=>h("esc")),onMaskClick:p[3]||(p[3]=b=>h("mask"))},i.createSlots({default:i.withCtx(()=>[i.renderSlot(m.$slots,"default")]),_:2},[m.$slots.header?{name:"header",fn:i.withCtx(()=>[i.renderSlot(m.$slots,"header")]),key:"0"}:void 0,m.$slots.action||m.$slots["extra-action"]||t.acceptButton.show||t.cancelButton.show?{name:"action",fn:i.withCtx(()=>[m.$slots["extra-action"]?(i.openBlock(),i.createElementBlock("div",o_,[i.renderSlot(m.$slots,"extra-action")])):i.createCommentVNode("",!0),m.$slots.action||t.acceptButton.show||t.cancelButton.show?(i.openBlock(),i.createElementBlock("div",s_,[i.renderSlot(m.$slots,"action",{disabled:a.value}),t.acceptButton.show??!0?(i.openBlock(),i.createBlock(g,{key:0,disabled:a.value||!t.valid,loading:a.value,size:i.unref(l),type:"primary",onClick:f},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","loading","size"])):i.createCommentVNode("",!0),t.cancelButton.show??!0?(i.openBlock(),i.createBlock(g,{key:1,disabled:a.value,size:i.unref(l),type:"default",onClick:p[0]||(p[0]=b=>h("footer"))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.cancelButton.text??"Отмена"),1)]),_:1},8,["disabled","size"])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["loading","show","size","style","title","trap-focus","action-class"])}}}),l_={class:"text-sm"},c_={class:"text-sm"},d_={},u_=i.defineComponent({...d_,__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(!1),a=i.ref(null),l=i.computed(()=>{var R,F,H;return((R=a.value)==null?void 0:R.unit.isLinear)&&((H=(F=a.value)==null?void 0:F.properties)==null?void 0:H.isLengthConfigurator)}),c=i.computed(()=>a.value?j.UnitsHelper.productIsMeasurable(a.value)||l.value?"шт.":a.value.unit.name:"шт."),d=i.ref(void 0),u=i.ref(void 0),h=i.ref(!0),f=i.ref(null),m=i.computed({get:()=>{var R;return((R=f.value)==null?void 0:R.quantity)??null},set:R=>{f.value&&(f.value.quantity=R??0)}}),p=i.computed({get:()=>{var R;return((R=f.value)==null?void 0:R.length)??null},set:R=>{f.value&&(f.value.length=R??void 0)}}),g=R=>{f.value&&(f.value.marker=R??null)},y=n,b=()=>({length:{},quantity:{},marker:{}}),_=i.ref(b()),k=i.ref(!1),x=i.computed(()=>{var Z,O,P,V;if(!a.value)return{};const R=j.UnitsHelper.getProductLengthMultiplicity(a.value),F=j.UnitsHelper.getProductMultiplicity(a.value),H=((O=(Z=a.value)==null?void 0:Z.properties)==null?void 0:O.minLength)||R,Q=(V=(P=a.value)==null?void 0:P.properties)==null?void 0:V.maxLength;return{length:[ae.required,ae.min(H??.1),ae.max(Q),ae.step(R),We.serverValidation(_.value.length.feedback)],quantity:[ae.required,ae.min(F),ae.step(F),We.serverValidation(_.value.quantity.feedback)],marker:[We.serverValidation(_.value.marker.feedback)]}}),C=i.computed(()=>{var R,F,H;return a.value?((R=a.value.properties)==null?void 0:R.lengthStep)??((F=a.value.properties)!=null&&F.ignoreMinCountCheck?0:((H=a.value.properties)==null?void 0:H.minCount)??0):0}),N=i.computed(()=>{var H,Q,Z,O,P,V,M,L,Y;if(!a.value)return"";const R=((Q=(H=a.value)==null?void 0:H.properties)==null?void 0:Q.minLength)??((O=(Z=a.value)==null?void 0:Z.properties)!=null&&O.ignoreMinCountCheck?0:(V=(P=a.value)==null?void 0:P.properties)==null?void 0:V.minCount),F=(L=(M=a.value)==null?void 0:M.properties)==null?void 0:L.maxLength;return R||F?`(${R?`от ${R}`:""}${R&&F?" ":""}${F?`до ${F}`:""} ${(Y=a.value)==null?void 0:Y.unit.name})`:""}),w=R=>{var O,P;if(!((P=(O=a.value)==null?void 0:O.properties)!=null&&P.isLengthConfigurator)||!f.value||D.isNil(R)||C.value===0)return;const F=R/C.value,H=Math.round(F),Q=j.UnitsHelper.getProductMultiplicity(a.value),Z=Math.max(H,Q);f.value.quantity=Z},S=R=>{var Z,O,P,V;if(!((O=(Z=a.value)==null?void 0:Z.properties)!=null&&O.isLengthConfigurator)||!f.value||D.isNil(R)||C.value===0)return;const F=R*C.value,H=((P=a.value.properties)==null?void 0:P.minLength)||j.UnitsHelper.getProductLengthMultiplicity(a.value),Q=(V=a.value.properties)==null?void 0:V.maxLength;H!==void 0&&F<H?f.value.length=H:Q!==void 0&&F>Q?f.value.length=Q:f.value.length=F},v=async R=>{var H;const F=D.cloneDeep(f.value);try{await((H=r.value)==null?void 0:H.validate(Q=>{if(!Q){if(!a.value||!F)return;j.UnitsHelper.productIsMeasurable(a.value)||delete F.length,l.value&&C.value&&(F.length=C.value),k.value=!0,y("submit",F,_.value,()=>{k.value=!1,R(!1),i.nextTick(()=>{var Z;(Z=r.value)==null||Z.validate(D.noop).catch(D.noop)})})}}))}catch{}},$=()=>{a.value=null,d.value=void 0,f.value=null,_.value=b()},E=()=>{s.value=!1};return e({show:(R,F)=>{var H,Q,Z,O,P;if($(),s.value=!0,a.value=R,d.value=F==null?void 0:F.cartItemData,u.value=F==null?void 0:F.orderId,h.value=(F==null?void 0:F.canSetDopProdaga)??!1,f.value=new j.OrderItemBase((F==null?void 0:F.cartItemData)??new j.OrderItemBase({product:R,quantity:j.UnitsHelper.productIsMeasurable(a.value)?1:((H=R==null?void 0:R.properties)==null?void 0:H.minCount)??1,length:((Q=R==null?void 0:R.properties)==null?void 0:Q.minLength)||((Z=R==null?void 0:R.properties)!=null&&Z.ignoreMinCountCheck?0:(O=R==null?void 0:R.properties)==null?void 0:O.minCount)||0})),(P=R==null?void 0:R.properties)!=null&&P.isLengthConfigurator&&f.value&&C.value>0){const V=C.value,M=f.value.quantity||1;f.value.length=M*V}},closeDialog:E}),(R,F)=>{var P;const H=z.NFormItem,Q=z.NInputGroupLabel,Z=z.NInputGroup,O=z.NCheckbox;return i.openBlock(),i.createBlock(ku,{ref:"base-dialog-reference",show:s.value,title:`${d.value?"Изменение":"Добавление"} товара ${(P=a.value)==null?void 0:P.name} в ${u.value?` заказ №${u.value}`:"корзину"}`,"accept-button":{show:!0,text:d.value?"Изменить":"Добавить"},processing:k.value,"modal-width":500,onAccept:v,onClosing:E},{default:i.withCtx(()=>[a.value&&f.value?i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{key:0,ref:"form-reference",model:f.value,rules:x.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>[i.unref(j.UnitsHelper).productIsMeasurable(a.value)?(i.openBlock(),i.createBlock(H,{key:0,path:"length",label:`Метраж, ${N.value+a.value.unit.name}`},i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:p.value,"onUpdate:value":[F[0]||(F[0]=V=>p.value=V),w],parse:i.unref(lt),step:i.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:F[1]||(F[1]=V=>i.unref(eo)(V,".",!1)),onInput:F[2]||(F[2]=V=>i.unref(nt)(_.value,"length")),onFocus:i.unref(Le)},null,8,["value","parse","step","onFocus"])]),_:2},[!_.value.length.feedback&&i.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",l_,"Метраж должно быть кратно "+i.toDisplayString(i.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)),1)]),key:"0"}:void 0]),1032,["label"])):i.createCommentVNode("",!0),i.createVNode(H,{path:"quantity",label:`Количество, ${c.value}`},{default:i.withCtx(()=>[i.createVNode(Z,null,i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:m.value,"onUpdate:value":[F[3]||(F[3]=V=>m.value=V),S],parse:i.unref(lt),step:i.unref(j.UnitsHelper).getProductMultiplicity(a.value),"show-button":i.unref(j.UnitsHelper).getProductMultiplicity(a.value)>1,"button-placement":"both",placeholder:"Введите количество",class:"w-full",onKeydown:F[4]||(F[4]=V=>i.unref(eo)(V,".",!1)),onInput:F[5]||(F[5]=V=>i.unref(nt)(_.value,"quantity")),onFocus:i.unref(Le)},null,8,["value","parse","step","show-button","onFocus"]),l.value?(i.openBlock(),i.createBlock(Q,{key:0,class:"bg-orange-100 font-bold"},{default:i.withCtx(()=>[i.createTextVNode(" x "+i.toDisplayString(C.value)+" "+i.toDisplayString(a.value.unit.name),1)]),_:1})):i.createCommentVNode("",!0)]),_:2},[!_.value.quantity.feedback&&i.unref(j.UnitsHelper).getProductMultiplicity(a.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",c_,"Количество должно быть кратно "+i.toDisplayString(i.unref(j.UnitsHelper).getProductMultiplicity(a.value)),1)]),key:"0"}:void 0]),1024)]),_:1},8,["label"]),i.unref(j.UnitsHelper).productIsMeasurable(a.value)?(i.openBlock(),i.createBlock(H,{key:1,path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:f.value.marker??null,placeholder:"Введите маркировку",onInput:F[6]||(F[6]=V=>i.unref(nt)(_.value,"marker")),"onUpdate:value":F[7]||(F[7]=V=>g(V)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1})):i.createCommentVNode("",!0),h.value?(i.openBlock(),i.createBlock(O,{key:2,checked:f.value.isAdditionalSale,"onUpdate:checked":F[8]||(F[8]=V=>f.value.isAdditionalSale=V),"true-value":!0,"false-value":!1},{default:i.withCtx(()=>[...F[9]||(F[9]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0)]),_:1},8,["model","rules"])),[[i.unref(ei),()=>{var V,M;return(M=(V=o.value)==null?void 0:V.acceptHandler)==null?void 0:M.call(V)}]]):i.createCommentVNode("",!0)]),_:1},8,["show","title","accept-button","processing"])}}}),f_={class:"flex flex-row gap-1"},h_={class:"sc-client-name flex flex-col gap-1 text-base"},m_=["href"],p_={key:1,class:"text-sc-grey"},g_={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},y_={key:0},b_={key:1,class:"text-sm"},__={},Er=i.defineComponent({...__,__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?He.format(n.client.lastLoginAt,j.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{D.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=ps,d=z.NButton,u=z.NPopover;return i.openBlock(),i.createElementBlock("div",f_,[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(D.isNil)(t.popoverPosition),placement:t.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",h_,[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",p_," [ Деактивирован ] "))],8,m_),t.showCityAndRegion&&t.client.city?(i.openBlock(),i.createElementBlock("span",g_," г. "+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",y_,i.toDisplayString(t.client.alternativeName),1)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("span",b_," Последний вход: "+i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),w_={class:"text-base"},x_={},vu=i.defineComponent({...x_,__name:"contragent-with-short-info",props:{contragent:{}},setup(t){const e=t,n=i.computed(()=>ti.getFormatEntityName(e.contragent));return(r,o)=>(i.openBlock(),i.createElementBlock("span",w_,i.toDisplayString(n.value),1))}}),k_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function v_(t,e){return i.openBlock(),i.createElementBlock("svg",k_,[...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 C_=i.markRaw({name:"tabler-mail",render:v_}),S_=["href"],B_={},T_=i.defineComponent({...B_,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(t){return(e,n)=>{const r=C_;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,S_)],2)}}}),N_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function $_(t,e){return i.openBlock(),i.createElementBlock("svg",N_,[...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 Cu=i.markRaw({name:"fa6-brands-viber",render:$_}),R_={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},E_=["id"],P_=["id"],F_=["fill"],V_=["fill"];function M_(t,e){return i.openBlock(),i.createElementBlock("svg",R_,[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,E_),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,P_)]),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,F_),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,V_),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 Su=i.markRaw({name:"logos-whatsapp-icon",render:M_,setup(){const t=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+t(),SVGHW6lecxh:"uicons-"+t()}}}}),A_={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},I_=["id"],O_=["fill"];function z_(t,e){return i.openBlock(),i.createElementBlock("svg",A_,[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,I_)]),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,O_),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 Bu=i.markRaw({name:"logos-telegram",render:z_,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),D_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function L_(t,e){return i.openBlock(),i.createElementBlock("svg",D_,[...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 Tu=i.markRaw({name:"ion-call",render:L_}),H_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function W_(t,e){return i.openBlock(),i.createElementBlock("svg",H_,[...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 j_=i.markRaw({name:"tabler-phone-call",render:W_}),q_={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},X_=["href"],Y_=["href"],U_=["href"],K_=["href"],G_={},Z_=i.defineComponent({...G_,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(t){const e=t,n=i.computed(()=>{try{return e.phone?br.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=i.computed(()=>{var l;return D.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),o=i.computed(()=>{var l;return D.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=i.computed(()=>{var l;return D.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=j_,u=Tu,h=Bu,f=Su,m=Cu;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]=p=>a.value=!a.value),onFocusout:c[1]||(c[1]=p=>a.value=!1),onMouseleave:c[2]||(c[2]=p=>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",q_,[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,Y_)):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,U_)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${s.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[i.createVNode(m)],8,K_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),Q_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function J_(t,e){return i.openBlock(),i.createElementBlock("svg",Q_,[...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 ew=i.markRaw({name:"mdi-envelope",render:J_}),tw={class:"flex flex-col gap-1"},nw={key:0,class:"mb-2 flex flex-col text-base"},iw={key:0,class:"text-sc-dark-grey text-sm"},rw={key:1,class:"whitespace-nowrap text-sm"},ow={key:2,class:"whitespace-nowrap text-sm"},sw={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},aw=["href"],lw=["href"],cw=["href"],dw=["href"],uw=["href"],fw={key:0,class:"flex flex-col text-base"},hw={key:0,class:"text-sc-dark-grey text-sm"},mw={key:1,class:"mt-2 text-sm"},pw={key:0,class:"-mt-1"},gw={},yw=i.defineComponent({...gw,__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(()=>ti.getFormatEntityName(e.contact)),r=i.computed(()=>{try{return e.contact.phone?br.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),o=i.computed(()=>{var d;return D.isString(r.value)?!1:((d=r.value)==null?void 0:d.isValid())??!1}),s=i.computed(()=>{var d;return D.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("INTERNATIONAL"))??""}),a=i.computed(()=>{var d;return D.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("E.164"))??""}),l=i.computed(()=>o.value||e.contact.email),c=i.ref(!1);return(d,u)=>{var b,_;const h=Tu,f=Bu,m=Su,p=Cu,g=ew,y=z.NPopover;return i.openBlock(),i.createElementBlock("div",tw,[i.createVNode(y,{disabled:t.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var k,x,C,N;return[i.createElementVNode("div",{class:i.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(k=t.contact)!=null&&k.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${t.classes}`),style:i.normalizeStyle(t.styles),onMouseenter:u[0]||(u[0]=w=>c.value=!0),onFocusin:u[1]||(u[1]=w=>c.value=!0),onMouseleave:u[2]||(u[2]=w=>c.value=!1),onFocusout:u[3]||(u[3]=w=>c.value=!1)},[i.createElementVNode("div",null,[t.fullView&&(t.contact.name||(x=t.contact)!=null&&x.position)?(i.openBlock(),i.createElementBlock("div",nw,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),(C=t.contact)!=null&&C.position?(i.openBlock(),i.createElementBlock("span",iw,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",rw,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("div",ow,i.toDisplayString(t.contact.email),1)):i.createCommentVNode("",!0),l.value&&c.value?(i.openBlock(),i.createElementBlock("div",sw,[o.value?(i.openBlock(),i.createElementBlock("a",{key:0,href:`tel:${a.value}`,class:"text-blue-600 hover:text-3xl hover:text-blue-600"},[i.createVNode(h)],8,aw)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("a",{key:1,href:`https://t.me/${a.value}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(f)],8,lw)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${a.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(m)],8,cw)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${a.value}`,class:"text-purple-600 hover:text-3xl hover:text-purple-600"},[i.createVNode(p)],8,dw)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${t.contact.email}`,class:"hover:text-3xl"},[i.createVNode(g)],8,uw)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var k,x,C,N;return[t.contact.name?(i.openBlock(),i.createElementBlock("div",fw,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),(k=t.contact)!=null&&k.position?(i.openBlock(),i.createElementBlock("span",hw,i.toDisplayString((x=t.contact)==null?void 0:x.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),(C=t.contact)!=null&&C.comment?(i.openBlock(),i.createElementBlock("div",mw,[u[4]||(u[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",pw,[u[5]||(u[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((_=t.contact)==null?void 0:_.comment),1)])):i.createCommentVNode("",!0)])}}});class bw{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=hs.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=hs.objectToSnake(e.heightOverlaps),this.widthOverlaps=hs.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function _w(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.SandwichM2?!0:t.properties.configuratorSettings!==void 0&&D.isArray(t.products)&&t.products.length>0}const ww={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function xw(t,e){return i.openBlock(),i.createElementBlock("svg",ww,[...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 kw=i.markRaw({name:"mdi-dots-horizontal",render:xw}),Nu="date-range.dialog.mode",$u=["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],Ru=(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?He.startOfDay(r):void 0,to:o?He.endOfDay(o):void 0}},vw={class:"text-center font-semibold"},Cw={class:"grid grid-cols-3 gap-1"},Sw=["onPointerdown","onPointerenter","onKeydown"],Bw={},Tw=i.defineComponent({...Bw,__name:"month-range-grid",props:{from:{},to:{}},emits:["select"],setup(t,{emit:e}){const n=t,r=e,o=z.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 S=new Date().getFullYear();return w&&He.isValid(w)?w.getFullYear():S},l=i.ref(a(n.from??n.to)),c=it.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),m=i.ref(null),p=i.computed(()=>{const{from:w,to:S}=n;return!w||!S||!He.isSameDay(w,He.startOfMonth(w))||!He.isSameDay(S,He.endOfMonth(S))?null:[w.getFullYear()*12+w.getMonth(),S.getFullYear()*12+S.getMonth()]}),g=i.computed(()=>f.value&&h.value!==null&&m.value!==null?y(h.value,m.value):u.value!==null?m.value===null?[u.value,u.value]:y(u.value,m.value):p.value),y=(w,S)=>w<=S?[w,S]:[S,w],b=(w,S)=>{const v=w*12+S,$=g.value;return $&&v>=$[0]&&v<=$[1]?[v===$[0]||v===$[1]?"sc-month--bound":"sc-month--in-range"]:[]},_=(w,S)=>{const[v,$]=y(w,S);u.value=null,r("select",{from:new Date(Math.floor(v/12),v%12,1),to:He.endOfMonth(new Date(Math.floor($/12),$%12,1))})},k=w=>{u.value===null?(u.value=w,r("select",{from:new Date(Math.floor(w/12),w%12,1),to:He.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,m.value!==null&&_(w,m.value);return}k(w)}},C=(w,S)=>{h.value=w*12+S,f.value=!1,globalThis.addEventListener("pointerup",x)},N=(w,S)=>{const v=w*12+S;m.value=v,h.value!==null&&v!==h.value&&(f.value=!0)};return i.watch(()=>[n.from,n.to],()=>{const w=n.from??n.to;if(!w||!He.isValid(w))return;const S=w.getFullYear();(S<l.value-1||S>l.value+1)&&(l.value=S)}),i.onBeforeUnmount(()=>{globalThis.removeEventListener("pointerup",x)}),(w,S)=>{const v=z.NButton;return i.openBlock(),i.createElementBlock("div",{class:"flex select-none items-start gap-2",style:i.normalizeStyle(s.value),onPointerleave:S[2]||(S[2]=$=>m.value=null)},[i.createVNode(v,{size:"small",quaternary:"",class:"mt-5",onClick:S[0]||(S[0]=$=>l.value-=1)},{default:i.withCtx(()=>[...S[3]||(S[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,$=>(i.openBlock(),i.createElementBlock("div",{key:$,class:"flex flex-col gap-1"},[i.createElementVNode("div",vw,i.toDisplayString($),1),i.createElementVNode("div",Cw,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref($u),(E,A)=>(i.openBlock(),i.createElementBlock("button",{key:E,type:"button",class:i.normalizeClass(["sc-month cursor-pointer rounded border-0 px-1 py-1 text-sm",b($,A)]),onPointerdown:i.withModifiers(R=>C($,A),["prevent"]),onPointerenter:R=>N($,A),onKeydown:[i.withKeys(i.withModifiers(R=>k($*12+A),["prevent"]),["enter"]),i.withKeys(i.withModifiers(R=>k($*12+A),["prevent"]),["space"])]},i.toDisplayString(E),43,Sw))),128))])]))),128))],2),i.createVNode(v,{size:"small",quaternary:"",class:"mt-5",onClick:S[1]||(S[1]=$=>l.value+=1)},{default:i.withCtx(()=>[...S[4]||(S[4]=[i.createTextVNode(" › ",-1)])]),_:1})],36)}}}),Nw=An(Tw,[["__scopeId","data-v-7dd4941e"]]),$w={class:"sc-date-range-sidebar flex flex-col gap-1"},Rw={class:"flex items-center justify-center gap-1"},Ew={class:"min-w-12 text-center font-semibold"},Pw={class:"grid grid-flow-col grid-cols-2 grid-rows-6 gap-1"},Fw={},Vw=i.defineComponent({...Fw,__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=z.NButton;return i.openBlock(),i.createElementBlock("div",$w,[i.createElementVNode("div",Rw,[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",Ew,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",Pw,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref($u),(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})])}}}),Mw={},Eu=i.defineComponent({...Mw,__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=it.initRefDependingOnDeviceResolution(!0,!1,!1),s=i.ref(null),a=i.ref(!1),l=i.ref(0),c=i.ref(n.value&&He.isValid(n.value)?n.value:new Date),d=i.computed(()=>{const k=n.value&&He.isValid(n.value)?n.value:c.value;return k.getFullYear()===c.value.getFullYear()?k.getMonth():null});let u=0;const h=k=>{var x,C;(C=(x=k.target)==null?void 0:x.closest)!=null&&C.call(x,".n-base-clear")&&(u=performance.now())},f=k=>{k&&performance.now()-u<300||(a.value=k,k&&(c.value=n.value&&He.isValid(n.value)?n.value:new Date))},m=k=>{r("update:value",k===null?null:new Date(k))},p=(k,x)=>{const C=new Date(k,x,1);if(c.value=C,n.value&&He.isValid(n.value)){const N=Math.min(He.getDate(n.value),He.getDaysInMonth(C));r("update:value",new Date(k,x,N));return}l.value+=1,i.nextTick().then(()=>{var N;return(N=s.value)==null?void 0:N.focus()})},g=(k,x)=>{c.value=He.addYears(He.addMonths(c.value,k),x)},y=k=>{p(k,c.value.getMonth())},b=k=>{p(c.value.getFullYear(),k)},_=()=>{a.value=!1,r("update:value",new Date)};return(k,x)=>{const C=z.NButton,N=z.NDatePicker;return i.openBlock(),i.createBlock(N,{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":m,onNextMonth:x[0]||(x[0]=w=>g(1,0)),onPrevMonth:x[1]||(x[1]=w=>g(-1,0)),onNextYear:x[2]||(x[2]=w=>g(0,1)),onPrevYear:x[3]||(x[3]=w=>g(0,-1))},{footer:i.withCtx(()=>[i.unref(o)?(i.openBlock(),i.createBlock(C,{key:1,size:"small",text:"",type:"info",onClick:_},{default:i.withCtx(()=>[...x[4]||(x[4]=[i.createTextVNode(" Сегодня ",-1)])]),_:1})):(i.openBlock(),i.createBlock(Vw,{key:0,year:c.value.getFullYear(),month:d.value,"onUpdate:year":y,onSelectMonth:b,onToday:_},null,8,["year","month"]))]),_:1},8,["value","show","clearable","disabled","placeholder","format","default-calendar-start-time"])}}}),Aw={class:"@container"},Iw={class:"flex flex-col gap-1 @xs:flex-row @xs:items-center"},Ow={},Pu=i.defineComponent({...Ow,__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",Aw,[i.createElementVNode("div",Iw,[i.createVNode(Eu,{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(Eu,{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"])])])}}}),zw={class:"flex flex-col items-stretch gap-3 sm:flex-row"},Dw={class:"order-2 flex-1 rounded-lg border border-solid border-gray-200 p-2 shadow-sm"},Lw={class:"flex flex-col items-stretch pr-3"},Hw={key:0,class:"px-2 pb-0.5 pt-2 text-xs text-gray-400"},Ww={key:1,class:"order-2 w-44 shrink-0 rounded-lg border border-solid border-gray-200 p-1 shadow-sm"},jw={},qw=i.defineComponent({...jw,__name:"standard-periods",props:{activeKey:{},customPeriods:{}},emits:["apply","preview"],setup(t,{emit:e}){const n=t,r=e,o="custom",s=it.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 D.isEmpty(n.customPeriods)||h.push({key:o,value:o,label:"Пользовательские"}),h}),d=h=>Object.entries(h).map(([f,m])=>({value:f,label:m.label,item:m})),u=i.computed(()=>{if(l.value===o)return[{type:"group",key:o,children:d(n.customPeriods??{})}];const h=Object.entries(a).filter(([,m])=>m.group===l.value),f=Object.fromEntries(h);return l.value!=="other"?[{type:"group",key:l.value,children:d(f)}]:j.STANDARD_PERIOD_SECTIONS.map(m=>{const p=h.filter(([,g])=>g.section===m.key);return{type:"group",key:m.key,label:m.label,children:d(Object.fromEntries(p))}}).filter(m=>{var p;return(((p=m.children)==null?void 0:p.length)??0)>0})});return(h,f)=>{const m=z.NButton,p=z.NScrollbar,g=z.NSelect,y=z.NMenu;return i.openBlock(),i.createElementBlock("div",zw,[i.createElementVNode("div",Dw,[i.createVNode(p,{class:"max-h-96"},{default:i.withCtx(()=>[i.createElementVNode("div",Lw,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(u.value,b=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:b.key},[b.label?(i.openBlock(),i.createElementBlock("div",Hw,i.toDisplayString(b.label),1)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(b.children,_=>(i.openBlock(),i.createBlock(m,{key:_.value,size:"small",quaternary:"",type:_.value===t.activeKey?"primary":"default",class:"justify-start",onClick:k=>r("apply",_),onMouseenter:k=>r("preview",_),onMouseleave:f[0]||(f[0]=k=>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(g,{key:0,value:l.value,options:c.value,class:"order-1","onUpdate:value":f[1]||(f[1]=b=>l.value=b)},null,8,["value","options"])):(i.openBlock(),i.createElementBlock("div",Ww,[i.createVNode(y,{value:l.value,options:c.value,mode:"vertical","onUpdate:value":f[2]||(f[2]=b=>l.value=b)},null,8,["value","options"])]))])}}}),Xw={class:"flex flex-col gap-3"},Yw={class:"flex flex-col gap-1 sm:flex-row sm:items-center"},Uw={key:0,class:"overflow-x-auto rounded-lg border border-solid border-gray-200 p-2 shadow-sm sm:p-3"},Kw={class:"flex flex-col items-stretch justify-between gap-2 sm:flex-row sm:items-center"},Gw={class:"flex gap-2"},Zw={},Qw=i.defineComponent({...Zw,__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=it.initRefDependingOnDeviceResolution("100%","90%","44rem"),s=i.ref("custom"),a=()=>j.PreferencesStorageProvider.getActualDataFromStorage(Nu)==="standard"?"standard":"custom",l=i.ref({}),c=i.ref(null),d=i.ref(null),u=i.computed(()=>c.value??l.value),h=(x,C)=>{var S,v;const N=(S=n.disabled)!=null&&S.from?l.value.from:x,w=(v=n.disabled)!=null&&v.to?l.value.to:C;c.value=null,l.value=Ru(N,w,n.disabled)},f=x=>{d.value=null,h(x,l.value.to)},m=x=>{d.value=null,h(l.value.from,x)},p=()=>{d.value=null,h(null,null)},g=x=>{d.value=null,h(x.from,x.to)},y=x=>{const C=x.item;h(C.from,C.to),d.value=String(x.value)},b=x=>{const C=x==null?void 0:x.item;c.value=C?{from:C.from,to:C.to}:null},_=()=>{c.value=null,s.value=s.value==="custom"?"standard":"custom";const x=Nu;j.PreferencesStorageProvider.saveActualDataToStorage(x,s.value,He.addYears(He.startOfToday(),1))},k=()=>{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,C)=>{const N=z.NButton,w=z.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":C[1]||(C[1]=S=>r("update:show",S))},{footer:i.withCtx(()=>[i.createElementVNode("div",Kw,[i.createVNode(N,{text:"",type:"info",onClick:_},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(s.value==="custom"?"Показать стандартные периоды":"Показать произвольный период"),1)]),_:1}),i.createElementVNode("div",Gw,[i.createVNode(N,{type:"primary",onClick:k},{default:i.withCtx(()=>[...C[3]||(C[3]=[i.createTextVNode(" Выбрать ",-1)])]),_:1}),i.createVNode(N,{onClick:C[0]||(C[0]=S=>r("update:show",!1))},{default:i.withCtx(()=>[...C[4]||(C[4]=[i.createTextVNode("Отмена",-1)])]),_:1})])])]),default:i.withCtx(()=>[i.createElementVNode("div",Xw,[i.createElementVNode("div",Yw,[i.createVNode(Pu,{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":m},null,8,["from","to","clearable","disabled","date-format"]),t.clearable?(i.openBlock(),i.createBlock(N,{key:0,text:"",type:"info",class:"sm:ml-2",onClick:p},{default:i.withCtx(()=>[...C[2]||(C[2]=[i.createTextVNode(" Очистить период ",-1)])]),_:1})):i.createCommentVNode("",!0)]),s.value==="custom"?(i.openBlock(),i.createElementBlock("div",Uw,[i.createVNode(Nw,{from:l.value.from,to:l.value.to,onSelect:g},null,8,["from","to"])])):(i.openBlock(),i.createBlock(qw,{key:1,"active-key":d.value,"custom-periods":t.customPeriods,onApply:y,onPreview:b},null,8,["active-key","custom-periods"]))])]),_:1},8,["show","style"])}}}),Jw={class:"flex w-full min-w-28 items-center gap-1"},ex={},tx=i.defineComponent({...ex,__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 D.isEmpty(u)?void 0:u}),a=(u,h)=>{r("update:date-range",Ru(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 p,g,y,b;const f=kw,m=z.NButton;return i.openBlock(),i.createElementBlock("div",Jw,[i.createVNode(Pu,{from:(p=t.dateRange)==null?void 0:p.from,to:(g=t.dateRange)==null?void 0:g.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(m,{disabled:!!((y=t.disabled)!=null&&y.from&&((b=t.disabled)!=null&&b.to)),title:"Выбрать период","aria-label":"Выбрать период",onClick:h[0]||(h[0]=_=>o.value=!0)},{default:i.withCtx(()=>[i.createVNode(f)]),_:1},8,["disabled"]),i.createVNode(Qw,{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"])])}}}),nx={class:"sc-lbl-date text-nowrap"},ix={},Lo=i.defineComponent({...ix,__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(()=>He.format(e.date,j.useBaseConfigStateStore().config.dateFormats.uiDate)),r=i.computed(()=>He.format(e.date,"HH:mm"));return(o,s)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-col":t.isTimeOnSecondLine})},[i.createElementVNode("span",nx,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))}}),rx={},ox=i.defineComponent({...rx,__name:"debt",props:{debt:{default:0},showLabel:{type:Boolean,default:!1},wrapAsSmall:{type:Boolean,default:!1}},setup(t){const e=t,n=i.computed(()=>{let r="";return(e.showLabel??!1)&&(e.debt>0?r="Переплата: ":e.debt<0&&(r="Задолженность: ")),r});return(r,o)=>t.debt!==0?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass({"text-sm":t.wrapAsSmall})},[i.createTextVNode(i.toDisplayString(n.value)+" ",1),i.createElementVNode("span",{class:i.normalizeClass({"text-green-700":t.debt>0,"text-red-700":t.debt<0})},i.toDisplayString(t.debt)+" ₽ ",3)],2)):i.createCommentVNode("",!0)}}),sx={class:"flex flex-row gap-2.5"},ax={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},lx={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},cx={class:"mb-0.5 sm:mb-0 sm:ml-3"},dx={},ux=i.defineComponent({...dx,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(t){return(e,n)=>{const r=Do,o=z.NButton,s=z.NPopover;return i.openBlock(),i.createElementBlock("div",sx,[i.createElementVNode("div",ax,[i.renderSlot(e.$slots,"main")]),i.createElementVNode("div",null,[i.createElementVNode("div",lx,[i.renderSlot(e.$slots,"extra-buttons"),i.createElementVNode("div",cx,[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)])])])])}}}),fx={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function hx(t,e){return i.openBlock(),i.createElementBlock("svg",fx,[...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 mx=i.markRaw({name:"ion-checkmark-done-sharp",render:hx}),px={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function gx(t,e){return i.openBlock(),i.createElementBlock("svg",px,[...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 yx=i.markRaw({name:"ion-options-outline",render:gx}),bx={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},_x={class:"flex-auto"},wx={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"},xx={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"},kx={},pa=i.defineComponent({...kx,__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=yx,h=z.NButton,f=z.NPopover,m=mx,p=Do;return i.openBlock(),i.createElementBlock("div",bx,[i.createElementVNode("div",_x,[i.renderSlot(c.$slots,"default")]),i.createElementVNode("div",null,[i.createElementVNode("div",wx,[i.createElementVNode("div",xx,[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(m)]),_: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(p)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[2]||(d[2]=i.createTextVNode(" Отменить изменения ",-1))]),_:1})):i.createCommentVNode("",!0)]),i.renderSlot(c.$slots,"extra-buttons")])])])}}}),vx={},Fu=i.defineComponent({...vx,__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(pa,{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(pa,{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"]))]))}}),Cx={key:0,class:"whitespace-pre-line"},Sx={key:1,class:"text-sc-dark-grey"},Bx={},Tx=i.defineComponent({...Bx,__name:"comment-editor",props:{disabled:{type:Boolean,default:!1},comment:{default:""}},emits:["update:comment"],setup(t,{emit:e}){const n=t,r=e,o=i.ref(n.comment);i.watch(()=>o.value,l=>{o.value=l});const s=l=>{r("update:comment",o.value,l)},a=()=>{o.value=n.comment};return(l,c)=>{const d=z.NInput;return i.openBlock(),i.createBlock(Fu,{disabled:t.disabled,"onEditor:apply":s,"onEditor:cancel":a},{viewer:i.withCtx(()=>[i.createElementVNode("div",null,[t.comment?(i.openBlock(),i.createElementBlock("span",Cx,i.toDisplayString(t.comment),1)):(i.openBlock(),i.createElementBlock("span",Sx," - Комментарий отсутствует - "))])]),editor:i.withCtx(()=>[i.createVNode(d,{value:o.value,"onUpdate:value":c[0]||(c[0]=u=>o.value=u),clearable:!0,type:"textarea"},null,8,["value"])]),_:1},8,["disabled"])}}}),Nx={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function $x(t,e){return i.openBlock(),i.createElementBlock("svg",Nx,[...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 Rx=i.markRaw({name:"ion-download-outline",render:$x}),Ex={},Px=i.defineComponent({...Ex,__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=Rx;return i.openBlock(),i.createBlock(i.unref(z.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(z.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"])}}}),Fx={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Vx(t,e){return i.openBlock(),i.createElementBlock("svg",Fx,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0 0 80 446.25h340.89a32 32 0 0 0 28.18-47.17m-198.6-1.83a20 20 0 1 1 20-20a20 20 0 0 1-20 20m21.72-201.15l-5.74 122a16 16 0 0 1-32 0l-5.74-121.95a21.73 21.73 0 0 1 21.5-22.69h.21a21.74 21.74 0 0 1 21.73 22.7Z"},null,-1)])])}const Mx=i.markRaw({name:"ion-warning",render:Vx}),Ax={},Ix=i.defineComponent({...Ax,__name:"warning-icon",props:{popoverText:{default:""},iconClass:{default:"text-sc-warning"}},setup(t){return(e,n)=>{const r=Mx,o=z.NPopover;return i.openBlock(),i.createBlock(o,{disabled:t.popoverText.length===0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(r,{class:i.normalizeClass(`ml-0.5 ${t.iconClass}`)},null,8,["class"])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.popoverText),1)]),_:1},8,["disabled"])}}}),Ox={},zx=i.defineComponent({...Ox,__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=D.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(z.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"]))}}),Dx={},Lx=i.defineComponent({...Dx,__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=D.debounce(()=>o("update:value",s.value),a.value),c=m=>{s.value=m,l()};i.watch(()=>r.value,m=>{s.value=m});const d=i.ref(null);return e({focus:()=>{var m;return(m=d.value)==null?void 0:m.focus()},blur:()=>{var m;return(m=d.value)==null?void 0:m.blur()},select:()=>{var m;return(m=d.value)==null?void 0:m.select()}}),(m,p)=>(i.openBlock(),i.createBlock(i.unref(z.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:p[0]||(p[0]=g=>o("keydown",g)),onInput:p[1]||(p[1]=g=>o("input",g)),onFocus:p[2]||(p[2]=g=>o("focus",g))},{prefix:i.withCtx(()=>[i.renderSlot(m.$slots,"prefix")]),_:3},8,["value","clearable","parse","show-button","placeholder","min","max","step","validator"]))}}),Hx={},Wx=i.defineComponent({...Hx,__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=D.debounce(c=>r("update:value",c),n.debounceTime??0),a=c=>{let d="";if(D.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(D.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof br.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=br.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof br.ParseError)o.value=d;else throw u}};return 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(Lh.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"]))}}),jx=An(Wx,[["__scopeId","data-v-751dbb0e"]]),qx={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Xx(t,e){return i.openBlock(),i.createElementBlock("svg",qx,[...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 Yx=i.markRaw({name:"tabler-external-link",render:Xx}),Ux={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},Kx=["href"],Gx={},Zx=i.defineComponent({...Gx,__name:"external-link",props:{text:{},url:{},description:{}},setup(t){return(e,n)=>{const r=Yx,o=z.NTooltip;return i.openBlock(),i.createBlock(o,{disabled:i.unref(D.isUndefined)(t.description),placement:"top-start"},{trigger:i.withCtx(()=>[i.createElementVNode("span",Ux,[i.createElementVNode("a",{href:t.url,target:"_blank",class:"no-underline"},i.toDisplayString(t.text),9,Kx),i.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.description),1)]),_:1},8,["disabled"])}}}),Qx={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Jx(t,e){return i.openBlock(),i.createElementBlock("svg",Qx,[...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 ek=i.markRaw({name:"ion-remove-circle-outline",render:Jx});let Ho=[];const Vu=new WeakMap;function tk(){Ho.forEach(t=>t(...Vu.get(t))),Ho=[]}function Mu(t,...e){Vu.set(t,e),!Ho.includes(t)&&Ho.push(t)===1&&requestAnimationFrame(tk)}function Pr(t,e){let{target:n}=t;for(;n;){if(n.dataset&&n.dataset[e]!==void 0)return!0;n=n.parentElement}return!1}function Fr(t){return t.composedPath()[0]||null}function Vr(t){return typeof t=="string"?t.endsWith("px")?Number(t.slice(0,t.length-2)):Number(t):t}function Mr(t){if(t!=null)return typeof t=="number"?`${t}px`:t.endsWith("px")?t:`${t}px`}function fn(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 Au={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 nk(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 ik(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 Nn="^\\s*",$n="\\s*$",ai="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Kt="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",Ci="([0-9A-Fa-f])",Si="([0-9A-Fa-f]{2})",Iu=new RegExp(`${Nn}hsl\\s*\\(${Kt},${ai},${ai}\\)${$n}`),Ou=new RegExp(`${Nn}hsv\\s*\\(${Kt},${ai},${ai}\\)${$n}`),zu=new RegExp(`${Nn}hsla\\s*\\(${Kt},${ai},${ai},${Kt}\\)${$n}`),Du=new RegExp(`${Nn}hsva\\s*\\(${Kt},${ai},${ai},${Kt}\\)${$n}`),rk=new RegExp(`${Nn}rgb\\s*\\(${Kt},${Kt},${Kt}\\)${$n}`),ok=new RegExp(`${Nn}rgba\\s*\\(${Kt},${Kt},${Kt},${Kt}\\)${$n}`),sk=new RegExp(`${Nn}#${Ci}${Ci}${Ci}${$n}`),ak=new RegExp(`${Nn}#${Si}${Si}${Si}${$n}`),lk=new RegExp(`${Nn}#${Ci}${Ci}${Ci}${Ci}${$n}`),ck=new RegExp(`${Nn}#${Si}${Si}${Si}${Si}${$n}`);function qt(t){return parseInt(t,16)}function dk(t){try{let e;if(e=zu.exec(t))return[jo(e[1]),li(e[5]),li(e[9]),Ti(e[13])];if(e=Iu.exec(t))return[jo(e[1]),li(e[5]),li(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${t}.`)}catch(e){throw e}}function uk(t){try{let e;if(e=Du.exec(t))return[jo(e[1]),li(e[5]),li(e[9]),Ti(e[13])];if(e=Ou.exec(t))return[jo(e[1]),li(e[5]),li(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${t}.`)}catch(e){throw e}}function Bi(t){try{let e;if(e=ak.exec(t))return[qt(e[1]),qt(e[2]),qt(e[3]),1];if(e=rk.exec(t))return[Ct(e[1]),Ct(e[5]),Ct(e[9]),1];if(e=ok.exec(t))return[Ct(e[1]),Ct(e[5]),Ct(e[9]),Ti(e[13])];if(e=sk.exec(t))return[qt(e[1]+e[1]),qt(e[2]+e[2]),qt(e[3]+e[3]),1];if(e=ck.exec(t))return[qt(e[1]),qt(e[2]),qt(e[3]),Ti(qt(e[4])/255)];if(e=lk.exec(t))return[qt(e[1]+e[1]),qt(e[2]+e[2]),qt(e[3]+e[3]),Ti(qt(e[4]+e[4])/255)];if(t in Au)return Bi(Au[t]);if(Iu.test(t)||zu.test(t)){const[n,r,o,s]=dk(t);return[...ik(n,r,o),s]}else if(Ou.test(t)||Du.test(t)){const[n,r,o,s]=uk(t);return[...nk(n,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${t}.`)}catch(e){throw e}}function fk(t){return t>1?1:t<0?0:t}function ga(t,e,n,r){return`rgba(${Ct(t)}, ${Ct(e)}, ${Ct(n)}, ${fk(r)})`}function ya(t,e,n,r,o){return Ct((t*e*(1-r)+n*r)/o)}function hk(t,e){Array.isArray(t)||(t=Bi(t)),Array.isArray(e)||(e=Bi(e));const n=t[3],r=e[3],o=Ti(n+r-n*r);return ga(ya(t[0],n,e[0],r,o),ya(t[1],n,e[1],r,o),ya(t[2],n,e[2],r,o),o)}function ze(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:Bi(t);return typeof e.alpha=="number"?ga(n,r,o,e.alpha):ga(n,r,o,s)}function Wo(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:Bi(t),{lightness:a=1,alpha:l=1}=e;return mk([n*a,r*a,o*a,s*l])}function Ti(t){const e=Math.round(Number(t)*100)/100;return e>1?1:e<0?0:e}function jo(t){const e=Math.round(Number(t));return e>=360||e<0?0:e}function Ct(t){const e=Math.round(Number(t));return e>255?255:e<0?0:e}function li(t){const e=Math.round(Number(t));return e>100?100:e<0?0:e}function mk(t){const[e,n,r]=t;return 3 in t?`rgba(${Ct(e)}, ${Ct(n)}, ${Ct(r)}, ${Ti(t[3])})`:`rgba(${Ct(e)}, ${Ct(n)}, ${Ct(r)}, 1)`}function pk(t=8){return Math.random().toString(16).slice(2,2+t)}function Lu(t){return Array.isArray(t)?t:[t]}const ba={STOP:"STOP"};function Hu(t,e){const n=e(t);t.children!==void 0&&n!==ba.STOP&&t.children.forEach(r=>Hu(r,e))}function gk(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 yk(t,e){const{isLeaf:n}=t;return n!==void 0?n:!e(t)}function bk(t){return t.children}function _k(t){return t.key}function wk(){return!1}function xk(t,e){const{isLeaf:n}=t;return!(n===!1&&!Array.isArray(e(t)))}function kk(t){return t.disabled===!0}function vk(t,e){return t.isLeaf===!1&&!Array.isArray(e(t))}function Ck(t,e){if(t.isLeaf===!0){const n=e(t);if(Array.isArray(n)&&n.length>0)return!0}return!1}function _a(t){var e;return t==null?[]:Array.isArray(t)?t:(e=t.checkedKeys)!==null&&e!==void 0?e:[]}function wa(t){var e;return t==null||Array.isArray(t)?[]:(e=t.indeterminateKeys)!==null&&e!==void 0?e:[]}function Sk(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)||n.add(r)}),Array.from(n)}function Bk(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)&&n.delete(r)}),Array.from(n)}function Tk(t){return(t==null?void 0:t.type)==="group"}function Nk(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 $k extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function Rk(t,e,n,r){return qo(e.concat(t),n,r,!1)}function Ek(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 Pk(t,e,n,r){const o=qo(e,n,r,!1),s=qo(t,n,r,!0),a=Ek(t,n),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function xa(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:Sk(n,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:Bk(n,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(n),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let h;o!==void 0?h=Pk(o,n,e,d):r!==void 0?h=Rk(r,n,e,d):h=qo(n,e,d,!1);const f=c==="parent",m=c==="child"||l,p=h,g=new Set,y=Math.max.apply(null,Array.from(u.keys()));for(let b=y;b>=0;b-=1){const _=b===0,k=u.get(b);for(const x of k){if(x.isLeaf)continue;const{key:C,shallowLoaded:N}=x;if(m&&N&&x.children.forEach($=>{!$.disabled&&!$.isLeaf&&$.shallowLoaded&&p.has($.key)&&p.delete($.key)}),x.disabled||!N)continue;let w=!0,S=!1,v=!0;for(const $ of x.children){const E=$.key;if(!$.disabled){if(v&&(v=!1),p.has(E))S=!0;else if(g.has(E)){S=!0,w=!1;break}else if(w=!1,S)break}}w&&!v?(f&&x.children.forEach($=>{!$.disabled&&p.has($.key)&&p.delete($.key)}),p.add(C)):S&&g.add(C),_&&m&&p.has(C)&&p.delete(C)}}return{checkedKeys:Array.from(p),indeterminateKeys:Array.from(g)}}function qo(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&&Hu(d,u=>{if(u.disabled)return ba.STOP;const{key:h}=u;if(!a.has(h)&&(a.add(h),l.add(h),vk(u.rawNode,s))){if(r)return ba.STOP;if(!n)throw new $k}})}),l}function Fk(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 Vk(t){if(t.length===0)return null;const e=t[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function Mk(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 Wu(t,e,{loop:n=!1,includeDisabled:r=!1}={}){const o=e==="prev"?Ak:Mk,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=ka(d,s);u!==null?l=u:c(o(d,n))}else{const u=o(d,!1);if(u!==null)c(u);else{const h=Ik(d);h!=null&&h.isGroup?c(o(h,n)):n&&c(o(d,!0))}}}}return c(t),l}function Ak(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 Ik(t){return t.parent}function ka(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=ka(d,e);if(u!==null)return u}else return d}}return null}const Ok={getChild(){return this.ignored?null:ka(this)},getParent(){const{parent:t}=this;return t!=null&&t.isGroup?t.getParent():t},getNext(t={}){return Wu(this,"next",t)},getPrev(t={}){return Wu(this,"prev",t)}};function zk(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 Dk(t,e){const n=t.key;for(;e;){if(e.key===n)return!0;e=e.parent}return!1}var Lk={};function ju(t,e,n,r,o,s=null,a=0){const l=[];return t.forEach((c,d)=>{var u;Lk.NODE_ENV!=="production"&&Ck(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=ju(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 Hk(t,e={}){var n;const r=new Map,o=new Map,{getDisabled:s=kk,getIgnored:a=wk,getIsGroup:l=Tk,getKey:c=_k}=e,d=(n=e.getChildren)!==null&&n!==void 0?n:bk,u=e.ignoreEmptyChildren?x=>{const C=d(x);return Array.isArray(C)?C.length?C:null:C}: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 yk(this.rawNode,u)},get shallowLoaded(){return xk(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(x){return Dk(this,x)}},Ok),f=ju(t,r,o,h,u);function m(x){if(x==null)return null;const C=r.get(x);return C&&!C.isGroup&&!C.ignored?C:null}function p(x){if(x==null)return null;const C=r.get(x);return C&&!C.ignored?C:null}function g(x,C){const N=p(x);return N?N.getPrev(C):null}function y(x,C){const N=p(x);return N?N.getNext(C):null}function b(x){const C=p(x);return C?C.getParent():null}function _(x){const C=p(x);return C?C.getChild():null}const k={treeNodes:f,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(x){return zk(f,x)},getNode:m,getPrev:g,getNext:y,getParent:b,getChild:_,getFirstAvailableNode(){return Vk(f)},getPath(x,C={}){return Fk(x,C,k)},getCheckedKeys(x,C={}){const{cascade:N=!0,leafOnly:w=!1,checkStrategy:S="all",allowNotLoaded:v=!1}=C;return xa({checkedKeys:_a(x),indeterminateKeys:wa(x),cascade:N,leafOnly:w,checkStrategy:S,allowNotLoaded:v},k)},check(x,C,N={}){const{cascade:w=!0,leafOnly:S=!1,checkStrategy:v="all",allowNotLoaded:$=!1}=N;return xa({checkedKeys:_a(C),indeterminateKeys:wa(C),keysToCheck:x==null?[]:Lu(x),cascade:w,leafOnly:S,checkStrategy:v,allowNotLoaded:$},k)},uncheck(x,C,N={}){const{cascade:w=!0,leafOnly:S=!1,checkStrategy:v="all",allowNotLoaded:$=!1}=N;return xa({checkedKeys:_a(C),indeterminateKeys:wa(C),keysToUncheck:x==null?[]:Lu(x),cascade:w,leafOnly:S,checkStrategy:v,allowNotLoaded:$},k)},getNonLeafKeys(x={}){return gk(f,x)}};return k}function Xo(t){return t.composedPath()[0]}const Wk={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function jk(t,e,n){if(t==="mousemoveoutside"){const r=o=>{e.contains(Xo(o))||n(o)};return{mousemove:r,touchstart:r}}else if(t==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(Xo(a))},s=a=>{r&&(e.contains(Xo(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 qu(t,e,n){const r=Wk[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=jk(t,e,n)),s}function qk(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=qu(t,e,n);return Object.keys(o).forEach(s=>{Mt(s,document,o[s],r)}),!0}return!1}function Xk(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=qu(t,e,n);return Object.keys(o).forEach(s=>{ft(s,document,o[s],r)}),!0}return!1}function Yk(){if(typeof window>"u")return{on:()=>{},off:()=>{}};const t=new WeakMap,e=new WeakMap;function n(){t.set(this,!0)}function r(){t.set(this,!0),e.set(this,!0)}function o(w,S,v){const $=w[S];return w[S]=function(){return v.apply(w,arguments),$.apply(w,arguments)},w}function s(w,S){w[S]=Event.prototype[S]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var w;return(w=a.get(this))!==null&&w!==void 0?w:null}function d(w,S){l!==void 0&&Object.defineProperty(w,"currentTarget",{configurable:!0,enumerable:!0,get:S??l.get})}const u={bubble:{},capture:{}},h={};function f(){const w=function(S){const{type:v,eventPhase:$,bubbles:E}=S,A=Xo(S);if($===2)return;const R=$===1?"capture":"bubble";let F=A;const H=[];for(;F===null&&(F=window),H.push(F),F!==window;)F=F.parentNode||null;const Q=u.capture[v],Z=u.bubble[v];if(o(S,"stopPropagation",n),o(S,"stopImmediatePropagation",r),d(S,c),R==="capture"){if(Q===void 0)return;for(let O=H.length-1;O>=0&&!t.has(S);--O){const P=H[O],V=Q.get(P);if(V!==void 0){a.set(S,P);for(const M of V){if(e.has(S))break;M(S)}}if(O===0&&!E&&Z!==void 0){const M=Z.get(P);if(M!==void 0)for(const L of M){if(e.has(S))break;L(S)}}}}else if(R==="bubble"){if(Z===void 0)return;for(let O=0;O<H.length&&!t.has(S);++O){const P=H[O],V=Z.get(P);if(V!==void 0){a.set(S,P);for(const M of V){if(e.has(S))break;M(S)}}}}s(S,"stopPropagation"),s(S,"stopImmediatePropagation"),d(S)};return w.displayName="evtdUnifiedHandler",w}function m(){const w=function(S){const{type:v,eventPhase:$}=S;if($!==2)return;const E=h[v];E!==void 0&&E.forEach(A=>A(S))};return w.displayName="evtdUnifiedWindowEventHandler",w}const p=f(),g=m();function y(w,S){const v=u[w];return v[S]===void 0&&(v[S]=new Map,window.addEventListener(S,p,w==="capture")),v[S]}function b(w){return h[w]===void 0&&(h[w]=new Set,window.addEventListener(w,g)),h[w]}function _(w,S){let v=w.get(S);return v===void 0&&w.set(S,v=new Set),v}function k(w,S,v,$){const E=u[S][v];if(E!==void 0){const A=E.get(w);if(A!==void 0&&A.has($))return!0}return!1}function x(w,S){const v=h[w];return!!(v!==void 0&&v.has(S))}function C(w,S,v,$){let E;if(typeof $=="object"&&$.once===!0?E=Q=>{N(w,S,E,$),v(Q)}:E=v,qk(w,S,E,$))return;const R=$===!0||typeof $=="object"&&$.capture===!0?"capture":"bubble",F=y(R,w),H=_(F,S);if(H.has(E)||H.add(E),S===window){const Q=b(w);Q.has(E)||Q.add(E)}}function N(w,S,v,$){if(Xk(w,S,v,$))return;const A=$===!0||typeof $=="object"&&$.capture===!0,R=A?"capture":"bubble",F=y(R,w),H=_(F,S);if(S===window&&!k(S,A?"bubble":"capture",w,v)&&x(w,v)){const Z=h[w];Z.delete(v),Z.size===0&&(window.removeEventListener(w,g),h[w]=void 0)}H.has(v)&&H.delete(v),H.size===0&&F.delete(S),F.size===0&&(window.removeEventListener(w,p,R==="capture"),u[R][w]=void 0)}return{on:C,off:N}}const{on:Mt,off:ft}=Yk(),lr="@@mmoContext",Uk={mounted(t,{value:e}){t[lr]={handler:void 0},typeof e=="function"&&(t[lr].handler=e,Mt("mousemoveoutside",t,e))},updated(t,{value:e}){const n=t[lr];typeof e=="function"?n.handler?n.handler!==e&&(ft("mousemoveoutside",t,n.handler),n.handler=e,Mt("mousemoveoutside",t,e)):(t[lr].handler=e,Mt("mousemoveoutside",t,e)):n.handler&&(ft("mousemoveoutside",t,n.handler),n.handler=void 0)},unmounted(t){const{handler:e}=t[lr];e&&ft("mousemoveoutside",t,e),t[lr].handler=void 0}},cr="@@coContext",Yo={mounted(t,{value:e,modifiers:n}){t[cr]={handler:void 0},typeof e=="function"&&(t[cr].handler=e,Mt("clickoutside",t,e,{capture:n.capture}))},updated(t,{value:e,modifiers:n}){const r=t[cr];typeof e=="function"?r.handler?r.handler!==e&&(ft("clickoutside",t,r.handler,{capture:n.capture}),r.handler=e,Mt("clickoutside",t,e,{capture:n.capture})):(t[cr].handler=e,Mt("clickoutside",t,e,{capture:n.capture})):r.handler&&(ft("clickoutside",t,r.handler,{capture:n.capture}),r.handler=void 0)},unmounted(t,{modifiers:e}){const{handler:n}=t[cr];n&&ft("clickoutside",t,n,{capture:e.capture}),t[cr].handler=void 0}};function Kk(t,e){console.error(`[vdirs/${t}]: ${e}`)}class Gk{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&&Kk("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 va=new Gk,dr="@@ziContext",Xu={mounted(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n;t[dr]={enabled:!!o,initialized:!1},o&&(va.ensureZIndex(t,r),t[dr].initialized=!0)},updated(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n,s=t[dr].enabled;o&&!s&&(va.ensureZIndex(t,r),t[dr].initialized=!0),t[dr].enabled=!!o},unmounted(t,e){if(!t[dr].initialized)return;const{value:n={}}=e,{zIndex:r}=n;va.unregister(t,r)}};function Zk(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 rn(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 Qk=typeof window<"u";let ur,Ar;(()=>{var t,e;ur=Qk?(e=(t=document)===null||t===void 0?void 0:t.fonts)===null||e===void 0?void 0:e.ready:void 0,Ar=!1,ur!==void 0?ur.then(()=>{Ar=!0}):Ar=!0})();function Jk(t){if(Ar)return;let e=!1;i.onMounted(()=>{Ar||ur==null||ur.then(()=>{e||t()})}),i.onBeforeUnmount(()=>{e=!0})}function Ca(t,e){return i.watch(t,n=>{n!==void 0&&(e.value=n)}),i.computed(()=>t.value===void 0?e.value:t.value)}function Uo(){const t=i.ref(!1);return i.onMounted(()=>{t.value=!0}),i.readonly(t)}function Yu(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 ev=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function tv(){return ev}function Sa(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);return r()}function Ba(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)){Ba(r,e,n);return}if(r.type===i.Fragment){if(r.children===null)return;Array.isArray(r.children)&&Ba(r.children,e,n)}else r.type!==i.Comment&&n.push(r)}}),n}function Uu(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);const o=Ba(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${t}]: slot[${n}] should have exactly one child.`)}let ci=null;function Ku(){if(ci===null&&(ci=document.getElementById("v-binder-view-measurer"),ci===null)){ci=document.createElement("div"),ci.id="v-binder-view-measurer";const{style:t}=ci;t.position="fixed",t.left="0",t.right="0",t.top="0",t.bottom="0",t.pointerEvents="none",t.visibility="hidden",document.body.appendChild(ci)}return ci.getBoundingClientRect()}function nv(t,e){const n=Ku();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=Ku();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 iv(t){return t.nodeType===9?null:t.parentNode}function Gu(t){if(t===null)return null;const e=iv(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 Gu(e)}const Zu=i.defineComponent({name:"Binder",props:{syncTargetWithParent:Boolean,syncTarget:{type:Boolean,default:!0}},setup(t){var e;i.provide("VBinder",(e=i.getCurrentInstance())===null||e===void 0?void 0:e.proxy);const n=i.inject("VBinder",null),r=i.ref(null),o=b=>{r.value=b,n&&t.syncTargetWithParent&&n.setTargetRef(b)};let s=[];const a=()=>{let b=r.value;for(;b=Gu(b),b!==null;)s.push(b);for(const _ of s)Mt("scroll",_,h,!0)},l=()=>{for(const b of s)ft("scroll",b,h,!0);s=[]},c=new Set,d=b=>{c.size===0&&a(),c.has(b)||c.add(b)},u=b=>{c.has(b)&&c.delete(b),c.size===0&&l()},h=()=>{Mu(f)},f=()=>{c.forEach(b=>b())},m=new Set,p=b=>{m.size===0&&Mt("resize",window,y),m.has(b)||m.add(b)},g=b=>{m.has(b)&&m.delete(b),m.size===0&&ft("resize",window,y)},y=()=>{m.forEach(b=>b())};return i.onBeforeUnmount(()=>{ft("resize",window,y),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:p,removeResizeListener:g}},render(){return Sa("binder",this.$slots)}}),Qu=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(Uu("follower",this.$slots),[[e]]):Uu("follower",this.$slots)}}),rv="@css-render/vue3-ssr";function ov(t,e){return`<style cssr-id="${t}">
|
|
104
104
|
${e}
|
|
105
105
|
</style>`}function sv(t,e,n){const{styles:r,ids:o}=n;o.has(t)||r!==null&&(o.add(t),r.push(ov(t,e)))}const av=typeof document<"u";function Ni(){if(av)return;const t=i.inject(rv,null);if(t!==null)return{adapter:(e,n)=>sv(e,n,t),context:t}}function Ju(t,e){console.error(`[vueuc/${t}]: ${e}`)}function lv(t){let e=0;for(let n=0;n<t.length;++n)t[n]==="&"&&++e;return e}const ef=/\s*,(?![^(]*\))\s*/g,cv=/\s+/g;function dv(t,e){const n=[];return e.split(ef).forEach(r=>{let o=lv(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 uv(t,e){const n=[];return e.split(ef).forEach(r=>{t.forEach(o=>{n.push((o&&o+" ")+r)})}),n}function fv(t){let e=[""];return t.forEach(n=>{n=n&&n.trim(),n&&(n.includes("&")?e=dv(e,n):e=uv(e,n))}),e.join(", ").replace(cv," ")}function tf(t){if(!t)return;const e=t.parentElement;e&&e.removeChild(t)}function Ko(t,e){return(e??document.head).querySelector(`style[cssr-id="${t}"]`)}function hv(t){const e=document.createElement("style");return e.setAttribute("cssr-id",t),e}function Go(t){return t?/^\s*@(s|m)/.test(t):!1}const mv=/[A-Z]/g;function nf(t){return t.replace(mv,e=>"-"+e.toLowerCase())}function pv(t,e=" "){return typeof t=="object"&&t!==null?` {
|
|
106
106
|
`+Object.entries(t).map(n=>e+` ${nf(n[0])}: ${n[1]};`).join(`
|