/* generated by Svelte vX.Y.Z */
import { addLoc, append, assign, createElement, createText, detachNode, init, insert, protoDev, setData } from "svelte/shared.js";

function bar({ foo }) {
	return foo * 2;
}

const file = undefined;

function create_main_fragment(component, ctx) {
	var p, text_value = ctx.Math.max(0, ctx.foo), text, text_1, text_2;

	return {
		c: function create() {
			p = createElement("p");
			text = createText(text_value);
			text_1 = createText("\n\t");
			text_2 = createText(ctx.bar);
			addLoc(p, file, 0, 0, 0);
		},

		m: function mount(target, anchor) {
			insert(target, p, anchor);
			append(p, text);
			append(p, text_1);
			append(p, text_2);
		},

		p: function update(changed, ctx) {
			if ((changed.Math || changed.foo) && text_value !== (text_value = ctx.Math.max(0, ctx.foo))) {
				setData(text, text_value);
			}

			if (changed.bar) {
				setData(text_2, ctx.bar);
			}
		},

		d: function destroy(detach) {
			if (detach) {
				detachNode(p);
			}
		}
	};
}

function SvelteComponent(options) {
	this._debugName = '<SvelteComponent>';
	if (!options || (!options.target && !options.root)) throw new Error("'target' is a required option");
	init(this, options);
	this._state = assign({ Math : Math }, options.data);
	this._recompute({ foo: 1 }, this._state);
	if (!('foo' in this._state)) console.warn("<SvelteComponent> was created without expected data property 'foo'");
	this._intro = true;

	this._fragment = create_main_fragment(this, this._state);

	if (options.target) {
		if (options.hydrate) throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
		this._fragment.c();
		this._mount(options.target, options.anchor);
	}
}

assign(SvelteComponent.prototype, protoDev);

SvelteComponent.prototype._checkReadOnly = function _checkReadOnly(newState) {
	if ('bar' in newState && !this._updatingReadonlyProperty) throw new Error("<SvelteComponent>: Cannot set read-only property 'bar'");
};

SvelteComponent.prototype._recompute = function _recompute(changed, state) {
	if (changed.foo) {
		if (this._differs(state.bar, (state.bar = bar(state)))) changed.bar = true;
	}
}
export default SvelteComponent;