import{r as t,e as i,h as a}from"./p-5ab6b26f.js";import{_ as e}from"./p-a41b3114.js";class l{constructor(a){t(this,a),this.visible=!1,this.featureCount=0,this.cancelText=e("webmapgl.draw-toolbar.cancel"),this.color="primary",this.confirmText=e("webmapgl.draw-toolbar.confirm"),this.label=e("webmapgl.draw-toolbar.label"),this.maxFeatures=1,this.minFeatures=1,this.glDrawCancel=i(this,"glDrawCancel",7),this.glDrawConfirm=i(this,"glDrawConfirm",7)}handleDrawEnter(t){t.detail.mapId==this.mapId&&(this.featureCount=0,this.visible=!0)}handleDrawExit(t){t.detail.mapId==this.mapId&&(this.visible=!1)}handleDrawCreate(t){t.detail.mapId==this.mapId&&(this.featureCount+=1)}handleDrawDelete(t){t.detail.mapId==this.mapId&&(this.featureCount-=1)}cancel(){this.glDrawCancel.emit({mapId:this.mapId})}confirm(){this.glDrawConfirm.emit({mapId:this.mapId})}render(){if(!this.visible)return;let t=screen.width<=640,i=this.featureCount>=this.minFeatures&&this.featureCount<=this.maxFeatures;return a("ion-toolbar",{color:this.color},a("ion-title",null,this.label),a("ion-buttons",{slot:"end"},a("ion-button",{onClick:()=>{this.cancel()}},a("ion-icon",{slot:t?"icon-only":"start",name:"close"}),t?null:this.cancelText),a("ion-button",{onClick:()=>{i&&this.confirm()},disabled:!i},a("ion-icon",{slot:t?"icon-only":"start",name:"checkmark"}),t?null:this.confirmText)))}}export{l as gl_draw_toolbar};