"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = WelcomeGuideTemplate;
var _data = require("@wordpress/data");
var _components = require("@wordpress/components");
var _i18n = require("@wordpress/i18n");
var _preferences = require("@wordpress/preferences");
var _editor = require("@wordpress/editor");
var _jsxRuntime = require("react/jsx-runtime");
/**
 * WordPress dependencies
 */

function WelcomeGuideTemplate() {
  const {
    toggle
  } = (0, _data.useDispatch)(_preferences.store);
  const {
    isActive,
    hasPreviousEntity
  } = (0, _data.useSelect)(select => {
    const {
      getEditorSettings
    } = select(_editor.store);
    const {
      get
    } = select(_preferences.store);
    return {
      isActive: get('core/edit-site', 'welcomeGuideTemplate'),
      hasPreviousEntity: !!getEditorSettings().onNavigateToPreviousEntityRecord
    };
  }, []);
  const isVisible = isActive && hasPreviousEntity;
  if (!isVisible) {
    return null;
  }
  const heading = (0, _i18n.__)('Editing a template');
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Guide, {
    className: "edit-site-welcome-guide guide-template",
    contentLabel: heading,
    finishButtonText: (0, _i18n.__)('Continue'),
    onFinish: () => toggle('core/edit-site', 'welcomeGuideTemplate'),
    pages: [{
      image: /*#__PURE__*/(0, _jsxRuntime.jsx)("video", {
        className: "edit-site-welcome-guide__video",
        autoPlay: true,
        loop: true,
        muted: true,
        width: "312",
        height: "240",
        children: /*#__PURE__*/(0, _jsxRuntime.jsx)("source", {
          src: "https://s.w.org/images/block-editor/editing-your-template.mp4",
          type: "video/mp4"
        })
      }),
      content: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
        children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h1", {
          className: "edit-site-welcome-guide__heading",
          children: heading
        }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
          className: "edit-site-welcome-guide__text",
          children: (0, _i18n.__)('Note that the same template can be used by multiple pages, so any changes made here may affect other pages on the site. To switch back to editing the page content click the ‘Back’ button in the toolbar.')
        })]
      })
    }]
  });
}
//# sourceMappingURL=template.js.map