/* * 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! */ import{property as h,state as c,query as f,customElement as m}from"lit/decorators.js";import{LitElement as u,html as l}from"lit";import w from"~labels/backend.layout";import z from"~labels/backend.wizards.general";import S from"@typo3/backend/page-wizard/steps/doktype-step.js";import{AutoAdvanceEvent as b}from"@typo3/backend/wizard/events/auto-advance-event.js";import y from"@typo3/backend/page-wizard/steps/position-step.js";import{loadDynamicSteps as g}from"@typo3/backend/wizard/helper/dynamic-steps-loader.js";import{PageWizardSubmissionService as v}from"@typo3/backend/page-wizard/finisher/page-wizard-submission-service.js";var o=function(s,t,e,a){var n=arguments.length,i=n<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,e):a,p;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(s,t,e,a);else for(var d=s.length-1;d>=0;d--)(p=s[d])&&(i=(n<3?p(i):n>3?p(t,e,i):p(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i};let r=class extends u{constructor(){super(...arguments),this.configuration=null,this.steps=[],this.fixedSteps=[]}firstUpdated(t){super.firstUpdated(t),this.context={wizard:this.wizard,configuration:this.configuration,getStoreData:this.wizard.getStoreData.bind(this.wizard),setStoreData:this.wizard.setStoreData.bind(this.wizard),clearStoreData:this.wizard.clearStoreData.bind(this.wizard),getDataStore:this.wizard.getDataStore.bind(this.wizard),dispatchAutoAdvance:()=>this.wizard.dispatchEvent(new b)},this.steps=this.fixedSteps=[new y(this.context),new S(this.context)],this.submissionService=new v(this.context)}createRenderRoot(){return this}render(){return l``}loadDynamicStepsAfterDoktype(t){t.detail.currentStepKey==="doktype"&&(t.detail.result=g("page_wizard",this.context).then(e=>{this.steps=[...this.fixedSteps,...e]}).catch(e=>{this.wizard.renderError(z.get("wizard.status.error.message"),e)}))}};o([h({type:Object})],r.prototype,"configuration",void 0),o([c()],r.prototype,"steps",void 0),o([c()],r.prototype,"submissionService",void 0),o([f("typo3-backend-wizard")],r.prototype,"wizard",void 0),r=o([m("typo3-backend-page-wizard")],r);export{r as PageWizard};