+ ${null===(i=this.tiles)||void 0===i?void 0:i.map((e=>D`
+
+ `))}
+ `}static get styles(){return r`
+ .tiles-wrapper {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: space-evenly;
+ align-items: stretch;
+ gap: 5px;
+ }
+
+ ${fc.styles}
+ `}};e([ue({attribute:!1})],bc.prototype,"tiles",void 0),e([ue({attribute:!1})],bc.prototype,"hass",void 0),e([ue({attribute:!1})],bc.prototype,"isInEditor",void 0),e([ue({attribute:!1})],bc.prototype,"onAction",void 0),e([ue({attribute:!1})],bc.prototype,"internalVariables",void 0),bc=e([le("xvmc-tiles-wrapper")],bc);let yc=class extends gc{render(){var e;const t=this.config.map((e=>{var t;return{icon:e.icon,name:null!==(t=e.label)&&void 0!==t?t:""}})),i=this.config.findIndex((e=>e.isSelected)),a=`icon-menu-${this.config[0].menu_id}`;return D`
+
this.onAction(this.config[e])()}
+ .renderNameCollapsed=${!1}
+ .additionalClasses=${[a,"dropdown-icon"]}>
+
+ `}static get styles(){return r`
+ .dropdown-icon * .dropdown-menu-button-button {
+ background-color: transparent;
+ }
+ `}};e([ue({attribute:!1})],yc.prototype,"config",void 0),e([ue({attribute:!1})],yc.prototype,"isInEditor",void 0),e([ue({attribute:!1})],yc.prototype,"onAction",void 0),yc=e([le("xvmc-dropdown-icon")],yc);let kc=class extends gc{render(){var e,t,i;return D`
+
+
+
+ `}static get styles(){return r`
+ .single-icon {
+ float: left;
+ width: 50px;
+ height: 50px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ background-color: transparent;
+ border-radius: var(--map-card-internal-big-radius);
+ }
+ `}};e([ue({attribute:!1})],kc.prototype,"config",void 0),e([ue({attribute:!1})],kc.prototype,"isInEditor",void 0),e([ue({attribute:!1})],kc.prototype,"onAction",void 0),kc=e([le("xvmc-single-icon")],kc);let Ac=class extends gc{render(){return Array.isArray(this.config)?D`
+
+
+ `:D`
+
+
+ `}static get styles(){return r`
+ ${kc.styles}
+ ${yc.styles}
+ `}};var xc;e([ue({attribute:!1})],Ac.prototype,"config",void 0),e([ue({attribute:!1})],Ac.prototype,"isInEditor",void 0),e([ue({attribute:!1})],Ac.prototype,"onAction",void 0),Ac=e([le("xvmc-icon")],Ac);let Ec=xc=class extends gc{render(){var e,t,i;if(0!==(null!==(t=null===(e=this.icons)||void 0===e?void 0:e.length)&&void 0!==t?t:0))return D`
+
+
+ ${null===(i=this.icons)||void 0===i?void 0:i.map((e=>D`
+
+ `))}
+
+
+ `}static get styles(){return r`
+ .icons-wrapper {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ }
+
+ .icons-list {
+ float: right;
+ border-radius: var(--map-card-internal-big-radius);
+ overflow: hidden;
+ background-color: var(--map-card-internal-secondary-color);
+ color: var(--map-card-internal-secondary-text-color);
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: center;
+ }
+
+ ${Ac.styles}
+ `}static preprocessIcons(e,t,i){if(void 0===e)return[];const a=[],n=new Map;xc.expandMenus(e,t,i).forEach((e=>{const o=Qs(e,t,i);if(void 0===e.menu_id)o&&a.push(e);else{const t=Object.assign(Object.assign({},e),{isSelected:o});n.has(e.menu_id)&&Array.isArray(a[n.get(e.menu_id)])?a[n.get(e.menu_id)].push(t):(n.set(e.menu_id,a.length),a.push([t]))}}));for(let e=a.length-1;e>=0;e--)Array.isArray(a[e])&&!a[e].some((e=>e.isSelected))&&a.splice(e,1);return a}static expandMenus(e,t,i){return e.flatMap((e=>"menu"===e.type?xc.expandMenu(e,t,i):[e]))}static expandMenu(e,t,i){var a;const n=i.states[e.entity];return(null!==(a=n.attributes[e.available_values_attribute])&&void 0!==a?a:[]).map((t=>{var a,o,r,s,l,c;return Object.assign(Object.assign({},e),{label:null!==(o=null===(a=e.value_translation_keys)||void 0===a?void 0:a[t])&&void 0!==o?o:xc.getLabel(i,n,t,e.current_value_attribute),icon:null!==(s=null===(r=e.icon_mapping)||void 0===r?void 0:r[t])&&void 0!==s?s:e.icon,icon_id:`${e.icon_id}_${t.replace(" ","_").toLowerCase()}`,conditions:[...null!==(l=e.conditions)&&void 0!==l?l:[],{entity:e.entity,attribute:e.current_value_attribute,value:`${t}`}],variables:Object.assign(Object.assign({},null!==(c=null==e?void 0:e.variables)&&void 0!==c?c:{}),{value:t})})}))}static getLabel(e,t,i,a){return a?function(e,t,i,a){return Do(e.localize,t,e.locale,e.entities,i,a)}(e,t,a,i):function(e,t,i){return Go(e.localize,t,e.locale,e.entities,i)}(e,t,i)}};e([ue({attribute:!1})],Ec.prototype,"icons",void 0),e([ue({attribute:!1})],Ec.prototype,"isInEditor",void 0),e([ue({attribute:!1})],Ec.prototype,"onAction",void 0),Ec=xc=e([le("xvmc-icons-wrapper")],Ec);let wc=class extends gc{render(){var e;if(this.availablePresets.length<2)return;const t="rtl"===(null===(e=getComputedStyle(this))||void 0===e?void 0:e.getPropertyValue("direction"));return D`
+
+
+
+
+
+
this.executePresetsActivation()}">
+
${this.presetName}
+
+ ${new Array(this.availablePresets.length).fill(0).map(((e,t)=>t===this.availablePresetIndex?"●":"○"))}
+
+
+
+
+
+
+
+ `}static get styles(){return r`
+ .preset-selector-wrapper {
+ width: 100%;
+ display: inline-flex;
+ align-content: center;
+ justify-content: space-between;
+ align-items: center;
+ }
+
+ .preset-selector-icon-wrapper {
+ height: 44px;
+ width: 44px;
+ display: grid;
+ place-items: center;
+ }
+
+ .preset-selector-icon {
+ cursor: pointer;
+ }
+
+ .preset-selector-icon.disabled {
+ color: var(--map-card-internal-disabled-text-color);
+ cursor: default;
+ }
+
+ .preset-label-wrapper {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ }
+
+ .preset-indicator {
+ line-height: 50%;
+ }
+ `}};var zc;e([ue({attribute:!1})],wc.prototype,"availablePresets",void 0),e([ue({attribute:!1})],wc.prototype,"availablePresetIndex",void 0),e([ue({attribute:!1})],wc.prototype,"openPreviousPreset",void 0),e([ue({attribute:!1})],wc.prototype,"previousPresetIndex",void 0),e([ue({attribute:!1})],wc.prototype,"presetActivable",void 0),e([ue({attribute:!1})],wc.prototype,"presetName",void 0),e([ue({attribute:!1})],wc.prototype,"executePresetsActivation",void 0),e([ue({attribute:!1})],wc.prototype,"openNextPreset",void 0),e([ue({attribute:!1})],wc.prototype,"nextPresetIndex",void 0),wc=e([le("xvmc-preset-selector")],wc);const Pc=" XIAOMI-VACUUM-MAP-CARD",Mc=` ${Wo("common.version")} ${zs}`,Tc=Math.max(25,Mc.length)+3,Sc=(e,t)=>e+" ".repeat(t-e.length);console.info(`%c${Sc(Pc,Tc)}\n%c${Sc(Mc,Tc)}`,"color: orange; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray");const Cc=window;Cc.customCards=Cc.customCards||[],Cc.customCards.push({type:Ps,name:"Vacuum Map Card",description:Wo("common.description")});let Oc=zc=class extends re{constructor(){super(),this.oldConfig=!1,this.repeats=1,this.selectedMode=0,this.mapLocked=!1,this.configErrors=[],this.connected=!1,this.internalVariables={},this.watchedEntities=[],this.selectedManualRectangles=[],this.selectedManualPath=new Hl([],this._getContext()),this.selectedPredefinedRectangles=[],this.selectedRooms=[],this.selectedPredefinedPoint=[],this.selectablePredefinedRectangles=[],this.selectableRooms=[],this.selectablePredefinedPoints=[],this.modes=[],this.isInEditor=!1,this._handleAutogeneratedConfigGet=this._handleAutogeneratedConfigGet.bind(this),this._handleRoomsConfigGet=this._handleRoomsConfigGet.bind(this),this._handleServiceCallGet=this._handleServiceCallGet.bind(this),this._handleLovelaceDomEvent=this._handleLovelaceDomEvent.bind(this)}get hass(){return this._hass}set hass(e){const t=!this._hass&&e;this._hass=e,this.lastHassUpdate=new Date,t&&this._firstHass()}static async getConfigElement(){return document.createElement(Ms)}static getStubConfig(e){const t=Object.keys(e.states),i=t.filter((e=>"camera"===e.substr(0,e.indexOf(".")))).filter((t=>null==e?void 0:e.states[t].attributes.calibration_points)),a=t.filter((e=>"vacuum"===e.substr(0,e.indexOf("."))));if(0!==i.length&&0!==a.length)return{type:"custom:"+Ps,map_source:{camera:i[0]},calibration_source:{camera:!0},entity:a[0],vacuum_platform:ws.XIAOMI_MIIO_PLATFORM}}setConfig(e){if(!e)throw new Error(this._localize("common.invalid_configuration"));this.config=e,function(e){return e.map_image||e.map_camera}(e)?this.oldConfig=!0:(this.configErrors=function(e){var t,i,a;const n=[],o=(null!==(i=null===(t=e.additional_presets)||void 0===t?void 0:t.length)&&void 0!==i?i:0)>0;return Jl(e,o,e.language).forEach((e=>n.push(e))),null===(a=e.additional_presets)||void 0===a||a.flatMap((t=>Jl(t,o,e.language))).forEach((e=>n.push(e))),n.map((t=>Wo(t,e.language)))}(this.config),this.configErrors.length>0||(this.watchedEntities=Ws(this.config),this._setPresetIndex(0,!1,!0),this.requestUpdate("config")))}getCardSize(){return 12}connectedCallback(){super.connectedCallback(),this._isInEditor()&&(window.addEventListener(Os,this._handleAutogeneratedConfigGet),window.addEventListener(Rs,this._handleRoomsConfigGet),window.addEventListener(js,this._handleServiceCallGet),this.isInEditor=!0),document.addEventListener(Is,this._handleLovelaceDomEvent),this.connected=!0,this._updateElements(),ol(100).then((()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this._isInEditor()&&(window.removeEventListener(Os,this._handleAutogeneratedConfigGet),window.removeEventListener(Rs,this._handleRoomsConfigGet),window.removeEventListener(js,this._handleServiceCallGet)),document.removeEventListener(Is,this._handleLovelaceDomEvent),this.connected=!1}shouldUpdate(e){return!!this.config&&function(e,t,i,a){if(t.has("config")||i)return!0;const n=t.get("hass");return!n||e.some((e=>n.states[e]!==(null==a?void 0:a.states[e])))}(this.watchedEntities,e,!1,this.hass)}render(){var e,t,i,a,n,o,r,s,l,c,d,u;if(this.oldConfig)return this._showOldConfig();if(this.configErrors.length>0)return this._showConfigErrors(this.configErrors);const m=function(e,t){const i=Object.keys(t.states);return e.filter((e=>!i.includes(e)))}(this.watchedEntities,this.hass);if(m.length>0)return this._showInvalidEntities(m);let p=this._getCurrentPreset();const _=this._getAllPresets();let v=this._getAllAvailablePresets(),g=v.indexOf(_[this.presetIndex]);-1===g&&(this._firstHass(),p=this._getCurrentPreset(),v=this._getAllAvailablePresets(),g=v.indexOf(_[this.presetIndex])),this._updateCalibration(p);const h=null===(e=p.tiles)||void 0===e?void 0:e.filter((e=>Qs(e,this.internalVariables,this.hass))),f=Ec.preprocessIcons(p.icons,this.internalVariables,this.hass),b=this.modes,y=this._getMapSrc(p),k=!!this.coordinatesConverter&&this.coordinatesConverter.calibrated,A=k?this._createMapControls():[],x=D`
+
+
this._calculateBasicScale()}" />
+
+
+
+
+ `;return D`
+
+ ${el((null!==(c=this.config.title)&&void 0!==c?c:"").length>0,(()=>D``))}
+ this._openPreviousPreset()}
+ .previousPresetIndex=${this._getPreviousPresetIndex()}
+ .presetActivable=${void 0!==p.activate}
+ .presetName=${p.preset_name}
+ .executePresetsActivation=${()=>this._executePresetsActivation()}
+ .openNextPreset=${()=>this._openNextPreset()}
+ .nextPresetIndex=${this._getNextPresetIndex()}>
+
+
+ ${el(!k,(()=>this._showInvalidCalibrationWarning()))}
+ ${el(b.length>1||A.length>0||0!==(null!==(d=null==f?void 0:f.length)&&void 0!==d?d:0)||0!==(null!==(u=null==h?void 0:h.length)&&void 0!==u?u:0),(()=>D`
+
+ ${el(k&&(b.length>1||A.length>0),(()=>D`
+
+
+ ${el(b.length>1,(()=>D`
+
this._setCurrentMode(e)}
+ .renderNameCollapsed=${!0}>
+
+ `))}
+ ${el(A.length>0,(()=>D`
${A}
`))}
+
+
+ `))}
+
tl(this,e,t)}>
+
+
tl(this,e,t)}
+ .internalVariables=${this.internalVariables}>
+
+
`))}
+ ${dl.render("map-card")}
+
+ `}updated(e){this._updateElements()}_getCurrentPreset(){return this.currentPreset}_getCalibration(e){var t,i,a,n,o,r,s,l,c,d,u,m,p;if(null===(t=e.calibration_source)||void 0===t?void 0:t.identity)return[{map:{x:0,y:0},vacuum:{x:0,y:0}},{map:{x:1,y:0},vacuum:{x:1,y:0}},{map:{x:0,y:1},vacuum:{x:0,y:1}}];if((null===(i=e.calibration_source)||void 0===i?void 0:i.calibration_points)&&[3,4].includes(e.calibration_source.calibration_points.length))return e.calibration_source.calibration_points;if(!this.hass)return;if((null===(a=e.calibration_source)||void 0===a?void 0:a.entity)&&!(null===(n=e.calibration_source)||void 0===n?void 0:n.attribute))return JSON.parse(null===(o=this.hass.states[e.calibration_source.entity])||void 0===o?void 0:o.state);if((null===(r=e.calibration_source)||void 0===r?void 0:r.entity)&&(null===(s=e.calibration_source)||void 0===s?void 0:s.attribute))return null===(l=this.hass.states[e.calibration_source.entity])||void 0===l?void 0:l.attributes[e.calibration_source.attribute];if(null===(c=e.calibration_source)||void 0===c?void 0:c.camera)return null===(m=this.hass.states[null!==(u=null===(d=e.map_source)||void 0===d?void 0:d.camera)&&void 0!==u?u:""])||void 0===m?void 0:m.attributes.calibration_points;if(null===(p=e.calibration_source)||void 0===p?void 0:p.platform)return ws.getCalibration(e.calibration_source.platform);const _=ws.getCalibration(e.vacuum_platform);return _||void 0}_firstHass(){if(0===this.configErrors.length&&!this.oldConfig){const e=this._getAllPresets(),t=this._getAllAvailablePresets(),i=e.indexOf(t[0]);this._setPresetIndex(i,!1,!0)}}_getAllPresets(){var e;return[this.config,...null!==(e=this.config.additional_presets)&&void 0!==e?e:[]]}_getAllAvailablePresets(){const e=this._getAllPresets(),t=e.filter((e=>{var t,i;return 0===(null!==(i=null===(t=e.conditions)||void 0===t?void 0:t.length)&&void 0!==i?i:0)||Qs(e,this.internalVariables,this.hass)}));return 0===t.length?[e[0]]:t}_getPreviousPresetIndex(){const e=this._getAllPresets(),t=e.filter(((e,t)=>{var i,a;return t
{var i,a;return t>this.presetIndex&&(0===(null!==(a=null===(i=e.conditions)||void 0===i?void 0:i.length)&&void 0!==a?a:0)||Qs(e,this.internalVariables,this.hass))}));return 0==t.length?-1:e.indexOf(t[0])}_openPreviousPreset(){const e=this._getPreviousPresetIndex();e>=0&&this._setPresetIndex(e,!0)}_openNextPreset(){const e=this._getNextPresetIndex();e>=0&&this._setPresetIndex(e,!0)}_setPresetIndex(e,t=!1,i=!1){var a,n,o,r,s;if((e=Math.min(Math.max(e,0),null!==(n=null===(a=this.config.additional_presets)||void 0===a?void 0:a.length)&&void 0!==n?n:0))===this.presetIndex&&!i)return;const l=0===e?this.config:(null!==(o=this.config.additional_presets)&&void 0!==o?o:[])[e-1];this.mapLocked||null===(r=this._getPinchZoom())||void 0===r||r.setTransform({scale:1,x:0,y:0,allowChangeEvent:!0}),t&&ke("selection"),this.mapLocked=null!==(s=null==l?void 0:l.map_locked)&&void 0!==s&&s,this.selectedMode=0,this.realScale=1,this.mapScale=1,this.mapX=0,this.mapY=0,this.hass&&this._updateCalibration(l),this.modes=this._getModes(l),this.presetIndex=e,this.currentPreset=l,this.internalVariables=this._getInternalVariables(l),this._getIconsAndTiles(l,this.internalVariables).then((([e,t])=>this._setPreset(Object.assign(Object.assign({},l),{tiles:t,icons:e})))).then((()=>setTimeout((()=>this.requestUpdate()),100))).then((()=>this._setCurrentMode(0,!1))),t&&this.currentPreset.activate_on_switch&&this._executePresetsActivation(),this._selectionChanged()}_getInternalVariables(e){var t,i;return Object.assign(Object.assign({},null!==(t=ws.getVariables(e.vacuum_platform))&&void 0!==t?t:{}),null!==(i=e.internal_variables)&&void 0!==i?i:{})}_getIconsAndTiles(e,t){var i,a;const n=ws.getPlatformName(e.vacuum_platform),o=Wl.generate(this.hass,e.icons,e.entity,n,t,this.config.language,null!==(i=e.append_icons)&&void 0!==i&&i,(e=>e.icon_id),nc,ac.generate),r=Wl.generate(this.hass,e.tiles,e.entity,n,t,this.config.language,null!==(a=e.append_tiles)&&void 0!==a&&a,(e=>e.tile_id),tc,ec.generate);return Promise.all([o,r])}_getModes(e){var t,i,a;const n=ws.getPlatformName(e.vacuum_platform);return(-1===(null!==(i=null===(t=e.map_modes)||void 0===t?void 0:t.length)&&void 0!==i?i:-1)||n.startsWith("Setup")?ws.generateDefaultModes(n):null!==(a=e.map_modes)&&void 0!==a?a:[Vs]).map((e=>new Gs(n,e,this.config.language)))}_executePresetsActivation(){if(this.currentPreset.activate){const e=new Xs(this.currentPreset.activate).apply(this.currentPreset.entity,[],0,{});this.hass.callService(e.domain,e.service,e.serviceData,e.target).then((()=>ke("success")))}}_setPreset(e){this.currentPreset=e,this.watchedEntities=Ws(Object.assign({type:""},e))}_updateCalibration(e){this.coordinatesConverter=void 0;const t=this._getCalibration(e);this.coordinatesConverter=new vc(t)}_getMapSrc(e){if(e.map_source.camera){if(this.connected&&this.lastHassUpdate&&this.lastHassUpdate.getTime()+36e4>=(new Date).getTime()){return`${this.hass.hassUrl(this.hass.states[e.map_source.camera].attributes.entity_picture)}&v=${+new Date}`}return Ss}return e.map_source.image?`${e.map_source.image}`:Ss}_createMapControls(){const e=[],t=this._getCurrentMode();return t?(t.selectionType===tr.MANUAL_RECTANGLE&&e.push(D`
+ this._addRectangle()}">
+
+
+ `),t.selectionType===tr.MANUAL_PATH&&e.push(D`
+ {this.selectedManualPath.removeLast(),ke("selection"),this._selectionChanged(),this.requestUpdate()}}">
+
+
+ {this.selectedManualPath.clear(),ke("selection"),this._selectionChanged(),this.requestUpdate()}}">
+
+
+ `),t.repeatsType!==ir.NONE&&e.push(D`
+ {this.repeats=this.repeats%t.maxRepeats+1,this._selectionChanged(),ke("selection")}}">
+ ×${this.repeats}
+
+ `),t.runImmediately||e.push(D`
+
+
+
+
+ `),e):[]}_getContext(){return new Vl((()=>this.mapScale),(()=>this.realScale),(e=>this._getMousePosition(e)),(()=>this.requestUpdate()),(()=>this._selectionChanged()),(()=>this.coordinatesConverter),(()=>this.selectedManualRectangles),(()=>this.selectedPredefinedRectangles),(()=>this.selectedRooms),(()=>this.selectedPredefinedPoint),(()=>{var e,t;return null!==(t=null===(e=this._getCurrentMode())||void 0===e?void 0:e.coordinatesRounding)&&void 0!==t&&t}),(()=>{var e,t;return null!==(t=null===(e=this._getCurrentMode())||void 0===e?void 0:e.coordinatesToMetersDivider)&&void 0!==t?t:1}),(()=>{var e,t;return null!==(t=null===(e=this._getCurrentMode())||void 0===e?void 0:e.maxSelections)&&void 0!==t?t:0}),(e=>this._getCssProperty(e)),(()=>this._runImmediately()),(e=>this._localize(e)))}_getMousePosition(e){return al(e,this._getSvgWrapper(),this.mapScale)}_setCurrentMode(e,t=!0){const i=this.modes[e];switch(this.selectedManualRectangles=[],this.selectedManualPoint=void 0,this.selectedManualPath.clear(),this.selectedPredefinedRectangles=[],this.selectedRooms=[],this.selectedPredefinedPoint=[],this.selectablePredefinedRectangles=[],this.selectableRooms=[],this.selectablePredefinedPoints=[],null==i?void 0:i.selectionType){case tr.PREDEFINED_RECTANGLE:const e=Xl.getFromEntities(i,this.hass,(()=>this._getContext())),t=i.predefinedSelections.map((e=>e)).filter((e=>"string"!=typeof e.zones)).map((e=>new Xl(e,this._getContext())));this.selectablePredefinedRectangles=e.concat(t);break;case tr.ROOM:this.selectableRooms=i.predefinedSelections.map((e=>new Gl(e,this._getContext())));break;case tr.PREDEFINED_POINT:const a=Kl.getFromEntities(i,this.hass,(()=>this._getContext())),n=i.predefinedSelections.map((e=>e)).filter((e=>"string"!=typeof e.position)).map((e=>new Kl(e,this._getContext())));this.selectablePredefinedPoints=a.concat(n)}this.selectedMode!=e&&t&&ke("selection"),this.selectedMode=e,this._selectionChanged()}_getCurrentMode(){return this.modes[this.selectedMode]}_getSelection(e){var t,i,a,n,o,r,s;if(!e)return{selection:[],variables:{}};const l=e.repeatsType===ir.INTERNAL?this.repeats:null;let c=[],d={};const u=e=>{var t,i;return Object.assign(Object.assign({},null!==(i=null===(t=e[0])||void 0===t?void 0:t.variables)&&void 0!==i?i:{}),{variables:e.map((e=>{var t;return null!==(t=null==e?void 0:e.variables)&&void 0!==t?t:{}}))})};switch(e.selectionType){case tr.MANUAL_RECTANGLE:c=this.selectedManualRectangles.map((e=>e.toVacuum(l))),d=u(this.selectedManualRectangles);break;case tr.PREDEFINED_RECTANGLE:c=this.selectedPredefinedRectangles.map((e=>e.toVacuum(l))).reduce(((e,t)=>e.concat(t)),[]),d=null!==(i=null===(t=this.selectedPredefinedRectangles[0])||void 0===t?void 0:t.variables)&&void 0!==i?i:{},d=u(this.selectedPredefinedRectangles);break;case tr.ROOM:const m=this.selectedRooms.map((e=>e.toVacuum())).map((t=>zc.adjustRoomId(t,e)));c=[...m,...l&&m.length>0?[l]:[]],d=null!==(n=null===(a=this.selectedRooms[0])||void 0===a?void 0:a.variables)&&void 0!==n?n:{},d=u(this.selectedRooms);break;case tr.MANUAL_PATH:c=this.selectedManualPath.toVacuum(l),d=null!==(o=this.selectedManualPath.variables)&&void 0!==o?o:{},d=u([this.selectedManualPath]);break;case tr.MANUAL_POINT:c=null!==(s=null===(r=this.selectedManualPoint)||void 0===r?void 0:r.toVacuum(l))&&void 0!==s?s:[],d=u([this.selectedManualPoint]);break;case tr.PREDEFINED_POINT:c=this.selectedPredefinedPoint.map((e=>e.toVacuum(l))).reduce(((e,t)=>e.concat(t)),[]),d=u(this.selectedPredefinedPoint)}return e.repeatsType===ir.REPEAT&&(c=Array(this.repeats).fill(0).flatMap((()=>c))),{selection:c,variables:d}}async _runImmediately(){var e,t;return!(null===(t=null===(e=this._getCurrentMode())||void 0===e?void 0:e.runImmediately)||void 0===t||!t)&&(await this._run(!1),!0)}_selectionChanged(){const e=this._getCurrentMode(),{selection:t}=this._getSelection(e);if(this.isInEditor){const e=new Event(Cs);e.selection=null!=t?t:"[]",window.dispatchEvent(e)}}_isInEditor(){return function e(t){var i,a,n,o,r,s,l,c,d,u,m;return"hui-card"===(null===(a=null===(i=t.parentElement)||void 0===i?void 0:i.tagName)||void 0===a?void 0:a.toLowerCase())&&"preview"in(null!==(o=null===(n=t.parentElement)||void 0===n?void 0:n.attributes)&&void 0!==o?o:[])||"hui-section"===(null===(s=null===(r=t.parentElement)||void 0===r?void 0:r.tagName)||void 0===s?void 0:s.toLowerCase())&&"preview"in(null!==(c=null===(l=t.parentElement)||void 0===l?void 0:l.attributes)&&void 0!==c?c:[])||"hui-card-preview"===(null===(u=null===(d=t.parentElement)||void 0===d?void 0:d.tagName)||void 0===u?void 0:u.toLowerCase())||null!=t.parentElement&&e(t.parentElement)||"[object ShadowRoot]"==(null===(m=t.parentNode)||void 0===m?void 0:m.toString())&&e(t.getRootNode().host)}(this)}async _handleAutogeneratedConfigGet(){var e;const t=new Event(Ns),i=await Promise.all((null!==(e=this.config.additional_presets)&&void 0!==e?e:[]).map((async e=>await this._getConfigOfPreset(e))));t.presetConfig=Object.assign(Object.assign(Object.assign({},this.config),await this._getConfigOfPreset(this.config)),{additional_presets:i}),window.dispatchEvent(t)}async _getConfigOfPreset(e){const t=this._getInternalVariables(e),[i,a]=await this._getIconsAndTiles(e,t);return Object.assign(Object.assign({},e),{icons:JSON.parse(JSON.stringify(i)),tiles:JSON.parse(JSON.stringify(a)),map_modes:this._getModes(e).map((e=>e.toMapModeConfig()))})}_handleRoomsConfigGet(){const e=new Event($s);e.roomConfig=this._getRoomsConfig(),window.dispatchEvent(e)}async _handleServiceCallGet(){const e=this._getCurrentPreset(),t=this._getCurrentMode(),{selection:i,variables:a}=this._getSelection(t);if(0!=i.length&&t){const n=await t.getServiceCall(this.hass,e.entity,i,this.repeats,Object.assign(Object.assign({},this.internalVariables),a)),o=new Event(Ls);o.serviceCall=JSON.stringify(n,null,2),window.dispatchEvent(o)}else this._showToast("popups.no_selection","mdi:close",!1),ke("failure")}async _handleLovelaceDomEvent(e){var t;const i=e;if(Ds in i.detail&&"action_handler_id"in i.detail[Ds]&&i.detail[Ds].action_handler_id===(null!==(t=this.config.action_handler_id)&&void 0!==t?t:"this")){const e=i.detail[Ds];if(void 0===e.action)return;const t=e.action,a=e.data,n=this._getCurrentMode();switch(t){case ml.CLEANING_START:await this._run(!1);break;case ml.INTERNAL_VARIABLE_SET:this._setInternalVariable(a.variable,a.value);break;case ml.MAP_MODE_NEXT:this._setCurrentMode((this.selectedMode+1)%this.modes.length,!1);break;case ml.MAP_MODE_PREVIOUS:this._setCurrentMode((this.selectedMode-1+this.modes.length)%this.modes.length,!1);break;case ml.MAP_MODE_SET:this._setCurrentMode(a.index%this.modes.length,!1);break;case ml.REPEATS_DECREMENT:n&&(this.repeats=(this.repeats+n.maxRepeats-2)%n.maxRepeats+1);break;case ml.REPEATS_INCREMENT:n&&(this.repeats=this.repeats%n.maxRepeats+1);break;case ml.REPEATS_SET:n&&(this.repeats=(a.value+n.maxRepeats-1)%n.maxRepeats+1);break;case ml.SELECTION_CLEAR:this._setCurrentMode(this.selectedMode)}}}_setInternalVariable(e,t){const i=Object.assign({},this.internalVariables);i[e]=t,this.internalVariables=i,this.requestUpdate()}_getRoomsConfig(){var e,t,i,a,n,o,r,s,l,c;const d=this._getCurrentPreset(),u=null===(i=this.hass.states[null!==(t=null===(e=d.map_source)||void 0===e?void 0:e.camera)&&void 0!==t?t:""])||void 0===i?void 0:i.attributes.rooms,m=new Array;if(u){const e=this.modes.filter((e=>e.selectionType===tr.ROOM)).reverse()[0],t=e?this.modes.indexOf(e):-1;for(const e in u){if(!u.hasOwnProperty(e))continue;const t=u[e];if(!(t.outline||t.x0||t.y0||t.x1||t.y1))continue;const i=null!==(a=t.outline)&&void 0!==a?a:[[t.x0,t.y0],[t.x1,t.y0],[t.x1,t.y1],[t.x0,t.y1]],d=i.toString().includes("."),p=(e,t=1)=>d?e/t:Math.round(e/t),_=i.reduce(((e,t)=>{var i;return e+(null!==(i=t[0])&&void 0!==i?i:0)}),0),v=i.reduce(((e,t)=>{var i;return e+(null!==(i=t[1])&&void 0!==i?i:0)}),0),g={id:e,icon:{name:null!==(n=t.icon)&&void 0!==n?n:"mdi:broom",x:null!==(o=t.x)&&void 0!==o?o:p(_,i.length),y:null!==(r=t.y)&&void 0!==r?r:p(v,i.length)},label:{text:null!==(s=t.name)&&void 0!==s?s:`Room ${e}`,x:null!==(l=t.x)&&void 0!==l?l:p(_,i.length),y:null!==(c=t.y)&&void 0!==c?c:p(v,i.length),offset_y:35},outline:i};m.push(g)}return{modeIndex:t,rooms:m}}}static adjustRoomId(e,t){return"number"===t.idType?+e:e}async _run(e){var t,i;const a=this._getCurrentPreset(),n=this._getCurrentMode(),{selection:o,variables:r}=this._getSelection(n);if(0!=o.length&&n){const i=this.repeats,s=await n.getServiceCall(this.hass,a.entity,o,i,Object.assign(Object.assign({},this.internalVariables),r));if(e||null!==(t=this.config.debug)&&void 0!==t&&t){const e=JSON.stringify(s,null,2);this._showToast("popups.success","mdi:check",!0),console.log(e),window.alert(e),ke("success")}else this.hass.callService(s.domain,s.service,s.serviceData,s.target).then((()=>{this._showToast("popups.success","mdi:check",!0),ke("success")}),(e=>{this._showToast("popups.failed","mdi:close",!1,e.message),ke("failure")}))}else this._showToast("popups.no_selection","mdi:close",!1),ke("failure");(null===(i=a.clean_selection_on_start)||void 0===i||i)&&this._setCurrentMode(this.selectedMode),this._selectionChanged()}_updateElements(){var e,t;const i=null===(t=null===(e=this._modesDropdownMenu)||void 0===e?void 0:e.shadowRoot)||void 0===t?void 0:t.querySelector(".dropdown-content");i&&(i.style.borderRadius=this._getCssProperty("--map-card-internal-big-radius")),ol(100).then((()=>this._calculateBasicScale()))}_drawSelection(){var e,t,i;switch(null===(e=this._getCurrentMode())||void 0===e?void 0:e.selectionType){case tr.MANUAL_RECTANGLE:return V`${this.selectedManualRectangles.map((e=>e.render()))}`;case tr.PREDEFINED_RECTANGLE:return V`${this.selectablePredefinedRectangles.map((e=>e.render()))}`;case tr.ROOM:return V`${this.selectableRooms.map((e=>e.render()))}`;case tr.MANUAL_PATH:return V`${null===(t=this.selectedManualPath)||void 0===t?void 0:t.render()}`;case tr.MANUAL_POINT:return V`${null===(i=this.selectedManualPoint)||void 0===i?void 0:i.render()}`;case tr.PREDEFINED_POINT:return V`${this.selectablePredefinedPoints.map((e=>e.render()))}`;default:return null}}_toggleLock(){this.mapLocked=!this.mapLocked,ke("selection"),ol(500).then((()=>this.requestUpdate()))}_addRectangle(){var e,t,i,a,n,o,r,s;const l=this._getCurrentPreset(),c=this._getCurrentMode(),d=null!==(t=null===(e=l.map_source.crop)||void 0===e?void 0:e.top)&&void 0!==t?t:0,u=null!==(a=null===(i=l.map_source.crop)||void 0===i?void 0:i.bottom)&&void 0!==a?a:0,m=null!==(o=null===(n=l.map_source.crop)||void 0===n?void 0:n.left)&&void 0!==o?o:0,p=null!==(s=null===(r=l.map_source.crop)||void 0===r?void 0:r.right)&&void 0!==s?s:0;if(this._calculateBasicScale(),!c||this.selectedManualRectangles.length>=c.maxSelections)return void ke("failure");const _=this.realImageHeight*this.realScale-d-u,v=this.realImageWidth*this.realScale-m-p,g=(this.selectedManualRectangles.length+1).toString(),h=(v/3+m-this.mapX)/this.mapScale,f=(_/3+d-this.mapY)/this.mapScale,b=v/3/this.mapScale,y=_/3/this.mapScale;this.selectedManualRectangles.push(new Dl(h,f,b,y,g,this._getContext())),this._selectionChanged(),ke("selection"),this.requestUpdate()}_mouseDown(e){e instanceof MouseEvent&&0!=e.button||(this.shouldHandleMouseUp=!0)}_mouseMove(e){e.target.classList.contains("draggable")||(this.selectedManualRectangles.filter((e=>e.isSelected())).forEach((t=>t.externalDrag(e))),this.shouldHandleMouseUp=!1)}_mouseUp(e){const t=this._getCurrentMode();if(!(e instanceof MouseEvent&&0!=e.button)&&this.shouldHandleMouseUp&&t){const{x:i,y:a}=al(e,this._getSvgWrapper(),1);switch(t.selectionType){case tr.MANUAL_PATH:ke("selection"),this.selectedManualPath.addPoint(i,a),this._selectionChanged();break;case tr.MANUAL_POINT:ke("selection"),this.selectedManualPoint=new Ul(i,a,this._getContext()),this._selectionChanged();break;default:return}Zs(e),this.requestUpdate()}this.shouldHandleMouseUp=!1}_handleRunAction(){return async e=>{var t;if(this.hass&&(null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.action))switch(e.detail.action){case"tap":await this._run(!1);break;case"hold":await this._run(!0);break;case"double_tap":console.log(JSON.stringify(Object.assign(Object.assign({},this._getCurrentPreset()),{additional_presets:void 0,title:void 0,type:void 0}),null,2)),window.alert("Configuration available in browser's console"),ke("success")}}}_restoreMap(){const e=this._getMapZoomerContent();e.style.transitionDuration=this._getCssProperty("--map-card-internal-transitions-duration"),this._getPinchZoom().setTransform({scale:1,x:0,y:0,allowChangeEvent:!0}),this.mapScale=1,ke("selection"),ol(300).then((()=>e.style.transitionDuration="0s"))}_getCssProperty(e){return getComputedStyle(this._getMapImage()).getPropertyValue(e)}_zoomIn(){ke("selection"),this._updateScale(1.5)}_zoomOut(){ke("selection"),this._updateScale(1/1.5)}_updateScale(e){const t=this._getMapZoomerContent(),i=this._getPinchZoom(),a=this._getPinchZoom().getBoundingClientRect();this.mapScale=Math.max(this.mapScale*e,.5),t.style.transitionDuration="200ms",i.scaleTo(this.mapScale,{originX:a.left+a.width/2,originY:a.top+a.height/2,relativeTo:"container",allowChangeEvent:!0}),ol(300).then((()=>t.style.transitionDuration="0s"))}_calculateBasicScale(){const e=this._getMapImage();e&&e.naturalWidth>0&&(this.realImageWidth=e.naturalWidth,this.realImageHeight=e.naturalHeight,this.realScale=e.width/e.naturalWidth)}_calculateScale(){const e=this._getPinchZoom();this.mapScale=e.scale,this.mapX=e.x,this.mapY=e.y}_getPinchZoom(){var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("map-zoomer")}_getMapImage(){var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("map-image")}_getMapZoomerContent(){var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.getElementById("map-zoomer-content")}_getSvgWrapper(){var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("#svg-wrapper")}_showConfigErrors(e){e.forEach((e=>console.error(e)));const t=document.createElement("hui-error-card");return t.setConfig({type:"error",error:e[0],origConfig:this.config}),D` ${t} `}_showOldConfig(){return D`
+
+ Xiaomi Vacuum Map Card ${zs}
+ ${this._localize("common.old_configuration")}
+
+ ${this._localize("common.old_configuration_migration_link")}
+
+
+ `}_showInvalidEntities(e){return D`
+
+ ${this._localize("validation.invalid_entities")}
+
+ ${e.map((e=>D` -
+
${e}
+ `))}
+
+
+ `}_showInvalidCalibrationWarning(){return D` ${this._localize("validation.invalid_calibration")} `}_localize(e){return Qo(e,this.hass,this.config)}_showToast(e,t,i,a=""){dl.showToast(this.shadowRoot,(e=>this._localize(e)),"map-card",e,t,i,a)}static get styles(){return r`
+ ha-card {
+ overflow: hidden;
+ display: flow-root;
+ --map-card-internal-primary-color: var(--map-card-primary-color, var(--slider-color));
+ --map-card-internal-primary-text-color: var(--map-card-primary-text-color, var(--primary-text-color));
+ --map-card-internal-secondary-color: var(--map-card-secondary-color, var(--slider-secondary-color));
+ --map-card-internal-secondary-text-color: var(
+ --map-card-secondary-text-color,
+ var(--text-light-primary-color)
+ );
+ --map-card-internal-tertiary-color: var(--map-card-tertiary-color, var(--secondary-background-color));
+ --map-card-internal-tertiary-text-color: var(--map-card-tertiary-text-color, var(--primary-text-color));
+ --map-card-internal-disabled-text-color: var(
+ --map-card-disabled-text-color,
+ var(--disabled-text-color)
+ );
+ --map-card-internal-zoomer-background: var(
+ --map-card-zoomer-background,
+ var(--map-card-internal-tertiary-color)
+ );
+ --map-card-internal-ripple-color: var(--map-card-ripple-color, #7a7f87);
+ --map-card-internal-big-radius: var(--map-card-big-radius, 25px);
+ --map-card-internal-small-radius: var(--map-card-small-radius, 18px);
+ --map-card-internal-predefined-point-icon-wrapper-size: var(
+ --map-card-predefined-point-icon-wrapper-size,
+ 36px
+ );
+ --map-card-internal-predefined-point-icon-size: var(--map-card-predefined-point-icon-size, 24px);
+ --map-card-internal-predefined-point-icon-color: var(
+ --map-card-predefined-point-icon-color,
+ var(--map-card-internal-secondary-text-color)
+ );
+ --map-card-internal-predefined-point-icon-color-selected: var(
+ --map-card-predefined-point-icon-color-selected,
+ var(--map-card-internal-primary-text-color)
+ );
+ --map-card-internal-predefined-point-icon-background-color: var(
+ --map-card-predefined-point-icon-background-color,
+ var(--map-card-internal-secondary-color)
+ );
+ --map-card-internal-predefined-point-icon-background-color-selected: var(
+ --map-card-predefined-point-icon-background-color-selected,
+ var(--map-card-internal-primary-color)
+ );
+ --map-card-internal-predefined-point-label-color: var(
+ --map-card-predefined-point-label-color,
+ var(--map-card-internal-secondary-text-color)
+ );
+ --map-card-internal-predefined-point-label-color-selected: var(
+ --map-card-predefined-point-label-color-selected,
+ var(--map-card-internal-primary-text-color)
+ );
+ --map-card-internal-predefined-point-label-font-size: var(
+ --map-card-predefined-point-label-font-size,
+ 12px
+ );
+ --map-card-internal-manual-point-radius: var(--map-card-manual-point-radius, 5px);
+ --map-card-internal-manual-point-line-color: var(--map-card-manual-point-line-color, yellow);
+ --map-card-internal-manual-point-fill-color: var(--map-card-manual-point-fill-color, transparent);
+ --map-card-internal-manual-point-line-width: var(--map-card-manual-point-line-width, 1px);
+ --map-card-internal-manual-path-point-radius: var(--map-card-manual-path-point-radius, 5px);
+ --map-card-internal-manual-path-point-line-color: var(--map-card-manual-path-point-line-color, yellow);
+ --map-card-internal-manual-path-point-fill-color: var(
+ --map-card-manual-path-point-fill-color,
+ transparent
+ );
+ --map-card-internal-manual-path-point-line-width: var(--map-card-manual-path-point-line-width, 1px);
+ --map-card-internal-manual-path-line-color: var(--map-card-manual-path-line-color, yellow);
+ --map-card-internal-manual-path-line-width: var(--map-card-manual-path-line-width, 1px);
+ --map-card-internal-predefined-rectangle-line-width: var(
+ --map-card-predefined-rectangle-line-width,
+ 1px
+ );
+ --map-card-internal-predefined-rectangle-line-color: var(
+ --map-card-predefined-rectangle-line-color,
+ white
+ );
+ --map-card-internal-predefined-rectangle-fill-color: var(
+ --map-card-predefined-rectangle-fill-color,
+ transparent
+ );
+ --map-card-internal-predefined-rectangle-line-color-selected: var(
+ --map-card-predefined-rectangle-line-color-selected,
+ white
+ );
+ --map-card-internal-predefined-rectangle-fill-color-selected: var(
+ --map-card-predefined-rectangle-fill-color-selected,
+ rgba(255, 255, 255, 0.2)
+ );
+ --map-card-internal-predefined-rectangle-line-segment-line: var(
+ --map-card-predefined-rectangle-line-segment-line,
+ 10px
+ );
+ --map-card-internal-predefined-rectangle-line-segment-gap: var(
+ --map-card-predefined-rectangle-line-segment-gap,
+ 5px
+ );
+ --map-card-internal-predefined-rectangle-icon-wrapper-size: var(
+ --map-card-predefined-rectangle-icon-wrapper-size,
+ 36px
+ );
+ --map-card-internal-predefined-rectangle-icon-size: var(
+ --map-card-predefined-rectangle-icon-size,
+ 24px
+ );
+ --map-card-internal-predefined-rectangle-icon-color: var(
+ --map-card-predefined-rectangle-icon-color,
+ var(--map-card-internal-secondary-text-color)
+ );
+ --map-card-internal-predefined-rectangle-icon-color-selected: var(
+ --map-card-predefined-rectangle-icon-color-selected,
+ var(--map-card-internal-primary-text-color)
+ );
+ --map-card-internal-predefined-rectangle-icon-background-color: var(
+ --map-card-predefined-rectangle-icon-background-color,
+ var(--map-card-internal-secondary-color)
+ );
+ --map-card-internal-predefined-rectangle-icon-background-color-selected: var(
+ --map-card-predefined-rectangle-icon-background-color-selected,
+ var(--map-card-internal-primary-color)
+ );
+ --map-card-internal-predefined-rectangle-label-color: var(
+ --map-card-predefined-rectangle-label-color,
+ var(--map-card-internal-secondary-text-color)
+ );
+ --map-card-internal-predefined-rectangle-label-color-selected: var(
+ --map-card-predefined-rectangle-label-color-selected,
+ var(--map-card-internal-primary-text-color)
+ );
+ --map-card-internal-predefined-rectangle-label-font-size: var(
+ --map-card-predefined-rectangle-label-font-size,
+ 12px
+ );
+ --map-card-internal-manual-rectangle-line-width: var(--map-card-manual-rectangle-line-width, 1px);
+ --map-card-internal-manual-rectangle-line-color: var(--map-card-manual-rectangle-line-color, white);
+ --map-card-internal-manual-rectangle-fill-color: var(
+ --map-card-manual-rectangle-fill-color,
+ rgba(255, 255, 255, 0.2)
+ );
+ --map-card-internal-manual-rectangle-line-color-selected: var(
+ --map-card-manual-rectangle-line-color-selected,
+ white
+ );
+ --map-card-internal-manual-rectangle-fill-color-selected: var(
+ --map-card-manual-rectangle-fill-color-selected,
+ transparent
+ );
+ --map-card-internal-manual-rectangle-line-segment-line: var(
+ --map-card-manual-rectangle-line-segment-line,
+ 10px
+ );
+ --map-card-internal-manual-rectangle-line-segment-gap: var(
+ --map-card-manual-rectangle-line-segment-gap,
+ 5px
+ );
+ --map-card-internal-manual-rectangle-description-color: var(
+ --map-card-manual-rectangle-description-color,
+ white
+ );
+ --map-card-internal-manual-rectangle-description-font-size: var(
+ --map-card-manual-rectangle-description-font-size,
+ 12px
+ );
+ --map-card-internal-manual-rectangle-description-offset-x: var(
+ --map-card-manual-rectangle-description-offset-x,
+ 2px
+ );
+ --map-card-internal-manual-rectangle-description-offset-y: var(
+ --map-card-manual-rectangle-description-offset-y,
+ -8px
+ );
+ --map-card-internal-manual-rectangle-delete-circle-radius: var(
+ --map-card-manual-rectangle-delete-circle-radius,
+ 13px
+ );
+ --map-card-internal-manual-rectangle-delete-circle-line-color: var(
+ --map-card-manual-rectangle-delete-circle-line-color,
+ white
+ );
+ --map-card-internal-manual-rectangle-delete-circle-fill-color: var(
+ --map-card-manual-rectangle-delete-circle-fill-color,
+ var(--map-card-internal-secondary-color)
+ );
+ --map-card-internal-manual-rectangle-delete-circle-line-color-selected: var(
+ --map-card-manual-rectangle-delete-circle-line-color-selected,
+ white
+ );
+ --map-card-internal-manual-rectangle-delete-circle-fill-color-selected: var(
+ --map-card-manual-rectangle-delete-circle-fill-color-selected,
+ var(--map-card-internal-primary-color)
+ );
+ --map-card-internal-manual-rectangle-delete-circle-line-width: var(
+ --map-card-manual-rectangle-delete-circle-line-width,
+ 1px
+ );
+ --map-card-internal-manual-rectangle-delete-icon-color: var(
+ --map-card-manual-rectangle-delete-icon-color,
+ var(--map-card-internal-secondary-text-color)
+ );
+ --map-card-internal-manual-rectangle-delete-icon-color-selected: var(
+ --map-card-manual-rectangle-delete-icon-color-selected,
+ var(--map-card-internal-primary-text-color)
+ );
+ --map-card-internal-manual-rectangle-resize-circle-radius: var(
+ --map-card-manual-rectangle-resize-circle-radius,
+ 13px
+ );
+ --map-card-internal-manual-rectangle-resize-circle-line-color: var(
+ --map-card-manual-rectangle-resize-circle-line-color,
+ white
+ );
+ --map-card-internal-manual-rectangle-resize-circle-fill-color: var(
+ --map-card-manual-rectangle-resize-circle-fill-color,
+ var(--map-card-internal-secondary-color)
+ );
+ --map-card-internal-manual-rectangle-resize-circle-line-color-selected: var(
+ --map-card-manual-rectangle-resize-circle-line-color-selected,
+ white
+ );
+ --map-card-internal-manual-rectangle-resize-circle-fill-color-selected: var(
+ --map-card-manual-rectangle-resize-circle-fill-color-selected,
+ var(--map-card-internal-primary-color)
+ );
+ --map-card-internal-manual-rectangle-resize-circle-line-width: var(
+ --map-card-manual-rectangle-resize-circle-line-width,
+ 1px
+ );
+ --map-card-internal-manual-rectangle-resize-icon-color: var(
+ --map-card-manual-rectangle-resize-icon-color,
+ var(--map-card-internal-secondary-text-color)
+ );
+ --map-card-internal-manual-rectangle-resize-icon-color-selected: var(
+ --map-card-manual-rectangle-resize-icon-color-selected,
+ var(--map-card-internal-primary-text-color)
+ );
+ --map-card-internal-room-outline-line-color: var(--map-card-room-outline-line-color, white);
+ --map-card-internal-room-outline-line-width: var(--map-card-room-outline-line-width, 1px);
+ --map-card-internal-room-outline-line-segment-line: var(
+ --map-card-room-outline-line-segment-line,
+ 10px
+ );
+ --map-card-internal-room-outline-line-segment-gap: var(--map-card-room-outline-line-segment-gap, 5px);
+ --map-card-internal-room-outline-fill-color: var(--map-card-room-outline-fill-color, transparent);
+ --map-card-internal-room-outline-line-color-selected: var(
+ --map-card-room-outline-line-color-selected,
+ white
+ );
+ --map-card-internal-room-outline-fill-color-selected: var(
+ --map-card-room-outline-fill-color-selected,
+ rgba(255, 255, 255, 0.3)
+ );
+ --map-card-internal-room-icon-wrapper-size: var(--map-card-room-icon-wrapper-size, 36px);
+ --map-card-internal-room-icon-size: var(--map-card-room-icon-size, 24px);
+ --map-card-internal-room-icon-color: var(
+ --map-card-room-icon-color,
+ var(--map-card-internal-secondary-text-color)
+ );
+ --map-card-internal-room-icon-color-selected: var(
+ --map-card-room-icon-color-selected,
+ var(--map-card-internal-primary-text-color)
+ );
+ --map-card-internal-room-icon-background-color: var(
+ --map-card-room-icon-background-color,
+ var(--map-card-internal-secondary-color)
+ );
+ --map-card-internal-room-icon-background-color-selected: var(
+ --map-card-room-icon-background-color-selected,
+ var(--map-card-internal-primary-color)
+ );
+ --map-card-internal-room-label-color: var(
+ --map-card-room-label-color,
+ var(--map-card-internal-secondary-text-color)
+ );
+ --map-card-internal-room-label-color-selected: var(
+ --map-card-room-label-color-selected,
+ var(--map-card-internal-primary-text-color)
+ );
+ --map-card-internal-room-label-font-size: var(--map-card-room-label-font-size, 12px);
+ --map-card-internal-toast-successful-icon-color: var(
+ --map-card-toast-successful-icon-color,
+ rgb(0, 255, 0)
+ );
+ --map-card-internal-toast-unsuccessful-icon-color: var(
+ --map-card-toast-unsuccessful-icon-color,
+ rgb(255, 0, 0)
+ );
+ --map-card-internal-transitions-duration: var(--map-card-transitions-duration, 200ms);
+ }
+
+ .clickable {
+ cursor: pointer;
+ }
+
+ .map-wrapper {
+ position: relative;
+ height: max-content;
+ }
+
+ #map-zoomer {
+ overflow: hidden;
+ display: block;
+ --scale: 1;
+ --x: 0;
+ --y: 0;
+ background: var(--map-card-internal-zoomer-background);
+ }
+
+ #map-zoomer-content {
+ transform: translate(var(--x), var(--y)) scale(var(--scale));
+ transform-origin: 0 0;
+ position: relative;
+ }
+
+ #map-image {
+ width: 100%;
+ margin-bottom: -6px;
+ }
+
+ #map-image.zoomed {
+ image-rendering: pixelated;
+ }
+
+ #map-image-overlay {
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ }
+
+ .standalone-icon-on-map {
+ background-color: var(--map-card-internal-secondary-color);
+ color: var(--map-card-internal-secondary-text-color);
+ border-radius: var(--map-card-internal-small-radius);
+ margin: 5px;
+ width: 36px;
+ height: 36px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ }
+
+ .map-zoom-icons {
+ right: 0;
+ bottom: 0;
+ position: absolute;
+ display: inline-flex;
+ background-color: var(--map-card-internal-secondary-color);
+ color: var(--map-card-internal-secondary-text-color);
+ border-radius: var(--map-card-internal-small-radius);
+ margin: 5px;
+ direction: ltr;
+ }
+
+ .map-zoom-icons-main {
+ display: inline-flex;
+ border-radius: var(--map-card-internal-small-radius);
+ background-color: var(--map-card-internal-primary-color);
+ color: var(--map-card-internal-primary-text-color);
+ }
+
+ .icon-on-map {
+ touch-action: auto;
+ pointer-events: auto;
+ height: 36px;
+ width: 36px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ }
+
+ .controls-wrapper {
+ margin: 15px;
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ }
+
+ .map-controls {
+ width: 100%;
+ display: inline-flex;
+ gap: 10px;
+ place-content: space-between;
+ flex-wrap: wrap;
+ }
+
+ .map-actions-list {
+ border-radius: var(--map-card-internal-big-radius);
+ overflow: hidden;
+ background-color: var(--map-card-internal-secondary-color);
+ color: var(--map-card-internal-secondary-text-color);
+ margin-inline-start: auto;
+ display: inline-flex;
+ height: min-content;
+ }
+
+ .map-actions-item.main {
+ border-radius: var(--map-card-internal-big-radius);
+ background-color: var(--map-card-internal-primary-color);
+ color: var(--map-card-internal-primary-text-color);
+ }
+
+ .map-actions-item {
+ width: 50px;
+ height: 50px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ background-color: transparent;
+ }
+
+ .ripple {
+ position: relative;
+ overflow: hidden;
+ transform: translate3d(0, 0, 0);
+ }
+
+ .ripple:after {
+ content: "";
+ display: block;
+ position: absolute;
+ border-radius: 50%;
+ width: 100%;
+ height: 100%;
+ top: 0;
+ left: 0;
+ pointer-events: none;
+ background-image: radial-gradient(circle, var(--map-card-internal-ripple-color) 2%, transparent 10.01%);
+ background-repeat: no-repeat;
+ background-position: 50%;
+ transform: scale(10, 10);
+ opacity: 0;
+ transition: transform 0.5s, opacity 1s;
+ }
+
+ .ripple:active:after {
+ transform: scale(0, 0);
+ opacity: 0.7;
+ transition: 0s;
+ }
+
+ ${wc.styles}
+ ${Ll.styles}
+ ${Dl.styles}
+ ${Xl.styles}
+ ${Hl.styles}
+ ${Ul.styles}
+ ${Kl.styles}
+ ${Gl.styles}
+ ${Ec.styles}
+ ${bc.styles}
+ ${hc.styles}
+ ${dl.styles}
+ `}};e([me()],Oc.prototype,"oldConfig",void 0),e([me()],Oc.prototype,"config",void 0),e([me()],Oc.prototype,"presetIndex",void 0),e([me()],Oc.prototype,"realScale",void 0),e([me()],Oc.prototype,"realImageWidth",void 0),e([me()],Oc.prototype,"realImageHeight",void 0),e([me()],Oc.prototype,"mapScale",void 0),e([me()],Oc.prototype,"mapX",void 0),e([me()],Oc.prototype,"mapY",void 0),e([me()],Oc.prototype,"repeats",void 0),e([me()],Oc.prototype,"selectedMode",void 0),e([me()],Oc.prototype,"mapLocked",void 0),e([me()],Oc.prototype,"configErrors",void 0),e([me()],Oc.prototype,"connected",void 0),e([me()],Oc.prototype,"internalVariables",void 0),e([_e(".modes-dropdown-menu")],Oc.prototype,"_modesDropdownMenu",void 0),e([function(e){return pe({descriptor:t=>({get(){var t,i;return null!==(i=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelectorAll(e))&&void 0!==i?i:[]},enumerable:!0,configurable:!0})})}(".icon-dropdown-menu")],Oc.prototype,"_iconDropdownMenus",void 0),e([ue({attribute:!1})],Oc.prototype,"_hass",void 0),Oc=zc=e([le(Ps)],Oc);export{Oc as XiaomiVacuumMapCard};
diff --git a/config/www/community/lovelace-xiaomi-vacuum-map-card/xiaomi-vacuum-map-card.js.gz b/config/www/community/lovelace-xiaomi-vacuum-map-card/xiaomi-vacuum-map-card.js.gz
new file mode 100644
index 00000000..934841c5
Binary files /dev/null and b/config/www/community/lovelace-xiaomi-vacuum-map-card/xiaomi-vacuum-map-card.js.gz differ