{"version":3,"sources":["webpack:///./src/views/pages/PlantDetail/CommandsGroups/CommandWizard/CommandWizardStep1/CommandWizardStep1.vue?a28b","webpack:///./src/views/pages/PlantDetail/CommandsGroups/CommandWizard/CommandWizardStep1/CommandWizardStep1.ts","webpack:///./src/views/pages/PlantDetail/CommandsGroups/CommandWizard/CommandWizardStep1/CommandWizardStep1.vue","webpack:///./src/views/pages/PlantDetail/CommandsGroups/CommandWizard/CommandWizardStep.ts","webpack:///./node_modules/lodash.debounce/index.js"],"names":["_hoisted_1","class","_hoisted_2","_hoisted_3","for","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","render","_ctx","_cache","$props","$setup","$data","$options","_component_RadioButton","_component_InputText","$t","id","name","onChange","computeGroupName","value","RoomObjectType","Light","modelValue","commandGroup","roomObjectType","$event","Shutter","type","isValidName","if","invalidNameReason","this","None","isEditMode","initialName","verifyValidityOfName","flushCache","prefetchFlatEntities","plantId","GROUP","$store","dispatch","validName","isValidEntityTypeName","suggestNextValidEntityName","eType","metadata","suggestedName","$emit","trim","length","CommandWizardStep","emits","watch","__exports__","nextEnabled","props","Number","required","Object","defaultSettings","emitIsNextEnabled","FUNC_ERROR_TEXT","NAN","symbolTag","reTrim","reIsBadHex","reIsBinary","reIsOctal","freeParseInt","parseInt","freeGlobal","global","freeSelf","self","root","Function","objectProto","prototype","objectToString","toString","nativeMax","Math","max","nativeMin","min","now","Date","debounce","func","wait","options","lastArgs","lastThis","maxWait","result","timerId","lastCallTime","lastInvokeTime","leading","maxing","trailing","TypeError","invokeFunc","time","args","thisArg","undefined","apply","leadingEdge","setTimeout","timerExpired","remainingWait","timeSinceLastCall","timeSinceLastInvoke","shouldInvoke","trailingEdge","cancel","clearTimeout","flush","debounced","isInvoking","arguments","toNumber","isObject","isObjectLike","isSymbol","call","other","valueOf","replace","isBinary","test","slice","module","exports"],"mappings":"mJAEMA,EAAa,CAAEC,MAAO,6BACtBC,EAAa,CAAED,MAAO,WACtB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F,EAAW,EAAI,GAC3CjE,EAAWkE,KAAKjH,GAAS4C,GAAO5C,EAGvCmH,EAAOC,QAAU/C,I","file":"js/chunk-73a2bccc.8aadbb05.js","sourcesContent":["import { toDisplayString as _toDisplayString, createVNode as _createVNode, resolveComponent as _resolveComponent, openBlock as _openBlock, createBlock as _createBlock } from \"vue\"\n\nconst _hoisted_1 = { class: \"form-custom col-lg-6 mt-5\" }\nconst _hoisted_2 = { class: \"p-field\" }\nconst _hoisted_3 = {\n class: \"p-field-label\",\n for: \"name\"\n}\nconst _hoisted_4 = { class: \"p-field-radiobutton mt-3\" }\nconst _hoisted_5 = { for: \"gtLights\" }\nconst _hoisted_6 = { class: \"p-field-radiobutton\" }\nconst _hoisted_7 = { for: \"gtShutters\" }\nconst _hoisted_8 = { class: \"p-field mt-5\" }\nconst _hoisted_9 = {\n class: \"p-field-label\",\n for: \"name\"\n}\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n const _component_RadioButton = _resolveComponent(\"RadioButton\")\n const _component_InputText = _resolveComponent(\"InputText\")\n\n return (_openBlock(), _createBlock(\"div\", _hoisted_1, [\n _createVNode(\"div\", _hoisted_2, [\n _createVNode(\"label\", _hoisted_3, _toDisplayString(_ctx.$t(\"AppResource.Groups\")), 1)\n ]),\n _createVNode(\"div\", _hoisted_4, [\n _createVNode(_component_RadioButton, {\n id: \"gtLights\",\n name: \"groupType\",\n onChange: _ctx.computeGroupName,\n value: _ctx.RoomObjectType.Light,\n modelValue: _ctx.commandGroup.roomObjectType,\n \"onUpdate:modelValue\": _cache[1] || (_cache[1] = ($event: any) => (_ctx.commandGroup.roomObjectType = $event))\n }, null, 8, [\"onChange\", \"value\", \"modelValue\"]),\n _createVNode(\"label\", _hoisted_5, _toDisplayString(_ctx.$t(\"AppResource.Light\")), 1)\n ]),\n _createVNode(\"div\", _hoisted_6, [\n _createVNode(_component_RadioButton, {\n id: \"gtShutters\",\n name: \"groupType\",\n onChange: _ctx.computeGroupName,\n value: _ctx.RoomObjectType.Shutter,\n modelValue: _ctx.commandGroup.roomObjectType,\n \"onUpdate:modelValue\": _cache[2] || (_cache[2] = ($event: any) => (_ctx.commandGroup.roomObjectType = $event))\n }, null, 8, [\"onChange\", \"value\", \"modelValue\"]),\n _createVNode(\"label\", _hoisted_7, _toDisplayString(_ctx.$t(\"AppResource.Shutter\")), 1)\n ]),\n _createVNode(\"div\", _hoisted_8, [\n _createVNode(\"label\", _hoisted_9, _toDisplayString(_ctx.$t(\"AppResource.Name\")), 1),\n _createVNode(_component_InputText, {\n id: \"name\",\n type: \"text\",\n class: [\"w-100\", { 'input-error': !_ctx.isValidName }],\n modelValue: _ctx.commandGroup.name,\n \"onUpdate:modelValue\": _cache[3] || (_cache[3] = ($event: any) => (_ctx.commandGroup.name = $event))\n }, null, 8, [\"modelValue\", \"class\"]),\n _createVNode(\"label\", {\n if: !_ctx.isValidName,\n for: \"name\",\n class: \"fs-13 label-error\"\n }, _toDisplayString(_ctx.invalidNameReason), 9, [\"if\"])\n ])\n ]))\n}","import debounce from 'lodash.debounce';\nimport { Options } from 'vue-class-component';\nimport CommandWizardStep from '../CommandWizardStep';\nimport { SET_APP_LOADING } from '@/core/store/action-types';\nimport { NamingService } from '@/core/services/naming.service';\nimport { RoomObjectType } from '@/../client-generator/generated-clients/plants';\nimport { PlantEntityType } from '@/../client-generator/generated-clients/configurations';\nimport { NAME_VALIDATION_DEBOUNCE_TIME } from '@/core/utils/utils';\n\n@Options({\n name: 'CommandWizardStep1',\n emits: ['next-enabled'],\n watch: {\n 'commandGroup.roomObjectType': function () {\n if (!this.isEditMode()) this.computeGroupName();\n },\n 'commandGroup.name': function () {\n this.verifyValidityOfName();\n },\n },\n})\nexport default class CommandWizardStep1 extends CommandWizardStep {\n isValidName = true;\n initialName!: string;\n invalidNameReason: string = '';\n RoomObjectType = RoomObjectType;\n\n async mounted() {\n if (this.commandGroup.roomObjectType === RoomObjectType.None) {\n this.commandGroup.roomObjectType = RoomObjectType.Light;\n }\n\n if (this.isEditMode()) {\n this.initialName = this.commandGroup.name ?? '';\n }\n\n this.verifyValidityOfName = debounce(\n this.verifyValidityOfName,\n NAME_VALIDATION_DEBOUNCE_TIME\n );\n\n NamingService.flushCache();\n await NamingService.prefetchFlatEntities(\n this.plantId,\n PlantEntityType.GROUP\n );\n }\n\n private async verifyValidityOfName() {\n this.$store.dispatch(SET_APP_LOADING, true);\n const validName = NamingService.isValidEntityTypeName(\n this.commandGroup.name\n );\n\n if (this.initialName !== this.commandGroup.name && !validName) {\n const suggestedName = await NamingService.suggestNextValidEntityName({\n eType: PlantEntityType.GROUP,\n plantId: this.plantId,\n metadata: {\n roomObjectType: this.commandGroup.roomObjectType,\n },\n });\n this.isValidName = validName;\n this.invalidNameReason = this.$t(\n `uniqueNaming.validationErrorWithSuggestion`,\n { suggestedName }\n );\n this.$emit('next-enabled', false);\n } else {\n this.isValidName = true;\n this.invalidNameReason = '';\n this.$emit('next-enabled', true);\n }\n this.$store.dispatch(SET_APP_LOADING, false);\n }\n\n private isEditMode(): boolean {\n return !!this.commandGroup.id && !!this.commandGroup.id.trim().length;\n }\n\n // DO NOT DELETE ME: I'm used in the watcher\n private async computeGroupName() {\n this.$store.dispatch(SET_APP_LOADING, true);\n this.commandGroup.name = await NamingService.suggestNextValidEntityName({\n eType: PlantEntityType.GROUP,\n plantId: this.plantId,\n metadata: {\n roomObjectType: this.commandGroup.roomObjectType,\n },\n });\n this.$store.dispatch(SET_APP_LOADING, false);\n }\n}\n","import { render } from \"./CommandWizardStep1.vue?vue&type=template&id=378ab98b&ts=true\"\nimport script from \"./CommandWizardStep1.ts?vue&type=script&lang=ts\"\nexport * from \"./CommandWizardStep1.ts?vue&type=script&lang=ts\"\n\nimport exportComponent from \"/home/vsts/work/1/s/Frontend/node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","import { Vue, Options } from 'vue-class-component';\nimport { PropType } from 'vue';\nimport { AggregateCommandDTO } from '@/../client-generator/generated-clients/plants';\nimport { IDefaultDevicesSettingsDTO } from 'client-generator/generated-clients/device-settings';\n\n@Options({\n name: 'CommandWizardStep',\n props: {\n plantId: {\n type: Number,\n required: true,\n },\n commandGroup: {\n type: Object as PropType,\n },\n defaultSettings: {\n type: Object as PropType,\n required: true,\n },\n },\n emits: ['update:defaultSettings', 'next-enabled'],\n watch: {\n nextEnabled: function () {\n this.emitIsNextEnabled();\n },\n },\n})\nexport default class CommandWizardStep extends Vue {\n plantId!: number;\n commandGroup!: AggregateCommandDTO;\n defaultSettings!: IDefaultDevicesSettingsDTO[];\n\n nextEnabled = true;\n\n emitIsNextEnabled() {\n this.$emit('next-enabled', this.nextEnabled);\n }\n}\n","/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nmodule.exports = debounce;\n"],"sourceRoot":""}