/*
 * This file is part of the TYPO3 CMS project.
 *
 * It is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, either version 2
 * of the License, or any later version.
 *
 * For the full copyright and license information, please read the
 * LICENSE.txt file that was distributed with this source code.
 *
 * The TYPO3 project - inspiring people to share!
 */
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","TYPO3/CMS/Core/Ajax/AjaxRequest","TYPO3/CMS/Backend/Enum/Severity","jquery","nprogress","TYPO3/CMS/Backend/Modal"],(function(e,t,a,n,o,l,s){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),o=__importDefault(o);t.default=class{constructor(){this.tid=0}renderSendToStageWindow(e){const t=e[0].result,a=(0,o.default)("<form />");if(void 0!==t.sendMailTo&&t.sendMailTo.length>0){a.append((0,o.default)("<label />",{class:"control-label"}).text(TYPO3.lang["window.sendToNextStageWindow.itemsWillBeSentTo"])),a.append((0,o.default)("<div />",{class:"form-group"}).append((0,o.default)('<button type="button" class="btn btn-default btn-xs t3js-workspace-recipients-selectall" />').text(TYPO3.lang["window.sendToNextStageWindow.selectAll"]),"&nbsp;",(0,o.default)('<button type="button" class="btn btn-default btn-xs t3js-workspace-recipients-deselectall" />').text(TYPO3.lang["window.sendToNextStageWindow.deselectAll"])));for(const e of t.sendMailTo)a.append((0,o.default)("<div />",{class:"form-check"}).append((0,o.default)("<input />",{type:"checkbox",name:"recipients",class:"form-check-input t3js-workspace-recipient",id:e.name,value:e.value}).prop("checked",e.checked).prop("disabled",e.disabled),(0,o.default)("<label />",{class:"form-check-label",for:e.name}).text(e.label)))}void 0!==t.additional&&a.append((0,o.default)("<div />",{class:"form-group"}).append((0,o.default)("<label />",{class:"control-label",for:"additional"}).text(TYPO3.lang["window.sendToNextStageWindow.additionalRecipients"]),(0,o.default)("<textarea />",{class:"form-control",name:"additional",id:"additional"}).text(t.additional.value),(0,o.default)("<span />",{class:"help-block"}).text(TYPO3.lang["window.sendToNextStageWindow.additionalRecipients.hint"]))),a.append((0,o.default)("<div />",{class:"form-group"}).append((0,o.default)("<label />",{class:"control-label",for:"comments"}).text(TYPO3.lang["window.sendToNextStageWindow.comments"]),(0,o.default)("<textarea />",{class:"form-control",name:"comments",id:"comments"}).text(t.comments.value)));const l=s.show(TYPO3.lang.actionSendToStage,a,n.SeverityEnum.info,[{text:TYPO3.lang.cancel,active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>{l.modal("hide")}},{text:TYPO3.lang.ok,btnClass:"btn-info",name:"ok"}]);return l}sendRemoteRequest(e,t="#workspace-content-wrapper"){return l.configure({parent:t,showSpinner:!1}),l.start(),new a(TYPO3.settings.ajaxUrls.workspace_dispatch).post(e,{headers:{"Content-Type":"application/json; charset=utf-8"}}).finally(()=>l.done())}generateRemotePayload(e,t={}){return this.generateRemotePayloadBody("RemoteServer",e,t)}generateRemoteMassActionsPayload(e,t={}){return this.generateRemotePayloadBody("MassActions",e,t)}generateRemoteActionsPayload(e,t={}){return this.generateRemotePayloadBody("Actions",e,t)}generateRemotePayloadBody(e,t,a){return a instanceof Array?a.push(TYPO3.settings.Workspaces.token):a=[a,TYPO3.settings.Workspaces.token],{action:e,data:a,method:t,type:"rpc",tid:this.tid++}}}}));