@snabcentr/vue-ui-lib 4.13.1 → 4.13.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 +1 -1
- package/dist/sc-vue-ui-lib.js +12 -10
- 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/dialogs/add-product-to-cart-dialog.vue.d.ts +2 -2
- package/dist/src/components/dialog/base-dialog.vue.d.ts +1 -1
- package/package.json +1 -1
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
}
|
|
101
101
|
gl_FragColor = texel;
|
|
102
102
|
}
|
|
103
|
-
`}},lo=Wi.Multiply,Sp=[1,0,0,0,1,0,0,0,1],Zn=new hn(9),Bp=bt.Utils,Pc=new re,Ns=new hn([0,0,1,0,0,1,0,1,1,0,1,1]),xe={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Ye.document?Ye.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new Wi,group:{removeChild:function(t,e){if(t.children)for(let n=0;n<t.children.length;n++)xe.group.removeChild(t.children[n],e);t._renderer.texture&&(e.deleteTexture(t._renderer.texture),delete t._renderer.texture),t._renderer.positionBuffer&&(e.deleteBuffer(t._renderer.positionBuffer),delete t._renderer.positionBuffer)},render:function(t,e){if(!this._visible)return;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.parent,r=n._matrix&&n._matrix.manual||n._flagMatrix,o=this._matrix.manual||this._flagMatrix;if((r||o)&&(this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Zn),lo(Zn,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=bt.Utils.getRendererType(this._mask._renderer.type);xe[a].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}this._flagOpacity=n._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);let s;if(this._flagSubtractions)for(s=0;s<this.subtractions.length;s++)xe.group.removeChild(this.subtractions[s],t);for(s=0;s<this.children.length;s++){const a=this.children[s],l=bt.Utils.getRendererType(a._renderer.type);xe[l].render.call(a,t,e)}return this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(t,e){let n,r,o,s,a,l,c,d,u,f,m,g,h,p;const y=e._renderer.vertices,b=this.canvas,_=this.ctx,v=t.renderer.ratio,x=Pc.copy(e._renderer.scale).multiply(v),N=e._stroke,T=e._linewidth,k=e._fill,$=e._renderer.opacity||e._opacity,w=e._cap,B=e._join,E=e._miter,M=e._closed,R=e.dashes,O=y.length,W=O-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 G=e._renderer.rect.centroid,Q=G.x,H=G.y;if(_.clearRect(0,0,b.width,b.height),k)if(typeof k=="string")_.fillStyle=k;else{const Y=bt.Utils.getRendererType(k._renderer.type);xe[Y].render.call(k,_,e),_.fillStyle=k._renderer.effect}if(N){if(typeof N=="string")_.strokeStyle=N;else{const Y=bt.Utils.getRendererType(N._renderer.type);xe[Y].render.call(N,_,e),_.strokeStyle=N._renderer.effect}T&&(_.lineWidth=fn(e)),E&&(_.miterLimit=E),B&&(_.lineJoin=B),!M&&w&&(_.lineCap=w)}typeof $=="number"&&(_.globalAlpha=$),R&&R.length>0&&(_.lineDashOffset=R.offset||0,_.setLineDash(R));let P,D,A,L,U,K,V,q;_.save(),_.scale(x.x,x.y),_.translate(Q,H),_.beginPath();for(let Y=0;Y<y.length;Y++){const te=y[Y];switch(g=te.x,h=te.y,te.command){case oe.close:_.closePath();break;case oe.arc:D=te.rx,A=te.ry,L=te.xAxisRotation,U=te.largeArcFlag,K=te.sweepFlag,n=M?Dt(Y-1,O):Math.max(Y-1,0),r=y[n],V=r.x,q=r.y,Bp.renderSvgArcCommand(_,V,q,D,A,U,K,L,g,h);break;case oe.curve:n=M?Dt(Y-1,O):Math.max(Y-1,0),r=y[n],d=r.controls&&r.controls.right||re.zero,u=te.controls&&te.controls.left||re.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),te._relative?(s=u.x+te.x,a=u.y+te.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,g,h),Y>=W&&M&&(o=P,f=te.controls&&te.controls.right||re.zero,m=o.controls&&o.controls.left||re.zero,te._relative?(l=f.x+te.x,c=f.y+te.y):(l=f.x,c=f.y),o._relative?(s=m.x+o.x,a=m.y+o.y):(s=m.x,a=m.y),g=o.x,h=o.y,_.bezierCurveTo(l,c,s,a,g,h));break;case oe.line:_.lineTo(g,h);break;case oe.move:P=te,_.moveTo(g,h);break}}M&&_.closePath(),xe.isHidden.test(k)||(p=k._renderer&&k._renderer.offset,p&&(_.save(),_.translate(-k._renderer.offset.x,-k._renderer.offset.y),_.scale(k._renderer.scale.x,k._renderer.scale.y)),_.fill(),p&&_.restore()),xe.isHidden.test(N)||(p=N._renderer&&N._renderer.offset,p&&(_.save(),_.translate(-N._renderer.offset.x,-N._renderer.offset.y),_.scale(N._renderer.scale.x,N._renderer.scale.y),_.lineWidth=T/N._renderer.scale.x),_.stroke(),p&&_.restore()),_.restore()},getBoundingClientRect:function(t,e,n){let r=1/0,o=-1/0,s=1/0,a=-1/0,l,c;t.forEach(function(d){const u=d.x,f=d.y,m=d.controls;let g,h,p,y,b,_;s=Math.min(f,s),r=Math.min(u,r),o=Math.max(u,o),a=Math.max(f,a),d.controls&&(b=m.left,_=m.right,!(!b||!_)&&(g=d._relative?b.x+u:b.x,h=d._relative?b.y+f:b.y,p=d._relative?_.x+u:_.x,y=d._relative?_.y+f:_.y,!(!g||!h||!p||!y)&&(s=Math.min(h,y,s),r=Math.min(g,p,r),o=Math.max(g,p,o),a=Math.max(h,y,a))))}),typeof e=="number"&&(s-=e,r-=e,o+=e,a+=e),l=o-r,c=a-s,n.top=s,n.left=r,n.right=o,n.bottom=a,n.width=l,n.height=c,n.centroid||(n.centroid={}),n.centroid.x=-r,n.centroid.y=-s},render:function(t,e,n){if(!this._visible||!this._opacity)return this;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,o=bt.Utils.getRendererType(this._renderer.type),s=e[o],a=r._matrix.manual||r._flagMatrix,l=this._matrix.manual||this._flagMatrix,c=this._renderer.parent!==r,d=this._flagVertices||this._flagFill||this._fill instanceof Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ke&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Oe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(a||l||c){this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Zn),lo(Zn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let f,m;this._scale instanceof re?(f=this._scale.x*r._renderer.scale.x,m=this._scale.y*r._renderer.scale.y):(f=this._scale*r._renderer.scale.x,m=this._scale*r._renderer.scale.y),this._renderer.scale.x=f<0?-f:f,this._renderer.scale.y=m<0?-m:m,c&&(this._renderer.parent=r)}if(this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const f=bt.Utils.getRendererType(this._mask._renderer.type);xe[f].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}if(d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,xe.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),xe.updateTexture.call(xe,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==s&&(t.useProgram(s),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,Ns,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const u=this._renderer.rect;return t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform4f(s.rect,u.left,u.top,u.right,u.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(t,e){let n;const r=this.canvas,o=this.ctx,s=t.renderer.ratio,a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._size*s;let m=f;xe.isHidden.test(a)||(m+=l),r.width=xl(m),r.height=r.width;const g=m/r.width,h=r.width/2,p=r.height/2;if(o.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")o.fillStyle=c;else{const y=bt.Utils.getRendererType(c._renderer.type);xe[y].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const y=bt.Utils.getRendererType(a._renderer.type);xe[y].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=fn(e)/g)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(h,p),o.scale(xe.precision,xe.precision),o.beginPath(),o.arc(0,0,f/g*.5,0,pt),o.restore(),closed&&o.closePath(),xe.isHidden.test(c)||(n=c._renderer&&c._renderer.offset,n&&(o.save(),o.translate(-c._renderer.offset.x,-c._renderer.offset.y),o.scale(c._renderer.scale.x,c._renderer.scale.y)),o.fill(),n&&o.restore()),xe.isHidden.test(a)||(n=a._renderer&&a._renderer.offset,n&&(o.save(),o.translate(-a._renderer.offset.x,-a._renderer.offset.y),o.scale(a._renderer.scale.x,a._renderer.scale.y),o.lineWidth=l/a._renderer.scale.x),o.stroke(),n&&o.restore())},render:function(t,e,n){if(!this._visible||!this._opacity)return this;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const o=n||this.parent,s=e[this._renderer.type],a=this._sizeAttenuation,l=this._stroke,c=this._linewidth,d=o._matrix.manual||o._flagMatrix,u=this._matrix.manual||this._flagMatrix,f=this._renderer.parent!==o,m=this._renderer.vertices,g=this._renderer.collection.length,h=this._flagVertices,p=this._flagFill||this._fill instanceof Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ke&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Oe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||o._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(d||u||f){this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Zn),lo(Zn,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,f&&(this._renderer.parent=o)}if(h){const y=this._renderer.positionBuffer;y&&t.deleteBuffer(y),this._renderer.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this._renderer.positionBuffer),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,m,t.STATIC_DRAW)}return p?(this._renderer.opacity=this._opacity*o._renderer.opacity,xe.updateTexture.call(xe,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture?this:(xe.isHidden.test(l)||(r+=c),r/=xe.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),e.current!==s&&(t.useProgram(s),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture),t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform1f(s.size,r*e.resolution.ratio),t.drawArrays(t.POINTS,0,g),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(t,e){const n=this.canvas,r=this.ctx,o=t.renderer.ratio,s=Pc.copy(e._renderer.scale).multiply(o),a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._decoration,m=e._direction;n.width=Math.max(Math.ceil(e._renderer.rect.width*s.x),1),n.height=Math.max(Math.ceil(e._renderer.rect.height*s.y),1);const g=e._renderer.rect.centroid,h=g.x,p=g.y;let y,b,_,v,x,N,T,k,$,w,B;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=m,c)if(typeof c=="string")r.fillStyle=c;else{const M=bt.Utils.getRendererType(c._renderer.type);xe[M].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const M=bt.Utils.getRendererType(a._renderer.type);xe[M].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=fn(e))}if(typeof d=="number"&&(r.globalAlpha=d),u&&u.length>0&&(r.lineDashOffset=u.offset||0,r.setLineDash(u)),r.save(),r.scale(s.x,s.y),r.translate(h,p),xe.isHidden.test(c)||(c._renderer&&c._renderer.offset?(N=c._renderer.scale.x,T=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(N,T),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,v=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,v),r.restore()):r.fillText(e.value,0,0)),xe.isHidden.test(a)||(a._renderer&&a._renderer.offset?(N=a._renderer.scale.x,T=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(N,T),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,v=a._renderer.offset.y/a._renderer.scale.y,x=l/a._renderer.scale.x,r.lineWidth=x,r.strokeText(e.value,_,v),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(f)){const M=r.measureText(e.value);switch(f){case"underline":$=M.actualBoundingBoxDescent,B=M.actualBoundingBoxDescent;break;case"strikethrough":$=0,B=0;break}k=-M.width/2,w=M.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(k,$),r.lineTo(w,B),r.stroke()}r.restore()},getBoundingClientRect:function(t,e){const n=xe.ctx;n.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" "),n.textAlign="center",n.textBaseline=bt.Utils.baselines[t._baseline]||t._baseline;const r=n.measureText(t._value);let o=r.width,s=1.15*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent);this._linewidth&&!xe.isHidden.test(this._stroke)&&(o+=this._linewidth*2,s+=this._linewidth*2);const a=o/2,l=s/2;switch(xe.alignments[t._alignment]||t._alignment){case xe.alignments.left:t.direction==="ltr"?(e.left=0,e.right=o):(e.left=-o,e.right=0);break;case xe.alignments.right:t.direction==="ltr"?(e.left=-o,e.right=0):(e.left=0,e.right=o);break;default:e.left=-a,e.right=a}switch(t._baseline){case"bottom":e.top=-s,e.bottom=0;break;case"top":e.top=0,e.bottom=s;break;case"baseline":e.top=-l*1.5,e.bottom=l*.5;break;default:e.top=-l,e.bottom=l}e.width=o,e.height=s,e.centroid||(e.centroid={}),e.centroid.x=a,e.centroid.y=l},render:function(t,e,n){if(!this._visible||!this._opacity)return this;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,o=e[this._renderer.type],s=r._matrix.manual||r._flagMatrix,a=this._matrix.manual||this._flagMatrix,l=this._renderer.parent!==r,c=this._flagVertices||this._flagFill||this._fill instanceof Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ke&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Oe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(s||a||l){this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Zn),lo(Zn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let u,f;this._scale instanceof re?(u=this._scale.x*r._renderer.scale.x,f=this._scale.y*r._renderer.scale.y):(u=this._scale*r._renderer.scale.x,f=this._scale*r._renderer.scale.y),this._renderer.scale.x=u<0?-u:u,this._renderer.scale.y=f<0?-f:f,l&&(this._renderer.parent=r)}if(this._mask){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=bt.Utils.getRendererType(this._mask._renderer.type);xe[u].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}if(c?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,xe.text.getBoundingClientRect(this,this._renderer.rect),xe.updateTexture.call(xe,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==o&&(t.useProgram(o),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(o.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o.position),t.bufferData(t.ARRAY_BUFFER,Ns,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return t.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),t.uniform4f(o.rect,d.left,d.top,d.right,d.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let n,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(n=e.getBoundingClientRect(!0),r=(r-.5)*n.width,o=(o-.5)*n.height,s=(s-.5)*n.width,a=(a-.5)*n.height),this._renderer.effect=t.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let n,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(n=e.getBoundingClientRect(!0),r=(r-.5)*n.width*.5,o=(o-.5)*n.height*.5,s=(s-.5)*n.width*.5,a=(a-.5)*n.height*.5,l*=Math.min(n.width,n.height)),this._renderer.effect=t.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(t,e){if(!t.canvas.getContext("2d"))return;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=t.createPattern(n,this._repeat);else if(!this._renderer.effect)return this.flagReset();if((this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof re||(this._renderer.offset=new re),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,n&&(this._renderer.offset.x+=n.width/2,this._renderer.offset.y+=n.height/2,this._scale instanceof re?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),this._flagScale||this._flagLoaded){this._renderer.scale instanceof re||(this._renderer.scale=new re);let r,o;this._scale instanceof re?(r=this._scale.x,o=this._scale.y):(r=this._scale,o=this._scale),this._renderer.scale.x=r<0?-r:r,this._renderer.scale.y=o<0?-o:o}return ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(t,e){const n=bt.Utils.getRendererType(e._renderer.type);if(this[n].updateCanvas.call(xe,t,e),this.canvas.width<=0||this.canvas.height<=0){e._renderer.texture&&t.deleteTexture(e._renderer.texture),delete e._renderer.texture;return}e._renderer.texture||(e._renderer.texture=t.createTexture()),t.bindTexture(t.TEXTURE_2D,e._renderer.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.canvas),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR)},program:{create:function(t,e){let n,r,o;if(n=t.createProgram(),ie.each(e,function(s){t.attachShader(n,s)}),t.linkProgram(n),r=t.getProgramParameter(n,t.LINK_STATUS),!r)throw o=t.getProgramInfoLog(n),t.deleteProgram(n),new It("unable to link program: "+o);return n}},extensions:{init:function(t){const e={},n=["EXT_texture_filter_anisotropic","WEBGL_compressed_texture_s3tc","OES_texture_float_linear","WEBGL_multisampled_render_to_texture"];for(let r=0;r<n.length;r++){const o=n[r];e[o]=xe.extensions.get(t,o)}return e},get:function(t,e){return t.getExtension(e)||t.getExtension(`MOZ_${e}`)||t.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new Yr};xe.ctx=xe.canvas.getContext("2d");var Fc=class extends J{constructor(t){super();let e,n,r,o;if(this.domElement=t.domElement||document.createElement("canvas"),typeof t.offscreenElement<"u"&&(xe.canvas=t.offscreenElement,xe.ctx=xe.canvas.getContext("2d")),this.scene=new ct,this.scene.parent=this,this._renderer={type:"renderer",matrix:new hn(Sp),scale:1,opacity:1},this._flagMatrix=!0,t=ie.defaults(t||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=t.overdraw,e=this.ctx=this.domElement.getContext("webgl",t)||this.domElement.getContext("experimental-webgl",t),!this.ctx)throw new It("unable to create a webgl context. Try using another renderer.");r=Kt.create(e,Kt.path.vertex,Kt.types.vertex),o=Kt.create(e,Kt.path.fragment,Kt.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},n=this.programs.path=xe.program.create(e,[r,o]),this.programs.text=this.programs.path,e.extensions=xe.extensions.init(e),e.renderer=this,n.position=e.getAttribLocation(n,"a_position"),n.matrix=e.getUniformLocation(n,"u_matrix"),n.rect=e.getUniformLocation(n,"u_rect");const s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(n.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n.position),e.bufferData(e.ARRAY_BUFFER,Ns,e.STATIC_DRAW),r=Kt.create(e,Kt.points.vertex,Kt.types.vertex),o=Kt.create(e,Kt.points.fragment,Kt.types.fragment),n=this.programs.points=xe.program.create(e,[r,o]),n.position=e.getAttribLocation(n,"a_position"),n.matrix=e.getUniformLocation(n,"u_matrix"),n.size=e.getUniformLocation(n,"u_size"),e.enable(e.BLEND),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}setSize(t,e,n){let r,o;const s=this.ctx;return this.width=t,this.height=e,this.ratio=typeof n>"u"?rs(s):n,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,ie.isObject(this.domElement.style)&&ie.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=t*this.ratio,o=e*this.ratio,s.viewport(0,0,r,o),this.programs.resolution.width=r,this.programs.resolution.height=o,this.programs.resolution.ratio=this.ratio,this.programs.resolution.flagged=!0,this.trigger(J.Types.resize,t,e,n)}render(){const t=this.ctx;return this.overdraw||t.clear(t.COLOR_BUFFER_BIT),xe.group.render.call(this.scene,t,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};C(Fc,"Utils",xe);var Tp=ie.extend({Error:It,getRatio:rs,read:Xe,xhr:Bc},ie,Tt,yl,bl),Ce=class Lr{constructor(e){C(this,"_events",new J),C(this,"type",""),C(this,"renderer",null),C(this,"scene",null),C(this,"width",0),C(this,"height",0),C(this,"frameCount",0),C(this,"timeDelta",0),C(this,"playing",!1);const n=ie.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:Lr.Types.svg,autostart:!1});if(ie.each(n,function(r,o){/fullscreen/i.test(o)||/autostart/i.test(o)||(this[o]=r)},this),ie.isElement(n.domElement)){const r=n.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=Lr.Types[r])}this.renderer=new Lr[this.type](this),this.setPlaying(n.autostart),this.frameCount=0,n.fullscreen?(this.fit=Np.bind(this),this.fit.domElement=window,this.fit.attached=!0,ie.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),ie.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),Lt.bind(this.fit.domElement,"resize",this.fit),this.fit()):n.fitted?(this.fit=$p.bind(this),ie.extend(this.renderer.domElement.style,{display:"block"})):typeof n.width=="number"&&typeof n.height=="number"&&(this.renderer.setSize(n.width,n.height,this.ratio),this.width=n.width,this.height=n.height),this.renderer.bind(J.Types.resize,Ep.bind(this)),this.scene=this.renderer.scene,Lr.Instances.push(this),n.autostart&&pr.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){return this._events.addEventListener.apply(this,arguments)}on(){return this._events.addEventListener.apply(this,arguments)}bind(){return this._events.addEventListener.apply(this,arguments)}removeEventListener(){return this._events.removeEventListener.apply(this,arguments)}off(){return this._events.removeEventListener.apply(this,arguments)}unbind(){return this._events.removeEventListener.apply(this,arguments)}dispatchEvent(){return this._events.dispatchEvent.apply(this,arguments)}trigger(){return this._events.dispatchEvent.apply(this,arguments)}listen(){return this._events.listen.apply(this,arguments)}ignore(){return this._events.ignore.apply(this,arguments)}appendTo(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,pr.init(),this.trigger(J.Types.play)}pause(){return this.playing=!1,this.trigger(J.Types.pause)}setPlaying(e){this.playing=e}release(e){let n,r,o;if(typeof e>"u")return this.release(this.scene);if(typeof e.unbind=="function"&&e.unbind(),typeof e.fill=="object"&&"unbind"in e.fill&&e.fill.unbind(),typeof e.stroke=="object"&&"unbind"in e.stroke&&e.stroke.unbind(),e.vertices){if(typeof e.vertices.unbind=="function")try{e.vertices.unbind()}catch{}for(n=0;n<e.vertices.length;n++)r=e.vertices[n],typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}if(e.children){for(n=0;n<e.children.length;n++)o=e.children[n],this.release(o);if(typeof e.children.unbind=="function")try{e.children.unbind()}catch{}}if(e._renderer){if(e._renderer.elem&&e._renderer.elem.parentNode&&(e._renderer.elem.parentNode.removeChild(e._renderer.elem),delete e._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const s=this.renderer.ctx;e._renderer.texture&&(s.deleteTexture(e._renderer.texture),delete e._renderer.texture),e._renderer.positionBuffer&&(s.deleteBuffer(e._renderer.positionBuffer),delete e._renderer.positionBuffer),e._renderer.effect&&(e._renderer.effect=null)}this.type==="CanvasRenderer"&&e._renderer.context&&delete e._renderer.context}return e}update(){const e=!!this._lastFrame,n=ie.performance.now();e&&(this.timeDelta=parseFloat((n-this._lastFrame).toFixed(3))),this._lastFrame=n,this.fit&&this.fit.domElement&&!this.fit.attached&&(Lt.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());const r=this.width,o=this.height,s=this.renderer;return(r!==s.width||o!==s.height)&&s.setSize(r,o,this.ratio),this.trigger(J.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(J.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 io(e,n,r,o);return this.scene.add(s),s}makeArrow(e,n,r,o,s){const a=typeof s=="number"?s:10,l=Math.atan2(o-n,r-e),c=[new Be(e,n,void 0,void 0,void 0,void 0,oe.move),new Be(r,o,void 0,void 0,void 0,void 0,oe.line),new Be(r-a*Math.cos(l-Math.PI/4),o-a*Math.sin(l-Math.PI/4),void 0,void 0,void 0,void 0,oe.line),new Be(r,o,void 0,void 0,void 0,void 0,oe.move),new Be(r-a*Math.cos(l+Math.PI/4),o-a*Math.sin(l+Math.PI/4),void 0,void 0,void 0,void 0,oe.line)],d=new $e(c,!1,!1,!0);return d.noFill(),d.cap="round",d.join="round",this.scene.add(d),d}makeRectangle(e,n,r,o){const s=new Gn(e,n,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,n,r,o,s){const a=new eo(e,n,r,o,s);return this.scene.add(a),a}makeCircle(e,n,r,o){const s=new Qr(e,n,r,o);return this.scene.add(s),s}makeEllipse(e,n,r,o,s){const a=new Jr(e,n,r,o,s);return this.scene.add(a),a}makeStar(e,n,r,o,s){const a=new _s(e,n,r,o,s);return this.scene.add(a),a}makeCurve(e){const n=arguments.length;if(!Array.isArray(e)){e=[];for(let a=0;a<n;a+=2){const l=arguments[a];if(typeof l!="number")break;const c=arguments[a+1];e.push(new Be(l,c))}}const r=arguments[n-1],o=new $e(e,!(typeof r=="boolean"&&r),!0),s=o.getBoundingClientRect();return o.center().translation.set(s.left+s.width/2,s.top+s.height/2),this.scene.add(o),o}makePolygon(e,n,r,o){const s=new bs(e,n,r,o);return this.scene.add(s),s}makeArcSegment(e,n,r,o,s,a,l){const c=new hs(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 ys(r);return this.scene.add(o),o}makePath(e){const n=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let l=0;l<n;l+=2){const c=arguments[l];if(typeof c!="number")break;const d=arguments[l+1];r.push(new Be(c,d))}}const o=arguments[n-1],s=new $e(r,!(typeof o=="boolean"&&o)),a=s.getBoundingClientRect();return typeof a.top=="number"&&typeof a.left=="number"&&typeof a.right=="number"&&typeof a.bottom=="number"&&s.center().translation.set(a.left+a.width/2,a.top+a.height/2),this.scene.add(s),s}makeText(e,n,r,o){const s=new mn(e,n,r,o);return this.add(s),s}makeLinearGradient(e,n,r,o){const s=Array.prototype.slice.call(arguments,4),a=new Ue(e,n,r,o,s);return this.add(a),a}makeRadialGradient(e,n,r){const o=Array.prototype.slice.call(arguments,3),s=new Ke(e,n,r,o);return this.add(s),s}makeSprite(e,n,r,o,s,a,l){const c=new Zr(e,n,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,n,r,o,s,a){const l=new Tc(e,n,r,o,s,a);return this.add(l),l}makeImageSequence(e,n,r,o,s){const a=new vs(e,n,r,o);return s&&a.play(),this.add(a),a}makeTexture(e,n){return new Oe(e,n)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const n=new ct;return this.scene.add(n),n.add(e),n}interpret(e,n,r){const o=e.tagName.toLowerCase();if(r=typeof r<"u"?r:!0,!(o in Xe))return null;const s=Xe[o].call(this,e);return r?this.add(n&&s instanceof ct?s.children:s):s.parent&&s.remove(),s}load(e,n){const r=new ct;let o,s,a;const l=(function(c){for(Lt.temp.innerHTML=c,s=0;s<Lt.temp.children.length;s++)o=Lt.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof n=="function"){const d=Lt.temp.children.length<=1?Lt.temp.children[0]:Lt.temp.children;n(r,d)}}).bind(this);return/\.svg$/i.test(e)?(Bc(e,l),r):(l(e),r)}};C(Ce,"NextFrameId",Nt.NextFrameId),C(Ce,"Types",Nt.Types),C(Ce,"Version",Nt.Version),C(Ce,"PublishDate",Nt.PublishDate),C(Ce,"Identifier",Nt.Identifier),C(Ce,"Resolution",Nt.Resolution),C(Ce,"AutoCalculateImportedMatrices",Nt.AutoCalculateImportedMatrices),C(Ce,"Instances",Nt.Instances),C(Ce,"uniqueId",Nt.uniqueId),C(Ce,"Anchor",Be),C(Ce,"Collection",Yn),C(Ce,"Events",J),C(Ce,"Group",ct),C(Ce,"Matrix",Wi),C(Ce,"Path",$e),C(Ce,"Registry",Yr),C(Ce,"Element",Hi),C(Ce,"Shape",Kn),C(Ce,"Text",mn),C(Ce,"Vector",re),C(Ce,"Gradient",ot),C(Ce,"Image",Tc),C(Ce,"ImageSequence",vs),C(Ce,"LinearGradient",Ue),C(Ce,"RadialGradient",Ke),C(Ce,"Sprite",Zr),C(Ce,"Stop",Un),C(Ce,"Texture",Oe),C(Ce,"ArcSegment",hs),C(Ce,"Circle",Qr),C(Ce,"Ellipse",Jr),C(Ce,"Line",io),C(Ce,"Points",ys),C(Ce,"Polygon",bs),C(Ce,"Rectangle",Gn),C(Ce,"RoundedRectangle",eo),C(Ce,"Star",_s),C(Ce,"CanvasRenderer",bt),C(Ce,"SVGRenderer",Rc),C(Ce,"WebGLRenderer",Fc),C(Ce,"Commands",oe),C(Ce,"Utils",Tp);var pn=Ce;function Np(){const t=document.body.getBoundingClientRect(),e=this.width=t.width,n=this.height=t.height;this.renderer.setSize(e,n,this.ratio)}function $p(){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 Ep(t,e){this.width=t,this.height=e,this.trigger(J.Types.resize,t,e)}var pr=Lt.getRequestAnimationFrame();function Vc(){for(let t=0;t<pn.Instances.length;t++){const e=pn.Instances[t];e.playing&&e.update()}pn.NextFrameId=pr(Vc)}pr.init=function(){Vc(),pr.init=function(){}};let yn;typeof window<"u"?yn=window:typeof global<"u"?yn=global:typeof self<"u"&&(yn=self);let Mc;const hi=Math.PI*2,dt=Math.PI*.5;function Rp(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 Pp(t){Mc=t}function Fp(t,e){e=e&&e.identity()||new Mc;let n=t;const r=[];for(;n&&n._matrix;)r.push(n._matrix),n=n.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Gt(t,e,n){return n*(e-t)+t}function Xi(t,e){for(;t<0;)t+=e;return t%e}const Ic=yn.Float32Array||Array,Vp=Math.floor;function bn(t){return Vp(t*1e6)/1e6}const pe={move:"M",line:"L",curve:"C",close:"Z"};class ne{constructor(){S(this,"_events",{});S(this,"_bound",!1)}addEventListener(e,n){return(this._events[e]||(this._events[e]=[])).push(n),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,n){if(!this._events)return this;if(!e&&!n)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(n)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,n!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const n=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...n);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,n,r){const o=this;e&&(s.obj=e,s.name=n,s.handler=r,e.on(n,s));function s(){r.apply(o,arguments)}return o}ignore(e,n,r){return e.off(n,r),this}}S(ne,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),S(ne,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Ac={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))}}},ft=class ft extends ne{constructor(n=0,r=0){super();S(this,"_x",0);S(this,"_y",0);for(let o in Ac)Object.defineProperty(this,o,Ac[o]);this.x=n,this.y=r}static add(n,r){return new ft(n.x+r.x,n.y+r.y)}static sub(n,r){return new ft(n.x-r.x,n.y-r.y)}static subtract(n,r){return ft.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(ft.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 ft(this.x,this.y)}add(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x+=n,this.y+=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x+=n.x,this.y+=n.y):(this.x+=n,this.y+=r),this)}addSelf(n){return this.add.apply(this,arguments)}sub(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x-=n,this.y-=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x-=n.x,this.y-=n.y):(this.x-=n,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(n){return this.sub.apply(this,arguments)}subtractSelf(n){return this.sub.apply(this,arguments)}multiply(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x*=n,this.y*=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x*=n.x,this.y*=n.y):(this.x*=n,this.y*=r),this)}multiplySelf(n){return this.multiply.apply(this,arguments)}multiplyScalar(n){return this.multiply(n)}divide(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x/=n,this.y/=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x/=n.x,this.y/=n.y):(this.x/=n,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(n){return this.divide.apply(this,arguments)}divideScalar(n){return this.divide(n)}negate(){return this.multiply(-1)}dot(n){return this.x*n.x+this.y*n.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(n){return Math.sqrt(this.distanceToSquared(n))}distanceToSquared(n){const r=this.x-n.x,o=this.y-n.y;return r*r+o*o}setLength(n){return this.normalize().multiplyScalar(n)}equals(n,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(n)<r}lerp(n,r){const o=(n.x-this.x)*r+this.x,s=(n.y-this.y)*r+this.y;return this.set(o,s)}isZero(n){return n=typeof n>"u"?1e-4:n,this.length()<n}toString(){return this.x+", "+this.y}toObject(){return{x:bn(this.x),y:bn(this.y)}}rotate(n){const r=this.x,o=this.y,s=Math.cos(n),a=Math.sin(n);return this.x=r*s-o*a,this.y=r*a+o*s,this}};S(ft,"zero",new ft),S(ft,"left",new ft(-1,0)),S(ft,"right",new ft(1,0)),S(ft,"up",new ft(0,-1)),S(ft,"down",new ft(0,1));let be=ft;class Fe extends be{constructor(n=0,r=0,o=0,s=0,a=0,l=0,c=pe.move){super(n,r);S(this,"controls",{left:new be,right:new be});S(this,"_command",pe.move);S(this,"_relative",!0);S(this,"_rx",0);S(this,"_ry",0);S(this,"_xAxisRotation",0);S(this,"_largeArcFlag",0);S(this,"_sweepFlag",1);for(let u in Oc)Object.defineProperty(this,u,Oc[u]);this.command=c,this.relative=!0;const d=Fe.makeBroadcast(this);this.controls.left.set(o,s).addEventListener(ne.Types.change,d),this.controls.right.set(a,l).addEventListener(ne.Types.change,d)}static makeBroadcast(n){return r;function r(){n._bound&&n.dispatchEvent(ne.Types.change)}}static fromObject(n){return new Fe().copy(n)}copy(n){return this.x=n.x,this.y=n.y,typeof n.command=="string"&&(this.command=n.command),n.controls&&(n.controls.left&&this.controls.left.copy(n.controls.left),n.controls.right&&this.controls.right.copy(n.controls.right)),typeof n.relative=="boolean"&&(this.relative=n.relative),typeof n.rx=="number"&&(this.rx=n.rx),typeof n.ry=="number"&&(this.ry=n.ry),typeof n.xAxisRotation=="number"&&(this.xAxisRotation=n.xAxisRotation),typeof n.largeArcFlag=="number"&&(this.largeArcFlag=n.largeArcFlag),typeof n.sweepFlag=="number"&&(this.sweepFlag=n.sweepFlag),this}clone(){return new Fe().copy(this)}toObject(){return{x:bn(this.x),y:bn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:bn(this.rx),ry:bn(this.ry),xAxisRotation:bn(this.xAxisRotation),largeArcFlag:bn(this.largeArcFlag),sweepFlag:bn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const Oc={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 Mp=0;const $s={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return Mp++}},co={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 uo(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 zc(t,e,n,r,o,s,a,l,c){c=c||co.RecursionLimit;const d=c+1;if(Math.abs(t-a)<.001&&Math.abs(e-l)<.001)return[new Fe(a,l)];const u=[];for(let f=0;f<d;f++){const m=f/d,g=uo(m,t,n,o,a),h=uo(m,e,r,s,l);u.push(new Fe(g,h))}return u}function Ip(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,f=3*(n-t),m=9*(r-s)+3*(l-e),g=6*(e+s)-12*r,h=3*(r-e);function p(y){const b=(d*y+u)*y+f,_=(m*y+g)*y+h;return Math.sqrt(b*b+_*_)}return Op(p,0,1,c||co.RecursionLimit)}function Ap(t,e,n,r,o,s,a,l){const c=[],d=[[],[]];let u,f,m,g,h,p,y,b;for(let N=0;N<2;++N){if(N===0?(f=6*t-12*n+6*o,u=-3*t+9*n-9*o+3*a,m=3*n-3*t):(f=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,m=3*r-3*e),Math.abs(u)<.001){if(Math.abs(f)<.001)continue;g=-m/f,0<g&&g<1&&c.push(g);continue}y=f*f-4*m*u,b=Math.sqrt(y),!(y<0)&&(h=(-f+b)/(2*u),0<h&&h<1&&c.push(h),p=(-f-b)/(2*u),0<p&&p<1&&c.push(p))}let _=c.length,v=_,x;for(;_--;)g=c[_],x=1-g,d[0][_]=x*x*x*t+3*x*x*g*n+3*x*g*g*o+g*g*g*a,d[1][_]=x*x*x*e+3*x*x*g*r+3*x*g*g*s+g*g*g*l;return d[0][v]=t,d[1][v]=e,d[0][v+1]=a,d[1][v+1]=l,d[0].length=d[1].length=v+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 Op(t,e,n,r){let o=co.abscissas[r-2],s=co.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 f=a*o[c];u+=s[c++]*(t(l+f)+t(l-f))}return a*u}function zp(t,e){const n=t.length,r=n-1;for(let o=0;o<n;o++){const s=t[o],a=e?Xi(o-1,n):Math.max(o-1,0),l=e?Xi(o+1,n):Math.min(o+1,r),c=t[a],d=s,u=t[l];Dp(c,d,u),d.command=o===0?pe.move:pe.curve}}function Dp(t,e,n){const r=be.angleBetween(t,e),o=be.angleBetween(n,e);let s=be.distanceBetween(t,e),a=be.distanceBetween(n,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=dt:l-=dt,e.controls.left.x=Math.cos(l)*s,e.controls.left.y=Math.sin(l)*s,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}let yr=(Ni=class extends ne{constructor(){super();S(this,"_flagId",!1);S(this,"_flagClassName",!1);S(this,"_renderer",{});S(this,"_id",$s.Identifier+$s.uniqueId());S(this,"_className","");S(this,"classList",[]);for(let n in Dc)Object.defineProperty(this,n,Dc[n])}static fromObject(n){const r=new Ni().copy(n);return"id"in n&&(r.id=n.id),r}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(n){return n.renderer&&typeof n.renderer.type=="string"&&(this.renderer.type=n.renderer.type),typeof n.className=="string"&&(this.className=n.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){const n=this._renderer.type;return this._renderer={type:n},typeof this.unbind=="function"&&this.unbind(),this}},S(Ni,"Properties",["renderer","id","className"]),Ni);const Dc={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 ho extends Error{constructor(n){super();S(this,"name","Two.js");S(this,"message");this.message=n}}class Lp{constructor(){S(this,"map",{})}add(e,n){return this.map[e]=n,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}}let fo;const Lc={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};yn.document&&(fo=document.createElement("a"));const Ze=class Ze extends yr{constructor(n,r){super();S(this,"_flagSrc",!1);S(this,"_flagImage",!1);S(this,"_flagVideo",!1);S(this,"_flagLoaded",!1);S(this,"_flagRepeat",!1);S(this,"_flagOffset",!1);S(this,"_flagScale",!1);S(this,"_src","");S(this,"_image",null);S(this,"_loaded",!1);S(this,"_repeat","no-repeat");S(this,"_scale",1);S(this,"_offset",null);for(let o in Hc)Object.defineProperty(this,o,Hc[o]);if(this._renderer.type="texture",this._renderer.flagOffset=Hp.bind(this),this._renderer.flagScale=Wp.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new be,typeof r=="function"){const o=(function(){this.unbind(ne.Types.load,o),typeof r=="function"&&r()}).bind(this);this.bind(ne.Types.load,o)}if(typeof n=="string")this.src=n;else if(typeof n=="object"){const o=Object.prototype.toString.call(n);(o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]"||o==="[object HTMLVideoElement]"||o==="[object Image]")&&(this.image=n)}this._update()}fromObject(n){const r=new Ze().copy(n);return"id"in n&&(r.id=n.id),r}static getAbsoluteURL(n){return fo?(fo.href=n,fo.href):n}static loadHeadlessBuffer(n,r){n.image.onload=r,n.image.src=n.src}static getTag(n){return n&&n.nodeName&&n.nodeName.toLowerCase()||"img"}static getImage(n){const r=Ze.getAbsoluteURL(n);if(Ze.ImageRegistry.contains(r))return Ze.ImageRegistry.get(r);let o;return yn.document?Lc.video.test(r)?o=document.createElement("video"):o=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),o.crossOrigin="anonymous",o.referrerPolicy="no-referrer",o}static load(n,r){let o=n.image,s=Ze.getTag(o);n._flagImage&&(/canvas/i.test(s)?Ze.Register.canvas(n,r):(n._src=o.getAttribute("two-src")||o.src,Ze.Register[s](n,r))),n._flagSrc&&(o||(o=Ze.getImage(n.src),n.image=o),s=Ze.getTag(o),Ze.Register[s](n,r))}clone(){const n=new Ze(this.src);return n.repeat=this.repeat,n.offset.copy(this.offset),n.scale=this.scale,n}copy(n){return this.src=n.src,this.repeat=n.repeat,this.offset=typeof n.offset=="number"||n.offset instanceof be?n.offset:new be().copy(n.offset),this.scale=typeof n.scale=="number"||n.scale instanceof be?n.scale:new be().copy(n.scale),this}toObject(){const n=super.toObject.call(this);return n.renderer.type="texture",n.src=this.src,n.repeat=this.repeat,n.offset=this.offset.toObject(),n.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),n}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(ne.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Ze.load(this,(function(){this.loaded=!0,this.trigger(ne.Types.change).trigger(ne.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(Ze,"Properties",["src","loaded","repeat","scale","offset","image"]),S(Ze,"RegularExpressions",Lc),S(Ze,"ImageRegistry",new Lp),S(Ze,"Register",{canvas:function(n,r){n._src="#"+n.id,Ze.ImageRegistry.add(n.src,n.image),typeof r=="function"&&r()},img:function(n,r){const o=n.image,s=function(l){o.removeEventListener&&typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),typeof r=="function"&&r()},a=function(l){throw typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),new ho("unable to load "+n.src)};typeof o.width=="number"&&o.width>0&&typeof o.height=="number"&&o.height>0?s():typeof o.addEventListener=="function"&&(o.addEventListener("load",s,!1),o.addEventListener("error",a,!1)),n._src=Ze.getAbsoluteURL(n._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",n.src),Ze.ImageRegistry.add(n.src,o),n.image.src=n.src)},video:function(n,r){const o=function(a){n.image.removeEventListener("canplaythrough",o,!1),n.image.removeEventListener("error",s,!1),n.image.width=n.image.videoWidth,n.image.height=n.image.videoHeight,typeof r=="function"&&r()},s=function(a){throw n.image.removeEventListener("canplaythrough",o,!1),n.image.removeEventListener("error",s,!1),new ho("unable to load "+n.src)};n._src=Ze.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),Ze.ImageRegistry.add(n.src,n.image)),n.image.readyState>=4?o():(n.image.addEventListener("canplaythrough",o,!1),n.image.addEventListener("error",s,!1),n.image.src=n.src,n.image.load())}});let Ge=Ze;const Hc={src:{enumerable:!0,get:function(){return this._src},set:function(t){this._src=t,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(t){this._loaded=t,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(t){this._repeat=t,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(t){const e=Ge.getTag(t);let n;switch(e){case"canvas":n="#"+t.id;break;default:n=t.src}Ge.ImageRegistry.contains(n)?this._image=Ge.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset&&this._offset.unbind(ne.Types.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(ne.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof be&&this._scale.unbind(ne.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof be&&this._scale.bind(ne.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Hp(){this._flagOffset=!0}function Wp(){this._flagScale=!0}class fi extends Array{constructor(){super();Ka(this,mt,new ne);arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}get _events(){return Vt(this,mt)}set _events(n){of(this,mt,n)}get _bound(){return Vt(this,mt)._bound}set _bound(n){Vt(this,mt)._bound=n}addEventListener(){return Vt(this,mt).addEventListener.apply(this,arguments)}on(){return Vt(this,mt).on.apply(this,arguments)}bind(){return Vt(this,mt).bind.apply(this,arguments)}removeEventListener(){return Vt(this,mt).removeEventListener.apply(this,arguments)}off(){return Vt(this,mt).off.apply(this,arguments)}unbind(){return Vt(this,mt).unbind.apply(this,arguments)}dispatchEvent(){return Vt(this,mt).dispatchEvent.apply(this,arguments)}trigger(){return Vt(this,mt).trigger.apply(this,arguments)}listen(){return Vt(this,mt).listen.apply(this,arguments)}ignore(){return Vt(this,mt).ignore.apply(this,arguments)}pop(){const n=super.pop.apply(this,arguments);return this.trigger(ne.Types.remove,[n]),n}shift(){const n=super.shift.apply(this,arguments);return this.trigger(ne.Types.remove,[n]),n}push(){const n=super.push.apply(this,arguments);return this.trigger(ne.Types.insert,arguments),n}unshift(){const n=super.unshift.apply(this,arguments);return this.trigger(ne.Types.insert,arguments),n}splice(){const n=super.splice.apply(this,arguments);if(this.trigger(ne.Types.remove,n),arguments.length>2){const r=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(ne.Types.insert,r),this.trigger(ne.Types.order)}return n}sort(){return super.sort.apply(this,arguments),this.trigger(ne.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(ne.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(n,r){const o=[];for(let s=0;s<this.length;s++){const a=this[s];let l;r?l=n.call(r,a,s):l=n(a,s),o.push(l)}return o}}mt=new WeakMap;const Wc=Array.prototype.slice;function jp(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}const Me={isNaN:function(t){return typeof t=="number"&&t!==+t},isElement:function(t){return!!(t&&t.nodeType===1)},isObject:function(t){const e=typeof t;return e==="function"||e==="object"&&!!t},isFunction:function(t){return typeof t=="function"},extend:function(t){const e=Wc.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=Wc.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=!jp(t)&&Object.keys(t),s=(o||t).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,t[l],l,t)}return t},performance:yn.performance&&yn.performance.now?yn.performance:Date},Ot=class Ot extends yr{constructor(n,r,o){super();S(this,"_flagOffset",!0);S(this,"_flagOpacity",!0);S(this,"_flagColor",!0);S(this,"_offset",0);S(this,"_opacity",1);S(this,"_color","#fff");for(let s in jc)Object.defineProperty(this,s,jc[s]);this._renderer.type="stop",this.offset=typeof n=="number"?n:Ot.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:Ot.Index<=0?"#fff":"#000",Ot.Index=(Ot.Index+1)%2}static fromObject(n){const r=new Ot().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Ot.Properties.length;r++){const o=Ot.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Ot;return Me.each(Ot.Properties,function(o){r[o]=this[o]},this),n&&n.stops&&n.stops.push(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="stop",Me.each(Ot.Properties,r=>{n[r]=this[r]},this),n}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};S(Ot,"Index",0),S(Ot,"Properties",["offset","opacity","color"]);let mi=Ot;const jc={offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},vn=class vn extends yr{constructor(n){super();S(this,"_flagStops",!1);S(this,"_flagSpread",!1);S(this,"_flagUnits",!1);S(this,"_spread","");S(this,"_units","");for(let r in qc)Object.defineProperty(this,r,qc[r]);this._renderer.type="gradient",this._renderer.flagStops=qp.bind(this),this._renderer.bindStops=Xp.bind(this),this._renderer.unbindStops=Yp.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 mi?s:new mi().copy(s)));const o=new vn(r).copy(n);return"id"in n&&(o.id=n.id),o}clone(n){const r=this.stops.map(s=>s.clone()),o=new vn(r);return Me.each(vn.Properties,s=>{o[s]=this[s]},this),n&&n.add(o),o}copy(n){super.copy.call(this,n);for(let r=0;r<vn.Properties.length;r++){const o=vn.Properties[r];o in n&&(this[o]=n[o])}return this}toObject(){const n={stops:this.stops.map(r=>r.toObject())};return Me.each(vn.Properties,r=>{n[r]=this[r]},this),n}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(ne.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(vn,"Stop",mi),S(vn,"Properties",["spread","stops","units"]);let st=vn;const qc={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 fi((t||[]).slice(0)),this._stops.bind(ne.Types.insert,e).bind(ne.Types.remove,n),e(this._stops)}}};function qp(){this._flagStops=!0}function Xp(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function Yp(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}const ii=class ii extends st{constructor(n,r,o,s,a){super(a);S(this,"_flagEndPoints",!1);S(this,"_left",null);S(this,"_right",null);for(let l in Xc)Object.defineProperty(this,l,Xc[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=Up.bind(this),this.left=new be,this.right=new be,typeof n=="number"&&(this.left.x=n),typeof r=="number"&&(this.left.y=r),typeof o=="number"&&(this.right.x=o),typeof s=="number"&&(this.right.y=s)}static fromObject(n){const r=new 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&&(this[o]=n[o]instanceof be?n[o]:new be().copy(n[o]))}return this}clone(n){const r=this.stops.map(function(s){return s.clone()}),o=new ii(this.left._x,this.left._y,this.right._x,this.right._y,r);return Me.each(st.Properties,function(s){o[s]=this[s]},this),n&&n.add(o),o}toObject(){const n=super.toObject.call(this);return n.left=this.left.toObject(),n.right=this.right.toObject(),n}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(ne.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};S(ii,"Stop",mi),S(ii,"Properties",["left","right"]);let $t=ii;const Xc={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof be&&this._left.unbind(ne.Types.change,this._renderer.flagEndPoints),this._left=t,this._left.bind(ne.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(t){this._right instanceof be&&this._right.unbind(ne.Types.change,this._renderer.flagEndPoints),this._right=t,this._right.bind(ne.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function Up(){this._flagEndPoints=!0}const Cn=class Cn extends st{constructor(n,r,o,s,a,l){super(s);S(this,"_flagRadius",!1);S(this,"_flagCenter",!1);S(this,"_flagFocal",!1);S(this,"_radius",0);S(this,"_center",null);S(this,"_focal",null);for(let c in Yc)Object.defineProperty(this,c,Yc[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Kp.bind(this),this._renderer.flagFocal=Gp.bind(this),this.center=new be,this.radius=typeof o=="number"?o:1,this.focal=new be,typeof n=="number"&&(this.center.x=n),typeof r=="number"&&(this.center.y=r),this.focal.copy(this.center),typeof a=="number"&&(this.focal.x=a),typeof l=="number"&&(this.focal.y=l)}static fromObject(n){const r=new Cn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Cn.Properties.length;r++){const o=Cn.Properties[r];o in n&&(/(center|focal)i/.test(o)?this[o]=n[o]instanceof be?n[o]:new be().copy(n[o]):typeof n[o]=="number"&&(this[o]=n[MediaKeySystemAccess]))}return this}clone(n){const r=this.stops.map(function(s){return s.clone()}),o=new Cn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return Me.each(st.Properties.concat(Cn.Properties),function(s){o[s]=this[s]},this),n&&n.add(o),o}toObject(){const n=super.toObject.call(this);return Me.each(Cn.Properties,function(r){n[r]=this[r]},this),n.center=this.center.toObject(),n.focal=this.focal.toObject(),n}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(ne.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};S(Cn,"Stop",mi),S(Cn,"Properties",["center","radius","focal"]);let Et=Cn;const Yc={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 Kp(){this._flagCenter=!0}function Gp(){this._flagFocal=!0}function Uc(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 mo(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 Kc(t,e,n){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(m||t).x,d=(m||t).y,a=t.x,u=t.y,f&&e._relative&&(o+=e.x,c+=e.y),m&&t._relative&&(s+=t.x,d+=t.y),Ip(r,l,o,c,s,d,a,u,n)}function Gc(t,e,n){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(m||t).x,d=(m||t).y,a=t.x,u=t.y,f&&e._relative&&(o+=e.x,c+=e.y),m&&t._relative&&(s+=t.x,d+=t.y),zc(r,l,o,c,s,d,a,u,n)}function gi(t){switch(t.renderer.type){case"texture":return Ge.fromObject(t);case"gradient":return st.fromObject(t);case"linear-gradient":return $t.fromObject(t);case"radial-gradient":return Et.fromObject(t)}return t}const Zp=Math.cos,Qp=Math.sin,Zc=Math.tan,Es=[],Pt=class Pt extends ne{constructor(n,r,o,s,a,l){super();S(this,"elements",new Ic(9));S(this,"manual",!1);let c=n;Array.isArray(c)||(c=Array.prototype.slice.call(arguments)),this.identity(),c.length>0&&this.set(c)}static Multiply(n,r,o){if(r.length<=3){const k=n;let $,w,B;const E=r[0]||0,M=r[1]||0,R=r[2]||0;return $=k[0]*E+k[1]*M+k[2]*R,w=k[3]*E+k[4]*M+k[5]*R,B=k[6]*E+k[7]*M+k[8]*R,[$,w,B]}const s=n[0],a=n[1],l=n[2],c=n[3],d=n[4],u=n[5],f=n[6],m=n[7],g=n[8],h=r[0],p=r[1],y=r[2],b=r[3],_=r[4],v=r[5],x=r[6],N=r[7],T=r[8];return o=o||new Ic(9),o[0]=s*h+a*b+l*x,o[1]=s*p+a*_+l*N,o[2]=s*y+a*v+l*T,o[3]=c*h+d*b+u*x,o[4]=c*p+d*_+u*N,o[5]=c*y+d*v+u*T,o[6]=f*h+m*b+g*x,o[7]=f*p+m*_+g*N,o[8]=f*y+m*v+g*T,o}static fromObject(n){return new Pt().copy(n)}set(n,r,o,s,a,l,c,d,u){if(typeof r>"u"){const f=n;n=f[0],r=f[1],o=f[2],s=f[3],a=f[4],l=f[5],c=f[6],d=f[7],u=f[8]}return this.elements[0]=n,this.elements[1]=r,this.elements[2]=o,this.elements[3]=s,this.elements[4]=a,this.elements[5]=l,this.elements[6]=c,this.elements[7]=d,this.elements[8]=u,this.trigger(ne.Types.change)}copy(n){return this.elements[0]=n.elements[0],this.elements[1]=n.elements[1],this.elements[2]=n.elements[2],this.elements[3]=n.elements[3],this.elements[4]=n.elements[4],this.elements[5]=n.elements[5],this.elements[6]=n.elements[6],this.elements[7]=n.elements[7],this.elements[8]=n.elements[8],this.manual=n.manual,this.trigger(ne.Types.change)}identity(){return this.elements[0]=Pt.Identity[0],this.elements[1]=Pt.Identity[1],this.elements[2]=Pt.Identity[2],this.elements[3]=Pt.Identity[3],this.elements[4]=Pt.Identity[4],this.elements[5]=Pt.Identity[5],this.elements[6]=Pt.Identity[6],this.elements[7]=Pt.Identity[7],this.elements[8]=Pt.Identity[8],this.trigger(ne.Types.change)}multiply(n,r,o,s,a,l,c,d,u){if(typeof r>"u")return this.elements[0]*=n,this.elements[1]*=n,this.elements[2]*=n,this.elements[3]*=n,this.elements[4]*=n,this.elements[5]*=n,this.elements[6]*=n,this.elements[7]*=n,this.elements[8]*=n,this.trigger(ne.Types.change);if(typeof o>"u"&&(o=1),typeof s>"u"){n=n||0,r=r||0,o=o||0,a=this.elements;const W=a[0]*n+a[1]*r+a[2]*o,G=a[3]*n+a[4]*r+a[5]*o,Q=a[6]*n+a[7]*r+a[8]*o;return[W,G,Q]}const f=this.elements,m=[n,r,o,s,a,l,c,d,u],g=f[0],h=f[1],p=f[2],y=f[3],b=f[4],_=f[5],v=f[6],x=f[7],N=f[8],T=m[0],k=m[1],$=m[2],w=m[3],B=m[4],E=m[5],M=m[6],R=m[7],O=m[8];return this.elements[0]=g*T+h*w+p*M,this.elements[1]=g*k+h*B+p*R,this.elements[2]=g*$+h*E+p*O,this.elements[3]=y*T+b*w+_*M,this.elements[4]=y*k+b*B+_*R,this.elements[5]=y*$+b*E+_*O,this.elements[6]=v*T+x*w+N*M,this.elements[7]=v*k+x*B+N*R,this.elements[8]=v*$+x*E+N*O,this.trigger(ne.Types.change)}inverse(n){const r=this.elements;n=n||new Pt;const o=r[0],s=r[1],a=r[2],l=r[3],c=r[4],d=r[5],u=r[6],f=r[7],m=r[8],g=m*c-d*f,h=-m*l+d*u,p=f*l-c*u;let y=o*g+s*h+a*p;return y?(y=1/y,n.elements[0]=g*y,n.elements[1]=(-m*s+a*f)*y,n.elements[2]=(d*s-a*c)*y,n.elements[3]=h*y,n.elements[4]=(m*o-a*u)*y,n.elements[5]=(-d*o+a*l)*y,n.elements[6]=p*y,n.elements[7]=(-f*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=Zp(n),o=Qp(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=Zc(n);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(n){const r=Zc(n);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(n){return Es.length=0,this.toTransformArray(n,Es),Es.map(bn).join(" ")}toTransformArray(n,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(n){const m=o[6],g=o[7],h=o[8];if(s){r[0]=a,r[1]=d,r[2]=m,r[3]=l,r[4]=u,r[5]=g,r[6]=c,r[7]=f,r[8]=h;return}return[a,d,m,l,u,g,c,f,h]}if(s){r[0]=a,r[1]=d,r[2]=l,r[3]=u,r[4]=c,r[5]=f;return}return[a,d,l,u,c,f]}toArray(n,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(n){const m=o[6],g=o[7],h=o[8];if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f,r[6]=m,r[7]=g,r[8]=h;return}return[a,l,c,d,u,f,m,g,h]}if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f;return}return[a,l,c,d,u,f]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Pt().copy(this)}};S(Pt,"Identity",[1,0,0,0,1,0,0,0,1]);let br=Pt;Pp(br);const Ar=class Ar extends yr{constructor(){super();S(this,"_flagMatrix",!0);S(this,"_flagScale",!1);S(this,"_matrix",null);S(this,"_worldMatrix",null);S(this,"_position",null);S(this,"_rotation",0);S(this,"_scale",1);S(this,"_skewX",0);S(this,"_skewY",0);for(let n in go)Object.defineProperty(this,n,go[n]);this._renderer.flagMatrix=Qc.bind(this),this.isShape=!0,this.matrix=new br,this.worldMatrix=new br,this.position=new be,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(n){const r=new Ar().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 go.position.get.apply(this,arguments)}set translation(n){go.position.set.apply(this,arguments)}addTo(n){return n.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}copy(n){return super.copy.call(this,n),"position"in n&&(n.position instanceof be?this.position=n.position:this.position.copy(n.position)),"rotation"in n&&(this.rotation=n.rotation),"scale"in n&&(this.scale=typeof n.scale=="number"||n.scale instanceof be?n.scale:new be(n.scale.x,n.scale.y)),"skewX"in n&&(this.skewX=n.skewX),"skewY"in n&&(this.skewY=n.skewY),"matrix"in n&&n.matrix.manual&&(this.matrix.copy(n.matrix),this.matrix.manual=!0),this}clone(n){const r=new Ar;return r.position.copy(this.position),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer={type:"shape"},n.isShape=!0,n.translation=this.translation.toObject(),n.rotation=this.translation.rotation,n.scale=this.scale instanceof be?this.scale.toObject():this.scale,n.skewX=this.skewX,n.skewY=this.skewY,n.matrix=this.matrix.toObject(),n}_update(n){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof be?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),n&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};S(Ar,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let $n=Ar;const go={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),Qc.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof be&&this._scale.unbind(ne.Types.change,this._renderer.flagMatrix),this._scale=t,this._scale instanceof be&&this._scale.bind(ne.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(t){this._skewX=t,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(t){this._skewY=t,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(t){this._matrix=t,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return Fp(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function Qc(){this._flagMatrix=!0}const Yi=Math.min,Ui=Math.max,Jp=Math.ceil,ey=Math.floor,ty=new be,sn=class sn extends $n{constructor(n,r,o,s){super();S(this,"_flagVertices",!0);S(this,"_flagLength",!0);S(this,"_flagFill",!0);S(this,"_flagStroke",!0);S(this,"_flagLinewidth",!0);S(this,"_flagOpacity",!0);S(this,"_flagVisible",!0);S(this,"_flagCap",!0);S(this,"_flagJoin",!0);S(this,"_flagMiter",!0);S(this,"_flagStrokeAttenuation",!0);S(this,"_flagMask",!1);S(this,"_flagClip",!1);S(this,"_length",0);S(this,"_fill","#fff");S(this,"_stroke","#000");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_cap","round");S(this,"_join","round");S(this,"_miter",4);S(this,"_closed",!0);S(this,"_curved",!1);S(this,"_automatic",!0);S(this,"_beginning",0);S(this,"_ending",1);S(this,"_mask",null);S(this,"_clip",!1);S(this,"_dashes",null);S(this,"_strokeAttenuation",!0);for(let a in Jc)Object.defineProperty(this,a,Jc[a]);this._renderer.type="path",this._renderer.flagVertices=ed.bind(this),this._renderer.bindVertices=td.bind(this),this._renderer.unbindVertices=nd.bind(this),this._renderer.flagFill=id.bind(this),this._renderer.flagStroke=rd.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:gi(n.fill),o=typeof n.stroke=="string"?n.stroke:gi(n.stroke),s=new sn().copy({...n,fill:r,stroke:o});return"id"in n&&(s.id=n.id),s}copy(n){if(super.copy.call(this,n),n.vertices){this.vertices=[];for(let r=0;r<n.vertices.length;r++){const o=n.vertices[r];o instanceof Fe?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Fe().copy(o))}}for(let r=0;r<sn.Properties.length;r++){const o=sn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new sn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<sn.Properties.length;o++){const s=sn.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="path",n.vertices=this.vertices.map(r=>r.toObject()),Me.each(sn.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const n=this.getBoundingClientRect(!0),r=n.width/2,o=n.height/2,s=n.left+n.width/2,a=n.top+n.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=s,c.y-=a,c.x+=r,c.y+=o}return this.mask&&(this.mask.translation.x-=s,this.mask.translation.x+=r,this.mask.translation.y-=a,this.mask.translation.y+=o),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,o=n.top+n.height/2-this.translation.y;for(let s=0;s<this.vertices.length;s++){const a=this.vertices[s];a.x-=r,a.y-=o}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getBoundingClientRect(n){let r,o,s,a,l,c,d=1/0,u=-1/0,f=1/0,m=-1/0;if(this._update(!0),r=n?this.matrix:this.worldMatrix,o=(this.linewidth||0)/2,s=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:g,scaleY:h}=Rp(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof g=="number"&&typeof h=="number"&&(o=Math.max(g,h)*(this.linewidth||0)/2)}else o*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(s<=0)return{width:0,height:0};for(a=0;a<s;a++){c=this._renderer.vertices[a],l=this._renderer.vertices[(a+s-1)%s];const[g,h]=r.multiply(l.x,l.y),[p,y]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let b=l.controls.right.x,_=l.controls.right.y;l.relative&&(b+=l.x,_+=l.y);let[v,x]=r.multiply(b,_),N=c.controls.left.x,T=c.controls.left.y;c.relative&&(N+=c.x,T+=c.y);let[k,$]=r.multiply(N,T);const w=Ap(g,h,v,x,k,$,p,y);f=Yi(w.min.y-o,f),d=Yi(w.min.x-o,d),u=Ui(w.max.x+o,u),m=Ui(w.max.y+o,m)}else a<=1&&(f=Yi(h-o,f),d=Yi(g-o,d),u=Ui(g+o,u),m=Ui(h+o,m)),f=Yi(y-o,f),d=Yi(p-o,d),u=Ui(p+o,u),m=Ui(y+o,m)}return{top:f,left:d,right:u,bottom:m,width:u-d,height:m-f}}getPointAt(n,r){let o,s,a,l,c,d,u,f,m,g,h,p,y,b,_,v=this.length*Math.min(Math.max(n,0),1);const x=this.vertices.length,N=x-1;let T=null,k=null;for(let H=0,P=this._lengths.length,D=0;H<P;H++){if(D+this._lengths[H]>=v){this._closed?(o=Xi(H,x),s=Xi(H-1,x),H===0&&(o=s,s=H)):(o=H,s=Math.min(Math.max(H-1,0),N)),T=this.vertices[o],k=this.vertices[s],v-=D,this._lengths[H]!==0?n=v/this._lengths[H]:n=0;break}D+=this._lengths[H]}if(T===null||k===null)return null;if(T){if(!k)return T}else return k;_=k.controls&&k.controls.right,b=T.controls&&T.controls.left,c=k.x,g=k.y,d=(_||k).x,h=(_||k).y,u=(b||T).x,p=(b||T).y,f=T.x,y=T.y,_&&k.relative&&(d+=k.x,h+=k.y),b&&T.relative&&(u+=T.x,p+=T.y),l=uo(n,c,d,u,f),m=uo(n,g,h,p,y);const $=Gt(c,d,n),w=Gt(g,h,n),B=Gt(d,u,n),E=Gt(h,p,n),M=Gt(u,f,n),R=Gt(p,y,n),O=Gt($,B,n),W=Gt(w,E,n),G=Gt(B,M,n),Q=Gt(E,R,n);return Me.isObject(r)?(r.x=l,r.y=m,r instanceof Fe&&(r.controls.left.x=O,r.controls.left.y=W,r.controls.right.x=G,r.controls.right.y=Q,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=m,r.controls.right.x-=l,r.controls.right.y-=m)),r.t=n,r):(a=new Fe(l,m,O-l,W-m,G-l,Q-m,this._curved?pe.curve:pe.line),a.t=n,a)}plot(){if(this.curved)return zp(this._collection,this.closed),this;for(let n=0;n<this._collection.length;n++)this._collection[n].command=n===0?pe.move:pe.line;return this}subdivide(n){this._update();const r=this.vertices.length-1,o=this._closed||this.vertices[r]._command===pe.close;let s=this.vertices[r],a=[],l;return Me.each(this.vertices,function(c,d){if(d<=0&&!o){s=c;return}if(c.command===pe.move){a.push(new Fe(s.x,s.y)),d>0&&(a[a.length-1].command=pe.line),s=c;return}l=Gc(c,s,n),a=a.concat(l),Me.each(l,function(u,f){f<=0&&s.command===pe.move?u.command=pe.move:u.command=pe.line}),d>=r&&(this._closed&&this._automatic&&(s=c,l=Gc(c,s,n),a=a.concat(l),Me.each(l,function(u,f){f<=0&&s.command===pe.move?u.command=pe.move:u.command=pe.line})),a.push(new Fe(c.x,c.y)),a[a.length-1].command=o?pe.close:pe.line),s=c},this),this._automatic=!1,this._curved=!1,this.vertices=a,this}_updateLength(n,r){r||this._update();const s=this.vertices.length-1;let a=this.vertices[s],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),Me.each(this.vertices,function(c,d){if(d<=0||c.command===pe.move){a=c,this._lengths[d]=0;return}this._lengths[d]=Kc(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=mo(this,o*this._length),l=mo(this,s*this._length),c=Jp(a),d=ey(l);let u,f,m,g,h,p;for(this._renderer.vertices.length=0,p=0;p<n;p++)this._renderer.collection.length<=p&&this._renderer.collection.push(new Fe),p>d&&!f?(h=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(s,h),h.command=this._renderer.collection[p].command,this._renderer.vertices.push(h),f=h,m=this._collection[p-1],m&&m.controls&&(h.relative?h.controls.right.clear():h.controls.right.copy(h),m.relative?this._renderer.collection[p-1].controls.right.copy(m.controls.right).lerp(be.zero,1-h.t):this._renderer.collection[p-1].controls.right.copy(m.controls.right).lerp(m,1-h.t))):p>=c&&p<=d&&(h=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(h),p===d&&Uc(this,s)?(f=h,!r&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):p===c&&Uc(this,o)&&(u=h,u.command=pe.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(p=c-1,h=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(o,h),h.command=pe.move,this._renderer.vertices.unshift(h),g=this._collection[p+1],g&&g.controls&&(h.controls.left.clear(),g.relative?this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(be.zero,h.t):(ty.copy(g),this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(g,h.t))))}return $n.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,$n.prototype.flagReset.call(this),this}};S(sn,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),S(sn,"Utils",{getCurveLength:Kc});let Ie=sn;const Jc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.bind(ne.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=!!t,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t===this._automatic)return;this._automatic=!!t;const e=this._automatic?"ignore":"listen";Me.each(this.vertices,function(n){n[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ne.Types.insert,e).unbind(ne.Types.remove,n),t instanceof fi?this._collection=t:this._collection=new fi(t||[]),this._collection.bind(ne.Types.insert,e).bind(ne.Types.remove,n),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Me.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function ed(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function td(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function nd(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function id(){this._flagFill=!0}function rd(){this._flagStroke=!0}const ny=Math.ceil,iy=Math.floor,Sn=class Sn extends $n{constructor(n){super();S(this,"_flagVertices",!0);S(this,"_flagLength",!0);S(this,"_flagFill",!0);S(this,"_flagStroke",!0);S(this,"_flagLinewidth",!0);S(this,"_flagOpacity",!0);S(this,"_flagVisible",!0);S(this,"_flagSize",!0);S(this,"_flagSizeAttenuation",!0);S(this,"_flagStrokeAttenuation",!0);S(this,"_length",0);S(this,"_fill","#fff");S(this,"_stroke","#000");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_size",1);S(this,"_sizeAttenuation",!1);S(this,"_beginning",0);S(this,"_ending",1);S(this,"_dashes",null);S(this,"_strokeAttenuation",!0);S(this,"noFill",Ie.prototype.noFill);S(this,"noStroke",Ie.prototype.noStroke);S(this,"corner",Ie.prototype.corner);S(this,"center",Ie.prototype.center);S(this,"getBoundingClientRect",Ie.prototype.getBoundingClientRect);S(this,"_updateLength",Ie.prototype._updateLength);for(let r in od)Object.defineProperty(this,r,od[r]);this._renderer.type="points",this._renderer.flagVertices=ed.bind(this),this._renderer.bindVertices=td.bind(this),this._renderer.unbindVertices=nd.bind(this),this._renderer.flagFill=id.bind(this),this._renderer.flagStroke=rd.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:gi(n.fill),o=typeof n.stroke=="string"?n.stroke:gi(n.stroke),s=new Sn().copy({...n,fill:r,stroke:o});return"id"in n&&(s.id=n.id),s}copy(n){super.copy.call(this,n);for(let r=0;r<n.vertices.length;r++){const o=n.vertices[r];o instanceof Fe?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Fe().copy(o))}for(let r=0;r<Sn.Properties.length;r++){const o=Sn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Sn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Sn.Properties.length;o++){const s=Sn.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="points",n.vertices=this.vertices.map(r=>r.toObject()),Me.each(Sn.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];typeof r.unbind=="function"&&r.unbind()}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}subdivide(n){this._update();let r=[];for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o],a=this.vertices[o-1];if(!a)continue;const l=s.x,c=s.y,d=a.x,u=a.y,f=zc(l,c,l,c,d,u,d,u,n);r=r.concat(f)}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=mo(this,n*this._length),s=mo(this,r*this._length),a=ny(o),l=iy(s);let c=0,d;this._renderer.vertices=[],this._renderer.collection=[];for(let u=0;u<this._collection.length;u++)u>=a&&u<=l&&(d=this._collection[u],this._renderer.collection.push(d),this._renderer.vertices[c*2+0]=d.x,this._renderer.vertices[c*2+1]=d.y,c++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};S(Sn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let po=Sn;const od={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(t){this._sizeAttenuation=t,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.bind(ne.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ne.Types.insert,e).unbind(ne.Types.remove,n),t instanceof fi?this._collection=t:this._collection=new fi(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 sd extends fi{constructor(n){n=Array.isArray(n)?n:Array.prototype.slice.call(arguments);super(n);Ka(this,Wo,{});this.attach(n),this.on(ne.Types.insert,this.attach),this.on(ne.Types.remove,this.detach)}get ids(){return Vt(this,Wo)}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}}Wo=new WeakMap;const Vn=class Vn extends Ie{constructor(n,r,o,s,a,l,c){const d=c||$s.Resolution*3,u=[];for(let f=0;f<d;f++)u.push(new Fe);super(u,!0,!1,!0);S(this,"_flagStartAngle",!1);S(this,"_flagEndAngle",!1);S(this,"_flagInnerRadius",!1);S(this,"_flagOuterRadius",!1);S(this,"_startAngle",0);S(this,"_endAngle",hi);S(this,"_innerRadius",0);S(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let f in ad)Object.defineProperty(this,f,ad[f]);typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.startAngle=a),typeof l=="number"&&(this.endAngle=l),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Vn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Vn.Properties.length;r++){const o=Vn.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const n=this._startAngle,r=this._endAngle,o=this._innerRadius,s=this._outerRadius,a=Xi(n,hi)===Xi(r,hi),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,f=0,m,g,h,p,y,b,_,v,x;for(a?d--:l||(d-=2),m=0,g=d-1;m<d;m++){switch(h=m/g,p=c[f],y=h*(r-n)+n,b=(r-n)/d,_=s*Math.cos(y),v=s*Math.sin(y),m){case 0:u=pe.move;break;default:u=pe.curve}p.command=u,p.x=_,p.y=v,p.controls.left.clear(),p.controls.right.clear(),p.command===pe.curve&&(x=s*b/Math.PI,p.controls.left.x=x*Math.cos(y-dt),p.controls.left.y=x*Math.sin(y-dt),p.controls.right.x=x*Math.cos(y+dt),p.controls.right.y=x*Math.sin(y+dt),m===1&&p.controls.left.multiplyScalar(2),m===g&&p.controls.right.multiplyScalar(2)),f++}if(l){for(a?(c[f].command=pe.close,f++):(d--,g=d-1),m=0;m<d;m++)h=m/g,p=c[f],y=(1-h)*(r-n)+n,b=(r-n)/d,_=o*Math.cos(y),v=o*Math.sin(y),u=pe.curve,m<=0&&(u=a?pe.move:pe.line),p.command=u,p.x=_,p.y=v,p.controls.left.clear(),p.controls.right.clear(),p.command===pe.curve&&(x=o*b/Math.PI,p.controls.left.x=x*Math.cos(y+dt),p.controls.left.y=x*Math.sin(y+dt),p.controls.right.x=x*Math.cos(y-dt),p.controls.right.y=x*Math.sin(y-dt),m===1&&p.controls.left.multiplyScalar(2),m===g&&p.controls.right.multiplyScalar(2)),f++;c[f].copy(c[0]),c[f].command=pe.line}else a||(c[f].command=pe.line,c[f].x=0,c[f].y=0,f++,c[f].copy(c[0]),c[f].command=pe.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(n){const r=this.innerRadius,o=this.outerRadius,s=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new Vn(0,0,r,o,s,a,l);c.translation.copy(this.translation),c.rotation=this.rotation,c.scale=this.scale,c.skewX=this.skewX,c.skewY=this.skewY,this.matrix.manual&&c.matrix.copy(this.matrix);for(let d=0;d<Ie.Properties.length;d++){const u=Ie.Properties[d];c[u]=this[u]}return n&&n.add(c),c}toObject(){const n=super.toObject.call(this);n.renderer.type="arc-segment";for(let r=0;r<Vn.Properties.length;r++){const o=Vn.Properties[r];n[o]=this[o]}return n}};S(Vn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let Rs=Vn;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}}},Ps=Math.cos,Fs=Math.sin,Mn=class Mn extends Ie{constructor(n,r,o,s){const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Fe(0,0,0,0,0,0));super(l,!0,!0,!0);S(this,"_flagRadius",!1);S(this,"_radius",0);this._renderer.type="circle";for(let c in ld)Object.defineProperty(this,c,ld[c]);typeof o=="number"&&(this.radius=o),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Mn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Mn.Properties.length;r++){const o=Mn.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagRadius){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(n*2)),o=this._radius,s=o*r;for(let a=0;a<this.vertices.length;a++){const c=a/n*hi,d=o*Ps(c),u=o*Fs(c),f=s*Ps(c-dt),m=s*Fs(c-dt),g=s*Ps(c+dt),h=s*Fs(c+dt),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(f,m),p.controls.right.set(g,h)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=new Mn(0,0,this.radius,this.vertices.length);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ie.Properties.length;o++){const s=Ie.Properties[o];r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="circle";for(let r=0;r<Mn.Properties.length;r++){const o=Mn.Properties[r];n[o]=this[o]}return n}};S(Mn,"Properties",["radius"]);let Vs=Mn;const ld={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},Ms=Math.cos,Is=Math.sin,In=class In extends Ie{constructor(n,r,o,s,a){typeof s!="number"&&typeof o=="number"&&(s=o);const l=a?Math.max(a,2):4,c=[];for(let d=0;d<l;d++)c.push(new Fe);super(c,!0,!0,!0);S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_width",0);S(this,"_height",0);this._renderer.type="ellipse";for(let d in cd)Object.defineProperty(this,d,cd[d]);typeof o=="number"&&(this.width=o*2),typeof s=="number"&&(this.height=s*2),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new In().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<In.Properties.length;r++){const o=In.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(this.vertices.length*2)),o=this._width/2,s=this._height/2;for(let a=0;a<this.vertices.length;a++){const c=a/n*hi,d=o*Ms(c),u=s*Is(c),f=o*r*Ms(c-dt),m=s*r*Is(c-dt),g=o*r*Ms(c+dt),h=s*r*Is(c+dt),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(f,m),p.controls.right.set(g,h)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=this.width/2,o=this.height/2,s=this.vertices.length,a=new In(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ie.Properties.length;l++){const c=Ie.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="ellipse";for(let r=0;r<In.Properties.length;r++){const o=In.Properties[r];n[o]=this[o]}return n}};S(In,"Properties",["width","height"]);let As=In;const cd={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}}},ry=Math.cos,oy=Math.sin,An=class An extends Ie{constructor(n,r,o,s){s=Math.max(s||0,3);super();S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_flagSides",!1);S(this,"_radius",0);S(this,"_width",0);S(this,"_height",0);S(this,"_sides",0);this._renderer.type="polygon";for(let a in dd)Object.defineProperty(this,a,dd[a]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.radius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new An().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<An.Properties.length;r++){const o=An.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const n=this._sides,r=n+1;let o=this.vertices.length;o>n&&(this.vertices.splice(n-1,o-n),o=n);for(let s=0;s<r;s++){const a=(s+.5)/n,l=hi*a+Math.PI/2,c=this._width*ry(l)/2,d=this._height*oy(l)/2;s>=o?this.vertices.push(new Fe(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?pe.move:pe.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=new An(0,0,0,this.sides);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,r.width=this.width,r.height=this.height,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ie.Properties.length;o++){const s=Ie.Properties[o];r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="polygon";for(let r=0;r<An.Properties.length;r++){const o=An.Properties[r];n[o]=this[o]}return n}};S(An,"Properties",["width","height","sides"]);let Os=An;const dd={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}}},$i=class $i extends Ie{constructor(n,r,o,s){const a=[new Fe,new Fe,new Fe,new Fe];super(a,!0,!1,!0);S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_width",0);S(this,"_height",0);S(this,"_origin",null);this._renderer.type="rectangle";for(let l in ud)Object.defineProperty(this,l,ud[l]);this.width=typeof o=="number"?o:1,this.height=typeof s=="number"?s:1,this.origin=new be,typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(n){const r=new $i().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<$i.Properties.length;r++){const o=$i.Properties[r];o in n&&(typeof n[o]=="number"?this[o]=n[o]:this[o]instanceof be&&this[o].copy(n[o]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const n=this._width/2,r=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Fe),this.vertices[0].set(-n,-r).sub(this._origin).command=pe.move,this.vertices[1].set(n,-r).sub(this._origin).command=pe.line,this.vertices[2].set(n,r).sub(this._origin).command=pe.line,this.vertices[3].set(-n,r).sub(this._origin).command=pe.line,this.vertices[4]&&(this.vertices[4].set(-n,-r).sub(this._origin).command=pe.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=new $i(0,0,this.width,this.height);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ie.Properties.length;o++){const s=Ie.Properties[o];r[s]instanceof be?r[s].copy(this[s]):r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="rectangle",n.width=this.width,n.height=this.height,n.origin=this.origin.toObject(),n}};S($i,"Properties",["width","height","origin"]);let _r=$i;const ud={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(t){this._origin&&this._origin.unbind(ne.Types.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(ne.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},On=class On extends Ie{constructor(n,r,o,s,a){typeof a>"u"&&typeof o=="number"&&typeof s=="number"&&(a=Math.floor(Math.min(o,s)/12));const l=[];for(let c=0;c<10;c++)l.push(new Fe(0,0,0,0,0,0,c===0?pe.move:pe.curve));super(l);S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_flagRadius",!1);S(this,"_width",0);S(this,"_height",0);S(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in hd)Object.defineProperty(this,c,hd[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=sy.bind(this),typeof o=="number"&&(this.width=o),typeof s=="number"&&(this.height=s),(typeof a=="number"||a instanceof be)&&(this.radius=a),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new On().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<On.Properties.length;r++){const o=On.Properties[r];if(o in n){const s=n[o];/radius/i.test(o)?this[o]=typeof s=="number"||s instanceof be?s:new be().copy(s):typeof s=="number"&&(this[o]=s)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const n=this._width,r=this._height;let o,s;this._radius instanceof be?(o=this._radius.x,s=this._radius.y):(o=this._radius,s=this._radius);let a,l=n/2,c=r/2;a=this.vertices[0],a.x=-(l-o),a.y=-c,a=this.vertices[1],a.x=l-o,a.y=-c,a.controls.left.clear(),a.controls.right.x=o,a.controls.right.y=0,a=this.vertices[2],a.x=l,a.y=-(c-s),a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[3],a.x=l,a.y=c-s,a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=s,a=this.vertices[4],a.x=l-o,a.y=c,a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[5],a.x=-(l-o),a.y=c,a.controls.left.clear(),a.controls.right.x=-o,a.controls.right.y=0,a=this.vertices[6],a.x=-l,a.y=c-s,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[7],a.x=-l,a.y=-(c-s),a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=-s,a=this.vertices[8],a.x=-(l-o),a.y=-c,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[9],a.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=this.width,o=this.height,s=this.radius,a=new On(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ie.Properties.length;l++){const c=Ie.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="rounded-rectangle";for(let r=0;r<On.Properties.length;r++){const o=On.Properties[r];n[o]=this[o]}return n.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),n}};S(On,"Properties",["width","height","radius"]);let zs=On;const hd={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof be&&this._radius.unbind(ne.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof be&&this._radius.bind(ne.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function sy(){this._flagRadius=!0}const ay=Math.cos,ly=Math.sin,zn=class zn extends Ie{constructor(n,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();S(this,"_flagInnerRadius",!1);S(this,"_flagOuterRadius",!1);S(this,"_flagSides",!1);S(this,"_innerRadius",0);S(this,"_outerRadius",0);S(this,"_sides",0);this._renderer.type="star";for(let l in fd)Object.defineProperty(this,l,fd[l]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.sides=a),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new zn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<zn.Properties.length;r++){const o=zn.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const n=this._sides*2,r=n+1;let o=this.vertices.length;o>n&&(this.vertices.splice(n-1,o-n),o=n);for(let s=0;s<r;s++){const a=(s+.5)/n,l=hi*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*ay(l),u=c*ly(l);s>=o?this.vertices.push(new Fe(d,u)):this.vertices[s].set(d,u),this.vertices[s].command=s===0?pe.move:pe.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=this.innerRadius,o=this.outerRadius,s=this.sides,a=new zn(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ie.Properties.length;l++){const c=Ie.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="star";for(let r=0;r<zn.Properties.length;r++){const o=zn.Properties[r];n[o]=this[o]}return n}};S(zn,"Properties",["innerRadius","outerRadius","sides"]);let Ds=zn;const fd={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 Ls;const md=Math.min,gd=Math.max;yn.document&&(Ls=document.createElement("canvas"));const Ct=class Ct extends $n{constructor(n,r,o,s){super();S(this,"_flagValue",!0);S(this,"_flagFamily",!0);S(this,"_flagSize",!0);S(this,"_flagLeading",!0);S(this,"_flagAlignment",!0);S(this,"_flagBaseline",!0);S(this,"_flagStyle",!0);S(this,"_flagWeight",!0);S(this,"_flagDecoration",!0);S(this,"_flagFill",!0);S(this,"_flagStroke",!0);S(this,"_flagLinewidth",!0);S(this,"_flagOpacity",!0);S(this,"_flagVisible",!0);S(this,"_flagMask",!1);S(this,"_flagClip",!1);S(this,"_flagDirection",!0);S(this,"_flagStrokeAttenuation",!0);S(this,"_value","");S(this,"_family","sans-serif");S(this,"_size",13);S(this,"_leading",17);S(this,"_alignment","center");S(this,"_baseline","middle");S(this,"_style","normal");S(this,"_weight",500);S(this,"_decoration","none");S(this,"_direction","ltr");S(this,"_fill","#000");S(this,"_stroke","none");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_mask",null);S(this,"_clip",!1);S(this,"_dashes",null);S(this,"_strokeAttenuation",!0);for(let a in pd)Object.defineProperty(this,a,pd[a]);if(this._renderer.type="text",this._renderer.flagFill=cy.bind(this),this._renderer.flagStroke=dy.bind(this),this.value=n,typeof r=="number"&&(this.translation.x=r),typeof o=="number"&&(this.translation.y=o),this.dashes=[],this.dashes.offset=0,!Me.isObject(s))return this;for(let a=0;a<Ct.Properties.length;a++){const l=Ct.Properties[a];l in s&&(this[l]=s[l])}}static Measure(n){if(Ls){const r=Ls.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*Ct.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:gi(n.fill),o=typeof n.stroke=="string"?n.stroke:gi(n.stroke),s=new Ct().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<Ct.Properties.length;r++){const o=Ct.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Ct(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<Ct.Properties.length;o++){const s=Ct.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<Ct.Properties.length;r++){const o=Ct.Properties[r];n[o]=this[o]}return n}dispose(){return super.dispose(),typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(n){let r,o,s,a,l;this._update(!0),r=n?this.matrix:this.worldMatrix;const{width:c,height:d}=Ct.Measure(this),u=(this._linewidth||0)/2;switch(this.alignment){case"left":o=-u,s=c+u;break;case"right":o=-(c+u),s=u;break;default:o=-(c/2+u),s=c/2+u}switch(this.baseline){case"middle":a=-(d/2+u),l=d/2+u;break;default:a=-(d+u),l=u}const[f,m]=r.multiply(o,a),[g,h]=r.multiply(o,l),[p,y]=r.multiply(s,a),[b,_]=r.multiply(s,l);return a=md(m,h,y,_),o=md(f,g,p,b),s=gd(f,g,p,b),l=gd(m,h,y,_),{top:a,left:o,right:s,bottom:l,width:s-o,height:l-a}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};S(Ct,"Ratio",.6),S(Ct,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let Ki=Ct;const pd={value:{enumerable:!0,get:function(){return this._value},set:function(t){this._value=t,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(t){this._family=t,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(t){this._leading=t,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(t){this._alignment=t,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(t){this._style=t,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(t){this._weight=t,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(t){this._decoration=t,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(t){this._direction=t,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(t){this._baseline=t,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.bind(ne.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Me.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function cy(){this._flagFill=!0}function dy(){this._flagStroke=!0}const Dn=class Dn extends _r{constructor(n,r,o,s){super(r,o,0,0);S(this,"_flagTextures",!1);S(this,"_flagFrameRate",!1);S(this,"_flagIndex",!1);S(this,"_amount",1);S(this,"_duration",0);S(this,"_index",0);S(this,"_startTime",0);S(this,"_playing",!1);S(this,"_firstFrame",0);S(this,"_lastFrame",0);S(this,"_loop",!0);S(this,"_textures",null);S(this,"_frameRate",0);S(this,"_origin",null);this._renderer.type="image-sequence";for(let a in yd)Object.defineProperty(this,a,yd[a]);this._renderer.flagTextures=uy.bind(this),this._renderer.bindTextures=hy.bind(this),this._renderer.unbindTextures=fy.bind(this),this.noStroke(),this.noFill(),Array.isArray(n)?this.textures=n.map(bd.bind(this)):typeof n=="string"&&(this.textures=[bd(n)]),this.origin=new be,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=Dn.DefaultFrameRate,this.index=0}static fromObject(n){const r=new Dn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Dn.Properties.length;r++){const o=Dn.Properties[r];o in n&&(this[o]=n[o])}return this}play(n,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=Me.performance.now(),typeof n=="number"&&(this._firstFrame=n),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(n){const r=new Dn(this.textures,this.translation.x,this.translation.y,this.frameRate);return r._loop=this._loop,this._playing&&r.play(),n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="image-sequence",n.textures=this.textures.map(function(r){return r.toObject()}),n.frameRate=this.frameRate,n.index=this.index,n.firstFrame=this.firstFrame,n.lastFrame=this.lastFrame,n.loop=this.loop,n}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let n=0;n<this.textures.length;n++){const r=this.textures[n];typeof r.dispose=="function"?r.dispose():typeof r.unbind=="function"&&r.unbind()}return this}_update(){const n=this._textures;let r,o,s,a,l,c,d,u;return n&&(this._flagTextures&&(this._amount=n.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(a=this._amount,Me.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=Me.performance.now()-this._startTime,u=this._lastFrame+1,l=1e3*(u-this._firstFrame)/this._frameRate,this._loop?s=s%l:s=Math.min(s,l),d=Gt(this._firstFrame,u,s/l),d=Math.floor(d),d!==this._index&&(this._index=d,c=n[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o),this.fill=c,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof Ge))&&(c=n[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o)),this.fill=c)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(Dn,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),S(Dn,"DefaultFrameRate",30);let Hs=Dn;const yd={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 fi((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 uy(){this._flagTextures=!0}function hy(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function fy(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function bd(t){if(t instanceof Ge)return t;if(typeof t=="string")return new Ge(t)}const Ei=class Ei extends _r{constructor(n,r,o,s,a,l){super(r,o,0,0);S(this,"_flagTexture",!1);S(this,"_flagColumns",!1);S(this,"_flagRows",!1);S(this,"_flagFrameRate",!1);S(this,"_flagIndex",!1);S(this,"_amount",1);S(this,"_duration",0);S(this,"_startTime",0);S(this,"_playing",!1);S(this,"_firstFrame",0);S(this,"_lastFrame",0);S(this,"_loop",!0);S(this,"_texture",null);S(this,"_columns",1);S(this,"_rows",1);S(this,"_frameRate",0);S(this,"_index",0);S(this,"_origin",null);this._renderer.type="sprite";for(let c in _d)Object.defineProperty(this,c,_d[c]);this.noStroke(),this.noFill(),n instanceof Ge?this.texture=n:typeof n=="string"&&(this.texture=new Ge(n)),this.origin=new be,this._update(),typeof s=="number"&&(this.columns=s),typeof a=="number"&&(this.rows=a),typeof l=="number"&&(this.frameRate=l),this.index=0}static fromObject(n){const r=new Ei().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Ei.Properties.length;r++){const o=Ei.Properties[r];o in n&&(this[o]=n[o])}return this}play(n,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=Me.performance.now(),typeof n=="number"&&(this._firstFrame=n),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(n){const r=new Ei(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,f,m,g;if(n&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=n),n.loaded)){f=n.image.width,m=n.image.height,s=f/r,a=m/o,c=this._amount,this.width!==s&&(this.width=s),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&(Me.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=Me.performance.now()-this._startTime,g=this._lastFrame+1,d=1e3*(g-this._firstFrame)/this._frameRate,this._loop?l=l%d:l=Math.min(l,d),u=Gt(this._firstFrame,g,l/d),u=Math.floor(u),u!==this._index&&(this._index=u,u>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const h=this._index%r,p=Math.floor(this._index/r),y=-s*h+(f-s)/2,b=-a*p+(m-a)/2;y!==n.offset.x&&(n.offset.x=y),b!==n.offset.y&&(n.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(Ei,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let Ws=Ei;const _d={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}}},yo=Math.min,bo=Math.max,an=class an extends $n{constructor(n){super();S(this,"_flagAdditions",!1);S(this,"_flagSubtractions",!1);S(this,"_flagOrder",!1);S(this,"_flagOpacity",!0);S(this,"_flagBeginning",!1);S(this,"_flagEnding",!1);S(this,"_flagLength",!1);S(this,"_flagMask",!1);S(this,"_fill","#fff");S(this,"_stroke","#000");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_cap","round");S(this,"_join","round");S(this,"_miter",4);S(this,"_closed",!0);S(this,"_curved",!1);S(this,"_automatic",!0);S(this,"_beginning",0);S(this,"_ending",1);S(this,"_length",0);S(this,"_mask",null);S(this,"_strokeAttenuation",!0);for(let r in wd)Object.defineProperty(this,r,wd[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++)xd.call(this,n[r],this)}static RemoveChildren(n){for(let r=0;r<n.length;r++)xd.call(this,n[r])}static OrderChildren(n){this._flagOrder=!0}static fromObject(n){const r=new an;for(let s=0;s<an.Properties.length;s++){const a=an.Properties[s];a in n&&(/(fill|stroke)/i.test(a)?r[a]=typeof n[a]=="string"?n[a]:gi(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 Rs.fromObject(s);case"circle":return Vs.fromObject(s);case"element":return yr.fromObject(s);case"ellipse":return As.fromObject(s);case"group":return an.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Hs.fromObject(s);case"path":return Ie.fromObject(s);case"points":return po.fromObject(s);case"polygon":return Os.fromObject(s);case"rectangle":return _r.fromObject(s);case"rounded-rectangle":return zs.fromObject(s);case"shape":return $n.fromObject(s);case"sprite":return Ws.fromObject(s);case"star":return Ds.fromObject(s);case"text":return Ki.fromObject(s)}return s}}copy(n){super.copy.call(this,n),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let r=0;r<an.Properties.length;r++){const o=an.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new an,o=this.children.map(function(s){return s.clone()});return r.add(o),r.opacity=this.opacity,this.mask&&(r.mask=this.mask),r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.className=this.className,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="group",n.children=[],n.opacity=this.opacity,n.className=this.className,n.mask=this.mask?this.mask.toObject():null,Me.each(this.children,(r,o)=>{n.children[o]=r.toObject()},this),n}dispose(){if(super.dispose(),this.children)for(let n=0;n<this.children.length;n++){const r=this.children[n];typeof r.dispose=="function"&&r.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}corner(){const n=this.getBoundingClientRect(!0);for(let r=0;r<this.children.length;r++){const o=this.children[r];o.translation.x-=n.left,o.translation.y-=n.top}return this.mask&&(this.mask.translation.x-=n.left,this.mask.translation.y-=n.top),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,o=n.top+n.height/2-this.translation.y;for(let s=0;s<this.children.length;s++){const a=this.children[s];a.isShape&&(a.translation.x-=r,a.translation.y-=o)}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getById(n){let r=null;function o(s){if(s.id===n)return s;if(s.children){if(s.children.ids[n])return s.children.ids[n];for(let a=0;a<s.children.length;a++)if(r=o(s.children[a]),r)return r}return null}return o(this)}getByClassName(n){const r=[];function o(s){if(Array.prototype.indexOf.call(s.classList,n)>=0&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}getByType(n){const r=[];function o(s){if(s instanceof n&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}add(n){n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let r=0;r<n.length;r++){const o=n[r];if(!(o&&o.id))continue;const s=Array.prototype.indexOf.call(this.children,o);s>=0&&this.children.splice(s,1),this.children.push(o)}return this}remove(n){const r=arguments.length,o=this.parent;if(r<=0&&o)return o.remove(this),this;n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let s=0;s<n.length;s++){const a=n[s];if(!a||!this.children.ids[a.id])continue;const l=this.children.indexOf(a);l>=0&&this.children.splice(l,1)}return this}getBoundingClientRect(n){let r,o,s,a,l,c;this._update(!0);let d=1/0,u=-1/0,f=1/0,m=-1/0;const g=/texture|gradient/i;o=n?this.matrix:this.worldMatrix;for(let h=0;h<this.children.length;h++){const p=this.children[h];if(!(!p.visible||g.test(p._renderer.type))&&(r=p.getBoundingClientRect(n),s=typeof r.top!="number"||Me.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||Me.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||Me.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||Me.isNaN(r.bottom)||!isFinite(r.bottom),!(s||a||l||c)))if(n){const[y,b]=o.multiply(r.left,r.top),[_,v]=o.multiply(r.right,r.top),[x,N]=o.multiply(r.left,r.bottom),[T,k]=o.multiply(r.right,r.bottom);f=yo(b,v,N,k,f),d=yo(y,_,x,T,d),u=bo(y,_,x,T,u),m=bo(b,v,N,k,m)}else f=yo(r.top,f),d=yo(r.left,d),u=bo(r.right,u),m=bo(r.bottom,m)}return{top:f,left:d,right:u,bottom:m,width:u-d,height:m-f}}noFill(){return this.children.forEach(function(n){n.noFill()}),this}noStroke(){return this.children.forEach(function(n){n.noStroke()}),this}subdivide(){const n=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,n)}),this}_update(){let n,r,o;if(this._flagBeginning||this._flagEnding){const s=Math.min(this._beginning,this._ending),a=Math.max(this._beginning,this._ending),l=this.length;let c=0;const d=s*l,u=a*l;for(n=0;n<this.children.length;n++)o=this.children[n],r=o.length,d>c+r?(o.beginning=1,o.ending=1):u<c?(o.beginning=0,o.ending=0):d>c&&d<c+r?(o.beginning=(d-c)/r,o.ending=1):u>c&&u<c+r?(o.beginning=0,o.ending=(u-c)/r):(o.beginning=0,o.ending=1),c+=r}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};S(an,"Children",sd),S(an,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let En=an;const wd={visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._flagVisible=this._visible!==t||this._flagVisible,this._visible=t}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!==t||this._flagOpacity,this._opacity=t}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._flagBeginning=this._beginning!==t||this._flagBeginning,this._beginning=t}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._flagEnding=this._ending!==t||this._flagEnding,this._ending=t}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let t=0;t<this.children.length;t++){const e=this.children[t];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){this._fill=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.fill=t}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){this._stroke=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.stroke=t}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.linewidth=t}}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.join=t}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.miter=t}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.cap=t}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.closed=t}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.curved=t}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){this._automatic=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.automatic=t}}},children:{enumerable:!0,get:function(){return this._children},set:function(t){const e=En.InsertChildren.bind(this),n=En.RemoveChildren.bind(this),r=En.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new sd(t),this._children.bind(ne.Types.insert,e),this._children.bind(ne.Types.remove,n),this._children.bind(ne.Types.order,r),t.length>0&&e(t)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Me.isObject(t)&&!t.clip&&(t.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.strokeAttenuation!==void 0&&(n.strokeAttenuation=t)}}}};function xd(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 _o extends Ie{constructor(e,n,r,o){const s=[new Fe(e,n),new Fe(r,o)];super(s);for(let a in kd)Object.defineProperty(this,a,kd[a]);this.vertices[0].command=pe.move,this.vertices[1].command=pe.line,this.automatic=!1}}S(_o,"Properties",["left","right"]);const kd={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if(Me.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=pe.move;else{const e=new ho("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(t){if(Me.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=pe.line;else{const e=new ho("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class js{constructor(e=0,n=0){this.x=e,this.y=n}}class _n{constructor(e=10,n=0,r="A"){S(this,"start",new js);S(this,"end",new js);this.width=e,this.angle=n,this.label=r}}const je={line:{color:"#000",size:5},previewLine:{color:"#000",size:2},anchorPoint:{color:"#FF8000",size:12,strokeSize:20},lineLabel:{color:"#FF8000",size:22,rotation:-.5},angleLabel:{size:22,color:"#088c00",rotation:-.5},colorSideLabel:{size:20,color:"#439227"}},my={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function gy(t,e){return i.openBlock(),i.createElementBlock("svg",my,[...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 wo=i.markRaw({name:"ion-close",render:gy}),py={class:"mr-3 flex flex-col gap-2"},yy=["onClick"],by={class:"h-full p-2"},_y={},wy=i.defineComponent({..._y,__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,f)=>{var g;const m=(g=o.value)==null?void 0:g.at(f);m&&a("init-draw-template",m,u)}),(d=n.settings.customTemplates)==null||d.forEach((u,f)=>{var g;const m=(g=s.value)==null?void 0:g.at(f);m&&a("init-draw-template",m,u)})}),i.watch(()=>[...n.settings.customTemplates],(c,d)=>{i.nextTick(()=>{c.forEach((u,f)=>{var m;if(!(d!=null&&d.includes(u))){const g=(m=s.value)==null?void 0:m.at(f);g&&a("init-draw-template",g,u)}}),d.length>c.length&&d.forEach((u,f)=>{var g;const m=(g=s.value)==null?void 0:g.at(f);m&&(m.innerHTML="",a("init-draw-template",m,u))})})},{deep:!0}),(c,d)=>{const u=wo;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",py,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.settings.allTemplates,(f,m)=>(i.openBlock(),i.createElementBlock("div",{key:`${f.id}-${m}`,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":m===t.selectTemplateIndex}]),onClick:g=>a("template:select",m)},[i.createElementVNode("div",by,[i.createElementVNode("div",{ref_for:!0,ref:f.isCustom&&f.id!==-1?"drawing-custom-template-containers":"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,yy)]),default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(f.label),1)]),_:2},1024),f.isCustom&&!f.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:g=>l(m)},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),vd=qn(wy,[["__scopeId","data-v-afccb364"]]),xy={class:"flex gap-3 min-w-[20rem] relative"},ky={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},vy={ref:"drawing-container",class:"size-full"},Cy={},Cd=i.defineComponent({...Cy,__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((H,P)=>new _n(n.value.configuratorParams.linesWidths[P],H,`A-${P+1}`))),f=i.computed(()=>n.value.configuratorParams.colorSide==="bottom"),m=i.computed(()=>{var H,P;return n.value.configuratorParams.startTailType&&((H=n.settings.startTailConfigs)!=null&&H[n.value.configuratorParams.startTailType])?(P=n.settings.startTailConfigs)==null?void 0:P[n.value.configuratorParams.startTailType].points:[]}),g=i.computed(()=>{var P;const H=n.value.configuratorParams.endTailType!==void 0&&((P=n.settings.endTailConfigs)==null?void 0:P[n.value.configuratorParams.endTailType]);return!H||!H.points?[]:H.points.map((D,A)=>Array.isArray(D)?new _n(D[0],D[1],`A-${A+1}`):new _n(D.width,D.angle,`A-${A+1}`))}),h=(H,P=!1)=>{H[0].start.x=0,H[0].start.y=0;let D=0;for(let A=0;A<H.length;A++){const L=H[A],U=H[A-1]??new _n(0,D);D+=!P||A>1?U.angle:0;const K=(!P||A>0?L.angle:0)+D;if(H[A].end.x=L.width*Math.cos(K*Math.PI/180)+H[A].start.x,H[A].end.y=L.width*Math.sin(K*Math.PI/180)+H[A].start.y,A<H.length-1){const V=A+1;H[V].start.x=H[A].end.x,H[V].start.y=H[A].end.y}}return H},p=(H,P,D,A,L=!1)=>{let U=h([...D,...A]);P.length>0&&(U=[...h(P),...U]);let K=0,V=0,q=0,Y=0;U.forEach(Te=>{K=Math.min(K,Te.start.x,Te.end.x),V=Math.min(V,Te.start.y,Te.end.y),q=Math.max(q,Te.start.x,Te.end.x),Y=Math.max(Y,Te.start.y,Te.end.y)});let te,ue;K===0&&V===0&&q===0&&Y===0?(te=1,ue=1):(te=H.width/Math.abs(q-K),ue=(L?H.height:H.height-je.colorSideLabel.size)/Math.abs(Y-V));const ve=Math.min(te,ue);return K=K<0?-K*ve:0,V=V<0?-V*ve:0,[ve,K,V]},y=H=>{const P=new po([H]);return P._size=je.anchorPoint.size,P.fill=je.anchorPoint.color,P.stroke="transparent",P._linewidth=je.anchorPoint.strokeSize,l.push(P),P},b=(H,P)=>{if(l=[],n.settings.allowChangeFirstPoint){const D=H[0],A=new be(D.vertices[0].x,D.vertices[0].y);A.bind(ne.Types.change,()=>{D.vertices[0].copy(A)});const L=y(A);P.add(L)}H.forEach((D,A)=>{const L=H[A+1],U=new be(D.vertices[1].x,D.vertices[1].y);U.bind(ne.Types.change,()=>{D.vertices[1].copy(U),L!==void 0&&L.vertices[0].copy(U)});const K=y(U);P.add(K)})},_=H=>H*(Math.PI/180),v=(H,P,D)=>{const A=P.vertices.length-1;H.position.x=P.vertices[A].x,H.position.y=P.vertices[A].y;const L=Math.atan2(P.vertices[A].y-P.vertices[0].y,P.vertices[A].x-P.vertices[0].x);H.rotation=_(D)+L},x=(H,P,D)=>{if(P.vertices[0]===void 0)return;H.position.x=P.vertices[0].x,H.position.y=P.vertices[0].y;const A=P.vertices.length-1,L=Math.atan2(P.vertices[A].y-P.vertices[0].y,P.vertices[A].x-P.vertices[0].x);H.rotation=_(D)+L},N=(H,P,D)=>{const A=new En;if(H.length===0)return A;const L=[];return[...H].reverse().forEach((U,K)=>{K!==0&&U.angle>0&&(U.angle*=-1),L.push(U)}),H=h(L,!0),x(A,P,H[0].angle),[P.vertices[0],P.vertices[1]].forEach(U=>{U.bind(ne.Types.change,()=>{x(A,P,H[0].angle)})}),H.forEach(U=>{const K=U.start.x*D,V=U.end.x*D,q=U.start.y*D,Y=U.end.y*D,te=new _o(K,q,V,Y);te.linewidth=je.line.size,te.stroke=je.line.color,A.add(te)}),A},T=(H,P,D)=>{const A=new En;return H.length===0||(H=h(H,!0),v(A,P,H[0].angle),[P.vertices[0],P.vertices[1]].forEach(L=>{L.bind(ne.Types.change,()=>{v(A,P,H[0].angle)})}),H.forEach(L=>{const U=L.start.x*D,K=L.end.x*D,V=L.start.y*D,q=L.end.y*D,Y=new _o(U,V,K,q);Y.linewidth=je.line.size,Y.stroke=je.line.color,A.add(Y)})),A},k=(H,P,D,A)=>{const L=P.vertices[0].x+(P.vertices[1].x-P.vertices[0].x)/2-8*Math.sin(H.angle*Math.PI/180),U=P.vertices[0].y+(P.vertices[1].y-P.vertices[0].y)/2-8*Math.cos(H.angle*Math.PI/180),K=new Ki(H.label,L+10,U-10);let V;K.size=je.lineLabel.size,K.weight=600,K.fill=je.lineLabel.color,K.id+=1,K.rotation=je.lineLabel.rotation,A>0&&(V=new Ki(`${H.angle}°`,P.vertices[0].x+25,P.vertices[0].y-25),V.size=je.angleLabel.size,V.weight=600,V.fill=je.angleLabel.color,V.rotation=je.angleLabel.rotation,V.id+=A,s.push(V),D.add(V)),D.add(K),w(K,P,0,V),w(K,P,1)},$=()=>{const{size:H}=je.colorSideLabel,P=0,D=0,A=f.value?H/2:H/2-H,L=f.value?H/2-H:H/2,U=new En;if(!c)return U;const K=5,V=Math.atan2(L-A,D-P),q=[new Fe(P,A,0,0,0,0,pn.Commands.move),new Fe(D,L,0,0,0,0,pn.Commands.line),new Fe(D-K*Math.cos(V-Math.PI/4),L-K*Math.sin(V-Math.PI/4),0,0,0,0,pn.Commands.line),new Fe(D,L,0,0,0,0,pn.Commands.move),new Fe(D-K*Math.cos(V+Math.PI/4),L-K*Math.sin(V+Math.PI/4),0,0,0,0,pn.Commands.line)],Y=new Ie(q,!1,!1,!0);Y.noFill(),Y.cap="round",Y.join="round",Y.linewidth=H/7,Y.stroke=je.colorSideLabel.color,U.add(Y);const te=new Ki(f.value?"Цвет снизу":"Цвет сверху",10,0);te.size=H,te.weight=600,te.fill=je.colorSideLabel.color,te.alignment="left",U.add(te);const ue=U.getBoundingClientRect();return U.position.x=(c.width-ue.width)*d+10,U.position.y=f.value?c.height+ue.height*2:ue.height/2,U},w=(H,P,D,A)=>{P.vertices[D].bind(ne.Types.change,()=>{const L=P.vertices.length-1,U=Math.atan2(P.vertices[0].y-P.vertices[L].y,P.vertices[0].x-P.vertices[L].x)*180/Math.PI,K=P.vertices[0].x+(P.vertices[L].x-P.vertices[0].x)/2-8*Math.sin(U*Math.PI/180),V=P.vertices[0].y+(P.vertices[L].y-P.vertices[0].y)/2-8*Math.cos(U*Math.PI/180);H.position.x=K+10,H.position.y=V-10,H.rotation=-.5,A&&(A.position.x=P.vertices[0].x+25,A.position.y=P.vertices[0].y-25)})},B=(H,P,D,A,L=!1)=>{var We;if(H.clear(),D.length===0){H.update();return}const U=h(D),[K,V,q]=p(H,P,U,A,L),Y=new En,te=new Array,ue=new Array;L||(s=[],a=[]),U.forEach((ce,gt)=>{const Ne=ce.start.x*K+V,Ft=ce.end.x*K+V,Wt=ce.start.y*K+q,ln=ce.end.y*K+q,St=new _o(Ne,Wt,Ft,ln);St.linewidth=L?je.previewLine.size:je.line.size,St.stroke=L?je.previewLine.color:je.line.color,a.push(St),te.push(St),Y.add(St),!L&&ce.label!==""&&k(ce,St,Y,gt)});const ve=te.at(-1);let Te=Y.getBoundingClientRect();if(!L){const ce=$();ue.push(ce)}if(P.length>0){const ce=N(P,te[0],K);Y.add(ce)}if(A.length>0&&ve){const ce=T(A,ve,K);Y.add(ce)}if(ue.push(Y),H.makeGroup(ue),Te=Y.getBoundingClientRect(),Y.position.x=0-Te.left+(H.width-Te.width)/(2*(L?1:d)),Y.position.y=0-Te.top+(H.height-Te.height)/(2*(L?1:d)),H.update(),!L){const ce=((We=n.value.configuratorParams)==null?void 0:We.colorSide)==="top";Y.position.y=Y.position.y+je.colorSideLabel.size*Number(ce),b(te,Y),H.update()}},E=(H,P)=>{if(H&&!P.isNewRec()){const D=new pn({width:H.scrollWidth,height:H.scrollHeight});D.appendTo(H),B(D,[],P.points,[],!0)}},M=()=>{c&&B(c,m.value,u.value,g.value,!1)},R=H=>H*(180/Math.PI),O=(H,P)=>{const D=H[1].x-H[0].x,A=H[1].y-H[0].y,L=P[1].x-P[0].x,U=P[1].y-P[0].y;let K=Math.atan2(D*U-A*L,D*L+A*U);return K=R(K),Math.round(K)*-1},W=H=>{const P=a.map((D,A,L)=>{const U=L[A-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let K=Math.ceil(D._length/H/n.settings.lineWidthStep)*n.settings.lineWidthStep;const V=s[A-1];K<(L.length>1?n.settings.minLineWidth:n.settings.stripMinWidth)&&(K=L.length>1?n.settings.minLineWidth:n.settings.stripMinWidth),K>n.settings.maxLineWidth&&(K=n.settings.maxLineWidth);const q=O(D.vertices,U.vertices);return V&&(V.value=`${q}°`),new _n(K,q,`A-${A+1}`)});r("pointer:move",P)},G=H=>{let P=null,D;const A=V=>{P=l.find(q=>{const Y=q.renderer;return(Y==null?void 0:Y.elem)===V.target}),[D]=p(H,m.value,u.value.map(q=>q),g.value)},L=V=>{if(P){const q=P.renderer,Y=q==null?void 0:q.elem;if(!Y)return;const te=Y.getBoundingClientRect();P.vertices[0].x-=te.x-(V instanceof MouseEvent?V.clientX:V.targetTouches[0].clientX)+je.anchorPoint.size/2,P.vertices[0].y-=te.y-(V instanceof MouseEvent?V.clientY:V.targetTouches[0].clientY)+je.anchorPoint.size/2,W(D),H.update()}},U=()=>{P&&r("pointer:up",u.value),P=null},K=o.value;K&&(K.addEventListener("touchstart",A,{passive:!0}),K.addEventListener("touchend",U,{passive:!0}),K.addEventListener("mousedown",A),K.addEventListener("mouseup",U),K.addEventListener("mousemove",L),K.addEventListener("touchmove",L,{passive:!0}))},Q=(H,P)=>{r("remove-custom-template",H,P)};return i.onMounted(()=>{o.value&&(c=new pn({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),i.watch(()=>n.value,()=>{M()},{deep:!0,immediate:!0}),G(c))}),i.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(H,P)=>(i.openBlock(),i.createElementBlock("div",xy,[i.createVNode(vd,{"select-template-index":t.selectTemplateIndex,settings:t.settings,"onTemplate:select":P[0]||(P[0]=D=>r("template:select",D)),onInitDrawTemplate:E,onRemoveCustomTemplate:Q},null,8,["select-template-index","settings"]),i.createElementVNode("div",ky,[i.createElementVNode("div",vy,null,512)])]))}});class Gi extends j.Identity{constructor(n,r){super();S(this,"label","");S(this,"points",[]);S(this,"isCustom",!1);S(this,"id",-1);S(this,"guid","");n?(this.label=n.label,this.points=n.points.map((o,s)=>I.isArray(o)?new _n(o[0],o[1],`A-${s+1}`):new _n(o.width,o.angle,`A-${s+1}`)),this.isCustom=n.isCustom):(this.label="-- Новая конфигурация --",this.points=[new _n(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class qs extends Gi{constructor(n){super(n);S(this,"isDefault");this.isDefault=n.isDefault??!1}}class Sd{constructor(e){S(this,"minLineWidth");S(this,"maxLineWidth");S(this,"lineWidthStep");S(this,"minLineAngle");S(this,"maxLineAngle");S(this,"lineAngleStep");S(this,"stripMinWidth");S(this,"stripMaxWidth");S(this,"stripMinLength");S(this,"stripMaxLength");S(this,"allowShowTable");S(this,"showOnlyTemplates");S(this,"templates");S(this,"customTemplates",[]);S(this,"startTailConfigs");S(this,"endTailConfigs");S(this,"bendCountForExtended");S(this,"extendedProductCatalog");S(this,"allowChangeFirstPoint");S(this,"allowSaveTemplates");S(this,"userTemplatesPrefix");S(this,"lengthStep");S(this,"canSetDopProdaga");var n,r;this.minLineWidth=e.minLineWidth,this.maxLineWidth=e.maxLineWidth,this.lineWidthStep=e.lineWidthStep,this.minLineAngle=e.minLineAngle,this.maxLineAngle=e.maxLineAngle,this.lineAngleStep=e.lineAngleStep,this.stripMinWidth=e.stripMinWidth,this.stripMaxWidth=e.stripMaxWidth,this.stripMinLength=e.stripMinLength,this.stripMaxLength=e.stripMaxLength,this.allowShowTable=e.allowShowTable,this.showOnlyTemplates=e.showOnlyTemplates,this.templates=e.templates.map(o=>new Gi(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((n=e.startTailConfigs)==null?void 0:n.map(o=>new qs(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new qs(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 Gi(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new Gi({label:"-- Новая конфигурация --",points:[new _n(this.stripMinWidth,0,"A-1")],isCustom:!0,id:-1,guid:""})))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(e){if(!this.allowSaveTemplates)return;const n=this.customTemplates.findLast(o=>!o.isNewRec()),r=new Gi(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 Sy={class:"flex flex-col gap-3"},By={class:"grid gap-5 md:grid-cols-5"},Ty={},Bd=i.defineComponent({...Ty,__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 Sd(n.settings)),d=i.ref({linesWidths:[...n.cartItem.configuratorParams.linesWidths],linesAngles:[...n.cartItem.configuratorParams.linesAngles]}),u=i.ref({quantity:{},marker:{},length:{}}),f=i.ref(0),m=i.useTemplateRef("kozyrek-configurator-params-form"),g=(w=0)=>{var E;const B=(E=c.value.allTemplates)==null?void 0:E.at(w);B!==void 0&&(f.value=w,l.value.configuratorParams.linesWidths=B.points.map(M=>I.isArray(M)?M[0]:M.width),l.value.configuratorParams.linesAngles=B.points.map(M=>I.isArray(M)?M[1]:M.angle),v()),b(l.value.configuratorParams)},h=async()=>{const w=prompt("Введите название шаблона:");if(!w)return;a.value=!0;const B={label:w,points:l.value.configuratorParams.linesWidths.map((M,R)=>[M,l.value.configuratorParams.linesAngles[R]])},E=M=>{M&&(c.value.addCustomTemplate(B),f.value=c.value.allTemplates.length-2),a.value=!1};n.eventEmitter.emit("configurator:create-template",{category:n.cartItem.category,template:B,callback:E})},p=async(w,B)=>{var R;const E=(R=c.value.allTemplates)==null?void 0:R.at(w);if(!E||!E.isCustom)return;const M=O=>{O&&(c.value.removeCustomTemplate(E.id),g()),B==null||B()};n.eventEmitter.emit("configurator:remove-template",{category:n.cartItem.category,templateId:E.id,callback:M})},y=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(f.value=c.value.allTemplates.length-1)},b=async w=>{var B,E;l.value.product=new j.ClientProduct,(E=(B=m.value)==null?void 0:B.formReference)==null||E.validate(M=>{M||(v(),o.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:w,validationFieldResultData:u.value,callback:R=>{R?l.value.product=R:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(I.noop)},_=async()=>{var w,B;(B=(w=m.value)==null?void 0:w.formReference)==null||B.validate(E=>{var M,R;if(!E){s.value=!0;const O=new j.OrderItemBase(l.value);(M=c.value.startTailConfigs)!=null&&M.length||delete O.configuratorParams.startTailType,(R=c.value.endTailConfigs)!=null&&R.length||delete O.configuratorParams.endTailType,r("submit",O,u.value,()=>{s.value=!1,i.nextTick(()=>{var W,G;(G=(W=m.value)==null?void 0:W.formReference)==null||G.restoreValidation()})})}}).catch(I.noop)},v=()=>{const w={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach((B,E)=>{w[`lines_widths[${E+1}]`]={},w[`lines_angles[${E+1}]`]={}}),u.value=w},x=w=>{d.value.linesWidths=w.map(B=>B.width),d.value.linesAngles=w.map(B=>B.angle)},N=w=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,v(),y(),b(l.value.configuratorParams)},T=(w,B)=>{d.value.linesWidths=w,d.value.linesAngles=B},k=w=>{const B=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,E=0;l.value.configuratorParams.linesWidths.splice(w+1,0,B),l.value.configuratorParams.linesAngles.splice(w+1,0,E),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],v(),y(),b(l.value.configuratorParams)},$=w=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(w,1),l.value.configuratorParams.linesAngles.splice(w,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],v(),y(),b(l.value.configuratorParams))};return i.onBeforeMount(()=>{n.cartItem.isNewRec()?g():(v(),b(l.value.configuratorParams))}),i.watch(()=>n.cartItem,w=>{l.value=new j.OrderItemBase(w),w.isNewRec()?g():(v(),b(l.value.configuratorParams))}),(w,B)=>{const E=z.NButton;return i.openBlock(),i.createElementBlock("div",Sy,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(E,{key:0,type:"tertiary",class:"self-end",onClick:B[0]||(B[0]=M=>r("click:view-switch"))},{default:i.withCtx(()=>[...B[3]||(B[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",By,[i.createVNode(Cd,{value:l.value,"select-template-index":f.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":N,"onPointer:move":x,"onTemplate:select":g,onRemoveCustomTemplate:p},null,8,["value","select-template-index","settings"]),i.createVNode(dl,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":B[1]||(B[1]=M=>l.value=M),"preview-params":d.value,validation:u.value,settings:c.value,"is-submit-processing":s.value,"is-product-searching":o.value,"select-template-index":f.value,class:"col-span-2","onUpdate:params":B[2]||(B[2]=M=>b(M)),"onUpdate:preview":T,onSubmit:_,"onClick:saveTemplate":h,"onClick:addLine":k,"onClick:removeLine":$},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),Ny={class:"flex flex-col items-center justify-between rounded-xl"},$y={class:"img-preview relative flex justify-center"},Ey={},Ry=i.defineComponent({...Ey,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(t,{emit:e}){const n=t,r=i.computed(()=>{const{height:s}=n.configuratorParams,a=I.keys(n.settings.crossbarCount).reverse().find(l=>{const c=n.settings.crossbarCount[Number(l)];return s>=c});if(a!==void 0)return String(Number(a)+1)}),o=e;return(s,a)=>{const l=z.NButton;return i.openBlock(),i.createElementBlock("div",Ny,[i.createElementVNode("div",$y,[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})])}}}),Xs=qn(Ry,[["__scopeId","data-v-a67fd61e"]]),Py={key:0,class:"flex items-baseline gap-1"},Fy={key:0,class:"flex items-baseline gap-1"},Vy={key:1},My={class:"text-lg font-semibold"},Iy={key:2,class:"text-red-500 text-sm mb-2"},Ay={class:"flex gap-3"},Oy={},Td=i.defineComponent({...Oy,__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 k;const r=t,o=n,s=i.computed(()=>ht.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(I.cloneDeep(r.value)),f=i.computed(()=>r.settings.widthOverlaps[u.value.configuratorParams.mountType]??0),m=i.computed(()=>r.settings.heightOverlaps[u.value.configuratorParams.mountType]??0),g=i.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),h=i.computed(()=>r.settings.maxHeights[u.value.configuratorParams.netType]),p=i.computed(()=>u.value.configuratorParams.width?u.value.configuratorParams.width+f.value:0),y=i.computed(()=>u.value.configuratorParams.height?u.value.configuratorParams.height+m.value:0),b=i.ref(r.settings.canSetDopProdaga??!1),_=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth-f.value),ae.max(g.value-f.value),ae.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[ae.required,ae.min(r.settings.minHeight-m.value),ae.max(h.value-m.value),ae.step(1),He.serverValidation(r.validation.height.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),v=i.computed(()=>{var R;const $=p.value,w=y.value,{quantity:B}=r.value,E=((R=r.value.product)==null?void 0:R.costRub)||0;if(!$||!w||!B||E===0)return null;const M=$*w/1e6;return(E*B*M).toLocaleString("ru-ru",{minimumFractionDigits:2})}),x=i.computed(()=>{const $=p.value,w=y.value,B=!!($&&$>=r.settings.minWidth&&$<=r.settings.maxWidths[u.value.configuratorParams.netType]),E=!!(w&&w>=r.settings.minHeight&&w<=r.settings.maxHeights[u.value.configuratorParams.netType]),M=!!(r.value.quantity&&r.value.quantity>0);return B&&E&&M}),N=($,w)=>{var M,R;const B=u.value.configuratorParams;$&&$ in B&&(B[$]=w);const E={...B,width:p.value??0,height:y.value??0};$==="width"&&((M=l.value)==null||M.validate().catch(I.noop)),$==="height"&&((R=c.value)==null||R.validate().catch(I.noop)),i.nextTick(()=>{var W,G;!((W=l.value)!=null&&W.validationErrored)&&!((G=c.value)!=null&&G.validationErrored)&&E.height&&E.width&&o("update:params",E),T("configuratorParams",E)})},T=($,w)=>{const B=new j.OrderItemBase(r.value);B[$]=w,$==="configuratorParams"&&(B.product=new j.ClientProduct),o("update:value",B)};return i.watch(()=>r.value,$=>{const w=I.cloneDeep(i.toRaw($)),B=w.configuratorParams.mountType,E=r.settings.widthOverlaps[B]??0,M=r.settings.heightOverlaps[B]??0;w.configuratorParams.width&&w.configuratorParams.width>0&&(w.configuratorParams.width-=E),w.configuratorParams.height&&w.configuratorParams.height>0&&(w.configuratorParams.height-=M),u.value=w},{deep:!0,immediate:!0}),i.onMounted(()=>{var $;($=d.value)==null||$.select()}),e({validate:(k=a.value)==null?void 0:k.validate,formReference:a}),($,w)=>{const B=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":[w[0]||(w[0]=E=>u.value.configuratorParams.netType=E),w[1]||(w[1]=E=>N("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":[w[2]||(w[2]=E=>u.value.configuratorParams.color=E),w[3]||(w[3]=E=>N("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":[w[4]||(w[4]=E=>u.value.configuratorParams.mountType=E),w[5]||(w[5]=E=>N("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-f.value} ${g.value?" до "+(g.value-f.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.width.showFeedback&&p.value>=t.settings.minWidth&&p.value<=t.settings.maxWidths[u.value.configuratorParams.netType]?(i.openBlock(),i.createElementBlock("div",Py,[i.createVNode(i.unref(z.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Ширина готового изделия "+i.toDisplayString(p.value),1)]),_:1}),i.createVNode(i.unref(z.NButton),{quaternary:"",type:"info",size:"tiny",onClick:w[10]||(w[10]=E=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...w[25]||(w[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":[w[6]||(w[6]=E=>u.value.configuratorParams.width=E),w[9]||(w[9]=E=>N("width",E))],parse:i.unref(it),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:w[7]||(w[7]=E=>i.unref(tt)(E)),onInput:w[8]||(w[8]=E=>i.unref(et)(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-m.value} ${h.value?" до "+(h.value-m.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.height.showFeedback&&y.value>=t.settings.minHeight&&y.value<=t.settings.maxHeights[u.value.configuratorParams.netType]?(i.openBlock(),i.createElementBlock("div",Fy,[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:w[15]||(w[15]=E=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...w[26]||(w[26]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[w[11]||(w[11]=E=>u.value.configuratorParams.height=E),w[14]||(w[14]=E=>N("height",E))],parse:i.unref(it),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:w[12]||(w[12]=E=>i.unref(tt)(E)),onInput:w[13]||(w[13]=E=>i.unref(et)(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":[w[16]||(w[16]=E=>u.value.quantity=E),w[19]||(w[19]=E=>T("quantity",E??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:w[17]||(w[17]=E=>i.unref(tt)(E,!1)),onInput:w[18]||(w[18]=E=>i.unref(et)(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:w[20]||(w[20]=E=>i.unref(et)(t.validation,"marker")),"onUpdate:value":w[21]||(w[21]=E=>{u.value.marker=E??null,T("marker",E??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),b.value?(i.openBlock(),i.createBlock(B,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":w[22]||(w[22]=E=>{u.value.isAdditionalSale=E??!1,T("isAdditionalSale",E??!1)})},{default:i.withCtx(()=>[...w[27]||(w[27]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(fr,{"is-product-searching":t.isProductSearching,product:u.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),v.value?(i.openBlock(),i.createElementBlock("div",Vy,[w[28]||(w[28]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",My,i.toDisplayString(v.value)+" ₽",1)])):i.createCommentVNode("",!0),x.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Iy," Пожалуйста, заполните все обязательные поля корректно. ")),i.createElementVNode("div",Ay,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!x.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:w[23]||(w[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:w[24]||(w[24]=E=>o("click:show-preview-drawer"))},{default:i.withCtx(()=>[...w[29]||(w[29]=[i.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1},8,["model","rules"])),[[i.unref(Wn),()=>o("submit",u.value)]])}}}),zy="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",Dy="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",Ly="/img/configurators/mosquitto/measurement-instructions/mount.png",Hy="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",Wy="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",jy={class:"flex flex-col gap-6"},qy={class:"flex gap-4"},Xy={class:"flex flex-col gap-2"},Yy={class:"flex gap-4"},Uy={class:"flex flex-col gap-2"},Ky={class:"flex gap-4"},Gy={class:"flex flex-col gap-2"},Zy={},Nd=i.defineComponent({...Zy,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(t,{emit:e}){const n=ht.initRefDependingOnDeviceResolution("small","small","medium"),r=ht.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",jy,[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:zy,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:Dy,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",qy,[l[9]||(l[9]=i.createElementVNode("img",{src:Ly,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Xy,[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",Yy,[l[15]||(l[15]=i.createElementVNode("img",{src:Hy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Uy,[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",Ky,[l[21]||(l[21]=i.createElementVNode("img",{src:Wy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Gy,[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"])}}}),Qy={class:"grid md:grid-cols-2"},Jy={},$d=i.defineComponent({...Jy,__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(()=>ht.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),f=i.ref(!1),m=i.computed(()=>i.inject("debounce-input-time",300)),g=I.debounce(async p=>{var y,b;l.value.product=new j.ClientProduct,(b=(y=c.value)==null?void 0:y.formReference)==null||b.validate(_=>{_||(u.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:p,validationFieldResultData:d.value,callback:v=>{v?l.value.product=v:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(I.noop)},m.value),h=()=>{f.value=!0,r("submit",l.value,d.value,()=>{f.value=!1})};return i.watch(()=>n.cartItem,p=>{l.value=p},{deep:!0}),(p,y)=>{const b=wo;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(Nd,{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",Qy,[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(Xs,{"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(Xs,{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(Td,{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":f.value,"onUpdate:params":y[6]||(y[6]=_=>i.unref(g)(_)),onSubmit:y[7]||(y[7]=_=>h()),"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)}}}),e0={},Ed=i.defineComponent({...e0,__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 g;return!((g=c.value)!=null&&g.validationErrored)}),u=g=>{l.value=g,o("update:value",g,r.index,a)},f=g=>{tt(g),(g.key==="Enter"||g.code==="Enter")&&!r.isLastLine&&(g.preventDefault(),g.stopPropagation())},m=()=>{var g;(g=s.value)==null||g.select()};return i.watch(()=>r.value,g=>{l.value=g}),i.onMounted(()=>{r.autoFocus&&i.nextTick(()=>{m()})}),e({isValid:d,formItemReference:c}),(g,h)=>{const p=cl,y=Xr;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(fr,{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(it),placeholder:"Введите ширину",onKeydown:f,onInput:h[0]||(h[0]=b=>i.unref(et)(t.validation,`linesWidths.${t.index}`)),onFocus:i.unref(Le),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),i.createVNode(i.unref(z.NButton),{disabled:t.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:h[1]||(h[1]=b=>o("click:add-line",t.index))},{default:i.withCtx(()=>[i.createVNode(p)]),_:1},8,["disabled"]),i.createVNode(i.unref(z.NButton),{disabled:t.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:h[2]||(h[2]=b=>o("click:remove-line",t.index))},{default:i.withCtx(()=>[i.createVNode(y)]),_:1},8,["disabled"])]),_:1},8,["path","label"])}}}),t0={class:"my-2 flex w-full flex-col"},n0={key:1},i0={class:"text-lg font-semibold"},r0={class:"flex gap-3"},o0={},Rd=i.defineComponent({...o0,__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(I.cloneDeep(r.value)),c=i.computed(()=>{const v={length:[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(r.settings.lengthStep),He.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]};return I.forEach(l.value,(x,N)=>{var T;v[`configuratorParams.linesWidths.${N}`]=[ae.required,ae.min(r.settings.minLineWidth),ae.step(r.settings.lineWidthStep),He.serverValidation((T=r.validation[`linesWidths.${N}`])==null?void 0:T.feedback)]}),v}),d=i.ref(r.settings.canSetDopProdaga??!1),u=i.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((v,x)=>(v??0)+(x??0),0)),f=i.computed(()=>r.settings.width-u.value),m=i.computed(()=>!r.value.some(({product:v})=>!v||v.isNewRec())),g=i.computed(()=>r.isSubmitProcessing||!m.value||f.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(v=>v.product.isNewRec())),h=i.computed(()=>v=>f.value===0?void 0:[{label:`${(f.value>0?"Остаток +":"Излишек ")+f.value} мм.`,key:f.value+v}]),p=i.computed(()=>{const{length:v}=r.value[0];return!v||u.value!==r.settings.width?null:(I.reduce(r.value,(N,T)=>{var $;const k=(($=T.product)==null?void 0:$.costRub)||0;return N+k},0)*r.value[0].quantity*v).toLocaleString("ru-ru",{minimumFractionDigits:2})}),y=(v,x,N)=>{var k,$,w;l.value[x].product.id=-1;const{configuratorParams:T}=l.value[x];T.linesWidths[x]=v,b("configuratorParams",T),(w=($=(k=a.value)==null?void 0:k.at(x))==null?void 0:$.formItemReference)==null||w.validate().catch(I.noop),i.nextTick(()=>{var B,E;(E=(B=a.value)==null?void 0:B.at(x))!=null&&E.isValid&&o("update:params",T,x,N)})},b=(v,x)=>{l.value.forEach(N=>{N[v]=x}),o("update:value",l.value)};return i.watch(()=>r.value,v=>{l.value=I.cloneDeep(v)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(v,x)=>{const N=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 T;return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(k,$)=>{var w,B,E;return i.openBlock(),i.createBlock(Ed,{key:$,ref_for:!0,ref:"line-items-reference",value:((w=k.configuratorParams)==null?void 0:w.linesWidths.at($))??null,"auto-focus":(((B=k.configuratorParams)==null?void 0:B.linesWidths.at($))??0)===0,index:$,path:`configuratorParams.linesWidths.${$}`,product:k.product,settings:t.settings,validation:t.validation,"suggestion-option":h.value(((E=k.configuratorParams)==null?void 0:E.linesWidths.at($))??0),"add-line-button-disabled":f.value<=0||t.value.length>=t.settings.maxLinesCount||t.value.some(M=>M.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"is-last-line":$===l.value.length-1&&f.value===0,"onUpdate:value":y,"onClick:addLine":x[0]||(x[0]=M=>o("click:add-line",M)),"onClick:removeLine":x[1]||(x[1]=M=>o("click:remove-line",M))},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",t0,[f.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),m.value&&l.value.length===t.settings.maxLinesCount&&f.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:f.value>=0?"Success":"error"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(f.value),1)]),_:1},8,["type"]),i.createTextVNode(" из "+i.toDisplayString(t.settings.width)+" мм ",1)])]),i.createVNode(i.unref(z.NButton),{disabled:g.value,type:"primary",class:"self-center",onClick:x[2]||(x[2]=k=>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]=k=>l.value[0].length=k),x[6]||(x[6]=k=>b("length",k))],parse:i.unref(it),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:x[4]||(x[4]=k=>i.unref(tt)(k,!1)),onInput:x[5]||(x[5]=k=>i.unref(et)(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]=k=>l.value[0].quantity=k),x[10]||(x[10]=k=>b("quantity",k))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:x[8]||(x[8]=k=>i.unref(tt)(k,!1)),onInput:x[9]||(x[9]=k=>i.unref(et)(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]=k=>i.unref(et)(t.validation,"marker")),"onUpdate:value":x[12]||(x[12]=k=>{l.value[0].marker=k??null,b("marker",k??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(N,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":x[13]||(x[13]=k=>{l.value[0].isAdditionalSale=k??!1,b("isAdditionalSale",k??!1)})},{default:i.withCtx(()=>[...x[18]||(x[18]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),p.value?(i.openBlock(),i.createElementBlock("div",n0,[x[19]||(x[19]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",i0,i.toDisplayString(p.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",r0,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!m.value||f.value!=0||!((T=l.value[0])!=null&&T.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]=k=>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(Wn),()=>o("submit",l.value)]])}}}),s0={class:"flex grow flex-col"},a0=["src"],l0={class:"w-full"},c0={},Pd=i.defineComponent({...c0,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",s0,[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,a0),i.createElementVNode("div",l0,[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)])]))}}),d0={class:"flex flex-col gap-2"},u0={class:"w-104 flex grow flex-col px-5"},h0={},Fd=i.defineComponent({...h0,__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 h;return(h=s.value[0].configuratorParams)==null?void 0:h.linesWidths.reduce((p,y)=>(p??0)+(y??0),0)}),u=h=>{h===void 0&&(h=s.value.length-1);const p=s.value.at(0);if(!p)return;p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(h+1,0,null),s.value.forEach(b=>{b.configuratorParams.linesWidths=p.configuratorParams.linesWidths});const y=new j.OrderItemBase({quantity:(p==null?void 0:p.quantity)??1,category:p==null?void 0:p.category,length:(p==null?void 0:p.length)??n.settings.minLength,marker:p==null?void 0:p.marker,configuratorParams:{linesWidths:p==null?void 0:p.configuratorParams.linesWidths}});s.value=s.value.toSpliced(h+1,0,y)},f=h=>{const p=s.value.at(0);p&&(p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(h,1),s.value.forEach(y=>{y.configuratorParams.linesWidths=p.configuratorParams.linesWidths}),s.value=s.value.toSpliced(h,1),delete a[`linesWidths.${h}`],delete a[`linesWidths.${h}`])},m=I.debounce(async(h,p,y)=>{const b={linesWidths:h.linesWidths.at(p)};y.value=!0,a.value[`linesWidths.${p}`]={},s.value[p].product=new j.ClientProduct,n.eventEmitter.emit("configurator:search-product",{category:s.value[p].category,params:b,validationFieldResultData:a.value,callback:_=>{_?(s.value[p].product=_,p===s.value.length-1&&s.value.length<n.settings.maxLinesCount&&d.value&&d.value<n.settings.width&&u()):(s.value[p].product=new j.ClientProduct,a.value[`linesWidths.${p}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},y.value=!1),y.value=!1}})},c.value),g=async()=>{var h,p;(p=(h=o.value)==null?void 0:h.formReference)==null||p.validate(y=>{if(!y){l.value=!0;const b=s.value.at(0);if(!b)return;r("submit",b,a.value,()=>{l.value=!1,i.nextTick(()=>{var _,v;(v=(_=o.value)==null?void 0:_.formReference)==null||v.restoreValidation()})})}}).catch(I.noop)};return i.watch(()=>n.cartItems,h=>{s.value=h.map(p=>new j.OrderItemBase(p))}),(h,p)=>{const y=z.NButton;return i.openBlock(),i.createElementBlock("div",d0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(y,{key:0,type:"tertiary",class:"self-center",onClick:p[0]||(p[0]=b=>r("click:view-switch"))},{default:i.withCtx(()=>[...p[3]||(p[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",u0,[i.createVNode(Pd,{value:s.value,"onUpdate:value":p[1]||(p[1]=b=>s.value=b),settings:t.settings},null,8,["value","settings"]),i.createVNode(Rd,{ref:"strip-configurator-form",value:s.value,"onUpdate:value":p[2]||(p[2]=b=>s.value=b),validation:a.value,settings:t.settings,"is-submit-processing":l.value,"onUpdate:params":i.unref(m),onSubmit:g,"onClick:addLine":u,"onClick:removeLine":f},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),f0={class:"flex flex-col gap-3"},m0={},Vd=i.defineComponent({...m0,__name:"metal-for-doors-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit"],setup(t,{expose:e,emit:n}){var g;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("first-input-element"),l=i.ref(I.cloneDeep(r.value)),c=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth),...r.settings.maxWidth?[ae.max(r.settings.maxWidth)]:[],ae.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(1),He.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),d=i.ref(r.settings.canSetDopProdaga??!1),u=()=>{o("update:params",l.value.configuratorParams),f("configuratorParams",l.value.configuratorParams)},f=(h,p)=>{const y=new j.OrderItemBase(r.value);y[h]=p,h==="configuratorParams"&&(y.product=new j.ClientProduct),o("update:value",y)},m=()=>{var h;(h=a.value)==null||h.select()};return i.watch(()=>r.value,h=>{l.value=I.cloneDeep(h)},{deep:!0}),i.onMounted(()=>{r.value.isNewRec()&&i.nextTick(()=>{m()})}),e({validate:(g=s.value)==null?void 0:g.validate,formReference:s}),(h,p)=>{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":[p[0]||(p[0]=b=>l.value.configuratorParams.width=b),u],class:"w-full",parse:i.unref(it),"show-button":!1,placeholder:"Введите ширину",onKeydown:p[1]||(p[1]=b=>i.unref(tt)(b)),onInput:p[2]||(p[2]=b=>i.unref(et)(t.validation,"width")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(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":[p[3]||(p[3]=b=>l.value.configuratorParams.length=b),u],placeholder:"Введите длину",parse:i.unref(it),"show-button":!1,class:"w-full",onKeydown:p[4]||(p[4]=b=>i.unref(tt)(b)),onInput:p[5]||(p[5]=b=>i.unref(et)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(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:p[6]||(p[6]=b=>i.unref(tt)(b,!1)),onInput:p[7]||(p[7]=b=>i.unref(et)(t.validation,"quantity")),"onUpdate:value":p[8]||(p[8]=b=>f("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:p[9]||(p[9]=b=>i.unref(et)(t.validation,"marker")),"onUpdate:value":p[10]||(p[10]=b=>f("marker",b??null)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(y,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":p[11]||(p[11]=b=>{l.value.isAdditionalSale=b??!1,f("isAdditionalSale",b??!1)})},{default:i.withCtx(()=>[...p[13]||(p[13]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(fr,{"is-product-searching":t.isProductSearching,product:t.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),i.createElementVNode("div",f0,[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:p[12]||(p[12]=b=>o("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["model","rules","disabled"])),[[i.unref(Wn),()=>o("submit",l.value)]])}}}),g0={class:"flex flex-col gap-2 w-72"},p0={},Md=i.defineComponent({...p0,__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=I.debounce(async m=>{var g,h;s.value.product=new j.ClientProduct,(h=(g=o.value)==null?void 0:g.formReference)==null||h.validate(p=>{p||(l.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:m,validationFieldResultData:a.value,callback:y=>{y?s.value.product=y:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(I.noop)},d.value),f=async()=>{var m,g;(g=(m=o.value)==null?void 0:m.formReference)==null||g.validate(h=>{h||(c.value=!0,r("submit",s.value,a.value,()=>{c.value=!1,i.nextTick(()=>{var p,y;(y=(p=o.value)==null?void 0:p.formReference)==null||y.restoreValidation()})}))}).catch(I.noop)};return i.watch(()=>n.cartItem,m=>{s.value=new j.OrderItemBase(m)},{deep:!0}),(m,g)=>{const h=z.NButton;return i.openBlock(),i.createElementBlock("div",g0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(h,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=p=>r("click:view-switch"))},{default:i.withCtx(()=>[...g[4]||(g[4]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Vd,{ref:"metal-for-doors-configurator-form",value:s.value,"onUpdate:value":g[1]||(g[1]=p=>s.value=p),validation:a.value,settings:t.settings,"is-submit-processing":c.value,"is-product-searching":l.value,"onUpdate:params":g[2]||(g[2]=p=>i.unref(u)(p)),onSubmit:g[3]||(g[3]=p=>f())},null,8,["value","validation","settings","is-submit-processing","is-product-searching"])])}}}),y0={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function b0(t,e){return i.openBlock(),i.createElementBlock("svg",y0,[...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 Id=i.markRaw({name:"ion-add",render:b0}),_0={key:0,class:"-mt-1 text-sm text-gray-500"},w0={class:"font-bold"},x0={class:"flex flex-col gap-3"},k0={key:0,class:"mt-4 flex flex-col gap-1.5"},v0={class:"flex flex-col gap-1 text-sm text-gray-700"},C0={key:0},S0={key:1},B0={"form-array-name":"items",class:"flex flex-col gap-3"},T0={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},N0={key:0,class:"flex flex-wrap items-end gap-2"},$0={class:"whitespace-nowrap text-xl font-bold"},E0={key:0,class:"whitespace-nowrap text-lg text-gray-500"},R0={class:"font-bold"},P0={class:"font-bold"},F0={class:"flex gap-3"},V0={},Ad=i.defineComponent({...V0,__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(I.cloneDeep(r.value)),l=i.ref({...r.validation}),c=D=>{var A;delete l.value[D],(A=s.value)==null||A.restoreValidation()};i.watch(()=>r.validation,D=>{l.value={...D},Object.values(D).some(L=>L==null?void 0:L.feedback)&&i.nextTick(()=>{var L;return(L=s.value)==null?void 0:L.validate(I.noop).catch(I.noop)})},{deep:!0});const d=i.computed(()=>r.value.category),u=i.ref(null),f=i.ref(null),m=i.computed(()=>d.value.products??[]),g=i.computed(()=>m.value.map(D=>({label:D.name,value:D.id}))),h=(D,A,L)=>{const U=D!=null&&D>0,K=A!=null&&A>0;return!U&&!K?null:U&&K?`от ${D} ${L} до ${A} ${L}`:U?`от ${D} ${L}`:`до ${A} ${L}`},p=i.computed(()=>{var D,A;return h(r.settings.minWidth,(A=(D=u.value)==null?void 0:D.properties)==null?void 0:A.width,"мм")}),y=i.computed(()=>{var D,A;return h(r.settings.minLength,(A=(D=u.value)==null?void 0:D.properties)==null?void 0:A.length,"мм")}),b=i.ref(null),_=i.ref(!1);i.computed(()=>{var D,A;return(A=(D=u.value)==null?void 0:D.properties)!=null&&A.width?ae.max(u.value.properties.width):null}),i.computed(()=>{var D,A;return(A=(D=u.value)==null?void 0:D.properties)!=null&&A.length?ae.max(u.value.properties.length):null});const v=i.computed(()=>{var A;const D={marker:[He.serverValidation((A=l.value.marker)==null?void 0:A.feedback)]};return a.value.configuratorParams.items.forEach((L,U)=>{var K,V,q,Y,te,ue,ve;D[`configuratorParams.items.${U}.width`]=[ae.required,ae.min(r.settings.minWidth),...(V=(K=u.value)==null?void 0:K.properties)!=null&&V.width?[ae.max(u.value.properties.width)]:[],ae.step(1),He.serverValidation((q=l.value[`items.${U}.width`])==null?void 0:q.feedback)],D[`configuratorParams.items.${U}.length`]=[ae.required,ae.min(r.settings.minLength),...(te=(Y=u.value)==null?void 0:Y.properties)!=null&&te.length?[ae.max(u.value.properties.length)]:[],ae.step(1),He.serverValidation((ue=l.value[`items.${U}.length`])==null?void 0:ue.feedback)],D[`configuratorParams.items.${U}.count`]=[ae.required,ae.min(1),ae.step(1),He.serverValidation((ve=l.value[`items.${U}.count`])==null?void 0:ve.feedback)]}),D}),x=i.ref(r.settings.canSetDopProdaga??!1),N=i.computed(()=>a.value.configuratorParams.items.some(D=>{var A,L;return!u.value||!D.width||D.width<r.settings.minWidth||D.width>(((A=u.value.properties)==null?void 0:A.width)??0)||D.length===0||D.length<r.settings.minLength||D.length>(((L=u.value.properties)==null?void 0:L.length)??0)||!D.count||D.count<1})),T=i.computed(()=>!u.value||N.value||a.value.configuratorParams.items.length===0),k=i.ref(null),$=D=>{if(!D){u.value=null,f.value=null,a.value.product=new j.ClientProduct,b.value=null;return}const A=m.value.find(L=>L.id===D);A&&(u.value=A,f.value=D,a.value.product=A,Q("product",a.value.product),a.value.configuratorParams.items.forEach(L=>{var U,K;(U=A.properties)!=null&&U.width&&L.width>A.properties.width&&(L.width=A.properties.width),(K=A.properties)!=null&&K.length&&L.length>A.properties.length&&(L.length=A.properties.length)}),B())};let w=!1;const B=()=>{w=!0,b.value=null,k.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},E=async()=>{var D;if(!u.value||a.value.configuratorParams.items.length===0||N.value){B();return}(D=s.value)==null||D.validate(A=>{if(A){B();return}if(_.value=!0,!u.value||!d.value){B(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:L=>{L?(b.value=L,a.value.configuratorParams.calculationId=L.id,a.value.quantity=L.quantity,i.nextTick(()=>{Q("quantity",L.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,B()),Q("configuratorParams",a.value.configuratorParams),M(),_.value=!1}})}).catch(()=>{B(),_.value=!1})},M=()=>{var A;if(!((A=u.value)!=null&&A.costRub)||!b.value){k.value=null;return}const D=b.value.quantity*u.value.costRub;k.value=Math.round(D*100)/100},R=D=>{var L,U;const A=a.value.configuratorParams.items[D];u.value&&((L=u.value.properties)!=null&&L.width&&A.width>u.value.properties.width&&(A.width=u.value.properties.width),(U=u.value.properties)!=null&&U.length&&A.length>u.value.properties.length&&(A.length=u.value.properties.length)),Q("configuratorParams",a.value.configuratorParams),B()},O=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),Q("configuratorParams",a.value.configuratorParams),B(),o("add-item",a.value.configuratorParams.items.length)},W=D=>{a.value.configuratorParams.items.splice(D,1),Q("configuratorParams",a.value.configuratorParams),B(),o("remove-item",D)},G=()=>{if(!(T.value||_.value||r.isSubmitProcessing)){if(!b.value){E();return}o("submit",a.value)}},Q=(D,A)=>{const L=new j.OrderItemBase(r.value);L[D]=A,o("update:value",L)};i.watch(()=>r.value,D=>{const A=I.cloneDeep(i.toRaw(D));(!A.configuratorParams.items||A.configuratorParams.items.length===0)&&(A.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=A,r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),r.value.product.isNewRec()&&(u.value=null,f.value=null),w?w=!1:H()},{deep:!0});const H=()=>{const{calculationId:D}=a.value.configuratorParams,A=a.value.quantity??0;D&&A>0&&a.value.product&&!a.value.product.isNewRec()&&(b.value={id:D,quantity:A,sheets:[]},M())};return i.onMounted(()=>{r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),H()}),e({validate:(P=s.value)==null?void 0:P.validate,formReference:s}),(D,A)=>{const L=Xr,U=Id;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:a.value,rules:v.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>{var K;return[i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:f.value,"onUpdate:value":[A[0]||(A[0]=V=>f.value=V),$],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((K=u.value)==null?void 0:K.costRub)!=null?(i.openBlock(),i.createElementBlock("div",_0,[i.createElementVNode("span",w0,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",x0,[u.value?(i.openBlock(),i.createElementBlock("div",k0,[A[7]||(A[7]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",v0,[p.value?(i.openBlock(),i.createElementBlock("div",C0,"Ширина "+i.toDisplayString(p.value)+".",1)):i.createCommentVNode("",!0),y.value?(i.openBlock(),i.createElementBlock("div",S0,"Длина "+i.toDisplayString(y.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",B0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value.configuratorParams.items,(V,q)=>(i.openBlock(),i.createElementBlock("div",{key:q,class:"flex grow gap-2"},[i.createElementVNode("div",T0,[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":[Y=>a.value.configuratorParams.items[q].width=Y,Y=>R(q)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:A[1]||(A[1]=Y=>i.unref(tt)(Y)),onInput:Y=>c(`items.${q}.width`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(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":[Y=>a.value.configuratorParams.items[q].length=Y,Y=>R(q)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:A[2]||(A[2]=Y=>i.unref(tt)(Y)),onInput:Y=>c(`items.${q}.length`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(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":[Y=>a.value.configuratorParams.items[q].count=Y,Y=>R(q)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:A[3]||(A[3]=Y=>i.unref(tt)(Y,!1)),onInput:Y=>c(`items.${q}.count`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),i.createVNode(i.unref(z.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:Y=>W(q)},{default:i.withCtx(()=>[i.createVNode(L)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:1,disabled:N.value,type:"default",class:"self-center",onClick:O},{default:i.withCtx(()=>[i.createVNode(U),A[8]||(A[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:A[4]||(A[4]=V=>c("marker")),"onUpdate:value":A[5]||(A[5]=V=>Q("marker",V??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":A[6]||(A[6]=V=>{a.value.isAdditionalSale=V??!1,Q("isAdditionalSale",V??!1)})},{default:i.withCtx(()=>[...A[9]||(A[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 V;return[b.value&&u.value&&k.value?(i.openBlock(),i.createElementBlock("div",N0,[i.createElementVNode("div",null,[A[10]||(A[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",$0,i.toDisplayString(k.value.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol),1)]),b.value.quantity&&u.value?(i.openBlock(),i.createElementBlock("div",E0,[i.createElementVNode("span",R0,"("+i.toDisplayString(b.value.quantity)+" шт.",1),A[11]||(A[11]=i.createTextVNode(" x ",-1)),i.createElementVNode("span",P0,i.toDisplayString((V=u.value.costRub)==null?void 0:V.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]}),_:1},8,["show"]),i.createElementVNode("div",F0,[b.value&&!_.value?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,loading:t.isSubmitProcessing,disabled:T.value||_.value,type:"primary",class:"self-start",onClick:G},{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:T.value||_.value,type:"info",class:"self-start",onClick:E},{default:i.withCtx(()=>[...A[12]||(A[12]=[i.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules"])),[[i.unref(Wn),G]])}}}),M0={class:"flex flex-col gap-2"},I0={class:"w-104 flex grow flex-col px-5"},A0={},Od=i.defineComponent({...A0,__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 f,m;(m=(f=o.value)==null?void 0:f.formReference)==null||m.validate(g=>{if(!g){l.value=!0;const h=I.cloneDeep(s.value);"items"in h.configuratorParams&&delete h.configuratorParams.items,r("submit",h,a.value,()=>{l.value=!1,i.nextTick(()=>{var p,y;(y=(p=o.value)==null?void 0:p.formReference)==null||y.restoreValidation()})})}}).catch(I.noop)},d=f=>{a.value[`items.${f}.width`]={},a.value[`items.${f}.length`]={},a.value[`items.${f}.count`]={}},u=f=>{delete a.value[`items.${f}.width`],delete a.value[`items.${f}.length`],delete a.value[`items.${f}.count`]};return i.onMounted(()=>{n.cartItem.configuratorParams.items.forEach((f,m)=>{a.value[`items.${m}.width`]={},a.value[`items.${m}.length`]={},a.value[`items.${m}.count`]={}})}),i.watch(()=>n.cartItem,f=>{s.value=new j.OrderItemBase(f)},{deep:!0}),(f,m)=>{const g=z.NButton;return i.openBlock(),i.createElementBlock("div",M0,[t.settings.allowShowTable&&s.value.isNewRec()?(i.openBlock(),i.createBlock(g,{key:0,type:"tertiary",class:"self-center",onClick:m[0]||(m[0]=h=>r("click:view-switch"))},{default:i.withCtx(()=>[...m[2]||(m[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",I0,[i.createVNode(Ad,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":m[1]||(m[1]=h=>s.value=h),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"])])])}}}),O0={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function z0(t,e){return i.openBlock(),i.createElementBlock("svg",O0,[...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 D0=i.markRaw({name:"ion-checkmark",render:z0}),L0={key:0,class:"-mt-1 text-sm text-gray-500"},H0={class:"font-bold"},W0={class:"flex flex-col gap-3"},j0={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},q0={class:"flex flex-col gap-1 text-sm text-gray-700"},X0={key:0},Y0={key:1},U0={"form-array-name":"items",class:"flex flex-col gap-3"},K0={class:"min-w-0 flex-1"},G0={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},Z0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},Q0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},J0={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},eb={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},tb={key:0,class:"lg:!flex-[2]"},nb={class:"font-bold"},ib={key:1,class:"lg:!flex-[3]"},rb={class:"font-bold"},ob={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"},sb={key:0},ab={class:"font-bold"},lb={key:1},cb={class:"font-bold"},db={class:"flex flex-wrap items-center gap-3"},ub={},zd=i.defineComponent({...ub,__name:"sandwich-m2-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},itemStates:{default:()=>[]}},emits:["submit","update:value","add-item","remove-item","item-reset"],setup(t,{expose:e,emit:n}){var K;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("widthInputs"),l=r.value==null?[]:I.cloneDeep(i.toRaw(r.value)),c=i.ref(l.map(V=>new j.OrderItemBase(V))),d=i.computed(()=>({items:c.value})),u=i.ref({...r.validation}),f=V=>{var q;delete u.value[V],(q=s.value)==null||q.restoreValidation()},m=i.ref(null),g=i.ref(null),h=i.computed(()=>{var V,q;return((q=(V=c.value[0])==null?void 0:V.category)==null?void 0:q.products)??[]}),p=i.computed(()=>h.value.map(V=>({label:V.name,value:V.id}))),y=(V,q,Y)=>{const te=V!=null&&V>0,ue=q!=null&&q>0;return!te&&!ue?null:te&&ue?`от ${V} ${Y} до ${q} ${Y}`:te?`от ${V} ${Y}`:`до ${q} ${Y}`},b=i.computed(()=>{var V,q;return y(r.settings.minWidth,(q=(V=m.value)==null?void 0:V.properties)==null?void 0:q.width,"мм")}),_=i.computed(()=>{var V,q;return y(r.settings.minLength,(q=(V=m.value)==null?void 0:V.properties)==null?void 0:q.length,"мм")}),v=i.computed(()=>{const V={};return c.value.forEach((q,Y)=>{var te,ue,ve,Te,We,ce,gt,Ne;V[`items.${Y}.configuratorParams.width`]=[ae.required,ae.min(r.settings.minWidth),...(ue=(te=m.value)==null?void 0:te.properties)!=null&&ue.width?[ae.max(m.value.properties.width)]:[],ae.step(1),He.serverValidation((ve=u.value[`items.${Y}.width`])==null?void 0:ve.feedback)],V[`items.${Y}.configuratorParams.length`]=[ae.required,ae.min(r.settings.minLength),...(We=(Te=m.value)==null?void 0:Te.properties)!=null&&We.length?[ae.max(m.value.properties.length)]:[],ae.step(1),He.serverValidation((ce=u.value[`items.${Y}.length`])==null?void 0:ce.feedback)],V[`items.${Y}.quantity`]=[ae.required,ae.min(1),ae.step(1),He.serverValidation((gt=u.value[`items.${Y}.quantity`])==null?void 0:gt.feedback)],V[`items.${Y}.marker`]=[He.serverValidation((Ne=u.value[`items.${Y}.marker`])==null?void 0:Ne.feedback)]}),V});i.watch(()=>r.validation,V=>{u.value={...V},Object.values(V).some(Y=>Y==null?void 0:Y.feedback)&&i.nextTick(()=>{var Y;return(Y=s.value)==null?void 0:Y.validate(I.noop).catch(I.noop)})},{deep:!0});const x=i.ref(r.settings.canSetDopProdaga??!1),N=i.computed(()=>{const V=m.value;return V?c.value.some(q=>{var ve,Te;const Y=q.configuratorParams,te=(ve=V.properties)==null?void 0:ve.width,ue=(Te=V.properties)==null?void 0:Te.length;return Y.width===0||Y.width<r.settings.minWidth||te!=null&&Y.width>te||Y.length===0||Y.length<r.settings.minLength||ue!=null&&Y.length>ue||q.quantity===0||q.quantity<1}):!0}),T=i.computed(()=>!m.value||N.value||c.value.length===0),k=i.computed(()=>{const V=c.value[0];return V!=null&&!V.isNewRec()}),$=V=>r.itemStates[V]??"idle",w=V=>$(V)==="success",B=V=>$(V)==="loading",E=i.computed(()=>c.value.length===0?!0:c.value.every((V,q)=>{const Y=$(q);return Y==="success"||Y==="loading"})),M=V=>V.width===0||V.length===0?0:V.width*V.length/1e6,R=V=>{var ve;const q=V.configuratorParams,Y=M(q),te=((ve=m.value)==null?void 0:ve.costRub)??0,ue=V.quantity??0;return!Y||!ue?0:Math.round(Y*te*ue*100)/100},O=i.computed(()=>I.sum(c.value.map(V=>{const q=V.configuratorParams;return!q.width||q.length===0||!V.quantity?0:q.width*q.length*V.quantity/1e6}))),W=i.computed(()=>Math.round(I.sum(c.value.map(V=>R(V)))*100)/100),G=()=>{var V,q,Y;return new j.OrderItemBase({category:(V=c.value[0])==null?void 0:V.category,configurator:(q=c.value[0])==null?void 0:q.configurator,product:m.value??new j.ClientProduct,quantity:1,isAdditionalSale:(Y=c.value[0])==null?void 0:Y.isAdditionalSale,configuratorParams:{width:0,length:0}})},Q=V=>{if(!V){m.value=null,g.value=null,c.value.forEach(Y=>{Y.product=new j.ClientProduct}),o("update:value",c.value);return}const q=h.value.find(Y=>Y.id===V);q&&(m.value=q,g.value=V,c.value.forEach((Y,te)=>{var ue,ve;Y.product=q,(ue=q.properties)!=null&&ue.width&&Y.configuratorParams.width>q.properties.width&&(Y.configuratorParams.width=q.properties.width),(ve=q.properties)!=null&&ve.length&&Y.configuratorParams.length>q.properties.length&&(Y.configuratorParams.length=q.properties.length),o("item-reset",te)}),o("update:value",c.value))},H=V=>{var te,ue;const q=c.value[V],Y=m.value;Y&&((te=Y.properties)!=null&&te.width&&q.configuratorParams.width>Y.properties.width&&(q.configuratorParams.width=Y.properties.width),(ue=Y.properties)!=null&&ue.length&&q.configuratorParams.length>Y.properties.length&&(q.configuratorParams.length=Y.properties.length)),o("item-reset",V),o("update:value",c.value)},P=(V,q)=>{c.value[V].marker=q===null||q===""?void 0:q,o("item-reset",V),o("update:value",c.value)},D=V=>{c.value.forEach(q=>{q.isAdditionalSale=V}),o("update:value",c.value)},A=()=>{c.value.push(G()),o("update:value",c.value),o("add-item",c.value.length),i.nextTick(()=>{var q,Y,te,ue;const V=c.value.length-1;(Y=(q=a.value)==null?void 0:q[V])==null||Y.focus(),(ue=(te=a.value)==null?void 0:te[V])==null||ue.select()})},L=V=>{c.value.splice(V,1),o("update:value",c.value),o("remove-item",V)};i.watch(()=>r.value,V=>{var ue;const Y=(V==null?[]:I.cloneDeep(i.toRaw(V))).map(ve=>new j.OrderItemBase(ve));c.value=Y.length>0?Y:[G()];const te=(ue=c.value[0])==null?void 0:ue.product;te&&!te.isNewRec()?(m.value=te,g.value=te.id):(m.value=null,g.value=null)},{deep:!0});const U=()=>{var q;if(m.value!==null)return;const V=(q=h.value[0])==null?void 0:q.id;V!=null&&Q(V)};return i.watch(h,()=>{U()}),i.onMounted(()=>{var q;c.value.length===0&&(c.value=[G()]);const V=(q=c.value[0])==null?void 0:q.product;V&&!V.isNewRec()&&(m.value=V,g.value=V.id),U()}),e({validate:(K=s.value)==null?void 0:K.validate,formReference:s}),(V,q)=>{const Y=D0,te=Xr,ue=Id;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:d.value,rules:v.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>{var ve,Te;return[i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:g.value,"onUpdate:value":[q[0]||(q[0]=We=>g.value=We),Q],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((ve=m.value)==null?void 0:ve.costRub)!=null?(i.openBlock(),i.createElementBlock("div",L0,[i.createElementVNode("span",H0,i.toDisplayString(m.value.code),1),i.createTextVNode(" — "+i.toDisplayString(m.value.costRub.toLocaleString())+" "+i.toDisplayString(m.value.currency.symbol)+"/м² ",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",W0,[m.value?(i.openBlock(),i.createElementBlock("div",j0,[q[6]||(q[6]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",q0,[b.value?(i.openBlock(),i.createElementBlock("div",X0,"Ширина "+i.toDisplayString(b.value)+".",1)):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createElementBlock("div",Y0,"Длина "+i.toDisplayString(_.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",U0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value.items,(We,ce)=>{var gt;return i.openBlock(),i.createElementBlock("div",{key:ce,class:i.normalizeClass(["flex min-w-0 items-start gap-2 border-b border-gray-100 last:border-0",w(ce)?"opacity-70":""])},[i.createElementVNode("div",K0,[i.createElementVNode("div",G0,[i.createElementVNode("div",Z0,[i.createVNode(i.unref(z.NFormItem),{path:`items.${ce}.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[ce].configuratorParams.width,"onUpdate:value":[Ne=>d.value.items[ce].configuratorParams.width=Ne,Ne=>H(ce)],parse:i.unref(it),"show-button":!1,disabled:!m.value||w(ce)||B(ce),placeholder:"Ширина",class:"w-full",onKeydown:q[1]||(q[1]=Ne=>i.unref(tt)(Ne)),onInput:Ne=>f(`items.${ce}.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.${ce}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:d.value.items[ce].configuratorParams.length,"onUpdate:value":[Ne=>d.value.items[ce].configuratorParams.length=Ne,Ne=>H(ce)],parse:i.unref(it),"show-button":!1,disabled:!m.value||w(ce)||B(ce),placeholder:"Длина",class:"w-full",onKeydown:q[2]||(q[2]=Ne=>i.unref(tt)(Ne)),onInput:Ne=>f(`items.${ce}.length`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),i.createElementVNode("div",Q0,[i.createVNode(i.unref(z.NFormItem),{path:`items.${ce}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:d.value.items[ce].quantity,"onUpdate:value":[Ne=>d.value.items[ce].quantity=Ne,Ne=>H(ce)],parse:i.unref(it),"show-button":!1,disabled:!m.value||w(ce)||B(ce),placeholder:"Кол-во",class:"w-full",onKeydown:q[3]||(q[3]=Ne=>i.unref(tt)(Ne,!1)),onInput:Ne=>f(`items.${ce}.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.${ce}.marker`,label:"Маркировка",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:d.value.items[ce].marker??null,disabled:!m.value||w(ce)||B(ce),placeholder:"Маркировка",class:"w-full",onInput:Ne=>f(`items.${ce}.marker`),"onUpdate:value":Ne=>P(ce,Ne??null),onFocus:i.unref(Le)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),B(ce)||w(ce)?(i.openBlock(),i.createElementBlock("div",J0,[B(ce)?(i.openBlock(),i.createBlock(i.unref(z.NSpin),{key:0,size:14})):w(ce)?(i.openBlock(),i.createBlock(Y,{key:1,class:"text-green-600 text-xl"})):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),i.createElementVNode("div",eb,[We.configuratorParams.width>0&&We.configuratorParams.length>0?(i.openBlock(),i.createElementBlock("div",tb,[q[7]||(q[7]=i.createTextVNode(" Площадь (S) = ",-1)),i.createElementVNode("span",nb,i.toDisplayString(M(We.configuratorParams).toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),R(We)>0?(i.openBlock(),i.createElementBlock("div",ib,[q[8]||(q[8]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",rb,i.toDisplayString(R(We).toLocaleString())+" "+i.toDisplayString((gt=m.value)==null?void 0:gt.currency.symbol),1)])):i.createCommentVNode("",!0)])]),k.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,disabled:B(ce)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:Ne=>L(ce)},{default:i.withCtx(()=>[i.createVNode(te)]),_:1},8,["disabled","onClick"]))],2)}),128))]),m.value?(i.openBlock(),i.createElementBlock("div",ob,[O.value>0?(i.openBlock(),i.createElementBlock("div",sb,[q[9]||(q[9]=i.createTextVNode(" Общая площадь: ",-1)),i.createElementVNode("span",ab,i.toDisplayString(O.value.toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),W.value>0?(i.openBlock(),i.createElementBlock("div",lb,[q[10]||(q[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",cb,i.toDisplayString(W.value.toLocaleString())+" "+i.toDisplayString(m.value.currency.symbol),1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),x.value?(i.openBlock(),i.createBlock(i.unref(z.NCheckbox),{key:1,checked:((Te=c.value[0])==null?void 0:Te.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":q[4]||(q[4]=We=>D(We??!1))},{default:i.withCtx(()=>[...q[11]||(q[11]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createElementVNode("div",db,[m.value&&!k.value?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,disabled:N.value,type:"default",onClick:A},{default:i.withCtx(()=>[i.createVNode(ue),q[12]||(q[12]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:T.value||E.value,type:"primary",class:"ml-auto",onClick:q[5]||(q[5]=We=>o("submit",c.value))},{default:i.withCtx(()=>{var We;return[i.createTextVNode(i.toDisplayString((We=c.value[0])!=null&&We.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[i.unref(Wn),()=>o("submit",c.value)]])}}}),hb={class:"flex flex-col gap-2"},fb={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},mb={},Dd=i.defineComponent({...mb,__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(v=>new j.OrderItemBase(v))),a=i.ref([]),l=i.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=v=>{c.forEach(x=>{l.value[`items.${v}.${x}`]={}})},u=v=>{c.forEach(x=>{delete l.value[`items.${v}.${x}`]})},f=i.computed(()=>a.value.includes("loading")),m=()=>({width:{},length:{},quantity:{},marker:{}}),g=(v,x)=>{let N=!1;return c.forEach(T=>{var M,R;const k=`items.0.${T}`,$=(M=v[T])==null?void 0:M.feedback,B=((R=v[k])==null?void 0:R.feedback)??$,E=`items.${x}.${T}`;B?(l.value[E]=v[k]??v[T],N=!0):l.value[E]={}}),N},h=(v,x,N)=>new Promise(T=>{const k=m();let $=!1;const w=B=>{if($)return;$=!0;const E=g(k,x),M=(B===void 0?!E:B)&&!E;a.value[x]=M?"success":"error",i.nextTick(()=>{var R,O;(O=(R=o.value)==null?void 0:R.formReference)==null||O.restoreValidation()}),T(M)};a.value[x]="loading",r("submit",[I.cloneDeep(v)],k,w,{isFinalSuccessfulCompletion:N})}),p=async()=>{var N,T;try{await((T=(N=o.value)==null?void 0:N.formReference)==null?void 0:T.validate())}catch{return}const v=s.value.map((k,$)=>$).filter(k=>{const $=a.value[k]??"idle";return $!=="success"&&$!=="loading"});let x=!0;for(let k=0;k<v.length;k+=1){const $=v[k],w=s.value[$];if(!w)break;const E=k===v.length-1&&x;await h(w,$,E)||(x=!1)}},y=v=>{const x=v-1;a.value[x]="idle",d(x)},b=v=>{a.value.splice(v,1),u(v);for(let x=v;x<s.value.length;x+=1)d(x)},_=v=>{const x=a.value[v];(x==="success"||x==="error")&&(a.value[v]="idle")};return i.onMounted(()=>{(n.cartItems??[]).forEach((v,x)=>{a.value[x]="idle",d(x)})}),i.watch(()=>n.cartItems,v=>{const x=(v??[]).map(N=>new j.OrderItemBase(N));s.value=x,a.value=x.map(()=>"idle"),x.forEach((N,T)=>{d(T)})},{deep:!0}),(v,x)=>{var T;const N=z.NButton;return i.openBlock(),i.createElementBlock("div",hb,[t.settings.allowShowTable&&((T=s.value[0])!=null&&T.isNewRec())?(i.openBlock(),i.createBlock(N,{key:0,type:"tertiary",class:"self-center",onClick:x[0]||(x[0]=k=>r("click:view-switch"))},{default:i.withCtx(()=>[...x[2]||(x[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",fb,[i.createVNode(zd,{ref:"sandwich-m2-configurator-form",value:s.value,"onUpdate:value":x[1]||(x[1]=k=>s.value=k),validation:l.value,settings:t.settings,"event-emitter":t.eventEmitter,"is-submit-processing":f.value,"item-states":a.value,onSubmit:p,onAddItem:y,onRemoveItem:b,onItemReset:_},null,8,["value","validation","settings","event-emitter","is-submit-processing","item-states"])])])}}}),gb={key:0,class:"flex justify-center p-4"},pb={key:1,class:"p-4 text-center text-red-500"},yb={key:2,class:"flex justify-center"},bb={class:"!bg-white p-4 m-2 rounded-md w-max"},_b={key:3,class:"p-4 text-center text-gray-500"},wb={},Ld=i.defineComponent({...wb,__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=m=>{const g=m.configuratorParams;return[new j.OrderItemBase({...m,quantity:m.quantity??1,marker:m.marker,configuratorParams:{width:(g==null?void 0:g.width)??m.width??0,length:(g==null?void 0:g.length)??m.length??0}})]},l=i.ref(e.editor===j.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var g,h,p;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const m={category:((g=e.cartItem)==null?void 0:g.category)??e.category,configurator:e.editor,quantity:1};switch(e.editor){case"kozyrek":{const y=e.settings;o.value=new j.OrderItemBase({...m,configuratorParams:{length:y.stripMinLength,linesAngles:[],linesWidths:[],startTailType:I.some(y.startTailConfigs,b=>b.isDefault)?(h=y.startTailConfigs)==null?void 0:h.findIndex(b=>b.isDefault):void 0,endTailType:I.some(y.endTailConfigs,b=>b.isDefault)?(p=y.endTailConfigs)==null?void 0:p.findIndex(b=>b.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const y=e.settings;o.value=new j.OrderItemBase({...m,configuratorParams:{width:0,height:0,netType:y.netType[0]||"",color:y.color[0]||"",mountType:y.mountType[0]||""}});break}case"strip":{const y=e.settings;s.value=[new j.OrderItemBase({...m,length:y.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const y=e.settings;o.value=new j.OrderItemBase({...m,configuratorParams:{width:y.minWidth,length:y.minLength}});break}case"sandwich":{o.value=new j.OrderItemBase({...m,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new j.OrderItemBase({...m,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(m,g,h)=>{const p=y=>{h==null||h(),y&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:m,callback:p,validation:g})},u=(m,g,h,p)=>{const y=m[0];if(!y){h==null||h();return}const b=(p==null?void 0:p.isFinalSuccessfulCompletion)===!0,_=v=>{h==null||h(v),b&&v&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:y,callback:_,validation:g,additionalParams:p})},f=()=>{e.category&&e.eventEmitter.emit("configurator:click-view-switch",{category:e.category})};return i.onMounted(()=>{!e.cartItem&&!e.cartItems&&c()}),(m,g)=>{const h=z.NSpin;return i.openBlock(),i.createElementBlock(i.Fragment,null,[n.value?(i.openBlock(),i.createElementBlock("div",gb,[i.createVNode(h,{size:"large"})])):r.value?(i.openBlock(),i.createElementBlock("div",pb,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",yb,[i.createElementVNode("div",bb,[t.editor==="kozyrek"?(i.openBlock(),i.createBlock(Bd,{key:0,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="mosquitto"?(i.openBlock(),i.createBlock($d,{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(Fd,{key:2,"event-emitter":t.eventEmitter,settings:t.settings,"cart-items":s.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-items"])):t.editor==="metal_for_doors"?(i.openBlock(),i.createBlock(Md,{key:3,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="sandwich"?(i.openBlock(),i.createBlock(Od,{key:4,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="sandwich_m2"?(i.openBlock(),i.createBlock(Dd,{key:5,"event-emitter":t.eventEmitter,settings:t.settings,"cart-items":l.value,"onClick:viewSwitch":f,onSubmit:u},null,8,["event-emitter","settings","cart-items"])):i.createCommentVNode("",!0)])])):(i.openBlock(),i.createElementBlock("div",_b,' Конфигуратор "'+i.toDisplayString(t.editor)+'" не поддерживается. ',1))],64)}}});function Hd(t){return Object.values(j.ConfiguratorsEnum).includes(t)}function Wd(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.Sandwich?!0:t.properties.configuratorSettings!==void 0&&I.isArray(t.products)&&t.products.length>0}const xb={key:0,class:"pt-0.5"},kb={key:0},vb={class:"line-through"},Cb={key:0},Sb={key:1},Bb={class:"flex flex-row gap-1"},Tb={key:0},Nb={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},$b={class:"flex flex-col gap-2.5 sm:flex-row"},Eb={class:"mt-2"},Rb={key:1,class:"flex flex-col"},Pb={},Fb=i.defineComponent({...Pb,__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(dr,"medium"),r=i.computed(()=>{var K;return(K=e==null?void 0:e.filteredItems)==null?void 0:K[e.categoryItem.id]}),o=i.computed(()=>{var K,V;return I.isArray((K=e.categoryItem)==null?void 0:K.categories)&&((V=e.categoryItem.categories)==null?void 0:V.length)>0}),s=i.computed(()=>{var K;return I.isArray((K=e.categoryItem)==null?void 0:K.products)?e.categoryItem.products:[]}),a=i.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([K,V])=>`${V} руб./${E(K)}`).join(", ")),l=i.computed(()=>I.isUndefined(e.filteredItems)||r.value==="*"?s.value:s.value.filter(K=>{var q;const V=(q=r.value)==null?void 0:q.products;return I.isArray(V)&&V.includes(K.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>I.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),u=i.computed(()=>I.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),f=i.computed(()=>I.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),m=i.computed(()=>I.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),g=i.computed(()=>{var K,V,q;return((K=e.categoryItem.properties)==null?void 0:K.configurator)!==void 0&&Hd((V=e.categoryItem.properties)==null?void 0:V.configurator)&&Wd(e.categoryItem)&&((q=e.categoryItem.properties)==null?void 0:q.configuratorSettings)!==void 0&&(I.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),h=i.computed(()=>g.value&&(I.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),p=i.computed(()=>I.isNil(e.categoryContextButtonsConfig)?[]:I.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),y=i.computed(()=>new j.ClientCategory(e.categoryItem)),b=i.ref(!1),_=i.ref(!1),v=i.computed(()=>!I.isUndefined(e.isCategoryItemSelected)),x=i.computed(()=>I.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),N=i.computed(()=>I.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),T=i.computed(()=>I.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),k=i.computed(()=>A.value&&ht.getDeviceTypeByResolution()===qe.laptop?"auto":"fixed"),$=i.useTemplateRef("collapse-item-reference"),w=i.computed(()=>{var K,V;return(V=(K=e.categoryItem.properties)==null?void 0:K.templateCost)==null?void 0:V.priceCoefficient}),B=i.computed(()=>{var K,V;return(V=(K=e.categoryItem.properties)==null?void 0:K.templateCost)==null?void 0:V.increasePercent}),E=(K,V="ru-RU")=>0 .toLocaleString(V,{style:"currency",currency:K,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),M=K=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:K,target:$.value})},R=(K,V)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:V,isLoadingState:b,target:$.value})},O=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:$.value})},W=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:$.value})},G=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:$.value})},Q=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:$.value})},H=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:$.value})},P=K=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:K,target:$.value})},D=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},A=i.ref(0),L=i.computed(()=>A.value&&s.value.length>0?lg(s.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),U=I.debounce(()=>{A.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",U)}),window.addEventListener("resize",U),U(),(K,V)=>{const q=z.NCheckbox,Y=Of,te=z.NTooltip,ue=Mf,ve=z.NTag,Te=Pf,We=$f,ce=z.NButton,gt=Bf,Ne=nl,Ft=tl,Wt=el,ln=Uo,St=z.NDropdown,Ln=z.NDataTable,cn=z.NAlert,Jt=z.NSpin;return i.openBlock(),i.createBlock(il,{ref:"collapse-item-reference",name:t.categoryItem.id,"data-id":t.categoryItem.id,"onHeader:click":R},{"pre-arrow":i.withCtx(()=>{var Ve,ee;return[v.value?(i.openBlock(),i.createElementBlock("div",xb,[i.createVNode(q,{checked:x.value,indeterminate:T.value,disabled:N.value,"onUpdate:checked":M},null,8,["checked","indeterminate","disabled"])])):i.createCommentVNode("",!0),!d.value&&((Ve=y.value)!=null&&Ve.isDisabled)?(i.openBlock(),i.createBlock(te,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(Y,{class:"pt-1.5"})]),default:i.withCtx(()=>[V[1]||(V[1]=i.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):i.createCommentVNode("",!0),((ee=y.value)==null?void 0:ee.isFavorite)??!1?(i.openBlock(),i.createBlock(te,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ue,{class:"pt-1.5"})]),default:i.withCtx(()=>[V[2]||(V[2]=i.createTextVNode(" Избранная категория ",-1))]),_:1})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var Ve,ee,le,De,ri;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(te,{disabled:!t.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createElementVNode("span",null,i.toDisplayString(t.categoryItem.name),1)]),default:i.withCtx(()=>[V[3]||(V[3]=i.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:V[0]||(V[0]=i.withModifiers((...nt)=>i.unref(I.noop)&&i.unref(I.noop)(...nt),["prevent","stop"]))},[(ee=t.categoryItem.properties)!=null&&ee.m2Price?(i.openBlock(),i.createBlock(ve,{key:0,size:i.unref(n),class:i.normalizeClass({"!pr-0":((le=t.categoryItem.properties)==null?void 0:le.templateCost)&&t.categoryItem.properties.m2PriceRetail&&B.value}),round:""},{default:i.withCtx(()=>{var nt;return[i.createTextVNode(" Установленная стоимость: "+i.toDisplayString(t.categoryItem.properties.m2Price)+" руб./м2 ",1),(nt=t.categoryItem.properties)!=null&&nt.templateCost&&t.categoryItem.properties.m2PriceRetail&&B.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[B.value?(i.openBlock(),i.createBlock(ve,{key:0,type:"success",bordered:!1,size:i.unref(n),class:"ml-2 !pr-0",round:""},{default:i.withCtx(()=>[B.value?(i.openBlock(),i.createElementBlock("span",kb,i.toDisplayString(B.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0),i.createVNode(ve,{size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createElementVNode("span",vb,i.toDisplayString(t.categoryItem.properties.m2PriceRetail)+" руб./м2",1)]),_:1},8,["size"])]),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0)]}),_:1},8,["size","class"])):(De=t.categoryItem.properties)!=null&&De.templateCost?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[w.value||B.value?(i.openBlock(),i.createBlock(ve,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>{var nt;return[w.value?(i.openBlock(),i.createElementBlock("span",Cb,i.toDisplayString((nt=w.value)==null?void 0:nt.name),1)):i.createCommentVNode("",!0),B.value?(i.openBlock(),i.createElementBlock("span",Sb,i.toDisplayString(B.value>0?"+":"")+i.toDisplayString(B.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0)]}),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(ve,{key:2,size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createTextVNode(" Фиксированный курс: "+i.toDisplayString(a.value),1)]),_:1},8,["size"])):i.createCommentVNode("",!0),u.value&&((ri=y.value)!=null&&ri.manager)?(i.openBlock(),i.createBlock(ve,{key:3,size:i.unref(n),closable:!0,round:"",class:"align-bottom",onClose:Q},{default:i.withCtx(()=>[i.createVNode(te,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var nt,jt;return[i.createElementVNode("span",Bb,[i.createVNode(Te),i.createTextVNode(" "+i.toDisplayString((jt=(nt=y.value)==null?void 0:nt.manager)==null?void 0:jt.name),1)])]}),default:i.withCtx(()=>{var nt,jt;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((jt=(nt=y.value)==null?void 0:nt.manager)==null?void 0:jt.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[t.showSlugs||t.showProperties?(i.openBlock(),i.createElementBlock("div",Tb,[i.createElementVNode("ul",Nb,[t.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:t.categoryItem.id,slug:t.categoryItem.slug},(Ve,ee)=>(i.openBlock(),i.createElementBlock("li",{key:ee}," ("+i.toDisplayString(ee)+"): "+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,ee)=>(i.openBlock(),i.createElementBlock("li",{key:ee}," ("+i.toDisplayString(ee)+"): "+i.toDisplayString(Ve),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var Ve;return[i.createElementVNode("div",$b,[d.value?(i.openBlock(),i.createBlock(te,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),onClick:O},{default:i.withCtx(()=>{var ee;return[(ee=y.value)!=null&&ee.isDisabled?(i.openBlock(),i.createBlock(Y,{key:1})):(i.openBlock(),i.createBlock(We,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var ee;return[(ee=y.value)!=null&&ee.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(te,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),onClick:G},{default:i.withCtx(()=>[i.createVNode(gt)]),_:1},8,["size"])]),default:i.withCtx(()=>{var ee,le,De;return[(ee=y.value)!=null&&ee.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),f.value?(i.openBlock(),i.createBlock(te,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,disabled:f.value==="disabled",size:i.unref(n),onClick:W},{default:i.withCtx(()=>{var ee;return[(ee=y.value)!=null&&ee.isRequired?(i.openBlock(),i.createBlock(Ft,{key:1})):(i.openBlock(),i.createBlock(Ne,{key:0}))]}),_:1},8,["disabled","size"])]),default:i.withCtx(()=>[V[4]||(V[4]=i.createTextVNode(" Категория, которую нужно предлагать клиенту ",-1))]),_:1})):i.createCommentVNode("",!0),m.value?(i.openBlock(),i.createBlock(te,{key:3,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),type:"primary",onClick:H},{default:i.withCtx(()=>[i.createVNode(Wt)]),_:1},8,["size"])]),default:i.withCtx(()=>[V[5]||(V[5]=i.createTextVNode(" Редактировать ",-1))]),_:1})):i.createCommentVNode("",!0),p.value.length>0?(i.openBlock(),i.createBlock(St,{key:4,options:p.value,size:i.unref(n),trigger:"click",onSelect:P},{default:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(ln)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(K.$slots,"default",{},()=>{var Ve,ee,le;return[i.createElementVNode("div",Eb,[o.value?(i.openBlock(),i.createBlock(qd,{key:0,"categories-items":t.categoryItem.categories??[],"has-products":c.value||b.value,"event-emitter":t.eventEmitter,"filtered-items":r.value?((Ve=r.value)==null?void 0:Ve.categories)??{}:void 0,"is-category-item-selected":t.isCategoryItemSelected,"show-slugs":t.showSlugs,"show-properties":t.showProperties,"allow-name-click":t.allowNameClick,"allow-price-click":t.allowPriceClick,"show-price-history":t.showPriceHistory,"show-cost-date":t.showCostDate,"show-category-required-button":t.showCategoryRequiredButton,"show-category-hide-for-client-button":t.showCategoryHideForClientButton,"show-category-pin-button":t.showCategoryPinButton,"show-category-edit-button":t.showCategoryEditButton,"category-context-buttons-config":t.categoryContextButtonsConfig,"is-product-item-selected":t.isProductItemSelected,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-costs":t.showProductCosts,"show-product-required-button":t.showProductRequiredButton,"show-product-edit-button":t.showProductEditButton,"product-context-buttons-config":t.productContextButtonsConfig,"show-configurator":t.showConfigurator,"can-show-configurator":t.canShowConfigurator},null,8,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"])):i.createCommentVNode("",!0)]),g.value&&h.value?(i.openBlock(),i.createBlock(Ld,{key:0,"event-emitter":t.eventEmitter,settings:(ee=t.categoryItem.properties)==null?void 0:ee.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",Rb,[g.value?(i.openBlock(),i.createBlock(ce,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:D},{default:i.withCtx(()=>[...V[6]||(V[6]=[i.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Ln,{columns:L.value,data:l.value,bordered:!0,loading:b.value,remote:!0,"row-key":De=>De.id,"table-layout":k.value,class:"mt-2"},null,8,["columns","data","loading","row-key","table-layout"])])):i.createCommentVNode("",!0),!b.value&&!_.value&&!o.value&&!c.value?(i.openBlock(),i.createBlock(cn,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createBlock(cn,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),b.value?(i.openBlock(),i.createBlock(Jt,{key:4,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>[...V[7]||(V[7]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),Vb=qn(Fb,[["__scopeId","data-v-607a5aad"]]),Mb={class:"sc-collapse flex w-full flex-col"},Ib={},jd=i.defineComponent({...Ib,__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",Mb,[i.renderSlot(s.$slots,"default")]))}}),Ab={},qd=i.defineComponent({...Ab,__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(dr,"medium"),r=i.computed(()=>I.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(I.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(jd,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(Vb,{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)}}}),Ob={},Xd=i.defineComponent({...Ob,__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(()=>I.isArray(r.value)),a=new j.Reference,l=i.computed(()=>I.isNil(r.value)?s.value?[]:null:I.isArray(r.value)?r.value.map(g=>g.id):r.value.id),c=i.computed(()=>Bt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue,void 0,r.disabledItem)),d=g=>{var h;if(I.isArray(g)){const p=g.length>0?g.map(y=>{var b;return(b=c.value.find(_=>_.value===y))==null?void 0:b.item}):[];o("update:value",p)}else{const p=g===a.id||I.isNil(g)||(h=c.value.find(y=>y.value===g))==null?void 0:h.item;o("update:value",p)}},u=i.useTemplateRef("select-component");return e({focus:()=>{var g;return(g=u.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=u.value)==null?void 0:g.blur()}}),(g,h)=>(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"]))}}),zb={},Db=i.defineComponent({...zb,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{},disabledCoefficient:{type:Function}},emits:["update:value"],setup(t,{emit:e}){var x,N;const n=t,r=e,o=()=>{const T=j.PriceCoefficient.getRetailPriceCoefficient();return I.unset(T,"isNewRec"),T},s=T=>!T||T.id===o().id,a=i.computed(()=>{var T;return((T=n.catalogItem)==null?void 0:T.type)==="product"}),l=i.computed(()=>a.value?n.catalogItem:void 0),c=T=>{var k,$,w,B;return T.id===o().id?(k=l.value)==null?void 0:k.getRetailCost():(B=(w=($=l.value)==null?void 0:$.priceCoefficients)==null?void 0:w.find(E=>E.coefficient.id===T.id))==null?void 0:B.cost},d=i.computed(()=>{var k;const T=[...((k=j.useReferencesStore().priceCoefficientsReference)==null?void 0:k.map($=>structuredClone(i.toRaw($))))??[],o()];return a.value&&T.forEach($=>{var B;const w=c($);w?$.name+=` (${w} ${(B=l.value)==null?void 0:B.currency.symbol})`:$.name=""}),T.filter($=>$.name!=="")}),u=i.ref(n.value.coefficient),f=i.ref(((N=(x=n.value)==null?void 0:x.value)==null?void 0:N.toString())??null),m=i.ref(null),g=i.computed(()=>{var T,k;return(k=(T=l.value)==null?void 0:T.priceCoefficients)==null?void 0:k.find($=>$.coefficient.slug===j.PriceCoefficientEnum.K0)}),h=i.ref(void 0),p=T=>Number.parseFloat((T??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),y=()=>{var k,$;h.value=void 0;let T=p(f.value);if(T=Number.isNaN(T)?void 0:T,a.value)if(u.value||f.value){const w=o(),B=c(u.value??w)??0,E=B+B*((T??0)/100);m.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(E),E>(((k=l.value)==null?void 0:k.getRetailCost())??E)&&(h.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),g.value&&E<((($=g.value)==null?void 0:$.cost)??0)&&(h.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else m.value=null;r("update:value",{value:Number.isNaN(T)?void 0:T,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})},b=T=>{I.isArray(T)||I.isNull(T)||(u.value=T,f.value=null,!u.value&&f.value&&(u.value=o()),y())},_=()=>{u.value||(u.value=o()),y()},v=T=>{var $,w,B,E,M;const k=p(T);if(a.value){if(Number.isNaN(k)){u.value=void 0,f.value=null,r("update:value",{value:void 0,coefficient:void 0});return}let R=0;if(k<=0)u.value=void 0,f.value=null;else if(g.value&&k<((($=g.value)==null?void 0:$.cost)??0))u.value=(w=g.value)==null?void 0:w.coefficient,R=(k-g.value.cost)*100/g.value.cost,h.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(k>(((B=l.value)==null?void 0:B.getRetailCost())??k)){u.value=o();const O=((E=l.value)==null?void 0:E.getRetailCost())??0;R=(k-O)*100/O,h.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const O=((M=l.value)==null?void 0:M.priceCoefficients)??[],W=I.sortBy(O,[H=>H.cost]),Q=W.filter(H=>H.cost<=k).at(-1)??W.at(0);Q&&(u.value=Q.coefficient,R=(k-Q.cost)*100/Q.cost),h.value={validationStatus:void 0,feedback:void 0}}f.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(k)?void 0:k,coefficient:void 0})};return i.onMounted(()=>{var T,k,$,w;n.calculationType===j.CalculationTypeEnum.m2Cost?m.value=((k=(T=n.value)==null?void 0:T.value)==null?void 0:k.toString())??null:!(($=n.value)!=null&&$.coefficient)&&((w=n.value)!=null&&w.value)&&(u.value=o()),y()}),(T,k)=>{var B,E,M;const $=z.NInput,w=z.NInputGroup;return i.openBlock(),i.createBlock(i.unref(z.NFormItem),{"show-label":!i.unref(I.isNil)(t.label),label:t.label,"show-feedback":!i.unref(I.isNil)(((B=h.value)==null?void 0:B.feedback)??t.feedback),feedback:((E=h.value)==null?void 0:E.feedback)??t.feedback,"validation-status":((M=h.value)==null?void 0:M.validationStatus)??t.validationStatus},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([{"sm:grid-cols-3":a.value&&t.calculationType!==i.unref(j.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[t.calculationType!==i.unref(j.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(w,{key:0,class:i.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:i.withCtx(()=>[i.createVNode(Xd,{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($,{value:f.value,"onUpdate:value":[k[0]||(k[0]=R=>f.value=R),_],clearable:t.clearable,disabled:t.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},i.createSlots({suffix:i.withCtx(()=>[k[3]||(k[3]=i.createTextVNode("%",-1))]),_:2},[f.value&&!f.value.startsWith("-")?{name:"prefix",fn:i.withCtx(()=>[k[2]||(k[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($,{key:1,value:m.value,"onUpdate:value":[k[1]||(k[1]=R=>m.value=R),v],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"])}}}),Lb={key:0,class:"flex flex-row gap-2.5"},Hb={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},Wb={},Yd=i.defineComponent({...Wb,__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=ht.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=ht.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)},f=(g="other")=>{if(a.value){o("processing:cancel",b=>{a.value=b});return}let h=!1;o("closing",g,()=>{h=!0}),h||(s.value=!1,o("update:show",s.value))},m=()=>{o("accept",h=>{a.value=h})};return i.watch(()=>r.show,g=>{g?u():f("other")}),i.watch(()=>r.processing,g=>{a.value=g}),e({open:u,close:f,acceptHandler:m}),(g,h)=>{const p=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":g.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:h[1]||(h[1]=b=>f("header")),onEsc:h[2]||(h[2]=b=>f("esc")),onMaskClick:h[3]||(h[3]=b=>f("mask"))},i.createSlots({default:i.withCtx(()=>[i.renderSlot(g.$slots,"default")]),_:2},[g.$slots.header?{name:"header",fn:i.withCtx(()=>[i.renderSlot(g.$slots,"header")]),key:"0"}:void 0,g.$slots.action||g.$slots["extra-action"]||t.acceptButton.show||t.cancelButton.show?{name:"action",fn:i.withCtx(()=>[g.$slots["extra-action"]?(i.openBlock(),i.createElementBlock("div",Lb,[i.renderSlot(g.$slots,"extra-action")])):i.createCommentVNode("",!0),g.$slots.action||t.acceptButton.show||t.cancelButton.show?(i.openBlock(),i.createElementBlock("div",Hb,[i.renderSlot(g.$slots,"action",{disabled:a.value}),t.acceptButton.show??!0?(i.openBlock(),i.createBlock(p,{key:0,disabled:a.value||!t.valid,size:i.unref(l),type:"primary",onClick:m},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.acceptButton.text??"ОК"),1)]),_:1},8,["disabled","size"])):i.createCommentVNode("",!0),t.cancelButton.show??!0?(i.openBlock(),i.createBlock(p,{key:1,size:i.unref(l),type:"default",onClick:h[0]||(h[0]=b=>f("footer"))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.cancelButton.text??"Отмена"),1)]),_:1},8,["size"])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["loading","show","size","style","title","trap-focus","action-class"])}}}),jb={class:"text-sm"},qb={class:"text-sm"},Xb={},Yb=i.defineComponent({...Xb,__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 w,B,E;return((w=a.value)==null?void 0:w.unit.isLinear)&&((E=(B=a.value)==null?void 0:B.properties)==null?void 0:E.isLengthConfigurator)}),c=i.ref(void 0),d=i.ref(void 0),u=i.ref(!0),f=i.ref(null),m=n,g=()=>({length:{},quantity:{},marker:{}}),h=i.ref(g()),p=i.ref(!1),y=i.computed(()=>{var R,O,W,G;if(!a.value)return{};const w=j.UnitsHelper.getProductLengthMultiplicity(a.value),B=j.UnitsHelper.getProductMultiplicity(a.value),E=((O=(R=a.value)==null?void 0:R.properties)==null?void 0:O.minLength)||w,M=(G=(W=a.value)==null?void 0:W.properties)==null?void 0:G.maxLength;return{length:[ae.required,ae.min(E??.1),ae.max(M),ae.step(w),He.serverValidation(h.value.length.feedback)],quantity:[ae.required,ae.min(B),ae.step(B),He.serverValidation(h.value.quantity.feedback)],marker:[He.serverValidation(h.value.marker.feedback)]}}),b=i.computed(()=>{var w,B,E;return a.value?((w=a.value.properties)==null?void 0:w.lengthStep)??((B=a.value.properties)!=null&&B.ignoreMinCountCheck?0:((E=a.value.properties)==null?void 0:E.minCount)??0):0}),_=i.computed(()=>{var E,M,R,O,W,G,Q,H,P;if(!a.value)return"";const w=((M=(E=a.value)==null?void 0:E.properties)==null?void 0:M.minLength)??((O=(R=a.value)==null?void 0:R.properties)!=null&&O.ignoreMinCountCheck?0:(G=(W=a.value)==null?void 0:W.properties)==null?void 0:G.minCount),B=(H=(Q=a.value)==null?void 0:Q.properties)==null?void 0:H.maxLength;return w||B?`(${w?`от ${w}`:""}${w&&B?" ":""}${B?`до ${B}`:""} ${(P=a.value)==null?void 0:P.unit.name})`:""}),v=w=>{var O,W;if(!((W=(O=a.value)==null?void 0:O.properties)!=null&&W.isLengthConfigurator)||!f.value||I.isNil(w)||b.value===0)return;const B=w/b.value,E=Math.round(B),M=j.UnitsHelper.getProductMultiplicity(a.value),R=Math.max(E,M);f.value.quantity=R},x=w=>{var R,O,W,G;if(!((O=(R=a.value)==null?void 0:R.properties)!=null&&O.isLengthConfigurator)||!f.value||I.isNil(w)||b.value===0)return;const B=w*b.value,E=((W=a.value.properties)==null?void 0:W.minLength)||j.UnitsHelper.getProductLengthMultiplicity(a.value),M=(G=a.value.properties)==null?void 0:G.maxLength;E!==void 0&&B<E?f.value.length=E:M!==void 0&&B>M?f.value.length=M:f.value.length=B},N=async w=>{var E;const B=I.cloneDeep(f.value);try{await((E=r.value)==null?void 0:E.validate(M=>{if(!M){if(!a.value||!B)return;j.UnitsHelper.productIsMeasurable(a.value)||delete B.length,l.value&&b.value&&(B.length=b.value),p.value=!0,m("submit",B,h.value,()=>{p.value=!1,w(!1),i.nextTick(()=>{var R;(R=r.value)==null||R.validate(I.noop).catch(I.noop)})})}}))}catch{}},T=()=>{a.value=null,c.value=void 0,f.value=null,h.value=g()},k=()=>{s.value=!1};return e({show:(w,B)=>{var E,M,R,O,W;if(T(),s.value=!0,a.value=w,c.value=B==null?void 0:B.cartItemData,d.value=B==null?void 0:B.orderId,u.value=(B==null?void 0:B.canSetDopProdaga)??!1,f.value=new j.OrderItemBase((B==null?void 0:B.cartItemData)??new j.OrderItemBase({product:w,quantity:j.UnitsHelper.productIsMeasurable(a.value)?1:((E=w==null?void 0:w.properties)==null?void 0:E.minCount)??1,length:((M=w==null?void 0:w.properties)==null?void 0:M.minLength)||((R=w==null?void 0:w.properties)!=null&&R.ignoreMinCountCheck?0:(O=w==null?void 0:w.properties)==null?void 0:O.minCount)||0})),(W=w==null?void 0:w.properties)!=null&&W.isLengthConfigurator&&f.value&&b.value>0){const G=b.value,Q=f.value.quantity||1;f.value.length=Q*G}},closeDialog:k}),(w,B)=>{var W;const E=z.NFormItem,M=z.NInputGroupLabel,R=z.NInputGroup,O=z.NCheckbox;return i.openBlock(),i.createBlock(Yd,{ref:"base-dialog-reference",show:s.value,title:`${c.value?"Изменение":"Добавление"} товара ${(W=a.value)==null?void 0:W.name} в ${d.value?` заказ №${d.value}`:"корзину"}`,"accept-button":{show:!0,text:c.value?"Изменить":"Добавить"},processing:p.value,"modal-width":500,onAccept:N,onClosing:k},{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:y.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(E,{key:0,path:"length",label:`Метраж, ${_.value+a.value.unit.name}`},i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:f.value.length,"onUpdate:value":[B[0]||(B[0]=G=>f.value.length=G),v],parse:i.unref(it),step:i.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:B[1]||(B[1]=G=>i.unref(Wr)(G,".",!1)),onInput:B[2]||(B[2]=G=>i.unref(et)(h.value,"length")),onFocus:i.unref(Le)},null,8,["value","parse","step","onFocus"])]),_:2},[!h.value.length.feedback&&i.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",jb,"Метраж должно быть кратно "+i.toDisplayString(i.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)),1)]),key:"0"}:void 0]),1032,["label"])):i.createCommentVNode("",!0),i.createVNode(E,{path:"quantity",label:"Количество, шт."},{default:i.withCtx(()=>[i.createVNode(R,null,i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:f.value.quantity,"onUpdate:value":[B[3]||(B[3]=G=>f.value.quantity=G),x],parse:i.unref(it),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:B[4]||(B[4]=G=>i.unref(Wr)(G,".",!1)),onInput:B[5]||(B[5]=G=>i.unref(et)(h.value,"quantity")),onFocus:i.unref(Le)},null,8,["value","parse","step","show-button","onFocus"]),l.value?(i.openBlock(),i.createBlock(M,{key:0,class:"bg-orange-100 font-bold"},{default:i.withCtx(()=>[i.createTextVNode(" x "+i.toDisplayString(b.value)+" "+i.toDisplayString(a.value.unit.name),1)]),_:1})):i.createCommentVNode("",!0)]),_:2},[!h.value.quantity.feedback&&i.unref(j.UnitsHelper).getProductMultiplicity(a.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",qb,"Количество должно быть кратно "+i.toDisplayString(i.unref(j.UnitsHelper).getProductMultiplicity(a.value)),1)]),key:"0"}:void 0]),1024)]),_:1}),i.unref(j.UnitsHelper).productIsMeasurable(a.value)?(i.openBlock(),i.createBlock(E,{key:1,path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:f.value.marker??null,placeholder:"Введите маркировку",onInput:B[6]||(B[6]=G=>i.unref(et)(h.value,"marker")),"onUpdate:value":B[7]||(B[7]=G=>f.value.marker=G??null),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1})):i.createCommentVNode("",!0),u.value?(i.openBlock(),i.createBlock(O,{key:2,checked:f.value.isAdditionalSale,"onUpdate:checked":B[8]||(B[8]=G=>f.value.isAdditionalSale=G),"true-value":!0,"false-value":!1},{default:i.withCtx(()=>[...B[9]||(B[9]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0)]),_:1},8,["model","rules"])),[[i.unref(Wn),()=>{var G,Q;return(Q=(G=o.value)==null?void 0:G.acceptHandler)==null?void 0:Q.call(G)}]]):i.createCommentVNode("",!0)]),_:1},8,["show","title","accept-button","processing"])}}}),Ub={class:"flex flex-row gap-1"},Kb={class:"sc-client-name flex flex-col gap-1 text-base"},Gb=["href"],Zb={key:1,class:"text-sc-grey"},Qb={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Jb={key:0},e_={key:1,class:"text-sm"},t_={},wr=i.defineComponent({...t_,__name:"client-name-with-short-info",props:{client:{},nameLink:{default:void 0},popoverPosition:{default:void 0},showCityAndRegion:{type:Boolean,default:!0},showSalesDirection:{type:Boolean,default:!1},showClientInfoIcon:{type:Boolean,default:!1}},emits:["click:client-name","click:client-info"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>n.client.lastLoginAt?en.format(n.client.lastLoginAt,j.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{I.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=Ko,d=z.NButton,u=z.NPopover;return i.openBlock(),i.createElementBlock("div",Ub,[t.showClientInfoIcon?(i.openBlock(),i.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=f=>a.$emit("click:client-info",t.client))},{default:i.withCtx(()=>[i.createVNode(c)]),_:1})):i.createCommentVNode("",!0),i.createVNode(u,{disabled:i.unref(I.isNil)(t.popoverPosition),placement:t.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",Kb,[i.createElementVNode("a",{href:t.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=f=>s(f))},[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",Zb," [ Деактивирован ] "))],8,Gb),t.showCityAndRegion&&t.client.city?(i.openBlock(),i.createElementBlock("span",Qb," г. "+i.toDisplayString(t.client.city.name)+", "+i.toDisplayString(t.client.city.region.name),1)):i.createCommentVNode("",!0)])]),default:i.withCtx(()=>[t.client.alternativeName?(i.openBlock(),i.createElementBlock("div",Jb,i.toDisplayString(t.client.alternativeName),1)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("span",e_," Последний вход: "+i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),n_={class:"text-base"},i_={},Ud=i.defineComponent({...i_,__name:"contragent-with-short-info",props:{contragent:{}},setup(t){const e=t,n=i.computed(()=>jn.getFormatEntityName(e.contragent));return(r,o)=>(i.openBlock(),i.createElementBlock("span",n_,i.toDisplayString(n.value),1))}}),r_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function o_(t,e){return i.openBlock(),i.createElementBlock("svg",r_,[...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 s_=i.markRaw({name:"tabler-mail",render:o_}),a_=["href"],l_={},c_=i.defineComponent({...l_,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(t){return(e,n)=>{const r=s_;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,a_)],2)}}}),d_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function u_(t,e){return i.openBlock(),i.createElementBlock("svg",d_,[...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 Kd=i.markRaw({name:"fa6-brands-viber",render:u_}),h_={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},f_=["id"],m_=["id"],g_=["fill"],p_=["fill"];function y_(t,e){return i.openBlock(),i.createElementBlock("svg",h_,[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,f_),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,m_)]),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,g_),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,p_),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 Gd=i.markRaw({name:"logos-whatsapp-icon",render:y_,setup(){const t=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+t(),SVGHW6lecxh:"uicons-"+t()}}}}),b_={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},__=["id"],w_=["fill"];function x_(t,e){return i.openBlock(),i.createElementBlock("svg",b_,[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.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,w_),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 Zd=i.markRaw({name:"logos-telegram",render:x_,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),k_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function v_(t,e){return i.openBlock(),i.createElementBlock("svg",k_,[...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 Qd=i.markRaw({name:"ion-call",render:v_}),C_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function S_(t,e){return i.openBlock(),i.createElementBlock("svg",C_,[...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 B_=i.markRaw({name:"tabler-phone-call",render:S_}),T_={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},N_=["href"],$_=["href"],E_=["href"],R_=["href"],P_={},F_=i.defineComponent({...P_,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(t){const e=t,n=i.computed(()=>{try{return e.phone?ar.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=i.computed(()=>{var l;return I.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),o=i.computed(()=>{var l;return I.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=i.computed(()=>{var l;return I.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=B_,u=Qd,f=Zd,m=Gd,g=Kd;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]=h=>a.value=!a.value),onFocusout:c[1]||(c[1]=h=>a.value=!1),onMouseleave:c[2]||(c[2]=h=>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",T_,[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,N_)):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(f)],8,$_)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${s.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(m)],8,E_)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${s.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[i.createVNode(g)],8,R_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),V_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function M_(t,e){return i.openBlock(),i.createElementBlock("svg",V_,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"m20 8l-8 5l-8-5V6l8 5l8-5m0-2H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2"},null,-1)])])}const I_=i.markRaw({name:"mdi-envelope",render:M_}),A_={class:"flex flex-col gap-1"},O_={key:0,class:"mb-2 flex flex-col text-base"},z_={key:0,class:"text-sc-dark-grey text-sm"},D_={key:1,class:"whitespace-nowrap text-sm"},L_={key:2,class:"whitespace-nowrap text-sm"},H_={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},W_=["href"],j_=["href"],q_=["href"],X_=["href"],Y_=["href"],U_={key:0,class:"flex flex-col text-base"},K_={key:0,class:"text-sc-dark-grey text-sm"},G_={key:1,class:"mt-2 text-sm"},Z_={key:0,class:"-mt-1"},Q_={},J_=i.defineComponent({...Q_,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(t){const e=t,n=i.computed(()=>jn.getFormatEntityName(e.contact)),r=i.computed(()=>{try{return e.contact.phone?ar.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),o=i.computed(()=>{var d;return I.isString(r.value)?!1:((d=r.value)==null?void 0:d.isValid())??!1}),s=i.computed(()=>{var d;return I.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("INTERNATIONAL"))??""}),a=i.computed(()=>{var d;return I.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 f=Qd,m=Zd,g=Gd,h=Kd,p=I_,y=z.NPopover;return i.openBlock(),i.createElementBlock("div",A_,[i.createVNode(y,{disabled:t.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var v,x,N,T;return[i.createElementVNode("div",{class:i.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(v=t.contact)!=null&&v.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${t.classes}`),style:i.normalizeStyle(t.styles),onMouseenter:u[0]||(u[0]=k=>c.value=!0),onFocusin:u[1]||(u[1]=k=>c.value=!0),onMouseleave:u[2]||(u[2]=k=>c.value=!1),onFocusout:u[3]||(u[3]=k=>c.value=!1)},[i.createElementVNode("div",null,[t.fullView&&(t.contact.name||(x=t.contact)!=null&&x.position)?(i.openBlock(),i.createElementBlock("div",O_,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),(N=t.contact)!=null&&N.position?(i.openBlock(),i.createElementBlock("span",z_,i.toDisplayString((T=t.contact)==null?void 0:T.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),t.contact.phone?(i.openBlock(),i.createElementBlock("div",D_,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("div",L_,i.toDisplayString(t.contact.email),1)):i.createCommentVNode("",!0),l.value&&c.value?(i.openBlock(),i.createElementBlock("div",H_,[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(f)],8,W_)):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(m)],8,j_)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${a.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(g)],8,q_)):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(h)],8,X_)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${t.contact.email}`,class:"hover:text-3xl"},[i.createVNode(p)],8,Y_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var v,x,N,T;return[t.contact.name?(i.openBlock(),i.createElementBlock("div",U_,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),(v=t.contact)!=null&&v.position?(i.openBlock(),i.createElementBlock("span",K_,i.toDisplayString((x=t.contact)==null?void 0:x.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),(N=t.contact)!=null&&N.comment?(i.openBlock(),i.createElementBlock("div",G_,[u[4]||(u[4]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((T=t.contact)==null?void 0:T.comment),1)])):i.createCommentVNode("",!0)]}),_:1},8,["disabled"]),t.fullView&&((b=t.contact)!=null&&b.comment)?(i.openBlock(),i.createElementBlock("div",Z_,[u[5]||(u[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((_=t.contact)==null?void 0:_.comment),1)])):i.createCommentVNode("",!0)])}}});class e1{constructor(e){S(this,"minHeight");S(this,"maxHeights");S(this,"minWidth");S(this,"maxWidths");S(this,"netType");S(this,"color");S(this,"mountType");S(this,"descriptions");S(this,"crossbarCount");S(this,"heightOverlaps");S(this,"widthOverlaps");S(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=Yo.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=Yo.objectToSnake(e.heightOverlaps),this.widthOverlaps=Yo.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function t1(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.SandwichM2?!0:t.properties.configuratorSettings!==void 0&&I.isArray(t.products)&&t.products.length>0}const n1={class:"flex flex-wrap gap-2"},i1={class:"flex flex-col"},r1={class:"flex flex-col"},o1={},s1=i.defineComponent({...o1,__name:"date-range",props:{clearable:{type:Boolean,default:!0},dateRange:{default:void 0},dateFormat:{default:()=>j.useBaseConfigStateStore().config.dateFormats.uiDate},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1}},emits:["update:date-range"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{if(n.predefinedDateRanges)return n.predefinedDateRanges;if(n.useDefaultPredefinedDateRanges){const a={};return I.forOwn(j.DateTimeProvider.defaultDateRanges(),(l,c)=>{a[c]={label:l.label,from:l.from??void 0,to:l.to??void 0}}),a}}),s=(a,l)=>{r("update:date-range",{from:a?en.startOfDay(new Date(a)):void 0,to:l?en.endOfDay(new Date(l)):void 0})};return(a,l)=>{var u,f,m,g,h,p;const c=z.NButton,d=z.NDatePicker;return i.openBlock(),i.createElementBlock("div",n1,[i.createVNode(d,{value:((f=(u=t.dateRange)==null?void 0:u.from)==null?void 0:f.getTime())??null,clearable:t.clearable,"is-date-disabled":y=>{var b,_;return((b=t.dateRange)==null?void 0:b.to)&&y>((_=t.dateRange)==null?void 0:_.to)},disabled:(m=t.disabled)==null?void 0:m.from,format:t.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[0]||(l[0]=y=>{var b,_;return s(y,(_=(b=t.dateRange)==null?void 0:b.to)==null?void 0:_.getTime())})},i.createSlots({_:2},[o.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",i1,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,(y,b)=>(i.openBlock(),i.createBlock(c,{key:b,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:_=>{var v,x;return s((v=y==null?void 0:y.from)==null?void 0:v.getTime(),(x=y==null?void 0:y.to)==null?void 0:x.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"]),i.createVNode(d,{value:((h=(g=t.dateRange)==null?void 0:g.to)==null?void 0:h.getTime())??null,clearable:t.clearable,"is-date-disabled":y=>{var b,_;return((b=t.dateRange)==null?void 0:b.from)&&y<((_=t.dateRange)==null?void 0:_.from)},disabled:(p=t.disabled)==null?void 0:p.to,format:t.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[1]||(l[1]=y=>{var b,_;return s((_=(b=t.dateRange)==null?void 0:b.from)==null?void 0:_.getTime(),y)})},i.createSlots({_:2},[o.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",r1,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,(y,b)=>(i.openBlock(),i.createBlock(c,{key:b,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:_=>{var v,x;return s((v=y==null?void 0:y.from)==null?void 0:v.getTime(),(x=y==null?void 0:y.to)==null?void 0:x.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"])])}}}),a1={class:"sc-lbl-date text-nowrap"},l1={},xo=i.defineComponent({...l1,__name:"date-time-label",props:{date:{},isTimeSecondary:{type:Boolean},isTimeOnSecondLine:{type:Boolean},isShowTime:{type:Boolean,default:!0}},setup(t){const e=t,n=i.computed(()=>en.format(e.date,j.useBaseConfigStateStore().config.dateFormats.uiDate)),r=i.computed(()=>en.format(e.date,"HH:mm"));return(o,s)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-col":t.isTimeOnSecondLine})},[i.createElementVNode("span",a1,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))}}),c1={class:"flex flex-row gap-2.5"},d1={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},u1={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},h1={class:"mb-0.5 sm:mb-0 sm:ml-3"},f1={},m1=i.defineComponent({...f1,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(t){return(e,n)=>{const r=wo,o=z.NButton,s=z.NPopover;return i.openBlock(),i.createElementBlock("div",c1,[i.createElementVNode("div",d1,[i.renderSlot(e.$slots,"main")]),i.createElementVNode("div",null,[i.createElementVNode("div",u1,[i.renderSlot(e.$slots,"extra-buttons"),i.createElementVNode("div",h1,[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)])])])])}}}),g1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function p1(t,e){return i.openBlock(),i.createElementBlock("svg",g1,[...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 y1=i.markRaw({name:"ion-download-outline",render:p1}),b1={},_1=i.defineComponent({...b1,__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=y1;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"])}}}),w1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function x1(t,e){return i.openBlock(),i.createElementBlock("svg",w1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"square","stroke-miterlimit":"10","stroke-width":"44",d:"M465 127L241 384l-92-92m-9 93l-93-93m316-165L236 273"},null,-1)])])}const k1=i.markRaw({name:"ion-checkmark-done-sharp",render:x1}),v1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function C1(t,e){return i.openBlock(),i.createElementBlock("svg",v1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128h80m-384 0h240m64 256h80m-384 0h240m-96-128h240m-384 0h80"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"128",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"176",cy:"256",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"384",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1)])])}const S1=i.markRaw({name:"ion-options-outline",render:C1}),B1={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},T1={class:"flex-auto"},N1={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"},$1={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"},E1={},Ys=i.defineComponent({...E1,__name:"inline-view",props:{disabled:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!1},showApplyButton:{type:Boolean,default:!1},showCancelButton:{type:Boolean,default:!1}},emits:["edit","apply","cancel"],setup(t,{emit:e}){const n=e,r=i.ref(!1),o=()=>{n("edit")},s=()=>{r.value=!1},a=()=>{r.value=!0,n("apply",s)},l=()=>{n("cancel",s)};return(c,d)=>{const u=S1,f=z.NButton,m=z.NPopover,g=k1,h=wo;return i.openBlock(),i.createElementBlock("div",B1,[i.createElementVNode("div",T1,[i.renderSlot(c.$slots,"default")]),i.createElementVNode("div",null,[i.createElementVNode("div",N1,[i.createElementVNode("div",$1,[t.showEditButton?(i.openBlock(),i.createBlock(m,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(f,{disabled:t.disabled||r.value,type:"info",ghost:"",size:"small",onClick:o},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[0]||(d[0]=i.createTextVNode(" Редактировать данные ",-1))]),_:1})):i.createCommentVNode("",!0),t.showApplyButton?(i.openBlock(),i.createBlock(m,{key:1,disabled:r.value,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(f,{disabled:t.disabled||r.value,type:"primary",size:"small",onClick:a},{default:i.withCtx(()=>[i.createVNode(g)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[1]||(d[1]=i.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),t.showCancelButton?(i.openBlock(),i.createBlock(m,{key:2,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(f,{disabled:t.disabled||r.value,type:"error",size:"small",onClick:l},{default:i.withCtx(()=>[i.createVNode(h)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[2]||(d[2]=i.createTextVNode(" Отменить изменения ",-1))]),_:1})):i.createCommentVNode("",!0)]),i.renderSlot(c.$slots,"extra-buttons")])])])}}}),R1={},Jd=i.defineComponent({...R1,__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(Ys,{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(Ys,{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"]))]))}}),P1={},F1=i.defineComponent({...P1,__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=I.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"]))}}),V1={},M1=i.defineComponent({...V1,__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=I.debounce(()=>o("update:value",s.value),a.value),c=g=>{s.value=g,l()};i.watch(()=>r.value,g=>{s.value=g});const d=i.ref(null);return e({focus:()=>{var g;return(g=d.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=d.value)==null?void 0:g.blur()},select:()=>{var g;return(g=d.value)==null?void 0:g.select()}}),(g,h)=>(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:h[0]||(h[0]=p=>o("keydown",p)),onInput:h[1]||(h[1]=p=>o("input",p)),onFocus:h[2]||(h[2]=p=>o("focus",p))},{prefix:i.withCtx(()=>[i.renderSlot(g.$slots,"prefix")]),_:3},8,["value","clearable","parse","show-button","placeholder","min","max","step","validator"]))}}),I1={},A1=i.defineComponent({...I1,__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=I.debounce(c=>r("update:value",c),n.debounceTime??0),a=c=>{let d="";if(I.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(I.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof ar.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=ar.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof ar.ParseError)o.value=d;else throw u}};return i.watch(()=>n.value,c=>{var d;(c==null?void 0:c.replaceAll(/\D*/g,""))!==((d=o.value)==null?void 0:d.replaceAll(/\D*/g,""))&&l(c)},{immediate:!0}),i.onBeforeMount(()=>l(o.value??"")),(c,d)=>(i.openBlock(),i.createBlock(i.unref(af.VueTelInput),{modelValue:o.value,"onUpdate:modelValue":[d[0]||(d[0]=u=>o.value=u),a],"auto-default-country":!1,"auto-format":!0,"default-country":t.defaultCountry,disabled:t.disabled,"input-options":{placeholder:t.placeholder},"preferred-countries":t.preferredCountries,"only-countries":t.onlyCountries,mode:"international",class:"tel-input"},null,8,["modelValue","default-country","disabled","input-options","preferred-countries","only-countries"]))}}),O1=qn(A1,[["__scopeId","data-v-751dbb0e"]]),z1={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function D1(t,e){return i.openBlock(),i.createElementBlock("svg",z1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"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 L1=i.markRaw({name:"tabler-external-link",render:D1}),H1={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},W1=["href"],j1={},q1=i.defineComponent({...j1,__name:"external-link",props:{text:{},url:{},description:{}},setup(t){return(e,n)=>{const r=L1,o=z.NTooltip;return i.openBlock(),i.createBlock(o,{disabled:i.unref(I.isUndefined)(t.description),placement:"top-start"},{trigger:i.withCtx(()=>[i.createElementVNode("span",H1,[i.createElementVNode("a",{href:t.url,target:"_blank",class:"no-underline"},i.toDisplayString(t.text),9,W1),i.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.description),1)]),_:1},8,["disabled"])}}}),X1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Y1(t,e){return i.openBlock(),i.createElementBlock("svg",X1,[...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 U1=i.markRaw({name:"ion-remove-circle-outline",render:Y1});let ko=[];const eu=new WeakMap;function K1(){ko.forEach(t=>t(...eu.get(t))),ko=[]}function tu(t,...e){eu.set(t,e),!ko.includes(t)&&ko.push(t)===1&&requestAnimationFrame(K1)}function xr(t,e){let{target:n}=t;for(;n;){if(n.dataset&&n.dataset[e]!==void 0)return!0;n=n.parentElement}return!1}function kr(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 Cr(t){if(t!=null)return typeof t=="number"?`${t}px`:t.endsWith("px")?t:`${t}px`}function rn(t,e){const n=t.trim().split(/\s+/g),r={top:n[0]};switch(n.length){case 1:r.right=n[0],r.bottom=n[0],r.left=n[0];break;case 2:r.right=n[1],r.left=n[1],r.bottom=n[0];break;case 3:r.right=n[1],r.bottom=n[2],r.left=n[1];break;case 4:r.right=n[1],r.bottom=n[2],r.left=n[3];break;default:throw new Error("[seemly/getMargin]:"+t+" is not a valid value.")}return e===void 0?r:r[e]}const nu={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 G1(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 Z1(t,e,n){e/=100,n/=100;let r=e*Math.min(n,1-n),o=(s,a=(s+t/30)%12)=>n-r*Math.max(Math.min(a-3,9-a,1),-1);return[o(0)*255,o(8)*255,o(4)*255]}const wn="^\\s*",xn="\\s*$",Qn="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Ht="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",pi="([0-9A-Fa-f])",yi="([0-9A-Fa-f]{2})",iu=new RegExp(`${wn}hsl\\s*\\(${Ht},${Qn},${Qn}\\)${xn}`),ru=new RegExp(`${wn}hsv\\s*\\(${Ht},${Qn},${Qn}\\)${xn}`),ou=new RegExp(`${wn}hsla\\s*\\(${Ht},${Qn},${Qn},${Ht}\\)${xn}`),su=new RegExp(`${wn}hsva\\s*\\(${Ht},${Qn},${Qn},${Ht}\\)${xn}`),Q1=new RegExp(`${wn}rgb\\s*\\(${Ht},${Ht},${Ht}\\)${xn}`),J1=new RegExp(`${wn}rgba\\s*\\(${Ht},${Ht},${Ht},${Ht}\\)${xn}`),ew=new RegExp(`${wn}#${pi}${pi}${pi}${xn}`),tw=new RegExp(`${wn}#${yi}${yi}${yi}${xn}`),nw=new RegExp(`${wn}#${pi}${pi}${pi}${pi}${xn}`),iw=new RegExp(`${wn}#${yi}${yi}${yi}${yi}${xn}`);function At(t){return parseInt(t,16)}function rw(t){try{let e;if(e=ou.exec(t))return[Co(e[1]),Jn(e[5]),Jn(e[9]),_i(e[13])];if(e=iu.exec(t))return[Co(e[1]),Jn(e[5]),Jn(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${t}.`)}catch(e){throw e}}function ow(t){try{let e;if(e=su.exec(t))return[Co(e[1]),Jn(e[5]),Jn(e[9]),_i(e[13])];if(e=ru.exec(t))return[Co(e[1]),Jn(e[5]),Jn(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${t}.`)}catch(e){throw e}}function bi(t){try{let e;if(e=tw.exec(t))return[At(e[1]),At(e[2]),At(e[3]),1];if(e=Q1.exec(t))return[_t(e[1]),_t(e[5]),_t(e[9]),1];if(e=J1.exec(t))return[_t(e[1]),_t(e[5]),_t(e[9]),_i(e[13])];if(e=ew.exec(t))return[At(e[1]+e[1]),At(e[2]+e[2]),At(e[3]+e[3]),1];if(e=iw.exec(t))return[At(e[1]),At(e[2]),At(e[3]),_i(At(e[4])/255)];if(e=nw.exec(t))return[At(e[1]+e[1]),At(e[2]+e[2]),At(e[3]+e[3]),_i(At(e[4]+e[4])/255)];if(t in nu)return bi(nu[t]);if(iu.test(t)||ou.test(t)){const[n,r,o,s]=rw(t);return[...Z1(n,r,o),s]}else if(ru.test(t)||su.test(t)){const[n,r,o,s]=ow(t);return[...G1(n,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${t}.`)}catch(e){throw e}}function sw(t){return t>1?1:t<0?0:t}function Us(t,e,n,r){return`rgba(${_t(t)}, ${_t(e)}, ${_t(n)}, ${sw(r)})`}function Ks(t,e,n,r,o){return _t((t*e*(1-r)+n*r)/o)}function aw(t,e){Array.isArray(t)||(t=bi(t)),Array.isArray(e)||(e=bi(e));const n=t[3],r=e[3],o=_i(n+r-n*r);return Us(Ks(t[0],n,e[0],r,o),Ks(t[1],n,e[1],r,o),Ks(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"?Us(n,r,o,e.alpha):Us(n,r,o,s)}function vo(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:bi(t),{lightness:a=1,alpha:l=1}=e;return lw([n*a,r*a,o*a,s*l])}function _i(t){const e=Math.round(Number(t)*100)/100;return e>1?1:e<0?0:e}function Co(t){const e=Math.round(Number(t));return e>=360||e<0?0:e}function _t(t){const e=Math.round(Number(t));return e>255?255:e<0?0:e}function Jn(t){const e=Math.round(Number(t));return e>100?100:e<0?0:e}function lw(t){const[e,n,r]=t;return 3 in t?`rgba(${_t(e)}, ${_t(n)}, ${_t(r)}, ${_i(t[3])})`:`rgba(${_t(e)}, ${_t(n)}, ${_t(r)}, 1)`}function cw(t=8){return Math.random().toString(16).slice(2,2+t)}function au(t){return Array.isArray(t)?t:[t]}const Gs={STOP:"STOP"};function lu(t,e){const n=e(t);t.children!==void 0&&n!==Gs.STOP&&t.children.forEach(r=>lu(r,e))}function dw(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 uw(t,e){const{isLeaf:n}=t;return n!==void 0?n:!e(t)}function hw(t){return t.children}function fw(t){return t.key}function mw(){return!1}function gw(t,e){const{isLeaf:n}=t;return!(n===!1&&!Array.isArray(e(t)))}function pw(t){return t.disabled===!0}function yw(t,e){return t.isLeaf===!1&&!Array.isArray(e(t))}function bw(t,e){if(t.isLeaf===!0){const n=e(t);if(Array.isArray(n)&&n.length>0)return!0}return!1}function Zs(t){var e;return t==null?[]:Array.isArray(t)?t:(e=t.checkedKeys)!==null&&e!==void 0?e:[]}function Qs(t){var e;return t==null||Array.isArray(t)?[]:(e=t.indeterminateKeys)!==null&&e!==void 0?e:[]}function _w(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)||n.add(r)}),Array.from(n)}function ww(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)&&n.delete(r)}),Array.from(n)}function xw(t){return(t==null?void 0:t.type)==="group"}function kw(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 vw extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function Cw(t,e,n,r){return So(e.concat(t),n,r,!1)}function Sw(t,e){const n=new Set;return t.forEach(r=>{const o=e.treeNodeMap.get(r);if(o!==void 0){let s=o.parent;for(;s!==null&&!(s.disabled||n.has(s.key));)n.add(s.key),s=s.parent}}),n}function Bw(t,e,n,r){const o=So(e,n,r,!1),s=So(t,n,r,!0),a=Sw(t,n),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function Js(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:_w(n,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:ww(n,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(n),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let f;o!==void 0?f=Bw(o,n,e,d):r!==void 0?f=Cw(r,n,e,d):f=So(n,e,d,!1);const m=c==="parent",g=c==="child"||l,h=f,p=new Set,y=Math.max.apply(null,Array.from(u.keys()));for(let b=y;b>=0;b-=1){const _=b===0,v=u.get(b);for(const x of v){if(x.isLeaf)continue;const{key:N,shallowLoaded:T}=x;if(g&&T&&x.children.forEach(B=>{!B.disabled&&!B.isLeaf&&B.shallowLoaded&&h.has(B.key)&&h.delete(B.key)}),x.disabled||!T)continue;let k=!0,$=!1,w=!0;for(const B of x.children){const E=B.key;if(!B.disabled){if(w&&(w=!1),h.has(E))$=!0;else if(p.has(E)){$=!0,k=!1;break}else if(k=!1,$)break}}k&&!w?(m&&x.children.forEach(B=>{!B.disabled&&h.has(B.key)&&h.delete(B.key)}),h.add(N)):$&&p.add(N),_&&g&&h.has(N)&&h.delete(N)}}return{checkedKeys:Array.from(h),indeterminateKeys:Array.from(p)}}function So(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&&lu(d,u=>{if(u.disabled)return Gs.STOP;const{key:f}=u;if(!a.has(f)&&(a.add(f),l.add(f),yw(u.rawNode,s))){if(r)return Gs.STOP;if(!n)throw new vw}})}),l}function Tw(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 Nw(t){if(t.length===0)return null;const e=t[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function $w(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 cu(t,e,{loop:n=!1,includeDisabled:r=!1}={}){const o=e==="prev"?Ew:$w,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=ea(d,s);u!==null?l=u:c(o(d,n))}else{const u=o(d,!1);if(u!==null)c(u);else{const f=Rw(d);f!=null&&f.isGroup?c(o(f,n)):n&&c(o(d,!0))}}}}return c(t),l}function Ew(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 Rw(t){return t.parent}function ea(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=ea(d,e);if(u!==null)return u}else return d}}return null}const Pw={getChild(){return this.ignored?null:ea(this)},getParent(){const{parent:t}=this;return t!=null&&t.isGroup?t.getParent():t},getNext(t={}){return cu(this,"next",t)},getPrev(t={}){return cu(this,"prev",t)}};function Fw(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 Vw(t,e){const n=t.key;for(;e;){if(e.key===n)return!0;e=e.parent}return!1}var Mw={};function du(t,e,n,r,o,s=null,a=0){const l=[];return t.forEach((c,d)=>{var u;Mw.NODE_ENV!=="production"&&bw(c,o)&&console.error("[treemate]: node",c,"is invalid");const f=Object.create(r);if(f.rawNode=c,f.siblings=l,f.level=a,f.index=d,f.isFirstChild=d===0,f.isLastChild=d+1===t.length,f.parent=s,!f.ignored){const m=o(c);Array.isArray(m)&&(f.children=du(m,e,n,r,o,f,a+1))}l.push(f),e.set(f.key,f),n.has(a)||n.set(a,[]),(u=n.get(a))===null||u===void 0||u.push(f)}),l}function Iw(t,e={}){var n;const r=new Map,o=new Map,{getDisabled:s=pw,getIgnored:a=mw,getIsGroup:l=xw,getKey:c=fw}=e,d=(n=e.getChildren)!==null&&n!==void 0?n:hw,u=e.ignoreEmptyChildren?x=>{const N=d(x);return Array.isArray(N)?N.length?N:null:N}:d,f=Object.assign({get key(){return c(this.rawNode)},get disabled(){return s(this.rawNode)},get isGroup(){return l(this.rawNode)},get isLeaf(){return uw(this.rawNode,u)},get shallowLoaded(){return gw(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(x){return Vw(this,x)}},Pw),m=du(t,r,o,f,u);function g(x){if(x==null)return null;const N=r.get(x);return N&&!N.isGroup&&!N.ignored?N:null}function h(x){if(x==null)return null;const N=r.get(x);return N&&!N.ignored?N:null}function p(x,N){const T=h(x);return T?T.getPrev(N):null}function y(x,N){const T=h(x);return T?T.getNext(N):null}function b(x){const N=h(x);return N?N.getParent():null}function _(x){const N=h(x);return N?N.getChild():null}const v={treeNodes:m,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(x){return Fw(m,x)},getNode:g,getPrev:p,getNext:y,getParent:b,getChild:_,getFirstAvailableNode(){return Nw(m)},getPath(x,N={}){return Tw(x,N,v)},getCheckedKeys(x,N={}){const{cascade:T=!0,leafOnly:k=!1,checkStrategy:$="all",allowNotLoaded:w=!1}=N;return Js({checkedKeys:Zs(x),indeterminateKeys:Qs(x),cascade:T,leafOnly:k,checkStrategy:$,allowNotLoaded:w},v)},check(x,N,T={}){const{cascade:k=!0,leafOnly:$=!1,checkStrategy:w="all",allowNotLoaded:B=!1}=T;return Js({checkedKeys:Zs(N),indeterminateKeys:Qs(N),keysToCheck:x==null?[]:au(x),cascade:k,leafOnly:$,checkStrategy:w,allowNotLoaded:B},v)},uncheck(x,N,T={}){const{cascade:k=!0,leafOnly:$=!1,checkStrategy:w="all",allowNotLoaded:B=!1}=T;return Js({checkedKeys:Zs(N),indeterminateKeys:Qs(N),keysToUncheck:x==null?[]:au(x),cascade:k,leafOnly:$,checkStrategy:w,allowNotLoaded:B},v)},getNonLeafKeys(x={}){return dw(m,x)}};return v}function Bo(t){return t.composedPath()[0]}const Aw={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function Ow(t,e,n){if(t==="mousemoveoutside"){const r=o=>{e.contains(Bo(o))||n(o)};return{mousemove:r,touchstart:r}}else if(t==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(Bo(a))},s=a=>{r&&(e.contains(Bo(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 uu(t,e,n){const r=Aw[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=Ow(t,e,n)),s}function zw(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=uu(t,e,n);return Object.keys(o).forEach(s=>{Rt(s,document,o[s],r)}),!0}return!1}function Dw(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=uu(t,e,n);return Object.keys(o).forEach(s=>{at(s,document,o[s],r)}),!0}return!1}function Lw(){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(k,$,w){const B=k[$];return k[$]=function(){return w.apply(k,arguments),B.apply(k,arguments)},k}function s(k,$){k[$]=Event.prototype[$]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var k;return(k=a.get(this))!==null&&k!==void 0?k:null}function d(k,$){l!==void 0&&Object.defineProperty(k,"currentTarget",{configurable:!0,enumerable:!0,get:$??l.get})}const u={bubble:{},capture:{}},f={};function m(){const k=function($){const{type:w,eventPhase:B,bubbles:E}=$,M=Bo($);if(B===2)return;const R=B===1?"capture":"bubble";let O=M;const W=[];for(;O===null&&(O=window),W.push(O),O!==window;)O=O.parentNode||null;const G=u.capture[w],Q=u.bubble[w];if(o($,"stopPropagation",n),o($,"stopImmediatePropagation",r),d($,c),R==="capture"){if(G===void 0)return;for(let H=W.length-1;H>=0&&!t.has($);--H){const P=W[H],D=G.get(P);if(D!==void 0){a.set($,P);for(const A of D){if(e.has($))break;A($)}}if(H===0&&!E&&Q!==void 0){const A=Q.get(P);if(A!==void 0)for(const L of A){if(e.has($))break;L($)}}}}else if(R==="bubble"){if(Q===void 0)return;for(let H=0;H<W.length&&!t.has($);++H){const P=W[H],D=Q.get(P);if(D!==void 0){a.set($,P);for(const A of D){if(e.has($))break;A($)}}}}s($,"stopPropagation"),s($,"stopImmediatePropagation"),d($)};return k.displayName="evtdUnifiedHandler",k}function g(){const k=function($){const{type:w,eventPhase:B}=$;if(B!==2)return;const E=f[w];E!==void 0&&E.forEach(M=>M($))};return k.displayName="evtdUnifiedWindowEventHandler",k}const h=m(),p=g();function y(k,$){const w=u[k];return w[$]===void 0&&(w[$]=new Map,window.addEventListener($,h,k==="capture")),w[$]}function b(k){return f[k]===void 0&&(f[k]=new Set,window.addEventListener(k,p)),f[k]}function _(k,$){let w=k.get($);return w===void 0&&k.set($,w=new Set),w}function v(k,$,w,B){const E=u[$][w];if(E!==void 0){const M=E.get(k);if(M!==void 0&&M.has(B))return!0}return!1}function x(k,$){const w=f[k];return!!(w!==void 0&&w.has($))}function N(k,$,w,B){let E;if(typeof B=="object"&&B.once===!0?E=G=>{T(k,$,E,B),w(G)}:E=w,zw(k,$,E,B))return;const R=B===!0||typeof B=="object"&&B.capture===!0?"capture":"bubble",O=y(R,k),W=_(O,$);if(W.has(E)||W.add(E),$===window){const G=b(k);G.has(E)||G.add(E)}}function T(k,$,w,B){if(Dw(k,$,w,B))return;const M=B===!0||typeof B=="object"&&B.capture===!0,R=M?"capture":"bubble",O=y(R,k),W=_(O,$);if($===window&&!v($,M?"bubble":"capture",k,w)&&x(k,w)){const Q=f[k];Q.delete(w),Q.size===0&&(window.removeEventListener(k,p),f[k]=void 0)}W.has(w)&&W.delete(w),W.size===0&&O.delete($),O.size===0&&(window.removeEventListener(k,h,R==="capture"),u[R][k]=void 0)}return{on:N,off:T}}const{on:Rt,off:at}=Lw(),Zi="@@mmoContext",Hw={mounted(t,{value:e}){t[Zi]={handler:void 0},typeof e=="function"&&(t[Zi].handler=e,Rt("mousemoveoutside",t,e))},updated(t,{value:e}){const n=t[Zi];typeof e=="function"?n.handler?n.handler!==e&&(at("mousemoveoutside",t,n.handler),n.handler=e,Rt("mousemoveoutside",t,e)):(t[Zi].handler=e,Rt("mousemoveoutside",t,e)):n.handler&&(at("mousemoveoutside",t,n.handler),n.handler=void 0)},unmounted(t){const{handler:e}=t[Zi];e&&at("mousemoveoutside",t,e),t[Zi].handler=void 0}},Qi="@@coContext",To={mounted(t,{value:e,modifiers:n}){t[Qi]={handler:void 0},typeof e=="function"&&(t[Qi].handler=e,Rt("clickoutside",t,e,{capture:n.capture}))},updated(t,{value:e,modifiers:n}){const r=t[Qi];typeof e=="function"?r.handler?r.handler!==e&&(at("clickoutside",t,r.handler,{capture:n.capture}),r.handler=e,Rt("clickoutside",t,e,{capture:n.capture})):(t[Qi].handler=e,Rt("clickoutside",t,e,{capture:n.capture})):r.handler&&(at("clickoutside",t,r.handler,{capture:n.capture}),r.handler=void 0)},unmounted(t,{modifiers:e}){const{handler:n}=t[Qi];n&&at("clickoutside",t,n,{capture:e.capture}),t[Qi].handler=void 0}};function Ww(t,e){console.error(`[vdirs/${t}]: ${e}`)}class jw{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&&Ww("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 ta=new jw,Ji="@@ziContext",hu={mounted(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n;t[Ji]={enabled:!!o,initialized:!1},o&&(ta.ensureZIndex(t,r),t[Ji].initialized=!0)},updated(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n,s=t[Ji].enabled;o&&!s&&(ta.ensureZIndex(t,r),t[Ji].initialized=!0),t[Ji].enabled=!!o},unmounted(t,e){if(!t[Ji].initialized)return;const{value:n={}}=e,{zIndex:r}=n;ta.unregister(t,r)}};function qw(t){const e=i.ref(!!t.value);if(e.value)return i.readonly(e);const n=i.watch(t,r=>{r&&(e.value=!0,n())});return i.readonly(e)}function Zt(t){const e=i.computed(t),n=i.ref(e.value);return i.watch(e,r=>{n.value=r}),typeof t=="function"?n:{__v_isRef:!0,get value(){return n.value},set value(r){t.set(r)}}}const Xw=typeof window<"u";let er,Sr;(()=>{var t,e;er=Xw?(e=(t=document)===null||t===void 0?void 0:t.fonts)===null||e===void 0?void 0:e.ready:void 0,Sr=!1,er!==void 0?er.then(()=>{Sr=!0}):Sr=!0})();function Yw(t){if(Sr)return;let e=!1;i.onMounted(()=>{Sr||er==null||er.then(()=>{e||t()})}),i.onBeforeUnmount(()=>{e=!0})}function na(t,e){return i.watch(t,n=>{n!==void 0&&(e.value=n)}),i.computed(()=>t.value===void 0?e.value:t.value)}function No(){const t=i.ref(!1);return i.onMounted(()=>{t.value=!0}),i.readonly(t)}function fu(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 Uw=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function Kw(){return Uw}function ia(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);return r()}function ra(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)){ra(r,e,n);return}if(r.type===i.Fragment){if(r.children===null)return;Array.isArray(r.children)&&ra(r.children,e,n)}else r.type!==i.Comment&&n.push(r)}}),n}function mu(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);const o=ra(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${t}]: slot[${n}] should have exactly one child.`)}let ei=null;function gu(){if(ei===null&&(ei=document.getElementById("v-binder-view-measurer"),ei===null)){ei=document.createElement("div"),ei.id="v-binder-view-measurer";const{style:t}=ei;t.position="fixed",t.left="0",t.right="0",t.top="0",t.bottom="0",t.pointerEvents="none",t.visibility="hidden",document.body.appendChild(ei)}return ei.getBoundingClientRect()}function Gw(t,e){const n=gu();return{top:e,left:t,height:0,width:0,right:n.width-t,bottom:n.height-e}}function oa(t){const e=t.getBoundingClientRect(),n=gu();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 Zw(t){return t.nodeType===9?null:t.parentNode}function pu(t){if(t===null)return null;const e=Zw(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 pu(e)}const yu=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=pu(b),b!==null;)s.push(b);for(const _ of s)Rt("scroll",_,f,!0)},l=()=>{for(const b of s)at("scroll",b,f,!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()},f=()=>{tu(m)},m=()=>{c.forEach(b=>b())},g=new Set,h=b=>{g.size===0&&Rt("resize",window,y),g.has(b)||g.add(b)},p=b=>{g.has(b)&&g.delete(b),g.size===0&&at("resize",window,y)},y=()=>{g.forEach(b=>b())};return i.onBeforeUnmount(()=>{at("resize",window,y),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:h,removeResizeListener:p}},render(){return ia("binder",this.$slots)}}),bu=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(mu("follower",this.$slots),[[e]]):mu("follower",this.$slots)}}),Qw="@css-render/vue3-ssr";function Jw(t,e){return`<style cssr-id="${t}">
|
|
103
|
+
`}},lo=Wi.Multiply,Sp=[1,0,0,0,1,0,0,0,1],Zn=new hn(9),Bp=bt.Utils,Pc=new re,Ns=new hn([0,0,1,0,0,1,0,1,1,0,1,1]),xe={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:Ye.document?Ye.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new Wi,group:{removeChild:function(t,e){if(t.children)for(let n=0;n<t.children.length;n++)xe.group.removeChild(t.children[n],e);t._renderer.texture&&(e.deleteTexture(t._renderer.texture),delete t._renderer.texture),t._renderer.positionBuffer&&(e.deleteBuffer(t._renderer.positionBuffer),delete t._renderer.positionBuffer)},render:function(t,e){if(!this._visible)return;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.parent,r=n._matrix&&n._matrix.manual||n._flagMatrix,o=this._matrix.manual||this._flagMatrix;if((r||o)&&(this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Zn),lo(Zn,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=bt.Utils.getRendererType(this._mask._renderer.type);xe[a].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}this._flagOpacity=n._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(n&&n._renderer?n._renderer.opacity:1);let s;if(this._flagSubtractions)for(s=0;s<this.subtractions.length;s++)xe.group.removeChild(this.subtractions[s],t);for(s=0;s<this.children.length;s++){const a=this.children[s],l=bt.Utils.getRendererType(a._renderer.type);xe[l].render.call(a,t,e)}return this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},path:{updateCanvas:function(t,e){let n,r,o,s,a,l,c,d,u,f,m,g,h,p;const y=e._renderer.vertices,b=this.canvas,_=this.ctx,v=t.renderer.ratio,x=Pc.copy(e._renderer.scale).multiply(v),N=e._stroke,T=e._linewidth,k=e._fill,$=e._renderer.opacity||e._opacity,w=e._cap,B=e._join,E=e._miter,M=e._closed,R=e.dashes,O=y.length,W=O-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 G=e._renderer.rect.centroid,Q=G.x,H=G.y;if(_.clearRect(0,0,b.width,b.height),k)if(typeof k=="string")_.fillStyle=k;else{const Y=bt.Utils.getRendererType(k._renderer.type);xe[Y].render.call(k,_,e),_.fillStyle=k._renderer.effect}if(N){if(typeof N=="string")_.strokeStyle=N;else{const Y=bt.Utils.getRendererType(N._renderer.type);xe[Y].render.call(N,_,e),_.strokeStyle=N._renderer.effect}T&&(_.lineWidth=fn(e)),E&&(_.miterLimit=E),B&&(_.lineJoin=B),!M&&w&&(_.lineCap=w)}typeof $=="number"&&(_.globalAlpha=$),R&&R.length>0&&(_.lineDashOffset=R.offset||0,_.setLineDash(R));let P,D,A,L,U,K,V,q;_.save(),_.scale(x.x,x.y),_.translate(Q,H),_.beginPath();for(let Y=0;Y<y.length;Y++){const te=y[Y];switch(g=te.x,h=te.y,te.command){case oe.close:_.closePath();break;case oe.arc:D=te.rx,A=te.ry,L=te.xAxisRotation,U=te.largeArcFlag,K=te.sweepFlag,n=M?Dt(Y-1,O):Math.max(Y-1,0),r=y[n],V=r.x,q=r.y,Bp.renderSvgArcCommand(_,V,q,D,A,U,K,L,g,h);break;case oe.curve:n=M?Dt(Y-1,O):Math.max(Y-1,0),r=y[n],d=r.controls&&r.controls.right||re.zero,u=te.controls&&te.controls.left||re.zero,r._relative?(l=d.x+r.x,c=d.y+r.y):(l=d.x,c=d.y),te._relative?(s=u.x+te.x,a=u.y+te.y):(s=u.x,a=u.y),_.bezierCurveTo(l,c,s,a,g,h),Y>=W&&M&&(o=P,f=te.controls&&te.controls.right||re.zero,m=o.controls&&o.controls.left||re.zero,te._relative?(l=f.x+te.x,c=f.y+te.y):(l=f.x,c=f.y),o._relative?(s=m.x+o.x,a=m.y+o.y):(s=m.x,a=m.y),g=o.x,h=o.y,_.bezierCurveTo(l,c,s,a,g,h));break;case oe.line:_.lineTo(g,h);break;case oe.move:P=te,_.moveTo(g,h);break}}M&&_.closePath(),xe.isHidden.test(k)||(p=k._renderer&&k._renderer.offset,p&&(_.save(),_.translate(-k._renderer.offset.x,-k._renderer.offset.y),_.scale(k._renderer.scale.x,k._renderer.scale.y)),_.fill(),p&&_.restore()),xe.isHidden.test(N)||(p=N._renderer&&N._renderer.offset,p&&(_.save(),_.translate(-N._renderer.offset.x,-N._renderer.offset.y),_.scale(N._renderer.scale.x,N._renderer.scale.y),_.lineWidth=T/N._renderer.scale.x),_.stroke(),p&&_.restore()),_.restore()},getBoundingClientRect:function(t,e,n){let r=1/0,o=-1/0,s=1/0,a=-1/0,l,c;t.forEach(function(d){const u=d.x,f=d.y,m=d.controls;let g,h,p,y,b,_;s=Math.min(f,s),r=Math.min(u,r),o=Math.max(u,o),a=Math.max(f,a),d.controls&&(b=m.left,_=m.right,!(!b||!_)&&(g=d._relative?b.x+u:b.x,h=d._relative?b.y+f:b.y,p=d._relative?_.x+u:_.x,y=d._relative?_.y+f:_.y,!(!g||!h||!p||!y)&&(s=Math.min(h,y,s),r=Math.min(g,p,r),o=Math.max(g,p,o),a=Math.max(h,y,a))))}),typeof e=="number"&&(s-=e,r-=e,o+=e,a+=e),l=o-r,c=a-s,n.top=s,n.left=r,n.right=o,n.bottom=a,n.width=l,n.height=c,n.centroid||(n.centroid={}),n.centroid.x=-r,n.centroid.y=-s},render:function(t,e,n){if(!this._visible||!this._opacity)return this;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,o=bt.Utils.getRendererType(this._renderer.type),s=e[o],a=r._matrix.manual||r._flagMatrix,l=this._matrix.manual||this._flagMatrix,c=this._renderer.parent!==r,d=this._flagVertices||this._flagFill||this._fill instanceof Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ke&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Oe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(a||l||c){this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Zn),lo(Zn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let f,m;this._scale instanceof re?(f=this._scale.x*r._renderer.scale.x,m=this._scale.y*r._renderer.scale.y):(f=this._scale*r._renderer.scale.x,m=this._scale*r._renderer.scale.y),this._renderer.scale.x=f<0?-f:f,this._renderer.scale.y=m<0?-m:m,c&&(this._renderer.parent=r)}if(this._mask){t.clear(t.STENCIL_BUFFER_BIT),t.enable(t.STENCIL_TEST),t.stencilFunc(t.ALWAYS,1,0),t.stencilOp(t.KEEP,t.KEEP,t.REPLACE),t.colorMask(!1,!1,!1,!1);const f=bt.Utils.getRendererType(this._mask._renderer.type);xe[f].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}if(d?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,xe.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),xe.updateTexture.call(xe,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==s&&(t.useProgram(s),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,Ns,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const u=this._renderer.rect;return t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform4f(s.rect,u.left,u.top,u.right,u.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},points:{updateCanvas:function(t,e){let n;const r=this.canvas,o=this.ctx,s=t.renderer.ratio,a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._size*s;let m=f;xe.isHidden.test(a)||(m+=l),r.width=xl(m),r.height=r.width;const g=m/r.width,h=r.width/2,p=r.height/2;if(o.clearRect(0,0,r.width,r.height),c)if(typeof c=="string")o.fillStyle=c;else{const y=bt.Utils.getRendererType(c._renderer.type);xe[y].render.call(c,o,e),o.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")o.strokeStyle=a;else{const y=bt.Utils.getRendererType(a._renderer.type);xe[y].render.call(a,o,e),o.strokeStyle=a._renderer.effect}l&&(o.lineWidth=fn(e)/g)}typeof d=="number"&&(o.globalAlpha=d),u&&u.length>0&&(o.lineDashOffset=u.offset||0,o.setLineDash(u)),o.save(),o.translate(h,p),o.scale(xe.precision,xe.precision),o.beginPath(),o.arc(0,0,f/g*.5,0,pt),o.restore(),closed&&o.closePath(),xe.isHidden.test(c)||(n=c._renderer&&c._renderer.offset,n&&(o.save(),o.translate(-c._renderer.offset.x,-c._renderer.offset.y),o.scale(c._renderer.scale.x,c._renderer.scale.y)),o.fill(),n&&o.restore()),xe.isHidden.test(a)||(n=a._renderer&&a._renderer.offset,n&&(o.save(),o.translate(-a._renderer.offset.x,-a._renderer.offset.y),o.scale(a._renderer.scale.x,a._renderer.scale.y),o.lineWidth=l/a._renderer.scale.x),o.stroke(),n&&o.restore())},render:function(t,e,n){if(!this._visible||!this._opacity)return this;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();let r=this._size;const o=n||this.parent,s=e[this._renderer.type],a=this._sizeAttenuation,l=this._stroke,c=this._linewidth,d=o._matrix.manual||o._flagMatrix,u=this._matrix.manual||this._flagMatrix,f=this._renderer.parent!==o,m=this._renderer.vertices,g=this._renderer.collection.length,h=this._flagVertices,p=this._flagFill||this._fill instanceof Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ke&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Oe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||o._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(d||u||f){this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Zn),lo(Zn,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,f&&(this._renderer.parent=o)}if(h){const y=this._renderer.positionBuffer;y&&t.deleteBuffer(y),this._renderer.positionBuffer=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,this._renderer.positionBuffer),t.vertexAttribPointer(s.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(s.position),t.bufferData(t.ARRAY_BUFFER,m,t.STATIC_DRAW)}return p?(this._renderer.opacity=this._opacity*o._renderer.opacity,xe.updateTexture.call(xe,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture?this:(xe.isHidden.test(l)||(r+=c),r/=xe.precision,a&&(r*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),e.current!==s&&(t.useProgram(s),e.resolution.flagged||t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),e.current=s),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(s,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture),t.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),t.uniform1f(s.size,r*e.resolution.ratio),t.drawArrays(t.POINTS,0,g),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset())}},text:{updateCanvas:function(t,e){const n=this.canvas,r=this.ctx,o=t.renderer.ratio,s=Pc.copy(e._renderer.scale).multiply(o),a=e._stroke,l=e._linewidth,c=e._fill,d=e._renderer.opacity||e._opacity,u=e.dashes,f=e._decoration,m=e._direction;n.width=Math.max(Math.ceil(e._renderer.rect.width*s.x),1),n.height=Math.max(Math.ceil(e._renderer.rect.height*s.y),1);const g=e._renderer.rect.centroid,h=g.x,p=g.y;let y,b,_,v,x,N,T,k,$,w,B;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=m,c)if(typeof c=="string")r.fillStyle=c;else{const M=bt.Utils.getRendererType(c._renderer.type);xe[M].render.call(c,r,e),r.fillStyle=c._renderer.effect}if(a){if(typeof a=="string")r.strokeStyle=a;else{const M=bt.Utils.getRendererType(a._renderer.type);xe[M].render.call(a,r,e),r.strokeStyle=a._renderer.effect}l&&(r.lineWidth=fn(e))}if(typeof d=="number"&&(r.globalAlpha=d),u&&u.length>0&&(r.lineDashOffset=u.offset||0,r.setLineDash(u)),r.save(),r.scale(s.x,s.y),r.translate(h,p),xe.isHidden.test(c)||(c._renderer&&c._renderer.offset?(N=c._renderer.scale.x,T=c._renderer.scale.y,r.save(),r.translate(-c._renderer.offset.x,-c._renderer.offset.y),r.scale(N,T),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,v=c._renderer.offset.y/c._renderer.scale.y,r.fillText(e.value,_,v),r.restore()):r.fillText(e.value,0,0)),xe.isHidden.test(a)||(a._renderer&&a._renderer.offset?(N=a._renderer.scale.x,T=a._renderer.scale.y,r.save(),r.translate(-a._renderer.offset.x,-a._renderer.offset.y),r.scale(N,T),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,v=a._renderer.offset.y/a._renderer.scale.y,x=l/a._renderer.scale.x,r.lineWidth=x,r.strokeText(e.value,_,v),r.restore()):r.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(f)){const M=r.measureText(e.value);switch(f){case"underline":$=M.actualBoundingBoxDescent,B=M.actualBoundingBoxDescent;break;case"strikethrough":$=0,B=0;break}k=-M.width/2,w=M.width/2,r.lineWidth=Math.max(Math.floor(e._size/15),1),r.strokeStyle=r.fillStyle,r.beginPath(),r.moveTo(k,$),r.lineTo(w,B),r.stroke()}r.restore()},getBoundingClientRect:function(t,e){const n=xe.ctx;n.font=[t._style,t._weight,t._size+"px/"+t._leading+"px",t._family].join(" "),n.textAlign="center",n.textBaseline=bt.Utils.baselines[t._baseline]||t._baseline;const r=n.measureText(t._value);let o=r.width,s=1.15*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent);this._linewidth&&!xe.isHidden.test(this._stroke)&&(o+=this._linewidth*2,s+=this._linewidth*2);const a=o/2,l=s/2;switch(xe.alignments[t._alignment]||t._alignment){case xe.alignments.left:t.direction==="ltr"?(e.left=0,e.right=o):(e.left=-o,e.right=0);break;case xe.alignments.right:t.direction==="ltr"?(e.left=-o,e.right=0):(e.left=0,e.right=o);break;default:e.left=-a,e.right=a}switch(t._baseline){case"bottom":e.top=-s,e.bottom=0;break;case"top":e.top=0,e.bottom=s;break;case"baseline":e.top=-l*1.5,e.bottom=l*.5;break;default:e.top=-l,e.bottom=l}e.width=o,e.height=s,e.centroid||(e.centroid={}),e.centroid.x=a,e.centroid.y=l},render:function(t,e,n){if(!this._visible||!this._opacity)return this;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const r=n||this.parent,o=e[this._renderer.type],s=r._matrix.manual||r._flagMatrix,a=this._matrix.manual||this._flagMatrix,l=this._renderer.parent!==r,c=this._flagVertices||this._flagFill||this._fill instanceof Ue&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ke&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Oe&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof Ue&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ke&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Oe&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;if(s||a||l){this._renderer.matrix||(this._renderer.matrix=new hn(9)),this._matrix.toTransformArray(!0,Zn),lo(Zn,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof re||(this._renderer.scale=new re);let u,f;this._scale instanceof re?(u=this._scale.x*r._renderer.scale.x,f=this._scale.y*r._renderer.scale.y):(u=this._scale*r._renderer.scale.x,f=this._scale*r._renderer.scale.y),this._renderer.scale.x=u<0?-u:u,this._renderer.scale.y=f<0?-f:f,l&&(this._renderer.parent=r)}if(this._mask){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=bt.Utils.getRendererType(this._mask._renderer.type);xe[u].render.call(this._mask,t,e,this),t.stencilFunc(t.EQUAL,1,255),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.colorMask(!0,!0,!0,!0)}if(c?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,xe.text.getBoundingClientRect(this,this._renderer.rect),xe.updateTexture.call(xe,t,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!n||!this._renderer.texture)return this;e.current!==o&&(t.useProgram(o),t.bindBuffer(t.ARRAY_BUFFER,e.buffers.position),t.vertexAttribPointer(o.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o.position),t.bufferData(t.ARRAY_BUFFER,Ns,t.STATIC_DRAW),e.resolution.flagged||t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),e.current=o),e.resolution.flagged&&t.uniform2f(t.getUniformLocation(o,"u_resolution"),e.resolution.width,e.resolution.height),t.bindTexture(t.TEXTURE_2D,this._renderer.texture);const d=this._renderer.rect;return t.uniformMatrix3fv(o.matrix,!1,this._renderer.matrix),t.uniform4f(o.rect,d.left,d.top,d.right,d.bottom),t.drawArrays(t.TRIANGLES,0,6),this._mask&&t.disable(t.STENCIL_TEST),ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},"linear-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops||this._flagUnits){let n,r=this.left._x,o=this.left._y,s=this.right._x,a=this.right._y;/objectBoundingBox/i.test(this._units)&&(n=e.getBoundingClientRect(!0),r=(r-.5)*n.width,o=(o-.5)*n.height,s=(s-.5)*n.width,a=(a-.5)*n.height),this._renderer.effect=t.createLinearGradient(r,o,s,a);for(let l=0;l<this.stops.length;l++){const c=this.stops[l];this._renderer.effect.addColorStop(c._offset,c._color)}}return ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},"radial-gradient":{render:function(t,e){if(!(!t.canvas.getContext("2d")||!e)){if(ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops||this._flagUnits){let n,r=this.center._x,o=this.center._y,s=this.focal._x,a=this.focal._y,l=this._radius;/objectBoundingBox/i.test(this._units)&&(n=e.getBoundingClientRect(!0),r=(r-.5)*n.width*.5,o=(o-.5)*n.height*.5,s=(s-.5)*n.width*.5,a=(a-.5)*n.height*.5,l*=Math.min(n.width,n.height)),this._renderer.effect=t.createRadialGradient(r,o,0,s,a,l);for(let c=0;c<this.stops.length;c++){const d=this.stops[c];this._renderer.effect.addColorStop(d._offset,d._color)}}return ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}}},texture:{render:function(t,e){if(!t.canvas.getContext("2d"))return;ie.isFunction(this._renderer.onBeforeRender)&&this._renderer.onBeforeRender(),this._update();const n=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=t.createPattern(n,this._repeat);else if(!this._renderer.effect)return this.flagReset();if((this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof re||(this._renderer.offset=new re),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,n&&(this._renderer.offset.x+=n.width/2,this._renderer.offset.y+=n.height/2,this._scale instanceof re?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),this._flagScale||this._flagLoaded){this._renderer.scale instanceof re||(this._renderer.scale=new re);let r,o;this._scale instanceof re?(r=this._scale.x,o=this._scale.y):(r=this._scale,o=this._scale),this._renderer.scale.x=r<0?-r:r,this._renderer.scale.y=o<0?-o:o}return ie.isFunction(this._renderer.onAfterRender)&&this._renderer.onAfterRender(),this.flagReset()}},updateTexture:function(t,e){const n=bt.Utils.getRendererType(e._renderer.type);if(this[n].updateCanvas.call(xe,t,e),this.canvas.width<=0||this.canvas.height<=0){e._renderer.texture&&t.deleteTexture(e._renderer.texture),delete e._renderer.texture;return}e._renderer.texture||(e._renderer.texture=t.createTexture()),t.bindTexture(t.TEXTURE_2D,e._renderer.texture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.canvas),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR)},program:{create:function(t,e){let n,r,o;if(n=t.createProgram(),ie.each(e,function(s){t.attachShader(n,s)}),t.linkProgram(n),r=t.getProgramParameter(n,t.LINK_STATUS),!r)throw o=t.getProgramInfoLog(n),t.deleteProgram(n),new It("unable to link program: "+o);return n}},extensions:{init:function(t){const e={},n=["EXT_texture_filter_anisotropic","WEBGL_compressed_texture_s3tc","OES_texture_float_linear","WEBGL_multisampled_render_to_texture"];for(let r=0;r<n.length;r++){const o=n[r];e[o]=xe.extensions.get(t,o)}return e},get:function(t,e){return t.getExtension(e)||t.getExtension(`MOZ_${e}`)||t.getExtension(`WEBKIT_${e}`)}},TextureRegistry:new Yr};xe.ctx=xe.canvas.getContext("2d");var Fc=class extends J{constructor(t){super();let e,n,r,o;if(this.domElement=t.domElement||document.createElement("canvas"),typeof t.offscreenElement<"u"&&(xe.canvas=t.offscreenElement,xe.ctx=xe.canvas.getContext("2d")),this.scene=new ct,this.scene.parent=this,this._renderer={type:"renderer",matrix:new hn(Sp),scale:1,opacity:1},this._flagMatrix=!0,t=ie.defaults(t||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=t.overdraw,e=this.ctx=this.domElement.getContext("webgl",t)||this.domElement.getContext("experimental-webgl",t),!this.ctx)throw new It("unable to create a webgl context. Try using another renderer.");r=Kt.create(e,Kt.path.vertex,Kt.types.vertex),o=Kt.create(e,Kt.path.fragment,Kt.types.fragment),this.programs={current:null,buffers:{position:e.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},n=this.programs.path=xe.program.create(e,[r,o]),this.programs.text=this.programs.path,e.extensions=xe.extensions.init(e),e.renderer=this,n.position=e.getAttribLocation(n,"a_position"),n.matrix=e.getUniformLocation(n,"u_matrix"),n.rect=e.getUniformLocation(n,"u_rect");const s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(n.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(n.position),e.bufferData(e.ARRAY_BUFFER,Ns,e.STATIC_DRAW),r=Kt.create(e,Kt.points.vertex,Kt.types.vertex),o=Kt.create(e,Kt.points.fragment,Kt.types.fragment),n=this.programs.points=xe.program.create(e,[r,o]),n.position=e.getAttribLocation(n,"a_position"),n.matrix=e.getUniformLocation(n,"u_matrix"),n.size=e.getUniformLocation(n,"u_size"),e.enable(e.BLEND),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}setSize(t,e,n){let r,o;const s=this.ctx;return this.width=t,this.height=e,this.ratio=typeof n>"u"?rs(s):n,this.domElement.width=t*this.ratio,this.domElement.height=e*this.ratio,ie.isObject(this.domElement.style)&&ie.extend(this.domElement.style,{width:t+"px",height:e+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=t*this.ratio,o=e*this.ratio,s.viewport(0,0,r,o),this.programs.resolution.width=r,this.programs.resolution.height=o,this.programs.resolution.ratio=this.ratio,this.programs.resolution.flagged=!0,this.trigger(J.Types.resize,t,e,n)}render(){const t=this.ctx;return this.overdraw||t.clear(t.COLOR_BUFFER_BIT),xe.group.render.call(this.scene,t,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}};C(Fc,"Utils",xe);var Tp=ie.extend({Error:It,getRatio:rs,read:Xe,xhr:Bc},ie,Tt,yl,bl),Ce=class Lr{constructor(e){C(this,"_events",new J),C(this,"type",""),C(this,"renderer",null),C(this,"scene",null),C(this,"width",0),C(this,"height",0),C(this,"frameCount",0),C(this,"timeDelta",0),C(this,"playing",!1);const n=ie.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:Lr.Types.svg,autostart:!1});if(ie.each(n,function(r,o){/fullscreen/i.test(o)||/autostart/i.test(o)||(this[o]=r)},this),ie.isElement(n.domElement)){const r=n.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+r)||(this.type=Lr.Types[r])}this.renderer=new Lr[this.type](this),this.setPlaying(n.autostart),this.frameCount=0,n.fullscreen?(this.fit=Np.bind(this),this.fit.domElement=window,this.fit.attached=!0,ie.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),ie.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),Lt.bind(this.fit.domElement,"resize",this.fit),this.fit()):n.fitted?(this.fit=$p.bind(this),ie.extend(this.renderer.domElement.style,{display:"block"})):typeof n.width=="number"&&typeof n.height=="number"&&(this.renderer.setSize(n.width,n.height,this.ratio),this.width=n.width,this.height=n.height),this.renderer.bind(J.Types.resize,Ep.bind(this)),this.scene=this.renderer.scene,Lr.Instances.push(this),n.autostart&&pr.init()}get _bound(){return this._events._bound}set _bound(e){this._events._bound=e}addEventListener(){return this._events.addEventListener.apply(this,arguments)}on(){return this._events.addEventListener.apply(this,arguments)}bind(){return this._events.addEventListener.apply(this,arguments)}removeEventListener(){return this._events.removeEventListener.apply(this,arguments)}off(){return this._events.removeEventListener.apply(this,arguments)}unbind(){return this._events.removeEventListener.apply(this,arguments)}dispatchEvent(){return this._events.dispatchEvent.apply(this,arguments)}trigger(){return this._events.dispatchEvent.apply(this,arguments)}listen(){return this._events.listen.apply(this,arguments)}ignore(){return this._events.ignore.apply(this,arguments)}appendTo(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this}play(){return this.playing=!0,pr.init(),this.trigger(J.Types.play)}pause(){return this.playing=!1,this.trigger(J.Types.pause)}setPlaying(e){this.playing=e}release(e){let n,r,o;if(typeof e>"u")return this.release(this.scene);if(typeof e.unbind=="function"&&e.unbind(),typeof e.fill=="object"&&"unbind"in e.fill&&e.fill.unbind(),typeof e.stroke=="object"&&"unbind"in e.stroke&&e.stroke.unbind(),e.vertices){if(typeof e.vertices.unbind=="function")try{e.vertices.unbind()}catch{}for(n=0;n<e.vertices.length;n++)r=e.vertices[n],typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}if(e.children){for(n=0;n<e.children.length;n++)o=e.children[n],this.release(o);if(typeof e.children.unbind=="function")try{e.children.unbind()}catch{}}if(e._renderer){if(e._renderer.elem&&e._renderer.elem.parentNode&&(e._renderer.elem.parentNode.removeChild(e._renderer.elem),delete e._renderer.elem),this.type==="WebGLRenderer"&&this.renderer.ctx){const s=this.renderer.ctx;e._renderer.texture&&(s.deleteTexture(e._renderer.texture),delete e._renderer.texture),e._renderer.positionBuffer&&(s.deleteBuffer(e._renderer.positionBuffer),delete e._renderer.positionBuffer),e._renderer.effect&&(e._renderer.effect=null)}this.type==="CanvasRenderer"&&e._renderer.context&&delete e._renderer.context}return e}update(){const e=!!this._lastFrame,n=ie.performance.now();e&&(this.timeDelta=parseFloat((n-this._lastFrame).toFixed(3))),this._lastFrame=n,this.fit&&this.fit.domElement&&!this.fit.attached&&(Lt.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());const r=this.width,o=this.height,s=this.renderer;return(r!==s.width||o!==s.height)&&s.setSize(r,o,this.ratio),this.trigger(J.Types.update,this.frameCount,this.timeDelta),this.render()}render(){return this.renderer.render(),this.trigger(J.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 io(e,n,r,o);return this.scene.add(s),s}makeArrow(e,n,r,o,s){const a=typeof s=="number"?s:10,l=Math.atan2(o-n,r-e),c=[new Be(e,n,void 0,void 0,void 0,void 0,oe.move),new Be(r,o,void 0,void 0,void 0,void 0,oe.line),new Be(r-a*Math.cos(l-Math.PI/4),o-a*Math.sin(l-Math.PI/4),void 0,void 0,void 0,void 0,oe.line),new Be(r,o,void 0,void 0,void 0,void 0,oe.move),new Be(r-a*Math.cos(l+Math.PI/4),o-a*Math.sin(l+Math.PI/4),void 0,void 0,void 0,void 0,oe.line)],d=new $e(c,!1,!1,!0);return d.noFill(),d.cap="round",d.join="round",this.scene.add(d),d}makeRectangle(e,n,r,o){const s=new Gn(e,n,r,o);return this.scene.add(s),s}makeRoundedRectangle(e,n,r,o,s){const a=new eo(e,n,r,o,s);return this.scene.add(a),a}makeCircle(e,n,r,o){const s=new Qr(e,n,r,o);return this.scene.add(s),s}makeEllipse(e,n,r,o,s){const a=new Jr(e,n,r,o,s);return this.scene.add(a),a}makeStar(e,n,r,o,s){const a=new _s(e,n,r,o,s);return this.scene.add(a),a}makeCurve(e){const n=arguments.length;if(!Array.isArray(e)){e=[];for(let a=0;a<n;a+=2){const l=arguments[a];if(typeof l!="number")break;const c=arguments[a+1];e.push(new Be(l,c))}}const r=arguments[n-1],o=new $e(e,!(typeof r=="boolean"&&r),!0),s=o.getBoundingClientRect();return o.center().translation.set(s.left+s.width/2,s.top+s.height/2),this.scene.add(o),o}makePolygon(e,n,r,o){const s=new bs(e,n,r,o);return this.scene.add(s),s}makeArcSegment(e,n,r,o,s,a,l){const c=new hs(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 ys(r);return this.scene.add(o),o}makePath(e){const n=arguments.length;let r=e;if(!Array.isArray(e)){r=[];for(let l=0;l<n;l+=2){const c=arguments[l];if(typeof c!="number")break;const d=arguments[l+1];r.push(new Be(c,d))}}const o=arguments[n-1],s=new $e(r,!(typeof o=="boolean"&&o)),a=s.getBoundingClientRect();return typeof a.top=="number"&&typeof a.left=="number"&&typeof a.right=="number"&&typeof a.bottom=="number"&&s.center().translation.set(a.left+a.width/2,a.top+a.height/2),this.scene.add(s),s}makeText(e,n,r,o){const s=new mn(e,n,r,o);return this.add(s),s}makeLinearGradient(e,n,r,o){const s=Array.prototype.slice.call(arguments,4),a=new Ue(e,n,r,o,s);return this.add(a),a}makeRadialGradient(e,n,r){const o=Array.prototype.slice.call(arguments,3),s=new Ke(e,n,r,o);return this.add(s),s}makeSprite(e,n,r,o,s,a,l){const c=new Zr(e,n,r,o,s,a);return l&&c.play(),this.add(c),c}makeImage(e,n,r,o,s,a){const l=new Tc(e,n,r,o,s,a);return this.add(l),l}makeImageSequence(e,n,r,o,s){const a=new vs(e,n,r,o);return s&&a.play(),this.add(a),a}makeTexture(e,n){return new Oe(e,n)}makeGroup(e){e instanceof Array||(e=Array.prototype.slice.call(arguments));const n=new ct;return this.scene.add(n),n.add(e),n}interpret(e,n,r){const o=e.tagName.toLowerCase();if(r=typeof r<"u"?r:!0,!(o in Xe))return null;const s=Xe[o].call(this,e);return r?this.add(n&&s instanceof ct?s.children:s):s.parent&&s.remove(),s}load(e,n){const r=new ct;let o,s,a;const l=(function(c){for(Lt.temp.innerHTML=c,s=0;s<Lt.temp.children.length;s++)o=Lt.temp.children[s],a=this.interpret(o,!1,!1),a!==null&&r.add(a);if(typeof n=="function"){const d=Lt.temp.children.length<=1?Lt.temp.children[0]:Lt.temp.children;n(r,d)}}).bind(this);return/\.svg$/i.test(e)?(Bc(e,l),r):(l(e),r)}};C(Ce,"NextFrameId",Nt.NextFrameId),C(Ce,"Types",Nt.Types),C(Ce,"Version",Nt.Version),C(Ce,"PublishDate",Nt.PublishDate),C(Ce,"Identifier",Nt.Identifier),C(Ce,"Resolution",Nt.Resolution),C(Ce,"AutoCalculateImportedMatrices",Nt.AutoCalculateImportedMatrices),C(Ce,"Instances",Nt.Instances),C(Ce,"uniqueId",Nt.uniqueId),C(Ce,"Anchor",Be),C(Ce,"Collection",Yn),C(Ce,"Events",J),C(Ce,"Group",ct),C(Ce,"Matrix",Wi),C(Ce,"Path",$e),C(Ce,"Registry",Yr),C(Ce,"Element",Hi),C(Ce,"Shape",Kn),C(Ce,"Text",mn),C(Ce,"Vector",re),C(Ce,"Gradient",ot),C(Ce,"Image",Tc),C(Ce,"ImageSequence",vs),C(Ce,"LinearGradient",Ue),C(Ce,"RadialGradient",Ke),C(Ce,"Sprite",Zr),C(Ce,"Stop",Un),C(Ce,"Texture",Oe),C(Ce,"ArcSegment",hs),C(Ce,"Circle",Qr),C(Ce,"Ellipse",Jr),C(Ce,"Line",io),C(Ce,"Points",ys),C(Ce,"Polygon",bs),C(Ce,"Rectangle",Gn),C(Ce,"RoundedRectangle",eo),C(Ce,"Star",_s),C(Ce,"CanvasRenderer",bt),C(Ce,"SVGRenderer",Rc),C(Ce,"WebGLRenderer",Fc),C(Ce,"Commands",oe),C(Ce,"Utils",Tp);var pn=Ce;function Np(){const t=document.body.getBoundingClientRect(),e=this.width=t.width,n=this.height=t.height;this.renderer.setSize(e,n,this.ratio)}function $p(){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 Ep(t,e){this.width=t,this.height=e,this.trigger(J.Types.resize,t,e)}var pr=Lt.getRequestAnimationFrame();function Vc(){for(let t=0;t<pn.Instances.length;t++){const e=pn.Instances[t];e.playing&&e.update()}pn.NextFrameId=pr(Vc)}pr.init=function(){Vc(),pr.init=function(){}};let yn;typeof window<"u"?yn=window:typeof global<"u"?yn=global:typeof self<"u"&&(yn=self);let Mc;const hi=Math.PI*2,dt=Math.PI*.5;function Rp(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 Pp(t){Mc=t}function Fp(t,e){e=e&&e.identity()||new Mc;let n=t;const r=[];for(;n&&n._matrix;)r.push(n._matrix),n=n.parent;r.reverse();for(let o=0;o<r.length;o++){const a=r[o].elements;e.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8])}return e}function Gt(t,e,n){return n*(e-t)+t}function Xi(t,e){for(;t<0;)t+=e;return t%e}const Ic=yn.Float32Array||Array,Vp=Math.floor;function bn(t){return Vp(t*1e6)/1e6}const pe={move:"M",line:"L",curve:"C",close:"Z"};class ne{constructor(){S(this,"_events",{});S(this,"_bound",!1)}addEventListener(e,n){return(this._events[e]||(this._events[e]=[])).push(n),this._bound=!0,this}on(){return this.addEventListener.apply(this,arguments)}bind(){return this.addEventListener.apply(this,arguments)}removeEventListener(e,n){if(!this._events)return this;if(!e&&!n)return this._events={},this._bound=!1,this;const r=e?[e]:Object.keys(this._events);for(let o=0,s=r.length;o<s;o++){e=r[o];let a=this._events[e];if(a){let l=[];if(n)for(let c=0,d=a.length;c<d;c++){let u=a[c];u=u.handler?u.handler:u,n!==u&&l.push(u)}this._events[e]=l}}return this}off(){return this.removeEventListener.apply(this,arguments)}unbind(){return this.removeEventListener.apply(this,arguments)}dispatchEvent(e){if(!this._events)return this;const n=Array.prototype.slice.call(arguments,1),r=this._events[e];if(r)for(let o=0;o<r.length;o++)r[o].call(this,...n);return this}trigger(){return this.dispatchEvent.apply(this,arguments)}listen(e,n,r){const o=this;e&&(s.obj=e,s.name=n,s.handler=r,e.on(n,s));function s(){r.apply(o,arguments)}return o}ignore(e,n,r){return e.off(n,r),this}}S(ne,"Types",{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}),S(ne,"Methods",["addEventListener","on","removeEventListener","off","unbind","dispatchEvent","trigger","listen","ignore"]);const Ac={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))}}},ft=class ft extends ne{constructor(n=0,r=0){super();S(this,"_x",0);S(this,"_y",0);for(let o in Ac)Object.defineProperty(this,o,Ac[o]);this.x=n,this.y=r}static add(n,r){return new ft(n.x+r.x,n.y+r.y)}static sub(n,r){return new ft(n.x-r.x,n.y-r.y)}static subtract(n,r){return ft.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(ft.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 ft(this.x,this.y)}add(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x+=n,this.y+=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x+=n.x,this.y+=n.y):(this.x+=n,this.y+=r),this)}addSelf(n){return this.add.apply(this,arguments)}sub(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x-=n,this.y-=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x-=n.x,this.y-=n.y):(this.x-=n,this.y-=r),this)}subtract(){return this.sub.apply(this,arguments)}subSelf(n){return this.sub.apply(this,arguments)}subtractSelf(n){return this.sub.apply(this,arguments)}multiply(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x*=n,this.y*=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x*=n.x,this.y*=n.y):(this.x*=n,this.y*=r),this)}multiplySelf(n){return this.multiply.apply(this,arguments)}multiplyScalar(n){return this.multiply(n)}divide(n,r){return arguments.length<=0?this:(arguments.length<=1?typeof n=="number"?(this.x/=n,this.y/=n):n&&typeof n.x=="number"&&typeof n.y=="number"&&(this.x/=n.x,this.y/=n.y):(this.x/=n,this.y/=r),isNaN(this.x)&&(this.x=0),isNaN(this.y)&&(this.y=0),this)}divideSelf(n){return this.divide.apply(this,arguments)}divideScalar(n){return this.divide(n)}negate(){return this.multiply(-1)}dot(n){return this.x*n.x+this.y*n.y}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(n){return Math.sqrt(this.distanceToSquared(n))}distanceToSquared(n){const r=this.x-n.x,o=this.y-n.y;return r*r+o*o}setLength(n){return this.normalize().multiplyScalar(n)}equals(n,r){return r=typeof r>"u"?1e-4:r,this.distanceTo(n)<r}lerp(n,r){const o=(n.x-this.x)*r+this.x,s=(n.y-this.y)*r+this.y;return this.set(o,s)}isZero(n){return n=typeof n>"u"?1e-4:n,this.length()<n}toString(){return this.x+", "+this.y}toObject(){return{x:bn(this.x),y:bn(this.y)}}rotate(n){const r=this.x,o=this.y,s=Math.cos(n),a=Math.sin(n);return this.x=r*s-o*a,this.y=r*a+o*s,this}};S(ft,"zero",new ft),S(ft,"left",new ft(-1,0)),S(ft,"right",new ft(1,0)),S(ft,"up",new ft(0,-1)),S(ft,"down",new ft(0,1));let be=ft;class Fe extends be{constructor(n=0,r=0,o=0,s=0,a=0,l=0,c=pe.move){super(n,r);S(this,"controls",{left:new be,right:new be});S(this,"_command",pe.move);S(this,"_relative",!0);S(this,"_rx",0);S(this,"_ry",0);S(this,"_xAxisRotation",0);S(this,"_largeArcFlag",0);S(this,"_sweepFlag",1);for(let u in Oc)Object.defineProperty(this,u,Oc[u]);this.command=c,this.relative=!0;const d=Fe.makeBroadcast(this);this.controls.left.set(o,s).addEventListener(ne.Types.change,d),this.controls.right.set(a,l).addEventListener(ne.Types.change,d)}static makeBroadcast(n){return r;function r(){n._bound&&n.dispatchEvent(ne.Types.change)}}static fromObject(n){return new Fe().copy(n)}copy(n){return this.x=n.x,this.y=n.y,typeof n.command=="string"&&(this.command=n.command),n.controls&&(n.controls.left&&this.controls.left.copy(n.controls.left),n.controls.right&&this.controls.right.copy(n.controls.right)),typeof n.relative=="boolean"&&(this.relative=n.relative),typeof n.rx=="number"&&(this.rx=n.rx),typeof n.ry=="number"&&(this.ry=n.ry),typeof n.xAxisRotation=="number"&&(this.xAxisRotation=n.xAxisRotation),typeof n.largeArcFlag=="number"&&(this.largeArcFlag=n.largeArcFlag),typeof n.sweepFlag=="number"&&(this.sweepFlag=n.sweepFlag),this}clone(){return new Fe().copy(this)}toObject(){return{x:bn(this.x),y:bn(this.y),command:this.command,relative:this.relative,controls:{left:this.controls.left.toObject(),right:this.controls.right.toObject()},rx:bn(this.rx),ry:bn(this.ry),xAxisRotation:bn(this.xAxisRotation),largeArcFlag:bn(this.largeArcFlag),sweepFlag:bn(this.sweepFlag)}}toString(){return JSON.stringify(this.toObject())}}const Oc={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 Mp=0;const $s={NextFrameId:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"<%= version %>",PublishDate:"<%= publishDate %>",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return Mp++}},co={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 uo(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 zc(t,e,n,r,o,s,a,l,c){c=c||co.RecursionLimit;const d=c+1;if(Math.abs(t-a)<.001&&Math.abs(e-l)<.001)return[new Fe(a,l)];const u=[];for(let f=0;f<d;f++){const m=f/d,g=uo(m,t,n,o,a),h=uo(m,e,r,s,l);u.push(new Fe(g,h))}return u}function Ip(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,f=3*(n-t),m=9*(r-s)+3*(l-e),g=6*(e+s)-12*r,h=3*(r-e);function p(y){const b=(d*y+u)*y+f,_=(m*y+g)*y+h;return Math.sqrt(b*b+_*_)}return Op(p,0,1,c||co.RecursionLimit)}function Ap(t,e,n,r,o,s,a,l){const c=[],d=[[],[]];let u,f,m,g,h,p,y,b;for(let N=0;N<2;++N){if(N===0?(f=6*t-12*n+6*o,u=-3*t+9*n-9*o+3*a,m=3*n-3*t):(f=6*e-12*r+6*s,u=-3*e+9*r-9*s+3*l,m=3*r-3*e),Math.abs(u)<.001){if(Math.abs(f)<.001)continue;g=-m/f,0<g&&g<1&&c.push(g);continue}y=f*f-4*m*u,b=Math.sqrt(y),!(y<0)&&(h=(-f+b)/(2*u),0<h&&h<1&&c.push(h),p=(-f-b)/(2*u),0<p&&p<1&&c.push(p))}let _=c.length,v=_,x;for(;_--;)g=c[_],x=1-g,d[0][_]=x*x*x*t+3*x*x*g*n+3*x*g*g*o+g*g*g*a,d[1][_]=x*x*x*e+3*x*x*g*r+3*x*g*g*s+g*g*g*l;return d[0][v]=t,d[1][v]=e,d[0][v+1]=a,d[1][v+1]=l,d[0].length=d[1].length=v+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 Op(t,e,n,r){let o=co.abscissas[r-2],s=co.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 f=a*o[c];u+=s[c++]*(t(l+f)+t(l-f))}return a*u}function zp(t,e){const n=t.length,r=n-1;for(let o=0;o<n;o++){const s=t[o],a=e?Xi(o-1,n):Math.max(o-1,0),l=e?Xi(o+1,n):Math.min(o+1,r),c=t[a],d=s,u=t[l];Dp(c,d,u),d.command=o===0?pe.move:pe.curve}}function Dp(t,e,n){const r=be.angleBetween(t,e),o=be.angleBetween(n,e);let s=be.distanceBetween(t,e),a=be.distanceBetween(n,e),l=(r+o)/2;return s<.001||a<.001?(typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.copy(e),e.controls.right.copy(e)),e):(s*=.33,a*=.33,o<r?l+=dt:l-=dt,e.controls.left.x=Math.cos(l)*s,e.controls.left.y=Math.sin(l)*s,l-=Math.PI,e.controls.right.x=Math.cos(l)*a,e.controls.right.y=Math.sin(l)*a,typeof e.relative=="boolean"&&!e.relative&&(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}let yr=(Ni=class extends ne{constructor(){super();S(this,"_flagId",!1);S(this,"_flagClassName",!1);S(this,"_renderer",{});S(this,"_id",$s.Identifier+$s.uniqueId());S(this,"_className","");S(this,"classList",[]);for(let n in Dc)Object.defineProperty(this,n,Dc[n])}static fromObject(n){const r=new Ni().copy(n);return"id"in n&&(r.id=n.id),r}flagReset(){return this._flagId=this._flagClassName=!1,this}copy(n){return n.renderer&&typeof n.renderer.type=="string"&&(this.renderer.type=n.renderer.type),typeof n.className=="string"&&(this.className=n.className),this}toObject(){return{renderer:{type:this.renderer.type},id:this.id,className:this.className}}dispose(){const n=this._renderer.type;return this._renderer={type:n},typeof this.unbind=="function"&&this.unbind(),this}},S(Ni,"Properties",["renderer","id","className"]),Ni);const Dc={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 ho extends Error{constructor(n){super();S(this,"name","Two.js");S(this,"message");this.message=n}}class Lp{constructor(){S(this,"map",{})}add(e,n){return this.map[e]=n,this}remove(e){return delete this.map[e],this}get(e){return this.map[e]}contains(e){return e in this.map}}let fo;const Lc={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};yn.document&&(fo=document.createElement("a"));const Ze=class Ze extends yr{constructor(n,r){super();S(this,"_flagSrc",!1);S(this,"_flagImage",!1);S(this,"_flagVideo",!1);S(this,"_flagLoaded",!1);S(this,"_flagRepeat",!1);S(this,"_flagOffset",!1);S(this,"_flagScale",!1);S(this,"_src","");S(this,"_image",null);S(this,"_loaded",!1);S(this,"_repeat","no-repeat");S(this,"_scale",1);S(this,"_offset",null);for(let o in Hc)Object.defineProperty(this,o,Hc[o]);if(this._renderer.type="texture",this._renderer.flagOffset=Hp.bind(this),this._renderer.flagScale=Wp.bind(this),this.loaded=!1,this.repeat="no-repeat",this.offset=new be,typeof r=="function"){const o=(function(){this.unbind(ne.Types.load,o),typeof r=="function"&&r()}).bind(this);this.bind(ne.Types.load,o)}if(typeof n=="string")this.src=n;else if(typeof n=="object"){const o=Object.prototype.toString.call(n);(o==="[object HTMLImageElement]"||o==="[object HTMLCanvasElement]"||o==="[object HTMLVideoElement]"||o==="[object Image]")&&(this.image=n)}this._update()}fromObject(n){const r=new Ze().copy(n);return"id"in n&&(r.id=n.id),r}static getAbsoluteURL(n){return fo?(fo.href=n,fo.href):n}static loadHeadlessBuffer(n,r){n.image.onload=r,n.image.src=n.src}static getTag(n){return n&&n.nodeName&&n.nodeName.toLowerCase()||"img"}static getImage(n){const r=Ze.getAbsoluteURL(n);if(Ze.ImageRegistry.contains(r))return Ze.ImageRegistry.get(r);let o;return yn.document?Lc.video.test(r)?o=document.createElement("video"):o=document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),o.crossOrigin="anonymous",o.referrerPolicy="no-referrer",o}static load(n,r){let o=n.image,s=Ze.getTag(o);n._flagImage&&(/canvas/i.test(s)?Ze.Register.canvas(n,r):(n._src=o.getAttribute("two-src")||o.src,Ze.Register[s](n,r))),n._flagSrc&&(o||(o=Ze.getImage(n.src),n.image=o),s=Ze.getTag(o),Ze.Register[s](n,r))}clone(){const n=new Ze(this.src);return n.repeat=this.repeat,n.offset.copy(this.offset),n.scale=this.scale,n}copy(n){return this.src=n.src,this.repeat=n.repeat,this.offset=typeof n.offset=="number"||n.offset instanceof be?n.offset:new be().copy(n.offset),this.scale=typeof n.scale=="number"||n.scale instanceof be?n.scale:new be().copy(n.scale),this}toObject(){const n=super.toObject.call(this);return n.renderer.type="texture",n.src=this.src,n.repeat=this.repeat,n.offset=this.offset.toObject(),n.scale=typeof this.scale=="number"?this.scale:this.scale.toObject(),n}_update(){return(this._flagSrc||this._flagImage)&&(this.trigger(ne.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Ze.load(this,(function(){this.loaded=!0,this.trigger(ne.Types.change).trigger(ne.Types.load)}).bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}dispose(){if(super.dispose(),"elem"in this._renderer){const n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(Ze,"Properties",["src","loaded","repeat","scale","offset","image"]),S(Ze,"RegularExpressions",Lc),S(Ze,"ImageRegistry",new Lp),S(Ze,"Register",{canvas:function(n,r){n._src="#"+n.id,Ze.ImageRegistry.add(n.src,n.image),typeof r=="function"&&r()},img:function(n,r){const o=n.image,s=function(l){o.removeEventListener&&typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),typeof r=="function"&&r()},a=function(l){throw typeof o.removeEventListener=="function"&&(o.removeEventListener("load",s,!1),o.removeEventListener("error",a,!1)),new ho("unable to load "+n.src)};typeof o.width=="number"&&o.width>0&&typeof o.height=="number"&&o.height>0?s():typeof o.addEventListener=="function"&&(o.addEventListener("load",s,!1),o.addEventListener("error",a,!1)),n._src=Ze.getAbsoluteURL(n._src),!(o&&o.getAttribute("two-src"))&&(o.setAttribute("two-src",n.src),Ze.ImageRegistry.add(n.src,o),n.image.src=n.src)},video:function(n,r){const o=function(a){n.image.removeEventListener("canplaythrough",o,!1),n.image.removeEventListener("error",s,!1),n.image.width=n.image.videoWidth,n.image.height=n.image.videoHeight,typeof r=="function"&&r()},s=function(a){throw n.image.removeEventListener("canplaythrough",o,!1),n.image.removeEventListener("error",s,!1),new ho("unable to load "+n.src)};n._src=Ze.getAbsoluteURL(n._src),n.image.getAttribute("two-src")||(n.image.setAttribute("two-src",n.src),Ze.ImageRegistry.add(n.src,n.image)),n.image.readyState>=4?o():(n.image.addEventListener("canplaythrough",o,!1),n.image.addEventListener("error",s,!1),n.image.src=n.src,n.image.load())}});let Ge=Ze;const Hc={src:{enumerable:!0,get:function(){return this._src},set:function(t){this._src=t,this._flagSrc=!0}},loaded:{enumerable:!0,get:function(){return this._loaded},set:function(t){this._loaded=t,this._flagLoaded=!0}},repeat:{enumerable:!0,get:function(){return this._repeat},set:function(t){this._repeat=t,this._flagRepeat=!0}},image:{enumerable:!0,get:function(){return this._image},set:function(t){const e=Ge.getTag(t);let n;switch(e){case"canvas":n="#"+t.id;break;default:n=t.src}Ge.ImageRegistry.contains(n)?this._image=Ge.ImageRegistry.get(t.src):this._image=t,this._flagImage=!0}},offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset&&this._offset.unbind(ne.Types.change,this._renderer.flagOffset),this._offset=t,this._offset.bind(ne.Types.change,this._renderer.flagOffset),this._flagOffset=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof be&&this._scale.unbind(ne.Types.change,this._renderer.flagScale),this._scale=t,this._scale instanceof be&&this._scale.bind(ne.Types.change,this._renderer.flagScale),this._flagScale=!0}}};function Hp(){this._flagOffset=!0}function Wp(){this._flagScale=!0}class fi extends Array{constructor(){super();Ka(this,mt,new ne);arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&this.push.apply(this,arguments[0]):arguments.length>0&&this.push.apply(this,arguments)}get _events(){return Vt(this,mt)}set _events(n){of(this,mt,n)}get _bound(){return Vt(this,mt)._bound}set _bound(n){Vt(this,mt)._bound=n}addEventListener(){return Vt(this,mt).addEventListener.apply(this,arguments)}on(){return Vt(this,mt).on.apply(this,arguments)}bind(){return Vt(this,mt).bind.apply(this,arguments)}removeEventListener(){return Vt(this,mt).removeEventListener.apply(this,arguments)}off(){return Vt(this,mt).off.apply(this,arguments)}unbind(){return Vt(this,mt).unbind.apply(this,arguments)}dispatchEvent(){return Vt(this,mt).dispatchEvent.apply(this,arguments)}trigger(){return Vt(this,mt).trigger.apply(this,arguments)}listen(){return Vt(this,mt).listen.apply(this,arguments)}ignore(){return Vt(this,mt).ignore.apply(this,arguments)}pop(){const n=super.pop.apply(this,arguments);return this.trigger(ne.Types.remove,[n]),n}shift(){const n=super.shift.apply(this,arguments);return this.trigger(ne.Types.remove,[n]),n}push(){const n=super.push.apply(this,arguments);return this.trigger(ne.Types.insert,arguments),n}unshift(){const n=super.unshift.apply(this,arguments);return this.trigger(ne.Types.insert,arguments),n}splice(){const n=super.splice.apply(this,arguments);if(this.trigger(ne.Types.remove,n),arguments.length>2){const r=this.slice(arguments[0],arguments[0]+arguments.length-2);this.trigger(ne.Types.insert,r),this.trigger(ne.Types.order)}return n}sort(){return super.sort.apply(this,arguments),this.trigger(ne.Types.order),this}reverse(){return super.reverse.apply(this,arguments),this.trigger(ne.Types.order),this}indexOf(){return super.indexOf.apply(this,arguments)}map(n,r){const o=[];for(let s=0;s<this.length;s++){const a=this[s];let l;r?l=n.call(r,a,s):l=n(a,s),o.push(l)}return o}}mt=new WeakMap;const Wc=Array.prototype.slice;function jp(t){if(t==null)return!1;const e=t.length;return typeof e=="number"&&e>=0&&e<4294967296}const Me={isNaN:function(t){return typeof t=="number"&&t!==+t},isElement:function(t){return!!(t&&t.nodeType===1)},isObject:function(t){const e=typeof t;return e==="function"||e==="object"&&!!t},isFunction:function(t){return typeof t=="function"},extend:function(t){const e=Wc.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=Wc.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=!jp(t)&&Object.keys(t),s=(o||t).length;for(let a=0;a<s;a++){const l=o?o[a]:a;e.call(r,t[l],l,t)}return t},performance:yn.performance&&yn.performance.now?yn.performance:Date},Ot=class Ot extends yr{constructor(n,r,o){super();S(this,"_flagOffset",!0);S(this,"_flagOpacity",!0);S(this,"_flagColor",!0);S(this,"_offset",0);S(this,"_opacity",1);S(this,"_color","#fff");for(let s in jc)Object.defineProperty(this,s,jc[s]);this._renderer.type="stop",this.offset=typeof n=="number"?n:Ot.Index<=0?0:1,this.opacity=typeof o=="number"?o:1,this.color=typeof r=="string"?r:Ot.Index<=0?"#fff":"#000",Ot.Index=(Ot.Index+1)%2}static fromObject(n){const r=new Ot().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Ot.Properties.length;r++){const o=Ot.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Ot;return Me.each(Ot.Properties,function(o){r[o]=this[o]},this),n&&n.stops&&n.stops.push(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="stop",Me.each(Ot.Properties,r=>{n[r]=this[r]},this),n}flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}};S(Ot,"Index",0),S(Ot,"Properties",["offset","opacity","color"]);let mi=Ot;const jc={offset:{enumerable:!0,get:function(){return this._offset},set:function(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0)}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0)}},color:{enumerable:!0,get:function(){return this._color},set:function(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0)}}},vn=class vn extends yr{constructor(n){super();S(this,"_flagStops",!1);S(this,"_flagSpread",!1);S(this,"_flagUnits",!1);S(this,"_spread","");S(this,"_units","");for(let r in qc)Object.defineProperty(this,r,qc[r]);this._renderer.type="gradient",this._renderer.flagStops=qp.bind(this),this._renderer.bindStops=Xp.bind(this),this._renderer.unbindStops=Yp.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 mi?s:new mi().copy(s)));const o=new vn(r).copy(n);return"id"in n&&(o.id=n.id),o}clone(n){const r=this.stops.map(s=>s.clone()),o=new vn(r);return Me.each(vn.Properties,s=>{o[s]=this[s]},this),n&&n.add(o),o}copy(n){super.copy.call(this,n);for(let r=0;r<vn.Properties.length;r++){const o=vn.Properties[r];o in n&&(this[o]=n[o])}return this}toObject(){const n={stops:this.stops.map(r=>r.toObject())};return Me.each(vn.Properties,r=>{n[r]=this[r]},this),n}_update(){return(this._flagSpread||this._flagStops)&&this.trigger(ne.Types.change),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}dispose(){if("elem"in this._renderer){const n=this._renderer.elem;n.parentNode.removeChild(n)}return"effect"in this._renderer&&(this._renderer.effect=null),this}};S(vn,"Stop",mi),S(vn,"Properties",["spread","stops","units"]);let st=vn;const qc={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 fi((t||[]).slice(0)),this._stops.bind(ne.Types.insert,e).bind(ne.Types.remove,n),e(this._stops)}}};function qp(){this._flagStops=!0}function Xp(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagStops),t[e].parent=this;this._renderer.flagStops()}function Yp(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagStops),delete t[e].parent;this._renderer.flagStops()}const ii=class ii extends st{constructor(n,r,o,s,a){super(a);S(this,"_flagEndPoints",!1);S(this,"_left",null);S(this,"_right",null);for(let l in Xc)Object.defineProperty(this,l,Xc[l]);this._renderer.type="linear-gradient",this._renderer.flagEndPoints=Up.bind(this),this.left=new be,this.right=new be,typeof n=="number"&&(this.left.x=n),typeof r=="number"&&(this.left.y=r),typeof o=="number"&&(this.right.x=o),typeof s=="number"&&(this.right.y=s)}static fromObject(n){const r=new 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&&(this[o]=n[o]instanceof be?n[o]:new be().copy(n[o]))}return this}clone(n){const r=this.stops.map(function(s){return s.clone()}),o=new ii(this.left._x,this.left._y,this.right._x,this.right._y,r);return Me.each(st.Properties,function(s){o[s]=this[s]},this),n&&n.add(o),o}toObject(){const n=super.toObject.call(this);return n.left=this.left.toObject(),n.right=this.right.toObject(),n}_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(ne.Types.change),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}};S(ii,"Stop",mi),S(ii,"Properties",["left","right"]);let $t=ii;const Xc={left:{enumerable:!0,get:function(){return this._left},set:function(t){this._left instanceof be&&this._left.unbind(ne.Types.change,this._renderer.flagEndPoints),this._left=t,this._left.bind(ne.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}},right:{enumerable:!0,get:function(){return this._right},set:function(t){this._right instanceof be&&this._right.unbind(ne.Types.change,this._renderer.flagEndPoints),this._right=t,this._right.bind(ne.Types.change,this._renderer.flagEndPoints),this._flagEndPoints=!0}}};function Up(){this._flagEndPoints=!0}const Cn=class Cn extends st{constructor(n,r,o,s,a,l){super(s);S(this,"_flagRadius",!1);S(this,"_flagCenter",!1);S(this,"_flagFocal",!1);S(this,"_radius",0);S(this,"_center",null);S(this,"_focal",null);for(let c in Yc)Object.defineProperty(this,c,Yc[c]);this._renderer.type="radial-gradient",this._renderer.flagCenter=Kp.bind(this),this._renderer.flagFocal=Gp.bind(this),this.center=new be,this.radius=typeof o=="number"?o:1,this.focal=new be,typeof n=="number"&&(this.center.x=n),typeof r=="number"&&(this.center.y=r),this.focal.copy(this.center),typeof a=="number"&&(this.focal.x=a),typeof l=="number"&&(this.focal.y=l)}static fromObject(n){const r=new Cn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Cn.Properties.length;r++){const o=Cn.Properties[r];o in n&&(/(center|focal)i/.test(o)?this[o]=n[o]instanceof be?n[o]:new be().copy(n[o]):typeof n[o]=="number"&&(this[o]=n[MediaKeySystemAccess]))}return this}clone(n){const r=this.stops.map(function(s){return s.clone()}),o=new Cn(this.center._x,this.center._y,this._radius,r,this.focal._x,this.focal._y);return Me.each(st.Properties.concat(Cn.Properties),function(s){o[s]=this[s]},this),n&&n.add(o),o}toObject(){const n=super.toObject.call(this);return Me.each(Cn.Properties,function(r){n[r]=this[r]},this),n.center=this.center.toObject(),n.focal=this.focal.toObject(),n}_update(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(ne.Types.change),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}};S(Cn,"Stop",mi),S(Cn,"Properties",["center","radius","focal"]);let Et=Cn;const Yc={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 Kp(){this._flagCenter=!0}function Gp(){this._flagFocal=!0}function Uc(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 mo(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 Kc(t,e,n){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(m||t).x,d=(m||t).y,a=t.x,u=t.y,f&&e._relative&&(o+=e.x,c+=e.y),m&&t._relative&&(s+=t.x,d+=t.y),Ip(r,l,o,c,s,d,a,u,n)}function Gc(t,e,n){let r,o,s,a,l,c,d,u;const f=e.controls&&e.controls.right,m=t.controls&&t.controls.left;return r=e.x,l=e.y,o=(f||e).x,c=(f||e).y,s=(m||t).x,d=(m||t).y,a=t.x,u=t.y,f&&e._relative&&(o+=e.x,c+=e.y),m&&t._relative&&(s+=t.x,d+=t.y),zc(r,l,o,c,s,d,a,u,n)}function gi(t){switch(t.renderer.type){case"texture":return Ge.fromObject(t);case"gradient":return st.fromObject(t);case"linear-gradient":return $t.fromObject(t);case"radial-gradient":return Et.fromObject(t)}return t}const Zp=Math.cos,Qp=Math.sin,Zc=Math.tan,Es=[],Pt=class Pt extends ne{constructor(n,r,o,s,a,l){super();S(this,"elements",new Ic(9));S(this,"manual",!1);let c=n;Array.isArray(c)||(c=Array.prototype.slice.call(arguments)),this.identity(),c.length>0&&this.set(c)}static Multiply(n,r,o){if(r.length<=3){const k=n;let $,w,B;const E=r[0]||0,M=r[1]||0,R=r[2]||0;return $=k[0]*E+k[1]*M+k[2]*R,w=k[3]*E+k[4]*M+k[5]*R,B=k[6]*E+k[7]*M+k[8]*R,[$,w,B]}const s=n[0],a=n[1],l=n[2],c=n[3],d=n[4],u=n[5],f=n[6],m=n[7],g=n[8],h=r[0],p=r[1],y=r[2],b=r[3],_=r[4],v=r[5],x=r[6],N=r[7],T=r[8];return o=o||new Ic(9),o[0]=s*h+a*b+l*x,o[1]=s*p+a*_+l*N,o[2]=s*y+a*v+l*T,o[3]=c*h+d*b+u*x,o[4]=c*p+d*_+u*N,o[5]=c*y+d*v+u*T,o[6]=f*h+m*b+g*x,o[7]=f*p+m*_+g*N,o[8]=f*y+m*v+g*T,o}static fromObject(n){return new Pt().copy(n)}set(n,r,o,s,a,l,c,d,u){if(typeof r>"u"){const f=n;n=f[0],r=f[1],o=f[2],s=f[3],a=f[4],l=f[5],c=f[6],d=f[7],u=f[8]}return this.elements[0]=n,this.elements[1]=r,this.elements[2]=o,this.elements[3]=s,this.elements[4]=a,this.elements[5]=l,this.elements[6]=c,this.elements[7]=d,this.elements[8]=u,this.trigger(ne.Types.change)}copy(n){return this.elements[0]=n.elements[0],this.elements[1]=n.elements[1],this.elements[2]=n.elements[2],this.elements[3]=n.elements[3],this.elements[4]=n.elements[4],this.elements[5]=n.elements[5],this.elements[6]=n.elements[6],this.elements[7]=n.elements[7],this.elements[8]=n.elements[8],this.manual=n.manual,this.trigger(ne.Types.change)}identity(){return this.elements[0]=Pt.Identity[0],this.elements[1]=Pt.Identity[1],this.elements[2]=Pt.Identity[2],this.elements[3]=Pt.Identity[3],this.elements[4]=Pt.Identity[4],this.elements[5]=Pt.Identity[5],this.elements[6]=Pt.Identity[6],this.elements[7]=Pt.Identity[7],this.elements[8]=Pt.Identity[8],this.trigger(ne.Types.change)}multiply(n,r,o,s,a,l,c,d,u){if(typeof r>"u")return this.elements[0]*=n,this.elements[1]*=n,this.elements[2]*=n,this.elements[3]*=n,this.elements[4]*=n,this.elements[5]*=n,this.elements[6]*=n,this.elements[7]*=n,this.elements[8]*=n,this.trigger(ne.Types.change);if(typeof o>"u"&&(o=1),typeof s>"u"){n=n||0,r=r||0,o=o||0,a=this.elements;const W=a[0]*n+a[1]*r+a[2]*o,G=a[3]*n+a[4]*r+a[5]*o,Q=a[6]*n+a[7]*r+a[8]*o;return[W,G,Q]}const f=this.elements,m=[n,r,o,s,a,l,c,d,u],g=f[0],h=f[1],p=f[2],y=f[3],b=f[4],_=f[5],v=f[6],x=f[7],N=f[8],T=m[0],k=m[1],$=m[2],w=m[3],B=m[4],E=m[5],M=m[6],R=m[7],O=m[8];return this.elements[0]=g*T+h*w+p*M,this.elements[1]=g*k+h*B+p*R,this.elements[2]=g*$+h*E+p*O,this.elements[3]=y*T+b*w+_*M,this.elements[4]=y*k+b*B+_*R,this.elements[5]=y*$+b*E+_*O,this.elements[6]=v*T+x*w+N*M,this.elements[7]=v*k+x*B+N*R,this.elements[8]=v*$+x*E+N*O,this.trigger(ne.Types.change)}inverse(n){const r=this.elements;n=n||new Pt;const o=r[0],s=r[1],a=r[2],l=r[3],c=r[4],d=r[5],u=r[6],f=r[7],m=r[8],g=m*c-d*f,h=-m*l+d*u,p=f*l-c*u;let y=o*g+s*h+a*p;return y?(y=1/y,n.elements[0]=g*y,n.elements[1]=(-m*s+a*f)*y,n.elements[2]=(d*s-a*c)*y,n.elements[3]=h*y,n.elements[4]=(m*o-a*u)*y,n.elements[5]=(-d*o+a*l)*y,n.elements[6]=p*y,n.elements[7]=(-f*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=Zp(n),o=Qp(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=Zc(n);return this.multiply(1,r,0,0,1,0,0,0,1)}skewY(n){const r=Zc(n);return this.multiply(1,0,0,r,1,0,0,0,1)}toString(n){return Es.length=0,this.toTransformArray(n,Es),Es.map(bn).join(" ")}toTransformArray(n,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(n){const m=o[6],g=o[7],h=o[8];if(s){r[0]=a,r[1]=d,r[2]=m,r[3]=l,r[4]=u,r[5]=g,r[6]=c,r[7]=f,r[8]=h;return}return[a,d,m,l,u,g,c,f,h]}if(s){r[0]=a,r[1]=d,r[2]=l,r[3]=u,r[4]=c,r[5]=f;return}return[a,d,l,u,c,f]}toArray(n,r){const o=this.elements,s=!!r,a=o[0],l=o[1],c=o[2],d=o[3],u=o[4],f=o[5];if(n){const m=o[6],g=o[7],h=o[8];if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f,r[6]=m,r[7]=g,r[8]=h;return}return[a,l,c,d,u,f,m,g,h]}if(s){r[0]=a,r[1]=l,r[2]=c,r[3]=d,r[4]=u,r[5]=f;return}return[a,l,c,d,u,f]}toObject(){return{renderer:{type:"matrix"},elements:this.toArray(!0),manual:!!this.manual}}clone(){return new Pt().copy(this)}};S(Pt,"Identity",[1,0,0,0,1,0,0,0,1]);let br=Pt;Pp(br);const Ar=class Ar extends yr{constructor(){super();S(this,"_flagMatrix",!0);S(this,"_flagScale",!1);S(this,"_matrix",null);S(this,"_worldMatrix",null);S(this,"_position",null);S(this,"_rotation",0);S(this,"_scale",1);S(this,"_skewX",0);S(this,"_skewY",0);for(let n in go)Object.defineProperty(this,n,go[n]);this._renderer.flagMatrix=Qc.bind(this),this.isShape=!0,this.matrix=new br,this.worldMatrix=new br,this.position=new be,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}static fromObject(n){const r=new Ar().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 go.position.get.apply(this,arguments)}set translation(n){go.position.set.apply(this,arguments)}addTo(n){return n.add(this),this}remove(){return this.parent?(this.parent.remove(this),this):this}copy(n){return super.copy.call(this,n),"position"in n&&(n.position instanceof be?this.position=n.position:this.position.copy(n.position)),"rotation"in n&&(this.rotation=n.rotation),"scale"in n&&(this.scale=typeof n.scale=="number"||n.scale instanceof be?n.scale:new be(n.scale.x,n.scale.y)),"skewX"in n&&(this.skewX=n.skewX),"skewY"in n&&(this.skewY=n.skewY),"matrix"in n&&n.matrix.manual&&(this.matrix.copy(n.matrix),this.matrix.manual=!0),this}clone(n){const r=new Ar;return r.position.copy(this.position),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer={type:"shape"},n.isShape=!0,n.translation=this.translation.toObject(),n.rotation=this.translation.rotation,n.scale=this.scale instanceof be?this.scale.toObject():this.scale,n.skewX=this.skewX,n.skewY=this.skewY,n.matrix=this.matrix.toObject(),n}_update(n){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._matrix.rotate(this.rotation),this._scale instanceof be?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),n&&this.parent&&this.parent._update&&this.parent._update(),this}flagReset(){return this._flagMatrix=this._flagScale=!1,super.flagReset.call(this),this}};S(Ar,"Properties",["position","rotation","scale","skewX","skewY","matrix","worldMatrix"]);let $n=Ar;const go={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),Qc.call(this)}},rotation:{enumerable:!0,get:function(){return this._rotation},set:function(t){this._rotation=t,this._flagMatrix=!0}},scale:{enumerable:!0,get:function(){return this._scale},set:function(t){this._scale instanceof be&&this._scale.unbind(ne.Types.change,this._renderer.flagMatrix),this._scale=t,this._scale instanceof be&&this._scale.bind(ne.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}},skewX:{enumerable:!0,get:function(){return this._skewX},set:function(t){this._skewX=t,this._flagMatrix=!0}},skewY:{enumerable:!0,get:function(){return this._skewY},set:function(t){this._skewY=t,this._flagMatrix=!0}},matrix:{enumerable:!0,get:function(){return this._matrix},set:function(t){this._matrix=t,this._flagMatrix=!0}},worldMatrix:{enumerable:!0,get:function(){return Fp(this,this._worldMatrix),this._worldMatrix},set:function(t){this._worldMatrix=t}}};function Qc(){this._flagMatrix=!0}const Yi=Math.min,Ui=Math.max,Jp=Math.ceil,ey=Math.floor,ty=new be,sn=class sn extends $n{constructor(n,r,o,s){super();S(this,"_flagVertices",!0);S(this,"_flagLength",!0);S(this,"_flagFill",!0);S(this,"_flagStroke",!0);S(this,"_flagLinewidth",!0);S(this,"_flagOpacity",!0);S(this,"_flagVisible",!0);S(this,"_flagCap",!0);S(this,"_flagJoin",!0);S(this,"_flagMiter",!0);S(this,"_flagStrokeAttenuation",!0);S(this,"_flagMask",!1);S(this,"_flagClip",!1);S(this,"_length",0);S(this,"_fill","#fff");S(this,"_stroke","#000");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_cap","round");S(this,"_join","round");S(this,"_miter",4);S(this,"_closed",!0);S(this,"_curved",!1);S(this,"_automatic",!0);S(this,"_beginning",0);S(this,"_ending",1);S(this,"_mask",null);S(this,"_clip",!1);S(this,"_dashes",null);S(this,"_strokeAttenuation",!0);for(let a in Jc)Object.defineProperty(this,a,Jc[a]);this._renderer.type="path",this._renderer.flagVertices=ed.bind(this),this._renderer.bindVertices=td.bind(this),this._renderer.unbindVertices=nd.bind(this),this._renderer.flagFill=id.bind(this),this._renderer.flagStroke=rd.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:gi(n.fill),o=typeof n.stroke=="string"?n.stroke:gi(n.stroke),s=new sn().copy({...n,fill:r,stroke:o});return"id"in n&&(s.id=n.id),s}copy(n){if(super.copy.call(this,n),n.vertices){this.vertices=[];for(let r=0;r<n.vertices.length;r++){const o=n.vertices[r];o instanceof Fe?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Fe().copy(o))}}for(let r=0;r<sn.Properties.length;r++){const o=sn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new sn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<sn.Properties.length;o++){const s=sn.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="path",n.vertices=this.vertices.map(r=>r.toObject()),Me.each(sn.Properties,r=>{typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];typeof r.unbind=="function"&&r.unbind(),r.controls&&(r.controls.left&&typeof r.controls.left.unbind=="function"&&r.controls.left.unbind(),r.controls.right&&typeof r.controls.right.unbind=="function"&&r.controls.right.unbind())}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}corner(){const n=this.getBoundingClientRect(!0),r=n.width/2,o=n.height/2,s=n.left+n.width/2,a=n.top+n.height/2;for(let l=0;l<this.vertices.length;l++){const c=this.vertices[l];c.x-=s,c.y-=a,c.x+=r,c.y+=o}return this.mask&&(this.mask.translation.x-=s,this.mask.translation.x+=r,this.mask.translation.y-=a,this.mask.translation.y+=o),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,o=n.top+n.height/2-this.translation.y;for(let s=0;s<this.vertices.length;s++){const a=this.vertices[s];a.x-=r,a.y-=o}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getBoundingClientRect(n){let r,o,s,a,l,c,d=1/0,u=-1/0,f=1/0,m=-1/0;if(this._update(!0),r=n?this.matrix:this.worldMatrix,o=(this.linewidth||0)/2,s=this._renderer.vertices.length,this.linewidth>0||this.stroke&&!/(transparent|none)/i.test(this.stroke))if(this.matrix.manual){const{scaleX:g,scaleY:h}=Rp(r.elements[0],r.elements[3],r.elements[1],r.elements[4],r.elements[2],r.elements[5]);typeof g=="number"&&typeof h=="number"&&(o=Math.max(g,h)*(this.linewidth||0)/2)}else o*=typeof this.scale=="number"?this.scale:Math.max(this.scale.x,this.scale.y);if(s<=0)return{width:0,height:0};for(a=0;a<s;a++){c=this._renderer.vertices[a],l=this._renderer.vertices[(a+s-1)%s];const[g,h]=r.multiply(l.x,l.y),[p,y]=r.multiply(c.x,c.y);if(l.controls&&c.controls){let b=l.controls.right.x,_=l.controls.right.y;l.relative&&(b+=l.x,_+=l.y);let[v,x]=r.multiply(b,_),N=c.controls.left.x,T=c.controls.left.y;c.relative&&(N+=c.x,T+=c.y);let[k,$]=r.multiply(N,T);const w=Ap(g,h,v,x,k,$,p,y);f=Yi(w.min.y-o,f),d=Yi(w.min.x-o,d),u=Ui(w.max.x+o,u),m=Ui(w.max.y+o,m)}else a<=1&&(f=Yi(h-o,f),d=Yi(g-o,d),u=Ui(g+o,u),m=Ui(h+o,m)),f=Yi(y-o,f),d=Yi(p-o,d),u=Ui(p+o,u),m=Ui(y+o,m)}return{top:f,left:d,right:u,bottom:m,width:u-d,height:m-f}}getPointAt(n,r){let o,s,a,l,c,d,u,f,m,g,h,p,y,b,_,v=this.length*Math.min(Math.max(n,0),1);const x=this.vertices.length,N=x-1;let T=null,k=null;for(let H=0,P=this._lengths.length,D=0;H<P;H++){if(D+this._lengths[H]>=v){this._closed?(o=Xi(H,x),s=Xi(H-1,x),H===0&&(o=s,s=H)):(o=H,s=Math.min(Math.max(H-1,0),N)),T=this.vertices[o],k=this.vertices[s],v-=D,this._lengths[H]!==0?n=v/this._lengths[H]:n=0;break}D+=this._lengths[H]}if(T===null||k===null)return null;if(T){if(!k)return T}else return k;_=k.controls&&k.controls.right,b=T.controls&&T.controls.left,c=k.x,g=k.y,d=(_||k).x,h=(_||k).y,u=(b||T).x,p=(b||T).y,f=T.x,y=T.y,_&&k.relative&&(d+=k.x,h+=k.y),b&&T.relative&&(u+=T.x,p+=T.y),l=uo(n,c,d,u,f),m=uo(n,g,h,p,y);const $=Gt(c,d,n),w=Gt(g,h,n),B=Gt(d,u,n),E=Gt(h,p,n),M=Gt(u,f,n),R=Gt(p,y,n),O=Gt($,B,n),W=Gt(w,E,n),G=Gt(B,M,n),Q=Gt(E,R,n);return Me.isObject(r)?(r.x=l,r.y=m,r instanceof Fe&&(r.controls.left.x=O,r.controls.left.y=W,r.controls.right.x=G,r.controls.right.y=Q,(typeof r.relative!="boolean"||r.relative)&&(r.controls.left.x-=l,r.controls.left.y-=m,r.controls.right.x-=l,r.controls.right.y-=m)),r.t=n,r):(a=new Fe(l,m,O-l,W-m,G-l,Q-m,this._curved?pe.curve:pe.line),a.t=n,a)}plot(){if(this.curved)return zp(this._collection,this.closed),this;for(let n=0;n<this._collection.length;n++)this._collection[n].command=n===0?pe.move:pe.line;return this}subdivide(n){this._update();const r=this.vertices.length-1,o=this._closed||this.vertices[r]._command===pe.close;let s=this.vertices[r],a=[],l;return Me.each(this.vertices,function(c,d){if(d<=0&&!o){s=c;return}if(c.command===pe.move){a.push(new Fe(s.x,s.y)),d>0&&(a[a.length-1].command=pe.line),s=c;return}l=Gc(c,s,n),a=a.concat(l),Me.each(l,function(u,f){f<=0&&s.command===pe.move?u.command=pe.move:u.command=pe.line}),d>=r&&(this._closed&&this._automatic&&(s=c,l=Gc(c,s,n),a=a.concat(l),Me.each(l,function(u,f){f<=0&&s.command===pe.move?u.command=pe.move:u.command=pe.line})),a.push(new Fe(c.x,c.y)),a[a.length-1].command=o?pe.close:pe.line),s=c},this),this._automatic=!1,this._curved=!1,this.vertices=a,this}_updateLength(n,r){r||this._update();const s=this.vertices.length-1;let a=this.vertices[s],l=0;return typeof this._lengths>"u"&&(this._lengths=[]),Me.each(this.vertices,function(c,d){if(d<=0||c.command===pe.move){a=c,this._lengths[d]=0;return}this._lengths[d]=Kc(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=mo(this,o*this._length),l=mo(this,s*this._length),c=Jp(a),d=ey(l);let u,f,m,g,h,p;for(this._renderer.vertices.length=0,p=0;p<n;p++)this._renderer.collection.length<=p&&this._renderer.collection.push(new Fe),p>d&&!f?(h=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(s,h),h.command=this._renderer.collection[p].command,this._renderer.vertices.push(h),f=h,m=this._collection[p-1],m&&m.controls&&(h.relative?h.controls.right.clear():h.controls.right.copy(h),m.relative?this._renderer.collection[p-1].controls.right.copy(m.controls.right).lerp(be.zero,1-h.t):this._renderer.collection[p-1].controls.right.copy(m.controls.right).lerp(m,1-h.t))):p>=c&&p<=d&&(h=this._renderer.collection[p].copy(this._collection[p]),this._renderer.vertices.push(h),p===d&&Uc(this,s)?(f=h,!r&&f.controls&&(f.relative?f.controls.right.clear():f.controls.right.copy(f))):p===c&&Uc(this,o)&&(u=h,u.command=pe.move,!r&&u.controls&&(u.relative?u.controls.left.clear():u.controls.left.copy(u))));c>0&&!u&&(p=c-1,h=this._renderer.collection[p].copy(this._collection[p]),this.getPointAt(o,h),h.command=pe.move,this._renderer.vertices.unshift(h),g=this._collection[p+1],g&&g.controls&&(h.controls.left.clear(),g.relative?this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(be.zero,h.t):(ty.copy(g),this._renderer.collection[p+1].controls.left.copy(g.controls.left).lerp(g,h.t))))}return $n.prototype._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=this._flagStrokeAttenuation=!1,$n.prototype.flagReset.call(this),this}};S(sn,"Properties",["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending","dashes","strokeAttenuation"]),S(sn,"Utils",{getCurveLength:Kc});let Ie=sn;const Jc={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t,this._flagCap=!0}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t,this._flagJoin=!0}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t,this._flagMiter=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.bind(ne.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=!!t,this._flagVertices=!0}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=!!t,this._flagVertices=!0}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){if(t===this._automatic)return;this._automatic=!!t;const e=this._automatic?"ignore":"listen";Me.each(this.vertices,function(n){n[e]()})}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ne.Types.insert,e).unbind(ne.Types.remove,n),t instanceof fi?this._collection=t:this._collection=new fi(t||[]),this._collection.bind(ne.Types.insert,e).bind(ne.Types.remove,n),e(this._collection)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Me.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function ed(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)}function td(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function nd(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()}function id(){this._flagFill=!0}function rd(){this._flagStroke=!0}const ny=Math.ceil,iy=Math.floor,Sn=class Sn extends $n{constructor(n){super();S(this,"_flagVertices",!0);S(this,"_flagLength",!0);S(this,"_flagFill",!0);S(this,"_flagStroke",!0);S(this,"_flagLinewidth",!0);S(this,"_flagOpacity",!0);S(this,"_flagVisible",!0);S(this,"_flagSize",!0);S(this,"_flagSizeAttenuation",!0);S(this,"_flagStrokeAttenuation",!0);S(this,"_length",0);S(this,"_fill","#fff");S(this,"_stroke","#000");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_size",1);S(this,"_sizeAttenuation",!1);S(this,"_beginning",0);S(this,"_ending",1);S(this,"_dashes",null);S(this,"_strokeAttenuation",!0);S(this,"noFill",Ie.prototype.noFill);S(this,"noStroke",Ie.prototype.noStroke);S(this,"corner",Ie.prototype.corner);S(this,"center",Ie.prototype.center);S(this,"getBoundingClientRect",Ie.prototype.getBoundingClientRect);S(this,"_updateLength",Ie.prototype._updateLength);for(let r in od)Object.defineProperty(this,r,od[r]);this._renderer.type="points",this._renderer.flagVertices=ed.bind(this),this._renderer.bindVertices=td.bind(this),this._renderer.unbindVertices=nd.bind(this),this._renderer.flagFill=id.bind(this),this._renderer.flagStroke=rd.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:gi(n.fill),o=typeof n.stroke=="string"?n.stroke:gi(n.stroke),s=new Sn().copy({...n,fill:r,stroke:o});return"id"in n&&(s.id=n.id),s}copy(n){super.copy.call(this,n);for(let r=0;r<n.vertices.length;r++){const o=n.vertices[r];o instanceof Fe?this.vertices.push(n.vertices[r].clone()):this.vertices.push(new Fe().copy(o))}for(let r=0;r<Sn.Properties.length;r++){const o=Sn.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Sn;for(let o=0;o<this.vertices.length;o++)r.vertices.push(this.vertices[o].clone());for(let o=0;o<Sn.Properties.length;o++){const s=Sn.Properties[o];r[s]=this[s]}return r.className=this.className,r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="points",n.vertices=this.vertices.map(r=>r.toObject()),Me.each(Sn.Properties,function(r){typeof this[r]<"u"&&(this[r].toObject?n[r]=this[r].toObject():n[r]=this[r])},this),n}dispose(){if(super.dispose(),this.vertices&&typeof this.vertices.unbind=="function")try{this.vertices.unbind()}catch{}if(this.vertices)for(let n=0;n<this.vertices.length;n++){const r=this.vertices[n];typeof r.unbind=="function"&&r.unbind()}return typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}subdivide(n){this._update();let r=[];for(let o=0;o<this.vertices.length;o++){const s=this.vertices[o],a=this.vertices[o-1];if(!a)continue;const l=s.x,c=s.y,d=a.x,u=a.y,f=zc(l,c,l,c,d,u,d,u,n);r=r.concat(f)}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=mo(this,n*this._length),s=mo(this,r*this._length),a=ny(o),l=iy(s);let c=0,d;this._renderer.vertices=[],this._renderer.collection=[];for(let u=0;u<this._collection.length;u++)u>=a&&u<=l&&(d=this._collection[u],this._renderer.collection.push(d),this._renderer.vertices[c*2+0]=d.x,this._renderer.vertices[c*2+1]=d.y,c++)}return super._update.apply(this,arguments),this}flagReset(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,super.flagReset.call(this),this}};S(Sn,"Properties",["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending","dashes","strokeAttenuation"]);let po=Sn;const od={linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},sizeAttenuation:{enumerable:!0,get:function(){return this._sizeAttenuation},set:function(t){this._sizeAttenuation=t,this._flagSizeAttenuation=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.bind(ne.Types.change,this._renderer.flagStroke)}},length:{get:function(){return this._flagLength&&this._updateLength(),this._length}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._beginning=t,this._flagVertices=!0}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._ending=t,this._flagVertices=!0}},vertices:{enumerable:!0,get:function(){return this._collection},set:function(t){const e=this._renderer.bindVertices,n=this._renderer.unbindVertices;this._collection&&this._collection.unbind(ne.Types.insert,e).unbind(ne.Types.remove,n),t instanceof fi?this._collection=t:this._collection=new fi(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 sd extends fi{constructor(n){n=Array.isArray(n)?n:Array.prototype.slice.call(arguments);super(n);Ka(this,Wo,{});this.attach(n),this.on(ne.Types.insert,this.attach),this.on(ne.Types.remove,this.detach)}get ids(){return Vt(this,Wo)}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}}Wo=new WeakMap;const Vn=class Vn extends Ie{constructor(n,r,o,s,a,l,c){const d=c||$s.Resolution*3,u=[];for(let f=0;f<d;f++)u.push(new Fe);super(u,!0,!1,!0);S(this,"_flagStartAngle",!1);S(this,"_flagEndAngle",!1);S(this,"_flagInnerRadius",!1);S(this,"_flagOuterRadius",!1);S(this,"_startAngle",0);S(this,"_endAngle",hi);S(this,"_innerRadius",0);S(this,"_outerRadius",0);this._renderer.type="arc-segment";for(let f in ad)Object.defineProperty(this,f,ad[f]);typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.startAngle=a),typeof l=="number"&&(this.endAngle=l),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Vn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Vn.Properties.length;r++){const o=Vn.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){const n=this._startAngle,r=this._endAngle,o=this._innerRadius,s=this._outerRadius,a=Xi(n,hi)===Xi(r,hi),l=o>0,c=this.vertices;let d=l?c.length/2:c.length,u,f=0,m,g,h,p,y,b,_,v,x;for(a?d--:l||(d-=2),m=0,g=d-1;m<d;m++){switch(h=m/g,p=c[f],y=h*(r-n)+n,b=(r-n)/d,_=s*Math.cos(y),v=s*Math.sin(y),m){case 0:u=pe.move;break;default:u=pe.curve}p.command=u,p.x=_,p.y=v,p.controls.left.clear(),p.controls.right.clear(),p.command===pe.curve&&(x=s*b/Math.PI,p.controls.left.x=x*Math.cos(y-dt),p.controls.left.y=x*Math.sin(y-dt),p.controls.right.x=x*Math.cos(y+dt),p.controls.right.y=x*Math.sin(y+dt),m===1&&p.controls.left.multiplyScalar(2),m===g&&p.controls.right.multiplyScalar(2)),f++}if(l){for(a?(c[f].command=pe.close,f++):(d--,g=d-1),m=0;m<d;m++)h=m/g,p=c[f],y=(1-h)*(r-n)+n,b=(r-n)/d,_=o*Math.cos(y),v=o*Math.sin(y),u=pe.curve,m<=0&&(u=a?pe.move:pe.line),p.command=u,p.x=_,p.y=v,p.controls.left.clear(),p.controls.right.clear(),p.command===pe.curve&&(x=o*b/Math.PI,p.controls.left.x=x*Math.cos(y+dt),p.controls.left.y=x*Math.sin(y+dt),p.controls.right.x=x*Math.cos(y-dt),p.controls.right.y=x*Math.sin(y-dt),m===1&&p.controls.left.multiplyScalar(2),m===g&&p.controls.right.multiplyScalar(2)),f++;c[f].copy(c[0]),c[f].command=pe.line}else a||(c[f].command=pe.line,c[f].x=0,c[f].y=0,f++,c[f].copy(c[0]),c[f].command=pe.line)}return super._update.call(this),this}flagReset(){return super.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this}clone(n){const r=this.innerRadius,o=this.outerRadius,s=this.startAngle,a=this.endAngle,l=this.vertices.length,c=new Vn(0,0,r,o,s,a,l);c.translation.copy(this.translation),c.rotation=this.rotation,c.scale=this.scale,c.skewX=this.skewX,c.skewY=this.skewY,this.matrix.manual&&c.matrix.copy(this.matrix);for(let d=0;d<Ie.Properties.length;d++){const u=Ie.Properties[d];c[u]=this[u]}return n&&n.add(c),c}toObject(){const n=super.toObject.call(this);n.renderer.type="arc-segment";for(let r=0;r<Vn.Properties.length;r++){const o=Vn.Properties[r];n[o]=this[o]}return n}};S(Vn,"Properties",["startAngle","endAngle","innerRadius","outerRadius"]);let Rs=Vn;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}}},Ps=Math.cos,Fs=Math.sin,Mn=class Mn extends Ie{constructor(n,r,o,s){const a=s?Math.max(s,2):4,l=[];for(let c=0;c<a;c++)l.push(new Fe(0,0,0,0,0,0));super(l,!0,!0,!0);S(this,"_flagRadius",!1);S(this,"_radius",0);this._renderer.type="circle";for(let c in ld)Object.defineProperty(this,c,ld[c]);typeof o=="number"&&(this.radius=o),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new Mn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Mn.Properties.length;r++){const o=Mn.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagRadius){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(n*2)),o=this._radius,s=o*r;for(let a=0;a<this.vertices.length;a++){const c=a/n*hi,d=o*Ps(c),u=o*Fs(c),f=s*Ps(c-dt),m=s*Fs(c-dt),g=s*Ps(c+dt),h=s*Fs(c+dt),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(f,m),p.controls.right.set(g,h)}}return super._update.call(this),this}flagReset(){return this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=new Mn(0,0,this.radius,this.vertices.length);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ie.Properties.length;o++){const s=Ie.Properties[o];r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="circle";for(let r=0;r<Mn.Properties.length;r++){const o=Mn.Properties[r];n[o]=this[o]}return n}};S(Mn,"Properties",["radius"]);let Vs=Mn;const ld={radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius=t,this._flagRadius=!0}}},Ms=Math.cos,Is=Math.sin,In=class In extends Ie{constructor(n,r,o,s,a){typeof s!="number"&&typeof o=="number"&&(s=o);const l=a?Math.max(a,2):4,c=[];for(let d=0;d<l;d++)c.push(new Fe);super(c,!0,!0,!0);S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_width",0);S(this,"_height",0);this._renderer.type="ellipse";for(let d in cd)Object.defineProperty(this,d,cd[d]);typeof o=="number"&&(this.width=o*2),typeof s=="number"&&(this.height=s*2),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new In().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<In.Properties.length;r++){const o=In.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){let n=this.vertices.length;!this._closed&&n>2&&(n-=1);const r=4/3*Math.tan(Math.PI/(this.vertices.length*2)),o=this._width/2,s=this._height/2;for(let a=0;a<this.vertices.length;a++){const c=a/n*hi,d=o*Ms(c),u=s*Is(c),f=o*r*Ms(c-dt),m=s*r*Is(c-dt),g=o*r*Ms(c+dt),h=s*r*Is(c+dt),p=this.vertices[a];p.command=a===0?pe.move:pe.curve,p.set(d,u),p.controls.left.set(f,m),p.controls.right.set(g,h)}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=this.width/2,o=this.height/2,s=this.vertices.length,a=new In(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ie.Properties.length;l++){const c=Ie.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="ellipse";for(let r=0;r<In.Properties.length;r++){const o=In.Properties[r];n[o]=this[o]}return n}};S(In,"Properties",["width","height"]);let As=In;const cd={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}}},ry=Math.cos,oy=Math.sin,An=class An extends Ie{constructor(n,r,o,s){s=Math.max(s||0,3);super();S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_flagSides",!1);S(this,"_radius",0);S(this,"_width",0);S(this,"_height",0);S(this,"_sides",0);this._renderer.type="polygon";for(let a in dd)Object.defineProperty(this,a,dd[a]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.radius=o),typeof s=="number"&&(this.sides=s),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new An().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<An.Properties.length;r++){const o=An.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){const n=this._sides,r=n+1;let o=this.vertices.length;o>n&&(this.vertices.splice(n-1,o-n),o=n);for(let s=0;s<r;s++){const a=(s+.5)/n,l=hi*a+Math.PI/2,c=this._width*ry(l)/2,d=this._height*oy(l)/2;s>=o?this.vertices.push(new Fe(c,d)):this.vertices[s].set(c,d),this.vertices[s].command=s===0?pe.move:pe.line}}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=new An(0,0,0,this.sides);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,r.width=this.width,r.height=this.height,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ie.Properties.length;o++){const s=Ie.Properties[o];r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);n.renderer.type="polygon";for(let r=0;r<An.Properties.length;r++){const o=An.Properties[r];n[o]=this[o]}return n}};S(An,"Properties",["width","height","sides"]);let Os=An;const dd={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}}},$i=class $i extends Ie{constructor(n,r,o,s){const a=[new Fe,new Fe,new Fe,new Fe];super(a,!0,!1,!0);S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_width",0);S(this,"_height",0);S(this,"_origin",null);this._renderer.type="rectangle";for(let l in ud)Object.defineProperty(this,l,ud[l]);this.width=typeof o=="number"?o:1,this.height=typeof s=="number"?s:1,this.origin=new be,typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r),this._update()}static fromObject(n){const r=new $i().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<$i.Properties.length;r++){const o=$i.Properties[r];o in n&&(typeof n[o]=="number"?this[o]=n[o]:this[o]instanceof be&&this[o].copy(n[o]))}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight){const n=this._width/2,r=this._height/2;!this._closed&&this.vertices.length===4&&this.vertices.push(new Fe),this.vertices[0].set(-n,-r).sub(this._origin).command=pe.move,this.vertices[1].set(n,-r).sub(this._origin).command=pe.line,this.vertices[2].set(n,r).sub(this._origin).command=pe.line,this.vertices[3].set(-n,r).sub(this._origin).command=pe.line,this.vertices[4]&&(this.vertices[4].set(-n,-r).sub(this._origin).command=pe.line)}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=!1,super.flagReset.call(this),this}clone(n){const r=new $i(0,0,this.width,this.height);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.skewX=this.skewX,r.skewY=this.skewY,this.matrix.manual&&r.matrix.copy(this.matrix);for(let o=0;o<Ie.Properties.length;o++){const s=Ie.Properties[o];r[s]instanceof be?r[s].copy(this[s]):r[s]=this[s]}return n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="rectangle",n.width=this.width,n.height=this.height,n.origin=this.origin.toObject(),n}};S($i,"Properties",["width","height","origin"]);let _r=$i;const ud={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},origin:{enumerable:!0,get:function(){return this._origin},set:function(t){this._origin&&this._origin.unbind(ne.Types.change,this._renderer.flagVertices),this._origin=t,this._origin.bind(ne.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}}},On=class On extends Ie{constructor(n,r,o,s,a){typeof a>"u"&&typeof o=="number"&&typeof s=="number"&&(a=Math.floor(Math.min(o,s)/12));const l=[];for(let c=0;c<10;c++)l.push(new Fe(0,0,0,0,0,0,c===0?pe.move:pe.curve));super(l);S(this,"_flagWidth",!1);S(this,"_flagHeight",!1);S(this,"_flagRadius",!1);S(this,"_width",0);S(this,"_height",0);S(this,"_radius",12);this._renderer.type="rounded-rectangle";for(let c in hd)Object.defineProperty(this,c,hd[c]);this.closed=!0,this.automatic=!1,this._renderer.flagRadius=sy.bind(this),typeof o=="number"&&(this.width=o),typeof s=="number"&&(this.height=s),(typeof a=="number"||a instanceof be)&&(this.radius=a),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new On().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<On.Properties.length;r++){const o=On.Properties[r];if(o in n){const s=n[o];/radius/i.test(o)?this[o]=typeof s=="number"||s instanceof be?s:new be().copy(s):typeof s=="number"&&(this[o]=s)}}return this}_update(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){const n=this._width,r=this._height;let o,s;this._radius instanceof be?(o=this._radius.x,s=this._radius.y):(o=this._radius,s=this._radius);let a,l=n/2,c=r/2;a=this.vertices[0],a.x=-(l-o),a.y=-c,a=this.vertices[1],a.x=l-o,a.y=-c,a.controls.left.clear(),a.controls.right.x=o,a.controls.right.y=0,a=this.vertices[2],a.x=l,a.y=-(c-s),a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[3],a.x=l,a.y=c-s,a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=s,a=this.vertices[4],a.x=l-o,a.y=c,a.controls.right.clear(),a.controls.left.clear(),a=this.vertices[5],a.x=-(l-o),a.y=c,a.controls.left.clear(),a.controls.right.x=-o,a.controls.right.y=0,a=this.vertices[6],a.x=-l,a.y=c-s,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[7],a.x=-l,a.y=-(c-s),a.controls.left.clear(),a.controls.right.x=0,a.controls.right.y=-s,a=this.vertices[8],a.x=-(l-o),a.y=-c,a.controls.left.clear(),a.controls.right.clear(),a=this.vertices[9],a.copy(this.vertices[8])}return super._update.call(this),this}flagReset(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,super.flagReset.call(this),this}clone(n){const r=this.width,o=this.height,s=this.radius,a=new On(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ie.Properties.length;l++){const c=Ie.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="rounded-rectangle";for(let r=0;r<On.Properties.length;r++){const o=On.Properties[r];n[o]=this[o]}return n.radius=typeof this.radius=="number"?this.radius:this.radius.toObject(),n}};S(On,"Properties",["width","height","radius"]);let zs=On;const hd={width:{enumerable:!0,get:function(){return this._width},set:function(t){this._width=t,this._flagWidth=!0}},height:{enumerable:!0,get:function(){return this._height},set:function(t){this._height=t,this._flagHeight=!0}},radius:{enumerable:!0,get:function(){return this._radius},set:function(t){this._radius instanceof be&&this._radius.unbind(ne.Types.change,this._renderer.flagRadius),this._radius=t,this._radius instanceof be&&this._radius.bind(ne.Types.change,this._renderer.flagRadius),this._flagRadius=!0}}};function sy(){this._flagRadius=!0}const ay=Math.cos,ly=Math.sin,zn=class zn extends Ie{constructor(n,r,o,s,a){arguments.length<=3&&(s=o,o=s/2),(typeof a!="number"||a<=0)&&(a=5);super();S(this,"_flagInnerRadius",!1);S(this,"_flagOuterRadius",!1);S(this,"_flagSides",!1);S(this,"_innerRadius",0);S(this,"_outerRadius",0);S(this,"_sides",0);this._renderer.type="star";for(let l in fd)Object.defineProperty(this,l,fd[l]);this.closed=!0,this.automatic=!1,typeof o=="number"&&(this.innerRadius=o),typeof s=="number"&&(this.outerRadius=s),typeof a=="number"&&(this.sides=a),this._update(),typeof n=="number"&&(this.translation.x=n),typeof r=="number"&&(this.translation.y=r)}static fromObject(n){const r=new zn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<zn.Properties.length;r++){const o=zn.Properties[r];o in n&&typeof n[o]=="number"&&(this[o]=n[o])}return this}_update(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){const n=this._sides*2,r=n+1;let o=this.vertices.length;o>n&&(this.vertices.splice(n-1,o-n),o=n);for(let s=0;s<r;s++){const a=(s+.5)/n,l=hi*a,c=(s%2?this._outerRadius:this._innerRadius)/2,d=c*ay(l),u=c*ly(l);s>=o?this.vertices.push(new Fe(d,u)):this.vertices[s].set(d,u),this.vertices[s].command=s===0?pe.move:pe.line}}return super._update.call(this),this}flagReset(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,super.flagReset.call(this),this}clone(n){const r=this.innerRadius,o=this.outerRadius,s=this.sides,a=new zn(0,0,r,o,s);a.translation.copy(this.translation),a.rotation=this.rotation,a.scale=this.scale,a.skewX=this.skewX,a.skewY=this.skewY,this.matrix.manual&&a.matrix.copy(this.matrix);for(let l=0;l<Ie.Properties.length;l++){const c=Ie.Properties[l];a[c]=this[c]}return n&&n.add(a),a}toObject(){const n=super.toObject.call(this);n.renderer.type="star";for(let r=0;r<zn.Properties.length;r++){const o=zn.Properties[r];n[o]=this[o]}return n}};S(zn,"Properties",["innerRadius","outerRadius","sides"]);let Ds=zn;const fd={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 Ls;const md=Math.min,gd=Math.max;yn.document&&(Ls=document.createElement("canvas"));const Ct=class Ct extends $n{constructor(n,r,o,s){super();S(this,"_flagValue",!0);S(this,"_flagFamily",!0);S(this,"_flagSize",!0);S(this,"_flagLeading",!0);S(this,"_flagAlignment",!0);S(this,"_flagBaseline",!0);S(this,"_flagStyle",!0);S(this,"_flagWeight",!0);S(this,"_flagDecoration",!0);S(this,"_flagFill",!0);S(this,"_flagStroke",!0);S(this,"_flagLinewidth",!0);S(this,"_flagOpacity",!0);S(this,"_flagVisible",!0);S(this,"_flagMask",!1);S(this,"_flagClip",!1);S(this,"_flagDirection",!0);S(this,"_flagStrokeAttenuation",!0);S(this,"_value","");S(this,"_family","sans-serif");S(this,"_size",13);S(this,"_leading",17);S(this,"_alignment","center");S(this,"_baseline","middle");S(this,"_style","normal");S(this,"_weight",500);S(this,"_decoration","none");S(this,"_direction","ltr");S(this,"_fill","#000");S(this,"_stroke","none");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_mask",null);S(this,"_clip",!1);S(this,"_dashes",null);S(this,"_strokeAttenuation",!0);for(let a in pd)Object.defineProperty(this,a,pd[a]);if(this._renderer.type="text",this._renderer.flagFill=cy.bind(this),this._renderer.flagStroke=dy.bind(this),this.value=n,typeof r=="number"&&(this.translation.x=r),typeof o=="number"&&(this.translation.y=o),this.dashes=[],this.dashes.offset=0,!Me.isObject(s))return this;for(let a=0;a<Ct.Properties.length;a++){const l=Ct.Properties[a];l in s&&(this[l]=s[l])}}static Measure(n){if(Ls){const r=Ls.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*Ct.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:gi(n.fill),o=typeof n.stroke=="string"?n.stroke:gi(n.stroke),s=new Ct().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<Ct.Properties.length;r++){const o=Ct.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new Ct(this.value);r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale;for(let o=0;o<Ct.Properties.length;o++){const s=Ct.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<Ct.Properties.length;r++){const o=Ct.Properties[r];n[o]=this[o]}return n}dispose(){return super.dispose(),typeof this.fill=="object"&&this.fill&&"dispose"in this.fill?this.fill.dispose():typeof this.fill=="object"&&this.fill&&"unbind"in this.fill&&this.fill.unbind(),typeof this.stroke=="object"&&this.stroke&&"dispose"in this.stroke?this.stroke.dispose():typeof this.stroke=="object"&&this.stroke&&"unbind"in this.stroke&&this.stroke.unbind(),this}noFill(){return this.fill="none",this}noStroke(){return this.stroke="none",this.linewidth=0,this}getBoundingClientRect(n){let r,o,s,a,l;this._update(!0),r=n?this.matrix:this.worldMatrix;const{width:c,height:d}=Ct.Measure(this),u=(this._linewidth||0)/2;switch(this.alignment){case"left":o=-u,s=c+u;break;case"right":o=-(c+u),s=u;break;default:o=-(c/2+u),s=c/2+u}switch(this.baseline){case"middle":a=-(d/2+u),l=d/2+u;break;default:a=-(d+u),l=u}const[f,m]=r.multiply(o,a),[g,h]=r.multiply(o,l),[p,y]=r.multiply(s,a),[b,_]=r.multiply(s,l);return a=md(m,h,y,_),o=md(f,g,p,b),s=gd(f,g,p,b),l=gd(m,h,y,_),{top:a,left:o,right:s,bottom:l,width:s-o,height:l-a}}flagReset(){return super.flagReset.call(this),this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=this._flagDirection=!1,this}};S(Ct,"Ratio",.6),S(Ct,"Properties",["value","family","size","leading","alignment","linewidth","style","weight","decoration","direction","baseline","opacity","visible","fill","stroke","dashes","strokeAttenuation"]);let Ki=Ct;const pd={value:{enumerable:!0,get:function(){return this._value},set:function(t){this._value=t,this._flagValue=!0}},family:{enumerable:!0,get:function(){return this._family},set:function(t){this._family=t,this._flagFamily=!0}},size:{enumerable:!0,get:function(){return this._size},set:function(t){this._size=t,this._flagSize=!0}},leading:{enumerable:!0,get:function(){return this._leading},set:function(t){this._leading=t,this._flagLeading=!0}},alignment:{enumerable:!0,get:function(){return this._alignment},set:function(t){this._alignment=t,this._flagAlignment=!0}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t,this._flagLinewidth=!0}},style:{enumerable:!0,get:function(){return this._style},set:function(t){this._style=t,this._flagStyle=!0}},weight:{enumerable:!0,get:function(){return this._weight},set:function(t){this._weight=t,this._flagWeight=!0}},decoration:{enumerable:!0,get:function(){return this._decoration},set:function(t){this._decoration=t,this._flagDecoration=!0}},direction:{enumerable:!0,get:function(){return this._direction},set:function(t){this._direction=t,this._flagDirection=!0}},baseline:{enumerable:!0,get:function(){return this._baseline},set:function(t){this._baseline=t,this._flagBaseline=!0}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._opacity=t,this._flagOpacity=!0}},visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._visible=t,this._flagVisible=!0}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.unbind(ne.Types.change,this._renderer.flagFill),this._fill=t,this._flagFill=!0,(this._fill instanceof st||this._fill instanceof $t||this._fill instanceof Et||this._fill instanceof Ge)&&this._fill.bind(ne.Types.change,this._renderer.flagFill)}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.unbind(ne.Types.change,this._renderer.flagStroke),this._stroke=t,this._flagStroke=!0,(this._stroke instanceof st||this._stroke instanceof $t||this._stroke instanceof Et||this._stroke instanceof Ge)&&this._stroke.bind(ne.Types.change,this._renderer.flagStroke)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Me.isObject(t)&&!t.clip&&(t.clip=!0)}},clip:{enumerable:!0,get:function(){return this._clip},set:function(t){this._clip=t,this._flagClip=!0}},dashes:{enumerable:!0,get:function(){return this._dashes},set:function(t){typeof t.offset!="number"&&(t.offset=this.dashes&&this._dashes.offset||0),this._dashes=t}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t,this._flagStrokeAttenuation=!0,this._flagLinewidth=!0}}};function cy(){this._flagFill=!0}function dy(){this._flagStroke=!0}const Dn=class Dn extends _r{constructor(n,r,o,s){super(r,o,0,0);S(this,"_flagTextures",!1);S(this,"_flagFrameRate",!1);S(this,"_flagIndex",!1);S(this,"_amount",1);S(this,"_duration",0);S(this,"_index",0);S(this,"_startTime",0);S(this,"_playing",!1);S(this,"_firstFrame",0);S(this,"_lastFrame",0);S(this,"_loop",!0);S(this,"_textures",null);S(this,"_frameRate",0);S(this,"_origin",null);this._renderer.type="image-sequence";for(let a in yd)Object.defineProperty(this,a,yd[a]);this._renderer.flagTextures=uy.bind(this),this._renderer.bindTextures=hy.bind(this),this._renderer.unbindTextures=fy.bind(this),this.noStroke(),this.noFill(),Array.isArray(n)?this.textures=n.map(bd.bind(this)):typeof n=="string"&&(this.textures=[bd(n)]),this.origin=new be,this._update(),typeof s=="number"?this.frameRate=s:this.frameRate=Dn.DefaultFrameRate,this.index=0}static fromObject(n){const r=new Dn().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Dn.Properties.length;r++){const o=Dn.Properties[r];o in n&&(this[o]=n[o])}return this}play(n,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=Me.performance.now(),typeof n=="number"&&(this._firstFrame=n),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=this._firstFrame,this}clone(n){const r=new Dn(this.textures,this.translation.x,this.translation.y,this.frameRate);return r._loop=this._loop,this._playing&&r.play(),n&&n.add(r),r}toObject(){const n=super.toObject.call(this);return n.renderer.type="image-sequence",n.textures=this.textures.map(function(r){return r.toObject()}),n.frameRate=this.frameRate,n.index=this.index,n.firstFrame=this.firstFrame,n.lastFrame=this.lastFrame,n.loop=this.loop,n}dispose(){if(super.dispose(),this._playing&&(this._playing=!1),this._onLastFrame=null,this.textures&&typeof this.textures.unbind=="function")try{this.textures.unbind()}catch{}if(this.textures)for(let n=0;n<this.textures.length;n++){const r=this.textures[n];typeof r.dispose=="function"?r.dispose():typeof r.unbind=="function"&&r.unbind()}return this}_update(){const n=this._textures;let r,o,s,a,l,c,d,u;return n&&(this._flagTextures&&(this._amount=n.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(a=this._amount,Me.isNaN(this._lastFrame)&&(this._lastFrame=a-1),s=Me.performance.now()-this._startTime,u=this._lastFrame+1,l=1e3*(u-this._firstFrame)/this._frameRate,this._loop?s=s%l:s=Math.min(s,l),d=Gt(this._firstFrame,u,s/l),d=Math.floor(d),d!==this._index&&(this._index=d,c=n[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o),this.fill=c,d>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):(this._flagIndex||!(this.fill instanceof Ge))&&(c=n[this._index],c.loaded&&(r=c.image.width,o=c.image.height,this.width!==r&&(this.width=r),this.height!==o&&(this.height=o)),this.fill=c)),super._update.call(this),this}flagReset(){return this._flagTextures=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(Dn,"Properties",["textures","frameRate","index","firstFrame","lastFrame","loop"]),S(Dn,"DefaultFrameRate",30);let Hs=Dn;const yd={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 fi((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 uy(){this._flagTextures=!0}function hy(t){let e=t.length;for(;e--;)t[e].bind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function fy(t){let e=t.length;for(;e--;)t[e].unbind(ne.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()}function bd(t){if(t instanceof Ge)return t;if(typeof t=="string")return new Ge(t)}const Ei=class Ei extends _r{constructor(n,r,o,s,a,l){super(r,o,0,0);S(this,"_flagTexture",!1);S(this,"_flagColumns",!1);S(this,"_flagRows",!1);S(this,"_flagFrameRate",!1);S(this,"_flagIndex",!1);S(this,"_amount",1);S(this,"_duration",0);S(this,"_startTime",0);S(this,"_playing",!1);S(this,"_firstFrame",0);S(this,"_lastFrame",0);S(this,"_loop",!0);S(this,"_texture",null);S(this,"_columns",1);S(this,"_rows",1);S(this,"_frameRate",0);S(this,"_index",0);S(this,"_origin",null);this._renderer.type="sprite";for(let c in _d)Object.defineProperty(this,c,_d[c]);this.noStroke(),this.noFill(),n instanceof Ge?this.texture=n:typeof n=="string"&&(this.texture=new Ge(n)),this.origin=new be,this._update(),typeof s=="number"&&(this.columns=s),typeof a=="number"&&(this.rows=a),typeof l=="number"&&(this.frameRate=l),this.index=0}static fromObject(n){const r=new Ei().copy(n);return"id"in n&&(r.id=n.id),r}copy(n){super.copy.call(this,n);for(let r=0;r<Ei.Properties.length;r++){const o=Ei.Properties[r];o in n&&(this[o]=n[o])}return this}play(n,r,o){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=Me.performance.now(),typeof n=="number"&&(this._firstFrame=n),typeof r=="number"&&(this._lastFrame=r),typeof o=="function"?this._onLastFrame=o:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this}pause(){return this._playing=!1,this}stop(){return this._playing=!1,this._index=0,this}clone(n){const r=new Ei(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,f,m,g;if(n&&((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=n),n.loaded)){f=n.image.width,m=n.image.height,s=f/r,a=m/o,c=this._amount,this.width!==s&&(this.width=s),this.height!==a&&(this.height=a),this._playing&&this._frameRate>0&&(Me.isNaN(this._lastFrame)&&(this._lastFrame=c-1),l=Me.performance.now()-this._startTime,g=this._lastFrame+1,d=1e3*(g-this._firstFrame)/this._frameRate,this._loop?l=l%d:l=Math.min(l,d),u=Gt(this._firstFrame,g,l/d),u=Math.floor(u),u!==this._index&&(this._index=u,u>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));const h=this._index%r,p=Math.floor(this._index/r),y=-s*h+(f-s)/2,b=-a*p+(m-a)/2;y!==n.offset.x&&(n.offset.x=y),b!==n.offset.y&&(n.offset.y=b)}return super._update.call(this),this}flagReset(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,super.flagReset.call(this),this}};S(Ei,"Properties",["texture","columns","rows","frameRate","index","firstFrame","lastFrame","loop"]);let Ws=Ei;const _d={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}}},yo=Math.min,bo=Math.max,an=class an extends $n{constructor(n){super();S(this,"_flagAdditions",!1);S(this,"_flagSubtractions",!1);S(this,"_flagOrder",!1);S(this,"_flagOpacity",!0);S(this,"_flagBeginning",!1);S(this,"_flagEnding",!1);S(this,"_flagLength",!1);S(this,"_flagMask",!1);S(this,"_fill","#fff");S(this,"_stroke","#000");S(this,"_linewidth",1);S(this,"_opacity",1);S(this,"_visible",!0);S(this,"_cap","round");S(this,"_join","round");S(this,"_miter",4);S(this,"_closed",!0);S(this,"_curved",!1);S(this,"_automatic",!0);S(this,"_beginning",0);S(this,"_ending",1);S(this,"_length",0);S(this,"_mask",null);S(this,"_strokeAttenuation",!0);for(let r in wd)Object.defineProperty(this,r,wd[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++)xd.call(this,n[r],this)}static RemoveChildren(n){for(let r=0;r<n.length;r++)xd.call(this,n[r])}static OrderChildren(n){this._flagOrder=!0}static fromObject(n){const r=new an;for(let s=0;s<an.Properties.length;s++){const a=an.Properties[s];a in n&&(/(fill|stroke)/i.test(a)?r[a]=typeof n[a]=="string"?n[a]:gi(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 Rs.fromObject(s);case"circle":return Vs.fromObject(s);case"element":return yr.fromObject(s);case"ellipse":return As.fromObject(s);case"group":return an.fromObject(s);case"image":return Image.fromObject(s);case"image-sequence":return Hs.fromObject(s);case"path":return Ie.fromObject(s);case"points":return po.fromObject(s);case"polygon":return Os.fromObject(s);case"rectangle":return _r.fromObject(s);case"rounded-rectangle":return zs.fromObject(s);case"shape":return $n.fromObject(s);case"sprite":return Ws.fromObject(s);case"star":return Ds.fromObject(s);case"text":return Ki.fromObject(s)}return s}}copy(n){super.copy.call(this,n),console.warn("Two.js: attempting to copy group. Two.Group.children copying not supported.");for(let r=0;r<an.Properties.length;r++){const o=an.Properties[r];o in n&&(this[o]=n[o])}return this}clone(n){const r=new an,o=this.children.map(function(s){return s.clone()});return r.add(o),r.opacity=this.opacity,this.mask&&(r.mask=this.mask),r.translation.copy(this.translation),r.rotation=this.rotation,r.scale=this.scale,r.className=this.className,this.matrix.manual&&r.matrix.copy(this.matrix),n&&n.add(r),r._update()}toObject(){const n=super.toObject.call(this);return n.renderer.type="group",n.children=[],n.opacity=this.opacity,n.className=this.className,n.mask=this.mask?this.mask.toObject():null,Me.each(this.children,(r,o)=>{n.children[o]=r.toObject()},this),n}dispose(){if(super.dispose(),this.children)for(let n=0;n<this.children.length;n++){const r=this.children[n];typeof r.dispose=="function"&&r.dispose()}if(this.children&&typeof this.children.unbind=="function")try{this.children.unbind()}catch{}return this}corner(){const n=this.getBoundingClientRect(!0);for(let r=0;r<this.children.length;r++){const o=this.children[r];o.translation.x-=n.left,o.translation.y-=n.top}return this.mask&&(this.mask.translation.x-=n.left,this.mask.translation.y-=n.top),this}center(){const n=this.getBoundingClientRect(!0),r=n.left+n.width/2-this.translation.x,o=n.top+n.height/2-this.translation.y;for(let s=0;s<this.children.length;s++){const a=this.children[s];a.isShape&&(a.translation.x-=r,a.translation.y-=o)}return this.mask&&(this.mask.translation.x-=r,this.mask.translation.y-=o),this}getById(n){let r=null;function o(s){if(s.id===n)return s;if(s.children){if(s.children.ids[n])return s.children.ids[n];for(let a=0;a<s.children.length;a++)if(r=o(s.children[a]),r)return r}return null}return o(this)}getByClassName(n){const r=[];function o(s){if(Array.prototype.indexOf.call(s.classList,n)>=0&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}getByType(n){const r=[];function o(s){if(s instanceof n&&r.push(s),s.children)for(let a=0;a<s.children.length;a++){const l=s.children[a];o(l)}return r}return o(this)}add(n){n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let r=0;r<n.length;r++){const o=n[r];if(!(o&&o.id))continue;const s=Array.prototype.indexOf.call(this.children,o);s>=0&&this.children.splice(s,1),this.children.push(o)}return this}remove(n){const r=arguments.length,o=this.parent;if(r<=0&&o)return o.remove(this),this;n instanceof Array?n=n.slice():n=Array.prototype.slice.call(arguments);for(let s=0;s<n.length;s++){const a=n[s];if(!a||!this.children.ids[a.id])continue;const l=this.children.indexOf(a);l>=0&&this.children.splice(l,1)}return this}getBoundingClientRect(n){let r,o,s,a,l,c;this._update(!0);let d=1/0,u=-1/0,f=1/0,m=-1/0;const g=/texture|gradient/i;o=n?this.matrix:this.worldMatrix;for(let h=0;h<this.children.length;h++){const p=this.children[h];if(!(!p.visible||g.test(p._renderer.type))&&(r=p.getBoundingClientRect(n),s=typeof r.top!="number"||Me.isNaN(r.top)||!isFinite(r.top),a=typeof r.left!="number"||Me.isNaN(r.left)||!isFinite(r.left),l=typeof r.right!="number"||Me.isNaN(r.right)||!isFinite(r.right),c=typeof r.bottom!="number"||Me.isNaN(r.bottom)||!isFinite(r.bottom),!(s||a||l||c)))if(n){const[y,b]=o.multiply(r.left,r.top),[_,v]=o.multiply(r.right,r.top),[x,N]=o.multiply(r.left,r.bottom),[T,k]=o.multiply(r.right,r.bottom);f=yo(b,v,N,k,f),d=yo(y,_,x,T,d),u=bo(y,_,x,T,u),m=bo(b,v,N,k,m)}else f=yo(r.top,f),d=yo(r.left,d),u=bo(r.right,u),m=bo(r.bottom,m)}return{top:f,left:d,right:u,bottom:m,width:u-d,height:m-f}}noFill(){return this.children.forEach(function(n){n.noFill()}),this}noStroke(){return this.children.forEach(function(n){n.noStroke()}),this}subdivide(){const n=arguments;return this.children.forEach(function(r){r.subdivide.apply(r,n)}),this}_update(){let n,r,o;if(this._flagBeginning||this._flagEnding){const s=Math.min(this._beginning,this._ending),a=Math.max(this._beginning,this._ending),l=this.length;let c=0;const d=s*l,u=a*l;for(n=0;n<this.children.length;n++)o=this.children[n],r=o.length,d>c+r?(o.beginning=1,o.ending=1):u<c?(o.beginning=0,o.ending=0):d>c&&d<c+r?(o.beginning=(d-c)/r,o.ending=1):u>c&&u<c+r?(o.beginning=0,o.ending=(u-c)/r):(o.beginning=0,o.ending=1),c+=r}return super._update.apply(this,arguments)}flagReset(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,super.flagReset.call(this),this}};S(an,"Children",sd),S(an,"Properties",["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"]);let En=an;const wd={visible:{enumerable:!0,get:function(){return this._visible},set:function(t){this._flagVisible=this._visible!==t||this._flagVisible,this._visible=t}},opacity:{enumerable:!0,get:function(){return this._opacity},set:function(t){this._flagOpacity=this._opacity!==t||this._flagOpacity,this._opacity=t}},beginning:{enumerable:!0,get:function(){return this._beginning},set:function(t){this._flagBeginning=this._beginning!==t||this._flagBeginning,this._beginning=t}},ending:{enumerable:!0,get:function(){return this._ending},set:function(t){this._flagEnding=this._ending!==t||this._flagEnding,this._ending=t}},length:{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(let t=0;t<this.children.length;t++){const e=this.children[t];this._length+=e.length}}return this._length}},fill:{enumerable:!0,get:function(){return this._fill},set:function(t){this._fill=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.fill=t}}},stroke:{enumerable:!0,get:function(){return this._stroke},set:function(t){this._stroke=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.stroke=t}}},linewidth:{enumerable:!0,get:function(){return this._linewidth},set:function(t){this._linewidth=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.linewidth=t}}},join:{enumerable:!0,get:function(){return this._join},set:function(t){this._join=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.join=t}}},miter:{enumerable:!0,get:function(){return this._miter},set:function(t){this._miter=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.miter=t}}},cap:{enumerable:!0,get:function(){return this._cap},set:function(t){this._cap=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.cap=t}}},closed:{enumerable:!0,get:function(){return this._closed},set:function(t){this._closed=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.closed=t}}},curved:{enumerable:!0,get:function(){return this._curved},set:function(t){this._curved=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.curved=t}}},automatic:{enumerable:!0,get:function(){return this._automatic},set:function(t){this._automatic=t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.automatic=t}}},children:{enumerable:!0,get:function(){return this._children},set:function(t){const e=En.InsertChildren.bind(this),n=En.RemoveChildren.bind(this),r=En.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&n(this._children)),this._children=new sd(t),this._children.bind(ne.Types.insert,e),this._children.bind(ne.Types.remove,n),this._children.bind(ne.Types.order,r),t.length>0&&e(t)}},mask:{enumerable:!0,get:function(){return this._mask},set:function(t){this._mask=t,this._flagMask=!0,Me.isObject(t)&&!t.clip&&(t.clip=!0)}},strokeAttenuation:{enumerable:!0,get:function(){return this._strokeAttenuation},set:function(t){this._strokeAttenuation=!!t;for(let e=0;e<this.children.length;e++){const n=this.children[e];n.strokeAttenuation!==void 0&&(n.strokeAttenuation=t)}}}};function xd(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 _o extends Ie{constructor(e,n,r,o){const s=[new Fe(e,n),new Fe(r,o)];super(s);for(let a in kd)Object.defineProperty(this,a,kd[a]);this.vertices[0].command=pe.move,this.vertices[1].command=pe.line,this.automatic=!1}}S(_o,"Properties",["left","right"]);const kd={left:{enumerable:!0,get:function(){return this.vertices[0]},set:function(t){if(Me.isObject(t))this.vertices.splice(0,1,t),this.vertices[0].command=pe.move;else{const e=new ho("Two.Line.left argument is not an object.");console.warn(e.name,e.message)}}},right:{enumerable:!0,get:function(){return this.vertices[1]},set:function(t){if(Me.isObject(t))this.vertices.splice(1,1,t),this.vertices[1].command=pe.line;else{const e=new ho("Two.Line.right argument is not an object.");console.warn(e.name,e.message)}}}};class js{constructor(e=0,n=0){this.x=e,this.y=n}}class _n{constructor(e=10,n=0,r="A"){S(this,"start",new js);S(this,"end",new js);this.width=e,this.angle=n,this.label=r}}const je={line:{color:"#000",size:5},previewLine:{color:"#000",size:2},anchorPoint:{color:"#FF8000",size:12,strokeSize:20},lineLabel:{color:"#FF8000",size:22,rotation:-.5},angleLabel:{size:22,color:"#088c00",rotation:-.5},colorSideLabel:{size:20,color:"#439227"}},my={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function gy(t,e){return i.openBlock(),i.createElementBlock("svg",my,[...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 wo=i.markRaw({name:"ion-close",render:gy}),py={class:"mr-3 flex flex-col gap-2"},yy=["onClick"],by={class:"h-full p-2"},_y={},wy=i.defineComponent({..._y,__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,f)=>{var g;const m=(g=o.value)==null?void 0:g.at(f);m&&a("init-draw-template",m,u)}),(d=n.settings.customTemplates)==null||d.forEach((u,f)=>{var g;const m=(g=s.value)==null?void 0:g.at(f);m&&a("init-draw-template",m,u)})}),i.watch(()=>[...n.settings.customTemplates],(c,d)=>{i.nextTick(()=>{c.forEach((u,f)=>{var m;if(!(d!=null&&d.includes(u))){const g=(m=s.value)==null?void 0:m.at(f);g&&a("init-draw-template",g,u)}}),d.length>c.length&&d.forEach((u,f)=>{var g;const m=(g=s.value)==null?void 0:g.at(f);m&&(m.innerHTML="",a("init-draw-template",m,u))})})},{deep:!0}),(c,d)=>{const u=wo;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",py,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(t.settings.allTemplates,(f,m)=>(i.openBlock(),i.createElementBlock("div",{key:`${f.id}-${m}`,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":m===t.selectTemplateIndex}]),onClick:g=>a("template:select",m)},[i.createElementVNode("div",by,[i.createElementVNode("div",{ref_for:!0,ref:f.isCustom&&f.id!==-1?"drawing-custom-template-containers":"drawing-template-containers",class:"kozyrek-preview h-full"},null,512)])],10,yy)]),default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(f.label),1)]),_:2},1024),f.isCustom&&!f.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:g=>l(m)},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["loading","disabled","onClick"])):i.createCommentVNode("",!0)]))),128))])]),_:1})}}}),vd=qn(wy,[["__scopeId","data-v-afccb364"]]),xy={class:"flex gap-3 min-w-[20rem] relative"},ky={class:"kozyrek-preview w-fill h-[18rem] grow touch-none overflow-hidden rounded-lg bg-gray-200 p-2"},vy={ref:"drawing-container",class:"size-full"},Cy={},Cd=i.defineComponent({...Cy,__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((H,P)=>new _n(n.value.configuratorParams.linesWidths[P],H,`A-${P+1}`))),f=i.computed(()=>n.value.configuratorParams.colorSide==="bottom"),m=i.computed(()=>{var H,P;return n.value.configuratorParams.startTailType&&((H=n.settings.startTailConfigs)!=null&&H[n.value.configuratorParams.startTailType])?(P=n.settings.startTailConfigs)==null?void 0:P[n.value.configuratorParams.startTailType].points:[]}),g=i.computed(()=>{var P;const H=n.value.configuratorParams.endTailType!==void 0&&((P=n.settings.endTailConfigs)==null?void 0:P[n.value.configuratorParams.endTailType]);return!H||!H.points?[]:H.points.map((D,A)=>Array.isArray(D)?new _n(D[0],D[1],`A-${A+1}`):new _n(D.width,D.angle,`A-${A+1}`))}),h=(H,P=!1)=>{H[0].start.x=0,H[0].start.y=0;let D=0;for(let A=0;A<H.length;A++){const L=H[A],U=H[A-1]??new _n(0,D);D+=!P||A>1?U.angle:0;const K=(!P||A>0?L.angle:0)+D;if(H[A].end.x=L.width*Math.cos(K*Math.PI/180)+H[A].start.x,H[A].end.y=L.width*Math.sin(K*Math.PI/180)+H[A].start.y,A<H.length-1){const V=A+1;H[V].start.x=H[A].end.x,H[V].start.y=H[A].end.y}}return H},p=(H,P,D,A,L=!1)=>{let U=h([...D,...A]);P.length>0&&(U=[...h(P),...U]);let K=0,V=0,q=0,Y=0;U.forEach(Te=>{K=Math.min(K,Te.start.x,Te.end.x),V=Math.min(V,Te.start.y,Te.end.y),q=Math.max(q,Te.start.x,Te.end.x),Y=Math.max(Y,Te.start.y,Te.end.y)});let te,ue;K===0&&V===0&&q===0&&Y===0?(te=1,ue=1):(te=H.width/Math.abs(q-K),ue=(L?H.height:H.height-je.colorSideLabel.size)/Math.abs(Y-V));const ve=Math.min(te,ue);return K=K<0?-K*ve:0,V=V<0?-V*ve:0,[ve,K,V]},y=H=>{const P=new po([H]);return P._size=je.anchorPoint.size,P.fill=je.anchorPoint.color,P.stroke="transparent",P._linewidth=je.anchorPoint.strokeSize,l.push(P),P},b=(H,P)=>{if(l=[],n.settings.allowChangeFirstPoint){const D=H[0],A=new be(D.vertices[0].x,D.vertices[0].y);A.bind(ne.Types.change,()=>{D.vertices[0].copy(A)});const L=y(A);P.add(L)}H.forEach((D,A)=>{const L=H[A+1],U=new be(D.vertices[1].x,D.vertices[1].y);U.bind(ne.Types.change,()=>{D.vertices[1].copy(U),L!==void 0&&L.vertices[0].copy(U)});const K=y(U);P.add(K)})},_=H=>H*(Math.PI/180),v=(H,P,D)=>{const A=P.vertices.length-1;H.position.x=P.vertices[A].x,H.position.y=P.vertices[A].y;const L=Math.atan2(P.vertices[A].y-P.vertices[0].y,P.vertices[A].x-P.vertices[0].x);H.rotation=_(D)+L},x=(H,P,D)=>{if(P.vertices[0]===void 0)return;H.position.x=P.vertices[0].x,H.position.y=P.vertices[0].y;const A=P.vertices.length-1,L=Math.atan2(P.vertices[A].y-P.vertices[0].y,P.vertices[A].x-P.vertices[0].x);H.rotation=_(D)+L},N=(H,P,D)=>{const A=new En;if(H.length===0)return A;const L=[];return[...H].reverse().forEach((U,K)=>{K!==0&&U.angle>0&&(U.angle*=-1),L.push(U)}),H=h(L,!0),x(A,P,H[0].angle),[P.vertices[0],P.vertices[1]].forEach(U=>{U.bind(ne.Types.change,()=>{x(A,P,H[0].angle)})}),H.forEach(U=>{const K=U.start.x*D,V=U.end.x*D,q=U.start.y*D,Y=U.end.y*D,te=new _o(K,q,V,Y);te.linewidth=je.line.size,te.stroke=je.line.color,A.add(te)}),A},T=(H,P,D)=>{const A=new En;return H.length===0||(H=h(H,!0),v(A,P,H[0].angle),[P.vertices[0],P.vertices[1]].forEach(L=>{L.bind(ne.Types.change,()=>{v(A,P,H[0].angle)})}),H.forEach(L=>{const U=L.start.x*D,K=L.end.x*D,V=L.start.y*D,q=L.end.y*D,Y=new _o(U,V,K,q);Y.linewidth=je.line.size,Y.stroke=je.line.color,A.add(Y)})),A},k=(H,P,D,A)=>{const L=P.vertices[0].x+(P.vertices[1].x-P.vertices[0].x)/2-8*Math.sin(H.angle*Math.PI/180),U=P.vertices[0].y+(P.vertices[1].y-P.vertices[0].y)/2-8*Math.cos(H.angle*Math.PI/180),K=new Ki(H.label,L+10,U-10);let V;K.size=je.lineLabel.size,K.weight=600,K.fill=je.lineLabel.color,K.id+=1,K.rotation=je.lineLabel.rotation,A>0&&(V=new Ki(`${H.angle}°`,P.vertices[0].x+25,P.vertices[0].y-25),V.size=je.angleLabel.size,V.weight=600,V.fill=je.angleLabel.color,V.rotation=je.angleLabel.rotation,V.id+=A,s.push(V),D.add(V)),D.add(K),w(K,P,0,V),w(K,P,1)},$=()=>{const{size:H}=je.colorSideLabel,P=0,D=0,A=f.value?H/2:H/2-H,L=f.value?H/2-H:H/2,U=new En;if(!c)return U;const K=5,V=Math.atan2(L-A,D-P),q=[new Fe(P,A,0,0,0,0,pn.Commands.move),new Fe(D,L,0,0,0,0,pn.Commands.line),new Fe(D-K*Math.cos(V-Math.PI/4),L-K*Math.sin(V-Math.PI/4),0,0,0,0,pn.Commands.line),new Fe(D,L,0,0,0,0,pn.Commands.move),new Fe(D-K*Math.cos(V+Math.PI/4),L-K*Math.sin(V+Math.PI/4),0,0,0,0,pn.Commands.line)],Y=new Ie(q,!1,!1,!0);Y.noFill(),Y.cap="round",Y.join="round",Y.linewidth=H/7,Y.stroke=je.colorSideLabel.color,U.add(Y);const te=new Ki(f.value?"Цвет снизу":"Цвет сверху",10,0);te.size=H,te.weight=600,te.fill=je.colorSideLabel.color,te.alignment="left",U.add(te);const ue=U.getBoundingClientRect();return U.position.x=(c.width-ue.width)*d+10,U.position.y=f.value?c.height+ue.height*2:ue.height/2,U},w=(H,P,D,A)=>{P.vertices[D].bind(ne.Types.change,()=>{const L=P.vertices.length-1,U=Math.atan2(P.vertices[0].y-P.vertices[L].y,P.vertices[0].x-P.vertices[L].x)*180/Math.PI,K=P.vertices[0].x+(P.vertices[L].x-P.vertices[0].x)/2-8*Math.sin(U*Math.PI/180),V=P.vertices[0].y+(P.vertices[L].y-P.vertices[0].y)/2-8*Math.cos(U*Math.PI/180);H.position.x=K+10,H.position.y=V-10,H.rotation=-.5,A&&(A.position.x=P.vertices[0].x+25,A.position.y=P.vertices[0].y-25)})},B=(H,P,D,A,L=!1)=>{var We;if(H.clear(),D.length===0){H.update();return}const U=h(D),[K,V,q]=p(H,P,U,A,L),Y=new En,te=new Array,ue=new Array;L||(s=[],a=[]),U.forEach((ce,gt)=>{const Ne=ce.start.x*K+V,Ft=ce.end.x*K+V,Wt=ce.start.y*K+q,ln=ce.end.y*K+q,St=new _o(Ne,Wt,Ft,ln);St.linewidth=L?je.previewLine.size:je.line.size,St.stroke=L?je.previewLine.color:je.line.color,a.push(St),te.push(St),Y.add(St),!L&&ce.label!==""&&k(ce,St,Y,gt)});const ve=te.at(-1);let Te=Y.getBoundingClientRect();if(!L){const ce=$();ue.push(ce)}if(P.length>0){const ce=N(P,te[0],K);Y.add(ce)}if(A.length>0&&ve){const ce=T(A,ve,K);Y.add(ce)}if(ue.push(Y),H.makeGroup(ue),Te=Y.getBoundingClientRect(),Y.position.x=0-Te.left+(H.width-Te.width)/(2*(L?1:d)),Y.position.y=0-Te.top+(H.height-Te.height)/(2*(L?1:d)),H.update(),!L){const ce=((We=n.value.configuratorParams)==null?void 0:We.colorSide)==="top";Y.position.y=Y.position.y+je.colorSideLabel.size*Number(ce),b(te,Y),H.update()}},E=(H,P)=>{if(H&&!P.isNewRec()){const D=new pn({width:H.scrollWidth,height:H.scrollHeight});D.appendTo(H),B(D,[],P.points,[],!0)}},M=()=>{c&&B(c,m.value,u.value,g.value,!1)},R=H=>H*(180/Math.PI),O=(H,P)=>{const D=H[1].x-H[0].x,A=H[1].y-H[0].y,L=P[1].x-P[0].x,U=P[1].y-P[0].y;let K=Math.atan2(D*U-A*L,D*L+A*U);return K=R(K),Math.round(K)*-1},W=H=>{const P=a.map((D,A,L)=>{const U=L[A-1]??{vertices:[{x:-10,y:0},{x:0,y:0}]};let K=Math.ceil(D._length/H/n.settings.lineWidthStep)*n.settings.lineWidthStep;const V=s[A-1];K<(L.length>1?n.settings.minLineWidth:n.settings.stripMinWidth)&&(K=L.length>1?n.settings.minLineWidth:n.settings.stripMinWidth),K>n.settings.maxLineWidth&&(K=n.settings.maxLineWidth);const q=O(D.vertices,U.vertices);return V&&(V.value=`${q}°`),new _n(K,q,`A-${A+1}`)});r("pointer:move",P)},G=H=>{let P=null,D;const A=V=>{P=l.find(q=>{const Y=q.renderer;return(Y==null?void 0:Y.elem)===V.target}),[D]=p(H,m.value,u.value.map(q=>q),g.value)},L=V=>{if(P){const q=P.renderer,Y=q==null?void 0:q.elem;if(!Y)return;const te=Y.getBoundingClientRect();P.vertices[0].x-=te.x-(V instanceof MouseEvent?V.clientX:V.targetTouches[0].clientX)+je.anchorPoint.size/2,P.vertices[0].y-=te.y-(V instanceof MouseEvent?V.clientY:V.targetTouches[0].clientY)+je.anchorPoint.size/2,W(D),H.update()}},U=()=>{P&&r("pointer:up",u.value),P=null},K=o.value;K&&(K.addEventListener("touchstart",A,{passive:!0}),K.addEventListener("touchend",U,{passive:!0}),K.addEventListener("mousedown",A),K.addEventListener("mouseup",U),K.addEventListener("mousemove",L),K.addEventListener("touchmove",L,{passive:!0}))},Q=(H,P)=>{r("remove-custom-template",H,P)};return i.onMounted(()=>{o.value&&(c=new pn({width:o.value.scrollWidth,height:o.value.scrollHeight,fullscreen:!1}).appendTo(o.value),c.scene.scale=d,c.update(),i.watch(()=>n.value,()=>{M()},{deep:!0,immediate:!0}),G(c))}),i.onBeforeUnmount(()=>{c&&(c.clear(),c=null)}),(H,P)=>(i.openBlock(),i.createElementBlock("div",xy,[i.createVNode(vd,{"select-template-index":t.selectTemplateIndex,settings:t.settings,"onTemplate:select":P[0]||(P[0]=D=>r("template:select",D)),onInitDrawTemplate:E,onRemoveCustomTemplate:Q},null,8,["select-template-index","settings"]),i.createElementVNode("div",ky,[i.createElementVNode("div",vy,null,512)])]))}});class Gi extends j.Identity{constructor(n,r){super();S(this,"label","");S(this,"points",[]);S(this,"isCustom",!1);S(this,"id",-1);S(this,"guid","");n?(this.label=n.label,this.points=n.points.map((o,s)=>I.isArray(o)?new _n(o[0],o[1],`A-${s+1}`):new _n(o.width,o.angle,`A-${s+1}`)),this.isCustom=n.isCustom):(this.label="-- Новая конфигурация --",this.points=[new _n(0,0,"A-1")],this.isCustom=!0,this.id=r??this.id)}}class qs extends Gi{constructor(n){super(n);S(this,"isDefault");this.isDefault=n.isDefault??!1}}class Sd{constructor(e){S(this,"minLineWidth");S(this,"maxLineWidth");S(this,"lineWidthStep");S(this,"minLineAngle");S(this,"maxLineAngle");S(this,"lineAngleStep");S(this,"stripMinWidth");S(this,"stripMaxWidth");S(this,"stripMinLength");S(this,"stripMaxLength");S(this,"allowShowTable");S(this,"showOnlyTemplates");S(this,"templates");S(this,"customTemplates",[]);S(this,"startTailConfigs");S(this,"endTailConfigs");S(this,"bendCountForExtended");S(this,"extendedProductCatalog");S(this,"allowChangeFirstPoint");S(this,"allowSaveTemplates");S(this,"userTemplatesPrefix");S(this,"lengthStep");S(this,"canSetDopProdaga");var n,r;this.minLineWidth=e.minLineWidth,this.maxLineWidth=e.maxLineWidth,this.lineWidthStep=e.lineWidthStep,this.minLineAngle=e.minLineAngle,this.maxLineAngle=e.maxLineAngle,this.lineAngleStep=e.lineAngleStep,this.stripMinWidth=e.stripMinWidth,this.stripMaxWidth=e.stripMaxWidth,this.stripMinLength=e.stripMinLength,this.stripMaxLength=e.stripMaxLength,this.allowShowTable=e.allowShowTable,this.showOnlyTemplates=e.showOnlyTemplates,this.templates=e.templates.map(o=>new Gi(o)),this.templates.forEach((o,s)=>{o.id=s}),this.startTailConfigs=((n=e.startTailConfigs)==null?void 0:n.map(o=>new qs(o)))??[],this.endTailConfigs=((r=e.endTailConfigs)==null?void 0:r.map(o=>new qs(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 Gi(s);return a.isCustom=!0,a.id=+o,a}):[],this.customTemplates.some(o=>o.isCustom&&o.isNewRec())||this.customTemplates.push(new Gi({label:"-- Новая конфигурация --",points:[new _n(this.stripMinWidth,0,"A-1")],isCustom:!0,id:-1,guid:""})))}get allTemplates(){return[...this.templates,...this.customTemplates]}addCustomTemplate(e){if(!this.allowSaveTemplates)return;const n=this.customTemplates.findLast(o=>!o.isNewRec()),r=new Gi(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 Sy={class:"flex flex-col gap-3"},By={class:"grid gap-5 md:grid-cols-5"},Ty={},Bd=i.defineComponent({...Ty,__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 Sd(n.settings)),d=i.ref({linesWidths:[...n.cartItem.configuratorParams.linesWidths],linesAngles:[...n.cartItem.configuratorParams.linesAngles]}),u=i.ref({quantity:{},marker:{},length:{}}),f=i.ref(0),m=i.useTemplateRef("kozyrek-configurator-params-form"),g=(w=0)=>{var E;const B=(E=c.value.allTemplates)==null?void 0:E.at(w);B!==void 0&&(f.value=w,l.value.configuratorParams.linesWidths=B.points.map(M=>I.isArray(M)?M[0]:M.width),l.value.configuratorParams.linesAngles=B.points.map(M=>I.isArray(M)?M[1]:M.angle),v()),b(l.value.configuratorParams)},h=async()=>{const w=prompt("Введите название шаблона:");if(!w)return;a.value=!0;const B={label:w,points:l.value.configuratorParams.linesWidths.map((M,R)=>[M,l.value.configuratorParams.linesAngles[R]])},E=M=>{M&&(c.value.addCustomTemplate(B),f.value=c.value.allTemplates.length-2),a.value=!1};n.eventEmitter.emit("configurator:create-template",{category:n.cartItem.category,template:B,callback:E})},p=async(w,B)=>{var R;const E=(R=c.value.allTemplates)==null?void 0:R.at(w);if(!E||!E.isCustom)return;const M=O=>{O&&(c.value.removeCustomTemplate(E.id),g()),B==null||B()};n.eventEmitter.emit("configurator:remove-template",{category:n.cartItem.category,templateId:E.id,callback:M})},y=()=>{c.value.showOnlyTemplates||c.value.allowSaveTemplates&&(f.value=c.value.allTemplates.length-1)},b=async w=>{var B,E;l.value.product=new j.ClientProduct,(E=(B=m.value)==null?void 0:B.formReference)==null||E.validate(M=>{M||(v(),o.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:w,validationFieldResultData:u.value,callback:R=>{R?l.value.product=R:u.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},o.value=!1}}))}).catch(I.noop)},_=async()=>{var w,B;(B=(w=m.value)==null?void 0:w.formReference)==null||B.validate(E=>{var M,R;if(!E){s.value=!0;const O=new j.OrderItemBase(l.value);(M=c.value.startTailConfigs)!=null&&M.length||delete O.configuratorParams.startTailType,(R=c.value.endTailConfigs)!=null&&R.length||delete O.configuratorParams.endTailType,r("submit",O,u.value,()=>{s.value=!1,i.nextTick(()=>{var W,G;(G=(W=m.value)==null?void 0:W.formReference)==null||G.restoreValidation()})})}}).catch(I.noop)},v=()=>{const w={quantity:u.value.quantity,marker:u.value.marker};l.value.configuratorParams.linesWidths.forEach((B,E)=>{w[`lines_widths[${E+1}]`]={},w[`lines_angles[${E+1}]`]={}}),u.value=w},x=w=>{d.value.linesWidths=w.map(B=>B.width),d.value.linesAngles=w.map(B=>B.angle)},N=w=>{l.value.configuratorParams.linesWidths=d.value.linesWidths,l.value.configuratorParams.linesAngles=d.value.linesAngles,v(),y(),b(l.value.configuratorParams)},T=(w,B)=>{d.value.linesWidths=w,d.value.linesAngles=B},k=w=>{const B=l.value.configuratorParams.linesWidths.length>1?c.value.minLineWidth:c.value.stripMinWidth,E=0;l.value.configuratorParams.linesWidths.splice(w+1,0,B),l.value.configuratorParams.linesAngles.splice(w+1,0,E),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],v(),y(),b(l.value.configuratorParams)},$=w=>{l.value.configuratorParams.linesWidths.length<=1||(l.value.configuratorParams.linesWidths.splice(w,1),l.value.configuratorParams.linesAngles.splice(w,1),d.value.linesWidths=[...l.value.configuratorParams.linesWidths],d.value.linesAngles=[...l.value.configuratorParams.linesAngles],v(),y(),b(l.value.configuratorParams))};return i.onBeforeMount(()=>{n.cartItem.isNewRec()?g():(v(),b(l.value.configuratorParams))}),i.watch(()=>n.cartItem,w=>{l.value=new j.OrderItemBase(w),w.isNewRec()?g():(v(),b(l.value.configuratorParams))}),(w,B)=>{const E=z.NButton;return i.openBlock(),i.createElementBlock("div",Sy,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(E,{key:0,type:"tertiary",class:"self-end",onClick:B[0]||(B[0]=M=>r("click:view-switch"))},{default:i.withCtx(()=>[...B[3]||(B[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",By,[i.createVNode(Cd,{value:l.value,"select-template-index":f.value,settings:c.value,class:"h-fit col-span-3","onPointer:up":N,"onPointer:move":x,"onTemplate:select":g,onRemoveCustomTemplate:p},null,8,["value","select-template-index","settings"]),i.createVNode(dl,{ref:"kozyrek-configurator-params-form",value:l.value,"onUpdate:value":B[1]||(B[1]=M=>l.value=M),"preview-params":d.value,validation:u.value,settings:c.value,"is-submit-processing":s.value,"is-product-searching":o.value,"select-template-index":f.value,class:"col-span-2","onUpdate:params":B[2]||(B[2]=M=>b(M)),"onUpdate:preview":T,onSubmit:_,"onClick:saveTemplate":h,"onClick:addLine":k,"onClick:removeLine":$},null,8,["value","preview-params","validation","settings","is-submit-processing","is-product-searching","select-template-index"])])])}}}),Ny={class:"flex flex-col items-center justify-between rounded-xl"},$y={class:"img-preview relative flex justify-center"},Ey={},Ry=i.defineComponent({...Ey,__name:"mosquito-configurator-preview",props:{configuratorParams:{},settings:{}},emits:["open-instructions"],setup(t,{emit:e}){const n=t,r=i.computed(()=>{const{height:s}=n.configuratorParams,a=I.keys(n.settings.crossbarCount).reverse().find(l=>{const c=n.settings.crossbarCount[Number(l)];return s>=c});if(a!==void 0)return String(Number(a)+1)}),o=e;return(s,a)=>{const l=z.NButton;return i.openBlock(),i.createElementBlock("div",Ny,[i.createElementVNode("div",$y,[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})])}}}),Xs=qn(Ry,[["__scopeId","data-v-a67fd61e"]]),Py={key:0,class:"flex items-baseline gap-1"},Fy={key:0,class:"flex items-baseline gap-1"},Vy={key:1},My={class:"text-lg font-semibold"},Iy={key:2,class:"text-red-500 text-sm mb-2"},Ay={class:"flex gap-3"},Oy={},Td=i.defineComponent({...Oy,__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 k;const r=t,o=n,s=i.computed(()=>ht.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(I.cloneDeep(r.value)),f=i.computed(()=>r.settings.widthOverlaps[u.value.configuratorParams.mountType]??0),m=i.computed(()=>r.settings.heightOverlaps[u.value.configuratorParams.mountType]??0),g=i.computed(()=>r.settings.maxWidths[u.value.configuratorParams.netType]),h=i.computed(()=>r.settings.maxHeights[u.value.configuratorParams.netType]),p=i.computed(()=>u.value.configuratorParams.width?u.value.configuratorParams.width+f.value:0),y=i.computed(()=>u.value.configuratorParams.height?u.value.configuratorParams.height+m.value:0),b=i.ref(r.settings.canSetDopProdaga??!1),_=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth-f.value),ae.max(g.value-f.value),ae.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.height":[ae.required,ae.min(r.settings.minHeight-m.value),ae.max(h.value-m.value),ae.step(1),He.serverValidation(r.validation.height.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),v=i.computed(()=>{var R;const $=p.value,w=y.value,{quantity:B}=r.value,E=((R=r.value.product)==null?void 0:R.costRub)||0;if(!$||!w||!B||E===0)return null;const M=$*w/1e6;return(E*B*M).toLocaleString("ru-ru",{minimumFractionDigits:2})}),x=i.computed(()=>{const $=p.value,w=y.value,B=!!($&&$>=r.settings.minWidth&&$<=r.settings.maxWidths[u.value.configuratorParams.netType]),E=!!(w&&w>=r.settings.minHeight&&w<=r.settings.maxHeights[u.value.configuratorParams.netType]),M=!!(r.value.quantity&&r.value.quantity>0);return B&&E&&M}),N=($,w)=>{var M,R;const B=u.value.configuratorParams;$&&$ in B&&(B[$]=w);const E={...B,width:p.value??0,height:y.value??0};$==="width"&&((M=l.value)==null||M.validate().catch(I.noop)),$==="height"&&((R=c.value)==null||R.validate().catch(I.noop)),i.nextTick(()=>{var W,G;!((W=l.value)!=null&&W.validationErrored)&&!((G=c.value)!=null&&G.validationErrored)&&E.height&&E.width&&o("update:params",E),T("configuratorParams",E)})},T=($,w)=>{const B=new j.OrderItemBase(r.value);B[$]=w,$==="configuratorParams"&&(B.product=new j.ClientProduct),o("update:value",B)};return i.watch(()=>r.value,$=>{const w=I.cloneDeep(i.toRaw($)),B=w.configuratorParams.mountType,E=r.settings.widthOverlaps[B]??0,M=r.settings.heightOverlaps[B]??0;w.configuratorParams.width&&w.configuratorParams.width>0&&(w.configuratorParams.width-=E),w.configuratorParams.height&&w.configuratorParams.height>0&&(w.configuratorParams.height-=M),u.value=w},{deep:!0,immediate:!0}),i.onMounted(()=>{var $;($=d.value)==null||$.select()}),e({validate:(k=a.value)==null?void 0:k.validate,formReference:a}),($,w)=>{const B=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":[w[0]||(w[0]=E=>u.value.configuratorParams.netType=E),w[1]||(w[1]=E=>N("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":[w[2]||(w[2]=E=>u.value.configuratorParams.color=E),w[3]||(w[3]=E=>N("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":[w[4]||(w[4]=E=>u.value.configuratorParams.mountType=E),w[5]||(w[5]=E=>N("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-f.value} ${g.value?" до "+(g.value-f.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.width.showFeedback&&p.value>=t.settings.minWidth&&p.value<=t.settings.maxWidths[u.value.configuratorParams.netType]?(i.openBlock(),i.createElementBlock("div",Py,[i.createVNode(i.unref(z.NText),{type:"success"},{default:i.withCtx(()=>[i.createTextVNode("Ширина готового изделия "+i.toDisplayString(p.value),1)]),_:1}),i.createVNode(i.unref(z.NButton),{quaternary:"",type:"info",size:"tiny",onClick:w[10]||(w[10]=E=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...w[25]||(w[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":[w[6]||(w[6]=E=>u.value.configuratorParams.width=E),w[9]||(w[9]=E=>N("width",E))],parse:i.unref(it),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:w[7]||(w[7]=E=>i.unref(tt)(E)),onInput:w[8]||(w[8]=E=>i.unref(et)(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-m.value} ${h.value?" до "+(h.value-m.value):""} мм.`},{feedback:i.withCtx(()=>[!t.validation.height.showFeedback&&y.value>=t.settings.minHeight&&y.value<=t.settings.maxHeights[u.value.configuratorParams.netType]?(i.openBlock(),i.createElementBlock("div",Fy,[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:w[15]||(w[15]=E=>o("click:instructions-toggle"))},{default:i.withCtx(()=>[...w[26]||(w[26]=[i.createElementVNode("span",{class:"text-sm"},"Руководство",-1)])]),_:1})])):i.createCommentVNode("",!0)]),default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:u.value.configuratorParams.height,"onUpdate:value":[w[11]||(w[11]=E=>u.value.configuratorParams.height=E),w[14]||(w[14]=E=>N("height",E))],parse:i.unref(it),"show-button":!1,placeholder:"Введите высоту светового проёма",class:"w-full",onKeydown:w[12]||(w[12]=E=>i.unref(tt)(E)),onInput:w[13]||(w[13]=E=>i.unref(et)(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":[w[16]||(w[16]=E=>u.value.quantity=E),w[19]||(w[19]=E=>T("quantity",E??0))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:w[17]||(w[17]=E=>i.unref(tt)(E,!1)),onInput:w[18]||(w[18]=E=>i.unref(et)(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:w[20]||(w[20]=E=>i.unref(et)(t.validation,"marker")),"onUpdate:value":w[21]||(w[21]=E=>{u.value.marker=E??null,T("marker",E??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),b.value?(i.openBlock(),i.createBlock(B,{key:0,checked:u.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":w[22]||(w[22]=E=>{u.value.isAdditionalSale=E??!1,T("isAdditionalSale",E??!1)})},{default:i.withCtx(()=>[...w[27]||(w[27]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(fr,{"is-product-searching":t.isProductSearching,product:u.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),v.value?(i.openBlock(),i.createElementBlock("div",Vy,[w[28]||(w[28]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",My,i.toDisplayString(v.value)+" ₽",1)])):i.createCommentVNode("",!0),x.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",Iy," Пожалуйста, заполните все обязательные поля корректно. ")),i.createElementVNode("div",Ay,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!x.value||u.value.product.isNewRec(),type:"primary",class:"self-start",onClick:w[23]||(w[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:w[24]||(w[24]=E=>o("click:show-preview-drawer"))},{default:i.withCtx(()=>[...w[29]||(w[29]=[i.createTextVNode(" Предварительный просмотр ",-1)])]),_:1})):i.createCommentVNode("",!0)])]),_:1},8,["model","rules"])),[[i.unref(Wn),()=>o("submit",u.value)]])}}}),zy="/img/configurators/mosquitto/measurement-instructions/measurement-height.png",Dy="/img/configurators/mosquitto/measurement-instructions/measurement-width.png",Ly="/img/configurators/mosquitto/measurement-instructions/mount.png",Hy="/img/configurators/mosquitto/measurement-instructions/mount-z-plastic.png",Wy="/img/configurators/mosquitto/measurement-instructions/mount-z-metal.png",jy={class:"flex flex-col gap-6"},qy={class:"flex gap-4"},Xy={class:"flex flex-col gap-2"},Yy={class:"flex gap-4"},Uy={class:"flex flex-col gap-2"},Ky={class:"flex gap-4"},Gy={class:"flex flex-col gap-2"},Zy={},Nd=i.defineComponent({...Zy,__name:"mosquito-configurator-measurement-instructions",props:{heightOverlaps:{},widthOverlaps:{},show:{type:Boolean}},emits:["update:show"],setup(t,{emit:e}){const n=ht.initRefDependingOnDeviceResolution("small","small","medium"),r=ht.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",jy,[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:zy,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:Dy,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",qy,[l[9]||(l[9]=i.createElementVNode("img",{src:Ly,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Xy,[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",Yy,[l[15]||(l[15]=i.createElementVNode("img",{src:Hy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Uy,[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",Ky,[l[21]||(l[21]=i.createElementVNode("img",{src:Wy,alt:"measurement-height",class:"w-[7.5rem]"},null,-1)),i.createElementVNode("div",Gy,[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"])}}}),Qy={class:"grid md:grid-cols-2"},Jy={},$d=i.defineComponent({...Jy,__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(()=>ht.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),f=i.ref(!1),m=i.computed(()=>i.inject("debounce-input-time",300)),g=I.debounce(async p=>{var y,b;l.value.product=new j.ClientProduct,(b=(y=c.value)==null?void 0:y.formReference)==null||b.validate(_=>{_||(u.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:p,validationFieldResultData:d.value,callback:v=>{v?l.value.product=v:d.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},u.value=!1}}))}).catch(I.noop)},m.value),h=()=>{f.value=!0,r("submit",l.value,d.value,()=>{f.value=!1})};return i.watch(()=>n.cartItem,p=>{l.value=p},{deep:!0}),(p,y)=>{const b=wo;return i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(Nd,{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",Qy,[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(Xs,{"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(Xs,{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(Td,{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":f.value,"onUpdate:params":y[6]||(y[6]=_=>i.unref(g)(_)),onSubmit:y[7]||(y[7]=_=>h()),"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)}}}),e0={},Ed=i.defineComponent({...e0,__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 g;return!((g=c.value)!=null&&g.validationErrored)}),u=g=>{l.value=g,o("update:value",g,r.index,a)},f=g=>{tt(g),(g.key==="Enter"||g.code==="Enter")&&!r.isLastLine&&(g.preventDefault(),g.stopPropagation())},m=()=>{var g;(g=s.value)==null||g.select()};return i.watch(()=>r.value,g=>{l.value=g}),i.onMounted(()=>{r.autoFocus&&i.nextTick(()=>{m()})}),e({isValid:d,formItemReference:c}),(g,h)=>{const p=cl,y=Xr;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(fr,{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(it),placeholder:"Введите ширину",onKeydown:f,onInput:h[0]||(h[0]=b=>i.unref(et)(t.validation,`linesWidths.${t.index}`)),onFocus:i.unref(Le),"onUpdate:value":u},null,8,["value","parse","onFocus"])]),_:1},8,["options"]),i.createVNode(i.unref(z.NButton),{disabled:t.addLineButtonDisabled,size:"medium",class:"ml-2",onClick:h[1]||(h[1]=b=>o("click:add-line",t.index))},{default:i.withCtx(()=>[i.createVNode(p)]),_:1},8,["disabled"]),i.createVNode(i.unref(z.NButton),{disabled:t.removeLineButtonDisabled,size:"medium",class:"ml-2",onClick:h[2]||(h[2]=b=>o("click:remove-line",t.index))},{default:i.withCtx(()=>[i.createVNode(y)]),_:1},8,["disabled"])]),_:1},8,["path","label"])}}}),t0={class:"my-2 flex w-full flex-col"},n0={key:1},i0={class:"text-lg font-semibold"},r0={class:"flex gap-3"},o0={},Rd=i.defineComponent({...o0,__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(I.cloneDeep(r.value)),c=i.computed(()=>{const v={length:[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(r.settings.lengthStep),He.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]};return I.forEach(l.value,(x,N)=>{var T;v[`configuratorParams.linesWidths.${N}`]=[ae.required,ae.min(r.settings.minLineWidth),ae.step(r.settings.lineWidthStep),He.serverValidation((T=r.validation[`linesWidths.${N}`])==null?void 0:T.feedback)]}),v}),d=i.ref(r.settings.canSetDopProdaga??!1),u=i.computed(()=>r.value[0].configuratorParams.linesWidths.reduce((v,x)=>(v??0)+(x??0),0)),f=i.computed(()=>r.settings.width-u.value),m=i.computed(()=>!r.value.some(({product:v})=>!v||v.isNewRec())),g=i.computed(()=>r.isSubmitProcessing||!m.value||f.value<=0||l.value.length>=r.settings.maxLinesCount||r.value.some(v=>v.product.isNewRec())),h=i.computed(()=>v=>f.value===0?void 0:[{label:`${(f.value>0?"Остаток +":"Излишек ")+f.value} мм.`,key:f.value+v}]),p=i.computed(()=>{const{length:v}=r.value[0];return!v||u.value!==r.settings.width?null:(I.reduce(r.value,(N,T)=>{var $;const k=(($=T.product)==null?void 0:$.costRub)||0;return N+k},0)*r.value[0].quantity*v).toLocaleString("ru-ru",{minimumFractionDigits:2})}),y=(v,x,N)=>{var k,$,w;l.value[x].product.id=-1;const{configuratorParams:T}=l.value[x];T.linesWidths[x]=v,b("configuratorParams",T),(w=($=(k=a.value)==null?void 0:k.at(x))==null?void 0:$.formItemReference)==null||w.validate().catch(I.noop),i.nextTick(()=>{var B,E;(E=(B=a.value)==null?void 0:B.at(x))!=null&&E.isValid&&o("update:params",T,x,N)})},b=(v,x)=>{l.value.forEach(N=>{N[v]=x}),o("update:value",l.value)};return i.watch(()=>r.value,v=>{l.value=I.cloneDeep(v)},{deep:!0}),e({validate:(_=s.value)==null?void 0:_.validate,formReference:s}),(v,x)=>{const N=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 T;return[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(k,$)=>{var w,B,E;return i.openBlock(),i.createBlock(Ed,{key:$,ref_for:!0,ref:"line-items-reference",value:((w=k.configuratorParams)==null?void 0:w.linesWidths.at($))??null,"auto-focus":(((B=k.configuratorParams)==null?void 0:B.linesWidths.at($))??0)===0,index:$,path:`configuratorParams.linesWidths.${$}`,product:k.product,settings:t.settings,validation:t.validation,"suggestion-option":h.value(((E=k.configuratorParams)==null?void 0:E.linesWidths.at($))??0),"add-line-button-disabled":f.value<=0||t.value.length>=t.settings.maxLinesCount||t.value.some(M=>M.product.isNewRec()),"remove-line-button-disabled":l.value.length===1,"is-last-line":$===l.value.length-1&&f.value===0,"onUpdate:value":y,"onClick:addLine":x[0]||(x[0]=M=>o("click:add-line",M)),"onClick:removeLine":x[1]||(x[1]=M=>o("click:remove-line",M))},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",t0,[f.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),m.value&&l.value.length===t.settings.maxLinesCount&&f.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:f.value>=0?"Success":"error"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(f.value),1)]),_:1},8,["type"]),i.createTextVNode(" из "+i.toDisplayString(t.settings.width)+" мм ",1)])]),i.createVNode(i.unref(z.NButton),{disabled:g.value,type:"primary",class:"self-center",onClick:x[2]||(x[2]=k=>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]=k=>l.value[0].length=k),x[6]||(x[6]=k=>b("length",k))],parse:i.unref(it),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:x[4]||(x[4]=k=>i.unref(tt)(k,!1)),onInput:x[5]||(x[5]=k=>i.unref(et)(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]=k=>l.value[0].quantity=k),x[10]||(x[10]=k=>b("quantity",k))],"show-button":!1,placeholder:"Введите количество",class:"w-full",onKeydown:x[8]||(x[8]=k=>i.unref(tt)(k,!1)),onInput:x[9]||(x[9]=k=>i.unref(et)(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]=k=>i.unref(et)(t.validation,"marker")),"onUpdate:value":x[12]||(x[12]=k=>{l.value[0].marker=k??null,b("marker",k??null)}),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(N,{key:0,checked:l.value[0].isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":x[13]||(x[13]=k=>{l.value[0].isAdditionalSale=k??!1,b("isAdditionalSale",k??!1)})},{default:i.withCtx(()=>[...x[18]||(x[18]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),p.value?(i.openBlock(),i.createElementBlock("div",n0,[x[19]||(x[19]=i.createTextVNode(" ИТОГО: ",-1)),i.createElementVNode("span",i0,i.toDisplayString(p.value)+" ₽",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",r0,[i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:!m.value||f.value!=0||!((T=l.value[0])!=null&&T.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]=k=>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(Wn),()=>o("submit",l.value)]])}}}),s0={class:"flex grow flex-col"},a0=["src"],l0={class:"w-full"},c0={},Pd=i.defineComponent({...c0,__name:"strip-configurator-preview",props:{value:{},settings:{}},setup(t){return(e,n)=>(i.openBlock(),i.createElementBlock("div",s0,[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,a0),i.createElementVNode("div",l0,[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)])]))}}),d0={class:"flex flex-col gap-2"},u0={class:"w-104 flex grow flex-col px-5"},h0={},Fd=i.defineComponent({...h0,__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 h;return(h=s.value[0].configuratorParams)==null?void 0:h.linesWidths.reduce((p,y)=>(p??0)+(y??0),0)}),u=h=>{h===void 0&&(h=s.value.length-1);const p=s.value.at(0);if(!p)return;p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(h+1,0,null),s.value.forEach(b=>{b.configuratorParams.linesWidths=p.configuratorParams.linesWidths});const y=new j.OrderItemBase({quantity:(p==null?void 0:p.quantity)??1,category:p==null?void 0:p.category,length:(p==null?void 0:p.length)??n.settings.minLength,marker:p==null?void 0:p.marker,configuratorParams:{linesWidths:p==null?void 0:p.configuratorParams.linesWidths}});s.value=s.value.toSpliced(h+1,0,y)},f=h=>{const p=s.value.at(0);p&&(p.configuratorParams.linesWidths=p.configuratorParams.linesWidths.toSpliced(h,1),s.value.forEach(y=>{y.configuratorParams.linesWidths=p.configuratorParams.linesWidths}),s.value=s.value.toSpliced(h,1),delete a[`linesWidths.${h}`],delete a[`linesWidths.${h}`])},m=I.debounce(async(h,p,y)=>{const b={linesWidths:h.linesWidths.at(p)};y.value=!0,a.value[`linesWidths.${p}`]={},s.value[p].product=new j.ClientProduct,n.eventEmitter.emit("configurator:search-product",{category:s.value[p].category,params:b,validationFieldResultData:a.value,callback:_=>{_?(s.value[p].product=_,p===s.value.length-1&&s.value.length<n.settings.maxLinesCount&&d.value&&d.value<n.settings.width&&u()):(s.value[p].product=new j.ClientProduct,a.value[`linesWidths.${p}`]={showFeedback:!0,feedback:"Не удалось найти товар",validationStatus:"error"},y.value=!1),y.value=!1}})},c.value),g=async()=>{var h,p;(p=(h=o.value)==null?void 0:h.formReference)==null||p.validate(y=>{if(!y){l.value=!0;const b=s.value.at(0);if(!b)return;r("submit",b,a.value,()=>{l.value=!1,i.nextTick(()=>{var _,v;(v=(_=o.value)==null?void 0:_.formReference)==null||v.restoreValidation()})})}}).catch(I.noop)};return i.watch(()=>n.cartItems,h=>{s.value=h.map(p=>new j.OrderItemBase(p))}),(h,p)=>{const y=z.NButton;return i.openBlock(),i.createElementBlock("div",d0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(y,{key:0,type:"tertiary",class:"self-center",onClick:p[0]||(p[0]=b=>r("click:view-switch"))},{default:i.withCtx(()=>[...p[3]||(p[3]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",u0,[i.createVNode(Pd,{value:s.value,"onUpdate:value":p[1]||(p[1]=b=>s.value=b),settings:t.settings},null,8,["value","settings"]),i.createVNode(Rd,{ref:"strip-configurator-form",value:s.value,"onUpdate:value":p[2]||(p[2]=b=>s.value=b),validation:a.value,settings:t.settings,"is-submit-processing":l.value,"onUpdate:params":i.unref(m),onSubmit:g,"onClick:addLine":u,"onClick:removeLine":f},null,8,["value","validation","settings","is-submit-processing","onUpdate:params"])])])}}}),f0={class:"flex flex-col gap-3"},m0={},Vd=i.defineComponent({...m0,__name:"metal-for-doors-configurator-form",props:{value:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0}},emits:["update:value","update:params","submit"],setup(t,{expose:e,emit:n}){var g;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("first-input-element"),l=i.ref(I.cloneDeep(r.value)),c=i.computed(()=>({"configuratorParams.width":[ae.required,ae.min(r.settings.minWidth),...r.settings.maxWidth?[ae.max(r.settings.maxWidth)]:[],ae.step(1),He.serverValidation(r.validation.width.feedback)],"configuratorParams.length":[ae.required,ae.min(r.settings.minLength),ae.max(r.settings.maxLength),ae.step(1),He.serverValidation(r.validation.length.feedback)],quantity:[ae.required,ae.min(1),ae.step(1),He.serverValidation(r.validation.quantity.feedback)],marker:[He.serverValidation(r.validation.marker.feedback)]})),d=i.ref(r.settings.canSetDopProdaga??!1),u=()=>{o("update:params",l.value.configuratorParams),f("configuratorParams",l.value.configuratorParams)},f=(h,p)=>{const y=new j.OrderItemBase(r.value);y[h]=p,h==="configuratorParams"&&(y.product=new j.ClientProduct),o("update:value",y)},m=()=>{var h;(h=a.value)==null||h.select()};return i.watch(()=>r.value,h=>{l.value=I.cloneDeep(h)},{deep:!0}),i.onMounted(()=>{r.value.isNewRec()&&i.nextTick(()=>{m()})}),e({validate:(g=s.value)==null?void 0:g.validate,formReference:s}),(h,p)=>{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":[p[0]||(p[0]=b=>l.value.configuratorParams.width=b),u],class:"w-full",parse:i.unref(it),"show-button":!1,placeholder:"Введите ширину",onKeydown:p[1]||(p[1]=b=>i.unref(tt)(b)),onInput:p[2]||(p[2]=b=>i.unref(et)(t.validation,"width")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(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":[p[3]||(p[3]=b=>l.value.configuratorParams.length=b),u],placeholder:"Введите длину",parse:i.unref(it),"show-button":!1,class:"w-full",onKeydown:p[4]||(p[4]=b=>i.unref(tt)(b)),onInput:p[5]||(p[5]=b=>i.unref(et)(t.validation,"length")),onFocus:i.unref(Le)},null,8,["value","parse","onFocus"])]),_:1},8,["label"]),i.createVNode(i.unref(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:p[6]||(p[6]=b=>i.unref(tt)(b,!1)),onInput:p[7]||(p[7]=b=>i.unref(et)(t.validation,"quantity")),"onUpdate:value":p[8]||(p[8]=b=>f("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:p[9]||(p[9]=b=>i.unref(et)(t.validation,"marker")),"onUpdate:value":p[10]||(p[10]=b=>f("marker",b??null)),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1}),d.value?(i.openBlock(),i.createBlock(y,{key:0,checked:l.value.isAdditionalSale??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":p[11]||(p[11]=b=>{l.value.isAdditionalSale=b??!1,f("isAdditionalSale",b??!1)})},{default:i.withCtx(()=>[...p[13]||(p[13]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createVNode(fr,{"is-product-searching":t.isProductSearching,product:t.value.product,validation:t.validation.product},null,8,["is-product-searching","product","validation"]),i.createElementVNode("div",f0,[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:p[12]||(p[12]=b=>o("submit",t.value))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(t.value.isNewRec()?"В корзину":"Изменить"),1)]),_:1},8,["disabled"])])]),_:1},8,["model","rules","disabled"])),[[i.unref(Wn),()=>o("submit",l.value)]])}}}),g0={class:"flex flex-col gap-2 w-72"},p0={},Md=i.defineComponent({...p0,__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=I.debounce(async m=>{var g,h;s.value.product=new j.ClientProduct,(h=(g=o.value)==null?void 0:g.formReference)==null||h.validate(p=>{p||(l.value=!0,n.eventEmitter.emit("configurator:search-product",{category:n.cartItem.category,params:m,validationFieldResultData:a.value,callback:y=>{y?s.value.product=y:a.value.product={showFeedback:!0,feedback:"Не удалось найти товар по указанным параметрам.",validationStatus:"error"},l.value=!1}}))}).catch(I.noop)},d.value),f=async()=>{var m,g;(g=(m=o.value)==null?void 0:m.formReference)==null||g.validate(h=>{h||(c.value=!0,r("submit",s.value,a.value,()=>{c.value=!1,i.nextTick(()=>{var p,y;(y=(p=o.value)==null?void 0:p.formReference)==null||y.restoreValidation()})}))}).catch(I.noop)};return i.watch(()=>n.cartItem,m=>{s.value=new j.OrderItemBase(m)},{deep:!0}),(m,g)=>{const h=z.NButton;return i.openBlock(),i.createElementBlock("div",g0,[t.settings.allowShowTable?(i.openBlock(),i.createBlock(h,{key:0,type:"tertiary",class:"self-center",onClick:g[0]||(g[0]=p=>r("click:view-switch"))},{default:i.withCtx(()=>[...g[4]||(g[4]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Vd,{ref:"metal-for-doors-configurator-form",value:s.value,"onUpdate:value":g[1]||(g[1]=p=>s.value=p),validation:a.value,settings:t.settings,"is-submit-processing":c.value,"is-product-searching":l.value,"onUpdate:params":g[2]||(g[2]=p=>i.unref(u)(p)),onSubmit:g[3]||(g[3]=p=>f())},null,8,["value","validation","settings","is-submit-processing","is-product-searching"])])}}}),y0={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function b0(t,e){return i.openBlock(),i.createElementBlock("svg",y0,[...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 Id=i.markRaw({name:"ion-add",render:b0}),_0={key:0,class:"-mt-1 text-sm text-gray-500"},w0={class:"font-bold"},x0={class:"flex flex-col gap-3"},k0={key:0,class:"mt-4 flex flex-col gap-1.5"},v0={class:"flex flex-col gap-1 text-sm text-gray-700"},C0={key:0},S0={key:1},B0={"form-array-name":"items",class:"flex flex-col gap-3"},T0={class:"grid grow grid-cols-1 items-start gap-2 sm:grid-cols-3"},N0={key:0,class:"flex flex-wrap items-end gap-2"},$0={class:"whitespace-nowrap text-xl font-bold"},E0={key:0,class:"whitespace-nowrap text-lg text-gray-500"},R0={class:"font-bold"},P0={class:"font-bold"},F0={class:"flex gap-3"},V0={},Ad=i.defineComponent({...V0,__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(I.cloneDeep(r.value)),l=i.ref({...r.validation}),c=D=>{var A;delete l.value[D],(A=s.value)==null||A.restoreValidation()};i.watch(()=>r.validation,D=>{l.value={...D},Object.values(D).some(L=>L==null?void 0:L.feedback)&&i.nextTick(()=>{var L;return(L=s.value)==null?void 0:L.validate(I.noop).catch(I.noop)})},{deep:!0});const d=i.computed(()=>r.value.category),u=i.ref(null),f=i.ref(null),m=i.computed(()=>d.value.products??[]),g=i.computed(()=>m.value.map(D=>({label:D.name,value:D.id}))),h=(D,A,L)=>{const U=D!=null&&D>0,K=A!=null&&A>0;return!U&&!K?null:U&&K?`от ${D} ${L} до ${A} ${L}`:U?`от ${D} ${L}`:`до ${A} ${L}`},p=i.computed(()=>{var D,A;return h(r.settings.minWidth,(A=(D=u.value)==null?void 0:D.properties)==null?void 0:A.width,"мм")}),y=i.computed(()=>{var D,A;return h(r.settings.minLength,(A=(D=u.value)==null?void 0:D.properties)==null?void 0:A.length,"мм")}),b=i.ref(null),_=i.ref(!1);i.computed(()=>{var D,A;return(A=(D=u.value)==null?void 0:D.properties)!=null&&A.width?ae.max(u.value.properties.width):null}),i.computed(()=>{var D,A;return(A=(D=u.value)==null?void 0:D.properties)!=null&&A.length?ae.max(u.value.properties.length):null});const v=i.computed(()=>{var A;const D={marker:[He.serverValidation((A=l.value.marker)==null?void 0:A.feedback)]};return a.value.configuratorParams.items.forEach((L,U)=>{var K,V,q,Y,te,ue,ve;D[`configuratorParams.items.${U}.width`]=[ae.required,ae.min(r.settings.minWidth),...(V=(K=u.value)==null?void 0:K.properties)!=null&&V.width?[ae.max(u.value.properties.width)]:[],ae.step(1),He.serverValidation((q=l.value[`items.${U}.width`])==null?void 0:q.feedback)],D[`configuratorParams.items.${U}.length`]=[ae.required,ae.min(r.settings.minLength),...(te=(Y=u.value)==null?void 0:Y.properties)!=null&&te.length?[ae.max(u.value.properties.length)]:[],ae.step(1),He.serverValidation((ue=l.value[`items.${U}.length`])==null?void 0:ue.feedback)],D[`configuratorParams.items.${U}.count`]=[ae.required,ae.min(1),ae.step(1),He.serverValidation((ve=l.value[`items.${U}.count`])==null?void 0:ve.feedback)]}),D}),x=i.ref(r.settings.canSetDopProdaga??!1),N=i.computed(()=>a.value.configuratorParams.items.some(D=>{var A,L;return!u.value||!D.width||D.width<r.settings.minWidth||D.width>(((A=u.value.properties)==null?void 0:A.width)??0)||D.length===0||D.length<r.settings.minLength||D.length>(((L=u.value.properties)==null?void 0:L.length)??0)||!D.count||D.count<1})),T=i.computed(()=>!u.value||N.value||a.value.configuratorParams.items.length===0),k=i.ref(null),$=D=>{if(!D){u.value=null,f.value=null,a.value.product=new j.ClientProduct,b.value=null;return}const A=m.value.find(L=>L.id===D);A&&(u.value=A,f.value=D,a.value.product=A,Q("product",a.value.product),a.value.configuratorParams.items.forEach(L=>{var U,K;(U=A.properties)!=null&&U.width&&L.width>A.properties.width&&(L.width=A.properties.width),(K=A.properties)!=null&&K.length&&L.length>A.properties.length&&(L.length=A.properties.length)}),B())};let w=!1;const B=()=>{w=!0,b.value=null,k.value=null,a.value.configuratorParams.calculationId="",a.value.quantity=0},E=async()=>{var D;if(!u.value||a.value.configuratorParams.items.length===0||N.value){B();return}(D=s.value)==null||D.validate(A=>{if(A){B();return}if(_.value=!0,!u.value||!d.value){B(),_.value=!1;return}r.eventEmitter.emit("configurator:calculate",{category:d.value,params:{productId:u.value.id,items:a.value.configuratorParams.items},callback:L=>{L?(b.value=L,a.value.configuratorParams.calculationId=L.id,a.value.quantity=L.quantity,i.nextTick(()=>{Q("quantity",L.quantity)})):(a.value.configuratorParams.calculationId="",a.value.quantity=0,B()),Q("configuratorParams",a.value.configuratorParams),M(),_.value=!1}})}).catch(()=>{B(),_.value=!1})},M=()=>{var A;if(!((A=u.value)!=null&&A.costRub)||!b.value){k.value=null;return}const D=b.value.quantity*u.value.costRub;k.value=Math.round(D*100)/100},R=D=>{var L,U;const A=a.value.configuratorParams.items[D];u.value&&((L=u.value.properties)!=null&&L.width&&A.width>u.value.properties.width&&(A.width=u.value.properties.width),(U=u.value.properties)!=null&&U.length&&A.length>u.value.properties.length&&(A.length=u.value.properties.length)),Q("configuratorParams",a.value.configuratorParams),B()},O=()=>{a.value.configuratorParams.calculationId="",a.value.configuratorParams.items.push({width:0,length:0,count:1}),Q("configuratorParams",a.value.configuratorParams),B(),o("add-item",a.value.configuratorParams.items.length)},W=D=>{a.value.configuratorParams.items.splice(D,1),Q("configuratorParams",a.value.configuratorParams),B(),o("remove-item",D)},G=()=>{if(!(T.value||_.value||r.isSubmitProcessing)){if(!b.value){E();return}o("submit",a.value)}},Q=(D,A)=>{const L=new j.OrderItemBase(r.value);L[D]=A,o("update:value",L)};i.watch(()=>r.value,D=>{const A=I.cloneDeep(i.toRaw(D));(!A.configuratorParams.items||A.configuratorParams.items.length===0)&&(A.configuratorParams.items=[{width:0,length:0,count:1}]),a.value=A,r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),r.value.product.isNewRec()&&(u.value=null,f.value=null),w?w=!1:H()},{deep:!0});const H=()=>{const{calculationId:D}=a.value.configuratorParams,A=a.value.quantity??0;D&&A>0&&a.value.product&&!a.value.product.isNewRec()&&(b.value={id:D,quantity:A,sheets:[]},M())};return i.onMounted(()=>{r.value.product&&!r.value.product.isNewRec()&&(u.value=r.value.product,f.value=r.value.product.id),H()}),e({validate:(P=s.value)==null?void 0:P.validate,formReference:s}),(D,A)=>{const L=Xr,U=Id;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:a.value,rules:v.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>{var K;return[i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:f.value,"onUpdate:value":[A[0]||(A[0]=V=>f.value=V),$],options:g.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((K=u.value)==null?void 0:K.costRub)!=null?(i.openBlock(),i.createElementBlock("div",_0,[i.createElementVNode("span",w0,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",x0,[u.value?(i.openBlock(),i.createElementBlock("div",k0,[A[7]||(A[7]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",v0,[p.value?(i.openBlock(),i.createElementBlock("div",C0,"Ширина "+i.toDisplayString(p.value)+".",1)):i.createCommentVNode("",!0),y.value?(i.openBlock(),i.createElementBlock("div",S0,"Длина "+i.toDisplayString(y.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",B0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value.configuratorParams.items,(V,q)=>(i.openBlock(),i.createElementBlock("div",{key:q,class:"flex grow gap-2"},[i.createElementVNode("div",T0,[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":[Y=>a.value.configuratorParams.items[q].width=Y,Y=>R(q)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Ширина",class:"w-full",onKeydown:A[1]||(A[1]=Y=>i.unref(tt)(Y)),onInput:Y=>c(`items.${q}.width`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(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":[Y=>a.value.configuratorParams.items[q].length=Y,Y=>R(q)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Длина",class:"w-full",onKeydown:A[2]||(A[2]=Y=>i.unref(tt)(Y)),onInput:Y=>c(`items.${q}.length`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"]),i.createVNode(i.unref(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":[Y=>a.value.configuratorParams.items[q].count=Y,Y=>R(q)],parse:i.unref(it),"show-button":!1,disabled:!u.value,placeholder:"Количество",class:"w-full",onKeydown:A[3]||(A[3]=Y=>i.unref(tt)(Y,!1)),onInput:Y=>c(`items.${q}.count`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),i.createVNode(i.unref(z.NButton),{disabled:!u.value||a.value.configuratorParams.items.length<=1,type:"error",size:"medium",class:"mt-5",onClick:Y=>W(q)},{default:i.withCtx(()=>[i.createVNode(L)]),_:1},8,["disabled","onClick"])]))),128))]),u.value?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:1,disabled:N.value,type:"default",class:"self-center",onClick:O},{default:i.withCtx(()=>[i.createVNode(U),A[8]||(A[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:A[4]||(A[4]=V=>c("marker")),"onUpdate:value":A[5]||(A[5]=V=>Q("marker",V??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":A[6]||(A[6]=V=>{a.value.isAdditionalSale=V??!1,Q("isAdditionalSale",V??!1)})},{default:i.withCtx(()=>[...A[9]||(A[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 V;return[b.value&&u.value&&k.value?(i.openBlock(),i.createElementBlock("div",N0,[i.createElementVNode("div",null,[A[10]||(A[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",$0,i.toDisplayString(k.value.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol),1)]),b.value.quantity&&u.value?(i.openBlock(),i.createElementBlock("div",E0,[i.createElementVNode("span",R0,"("+i.toDisplayString(b.value.quantity)+" шт.",1),A[11]||(A[11]=i.createTextVNode(" x ",-1)),i.createElementVNode("span",P0,i.toDisplayString((V=u.value.costRub)==null?void 0:V.toLocaleString())+" "+i.toDisplayString(u.value.currency.symbol)+"/шт.)",1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]}),_:1},8,["show"]),i.createElementVNode("div",F0,[b.value&&!_.value?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,loading:t.isSubmitProcessing,disabled:T.value||_.value,type:"primary",class:"self-start",onClick:G},{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:T.value||_.value,type:"info",class:"self-start",onClick:E},{default:i.withCtx(()=>[...A[12]||(A[12]=[i.createTextVNode(" Рассчитать ",-1)])]),_:1},8,["loading","disabled"]))])]}),_:1},8,["model","rules"])),[[i.unref(Wn),G]])}}}),M0={class:"flex flex-col gap-2"},I0={class:"w-104 flex grow flex-col px-5"},A0={},Od=i.defineComponent({...A0,__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 f,m;(m=(f=o.value)==null?void 0:f.formReference)==null||m.validate(g=>{if(!g){l.value=!0;const h=I.cloneDeep(s.value);"items"in h.configuratorParams&&delete h.configuratorParams.items,r("submit",h,a.value,()=>{l.value=!1,i.nextTick(()=>{var p,y;(y=(p=o.value)==null?void 0:p.formReference)==null||y.restoreValidation()})})}}).catch(I.noop)},d=f=>{a.value[`items.${f}.width`]={},a.value[`items.${f}.length`]={},a.value[`items.${f}.count`]={}},u=f=>{delete a.value[`items.${f}.width`],delete a.value[`items.${f}.length`],delete a.value[`items.${f}.count`]};return i.onMounted(()=>{n.cartItem.configuratorParams.items.forEach((f,m)=>{a.value[`items.${m}.width`]={},a.value[`items.${m}.length`]={},a.value[`items.${m}.count`]={}})}),i.watch(()=>n.cartItem,f=>{s.value=new j.OrderItemBase(f)},{deep:!0}),(f,m)=>{const g=z.NButton;return i.openBlock(),i.createElementBlock("div",M0,[t.settings.allowShowTable&&s.value.isNewRec()?(i.openBlock(),i.createBlock(g,{key:0,type:"tertiary",class:"self-center",onClick:m[0]||(m[0]=h=>r("click:view-switch"))},{default:i.withCtx(()=>[...m[2]||(m[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",I0,[i.createVNode(Ad,{ref:"sandwich-configurator-form",value:s.value,"onUpdate:value":m[1]||(m[1]=h=>s.value=h),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"])])])}}}),O0={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function z0(t,e){return i.openBlock(),i.createElementBlock("svg",O0,[...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 D0=i.markRaw({name:"ion-checkmark",render:z0}),L0={key:0,class:"-mt-1 text-sm text-gray-500"},H0={class:"font-bold"},W0={class:"flex flex-col gap-3"},j0={key:0,class:"mt-4 mb-3 flex flex-col gap-1.5"},q0={class:"flex flex-col gap-1 text-sm text-gray-700"},X0={key:0},Y0={key:1},U0={"form-array-name":"items",class:"flex flex-col gap-3"},K0={class:"min-w-0 flex-1"},G0={class:"relative flex flex-col gap-3 lg:!flex-row lg:!items-start lg:!gap-6"},Z0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!flex-[2]"},Q0={class:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:!grid-cols-[1fr_2fr] lg:!flex-[3]"},J0={key:0,class:"pointer-events-none absolute bottom-2 right-3 flex h-8 w-8 items-center justify-center"},eb={class:"mt-1 flex flex-col gap-y-1 text-sm text-gray-500 lg:!flex-row lg:!gap-6"},tb={key:0,class:"lg:!flex-[2]"},nb={class:"font-bold"},ib={key:1,class:"lg:!flex-[3]"},rb={class:"font-bold"},ob={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"},sb={key:0},ab={class:"font-bold"},lb={key:1},cb={class:"font-bold"},db={class:"flex flex-wrap items-center gap-3"},ub={},zd=i.defineComponent({...ub,__name:"sandwich-m2-configurator-form",props:{value:{},eventEmitter:{},showSlugs:{type:Boolean},showProperties:{type:Boolean},showProductCosts:{type:[Boolean,Function]},allowNameClick:{type:[Boolean,Function]},allowPriceClick:{type:[Boolean,Function]},showPriceHistory:{type:[Boolean,Function]},showCostDate:{type:[Boolean,Function]},isProductItemSelected:{},showProductAddToCartButton:{type:[Boolean,String,Function]},showProductRequiredButton:{type:[Boolean,String,Function]},showProductEditButton:{type:[Boolean,String,Function]},currencyRates:{},productContextButtonsConfig:{},settings:{},isProductSearching:{type:Boolean,default:!1},isSubmitProcessing:{type:Boolean,default:!1},validation:{default:void 0},itemStates:{default:()=>[]}},emits:["submit","update:value","add-item","remove-item","item-reset"],setup(t,{expose:e,emit:n}){var K;const r=t,o=n,s=i.useTemplateRef("form-reference"),a=i.useTemplateRef("widthInputs"),l=r.value==null?[]:I.cloneDeep(i.toRaw(r.value)),c=i.ref(l.map(V=>new j.OrderItemBase(V))),d=i.computed(()=>({items:c.value})),u=i.ref({...r.validation}),f=V=>{var q;delete u.value[V],(q=s.value)==null||q.restoreValidation()},m=i.ref(null),g=i.ref(null),h=i.computed(()=>{var V,q;return((q=(V=c.value[0])==null?void 0:V.category)==null?void 0:q.products)??[]}),p=i.computed(()=>h.value.map(V=>({label:V.name,value:V.id}))),y=(V,q,Y)=>{const te=V!=null&&V>0,ue=q!=null&&q>0;return!te&&!ue?null:te&&ue?`от ${V} ${Y} до ${q} ${Y}`:te?`от ${V} ${Y}`:`до ${q} ${Y}`},b=i.computed(()=>{var V,q;return y(r.settings.minWidth,(q=(V=m.value)==null?void 0:V.properties)==null?void 0:q.width,"мм")}),_=i.computed(()=>{var V,q;return y(r.settings.minLength,(q=(V=m.value)==null?void 0:V.properties)==null?void 0:q.length,"мм")}),v=i.computed(()=>{const V={};return c.value.forEach((q,Y)=>{var te,ue,ve,Te,We,ce,gt,Ne;V[`items.${Y}.configuratorParams.width`]=[ae.required,ae.min(r.settings.minWidth),...(ue=(te=m.value)==null?void 0:te.properties)!=null&&ue.width?[ae.max(m.value.properties.width)]:[],ae.step(1),He.serverValidation((ve=u.value[`items.${Y}.width`])==null?void 0:ve.feedback)],V[`items.${Y}.configuratorParams.length`]=[ae.required,ae.min(r.settings.minLength),...(We=(Te=m.value)==null?void 0:Te.properties)!=null&&We.length?[ae.max(m.value.properties.length)]:[],ae.step(1),He.serverValidation((ce=u.value[`items.${Y}.length`])==null?void 0:ce.feedback)],V[`items.${Y}.quantity`]=[ae.required,ae.min(1),ae.step(1),He.serverValidation((gt=u.value[`items.${Y}.quantity`])==null?void 0:gt.feedback)],V[`items.${Y}.marker`]=[He.serverValidation((Ne=u.value[`items.${Y}.marker`])==null?void 0:Ne.feedback)]}),V});i.watch(()=>r.validation,V=>{u.value={...V},Object.values(V).some(Y=>Y==null?void 0:Y.feedback)&&i.nextTick(()=>{var Y;return(Y=s.value)==null?void 0:Y.validate(I.noop).catch(I.noop)})},{deep:!0});const x=i.ref(r.settings.canSetDopProdaga??!1),N=i.computed(()=>{const V=m.value;return V?c.value.some(q=>{var ve,Te;const Y=q.configuratorParams,te=(ve=V.properties)==null?void 0:ve.width,ue=(Te=V.properties)==null?void 0:Te.length;return Y.width===0||Y.width<r.settings.minWidth||te!=null&&Y.width>te||Y.length===0||Y.length<r.settings.minLength||ue!=null&&Y.length>ue||q.quantity===0||q.quantity<1}):!0}),T=i.computed(()=>!m.value||N.value||c.value.length===0),k=i.computed(()=>{const V=c.value[0];return V!=null&&!V.isNewRec()}),$=V=>r.itemStates[V]??"idle",w=V=>$(V)==="success",B=V=>$(V)==="loading",E=i.computed(()=>c.value.length===0?!0:c.value.every((V,q)=>{const Y=$(q);return Y==="success"||Y==="loading"})),M=V=>V.width===0||V.length===0?0:V.width*V.length/1e6,R=V=>{var ve;const q=V.configuratorParams,Y=M(q),te=((ve=m.value)==null?void 0:ve.costRub)??0,ue=V.quantity??0;return!Y||!ue?0:Math.round(Y*te*ue*100)/100},O=i.computed(()=>I.sum(c.value.map(V=>{const q=V.configuratorParams;return!q.width||q.length===0||!V.quantity?0:q.width*q.length*V.quantity/1e6}))),W=i.computed(()=>Math.round(I.sum(c.value.map(V=>R(V)))*100)/100),G=()=>{var V,q,Y;return new j.OrderItemBase({category:(V=c.value[0])==null?void 0:V.category,configurator:(q=c.value[0])==null?void 0:q.configurator,product:m.value??new j.ClientProduct,quantity:1,isAdditionalSale:(Y=c.value[0])==null?void 0:Y.isAdditionalSale,configuratorParams:{width:0,length:0}})},Q=V=>{if(!V){m.value=null,g.value=null,c.value.forEach(Y=>{Y.product=new j.ClientProduct}),o("update:value",c.value);return}const q=h.value.find(Y=>Y.id===V);q&&(m.value=q,g.value=V,c.value.forEach((Y,te)=>{var ue,ve;Y.product=q,(ue=q.properties)!=null&&ue.width&&Y.configuratorParams.width>q.properties.width&&(Y.configuratorParams.width=q.properties.width),(ve=q.properties)!=null&&ve.length&&Y.configuratorParams.length>q.properties.length&&(Y.configuratorParams.length=q.properties.length),o("item-reset",te)}),o("update:value",c.value))},H=V=>{var te,ue;const q=c.value[V],Y=m.value;Y&&((te=Y.properties)!=null&&te.width&&q.configuratorParams.width>Y.properties.width&&(q.configuratorParams.width=Y.properties.width),(ue=Y.properties)!=null&&ue.length&&q.configuratorParams.length>Y.properties.length&&(q.configuratorParams.length=Y.properties.length)),o("item-reset",V),o("update:value",c.value)},P=(V,q)=>{c.value[V].marker=q===null||q===""?void 0:q,o("item-reset",V),o("update:value",c.value)},D=V=>{c.value.forEach(q=>{q.isAdditionalSale=V}),o("update:value",c.value)},A=()=>{c.value.push(G()),o("update:value",c.value),o("add-item",c.value.length),i.nextTick(()=>{var q,Y,te,ue;const V=c.value.length-1;(Y=(q=a.value)==null?void 0:q[V])==null||Y.focus(),(ue=(te=a.value)==null?void 0:te[V])==null||ue.select()})},L=V=>{c.value.splice(V,1),o("update:value",c.value),o("remove-item",V)};i.watch(()=>r.value,V=>{var ue;const Y=(V==null?[]:I.cloneDeep(i.toRaw(V))).map(ve=>new j.OrderItemBase(ve));c.value=Y.length>0?Y:[G()];const te=(ue=c.value[0])==null?void 0:ue.product;te&&!te.isNewRec()?(m.value=te,g.value=te.id):(m.value=null,g.value=null)},{deep:!0});const U=()=>{var q;if(m.value!==null)return;const V=(q=h.value[0])==null?void 0:q.id;V!=null&&Q(V)};return i.watch(h,()=>{U()}),i.onMounted(()=>{var q;c.value.length===0&&(c.value=[G()]);const V=(q=c.value[0])==null?void 0:q.product;V&&!V.isNewRec()&&(m.value=V,g.value=V.id),U()}),e({validate:(K=s.value)==null?void 0:K.validate,formReference:s}),(V,q)=>{const Y=D0,te=Xr,ue=Id;return i.withDirectives((i.openBlock(),i.createBlock(i.unref(z.NForm),{ref:"form-reference",model:d.value,rules:v.value,class:"flex flex-col gap-2 sc-hide-empty-feedback-message"},{default:i.withCtx(()=>{var ve,Te;return[i.createVNode(i.unref(z.NFormItem),{required:!0,"show-feedback":!1,label:"Товар"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NSelect),{value:g.value,"onUpdate:value":[q[0]||(q[0]=We=>g.value=We),Q],options:p.value,placeholder:"Выберите материал",filterable:""},null,8,["value","options"])]),_:1}),((ve=m.value)==null?void 0:ve.costRub)!=null?(i.openBlock(),i.createElementBlock("div",L0,[i.createElementVNode("span",H0,i.toDisplayString(m.value.code),1),i.createTextVNode(" — "+i.toDisplayString(m.value.costRub.toLocaleString())+" "+i.toDisplayString(m.value.currency.symbol)+"/м² ",1)])):i.createCommentVNode("",!0),i.createElementVNode("div",W0,[m.value?(i.openBlock(),i.createElementBlock("div",j0,[q[6]||(q[6]=i.createElementVNode("div",{class:"w-full font-bold"},"Размеры изделий",-1)),i.createElementVNode("div",q0,[b.value?(i.openBlock(),i.createElementBlock("div",X0,"Ширина "+i.toDisplayString(b.value)+".",1)):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createElementBlock("div",Y0,"Длина "+i.toDisplayString(_.value)+".",1)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0),i.createElementVNode("div",U0,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value.items,(We,ce)=>{var gt;return i.openBlock(),i.createElementBlock("div",{key:ce,class:i.normalizeClass(["flex min-w-0 items-start gap-2 border-b border-gray-100 last:border-0",w(ce)?"opacity-70":""])},[i.createElementVNode("div",K0,[i.createElementVNode("div",G0,[i.createElementVNode("div",Z0,[i.createVNode(i.unref(z.NFormItem),{path:`items.${ce}.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[ce].configuratorParams.width,"onUpdate:value":[Ne=>d.value.items[ce].configuratorParams.width=Ne,Ne=>H(ce)],parse:i.unref(it),"show-button":!1,disabled:!m.value||w(ce)||B(ce),placeholder:"Ширина",class:"w-full",onKeydown:q[1]||(q[1]=Ne=>i.unref(tt)(Ne)),onInput:Ne=>f(`items.${ce}.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.${ce}.configuratorParams.length`,label:"Длина, мм",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:d.value.items[ce].configuratorParams.length,"onUpdate:value":[Ne=>d.value.items[ce].configuratorParams.length=Ne,Ne=>H(ce)],parse:i.unref(it),"show-button":!1,disabled:!m.value||w(ce)||B(ce),placeholder:"Длина",class:"w-full",onKeydown:q[2]||(q[2]=Ne=>i.unref(tt)(Ne)),onInput:Ne=>f(`items.${ce}.length`),onFocus:i.unref(Le)},null,8,["value","onUpdate:value","parse","disabled","onInput","onFocus"])]),_:2},1032,["path"])]),i.createElementVNode("div",Q0,[i.createVNode(i.unref(z.NFormItem),{path:`items.${ce}.quantity`,label:"Количество, шт",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:d.value.items[ce].quantity,"onUpdate:value":[Ne=>d.value.items[ce].quantity=Ne,Ne=>H(ce)],parse:i.unref(it),"show-button":!1,disabled:!m.value||w(ce)||B(ce),placeholder:"Кол-во",class:"w-full",onKeydown:q[3]||(q[3]=Ne=>i.unref(tt)(Ne,!1)),onInput:Ne=>f(`items.${ce}.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.${ce}.marker`,label:"Маркировка",class:"min-w-0"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:d.value.items[ce].marker??null,disabled:!m.value||w(ce)||B(ce),placeholder:"Маркировка",class:"w-full",onInput:Ne=>f(`items.${ce}.marker`),"onUpdate:value":Ne=>P(ce,Ne??null),onFocus:i.unref(Le)},null,8,["value","disabled","onInput","onUpdate:value","onFocus"])]),_:2},1032,["path"])]),B(ce)||w(ce)?(i.openBlock(),i.createElementBlock("div",J0,[B(ce)?(i.openBlock(),i.createBlock(i.unref(z.NSpin),{key:0,size:14})):w(ce)?(i.openBlock(),i.createBlock(Y,{key:1,class:"text-green-600 text-xl"})):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),i.createElementVNode("div",eb,[We.configuratorParams.width>0&&We.configuratorParams.length>0?(i.openBlock(),i.createElementBlock("div",tb,[q[7]||(q[7]=i.createTextVNode(" Площадь (S) = ",-1)),i.createElementVNode("span",nb,i.toDisplayString(M(We.configuratorParams).toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),R(We)>0?(i.openBlock(),i.createElementBlock("div",ib,[q[8]||(q[8]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",rb,i.toDisplayString(R(We).toLocaleString())+" "+i.toDisplayString((gt=m.value)==null?void 0:gt.currency.symbol),1)])):i.createCommentVNode("",!0)])]),k.value?i.createCommentVNode("",!0):(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,disabled:B(ce)||d.value.items.length<=1,type:"error",size:"medium",class:"mt-5 shrink-0 lg:!ml-4",onClick:Ne=>L(ce)},{default:i.withCtx(()=>[i.createVNode(te)]),_:1},8,["disabled","onClick"]))],2)}),128))]),m.value?(i.openBlock(),i.createElementBlock("div",ob,[O.value>0?(i.openBlock(),i.createElementBlock("div",sb,[q[9]||(q[9]=i.createTextVNode(" Общая площадь: ",-1)),i.createElementVNode("span",ab,i.toDisplayString(O.value.toLocaleString(void 0,{maximumFractionDigits:4}))+" м²",1)])):i.createCommentVNode("",!0),W.value>0?(i.openBlock(),i.createElementBlock("div",lb,[q[10]||(q[10]=i.createTextVNode(" Итого: ",-1)),i.createElementVNode("span",cb,i.toDisplayString(W.value.toLocaleString())+" "+i.toDisplayString(m.value.currency.symbol),1)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)]),x.value?(i.openBlock(),i.createBlock(i.unref(z.NCheckbox),{key:1,checked:((Te=c.value[0])==null?void 0:Te.isAdditionalSale)??!1,"true-value":!0,"false-value":!1,"onUpdate:checked":q[4]||(q[4]=We=>D(We??!1))},{default:i.withCtx(()=>[...q[11]||(q[11]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0),i.createElementVNode("div",db,[m.value&&!k.value?(i.openBlock(),i.createBlock(i.unref(z.NButton),{key:0,disabled:N.value,type:"default",onClick:A},{default:i.withCtx(()=>[i.createVNode(ue),q[12]||(q[12]=i.createTextVNode(" Добавить изделие ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),i.createVNode(i.unref(z.NButton),{loading:t.isSubmitProcessing,disabled:T.value||E.value,type:"primary",class:"ml-auto",onClick:q[5]||(q[5]=We=>o("submit",c.value))},{default:i.withCtx(()=>{var We;return[i.createTextVNode(i.toDisplayString((We=c.value[0])!=null&&We.isNewRec()?"В корзину":"Изменить"),1)]}),_:1},8,["loading","disabled"])])]}),_:1},8,["model","rules"])),[[i.unref(Wn),()=>o("submit",c.value)]])}}}),hb={class:"flex flex-col gap-2"},fb={class:"min-w-56 max-w-3xl flex grow flex-col px-5"},mb={},Dd=i.defineComponent({...mb,__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(v=>new j.OrderItemBase(v))),a=i.ref([]),l=i.ref({width:{},length:{},quantity:{},marker:{}}),c=["width","length","quantity","marker"],d=v=>{c.forEach(x=>{l.value[`items.${v}.${x}`]={}})},u=v=>{c.forEach(x=>{delete l.value[`items.${v}.${x}`]})},f=i.computed(()=>a.value.includes("loading")),m=()=>({width:{},length:{},quantity:{},marker:{}}),g=(v,x)=>{let N=!1;return c.forEach(T=>{var M,R;const k=`items.0.${T}`,$=(M=v[T])==null?void 0:M.feedback,B=((R=v[k])==null?void 0:R.feedback)??$,E=`items.${x}.${T}`;B?(l.value[E]=v[k]??v[T],N=!0):l.value[E]={}}),N},h=(v,x,N)=>new Promise(T=>{const k=m();let $=!1;const w=B=>{if($)return;$=!0;const E=g(k,x),M=(B===void 0?!E:B)&&!E;a.value[x]=M?"success":"error",i.nextTick(()=>{var R,O;(O=(R=o.value)==null?void 0:R.formReference)==null||O.restoreValidation()}),T(M)};a.value[x]="loading",r("submit",[I.cloneDeep(v)],k,w,{isFinalSuccessfulCompletion:N})}),p=async()=>{var N,T;try{await((T=(N=o.value)==null?void 0:N.formReference)==null?void 0:T.validate())}catch{return}const v=s.value.map((k,$)=>$).filter(k=>{const $=a.value[k]??"idle";return $!=="success"&&$!=="loading"});let x=!0;for(let k=0;k<v.length;k+=1){const $=v[k],w=s.value[$];if(!w)break;const E=k===v.length-1&&x;await h(w,$,E)||(x=!1)}},y=v=>{const x=v-1;a.value[x]="idle",d(x)},b=v=>{a.value.splice(v,1),u(v);for(let x=v;x<s.value.length;x+=1)d(x)},_=v=>{const x=a.value[v];(x==="success"||x==="error")&&(a.value[v]="idle")};return i.onMounted(()=>{(n.cartItems??[]).forEach((v,x)=>{a.value[x]="idle",d(x)})}),i.watch(()=>n.cartItems,v=>{const x=(v??[]).map(N=>new j.OrderItemBase(N));s.value=x,a.value=x.map(()=>"idle"),x.forEach((N,T)=>{d(T)})},{deep:!0}),(v,x)=>{var T;const N=z.NButton;return i.openBlock(),i.createElementBlock("div",hb,[t.settings.allowShowTable&&((T=s.value[0])!=null&&T.isNewRec())?(i.openBlock(),i.createBlock(N,{key:0,type:"tertiary",class:"self-center",onClick:x[0]||(x[0]=k=>r("click:view-switch"))},{default:i.withCtx(()=>[...x[2]||(x[2]=[i.createTextVNode(" Показать в виде списка ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",fb,[i.createVNode(zd,{ref:"sandwich-m2-configurator-form",value:s.value,"onUpdate:value":x[1]||(x[1]=k=>s.value=k),validation:l.value,settings:t.settings,"event-emitter":t.eventEmitter,"is-submit-processing":f.value,"item-states":a.value,onSubmit:p,onAddItem:y,onRemoveItem:b,onItemReset:_},null,8,["value","validation","settings","event-emitter","is-submit-processing","item-states"])])])}}}),gb={key:0,class:"flex justify-center p-4"},pb={key:1,class:"p-4 text-center text-red-500"},yb={key:2,class:"flex justify-center"},bb={class:"!bg-white p-4 m-2 rounded-md w-max"},_b={key:3,class:"p-4 text-center text-gray-500"},wb={},Ld=i.defineComponent({...wb,__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=m=>{const g=m.configuratorParams;return[new j.OrderItemBase({...m,quantity:m.quantity??1,marker:m.marker,configuratorParams:{width:(g==null?void 0:g.width)??m.width??0,length:(g==null?void 0:g.length)??m.length??0}})]},l=i.ref(e.editor===j.ConfiguratorsEnum.SandwichM2&&e.cartItem!=null?a(e.cartItem):null),c=()=>{var g,h,p;if(!e.settings){r.value="Настройки конфигуратора не указаны в свойствах категории.";return}const m={category:((g=e.cartItem)==null?void 0:g.category)??e.category,configurator:e.editor,quantity:1};switch(e.editor){case"kozyrek":{const y=e.settings;o.value=new j.OrderItemBase({...m,configuratorParams:{length:y.stripMinLength,linesAngles:[],linesWidths:[],startTailType:I.some(y.startTailConfigs,b=>b.isDefault)?(h=y.startTailConfigs)==null?void 0:h.findIndex(b=>b.isDefault):void 0,endTailType:I.some(y.endTailConfigs,b=>b.isDefault)?(p=y.endTailConfigs)==null?void 0:p.findIndex(b=>b.isDefault):void 0,colorSide:"top"}});break}case"mosquitto":{const y=e.settings;o.value=new j.OrderItemBase({...m,configuratorParams:{width:0,height:0,netType:y.netType[0]||"",color:y.color[0]||"",mountType:y.mountType[0]||""}});break}case"strip":{const y=e.settings;s.value=[new j.OrderItemBase({...m,length:y.minLength,configuratorParams:{linesWidths:[0]}})];break}case"metal_for_doors":{const y=e.settings;o.value=new j.OrderItemBase({...m,configuratorParams:{width:y.minWidth,length:y.minLength}});break}case"sandwich":{o.value=new j.OrderItemBase({...m,configuratorParams:{calculationId:"",items:[{width:0,length:0,count:1}]}});break}case"sandwich_m2":{l.value=[new j.OrderItemBase({...m,configuratorParams:{width:0,length:0}})];break}default:r.value=`Неподдерживаемый тип конфигуратора: ${e.editor}.`}o.value&&(o.value.marker=void 0)},d=(m,g,h)=>{const p=y=>{h==null||h(),y&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:m,callback:p,validation:g})},u=(m,g,h,p)=>{const y=m[0];if(!y){h==null||h();return}const b=(p==null?void 0:p.isFinalSuccessfulCompletion)===!0,_=v=>{h==null||h(v),b&&v&&c()};e.eventEmitter.emit("configurator:submit",{cartItem:y,callback:_,validation:g,additionalParams:p})},f=()=>{e.category&&e.eventEmitter.emit("configurator:click-view-switch",{category:e.category})};return i.onMounted(()=>{!e.cartItem&&!e.cartItems&&c()}),(m,g)=>{const h=z.NSpin;return i.openBlock(),i.createElementBlock(i.Fragment,null,[n.value?(i.openBlock(),i.createElementBlock("div",gb,[i.createVNode(h,{size:"large"})])):r.value?(i.openBlock(),i.createElementBlock("div",pb,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",yb,[i.createElementVNode("div",bb,[t.editor==="kozyrek"?(i.openBlock(),i.createBlock(Bd,{key:0,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="mosquitto"?(i.openBlock(),i.createBlock($d,{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(Fd,{key:2,"event-emitter":t.eventEmitter,settings:t.settings,"cart-items":s.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-items"])):t.editor==="metal_for_doors"?(i.openBlock(),i.createBlock(Md,{key:3,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="sandwich"?(i.openBlock(),i.createBlock(Od,{key:4,"event-emitter":t.eventEmitter,settings:t.settings,"cart-item":o.value,"onClick:viewSwitch":f,onSubmit:d},null,8,["event-emitter","settings","cart-item"])):t.editor==="sandwich_m2"?(i.openBlock(),i.createBlock(Dd,{key:5,"event-emitter":t.eventEmitter,settings:t.settings,"cart-items":l.value,"onClick:viewSwitch":f,onSubmit:u},null,8,["event-emitter","settings","cart-items"])):i.createCommentVNode("",!0)])])):(i.openBlock(),i.createElementBlock("div",_b,' Конфигуратор "'+i.toDisplayString(t.editor)+'" не поддерживается. ',1))],64)}}});function Hd(t){return Object.values(j.ConfiguratorsEnum).includes(t)}function Wd(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.Sandwich?!0:t.properties.configuratorSettings!==void 0&&I.isArray(t.products)&&t.products.length>0}const xb={key:0,class:"pt-0.5"},kb={key:0},vb={class:"line-through"},Cb={key:0},Sb={key:1},Bb={class:"flex flex-row gap-1"},Tb={key:0},Nb={class:"m-0 list-inside list-disc p-0 pl-1.5 text-xs text-gray-500"},$b={class:"flex flex-col gap-2.5 sm:flex-row"},Eb={class:"mt-2"},Rb={key:1,class:"flex flex-col"},Pb={},Fb=i.defineComponent({...Pb,__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(dr,"medium"),r=i.computed(()=>{var K;return(K=e==null?void 0:e.filteredItems)==null?void 0:K[e.categoryItem.id]}),o=i.computed(()=>{var K,V;return I.isArray((K=e.categoryItem)==null?void 0:K.categories)&&((V=e.categoryItem.categories)==null?void 0:V.length)>0}),s=i.computed(()=>{var K;return I.isArray((K=e.categoryItem)==null?void 0:K.products)?e.categoryItem.products:[]}),a=i.computed(()=>Object.entries(e.categoryItem.currencyRates??{}).map(([K,V])=>`${V} руб./${E(K)}`).join(", ")),l=i.computed(()=>I.isUndefined(e.filteredItems)||r.value==="*"?s.value:s.value.filter(K=>{var q;const V=(q=r.value)==null?void 0:q.products;return I.isArray(V)&&V.includes(K.id)})),c=i.computed(()=>l.value.length>0),d=i.computed(()=>I.isFunction(e.showCategoryHideForClientButton)?e.showCategoryHideForClientButton(e.categoryItem):e.showCategoryHideForClientButton),u=i.computed(()=>I.isFunction(e.showCategoryPinButton)?e.showCategoryPinButton(e.categoryItem):e.showCategoryPinButton),f=i.computed(()=>I.isFunction(e.showCategoryRequiredButton)?e.showCategoryRequiredButton(e.categoryItem):e.showCategoryRequiredButton),m=i.computed(()=>I.isFunction(e.showCategoryEditButton)?e.showCategoryEditButton(e.categoryItem):e.showCategoryEditButton),g=i.computed(()=>{var K,V,q;return((K=e.categoryItem.properties)==null?void 0:K.configurator)!==void 0&&Hd((V=e.categoryItem.properties)==null?void 0:V.configurator)&&Wd(e.categoryItem)&&((q=e.categoryItem.properties)==null?void 0:q.configuratorSettings)!==void 0&&(I.isFunction(e.canShowConfigurator)?e.canShowConfigurator():e.canShowConfigurator)}),h=i.computed(()=>g.value&&(I.isFunction(e.showConfigurator)?e.showConfigurator(e.categoryItem):e.showConfigurator)),p=i.computed(()=>I.isNil(e.categoryContextButtonsConfig)?[]:I.isFunction(e.categoryContextButtonsConfig)?e.categoryContextButtonsConfig(e.categoryItem):e.categoryContextButtonsConfig),y=i.computed(()=>new j.ClientCategory(e.categoryItem)),b=i.ref(!1),_=i.ref(!1),v=i.computed(()=>!I.isUndefined(e.isCategoryItemSelected)),x=i.computed(()=>I.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem):e.isCategoryItemSelected===!0),N=i.computed(()=>I.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="disabled":e.isCategoryItemSelected==="disabled"),T=i.computed(()=>I.isFunction(e.isCategoryItemSelected)?e.isCategoryItemSelected(e.categoryItem)==="indeterminate":e.isCategoryItemSelected==="indeterminate"),k=i.computed(()=>A.value&&ht.getDeviceTypeByResolution()===qe.laptop?"auto":"fixed"),$=i.useTemplateRef("collapse-item-reference"),w=i.computed(()=>{var K,V;return(V=(K=e.categoryItem.properties)==null?void 0:K.templateCost)==null?void 0:V.priceCoefficient}),B=i.computed(()=>{var K,V;return(V=(K=e.categoryItem.properties)==null?void 0:K.templateCost)==null?void 0:V.increasePercent}),E=(K,V="ru-RU")=>0 .toLocaleString(V,{style:"currency",currency:K,minimumFractionDigits:0,maximumFractionDigits:0}).replaceAll(/\d/g,"").trim(),M=K=>{e.eventEmitter.emit("category:checked",{category:e.categoryItem,checked:K,target:$.value})},R=(K,V)=>{e.eventEmitter.emit("category:header-click",{categoryItem:e.categoryItem,expanded:V,isLoadingState:b,target:$.value})},O=()=>{e.eventEmitter.emit("category:hide",{category:e.categoryItem,target:$.value})},W=()=>{e.eventEmitter.emit("category:required",{category:e.categoryItem,target:$.value})},G=()=>{e.eventEmitter.emit("category:attach",{category:e.categoryItem,target:$.value})},Q=()=>{e.eventEmitter.emit("category:detach",{category:e.categoryItem,target:$.value})},H=()=>{e.eventEmitter.emit("category:edit",{category:e.categoryItem,target:$.value})},P=K=>{e.eventEmitter.emit("category:context-select",{category:e.categoryItem,key:K,target:$.value})},D=()=>{e.eventEmitter.emit("configurator:click-view-switch",{category:e.categoryItem})},A=i.ref(0),L=i.computed(()=>A.value&&s.value.length>0?lg(s.value,{eventEmitter:e.eventEmitter,showSlugs:e.showSlugs,showProperties:e.showProperties,showProductCosts:e.showProductCosts,allowNameClick:e.allowNameClick,allowPriceClick:e.allowPriceClick,showPriceHistory:e.showPriceHistory,showCostDate:e.showCostDate,showProductAddToCartButton:e.showProductAddToCartButton,isProductItemSelected:e.isProductItemSelected,showProductEditButton:e.showProductEditButton,showProductRequiredButton:e.showProductRequiredButton,currencyRates:e.categoryItem.currencyRates,productContextButtonsConfig:e.productContextButtonsConfig}):[]),U=I.debounce(()=>{A.value=window.innerWidth},20);return i.onUnmounted(()=>{window.removeEventListener("resize",U)}),window.addEventListener("resize",U),U(),(K,V)=>{const q=z.NCheckbox,Y=Of,te=z.NTooltip,ue=Mf,ve=z.NTag,Te=Pf,We=$f,ce=z.NButton,gt=Bf,Ne=nl,Ft=tl,Wt=el,ln=Uo,St=z.NDropdown,Ln=z.NDataTable,cn=z.NAlert,Jt=z.NSpin;return i.openBlock(),i.createBlock(il,{ref:"collapse-item-reference",name:t.categoryItem.id,"data-id":t.categoryItem.id,"onHeader:click":R},{"pre-arrow":i.withCtx(()=>{var Ve,ee;return[v.value?(i.openBlock(),i.createElementBlock("div",xb,[i.createVNode(q,{checked:x.value,indeterminate:T.value,disabled:N.value,"onUpdate:checked":M},null,8,["checked","indeterminate","disabled"])])):i.createCommentVNode("",!0),!d.value&&((Ve=y.value)!=null&&Ve.isDisabled)?(i.openBlock(),i.createBlock(te,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(Y,{class:"pt-1.5"})]),default:i.withCtx(()=>[V[1]||(V[1]=i.createTextVNode(" Категория скрыта для клиента ",-1))]),_:1})):i.createCommentVNode("",!0),((ee=y.value)==null?void 0:ee.isFavorite)??!1?(i.openBlock(),i.createBlock(te,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ue,{class:"pt-1.5"})]),default:i.withCtx(()=>[V[2]||(V[2]=i.createTextVNode(" Избранная категория ",-1))]),_:1})):i.createCommentVNode("",!0)]}),header:i.withCtx(()=>{var Ve,ee,le,De,ri;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(te,{disabled:!t.categoryItem.isHidden,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createElementVNode("span",null,i.toDisplayString(t.categoryItem.name),1)]),default:i.withCtx(()=>[V[3]||(V[3]=i.createTextVNode(" Категория скрыта ",-1))]),_:1},8,["disabled"])],2),i.createElementVNode("div",{class:"w-fit",onClick:V[0]||(V[0]=i.withModifiers((...nt)=>i.unref(I.noop)&&i.unref(I.noop)(...nt),["prevent","stop"]))},[(ee=t.categoryItem.properties)!=null&&ee.m2Price?(i.openBlock(),i.createBlock(ve,{key:0,size:i.unref(n),class:i.normalizeClass({"!pr-0":((le=t.categoryItem.properties)==null?void 0:le.templateCost)&&t.categoryItem.properties.m2PriceRetail&&B.value}),round:""},{default:i.withCtx(()=>{var nt;return[i.createTextVNode(" Установленная стоимость: "+i.toDisplayString(t.categoryItem.properties.m2Price)+" руб./м2 ",1),(nt=t.categoryItem.properties)!=null&&nt.templateCost&&t.categoryItem.properties.m2PriceRetail&&B.value?(i.openBlock(),i.createElementBlock(i.Fragment,{key:0},[B.value?(i.openBlock(),i.createBlock(ve,{key:0,type:"success",bordered:!1,size:i.unref(n),class:"ml-2 !pr-0",round:""},{default:i.withCtx(()=>[B.value?(i.openBlock(),i.createElementBlock("span",kb,i.toDisplayString(B.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0),i.createVNode(ve,{size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createElementVNode("span",vb,i.toDisplayString(t.categoryItem.properties.m2PriceRetail)+" руб./м2",1)]),_:1},8,["size"])]),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0)]}),_:1},8,["size","class"])):(De=t.categoryItem.properties)!=null&&De.templateCost?(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[w.value||B.value?(i.openBlock(),i.createBlock(ve,{key:0,size:i.unref(n),round:""},{default:i.withCtx(()=>{var nt;return[w.value?(i.openBlock(),i.createElementBlock("span",Cb,i.toDisplayString((nt=w.value)==null?void 0:nt.name),1)):i.createCommentVNode("",!0),B.value?(i.openBlock(),i.createElementBlock("span",Sb,i.toDisplayString(B.value>0?"+":"")+i.toDisplayString(B.value.toFixed(2))+"%",1)):i.createCommentVNode("",!0)]}),_:1},8,["size"])):i.createCommentVNode("",!0)],64)):i.createCommentVNode("",!0),a.value?(i.openBlock(),i.createBlock(ve,{key:2,size:i.unref(n),round:""},{default:i.withCtx(()=>[i.createTextVNode(" Фиксированный курс: "+i.toDisplayString(a.value),1)]),_:1},8,["size"])):i.createCommentVNode("",!0),u.value&&((ri=y.value)!=null&&ri.manager)?(i.openBlock(),i.createBlock(ve,{key:3,size:i.unref(n),closable:!0,round:"",class:"align-bottom",onClose:Q},{default:i.withCtx(()=>[i.createVNode(te,{placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>{var nt,jt;return[i.createElementVNode("span",Bb,[i.createVNode(Te),i.createTextVNode(" "+i.toDisplayString((jt=(nt=y.value)==null?void 0:nt.manager)==null?void 0:jt.name),1)])]}),default:i.withCtx(()=>{var nt,jt;return[i.createTextVNode(' Категория закреплена за "'+i.toDisplayString((jt=(nt=y.value)==null?void 0:nt.manager)==null?void 0:jt.name)+'" ',1)]}),_:1})]),_:1},8,["size"])):i.createCommentVNode("",!0)])]}),"sub-header":i.withCtx(()=>[t.showSlugs||t.showProperties?(i.openBlock(),i.createElementBlock("div",Tb,[i.createElementVNode("ul",Nb,[t.showSlugs?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList({id:t.categoryItem.id,slug:t.categoryItem.slug},(Ve,ee)=>(i.openBlock(),i.createElementBlock("li",{key:ee}," ("+i.toDisplayString(ee)+"): "+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,ee)=>(i.openBlock(),i.createElementBlock("li",{key:ee}," ("+i.toDisplayString(ee)+"): "+i.toDisplayString(Ve),1))),128)):i.createCommentVNode("",!0)])])):i.createCommentVNode("",!0)]),"header-extra":i.withCtx(()=>{var Ve;return[i.createElementVNode("div",$b,[d.value?(i.openBlock(),i.createBlock(te,{key:0,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),onClick:O},{default:i.withCtx(()=>{var ee;return[(ee=y.value)!=null&&ee.isDisabled?(i.openBlock(),i.createBlock(Y,{key:1})):(i.openBlock(),i.createBlock(We,{key:0}))]}),_:1},8,["size"])]),default:i.withCtx(()=>{var ee;return[(ee=y.value)!=null&&ee.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(te,{key:1,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),onClick:G},{default:i.withCtx(()=>[i.createVNode(gt)]),_:1},8,["size"])]),default:i.withCtx(()=>{var ee,le,De;return[(ee=y.value)!=null&&ee.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),f.value?(i.openBlock(),i.createBlock(te,{key:2,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,disabled:f.value==="disabled",size:i.unref(n),onClick:W},{default:i.withCtx(()=>{var ee;return[(ee=y.value)!=null&&ee.isRequired?(i.openBlock(),i.createBlock(Ft,{key:1})):(i.openBlock(),i.createBlock(Ne,{key:0}))]}),_:1},8,["disabled","size"])]),default:i.withCtx(()=>[V[4]||(V[4]=i.createTextVNode(" Категория, которую нужно предлагать клиенту ",-1))]),_:1})):i.createCommentVNode("",!0),m.value?(i.openBlock(),i.createBlock(te,{key:3,placement:"bottom",trigger:"hover"},{trigger:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),type:"primary",onClick:H},{default:i.withCtx(()=>[i.createVNode(Wt)]),_:1},8,["size"])]),default:i.withCtx(()=>[V[5]||(V[5]=i.createTextVNode(" Редактировать ",-1))]),_:1})):i.createCommentVNode("",!0),p.value.length>0?(i.openBlock(),i.createBlock(St,{key:4,options:p.value,size:i.unref(n),trigger:"click",onSelect:P},{default:i.withCtx(()=>[i.createVNode(ce,{ghost:!0,size:i.unref(n),type:"primary"},{default:i.withCtx(()=>[i.createVNode(ln)]),_:1},8,["size"])]),_:1},8,["options","size"])):i.createCommentVNode("",!0)])]}),default:i.withCtx(()=>[i.renderSlot(K.$slots,"default",{},()=>{var Ve,ee,le;return[i.createElementVNode("div",Eb,[o.value?(i.openBlock(),i.createBlock(qd,{key:0,"categories-items":t.categoryItem.categories??[],"has-products":c.value||b.value,"event-emitter":t.eventEmitter,"filtered-items":r.value?((Ve=r.value)==null?void 0:Ve.categories)??{}:void 0,"is-category-item-selected":t.isCategoryItemSelected,"show-slugs":t.showSlugs,"show-properties":t.showProperties,"allow-name-click":t.allowNameClick,"allow-price-click":t.allowPriceClick,"show-price-history":t.showPriceHistory,"show-cost-date":t.showCostDate,"show-category-required-button":t.showCategoryRequiredButton,"show-category-hide-for-client-button":t.showCategoryHideForClientButton,"show-category-pin-button":t.showCategoryPinButton,"show-category-edit-button":t.showCategoryEditButton,"category-context-buttons-config":t.categoryContextButtonsConfig,"is-product-item-selected":t.isProductItemSelected,"show-product-add-to-cart-button":t.showProductAddToCartButton,"show-product-costs":t.showProductCosts,"show-product-required-button":t.showProductRequiredButton,"show-product-edit-button":t.showProductEditButton,"product-context-buttons-config":t.productContextButtonsConfig,"show-configurator":t.showConfigurator,"can-show-configurator":t.canShowConfigurator},null,8,["categories-items","has-products","event-emitter","filtered-items","is-category-item-selected","show-slugs","show-properties","allow-name-click","allow-price-click","show-price-history","show-cost-date","show-category-required-button","show-category-hide-for-client-button","show-category-pin-button","show-category-edit-button","category-context-buttons-config","is-product-item-selected","show-product-add-to-cart-button","show-product-costs","show-product-required-button","show-product-edit-button","product-context-buttons-config","show-configurator","can-show-configurator"])):i.createCommentVNode("",!0)]),g.value&&h.value?(i.openBlock(),i.createBlock(Ld,{key:0,"event-emitter":t.eventEmitter,settings:(ee=t.categoryItem.properties)==null?void 0:ee.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",Rb,[g.value?(i.openBlock(),i.createBlock(ce,{key:0,color:"#bdbdbd",strong:"",class:"self-end p-2",onClick:D},{default:i.withCtx(()=>[...V[6]||(V[6]=[i.createTextVNode(" Назад в Конфигуратор ",-1)])]),_:1})):i.createCommentVNode("",!0),i.createVNode(Ln,{columns:L.value,data:l.value,bordered:!0,loading:b.value,remote:!0,"row-key":De=>De.id,"table-layout":k.value,class:"mt-2"},null,8,["columns","data","loading","row-key","table-layout"])])):i.createCommentVNode("",!0),!b.value&&!_.value&&!o.value&&!c.value?(i.openBlock(),i.createBlock(cn,{key:2,"show-icon":!0,type:"warning",title:"Категория пуста",class:"mx-10"})):i.createCommentVNode("",!0),_.value?(i.openBlock(),i.createBlock(cn,{key:3,"show-icon":!0,type:"error",title:"При получении данных произошла ошибка",class:"mx-10"})):i.createCommentVNode("",!0),b.value?(i.openBlock(),i.createBlock(Jt,{key:4,size:i.unref(n),class:"w-full"},{description:i.withCtx(()=>[...V[7]||(V[7]=[i.createElementVNode("div",null,"Выполняется загрузка данных ...",-1)])]),_:1},8,["size"])):i.createCommentVNode("",!0)]},!0)]),_:3},8,["name","data-id"])}}}),Vb=qn(Fb,[["__scopeId","data-v-607a5aad"]]),Mb={class:"sc-collapse flex w-full flex-col"},Ib={},jd=i.defineComponent({...Ib,__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",Mb,[i.renderSlot(s.$slots,"default")]))}}),Ab={},qd=i.defineComponent({...Ab,__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(dr,"medium"),r=i.computed(()=>I.isUndefined(e.filteredItems)?e.categoriesItems:e.categoriesItems.filter(s=>{var a;return!!((a=e.filteredItems)!=null&&a[s.id])})),o=(s,a)=>{if(I.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(jd,{key:0},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,d=>(i.openBlock(),i.createBlock(Vb,{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)}}}),Ob={},Xd=i.defineComponent({...Ob,__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(()=>I.isArray(r.value)),a=new j.Reference,l=i.computed(()=>I.isNil(r.value)?s.value?[]:null:I.isArray(r.value)?r.value.map(g=>g.id):r.value.id),c=i.computed(()=>Bt.convertReferencesToSelectOptionsList(r.referenceList,r.sortOptionsByLabel,!1,r.showEmptyValue,void 0,r.disabledItem)),d=g=>{var h;if(I.isArray(g)){const p=g.length>0?g.map(y=>{var b;return(b=c.value.find(_=>_.value===y))==null?void 0:b.item}):[];o("update:value",p)}else{const p=g===a.id||I.isNil(g)||(h=c.value.find(y=>y.value===g))==null?void 0:h.item;o("update:value",p)}},u=i.useTemplateRef("select-component");return e({focus:()=>{var g;return(g=u.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=u.value)==null?void 0:g.blur()}}),(g,h)=>(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"]))}}),zb={},Db=i.defineComponent({...zb,__name:"set-client-price-form-item",props:{value:{},clearable:{type:Boolean},feedback:{},validationStatus:{},disabled:{type:Boolean},catalogItem:{},calculationType:{},label:{},disabledCoefficient:{type:Function}},emits:["update:value"],setup(t,{emit:e}){var x,N;const n=t,r=e,o=()=>{const T=j.PriceCoefficient.getRetailPriceCoefficient();return I.unset(T,"isNewRec"),T},s=T=>!T||T.id===o().id,a=i.computed(()=>{var T;return((T=n.catalogItem)==null?void 0:T.type)==="product"}),l=i.computed(()=>a.value?n.catalogItem:void 0),c=T=>{var k,$,w,B;return T.id===o().id?(k=l.value)==null?void 0:k.getRetailCost():(B=(w=($=l.value)==null?void 0:$.priceCoefficients)==null?void 0:w.find(E=>E.coefficient.id===T.id))==null?void 0:B.cost},d=i.computed(()=>{var k;const T=[...((k=j.useReferencesStore().priceCoefficientsReference)==null?void 0:k.map($=>structuredClone(i.toRaw($))))??[],o()];return a.value&&T.forEach($=>{var B;const w=c($);w?$.name+=` (${w} ${(B=l.value)==null?void 0:B.currency.symbol})`:$.name=""}),T.filter($=>$.name!=="")}),u=i.ref(n.value.coefficient),f=i.ref(((N=(x=n.value)==null?void 0:x.value)==null?void 0:N.toString())??null),m=i.ref(null),g=i.computed(()=>{var T,k;return(k=(T=l.value)==null?void 0:T.priceCoefficients)==null?void 0:k.find($=>$.coefficient.slug===j.PriceCoefficientEnum.K0)}),h=i.ref(void 0),p=T=>Number.parseFloat((T??"").replaceAll(/[\s\u00A0\u202F]/g,"").replace(",",".")),y=()=>{var k,$;h.value=void 0;let T=p(f.value);if(T=Number.isNaN(T)?void 0:T,a.value)if(u.value||f.value){const w=o(),B=c(u.value??w)??0,E=B+B*((T??0)/100);m.value=new Intl.NumberFormat("ru-RU",{style:"decimal",minimumFractionDigits:2}).format(E),E>(((k=l.value)==null?void 0:k.getRetailCost())??E)&&(h.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}),g.value&&E<((($=g.value)==null?void 0:$.cost)??0)&&(h.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"})}else m.value=null;r("update:value",{value:Number.isNaN(T)?void 0:T,coefficient:s(u.value)?void 0:structuredClone(i.toRaw(u.value))})},b=T=>{I.isArray(T)||I.isNull(T)||(u.value=T,f.value=null,!u.value&&f.value&&(u.value=o()),y())},_=()=>{u.value||(u.value=o()),y()},v=T=>{var $,w,B,E,M;const k=p(T);if(a.value){if(Number.isNaN(k)){u.value=void 0,f.value=null,r("update:value",{value:void 0,coefficient:void 0});return}let R=0;if(k<=0)u.value=void 0,f.value=null;else if(g.value&&k<((($=g.value)==null?void 0:$.cost)??0))u.value=(w=g.value)==null?void 0:w.coefficient,R=(k-g.value.cost)*100/g.value.cost,h.value={validationStatus:"warning",feedback:"Устанавливается цена ниже минимальной цены"};else if(k>(((B=l.value)==null?void 0:B.getRetailCost())??k)){u.value=o();const O=((E=l.value)==null?void 0:E.getRetailCost())??0;R=(k-O)*100/O,h.value={validationStatus:"warning",feedback:"Устанавливается цена выше розничной цены"}}else{const O=((M=l.value)==null?void 0:M.priceCoefficients)??[],W=I.sortBy(O,[H=>H.cost]),Q=W.filter(H=>H.cost<=k).at(-1)??W.at(0);Q&&(u.value=Q.coefficient,R=(k-Q.cost)*100/Q.cost),h.value={validationStatus:void 0,feedback:void 0}}f.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(k)?void 0:k,coefficient:void 0})};return i.onMounted(()=>{var T,k,$,w;n.calculationType===j.CalculationTypeEnum.m2Cost?m.value=((k=(T=n.value)==null?void 0:T.value)==null?void 0:k.toString())??null:!(($=n.value)!=null&&$.coefficient)&&((w=n.value)!=null&&w.value)&&(u.value=o()),y()}),(T,k)=>{var B,E,M;const $=z.NInput,w=z.NInputGroup;return i.openBlock(),i.createBlock(i.unref(z.NFormItem),{"show-label":!i.unref(I.isNil)(t.label),label:t.label,"show-feedback":!i.unref(I.isNil)(((B=h.value)==null?void 0:B.feedback)??t.feedback),feedback:((E=h.value)==null?void 0:E.feedback)??t.feedback,"validation-status":((M=h.value)==null?void 0:M.validationStatus)??t.validationStatus},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass([{"sm:grid-cols-3":a.value&&t.calculationType!==i.unref(j.CalculationTypeEnum).m2Cost},"grid w-full grid-cols-1 gap-2"])},[t.calculationType!==i.unref(j.CalculationTypeEnum).m2Cost?(i.openBlock(),i.createBlock(w,{key:0,class:i.normalizeClass(["w-full flex-row",{"sm:col-span-2":a.value}])},{default:i.withCtx(()=>[i.createVNode(Xd,{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($,{value:f.value,"onUpdate:value":[k[0]||(k[0]=R=>f.value=R),_],clearable:t.clearable,disabled:t.disabled,placeholder:"",class:"w-full min-w-0 flex-1"},i.createSlots({suffix:i.withCtx(()=>[k[3]||(k[3]=i.createTextVNode("%",-1))]),_:2},[f.value&&!f.value.startsWith("-")?{name:"prefix",fn:i.withCtx(()=>[k[2]||(k[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($,{key:1,value:m.value,"onUpdate:value":[k[1]||(k[1]=R=>m.value=R),v],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"])}}}),Lb={key:0,class:"flex flex-row gap-2.5"},Hb={key:1,class:"flex flex-row flex-wrap justify-end gap-2.5"},Wb={},Yd=i.defineComponent({...Wb,__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=ht.initRefDependingOnDeviceResolution(r.sizes.phone.size,r.sizes.tablet.size,r.sizes.default.size),c=ht.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)},f=(g="other",h=!1)=>{if(a.value&&!h){o("processing:cancel",_=>{a.value=_});return}let p=!1;o("closing",g,()=>{p=!0}),p||(s.value=!1,o("update:show",s.value))},m=()=>{o("accept",h=>{a.value=h})};return i.watch(()=>r.show,g=>{g?u():f("other",!0)}),i.watch(()=>r.processing,g=>{a.value=g}),e({open:u,close:f,acceptHandler:m}),(g,h)=>{const p=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":g.$slots["extra-action"]?"grid grid-cols-2 !justify-between":void 0,preset:"dialog",onClose:h[1]||(h[1]=b=>f("header")),onEsc:h[2]||(h[2]=b=>f("esc")),onMaskClick:h[3]||(h[3]=b=>f("mask"))},i.createSlots({default:i.withCtx(()=>[i.renderSlot(g.$slots,"default")]),_:2},[g.$slots.header?{name:"header",fn:i.withCtx(()=>[i.renderSlot(g.$slots,"header")]),key:"0"}:void 0,g.$slots.action||g.$slots["extra-action"]||t.acceptButton.show||t.cancelButton.show?{name:"action",fn:i.withCtx(()=>[g.$slots["extra-action"]?(i.openBlock(),i.createElementBlock("div",Lb,[i.renderSlot(g.$slots,"extra-action")])):i.createCommentVNode("",!0),g.$slots.action||t.acceptButton.show||t.cancelButton.show?(i.openBlock(),i.createElementBlock("div",Hb,[i.renderSlot(g.$slots,"action",{disabled:a.value}),t.acceptButton.show??!0?(i.openBlock(),i.createBlock(p,{key:0,disabled:a.value||!t.valid,loading:a.value,size:i.unref(l),type:"primary",onClick:m},{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(p,{key:1,disabled:a.value,size:i.unref(l),type:"default",onClick:h[0]||(h[0]=b=>f("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"])}}}),jb={class:"text-sm"},qb={class:"text-sm"},Xb={},Yb=i.defineComponent({...Xb,__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 w,B,E;return((w=a.value)==null?void 0:w.unit.isLinear)&&((E=(B=a.value)==null?void 0:B.properties)==null?void 0:E.isLengthConfigurator)}),c=i.ref(void 0),d=i.ref(void 0),u=i.ref(!0),f=i.ref(null),m=n,g=()=>({length:{},quantity:{},marker:{}}),h=i.ref(g()),p=i.ref(!1),y=i.computed(()=>{var R,O,W,G;if(!a.value)return{};const w=j.UnitsHelper.getProductLengthMultiplicity(a.value),B=j.UnitsHelper.getProductMultiplicity(a.value),E=((O=(R=a.value)==null?void 0:R.properties)==null?void 0:O.minLength)||w,M=(G=(W=a.value)==null?void 0:W.properties)==null?void 0:G.maxLength;return{length:[ae.required,ae.min(E??.1),ae.max(M),ae.step(w),He.serverValidation(h.value.length.feedback)],quantity:[ae.required,ae.min(B),ae.step(B),He.serverValidation(h.value.quantity.feedback)],marker:[He.serverValidation(h.value.marker.feedback)]}}),b=i.computed(()=>{var w,B,E;return a.value?((w=a.value.properties)==null?void 0:w.lengthStep)??((B=a.value.properties)!=null&&B.ignoreMinCountCheck?0:((E=a.value.properties)==null?void 0:E.minCount)??0):0}),_=i.computed(()=>{var E,M,R,O,W,G,Q,H,P;if(!a.value)return"";const w=((M=(E=a.value)==null?void 0:E.properties)==null?void 0:M.minLength)??((O=(R=a.value)==null?void 0:R.properties)!=null&&O.ignoreMinCountCheck?0:(G=(W=a.value)==null?void 0:W.properties)==null?void 0:G.minCount),B=(H=(Q=a.value)==null?void 0:Q.properties)==null?void 0:H.maxLength;return w||B?`(${w?`от ${w}`:""}${w&&B?" ":""}${B?`до ${B}`:""} ${(P=a.value)==null?void 0:P.unit.name})`:""}),v=w=>{var O,W;if(!((W=(O=a.value)==null?void 0:O.properties)!=null&&W.isLengthConfigurator)||!f.value||I.isNil(w)||b.value===0)return;const B=w/b.value,E=Math.round(B),M=j.UnitsHelper.getProductMultiplicity(a.value),R=Math.max(E,M);f.value.quantity=R},x=w=>{var R,O,W,G;if(!((O=(R=a.value)==null?void 0:R.properties)!=null&&O.isLengthConfigurator)||!f.value||I.isNil(w)||b.value===0)return;const B=w*b.value,E=((W=a.value.properties)==null?void 0:W.minLength)||j.UnitsHelper.getProductLengthMultiplicity(a.value),M=(G=a.value.properties)==null?void 0:G.maxLength;E!==void 0&&B<E?f.value.length=E:M!==void 0&&B>M?f.value.length=M:f.value.length=B},N=async w=>{var E;const B=I.cloneDeep(f.value);try{await((E=r.value)==null?void 0:E.validate(M=>{if(!M){if(!a.value||!B)return;j.UnitsHelper.productIsMeasurable(a.value)||delete B.length,l.value&&b.value&&(B.length=b.value),p.value=!0,m("submit",B,h.value,()=>{p.value=!1,w(!1),i.nextTick(()=>{var R;(R=r.value)==null||R.validate(I.noop).catch(I.noop)})})}}))}catch{}},T=()=>{a.value=null,c.value=void 0,f.value=null,h.value=g()},k=()=>{s.value=!1};return e({show:(w,B)=>{var E,M,R,O,W;if(T(),s.value=!0,a.value=w,c.value=B==null?void 0:B.cartItemData,d.value=B==null?void 0:B.orderId,u.value=(B==null?void 0:B.canSetDopProdaga)??!1,f.value=new j.OrderItemBase((B==null?void 0:B.cartItemData)??new j.OrderItemBase({product:w,quantity:j.UnitsHelper.productIsMeasurable(a.value)?1:((E=w==null?void 0:w.properties)==null?void 0:E.minCount)??1,length:((M=w==null?void 0:w.properties)==null?void 0:M.minLength)||((R=w==null?void 0:w.properties)!=null&&R.ignoreMinCountCheck?0:(O=w==null?void 0:w.properties)==null?void 0:O.minCount)||0})),(W=w==null?void 0:w.properties)!=null&&W.isLengthConfigurator&&f.value&&b.value>0){const G=b.value,Q=f.value.quantity||1;f.value.length=Q*G}},closeDialog:k}),(w,B)=>{var W;const E=z.NFormItem,M=z.NInputGroupLabel,R=z.NInputGroup,O=z.NCheckbox;return i.openBlock(),i.createBlock(Yd,{ref:"base-dialog-reference",show:s.value,title:`${c.value?"Изменение":"Добавление"} товара ${(W=a.value)==null?void 0:W.name} в ${d.value?` заказ №${d.value}`:"корзину"}`,"accept-button":{show:!0,text:c.value?"Изменить":"Добавить"},processing:p.value,"modal-width":500,onAccept:N,onClosing:k},{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:y.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(E,{key:0,path:"length",label:`Метраж, ${_.value+a.value.unit.name}`},i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:f.value.length,"onUpdate:value":[B[0]||(B[0]=G=>f.value.length=G),v],parse:i.unref(it),step:i.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value),"show-button":!1,placeholder:"Введите метраж",class:"w-full",onKeydown:B[1]||(B[1]=G=>i.unref(Wr)(G,".",!1)),onInput:B[2]||(B[2]=G=>i.unref(et)(h.value,"length")),onFocus:i.unref(Le)},null,8,["value","parse","step","onFocus"])]),_:2},[!h.value.length.feedback&&i.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",jb,"Метраж должно быть кратно "+i.toDisplayString(i.unref(j.UnitsHelper).getProductLengthMultiplicity(a.value)),1)]),key:"0"}:void 0]),1032,["label"])):i.createCommentVNode("",!0),i.createVNode(E,{path:"quantity",label:"Количество, шт."},{default:i.withCtx(()=>[i.createVNode(R,null,i.createSlots({default:i.withCtx(()=>[i.createVNode(i.unref(z.NInputNumber),{value:f.value.quantity,"onUpdate:value":[B[3]||(B[3]=G=>f.value.quantity=G),x],parse:i.unref(it),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:B[4]||(B[4]=G=>i.unref(Wr)(G,".",!1)),onInput:B[5]||(B[5]=G=>i.unref(et)(h.value,"quantity")),onFocus:i.unref(Le)},null,8,["value","parse","step","show-button","onFocus"]),l.value?(i.openBlock(),i.createBlock(M,{key:0,class:"bg-orange-100 font-bold"},{default:i.withCtx(()=>[i.createTextVNode(" x "+i.toDisplayString(b.value)+" "+i.toDisplayString(a.value.unit.name),1)]),_:1})):i.createCommentVNode("",!0)]),_:2},[!h.value.quantity.feedback&&i.unref(j.UnitsHelper).getProductMultiplicity(a.value)!==1?{name:"feedback",fn:i.withCtx(()=>[i.createElementVNode("span",qb,"Количество должно быть кратно "+i.toDisplayString(i.unref(j.UnitsHelper).getProductMultiplicity(a.value)),1)]),key:"0"}:void 0]),1024)]),_:1}),i.unref(j.UnitsHelper).productIsMeasurable(a.value)?(i.openBlock(),i.createBlock(E,{key:1,path:"marker",label:"Маркировка"},{default:i.withCtx(()=>[i.createVNode(i.unref(z.NInput),{value:f.value.marker??null,placeholder:"Введите маркировку",onInput:B[6]||(B[6]=G=>i.unref(et)(h.value,"marker")),"onUpdate:value":B[7]||(B[7]=G=>f.value.marker=G??null),onFocus:i.unref(Le)},null,8,["value","onFocus"])]),_:1})):i.createCommentVNode("",!0),u.value?(i.openBlock(),i.createBlock(O,{key:2,checked:f.value.isAdditionalSale,"onUpdate:checked":B[8]||(B[8]=G=>f.value.isAdditionalSale=G),"true-value":!0,"false-value":!1},{default:i.withCtx(()=>[...B[9]||(B[9]=[i.createTextVNode(" ДопПродажа ",-1)])]),_:1},8,["checked"])):i.createCommentVNode("",!0)]),_:1},8,["model","rules"])),[[i.unref(Wn),()=>{var G,Q;return(Q=(G=o.value)==null?void 0:G.acceptHandler)==null?void 0:Q.call(G)}]]):i.createCommentVNode("",!0)]),_:1},8,["show","title","accept-button","processing"])}}}),Ub={class:"flex flex-row gap-1"},Kb={class:"sc-client-name flex flex-col gap-1 text-base"},Gb=["href"],Zb={key:1,class:"text-sc-grey"},Qb={key:0,class:"text-sc-dark-grey sc-client-city text-sm"},Jb={key:0},e_={key:1,class:"text-sm"},t_={},wr=i.defineComponent({...t_,__name:"client-name-with-short-info",props:{client:{},nameLink:{default:void 0},popoverPosition:{default:void 0},showCityAndRegion:{type:Boolean,default:!0},showSalesDirection:{type:Boolean,default:!1},showClientInfoIcon:{type:Boolean,default:!1}},emits:["click:client-name","click:client-info"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>n.client.lastLoginAt?en.format(n.client.lastLoginAt,j.useBaseConfigStateStore().config.dateFormats.uiDateWithTime):""),s=a=>{I.isNil(n.nameLink)&&(a.preventDefault(),a.stopPropagation()),r("click:client-name",n.client,a)};return(a,l)=>{const c=Ko,d=z.NButton,u=z.NPopover;return i.openBlock(),i.createElementBlock("div",Ub,[t.showClientInfoIcon?(i.openBlock(),i.createBlock(d,{key:0,quaternary:"",size:"small",onClick:l[0]||(l[0]=f=>a.$emit("click:client-info",t.client))},{default:i.withCtx(()=>[i.createVNode(c)]),_:1})):i.createCommentVNode("",!0),i.createVNode(u,{disabled:i.unref(I.isNil)(t.popoverPosition),placement:t.popoverPosition},{trigger:i.withCtx(()=>[i.createElementVNode("div",Kb,[i.createElementVNode("a",{href:t.nameLink??"#",class:"text-base no-underline",onClick:l[1]||(l[1]=f=>s(f))},[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",Zb," [ Деактивирован ] "))],8,Gb),t.showCityAndRegion&&t.client.city?(i.openBlock(),i.createElementBlock("span",Qb," г. "+i.toDisplayString(t.client.city.name)+", "+i.toDisplayString(t.client.city.region.name),1)):i.createCommentVNode("",!0)])]),default:i.withCtx(()=>[t.client.alternativeName?(i.openBlock(),i.createElementBlock("div",Jb,i.toDisplayString(t.client.alternativeName),1)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("span",e_," Последний вход: "+i.toDisplayString(o.value),1)):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"popover-content")]),_:3},8,["disabled","placement"])])}}}),n_={class:"text-base"},i_={},Ud=i.defineComponent({...i_,__name:"contragent-with-short-info",props:{contragent:{}},setup(t){const e=t,n=i.computed(()=>jn.getFormatEntityName(e.contragent));return(r,o)=>(i.openBlock(),i.createElementBlock("span",n_,i.toDisplayString(n.value),1))}}),r_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function o_(t,e){return i.openBlock(),i.createElementBlock("svg",r_,[...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 s_=i.markRaw({name:"tabler-mail",render:o_}),a_=["href"],l_={},c_=i.defineComponent({...l_,__name:"email",props:{email:{default:""},showEmailIcon:{type:Boolean,default:!1}},setup(t){return(e,n)=>{const r=s_;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,a_)],2)}}}),d_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function u_(t,e){return i.openBlock(),i.createElementBlock("svg",d_,[...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 Kd=i.markRaw({name:"fa6-brands-viber",render:u_}),h_={viewBox:"0 0 256 258",width:"1.2em",height:"1.2em"},f_=["id"],m_=["id"],g_=["fill"],p_=["fill"];function y_(t,e){return i.openBlock(),i.createElementBlock("svg",h_,[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,f_),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,m_)]),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,g_),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,p_),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 Gd=i.markRaw({name:"logos-whatsapp-icon",render:y_,setup(){const t=()=>Math.random().toString(36).substr(2,10);return{idMap:{SVGBRLHCcSy:"uicons-"+t(),SVGHW6lecxh:"uicons-"+t()}}}}),b_={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"},__=["id"],w_=["fill"];function x_(t,e){return i.openBlock(),i.createElementBlock("svg",b_,[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.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,w_),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 Zd=i.markRaw({name:"logos-telegram",render:x_,setup(){return{idMap:{SVGuySfwdaH:"uicons-"+Math.random().toString(36).substr(2,10)}}}}),k_={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function v_(t,e){return i.openBlock(),i.createElementBlock("svg",k_,[...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 Qd=i.markRaw({name:"ion-call",render:v_}),C_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function S_(t,e){return i.openBlock(),i.createElementBlock("svg",C_,[...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 B_=i.markRaw({name:"tabler-phone-call",render:S_}),T_={key:0,class:"absolute left-0 top-0 flex w-full flex-row items-center justify-around text-center backdrop-blur-sm"},N_=["href"],$_=["href"],E_=["href"],R_=["href"],P_={},F_=i.defineComponent({...P_,__name:"phone",props:{defaultCountry:{},phone:{default:""},showPhoneIcon:{type:Boolean,default:!1}},setup(t){const e=t,n=i.computed(()=>{try{return e.phone?ar.parsePhoneNumberWithError(e.phone,e.defaultCountry):void 0}catch{}return e.phone}),r=i.computed(()=>{var l;return I.isString(n.value)?!1:((l=n.value)==null?void 0:l.isValid())??!1}),o=i.computed(()=>{var l;return I.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("INTERNATIONAL"))??""}),s=i.computed(()=>{var l;return I.isString(n.value)?n.value:((l=n.value)==null?void 0:l.format("E.164"))??""}),a=i.ref(!1);return(l,c)=>{const d=B_,u=Qd,f=Zd,m=Gd,g=Kd;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]=h=>a.value=!a.value),onFocusout:c[1]||(c[1]=h=>a.value=!1),onMouseleave:c[2]||(c[2]=h=>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",T_,[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,N_)):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(f)],8,$_)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${s.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:animate-pulse"},[i.createVNode(m)],8,E_)):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("a",{key:3,href:`viber://chat?number=${s.value}`,class:"text-purple-600 hover:animate-pulse hover:text-purple-600"},[i.createVNode(g)],8,R_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)],34)])}}}),V_={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function M_(t,e){return i.openBlock(),i.createElementBlock("svg",V_,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"currentColor",d:"m20 8l-8 5l-8-5V6l8 5l8-5m0-2H4c-1.11 0-2 .89-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2"},null,-1)])])}const I_=i.markRaw({name:"mdi-envelope",render:M_}),A_={class:"flex flex-col gap-1"},O_={key:0,class:"mb-2 flex flex-col text-base"},z_={key:0,class:"text-sc-dark-grey text-sm"},D_={key:1,class:"whitespace-nowrap text-sm"},L_={key:2,class:"whitespace-nowrap text-sm"},H_={key:3,class:"absolute left-0 top-0 flex size-full items-center justify-around rounded-md text-center text-2xl backdrop-blur-sm"},W_=["href"],j_=["href"],q_=["href"],X_=["href"],Y_=["href"],U_={key:0,class:"flex flex-col text-base"},K_={key:0,class:"text-sc-dark-grey text-sm"},G_={key:1,class:"mt-2 text-sm"},Z_={key:0,class:"-mt-1"},Q_={},J_=i.defineComponent({...Q_,__name:"person-contacts-block",props:{defaultCountry:{},contact:{},fullView:{type:Boolean,default:!0},classes:{default:""},styles:{default:void 0}},setup(t){const e=t,n=i.computed(()=>jn.getFormatEntityName(e.contact)),r=i.computed(()=>{try{return e.contact.phone?ar.parsePhoneNumberWithError(e.contact.phone,e.defaultCountry):void 0}catch{}return e.contact.phone}),o=i.computed(()=>{var d;return I.isString(r.value)?!1:((d=r.value)==null?void 0:d.isValid())??!1}),s=i.computed(()=>{var d;return I.isString(r.value)?r.value:((d=r.value)==null?void 0:d.format("INTERNATIONAL"))??""}),a=i.computed(()=>{var d;return I.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 f=Qd,m=Zd,g=Gd,h=Kd,p=I_,y=z.NPopover;return i.openBlock(),i.createElementBlock("div",A_,[i.createVNode(y,{disabled:t.fullView,placement:"bottom"},{trigger:i.withCtx(()=>{var v,x,N,T;return[i.createElementVNode("div",{class:i.normalizeClass(`relative contact-btn px-3 py-2 rounded-md items-center inline-flex bg-gray-50 ${(v=t.contact)!=null&&v.isPrimary?"ring-1 ring-inset ring-green-600 hover:ring-gray-200":""} ${t.classes}`),style:i.normalizeStyle(t.styles),onMouseenter:u[0]||(u[0]=k=>c.value=!0),onFocusin:u[1]||(u[1]=k=>c.value=!0),onMouseleave:u[2]||(u[2]=k=>c.value=!1),onFocusout:u[3]||(u[3]=k=>c.value=!1)},[i.createElementVNode("div",null,[t.fullView&&(t.contact.name||(x=t.contact)!=null&&x.position)?(i.openBlock(),i.createElementBlock("div",O_,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),(N=t.contact)!=null&&N.position?(i.openBlock(),i.createElementBlock("span",z_,i.toDisplayString((T=t.contact)==null?void 0:T.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),t.contact.phone?(i.openBlock(),i.createElementBlock("div",D_,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("div",L_,i.toDisplayString(t.contact.email),1)):i.createCommentVNode("",!0),l.value&&c.value?(i.openBlock(),i.createElementBlock("div",H_,[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(f)],8,W_)):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(m)],8,j_)):i.createCommentVNode("",!0),o.value?(i.openBlock(),i.createElementBlock("a",{key:2,href:`https://wa.me/${a.value.substring(1)}`,target:"_blank",rel:"noopener noreferrer",class:"hover:text-3xl"},[i.createVNode(g)],8,q_)):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(h)],8,X_)):i.createCommentVNode("",!0),t.contact.email?(i.openBlock(),i.createElementBlock("a",{key:4,href:`mailto:${t.contact.email}`,class:"hover:text-3xl"},[i.createVNode(p)],8,Y_)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0)])],38)]}),default:i.withCtx(()=>{var v,x,N,T;return[t.contact.name?(i.openBlock(),i.createElementBlock("div",U_,[i.createTextVNode(i.toDisplayString(n.value)+" ",1),(v=t.contact)!=null&&v.position?(i.openBlock(),i.createElementBlock("span",K_,i.toDisplayString((x=t.contact)==null?void 0:x.position),1)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),(N=t.contact)!=null&&N.comment?(i.openBlock(),i.createElementBlock("div",G_,[u[4]||(u[4]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((T=t.contact)==null?void 0:T.comment),1)])):i.createCommentVNode("",!0)]}),_:1},8,["disabled"]),t.fullView&&((b=t.contact)!=null&&b.comment)?(i.openBlock(),i.createElementBlock("div",Z_,[u[5]||(u[5]=i.createElementVNode("sup",null,"**",-1)),i.createTextVNode(" "+i.toDisplayString((_=t.contact)==null?void 0:_.comment),1)])):i.createCommentVNode("",!0)])}}});class e1{constructor(e){S(this,"minHeight");S(this,"maxHeights");S(this,"minWidth");S(this,"maxWidths");S(this,"netType");S(this,"color");S(this,"mountType");S(this,"descriptions");S(this,"crossbarCount");S(this,"heightOverlaps");S(this,"widthOverlaps");S(this,"canSetDopProdaga");this.color=e.color,this.crossbarCount=e.crossbarCount,this.descriptions=Yo.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=Yo.objectToSnake(e.heightOverlaps),this.widthOverlaps=Yo.objectToSnake(e.widthOverlaps),this.canSetDopProdaga=e.canSetDopProdaga}}function t1(t){var e;return((e=t.properties)==null?void 0:e.configurator)!==j.ConfiguratorsEnum.SandwichM2?!0:t.properties.configuratorSettings!==void 0&&I.isArray(t.products)&&t.products.length>0}const n1={class:"flex flex-wrap gap-2"},i1={class:"flex flex-col"},r1={class:"flex flex-col"},o1={},s1=i.defineComponent({...o1,__name:"date-range",props:{clearable:{type:Boolean,default:!0},dateRange:{default:void 0},dateFormat:{default:()=>j.useBaseConfigStateStore().config.dateFormats.uiDate},disabled:{default:()=>({from:!1,to:!1})},predefinedDateRanges:{default:void 0},useDefaultPredefinedDateRanges:{type:Boolean,default:!1}},emits:["update:date-range"],setup(t,{emit:e}){const n=t,r=e,o=i.computed(()=>{if(n.predefinedDateRanges)return n.predefinedDateRanges;if(n.useDefaultPredefinedDateRanges){const a={};return I.forOwn(j.DateTimeProvider.defaultDateRanges(),(l,c)=>{a[c]={label:l.label,from:l.from??void 0,to:l.to??void 0}}),a}}),s=(a,l)=>{r("update:date-range",{from:a?en.startOfDay(new Date(a)):void 0,to:l?en.endOfDay(new Date(l)):void 0})};return(a,l)=>{var u,f,m,g,h,p;const c=z.NButton,d=z.NDatePicker;return i.openBlock(),i.createElementBlock("div",n1,[i.createVNode(d,{value:((f=(u=t.dateRange)==null?void 0:u.from)==null?void 0:f.getTime())??null,clearable:t.clearable,"is-date-disabled":y=>{var b,_;return((b=t.dateRange)==null?void 0:b.to)&&y>((_=t.dateRange)==null?void 0:_.to)},disabled:(m=t.disabled)==null?void 0:m.from,format:t.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[0]||(l[0]=y=>{var b,_;return s(y,(_=(b=t.dateRange)==null?void 0:b.to)==null?void 0:_.getTime())})},i.createSlots({_:2},[o.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",i1,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,(y,b)=>(i.openBlock(),i.createBlock(c,{key:b,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:_=>{var v,x;return s((v=y==null?void 0:y.from)==null?void 0:v.getTime(),(x=y==null?void 0:y.to)==null?void 0:x.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"]),i.createVNode(d,{value:((h=(g=t.dateRange)==null?void 0:g.to)==null?void 0:h.getTime())??null,clearable:t.clearable,"is-date-disabled":y=>{var b,_;return((b=t.dateRange)==null?void 0:b.from)&&y<((_=t.dateRange)==null?void 0:_.from)},disabled:(p=t.disabled)==null?void 0:p.to,format:t.dateFormat,type:"date",class:"min-w-28 grow basis-[calc(50%-0.5rem)]",onUpdateValue:l[1]||(l[1]=y=>{var b,_;return s((_=(b=t.dateRange)==null?void 0:b.from)==null?void 0:_.getTime(),y)})},i.createSlots({_:2},[o.value?{name:"footer",fn:i.withCtx(()=>[i.createElementVNode("div",r1,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,(y,b)=>(i.openBlock(),i.createBlock(c,{key:b,class:"my-1 mr-2",size:"small",type:"info",ghost:"",onClick:_=>{var v,x;return s((v=y==null?void 0:y.from)==null?void 0:v.getTime(),(x=y==null?void 0:y.to)==null?void 0:x.getTime())}},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(y.label),1)]),_:2},1032,["onClick"]))),128))])]),key:"0"}:void 0]),1032,["value","clearable","is-date-disabled","disabled","format"])])}}}),a1={class:"sc-lbl-date text-nowrap"},l1={},xo=i.defineComponent({...l1,__name:"date-time-label",props:{date:{},isTimeSecondary:{type:Boolean},isTimeOnSecondLine:{type:Boolean},isShowTime:{type:Boolean,default:!0}},setup(t){const e=t,n=i.computed(()=>en.format(e.date,j.useBaseConfigStateStore().config.dateFormats.uiDate)),r=i.computed(()=>en.format(e.date,"HH:mm"));return(o,s)=>(i.openBlock(),i.createElementBlock("span",{class:i.normalizeClass({"flex flex-col":t.isTimeOnSecondLine})},[i.createElementVNode("span",a1,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))}}),c1={class:"flex flex-row gap-2.5"},d1={class:"flex grow basis-0 flex-row flex-wrap justify-start justify-items-start gap-y-1 md:flex-nowrap"},u1={class:"flex min-w-0 flex-col-reverse flex-wrap-reverse justify-end gap-1 sm:flex-row"},h1={class:"mb-0.5 sm:mb-0 sm:ml-3"},f1={},m1=i.defineComponent({...f1,__name:"dialog-header",props:{showCloseButton:{type:Boolean,default:!0}},emits:["close"],setup(t){return(e,n)=>{const r=wo,o=z.NButton,s=z.NPopover;return i.openBlock(),i.createElementBlock("div",c1,[i.createElementVNode("div",d1,[i.renderSlot(e.$slots,"main")]),i.createElementVNode("div",null,[i.createElementVNode("div",u1,[i.renderSlot(e.$slots,"extra-buttons"),i.createElementVNode("div",h1,[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)])])])])}}}),g1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function p1(t,e){return i.openBlock(),i.createElementBlock("svg",g1,[...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 y1=i.markRaw({name:"ion-download-outline",render:p1}),b1={},_1=i.defineComponent({...b1,__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=y1;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"])}}}),w1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function x1(t,e){return i.openBlock(),i.createElementBlock("svg",w1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"square","stroke-miterlimit":"10","stroke-width":"44",d:"M465 127L241 384l-92-92m-9 93l-93-93m316-165L236 273"},null,-1)])])}const k1=i.markRaw({name:"ion-checkmark-done-sharp",render:x1}),v1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function C1(t,e){return i.openBlock(),i.createElementBlock("svg",v1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32",d:"M368 128h80m-384 0h240m64 256h80m-384 0h240m-96-128h240m-384 0h80"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"128",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"176",cy:"256",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1),i.createElementVNode("circle",{cx:"336",cy:"384",r:"32",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"32"},null,-1)])])}const S1=i.markRaw({name:"ion-options-outline",render:C1}),B1={class:"flex flex-row gap-x-2.5 p-0 sm:p-1"},T1={class:"flex-auto"},N1={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"},$1={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"},E1={},Ys=i.defineComponent({...E1,__name:"inline-view",props:{disabled:{type:Boolean,default:!1},showEditButton:{type:Boolean,default:!1},showApplyButton:{type:Boolean,default:!1},showCancelButton:{type:Boolean,default:!1}},emits:["edit","apply","cancel"],setup(t,{emit:e}){const n=e,r=i.ref(!1),o=()=>{n("edit")},s=()=>{r.value=!1},a=()=>{r.value=!0,n("apply",s)},l=()=>{n("cancel",s)};return(c,d)=>{const u=S1,f=z.NButton,m=z.NPopover,g=k1,h=wo;return i.openBlock(),i.createElementBlock("div",B1,[i.createElementVNode("div",T1,[i.renderSlot(c.$slots,"default")]),i.createElementVNode("div",null,[i.createElementVNode("div",N1,[i.createElementVNode("div",$1,[t.showEditButton?(i.openBlock(),i.createBlock(m,{key:0,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(f,{disabled:t.disabled||r.value,type:"info",ghost:"",size:"small",onClick:o},{default:i.withCtx(()=>[i.createVNode(u)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[0]||(d[0]=i.createTextVNode(" Редактировать данные ",-1))]),_:1})):i.createCommentVNode("",!0),t.showApplyButton?(i.openBlock(),i.createBlock(m,{key:1,disabled:r.value,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(f,{disabled:t.disabled||r.value,type:"primary",size:"small",onClick:a},{default:i.withCtx(()=>[i.createVNode(g)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[1]||(d[1]=i.createTextVNode(" Сохранить изменения ",-1))]),_:1},8,["disabled"])):i.createCommentVNode("",!0),t.showCancelButton?(i.openBlock(),i.createBlock(m,{key:2,placement:"bottom"},{trigger:i.withCtx(()=>[i.createVNode(f,{disabled:t.disabled||r.value,type:"error",size:"small",onClick:l},{default:i.withCtx(()=>[i.createVNode(h)]),_:1},8,["disabled"])]),default:i.withCtx(()=>[d[2]||(d[2]=i.createTextVNode(" Отменить изменения ",-1))]),_:1})):i.createCommentVNode("",!0)]),i.renderSlot(c.$slots,"extra-buttons")])])])}}}),R1={},Jd=i.defineComponent({...R1,__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(Ys,{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(Ys,{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"]))]))}}),P1={},F1=i.defineComponent({...P1,__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=I.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"]))}}),V1={},M1=i.defineComponent({...V1,__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=I.debounce(()=>o("update:value",s.value),a.value),c=g=>{s.value=g,l()};i.watch(()=>r.value,g=>{s.value=g});const d=i.ref(null);return e({focus:()=>{var g;return(g=d.value)==null?void 0:g.focus()},blur:()=>{var g;return(g=d.value)==null?void 0:g.blur()},select:()=>{var g;return(g=d.value)==null?void 0:g.select()}}),(g,h)=>(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:h[0]||(h[0]=p=>o("keydown",p)),onInput:h[1]||(h[1]=p=>o("input",p)),onFocus:h[2]||(h[2]=p=>o("focus",p))},{prefix:i.withCtx(()=>[i.renderSlot(g.$slots,"prefix")]),_:3},8,["value","clearable","parse","show-button","placeholder","min","max","step","validator"]))}}),I1={},A1=i.defineComponent({...I1,__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=I.debounce(c=>r("update:value",c),n.debounceTime??0),a=c=>{let d="";if(I.isString(c))o.value=c,d=c.replaceAll(/(\s|\(|\)|-|_)*/g,"");else if(I.isObject(c)){if(o.value=c.formatted,!c.valid)return;d=c instanceof ar.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=ar.parsePhoneNumberWithError(`+${d}`);u.isValid()?o.value=u.format("E.164"):u.getPossibleCountries().length>0&&(o.value=`+${d}`)}catch(u){if(u instanceof ar.ParseError)o.value=d;else throw u}};return i.watch(()=>n.value,c=>{var d;(c==null?void 0:c.replaceAll(/\D*/g,""))!==((d=o.value)==null?void 0:d.replaceAll(/\D*/g,""))&&l(c)},{immediate:!0}),i.onBeforeMount(()=>l(o.value??"")),(c,d)=>(i.openBlock(),i.createBlock(i.unref(af.VueTelInput),{modelValue:o.value,"onUpdate:modelValue":[d[0]||(d[0]=u=>o.value=u),a],"auto-default-country":!1,"auto-format":!0,"default-country":t.defaultCountry,disabled:t.disabled,"input-options":{placeholder:t.placeholder},"preferred-countries":t.preferredCountries,"only-countries":t.onlyCountries,mode:"international",class:"tel-input"},null,8,["modelValue","default-country","disabled","input-options","preferred-countries","only-countries"]))}}),O1=qn(A1,[["__scopeId","data-v-751dbb0e"]]),z1={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function D1(t,e){return i.openBlock(),i.createElementBlock("svg",z1,[...e[0]||(e[0]=[i.createElementVNode("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"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 L1=i.markRaw({name:"tabler-external-link",render:D1}),H1={class:"flex flex-row gap-1 hover:underline hover:decoration-dashed"},W1=["href"],j1={},q1=i.defineComponent({...j1,__name:"external-link",props:{text:{},url:{},description:{}},setup(t){return(e,n)=>{const r=L1,o=z.NTooltip;return i.openBlock(),i.createBlock(o,{disabled:i.unref(I.isUndefined)(t.description),placement:"top-start"},{trigger:i.withCtx(()=>[i.createElementVNode("span",H1,[i.createElementVNode("a",{href:t.url,target:"_blank",class:"no-underline"},i.toDisplayString(t.text),9,W1),i.createVNode(r,{class:"mt-0.5 flex-none"})])]),default:i.withCtx(()=>[i.createTextVNode(" "+i.toDisplayString(t.description),1)]),_:1},8,["disabled"])}}}),X1={viewBox:"0 0 512 512",width:"1.2em",height:"1.2em"};function Y1(t,e){return i.openBlock(),i.createElementBlock("svg",X1,[...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 U1=i.markRaw({name:"ion-remove-circle-outline",render:Y1});let ko=[];const eu=new WeakMap;function K1(){ko.forEach(t=>t(...eu.get(t))),ko=[]}function tu(t,...e){eu.set(t,e),!ko.includes(t)&&ko.push(t)===1&&requestAnimationFrame(K1)}function xr(t,e){let{target:n}=t;for(;n;){if(n.dataset&&n.dataset[e]!==void 0)return!0;n=n.parentElement}return!1}function kr(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 Cr(t){if(t!=null)return typeof t=="number"?`${t}px`:t.endsWith("px")?t:`${t}px`}function rn(t,e){const n=t.trim().split(/\s+/g),r={top:n[0]};switch(n.length){case 1:r.right=n[0],r.bottom=n[0],r.left=n[0];break;case 2:r.right=n[1],r.left=n[1],r.bottom=n[0];break;case 3:r.right=n[1],r.bottom=n[2],r.left=n[1];break;case 4:r.right=n[1],r.bottom=n[2],r.left=n[3];break;default:throw new Error("[seemly/getMargin]:"+t+" is not a valid value.")}return e===void 0?r:r[e]}const nu={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 G1(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 Z1(t,e,n){e/=100,n/=100;let r=e*Math.min(n,1-n),o=(s,a=(s+t/30)%12)=>n-r*Math.max(Math.min(a-3,9-a,1),-1);return[o(0)*255,o(8)*255,o(4)*255]}const wn="^\\s*",xn="\\s*$",Qn="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))%\\s*",Ht="\\s*((\\.\\d+)|(\\d+(\\.\\d*)?))\\s*",pi="([0-9A-Fa-f])",yi="([0-9A-Fa-f]{2})",iu=new RegExp(`${wn}hsl\\s*\\(${Ht},${Qn},${Qn}\\)${xn}`),ru=new RegExp(`${wn}hsv\\s*\\(${Ht},${Qn},${Qn}\\)${xn}`),ou=new RegExp(`${wn}hsla\\s*\\(${Ht},${Qn},${Qn},${Ht}\\)${xn}`),su=new RegExp(`${wn}hsva\\s*\\(${Ht},${Qn},${Qn},${Ht}\\)${xn}`),Q1=new RegExp(`${wn}rgb\\s*\\(${Ht},${Ht},${Ht}\\)${xn}`),J1=new RegExp(`${wn}rgba\\s*\\(${Ht},${Ht},${Ht},${Ht}\\)${xn}`),ew=new RegExp(`${wn}#${pi}${pi}${pi}${xn}`),tw=new RegExp(`${wn}#${yi}${yi}${yi}${xn}`),nw=new RegExp(`${wn}#${pi}${pi}${pi}${pi}${xn}`),iw=new RegExp(`${wn}#${yi}${yi}${yi}${yi}${xn}`);function At(t){return parseInt(t,16)}function rw(t){try{let e;if(e=ou.exec(t))return[Co(e[1]),Jn(e[5]),Jn(e[9]),_i(e[13])];if(e=iu.exec(t))return[Co(e[1]),Jn(e[5]),Jn(e[9]),1];throw new Error(`[seemly/hsla]: Invalid color value ${t}.`)}catch(e){throw e}}function ow(t){try{let e;if(e=su.exec(t))return[Co(e[1]),Jn(e[5]),Jn(e[9]),_i(e[13])];if(e=ru.exec(t))return[Co(e[1]),Jn(e[5]),Jn(e[9]),1];throw new Error(`[seemly/hsva]: Invalid color value ${t}.`)}catch(e){throw e}}function bi(t){try{let e;if(e=tw.exec(t))return[At(e[1]),At(e[2]),At(e[3]),1];if(e=Q1.exec(t))return[_t(e[1]),_t(e[5]),_t(e[9]),1];if(e=J1.exec(t))return[_t(e[1]),_t(e[5]),_t(e[9]),_i(e[13])];if(e=ew.exec(t))return[At(e[1]+e[1]),At(e[2]+e[2]),At(e[3]+e[3]),1];if(e=iw.exec(t))return[At(e[1]),At(e[2]),At(e[3]),_i(At(e[4])/255)];if(e=nw.exec(t))return[At(e[1]+e[1]),At(e[2]+e[2]),At(e[3]+e[3]),_i(At(e[4]+e[4])/255)];if(t in nu)return bi(nu[t]);if(iu.test(t)||ou.test(t)){const[n,r,o,s]=rw(t);return[...Z1(n,r,o),s]}else if(ru.test(t)||su.test(t)){const[n,r,o,s]=ow(t);return[...G1(n,r,o),s]}throw new Error(`[seemly/rgba]: Invalid color value ${t}.`)}catch(e){throw e}}function sw(t){return t>1?1:t<0?0:t}function Us(t,e,n,r){return`rgba(${_t(t)}, ${_t(e)}, ${_t(n)}, ${sw(r)})`}function Ks(t,e,n,r,o){return _t((t*e*(1-r)+n*r)/o)}function aw(t,e){Array.isArray(t)||(t=bi(t)),Array.isArray(e)||(e=bi(e));const n=t[3],r=e[3],o=_i(n+r-n*r);return Us(Ks(t[0],n,e[0],r,o),Ks(t[1],n,e[1],r,o),Ks(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"?Us(n,r,o,e.alpha):Us(n,r,o,s)}function vo(t,e){const[n,r,o,s=1]=Array.isArray(t)?t:bi(t),{lightness:a=1,alpha:l=1}=e;return lw([n*a,r*a,o*a,s*l])}function _i(t){const e=Math.round(Number(t)*100)/100;return e>1?1:e<0?0:e}function Co(t){const e=Math.round(Number(t));return e>=360||e<0?0:e}function _t(t){const e=Math.round(Number(t));return e>255?255:e<0?0:e}function Jn(t){const e=Math.round(Number(t));return e>100?100:e<0?0:e}function lw(t){const[e,n,r]=t;return 3 in t?`rgba(${_t(e)}, ${_t(n)}, ${_t(r)}, ${_i(t[3])})`:`rgba(${_t(e)}, ${_t(n)}, ${_t(r)}, 1)`}function cw(t=8){return Math.random().toString(16).slice(2,2+t)}function au(t){return Array.isArray(t)?t:[t]}const Gs={STOP:"STOP"};function lu(t,e){const n=e(t);t.children!==void 0&&n!==Gs.STOP&&t.children.forEach(r=>lu(r,e))}function dw(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 uw(t,e){const{isLeaf:n}=t;return n!==void 0?n:!e(t)}function hw(t){return t.children}function fw(t){return t.key}function mw(){return!1}function gw(t,e){const{isLeaf:n}=t;return!(n===!1&&!Array.isArray(e(t)))}function pw(t){return t.disabled===!0}function yw(t,e){return t.isLeaf===!1&&!Array.isArray(e(t))}function bw(t,e){if(t.isLeaf===!0){const n=e(t);if(Array.isArray(n)&&n.length>0)return!0}return!1}function Zs(t){var e;return t==null?[]:Array.isArray(t)?t:(e=t.checkedKeys)!==null&&e!==void 0?e:[]}function Qs(t){var e;return t==null||Array.isArray(t)?[]:(e=t.indeterminateKeys)!==null&&e!==void 0?e:[]}function _w(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)||n.add(r)}),Array.from(n)}function ww(t,e){const n=new Set(t);return e.forEach(r=>{n.has(r)&&n.delete(r)}),Array.from(n)}function xw(t){return(t==null?void 0:t.type)==="group"}function kw(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 vw extends Error{constructor(){super(),this.message="SubtreeNotLoadedError: checking a subtree whose required nodes are not fully loaded."}}function Cw(t,e,n,r){return So(e.concat(t),n,r,!1)}function Sw(t,e){const n=new Set;return t.forEach(r=>{const o=e.treeNodeMap.get(r);if(o!==void 0){let s=o.parent;for(;s!==null&&!(s.disabled||n.has(s.key));)n.add(s.key),s=s.parent}}),n}function Bw(t,e,n,r){const o=So(e,n,r,!1),s=So(t,n,r,!0),a=Sw(t,n),l=[];return o.forEach(c=>{(s.has(c)||a.has(c))&&l.push(c)}),l.forEach(c=>o.delete(c)),o}function Js(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:_w(n,r),indeterminateKeys:Array.from(s)}:o!==void 0?{checkedKeys:ww(n,o),indeterminateKeys:Array.from(s)}:{checkedKeys:Array.from(n),indeterminateKeys:Array.from(s)};const{levelTreeNodeMap:u}=e;let f;o!==void 0?f=Bw(o,n,e,d):r!==void 0?f=Cw(r,n,e,d):f=So(n,e,d,!1);const m=c==="parent",g=c==="child"||l,h=f,p=new Set,y=Math.max.apply(null,Array.from(u.keys()));for(let b=y;b>=0;b-=1){const _=b===0,v=u.get(b);for(const x of v){if(x.isLeaf)continue;const{key:N,shallowLoaded:T}=x;if(g&&T&&x.children.forEach(B=>{!B.disabled&&!B.isLeaf&&B.shallowLoaded&&h.has(B.key)&&h.delete(B.key)}),x.disabled||!T)continue;let k=!0,$=!1,w=!0;for(const B of x.children){const E=B.key;if(!B.disabled){if(w&&(w=!1),h.has(E))$=!0;else if(p.has(E)){$=!0,k=!1;break}else if(k=!1,$)break}}k&&!w?(m&&x.children.forEach(B=>{!B.disabled&&h.has(B.key)&&h.delete(B.key)}),h.add(N)):$&&p.add(N),_&&g&&h.has(N)&&h.delete(N)}}return{checkedKeys:Array.from(h),indeterminateKeys:Array.from(p)}}function So(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&&lu(d,u=>{if(u.disabled)return Gs.STOP;const{key:f}=u;if(!a.has(f)&&(a.add(f),l.add(f),yw(u.rawNode,s))){if(r)return Gs.STOP;if(!n)throw new vw}})}),l}function Tw(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 Nw(t){if(t.length===0)return null;const e=t[0];return e.isGroup||e.ignored||e.disabled?e.getNext():e}function $w(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 cu(t,e,{loop:n=!1,includeDisabled:r=!1}={}){const o=e==="prev"?Ew:$w,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=ea(d,s);u!==null?l=u:c(o(d,n))}else{const u=o(d,!1);if(u!==null)c(u);else{const f=Rw(d);f!=null&&f.isGroup?c(o(f,n)):n&&c(o(d,!0))}}}}return c(t),l}function Ew(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 Rw(t){return t.parent}function ea(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=ea(d,e);if(u!==null)return u}else return d}}return null}const Pw={getChild(){return this.ignored?null:ea(this)},getParent(){const{parent:t}=this;return t!=null&&t.isGroup?t.getParent():t},getNext(t={}){return cu(this,"next",t)},getPrev(t={}){return cu(this,"prev",t)}};function Fw(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 Vw(t,e){const n=t.key;for(;e;){if(e.key===n)return!0;e=e.parent}return!1}var Mw={};function du(t,e,n,r,o,s=null,a=0){const l=[];return t.forEach((c,d)=>{var u;Mw.NODE_ENV!=="production"&&bw(c,o)&&console.error("[treemate]: node",c,"is invalid");const f=Object.create(r);if(f.rawNode=c,f.siblings=l,f.level=a,f.index=d,f.isFirstChild=d===0,f.isLastChild=d+1===t.length,f.parent=s,!f.ignored){const m=o(c);Array.isArray(m)&&(f.children=du(m,e,n,r,o,f,a+1))}l.push(f),e.set(f.key,f),n.has(a)||n.set(a,[]),(u=n.get(a))===null||u===void 0||u.push(f)}),l}function Iw(t,e={}){var n;const r=new Map,o=new Map,{getDisabled:s=pw,getIgnored:a=mw,getIsGroup:l=xw,getKey:c=fw}=e,d=(n=e.getChildren)!==null&&n!==void 0?n:hw,u=e.ignoreEmptyChildren?x=>{const N=d(x);return Array.isArray(N)?N.length?N:null:N}:d,f=Object.assign({get key(){return c(this.rawNode)},get disabled(){return s(this.rawNode)},get isGroup(){return l(this.rawNode)},get isLeaf(){return uw(this.rawNode,u)},get shallowLoaded(){return gw(this.rawNode,u)},get ignored(){return a(this.rawNode)},contains(x){return Vw(this,x)}},Pw),m=du(t,r,o,f,u);function g(x){if(x==null)return null;const N=r.get(x);return N&&!N.isGroup&&!N.ignored?N:null}function h(x){if(x==null)return null;const N=r.get(x);return N&&!N.ignored?N:null}function p(x,N){const T=h(x);return T?T.getPrev(N):null}function y(x,N){const T=h(x);return T?T.getNext(N):null}function b(x){const N=h(x);return N?N.getParent():null}function _(x){const N=h(x);return N?N.getChild():null}const v={treeNodes:m,treeNodeMap:r,levelTreeNodeMap:o,maxLevel:Math.max(...o.keys()),getChildren:u,getFlattenedNodes(x){return Fw(m,x)},getNode:g,getPrev:p,getNext:y,getParent:b,getChild:_,getFirstAvailableNode(){return Nw(m)},getPath(x,N={}){return Tw(x,N,v)},getCheckedKeys(x,N={}){const{cascade:T=!0,leafOnly:k=!1,checkStrategy:$="all",allowNotLoaded:w=!1}=N;return Js({checkedKeys:Zs(x),indeterminateKeys:Qs(x),cascade:T,leafOnly:k,checkStrategy:$,allowNotLoaded:w},v)},check(x,N,T={}){const{cascade:k=!0,leafOnly:$=!1,checkStrategy:w="all",allowNotLoaded:B=!1}=T;return Js({checkedKeys:Zs(N),indeterminateKeys:Qs(N),keysToCheck:x==null?[]:au(x),cascade:k,leafOnly:$,checkStrategy:w,allowNotLoaded:B},v)},uncheck(x,N,T={}){const{cascade:k=!0,leafOnly:$=!1,checkStrategy:w="all",allowNotLoaded:B=!1}=T;return Js({checkedKeys:Zs(N),indeterminateKeys:Qs(N),keysToUncheck:x==null?[]:au(x),cascade:k,leafOnly:$,checkStrategy:w,allowNotLoaded:B},v)},getNonLeafKeys(x={}){return dw(m,x)}};return v}function Bo(t){return t.composedPath()[0]}const Aw={mousemoveoutside:new WeakMap,clickoutside:new WeakMap};function Ow(t,e,n){if(t==="mousemoveoutside"){const r=o=>{e.contains(Bo(o))||n(o)};return{mousemove:r,touchstart:r}}else if(t==="clickoutside"){let r=!1;const o=a=>{r=!e.contains(Bo(a))},s=a=>{r&&(e.contains(Bo(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 uu(t,e,n){const r=Aw[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=Ow(t,e,n)),s}function zw(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=uu(t,e,n);return Object.keys(o).forEach(s=>{Rt(s,document,o[s],r)}),!0}return!1}function Dw(t,e,n,r){if(t==="mousemoveoutside"||t==="clickoutside"){const o=uu(t,e,n);return Object.keys(o).forEach(s=>{at(s,document,o[s],r)}),!0}return!1}function Lw(){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(k,$,w){const B=k[$];return k[$]=function(){return w.apply(k,arguments),B.apply(k,arguments)},k}function s(k,$){k[$]=Event.prototype[$]}const a=new WeakMap,l=Object.getOwnPropertyDescriptor(Event.prototype,"currentTarget");function c(){var k;return(k=a.get(this))!==null&&k!==void 0?k:null}function d(k,$){l!==void 0&&Object.defineProperty(k,"currentTarget",{configurable:!0,enumerable:!0,get:$??l.get})}const u={bubble:{},capture:{}},f={};function m(){const k=function($){const{type:w,eventPhase:B,bubbles:E}=$,M=Bo($);if(B===2)return;const R=B===1?"capture":"bubble";let O=M;const W=[];for(;O===null&&(O=window),W.push(O),O!==window;)O=O.parentNode||null;const G=u.capture[w],Q=u.bubble[w];if(o($,"stopPropagation",n),o($,"stopImmediatePropagation",r),d($,c),R==="capture"){if(G===void 0)return;for(let H=W.length-1;H>=0&&!t.has($);--H){const P=W[H],D=G.get(P);if(D!==void 0){a.set($,P);for(const A of D){if(e.has($))break;A($)}}if(H===0&&!E&&Q!==void 0){const A=Q.get(P);if(A!==void 0)for(const L of A){if(e.has($))break;L($)}}}}else if(R==="bubble"){if(Q===void 0)return;for(let H=0;H<W.length&&!t.has($);++H){const P=W[H],D=Q.get(P);if(D!==void 0){a.set($,P);for(const A of D){if(e.has($))break;A($)}}}}s($,"stopPropagation"),s($,"stopImmediatePropagation"),d($)};return k.displayName="evtdUnifiedHandler",k}function g(){const k=function($){const{type:w,eventPhase:B}=$;if(B!==2)return;const E=f[w];E!==void 0&&E.forEach(M=>M($))};return k.displayName="evtdUnifiedWindowEventHandler",k}const h=m(),p=g();function y(k,$){const w=u[k];return w[$]===void 0&&(w[$]=new Map,window.addEventListener($,h,k==="capture")),w[$]}function b(k){return f[k]===void 0&&(f[k]=new Set,window.addEventListener(k,p)),f[k]}function _(k,$){let w=k.get($);return w===void 0&&k.set($,w=new Set),w}function v(k,$,w,B){const E=u[$][w];if(E!==void 0){const M=E.get(k);if(M!==void 0&&M.has(B))return!0}return!1}function x(k,$){const w=f[k];return!!(w!==void 0&&w.has($))}function N(k,$,w,B){let E;if(typeof B=="object"&&B.once===!0?E=G=>{T(k,$,E,B),w(G)}:E=w,zw(k,$,E,B))return;const R=B===!0||typeof B=="object"&&B.capture===!0?"capture":"bubble",O=y(R,k),W=_(O,$);if(W.has(E)||W.add(E),$===window){const G=b(k);G.has(E)||G.add(E)}}function T(k,$,w,B){if(Dw(k,$,w,B))return;const M=B===!0||typeof B=="object"&&B.capture===!0,R=M?"capture":"bubble",O=y(R,k),W=_(O,$);if($===window&&!v($,M?"bubble":"capture",k,w)&&x(k,w)){const Q=f[k];Q.delete(w),Q.size===0&&(window.removeEventListener(k,p),f[k]=void 0)}W.has(w)&&W.delete(w),W.size===0&&O.delete($),O.size===0&&(window.removeEventListener(k,h,R==="capture"),u[R][k]=void 0)}return{on:N,off:T}}const{on:Rt,off:at}=Lw(),Zi="@@mmoContext",Hw={mounted(t,{value:e}){t[Zi]={handler:void 0},typeof e=="function"&&(t[Zi].handler=e,Rt("mousemoveoutside",t,e))},updated(t,{value:e}){const n=t[Zi];typeof e=="function"?n.handler?n.handler!==e&&(at("mousemoveoutside",t,n.handler),n.handler=e,Rt("mousemoveoutside",t,e)):(t[Zi].handler=e,Rt("mousemoveoutside",t,e)):n.handler&&(at("mousemoveoutside",t,n.handler),n.handler=void 0)},unmounted(t){const{handler:e}=t[Zi];e&&at("mousemoveoutside",t,e),t[Zi].handler=void 0}},Qi="@@coContext",To={mounted(t,{value:e,modifiers:n}){t[Qi]={handler:void 0},typeof e=="function"&&(t[Qi].handler=e,Rt("clickoutside",t,e,{capture:n.capture}))},updated(t,{value:e,modifiers:n}){const r=t[Qi];typeof e=="function"?r.handler?r.handler!==e&&(at("clickoutside",t,r.handler,{capture:n.capture}),r.handler=e,Rt("clickoutside",t,e,{capture:n.capture})):(t[Qi].handler=e,Rt("clickoutside",t,e,{capture:n.capture})):r.handler&&(at("clickoutside",t,r.handler,{capture:n.capture}),r.handler=void 0)},unmounted(t,{modifiers:e}){const{handler:n}=t[Qi];n&&at("clickoutside",t,n,{capture:e.capture}),t[Qi].handler=void 0}};function Ww(t,e){console.error(`[vdirs/${t}]: ${e}`)}class jw{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&&Ww("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 ta=new jw,Ji="@@ziContext",hu={mounted(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n;t[Ji]={enabled:!!o,initialized:!1},o&&(ta.ensureZIndex(t,r),t[Ji].initialized=!0)},updated(t,e){const{value:n={}}=e,{zIndex:r,enabled:o}=n,s=t[Ji].enabled;o&&!s&&(ta.ensureZIndex(t,r),t[Ji].initialized=!0),t[Ji].enabled=!!o},unmounted(t,e){if(!t[Ji].initialized)return;const{value:n={}}=e,{zIndex:r}=n;ta.unregister(t,r)}};function qw(t){const e=i.ref(!!t.value);if(e.value)return i.readonly(e);const n=i.watch(t,r=>{r&&(e.value=!0,n())});return i.readonly(e)}function Zt(t){const e=i.computed(t),n=i.ref(e.value);return i.watch(e,r=>{n.value=r}),typeof t=="function"?n:{__v_isRef:!0,get value(){return n.value},set value(r){t.set(r)}}}const Xw=typeof window<"u";let er,Sr;(()=>{var t,e;er=Xw?(e=(t=document)===null||t===void 0?void 0:t.fonts)===null||e===void 0?void 0:e.ready:void 0,Sr=!1,er!==void 0?er.then(()=>{Sr=!0}):Sr=!0})();function Yw(t){if(Sr)return;let e=!1;i.onMounted(()=>{Sr||er==null||er.then(()=>{e||t()})}),i.onBeforeUnmount(()=>{e=!0})}function na(t,e){return i.watch(t,n=>{n!==void 0&&(e.value=n)}),i.computed(()=>t.value===void 0?e.value:t.value)}function No(){const t=i.ref(!1);return i.onMounted(()=>{t.value=!0}),i.readonly(t)}function fu(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 Uw=(typeof window>"u"?!1:/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;function Kw(){return Uw}function ia(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);return r()}function ra(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)){ra(r,e,n);return}if(r.type===i.Fragment){if(r.children===null)return;Array.isArray(r.children)&&ra(r.children,e,n)}else r.type!==i.Comment&&n.push(r)}}),n}function mu(t,e,n="default"){const r=e[n];if(r===void 0)throw new Error(`[vueuc/${t}]: slot[${n}] is empty.`);const o=ra(r());if(o.length===1)return o[0];throw new Error(`[vueuc/${t}]: slot[${n}] should have exactly one child.`)}let ei=null;function gu(){if(ei===null&&(ei=document.getElementById("v-binder-view-measurer"),ei===null)){ei=document.createElement("div"),ei.id="v-binder-view-measurer";const{style:t}=ei;t.position="fixed",t.left="0",t.right="0",t.top="0",t.bottom="0",t.pointerEvents="none",t.visibility="hidden",document.body.appendChild(ei)}return ei.getBoundingClientRect()}function Gw(t,e){const n=gu();return{top:e,left:t,height:0,width:0,right:n.width-t,bottom:n.height-e}}function oa(t){const e=t.getBoundingClientRect(),n=gu();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 Zw(t){return t.nodeType===9?null:t.parentNode}function pu(t){if(t===null)return null;const e=Zw(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 pu(e)}const yu=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=pu(b),b!==null;)s.push(b);for(const _ of s)Rt("scroll",_,f,!0)},l=()=>{for(const b of s)at("scroll",b,f,!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()},f=()=>{tu(m)},m=()=>{c.forEach(b=>b())},g=new Set,h=b=>{g.size===0&&Rt("resize",window,y),g.has(b)||g.add(b)},p=b=>{g.has(b)&&g.delete(b),g.size===0&&at("resize",window,y)},y=()=>{g.forEach(b=>b())};return i.onBeforeUnmount(()=>{at("resize",window,y),l()}),{targetRef:r,setTargetRef:o,addScrollListener:d,removeScrollListener:u,addResizeListener:h,removeResizeListener:p}},render(){return ia("binder",this.$slots)}}),bu=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(mu("follower",this.$slots),[[e]]):mu("follower",this.$slots)}}),Qw="@css-render/vue3-ssr";function Jw(t,e){return`<style cssr-id="${t}">
|
|
104
104
|
${e}
|
|
105
105
|
</style>`}function ex(t,e,n){const{styles:r,ids:o}=n;o.has(t)||r!==null&&(o.add(t),r.push(Jw(t,e)))}const tx=typeof document<"u";function wi(){if(tx)return;const t=i.inject(Qw,null);if(t!==null)return{adapter:(e,n)=>ex(e,n,t),context:t}}function _u(t,e){console.error(`[vueuc/${t}]: ${e}`)}function nx(t){let e=0;for(let n=0;n<t.length;++n)t[n]==="&"&&++e;return e}const wu=/\s*,(?![^(]*\))\s*/g,ix=/\s+/g;function rx(t,e){const n=[];return e.split(wu).forEach(r=>{let o=nx(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 ox(t,e){const n=[];return e.split(wu).forEach(r=>{t.forEach(o=>{n.push((o&&o+" ")+r)})}),n}function sx(t){let e=[""];return t.forEach(n=>{n=n&&n.trim(),n&&(n.includes("&")?e=rx(e,n):e=ox(e,n))}),e.join(", ").replace(ix," ")}function xu(t){if(!t)return;const e=t.parentElement;e&&e.removeChild(t)}function $o(t,e){return(e??document.head).querySelector(`style[cssr-id="${t}"]`)}function ax(t){const e=document.createElement("style");return e.setAttribute("cssr-id",t),e}function Eo(t){return t?/^\s*@(s|m)/.test(t):!1}const lx=/[A-Z]/g;function ku(t){return t.replace(lx,e=>"-"+e.toLowerCase())}function cx(t,e=" "){return typeof t=="object"&&t!==null?` {
|
|
106
106
|
`+Object.entries(t).map(n=>e+` ${ku(n[0])}: ${n[1]};`).join(`
|