"use strict";(self.webpackChunkknx_frontend=self.webpackChunkknx_frontend||[]).push([[3172],{73172:function(e,i,a){a.r(i),a.d(i,{HaFormInteger:function(){return g}});var t,n,d,s,l,h=a(6238),r=a(36683),u=a(89231),o=a(29864),v=a(83647),c=a(8364),f=(a(8485),a(98809),a(77052),a(43618),a(98597)),k=a(196),m=a(33167),g=(a(53335),(0,c.A)([(0,k.EM)("ha-form-integer")],(function(e,i){var a=function(i){function a(){var i;(0,u.A)(this,a);for(var t=arguments.length,n=new Array(t),d=0;d<t;d++)n[d]=arguments[d];return i=(0,o.A)(this,a,[].concat(n)),e(i),i}return(0,v.A)(a,i),(0,r.A)(a)}(i);return{F:a,d:[{kind:"field",decorators:[(0,k.MZ)({attribute:!1})],key:"localize",value:void 0},{kind:"field",decorators:[(0,k.MZ)({attribute:!1})],key:"schema",value:void 0},{kind:"field",decorators:[(0,k.MZ)({attribute:!1})],key:"data",value:void 0},{kind:"field",decorators:[(0,k.MZ)()],key:"label",value:void 0},{kind:"field",decorators:[(0,k.MZ)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,k.MZ)({type:Boolean})],key:"disabled",value:function(){return!1}},{kind:"field",decorators:[(0,k.P)("ha-textfield ha-slider")],key:"_input",value:void 0},{kind:"field",key:"_lastValue",value:void 0},{kind:"method",key:"focus",value:function(){this._input&&this._input.focus()}},{kind:"method",key:"render",value:function(){var e,i;return void 0!==this.schema.valueMin&&void 0!==this.schema.valueMax&&this.schema.valueMax-this.schema.valueMin<256?(0,f.qy)(t||(t=(0,h.A)(["\n        <div>\n          ",'\n          <div class="flex">\n            ',"\n            <ha-slider\n              labeled\n              .value=","\n              .min=","\n              .max=","\n              .disabled=","\n              @change=","\n            ></ha-slider>\n          </div>\n          ","\n        </div>\n      "])),this.label,this.schema.required?"":(0,f.qy)(n||(n=(0,h.A)(["\n                  <ha-checkbox\n                    @change=","\n                    .checked=","\n                    .disabled=","\n                  ></ha-checkbox>\n                "])),this._handleCheckboxChange,void 0!==this.data,this.disabled),this._value,this.schema.valueMin,this.schema.valueMax,this.disabled||void 0===this.data&&!this.schema.required,this._valueChanged,this.helper?(0,f.qy)(d||(d=(0,h.A)(["<ha-input-helper-text>","</ha-input-helper-text>"])),this.helper):""):(0,f.qy)(s||(s=(0,h.A)(['\n      <ha-textfield\n        type="number"\n        inputMode="numeric"\n        .label=',"\n        .helper=","\n        helperPersistent\n        .value=","\n        .disabled=","\n        .required=","\n        .autoValidate=","\n        .suffix=","\n        .validationMessage=","\n        @input=","\n      ></ha-textfield>\n    "])),this.label,this.helper,void 0!==this.data?this.data:"",this.disabled,this.schema.required,this.schema.required,null===(e=this.schema.description)||void 0===e?void 0:e.suffix,this.schema.required?null===(i=this.localize)||void 0===i?void 0:i.call(this,"ui.common.error_required"):void 0,this._valueChanged)}},{kind:"method",key:"updated",value:function(e){e.has("schema")&&this.toggleAttribute("own-margin",!("valueMin"in this.schema&&"valueMax"in this.schema||!this.schema.required))}},{kind:"get",key:"_value",value:function(){var e,i;return void 0!==this.data?this.data:this.schema.required?void 0!==(null===(e=this.schema.description)||void 0===e?void 0:e.suggested_value)&&null!==(null===(i=this.schema.description)||void 0===i?void 0:i.suggested_value)||this.schema.default||this.schema.valueMin||0:this.schema.valueMin||0}},{kind:"method",key:"_handleCheckboxChange",value:function(e){var i;if(e.target.checked)for(var a=0,t=[this._lastValue,null===(n=this.schema.description)||void 0===n?void 0:n.suggested_value,this.schema.default,0];a<t.length;a++){var n,d=t[a];if(void 0!==d){i=d;break}}else this._lastValue=this.data;(0,m.r)(this,"value-changed",{value:i})}},{kind:"method",key:"_valueChanged",value:function(e){var i,a=e.target,t=a.value;if(""!==t&&(i=parseInt(String(t))),this.data!==i)(0,m.r)(this,"value-changed",{value:i});else{var n=void 0===i?"":String(i);a.value!==n&&(a.value=n)}}},{kind:"get",static:!0,key:"styles",value:function(){return(0,f.AH)(l||(l=(0,h.A)(["\n      :host([own-margin]) {\n        margin-bottom: 5px;\n      }\n      .flex {\n        display: flex;\n      }\n      ha-slider {\n        flex: 1;\n      }\n      ha-textfield {\n        display: block;\n      }\n    "])))}}]}}),f.WF))}}]);