!function(e){function t(t){for(var r,u,l=t[0],c=t[1],d=t[2],f=0,s=[];f<l.length;f++)u=l[f],Object.prototype.hasOwnProperty.call(o,u)&&o[u]&&s.push(o[u][0]),o[u]=0;for(r in c)Object.prototype.hasOwnProperty.call(c,r)&&(e[r]=c[r]);for(a&&a(t);s.length;)s.shift()();return i.push.apply(i,d||[]),n()}function n(){for(var e,t=0;t<i.length;t++){for(var n=i[t],r=!0,l=1;l<n.length;l++){var c=n[l];0!==o[c]&&(r=!1)}r&&(i.splice(t--,1),e=u(u.s=n[0]))}return e}var r={},o={7:0},i=[];function u(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,u),n.l=!0,n.exports}u.m=e,u.c=r,u.d=function(e,t,n){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)u.d(n,r,function(t){return e[t]}.bind(null,r));return n},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="/dist/";var l=window.webpackJsonp=window.webpackJsonp||[],c=l.push.bind(l);l.push=t,l=l.slice();for(var d=0;d<l.length;d++)t(l[d]);var a=c;i.push([90,0]),n()}({90:function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t,n,r,o,i,u){try{var l=e[i](u),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var u=e.apply(t,n);function l(e){i(u,r,o,l,c,"next",e)}function c(e){i(u,r,o,l,c,"throw",e)}l(void 0)})}}CloudCmd.EditNames=t;var l,c=n(31),d=n(0),a=n(2),f=n(23),s=n(91),p=Promise.reject.bind(Promise),C=DOM.CurrentInfo,m=DOM.Dialog,y=d(function(e,t,n){if(404===n.status)return n.text().then(p);var r=e[t];CloudCmd.refresh({currentName:r})}),v=d(function(e,t,n,r){var o=function(e,t){return"/"===e?t:e+t}(r,e),i=CloudCmd.prefix;return fetch("".concat(i,"/rename"),{method:"put",credentials:"include",body:JSON.stringify({from:t,to:n,dir:o})})}),h=a.bind(),b={beforeClose:function(){a.ifExist(l,"hide"),DOM.Events.remove("keydown",g),j()}};function g(e){var t=e.ctrlKey,n=e.metaKey,r=t||n,o=CloudCmd.Key;r&&e.keyCode===o.S?h.hide():r&&e.keyCode===o.P&&c.prompt("Apply pattern:","[n][e]",{cancel:!1}).then(O),e.preventDefault()}function O(e){var t=s(e,E());CloudCmd.Edit.getEditor().setValue(t.join("\n"))}function E(){return DOM.getFilenames(DOM.getActiveFiles())}function w(){var e=C.dirPath,t=E(),n=t.indexOf(C.name),r=CloudCmd.Edit.getEditor().getValue().split("\n"),o=CloudCmd.config("root");Promise.resolve(o).then(v(e,t,r)).then(y(r,n)).catch(alert)}function P(e){var t={x:e.clientX,y:e.clientY};if(e.preventDefault(),!l){var n=CloudCmd.Edit.getEditor(),r={beforeShow:function(e){e.x-=18,e.y-=27},afterClick:function(){n.focus()}},o={"Save           Ctrl+S":function(){w(),h.hide()},"Go To Line     Ctrl+G":function(){n.goToLine()},"Cut            Ctrl+X":function(){n.cutToClipboard()},"Copy           Ctrl+C":function(){n.copyToClipboard()},"Paste          Ctrl+V":function(){n.pasteFromClipboard()},"Delete         Del":function(){n.remove("right")},"Select All     Ctrl+A":function(){n.selectAll()},"Close          Esc":function(){h.hide()}},i=CloudCmd.Edit.getElement();(l=f(i,r,o)).show(t.x,t.y)}}function j(){CloudCmd.Edit.getEditor().isChanged()&&m.confirm("Apply new names?",{cancel:!1}).then(w)}e.exports.init=u(function*(){yield CloudCmd.Edit();var e;CloudCmd.Edit.getEditor();e=CloudCmd.Edit.getElement(),DOM.Events.addOnce("contextmenu",e,P)}),e.exports.show=function(e){var t=E().join("\n"),n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(n,!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},b,{},e);return".."===C.name&&1===t.length?m.alert.noFiles():(DOM.Events.addKey(g),CloudCmd.Edit.getEditor().setValueFirst("edit-names",t).setMode().setOption("keyMap","default").disableKey(),CloudCmd.Edit.show(n),CloudCmd.Edit)},e.exports.hide=function(){CloudCmd.Edit.hide()},e.exports.isChanged=j}});
//# sourceMappingURL=edit-names.js.map