!function(e){function t(t){for(var o,s,i=t[0],a=t[1],u=t[2],f=0,d=[];f<i.length;f++)s=i[f],Object.prototype.hasOwnProperty.call(r,s)&&r[s]&&d.push(r[s][0]),r[s]=0;for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o]);for(l&&l(t);d.length;)d.shift()();return c.push.apply(c,u||[]),n()}function n(){for(var e,t=0;t<c.length;t++){for(var n=c[t],o=!0,i=1;i<n.length;i++){var a=n[i];0!==r[a]&&(o=!1)}o&&(c.splice(t--,1),e=s(s.s=n[0]))}return e}var o={},r={3:0},c=[];function s(t){if(o[t])return o[t].exports;var n=o[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,s),n.l=!0,n.exports}s.m=e,s.c=o,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)s.d(n,o,function(t){return e[t]}.bind(null,o));return n},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="/dist/";var i=window.webpackJsonp=window.webpackJsonp||[],a=i.push.bind(i);i.push=t,i=i.slice();for(var u=0;u<i.length;u++)t(i[u]);var l=a;c.push([104,0]),n()}({104:function(e,t,n){"use strict";n(183);const o=n(13),r=n(0),c=n(8),s=n(37),{promisify:i}=n(14),a=n(3),u=n(4),l=n(2),f=n(105),d=n(1),p=n(17),g=n(16),{getTitle:m}=n(6),{Dialog:y,setTitle:h}=DOM;CloudCmd.Config=e.exports;const b=i(DOM.loadSocket),w=r((e,t)=>(p.addKey(t,e),t)),C=r((e,t)=>(p.add("change",t,e),t)),v={};let x;const k=u.css;e.exports.init=async()=>{if(!CloudCmd.config("configDialog"))return;d.show.load("top");const{prefix:e}=CloudCmd;[x]=await Promise.all([g.get("config-tmpl"),b(),k(e+"/dist/config.css"),CloudCmd.View()]),function(){const e=function(){const{host:e,origin:t,protocol:n}=location;return t||`${n}//${e}`}(),{prefixSocket:t,prefix:n}=CloudCmd,o=io.connect(e+t+"/config",{reconnectionAttempts:1/0,reconnectionDelay:6e4,path:n+"/socket.io"}),r=e=>{P(e),o.send(e)};(function(e){e.emit("auth",O("username"),O("password")),e.on("reject",c(y.alert,"Wrong credentials!"))})(o),o.on("connect",()=>{v.save=r}),o.on("message",P),o.on("log",CloudCmd.log),o.on("disconnect",()=>{v.save=D}),o.on("err",y.alert)}()};const{config:O,Key:j}=CloudCmd;let S;function M(){CloudCmd.View.hide()}async function N(e){const t={},n=f.getName(e),o=f.getValue(n,S);"name"===n?function(e){h(m({name:e}))}(o):"auth"===n&&E(o),t[n]=o,await v.save(t)}function P(e){for(const t of Object.keys(e)){const n=e[t];CloudCmd._config(t,n),f.setValue(t,n,S)}}async function D(e){const{RESTful:t}=DOM,[n]=await t.Config.write(e);n||P(e)}function E(e){const t=f.getElementByName("username",S),n=f.getElementByName("password",S);t.disabled=n.disabled=!e}async function T({keyCode:e,target:t}){switch(e){case j.ESC:return M();case j.ENTER:return await N(t)}}v.save=D,e.exports.show=async function(){if(!CloudCmd.config("configDialog"))return;await async function(){const[e,t]=await a(g.get,"config");if(e)return y.alert("Could not load config!");const{editor:n,packer:r,columns:c,configAuth:i,...u}=f.convert(t);u[n+"-selected"]="selected",u[r+"-selected"]="selected",u[c+"-selected"]="selected",u.configAuth=i?"":"hidden";const d=o(x,u);S=l("form",{className:"config",innerHTML:d});const p=document.querySelectorAll("input, select",S),[m]=p;let h;m&&(E(m.checked),h=m.focus.bind(m));const b=s(N,({target:e})=>e);Array.from(p).map(w(T)).map(C(b));CloudCmd.View.show(S,{autoSize:!0,afterShow:h})}()},e.exports.hide=M},105:function(e,t,n){"use strict";const o=n(0)((e,t,n)=>e===typeof t[n])("boolean");function r(e,t){const n=`[data-name="js-${e}"]`;return t.querySelector(n)}function c(e){return e?" checked":""}e.exports.getElementByName=r,e.exports.getName=e=>e.getAttribute("data-name").replace(/^js-/,""),e.exports.convert=e=>{const t=e,n=Object.keys(e).filter(o(e));for(const o of n){const n=e[o];t[o]=c(n)}return t},e.exports.getValue=(e,t)=>{const n=r(e,t),{type:o}=n;switch(o){case"checkbox":return n.checked;case"number":return Number(n.value);default:return n.value}},e.exports.setValue=(e,t,n)=>{const o=r(e,n),{type:c}=o;switch(c){case"checkbox":o.checked=t;break;default:o.value=t}}},183:function(e,t){}});
//# sourceMappingURL=config.js.map