text: "use strict";
  
  exports.__esModule = true;
  exports.dataLayerMachine = void 0;
  
  var _xstate = require("xstate");
  
  var _actions = require("./actions");
  
  var _services = require("./services");
  
  const dataLayerStates = {
    initial: `customizingSchema`,
    states: {
      customizingSchema: {
        invoke: {
          src: `customizeSchema`,
          id: `customizing-schema`,
          onDone: {
            target: `sourcingNodes`
          }
        }
      },
      sourcingNodes: {
        invoke: {
          src: `sourceNodes`,
          id: `sourcing-nodes`,
          onDone: {
            target: `buildingSchema`,
            actions: `assignChangedPages`
          }
        }
      },
      buildingSchema: {
        invoke: {
          id: `building-schema`,
          src: `buildSchema`,
          onDone: {
            target: `creatingPages`,
            actions: `assignGatsbyNodeGraphQL`
          }
        }
      },
      creatingPages: {
        invoke: {
          id: `creating-pages`,
          src: `createPages`,
          onDone: [{
            target: `creatingPagesStatefully`,
            actions: `assignChangedPages`,
            cond: context => !!context.firstRun
          }, {
            target: `done`,
            actions: `assignChangedPages`
          }]
        }
      },
      creatingPagesStatefully: {
        invoke: {
          src: `createPagesStatefully`,
          id: `creating-pages-statefully`,
          onDone: {
            target: `done`
          }
        }
      },
      done: {
        type: `final`,
        data: ({
          gatsbyNodeGraphQLFunction,
          graphqlRunner,
          pagesToBuild,
          pagesToDelete
        }) => {
          return {
            gatsbyNodeGraphQLFunction,
            graphqlRunner,
            pagesToBuild,
            pagesToDelete
          };
        }
      }
    }
  };
  const dataLayerMachine = (0, _xstate.Machine)(dataLayerStates, {
    actions: _actions.dataLayerActions,
    services: _services.dataLayerServices
  });
  exports.dataLayerMachine = dataLayerMachine;
  //# sourceMappingURL=index.js.map