/*
utility to access the store using render function
339251
function createContainer(module) {
  var mapStateToProps = function mapStateToProps(state) {
    return state[module.name];
  };
  var mapDispatchToProps = function mapDispatchToProps(dispatch) {
    return Object.keys(module.actions).map(function (key) {
      var action = module.actions[key];
      return dispatch(action());
    });
  };

  var Container = function Container(props) {
    return props.children(props);
  };
  return (0, _reactRedux.connect)(mapStateToProps, module.actions || {})(Container);
}
248353
function(){
		var options = render.options,
			path = options.render = render._normalizePath( options.render );

		// Ensure render path actually exists
		fs.stat( path, function( e, stat ) {
			if ( e || ! stat || ! stat.isDirectory() ) {
				return munit.exit( 1, e, "'" + path + "' is not a directory" );
			}

			// Check for root munit config file
			fs.exists( path + '/munit.js', function( exists ) {
				if ( exists ) {
					munit.require( path + '/munit.js' );
				}

				// Initialize all files in test path for submodule additions
				render._renderPath( path, function( e ) {
					if ( e ) {
						return munit.exit( 1, e, "Unable to render test path" );
					}

					render._compile();
				});
			});
		});
	}
1333628
function view(template, options = {}) {

	if(!template) {
		throw new Exception('Please pass a template!');
	}

	return Class => {

		let renderedFlag = !(options.renderedFlag === false);

		initCoreMap(storage, Class);
		initViewMap(storage, Class);

		let map = storage.get(Class);

		/**
		 * Its required when we use @style multiple times!
		 * Only once registration!
		 */
		if(map.get('@view').get('callbacksDefined')){
			return;
		}

		map.get('@callbacks').get('created').push((domNode, createVars = {}) => {

			// get and merge dom view var attributes
			let domViewAttributes = extractDomProperties(
				domNode, /^@view\.bind\.(\S+)$/i, true
			);

			// get the restof regular attributes
			let regularDomAttributes = extractDomProperties(domNode);

			let viewBinds = {};
			let entries = map.get('@view').get('bind');
			entries.forEach(([key, value]) => viewBinds[key] = value);

			let viewVars = Object.assign({},
				viewBinds,
				domViewAttributes,
				createVars,
				regularDomAttributes
			);

			// initialize view
			let $view = new View({
				prerenderer: HandlebarsRuntime.template,
				rootNode: domNode,
				vars: viewVars,
				template: template,
			});

			view.helper.registerSetGet(
				domNode,
				Object.assign({}, viewBinds, domViewAttributes)
			);

			// render view
			$view.render(null, {
				renderedFlag: renderedFlag,
			});

			domNode.$view = $view;
		});

		map.get('@callbacks').get('attached').push(domNode => {

			if(domNode.$view.initialized()){
				return;
			}

			/**
			 * Using the same instance is 30% faster in
			 * (Chrome, Opera) and no difference in Firefox
			 * @see: https://jsperf.com/new-class-vs-singleton
			 */
			domNode.$view.reinit({
				rootNode: domNode,
				prerenderer: HandlebarsRuntime.template,
			});
		});

		map.get('@callbacks').get('detached').push(domNode => {
			domNode.$view.destroy();
		});

		map.get('@view').set('callbacksDefined', true);
	}
}
341144
function CacheStore(options) {
    if (!options.id) {
        throw new IdNotDefinedError();
    }
    var storeType, _cache;

    function parseKey(key) {
        return key.replace(/[^a-z0-9]/gi, '_').replace(/^-+/, '').replace(/-+$/, '').toLowerCase();
    }

    /**
     * Returns Cache Store object
     * @returns {Object}
     */
    this.getCacheStore = function () {
        return _cache;
    };

    /**
     * Method initiates cache store depends on type
     * @param type {String} cache store type
     * @returns {CacheStore}
     */
    this._setStoreType = function (type) {
        storeType = type;
        var ttl = options.expires || DEFAULT_EXPIRATION_TIME;
        options.max = options.max || 0; //makes lru cache to store infinite no of items
        switch (type) {
            case STORE_TYPE_MEMORY:
                _cache = CacheManager.caching({store: STORE_TYPE_MEMORY, max: options.max, ttl: ttl});
                break;

            case STORE_TYPE_REDIS:
                _cache = CacheManager.caching({store: RedisStore, db: options.db, ttl: ttl, host: options.host,
                    port: options.port, id: options.id
                });
                break;

            default :
                throw new InvalidCacheStoreTypeError(type);

        }
        //exposing delete method alias of _del
        _cache.delete = _cache.del;
        return this;
    };

    //setting public functions
    /**
     * Gets cache item
     * @param key {String} Key to retrieve cache item
     * @param next {Function} callback. parameters are err, value
     */
    this.get = function (key, next) {
        _cache.get(parseKey(key), next);
    };

    /**
     * Sets cache item in cache.
     * @param key {String} Key to retrieve cache item
     * @param value {String} Value to save cache item
     * @param next {Function} callback. parameters are err
     */
    this.set = function (key, value, next) {
        _cache.set(parseKey(key), value, next);
    };

    /**
     * Delete from cache
     * @param key {String} Key to retrieve cache item
     * @param next {Function} callback. parameters are err
     */
    this.delete = function (key, next) {
        _cache.del(parseKey(key), next);
    };

    /**
     * Wraps a function in cache, the first time the function is run,
     * its results are stored in cache so subsequent calls retrieve from cache
     * instead of calling the function.
     *
     * @example
     *
     *      var key = 'user_' + user_id;
     *      cache.wrap(key, function(cb) {
     *          User.get(user_id, cb);
     *      }, function(err, user) {
     *         console.log(user);
     *      });
     *
     * @param key {String} Key to retrieve cache item
     * @param wrapFn
     * @param next {Function} callback. parameters are err, value
     */
    this.wrap = function (key, wrapFn, next) {
        _cache.wrap(parseKey(key), wrapFn, next);
    };

    /**
     * Flushes the current cache store
     * @param next {Function} callback. parameters are err, success
     */
    this.reset = function (next) {
        _cache.reset(next);
    };

    /**
     * Gets all keys associated with this cache store
     * @param next {Function} callback. parameters are err, keys
     */
    this.keys = function (next) {
        _cache.keys(next);
    };
}
323716
function renderItemsByFolderId(id) {
        resourceDetail.hide();
        resourcesList.show();
        folderId = id;
        urls["getResources"] = urls["getResources"] || getURL("getResources");
        var options = {
            url: urls["getResources"] + '/' + id,
            data: {mode: "exclusive"},
            success: function (data) {
                resourcesList.html(data);

                renderActionButtons();
                var items = resourcesList.find("li");
                items.click(handleItemClick);
            }
        };
        Rocket.ajax(options);
    }
1264931
function store(name, val) {
        if (typeof (Storage) !== 'undefined') {
            localStorage.setItem(name, val)
        } else {
            window.alert('Please use a modern browser to properly view this template!')
        }
    }
668459
function hyperImg(store) {
  this.compile = function(input) {
    var path = input.split('.');
    return {
      path: input,
      target: path[path.length - 1]
    };
  };

  this.state = function(config, state) {
    var res = store.get(config.path, state);
    if (!res.completed) return false;
    return state.set(config.target, res.value);
  };

  this.props = function(config, state, props) {
    var image = state.get(config.target);
    if (!image || !image.src) return props;
    if (image.title) props = props.set('title', image.title);
    return props.set('src', image.src);
  };
}
693100
async function renderList(nj, templList, templateVars) {
  const renderedList = await Promise.map(
    _.without(templList, _.isUndefined),
    async(it) => render(nj, it, templateVars));
  return renderedList;
}
940405
function render(q) {
  if (!q.length) {
    complete();
    return;
  }

  const item = q.shift();

  // render HTML file
  fs.writeFile(`${item.file}.html`, item.html, err => {
    if (err) throw err;

    // if prerendering is enabled
    if (typeof options.prerender === "object" && options.prerender !== null) {
      // wait for response from browser
      puppet.once("message", height => {
        // store height
        item.json.height = height;

        // render JSON file
        fs.writeFile(`${item.file}.json`, JSON.stringify(item.json), err => {
          if (err) throw err;
          process.send(`success::Generated ${item.name}`);

          // render next
          render(q);
        });
      });

      // open html file in browser
      puppet.send({
        url: `http://localhost:${options.prerender.port}/${
          options.prerender.path
        }/${item.slug}.html`
      });

      // if no prerendering is to be done
    } else {
      // render JSON file
      fs.writeFile(`${item.file}.json`, JSON.stringify(item.json), err => {
        if (err) throw err;
        process.send(`success::Generated ${item.name}`);

        // render next
        render(q);
      });
    }
  });
}
1237368
function render()
    {
        if (!isset($this->result)) {
            $this->usageError('Nothing to render!');
        }

        $baseViewFilePath = dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'views';

        if (!empty($_SERVER['argv'])) {
            $viewFilename = $baseViewFilePath.DIRECTORY_SEPARATOR.'console'.DIRECTORY_SEPARATOR.'index.php';
        } else {
            $viewFilename = $baseViewFilePath.DIRECTORY_SEPARATOR.'web'.DIRECTORY_SEPARATOR.'index.php';
        }

        $this->renderViewFile($viewFilename, $this->result);
    }
606431
function getStore(id, callback) {
  db.collection(stores, function(err, collection) {
    if(err) return callback(err);

    collection.findOne({ _id: BSON.ObjectID(id)}, function(err, store) {
      if (err) return callback(err);
      callback(null, store);
    });
  });
}
76536
function __express(filepath, data, next) {
  data = Benchpress.addGlobals(data);
  data._locals = null;

  if (Benchpress.cache[filepath]) {
    render(filepath, data, Benchpress.cache[filepath], next);
    return;
  }

  fs.readFile(filepath, 'utf-8', (err, code) => {
    if (err) {
      next(err);
      return;
    }

    let template;
    try {
      template = Benchpress.cache[filepath] = evaluate(code);
    } catch (e) {
      e.message = `Evaluate failed for template ${filepath}:\n ${e.message}`;
      e.stack = `Evaluate failed for template ${filepath}:\n ${e.stack}`;

      process.nextTick(next, e);
      return;
    }

    render(filepath, data, template, next);
  });
}
617068
function giveStore(ecModel) {
    var store = ecModel[ATTR];
    if (!store) {
        store = ecModel[ATTR] = [{}];
    }
    return store;
}
956659
async function render(view, options) {
    view += settings.viewExt;
    const viewPath = path.join(settings.root, view);
    debug(`render: ${viewPath}`);
    // get from cache
    if (settings.cache && cache[viewPath]) {
      return cache[viewPath].call(options.scope, options);
    }

    const tpl = await fs.readFile(viewPath, 'utf8');

    // override `ejs` node_module `resolveInclude` function
    ejs.resolveInclude = function(name, filename, isDir) {
      if (!path.extname(name)) {
        name += settings.viewExt;
      }
      return parentResolveInclude(name, filename, isDir);
    }

    const fn = ejs.compile(tpl, {
      filename: viewPath,
      _with: settings._with,
      compileDebug: settings.debug && settings.compileDebug,
      debug: settings.debug,
      delimiter: settings.delimiter
    });
    if (settings.cache) {
      cache[viewPath] = fn;
    }

    return fn.call(options.scope, options);
  }
842772
function View_render(source, locals, escape) {
            return this.swig.render(source, {
                locals: locals,
                autoescape: !escape
            });
        }
555274
function Preview() {
    var state = clientStore.getAll();
    var preview = provider.renderPreview(state.selectedKind, state.selectedStory);
    return preview;
  }
942830
function renderItems(items) {
    var filesContainer = document.getElementById('files');
    items.forEach(function (item) {
        var li = document.createElement('li');
        li.innerHTML = item.name;
        filesContainer.appendChild(li);
    });
}