{"ast":null,"code":"import { createSlice } from '@reduxjs/toolkit';\nvar initialState = {\n  templates: [{\n    id: '1',\n    url: 'https://github.com/facebook/react-native.git',\n    name: 'React Native Template',\n    branch: 'main',\n    description: 'Official React Native template'\n  }, {\n    id: '2',\n    url: 'https://github.com/expo/expo.git',\n    name: 'Expo Template',\n    branch: 'main',\n    subDirectory: 'templates/expo-template-blank',\n    description: 'Expo blank template'\n  }],\n  loading: false,\n  error: null\n};\nexport var templatesSlice = createSlice({\n  name: 'templates',\n  initialState: initialState,\n  reducers: {\n    addTemplate: function addTemplate(state, action) {\n      state.templates.push(action.payload);\n    },\n    updateTemplate: function updateTemplate(state, action) {\n      var index = state.templates.findIndex(function (t) {\n        return t.id === action.payload.id;\n      });\n      if (index !== -1) {\n        state.templates[index] = action.payload;\n      }\n    },\n    removeTemplate: function removeTemplate(state, action) {\n      state.templates = state.templates.filter(function (t) {\n        return t.id !== action.payload;\n      });\n    },\n    setLoading: function setLoading(state, action) {\n      state.loading = action.payload;\n    },\n    setError: function setError(state, action) {\n      state.error = action.payload;\n    }\n  }\n});\nvar _templatesSlice$actio = templatesSlice.actions,\n  addTemplate = _templatesSlice$actio.addTemplate,\n  updateTemplate = _templatesSlice$actio.updateTemplate,\n  removeTemplate = _templatesSlice$actio.removeTemplate,\n  setLoading = _templatesSlice$actio.setLoading,\n  setError = _templatesSlice$actio.setError;\nexport { addTemplate, updateTemplate, removeTemplate, setLoading, setError };","map":{"version":3,"names":["createSlice","initialState","templates","id","url","name","branch","description","subDirectory","loading","error","templatesSlice","reducers","addTemplate","state","action","push","payload","updateTemplate","index","findIndex","t","removeTemplate","filter","setLoading","setError","_templatesSlice$actio","actions"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/src/store/templatesSlice.ts"],"sourcesContent":["import { createSlice, PayloadAction } from '@reduxjs/toolkit';\nimport { MobileTemplateRepository } from '../types';\n\ninterface TemplatesState {\n  templates: MobileTemplateRepository[];\n  loading: boolean;\n  error: string | null;\n}\n\nconst initialState: TemplatesState = {\n  templates: [\n    {\n      id: '1',\n      url: 'https://github.com/facebook/react-native.git',\n      name: 'React Native Template',\n      branch: 'main',\n      description: 'Official React Native template'\n    },\n    {\n      id: '2',\n      url: 'https://github.com/expo/expo.git',\n      name: 'Expo Template',\n      branch: 'main',\n      subDirectory: 'templates/expo-template-blank',\n      description: 'Expo blank template'\n    }\n  ],\n  loading: false,\n  error: null,\n};\n\nexport const templatesSlice = createSlice({\n  name: 'templates',\n  initialState,\n  reducers: {\n    addTemplate: (state, action: PayloadAction<MobileTemplateRepository>) => {\n      state.templates.push(action.payload);\n    },\n    updateTemplate: (state, action: PayloadAction<MobileTemplateRepository>) => {\n      const index = state.templates.findIndex(t => t.id === action.payload.id);\n      if (index !== -1) {\n        state.templates[index] = action.payload;\n      }\n    },\n    removeTemplate: (state, action: PayloadAction<string>) => {\n      state.templates = state.templates.filter(t => t.id !== action.payload);\n    },\n    setLoading: (state, action: PayloadAction<boolean>) => {\n      state.loading = action.payload;\n    },\n    setError: (state, action: PayloadAction<string | null>) => {\n      state.error = action.payload;\n    },\n  },\n});\n\nexport const { addTemplate, updateTemplate, removeTemplate, setLoading, setError } = templatesSlice.actions;"],"mappings":"AAAA,SAASA,WAAW,QAAuB,kBAAkB;AAS7D,IAAMC,YAA4B,GAAG;EACnCC,SAAS,EAAE,CACT;IACEC,EAAE,EAAE,GAAG;IACPC,GAAG,EAAE,8CAA8C;IACnDC,IAAI,EAAE,uBAAuB;IAC7BC,MAAM,EAAE,MAAM;IACdC,WAAW,EAAE;EACf,CAAC,EACD;IACEJ,EAAE,EAAE,GAAG;IACPC,GAAG,EAAE,kCAAkC;IACvCC,IAAI,EAAE,eAAe;IACrBC,MAAM,EAAE,MAAM;IACdE,YAAY,EAAE,+BAA+B;IAC7CD,WAAW,EAAE;EACf,CAAC,CACF;EACDE,OAAO,EAAE,KAAK;EACdC,KAAK,EAAE;AACT,CAAC;AAED,OAAO,IAAMC,cAAc,GAAGX,W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