{
  "version": 3,
  "sources": ["ssg:https://framer.com/m/framer/store.js@^1.0.0", "ssg:https://framerusercontent.com/modules/jojPDoWbWb65rBwkaRiD/jH6gbxJByv7ZoJwGq4sR/CMS_Nav_Helper.js"],
  "sourcesContent": ["import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map", "// Welcome to Code in Framer\n// Get Started: https://www.framer.com/developers/\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";//import CMSNav from \"https://framer.com/m/CMS-Nav-ZBOY.js\"\nimport{addPropertyControls,ControlType}from\"framer\";import React,{useState,useEffect}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{emptyStateStyle,stateParagraphStyle,stateTitleStyle}from\"https://framer.com/m/framer/integrations-styles.js@0.2.0\";const useStore=createStore({prev:\"\",next:\"\",current:\"\"});/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/#code-components-auto-sizing\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n * @framerDisableUnlink\n */export default function CMS_NAV(props){//console.log(props.layers)\nfunction EmptyState({title,description}){return /*#__PURE__*/_jsxs(\"div\",{style:{...emptyStateStyle,width:\"100%\",height:\"100%\"},children:[/*#__PURE__*/_jsx(\"h1\",{style:{...stateTitleStyle},children:title}),/*#__PURE__*/_jsx(\"p\",{style:{...stateParagraphStyle},children:description})]});}if(props.layers.length==0||props.cms_nav.length==0){// console.log(\"no layer\")\nreturn EmptyState({title:\"CMS Nav Helper\",description:\"Connect a collection list and your navigation component that contains prev, next, listing and count variables.\"});}// const ref = React.createRef<HTMLDivElement>()\nconst[arrange,setArrange]=useState(false);useEffect(()=>{// console.log(\"hee 2\")\n// cms collection'\u0131n varolamas\u0131n\u0131 bekliyore\nsetTimeout(function(){setArrange(true);},100);return()=>{if(typeof document!==\"undefined\"){if(document.querySelector('[data-framer-name=\"Listing\"]')){// console.log(\"Anything in here is fired on component unmount.\")\n}}// Anything in here is fired on component unmount.\n};},[]);// console.log(props)\ntry{try{try{var resolved=props.layers[0].props.children.props.children.type({query:props.layers[0].props.children.props.children.props.query,children:props.layers[0].props.children.props.children.props.children});}catch(e){var resolved=props.layers[0].props.children.type({query:props.layers[0].props.children.props.query,children:props.layers[0].props.children.props.children});}}catch(e){var resolved=props.layers[0].type({query:props.layers[0].props.query,children:props.layers[0].props.children});}// console.log(props.layers[0])\n// console.log(\"resolved\", resolved)\nvar allPosts=resolved.props.children;var currentImageSrc,currentPostSlug,currentKey,dynamicKey,total,index;allPosts.forEach(function(post,key){var image=post.props.children.props.children.props.children.props.children[0].props.background;if(document.querySelector(\"img[src='\"+image.src+\"']\")){var _post_props_children_props,_post_props_children;// console.log(\"this is the current\", image, post)\nconst dynamicValue=(_post_props_children=post.props.children)===null||_post_props_children===void 0?void 0:(_post_props_children_props=_post_props_children.props)===null||_post_props_children_props===void 0?void 0:_post_props_children_props.value;dynamicKey=dynamicValue?Object.keys(dynamicValue)[0]:undefined;currentImageSrc=image.src;currentPostSlug=post.props.children.props[\"value\"][dynamicKey];currentKey=key;}});// console.log({ currentImageSrc, currentPostSlug, currentKey })\n// if you are not using \"reverse\"\n// swicth prev and next\nvar next,prev;if(currentKey==allPosts.length-1){var _allPosts__props_children_props,_allPosts__props_children;const dynamicValue=(_allPosts__props_children=allPosts[0].props.children)===null||_allPosts__props_children===void 0?void 0:(_allPosts__props_children_props=_allPosts__props_children.props)===null||_allPosts__props_children_props===void 0?void 0:_allPosts__props_children_props.value;const dynamicKey=dynamicValue?Object.keys(dynamicValue)[0]:undefined;next=allPosts[0].props.children.props[\"value\"][dynamicKey];}else{// console.log(\"hello\")\n// console.log(dynamicKey)\nnext=allPosts[currentKey+1].props.children.props[\"value\"][dynamicKey];}if(currentKey==0){prev=allPosts[allPosts.length-1].props.children.props[\"value\"][dynamicKey];}else{prev=allPosts[currentKey-1].props.children.props[\"value\"][dynamicKey];}total=parseInt(allPosts.length),index=parseInt(currentKey);//console.log({ prev, next, total, index })\n}catch(e){}var listing=`./${props.cmsPath}`;var prevLink=`./${props.cmsPath}/${prev}`;var nextLink=`./${props.cmsPath}/${next}`;var count=`${index+1} / ${total}`;if(typeof document!==\"undefined\"){if(document.querySelector(\"[data-framer-name=Prev]\")){document.onkeydown=function(event){event.stopPropagation();event.preventDefault();switch(event.keyCode){case 37:document.querySelector(\"[data-framer-name=Prev]\").click();break;case 38:document.querySelector(\"[data-framer-name=Listing]\").click();break;case 39:document.querySelector(\"[data-framer-name=Next]\").click();break;}};}}var style;if(props.fullView){style={width:\"100%\",height:\"96vh\"};}else{style={width:\"auto\"};}try{var clonedCmsNav=/*#__PURE__*/React.cloneElement(props.cms_nav[0].props.children.props.children,{prev:prevLink,next:nextLink,listing:listing,count:total?count:\"\",style:style});}catch(e){try{var clonedCmsNav=/*#__PURE__*/React.cloneElement(props.cms_nav[0].props.children,{prev:prevLink,next:nextLink,listing:listing,count:total?count:\"\",style:style});}catch(e){var clonedCmsNav=/*#__PURE__*/React.cloneElement(props.cms_nav[0],{prev:prevLink,next:nextLink,listing:listing,count:total?count:\"\",style:style});}}return /*#__PURE__*/_jsx(\"div\",{children:clonedCmsNav});}// Styles are written in object syntax\n// Learn more: https://reactjs.org/docs/dom-elements.html#style\nconst containerStyle={height:\"100%\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",overflow:\"hidden\"};CMS_NAV.displayName=\"CMS Nav Helper\";addPropertyControls(CMS_NAV,{layers:{type:ControlType.ComponentInstance},cms_nav:{type:ControlType.ComponentInstance},cmsPath:{type:ControlType.String},fullView:{type:ControlType.Boolean,defaultValue:false}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CMS_NAV\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CMS_Nav_Helper.map"],
  "mappings": "qLAAqF,SAASA,EAAYC,EAAO,CACjH,IAAMC,EAAUC,EAAK,CAAC,MAAM,OAAO,OAAO,CAAC,GAAGF,CAAM,CAAC,CAAC,CAAC,EACjDG,EAAaC,GAAU,CAC1B,OAAOA,GAAW,aAAYA,EAASA,EAASH,EAAU,KAAK,GAAGA,EAAU,MAAM,OAAO,OAAO,CAAC,GAAGA,EAAU,MAAM,GAAGG,CAAQ,CAAC,CAAE,EACjIC,EAAW,OAAOL,GAAS,SAAS,OAAO,OAAO,CA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M,SAAUoC,EAAM,CAAC,MAAM,OAAO,OAAO,MAAM,EAAQA,EAAM,CAAC,MAAM,MAAM,EAAG,GAAG,CAAC,IAAIC,EAA0BC,EAAM,aAAatC,EAAM,QAAQ,CAAC,EAAE,MAAM,SAAS,MAAM,SAAS,CAAC,KAAKgC,EAAS,KAAKC,EAAS,QAAQF,EAAQ,MAAMZ,EAAMe,EAAM,GAAG,MAAME,CAAK,CAAC,CAAE,MAAS,CAAC,GAAG,CAAC,IAAIC,EAA0BC,EAAM,aAAatC,EAAM,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC,KAAKgC,EAAS,KAAKC,EAAS,QAAQF,EAAQ,MAAMZ,EAAMe,EAAM,GAAG,MAAME,CAAK,CAAC,CAAE,MAAS,CAAC,IAAIC,EAA0BC,EAAM,aAAatC,EAAM,QAAQ,CAAC,EAAE,CAAC,KAAKgC,EAAS,KAAKC,EAAS,QAAQF,EAAQ,MAAMZ,EAAMe,EAAM,GAAG,MAAME,CAAK,CAAC,CAAE,CAAC,CAAC,OAAoB9B,EAAK,MAAM,CAAC,SAAS+B,CAAY,CAAC,CAAE,CAErmCE,EAAQ,YAAY,iBAAiBC,EAAoBD,EAAQ,CAAC,OAAO,CAAC,KAAKE,EAAY,iBAAiB,EAAE,QAAQ,CAAC,KAAKA,EAAY,iBAAiB,EAAE,QAAQ,CAAC,KAAKA,EAAY,MAAM,EAAE,SAAS,CAAC,KAAKA,EAAY,QAAQ,aAAa,EAAK,CAAC,CAAC",
  "names": ["createStore", "state1", "dataStore", "Data", "setDataStore", "newState", "storeState", "storeSetters", "setStoreState", "setter", "useStore", "state", "setState", "ye", "ue", "useObserveData", "useStore", "createStore", "CMS_NAV", "props", "EmptyState", "title", "description", "u", "emptyStateStyle", "p", "stateTitleStyle", "stateParagraphStyle", "arrange", "setArrange", "ye", "ue", "resolved", "allPosts", "currentImageSrc", "currentPostSlug", "currentKey", "dynamicKey", "total", "index", "post", "key", "image", "_post_props_children_props", "_post_props_children", "dynamicValue", "next", "prev", "_allPosts__props_children_props", "_allPosts__props_children", "listing", "prevLink", "nextLink", "count", "event", "style", "clonedCmsNav", "e", "CMS_NAV", "addPropertyControls", "ControlType"]
}
