Socket
Socket
Sign inDemoInstall

@plasmicapp/host

Package Overview
Dependencies
Maintainers
1
Versions
247
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@plasmicapp/host - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

28

dist/fiber.d.ts
/// <reference types="react" />
export declare type Fiber = FiberForComponentClass | FiberForFunctionComponent | FiberForInstrinsicElement | FiberForTextNode | FiberForOtherNodes;
interface FiberBase {
tag: WorkTag;
child: Fiber | null;
sibling: Fiber | null;
return: Fiber | null;
alternate: Fiber | null;
key: null | string;

@@ -11,2 +13,3 @@ ref: React.Ref<any>;

memoizedProps: any;
memoizedState: any;
}

@@ -38,2 +41,27 @@ export interface FiberForFunctionComponent extends FiberBase {

}
declare type WorkTag = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24;
export declare const FunctionComponent = 0;
export declare const ClassComponent = 1;
export declare const IndeterminateComponent = 2;
export declare const HostRoot = 3;
export declare const HostPortal = 4;
export declare const HostComponent = 5;
export declare const HostText = 6;
export declare const Fragment = 7;
export declare const Mode = 8;
export declare const ContextConsumer = 9;
export declare const ContextProvider = 10;
export declare const ForwardRef = 11;
export declare const Profiler = 12;
export declare const SuspenseComponent = 13;
export declare const MemoComponent = 14;
export declare const SimpleMemoComponent = 15;
export declare const LazyComponent = 16;
export declare const IncompleteClassComponent = 17;
export declare const DehydratedFragment = 18;
export declare const SuspenseListComponent = 19;
export declare const ScopeComponent = 21;
export declare const OffscreenComponent = 22;
export declare const LegacyHiddenComponent = 23;
export declare const CacheComponent = 24;
export {};

2

dist/globalHook.d.ts
import { Fiber } from "./fiber";
interface GlobalHookCtx {
uidToFiber: Map<number, Fiber>;
startedEvalCount: number;
finishedEvalCount: number;
}
export declare const globalHookCtx: GlobalHookCtx;
export {};

@@ -41,2 +41,9 @@ 'use strict';

function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {

@@ -51,38 +58,68 @@ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {

function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
function _construct(Parent, args, Class) {
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return _construct.apply(null, arguments);
}
return arr2;
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}

@@ -106,998 +143,125 @@

}
var AssertionError = /*#__PURE__*/function (_Error) {
_inheritsLoose(AssertionError, _Error);
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
function AssertionError(msg) {
if (msg === void 0) {
msg = "Assertion failed";
}
var runtime_1 = createCommonjsModule(function (module) {
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var runtime = (function (exports) {
var Op = Object.prototype;
var hasOwn = Op.hasOwnProperty;
var undefined$1; // More compressible than void 0.
var $Symbol = typeof Symbol === "function" ? Symbol : {};
var iteratorSymbol = $Symbol.iterator || "@@iterator";
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
return obj[key];
return _Error.call(this, msg) || this;
}
try {
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
define({}, "");
} catch (err) {
define = function(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
var generator = Object.create(protoGenerator.prototype);
var context = new Context(tryLocsList || []);
// The ._invoke method unifies the implementations of the .next,
// .throw, and .return methods.
generator._invoke = makeInvokeMethod(innerFn, self, context);
return generator;
return AssertionError;
}( /*#__PURE__*/_wrapNativeSuper(Error));
function assert(cond, msg) {
if (msg === void 0) {
msg = "Assertion failed";
}
exports.wrap = wrap;
// Try/catch helper to minimize deoptimizations. Returns a completion
// record like context.tryEntries[i].completion. This interface could
// have been (and was previously) designed to take a closure to be
// invoked without arguments, but in all the cases we care about we
// already have an existing method we want to call, so there's no need
// to create a new function object. We can even get away with assuming
// the method takes exactly one argument, since that happens to be true
// in every case, so we don't have to touch the arguments object. The
// only additional allocation required is the completion record, which
// has a stable shape and so hopefully should be cheap to allocate.
function tryCatch(fn, obj, arg) {
try {
return { type: "normal", arg: fn.call(obj, arg) };
} catch (err) {
return { type: "throw", arg: err };
}
if (!cond) {
// We always generate an non empty message so that it doesn't get swallowed
// by the async library.
msg = (isString(msg) ? msg : msg()) || "Assertion failed";
debugger;
throw new AssertionError(msg);
}
}
var GenStateSuspendedStart = "suspendedStart";
var GenStateSuspendedYield = "suspendedYield";
var GenStateExecuting = "executing";
var GenStateCompleted = "completed";
var SuspenseComponent = 13;
// Returning this object from the innerFn has the same effect as
// breaking out of the dispatch switch statement.
var ContinueSentinel = {};
function traverseUpdates(node, prev, visit) {
// Suspense nodes are special cases that need some magic
// (when they timout, they don't unmount because might lose important state)
var isSuspense = node.tag === SuspenseComponent;
var prevDidTimeout = isSuspense && prev.memoizedState !== null;
var nextDidTimeOut = isSuspense && node.memoizedState !== null;
// Dummy constructor functions that we use as the .constructor and
// .constructor.prototype properties for functions that return Generator
// objects. For full spec compliance, you may wish to configure your
// minifier not to mangle the names of these two functions.
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
if (prevDidTimeout && nextDidTimeOut) {
// Special case
var child = node.child;
var nextFallback = child ? child.sibling : null;
var prevChild = prev.child;
var prevFallback = prevChild ? prevChild.sibling : null;
// This is a polyfill for %IteratorPrototype% for environments that
// don't natively support it.
var IteratorPrototype = {};
IteratorPrototype[iteratorSymbol] = function () {
return this;
};
if (nextFallback != null && prevFallback != null) {
traverseUpdates(nextFallback, prevFallback, visit);
}
} else if (prevDidTimeout && !nextDidTimeOut) {
// Special case
var nextPrimaryChildSet = node.child;
var getProto = Object.getPrototypeOf;
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
if (NativeIteratorPrototype &&
NativeIteratorPrototype !== Op &&
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
// This environment has a native %IteratorPrototype%; use it instead
// of the polyfill.
IteratorPrototype = NativeIteratorPrototype;
}
if (nextPrimaryChildSet != null) {
traverseTree(nextPrimaryChildSet, visit, true, true);
}
} else if (!prevDidTimeout && nextDidTimeOut) {
// Special case
var _child = node.child;
var Gp = GeneratorFunctionPrototype.prototype =
Generator.prototype = Object.create(IteratorPrototype);
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
GeneratorFunctionPrototype.constructor = GeneratorFunction;
GeneratorFunction.displayName = define(
GeneratorFunctionPrototype,
toStringTagSymbol,
"GeneratorFunction"
);
var _nextFallback = _child ? _child.sibling : null;
// Helper for defining the .next, .throw, and .return methods of the
// Iterator interface in terms of a single ._invoke method.
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
exports.isGeneratorFunction = function(genFun) {
var ctor = typeof genFun === "function" && genFun.constructor;
return ctor
? ctor === GeneratorFunction ||
// For the native GeneratorFunction constructor, the best we can
// do is to check its .name property.
(ctor.displayName || ctor.name) === "GeneratorFunction"
: false;
};
exports.mark = function(genFun) {
if (Object.setPrototypeOf) {
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
} else {
genFun.__proto__ = GeneratorFunctionPrototype;
define(genFun, toStringTagSymbol, "GeneratorFunction");
if (_nextFallback != null) {
traverseTree(_nextFallback, visit, true, true);
}
genFun.prototype = Object.create(Gp);
return genFun;
};
} else {
// Common case
if (node.child !== prev.child) {
var _child2 = node.child;
// Within the body of any async function, `await x` is transformed to
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
// `hasOwn.call(value, "__await")` to determine if the yielded value is
// meant to be awaited.
exports.awrap = function(arg) {
return { __await: arg };
};
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if (record.type === "throw") {
reject(record.arg);
} else {
var result = record.arg;
var value = result.value;
if (value &&
typeof value === "object" &&
hasOwn.call(value, "__await")) {
return PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
});
while (_child2) {
if (_child2.alternate) {
traverseUpdates(_child2, _child2.alternate, visit);
} else {
traverseTree(_child2, visit, true, false);
}
return PromiseImpl.resolve(value).then(function(unwrapped) {
// When a yielded Promise is resolved, its final value becomes
// the .value of the Promise<{value,done}> result for the
// current iteration.
result.value = unwrapped;
resolve(result);
}, function(error) {
// If a rejected Promise was yielded, throw the rejection back
// into the async generator function so it can be handled there.
return invoke("throw", error, resolve, reject);
});
_child2 = _child2.sibling;
}
}
}
var previousPromise;
function enqueue(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise =
// If enqueue has been called before, then we want to wait until
// all previous Promises have been resolved before calling invoke,
// so that results are always delivered in the correct order. If
// enqueue has not been called before, then it is important to
// call invoke immediately, without waiting on a callback to fire,
// so that the async generator function has the opportunity to do
// any necessary setup in a predictable way. This predictability
// is why the Promise constructor synchronously invokes its
// executor callback, and why async functions synchronously
// execute code before the first await. Since we implement simple
// async functions in terms of async generators, it is especially
// important to get this right, even though it requires care.
previousPromise ? previousPromise.then(
callInvokeWithMethodAndArg,
// Avoid propagating failures to Promises returned by later
// invocations of the iterator.
callInvokeWithMethodAndArg
) : callInvokeWithMethodAndArg();
visit(node);
}
function traverseTree(node, // Returns true if we should stop traversing
visit, visitChildFirst, visitSiblings) {
if (!visitChildFirst) {
if (visit(node)) {
return true;
}
// Define the unified helper method that is used to implement .next,
// .throw, and .return (see defineIteratorMethods).
this._invoke = enqueue;
}
defineIteratorMethods(AsyncIterator.prototype);
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
return this;
};
exports.AsyncIterator = AsyncIterator;
var isSuspense = node.tag === SuspenseComponent;
var didTimeout = isSuspense && node.memoizedState !== null;
// Note that simple async functions are implemented on top of
// AsyncIterator objects; they just return a Promise for the value of
// the final result produced by the iterator.
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
if (PromiseImpl === void 0) PromiseImpl = Promise;
if (isSuspense && didTimeout) {
var primary = node.child;
var fallback = primary ? primary.sibling : null;
var fallbackChild = fallback ? fallback.child : null;
var iter = new AsyncIterator(
wrap(innerFn, outerFn, self, tryLocsList),
PromiseImpl
);
return exports.isGeneratorFunction(outerFn)
? iter // If outerFn is a generator, return the full iterator.
: iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
};
function makeInvokeMethod(innerFn, self, context) {
var state = GenStateSuspendedStart;
return function invoke(method, arg) {
if (state === GenStateExecuting) {
throw new Error("Generator is already running");
if (fallbackChild !== null) {
if (traverseTree(fallbackChild, visit, visitChildFirst, true)) {
return true;
}
if (state === GenStateCompleted) {
if (method === "throw") {
throw arg;
}
// Be forgiving, per 25.3.3.3.3 of the spec:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
return doneResult();
}
context.method = method;
context.arg = arg;
while (true) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if (context.method === "next") {
// Setting context._sent for legacy support of Babel's
// function.sent implementation.
context.sent = context._sent = context.arg;
} else if (context.method === "throw") {
if (state === GenStateSuspendedStart) {
state = GenStateCompleted;
throw context.arg;
}
context.dispatchException(context.arg);
} else if (context.method === "return") {
context.abrupt("return", context.arg);
}
state = GenStateExecuting;
var record = tryCatch(innerFn, self, context);
if (record.type === "normal") {
// If an exception is thrown from innerFn, we leave state ===
// GenStateExecuting and loop back for another invocation.
state = context.done
? GenStateCompleted
: GenStateSuspendedYield;
if (record.arg === ContinueSentinel) {
continue;
}
return {
value: record.arg,
done: context.done
};
} else if (record.type === "throw") {
state = GenStateCompleted;
// Dispatch the exception by looping back around to the
// context.dispatchException(context.arg) call above.
context.method = "throw";
context.arg = record.arg;
}
}
};
}
// Call delegate.iterator[context.method](context.arg) and handle the
// result, either by returning a { value, done } result from the
// delegate iterator, or by modifying context.method and context.arg,
// setting context.delegate to null, and returning the ContinueSentinel.
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (method === undefined$1) {
// A .throw or .return when the delegate iterator has no .throw
// method always terminates the yield* loop.
context.delegate = null;
if (context.method === "throw") {
// Note: ["return"] must be used for ES3 parsing compatibility.
if (delegate.iterator["return"]) {
// If the delegate iterator has a return method, give it a
// chance to clean up.
context.method = "return";
context.arg = undefined$1;
maybeInvokeDelegate(delegate, context);
if (context.method === "throw") {
// If maybeInvokeDelegate(context) changed context.method from
// "return" to "throw", let that override the TypeError below.
return ContinueSentinel;
}
}
context.method = "throw";
context.arg = new TypeError(
"The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if (record.type === "throw") {
context.method = "throw";
context.arg = record.arg;
context.delegate = null;
return ContinueSentinel;
}
var info = record.arg;
if (! info) {
context.method = "throw";
context.arg = new TypeError("iterator result is not an object");
context.delegate = null;
return ContinueSentinel;
}
if (info.done) {
// Assign the result of the finished delegate to the temporary
// variable specified by delegate.resultName (see delegateYield).
context[delegate.resultName] = info.value;
// Resume execution at the desired location (see delegateYield).
context.next = delegate.nextLoc;
// If context.method was "throw" but the delegate handled the
// exception, let the outer generator proceed normally. If
// context.method was "next", forget context.arg since it has been
// "consumed" by the delegate iterator. If context.method was
// "return", allow the original .return call to continue in the
// outer generator.
if (context.method !== "return") {
context.method = "next";
context.arg = undefined$1;
} else {
if (node.child !== null) {
if (traverseTree(node.child, visit, visitChildFirst, true)) {
return true;
}
} else {
// Re-yield the result returned by the delegate method.
return info;
}
// The delegate iterator is finished, so forget it and continue with
// the outer generator.
context.delegate = null;
return ContinueSentinel;
}
// Define Generator.prototype.{next,throw,return} in terms of the
// unified ._invoke helper method.
defineIteratorMethods(Gp);
define(Gp, toStringTagSymbol, "Generator");
// A Generator should always return itself as the iterator object when the
// @@iterator function is called on it. Some browsers' implementations of the
// iterator prototype chain incorrectly implement this, causing the Generator
// object to not be returned from this call. This ensures that doesn't happen.
// See https://github.com/facebook/regenerator/issues/274 for more details.
Gp[iteratorSymbol] = function() {
return this;
};
Gp.toString = function() {
return "[object Generator]";
};
function pushTryEntry(locs) {
var entry = { tryLoc: locs[0] };
if (1 in locs) {
entry.catchLoc = locs[1];
if (visitSiblings && node.sibling !== null) {
if (traverseTree(node.sibling, visit, visitChildFirst, true)) {
return true;
}
if (2 in locs) {
entry.finallyLoc = locs[2];
entry.afterLoc = locs[3];
}
this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal";
delete record.arg;
entry.completion = record;
if (visitChildFirst) {
return visit(node);
}
function Context(tryLocsList) {
// The root entry object (effectively a try statement without a catch
// or a finally block) gives us a place to store values thrown from
// locations where there is no enclosing try statement.
this.tryEntries = [{ tryLoc: "root" }];
tryLocsList.forEach(pushTryEntry, this);
this.reset(true);
}
exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
keys.reverse();
// Rather than returning an object with a next method, we keep
// things simple and return the next function itself.
return function next() {
while (keys.length) {
var key = keys.pop();
if (key in object) {
next.value = key;
next.done = false;
return next;
}
}
// To avoid creating an additional object, we just hang the .value
// and .done properties off the next function object itself. This
// also ensures that the minifier will not anonymize the function.
next.done = true;
return next;
};
};
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) {
return iteratorMethod.call(iterable);
}
if (typeof iterable.next === "function") {
return iterable;
}
if (!isNaN(iterable.length)) {
var i = -1, next = function next() {
while (++i < iterable.length) {
if (hasOwn.call(iterable, i)) {
next.value = iterable[i];
next.done = false;
return next;
}
}
next.value = undefined$1;
next.done = true;
return next;
};
return next.next = next;
}
}
// Return an iterator with no values.
return { next: doneResult };
}
exports.values = values;
function doneResult() {
return { value: undefined$1, done: true };
}
Context.prototype = {
constructor: Context,
reset: function(skipTempReset) {
this.prev = 0;
this.next = 0;
// Resetting context._sent for legacy support of Babel's
// function.sent implementation.
this.sent = this._sent = undefined$1;
this.done = false;
this.delegate = null;
this.method = "next";
this.arg = undefined$1;
this.tryEntries.forEach(resetTryEntry);
if (!skipTempReset) {
for (var name in this) {
// Not sure about the optimal order of these conditions:
if (name.charAt(0) === "t" &&
hasOwn.call(this, name) &&
!isNaN(+name.slice(1))) {
this[name] = undefined$1;
}
}
}
},
stop: function() {
this.done = true;
var rootEntry = this.tryEntries[0];
var rootRecord = rootEntry.completion;
if (rootRecord.type === "throw") {
throw rootRecord.arg;
}
return this.rval;
},
dispatchException: function(exception) {
if (this.done) {
throw exception;
}
var context = this;
function handle(loc, caught) {
record.type = "throw";
record.arg = exception;
context.next = loc;
if (caught) {
// If the dispatched exception was caught by a catch block,
// then let that catch block handle the exception normally.
context.method = "next";
context.arg = undefined$1;
}
return !! caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
var record = entry.completion;
if (entry.tryLoc === "root") {
// Exception thrown outside of any try block that could handle
// it, so set the completion value of the entire function to
// throw the exception.
return handle("end");
}
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc");
var hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
} else if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else if (hasCatch) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
}
} else if (hasFinally) {
if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else {
throw new Error("try statement without catch or finally");
}
}
}
},
abrupt: function(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev &&
hasOwn.call(entry, "finallyLoc") &&
this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
if (finallyEntry &&
(type === "break" ||
type === "continue") &&
finallyEntry.tryLoc <= arg &&
arg <= finallyEntry.finallyLoc) {
// Ignore the finally entry if control is not jumping to a
// location outside the try/catch block.
finallyEntry = null;
}
var record = finallyEntry ? finallyEntry.completion : {};
record.type = type;
record.arg = arg;
if (finallyEntry) {
this.method = "next";
this.next = finallyEntry.finallyLoc;
return ContinueSentinel;
}
return this.complete(record);
},
complete: function(record, afterLoc) {
if (record.type === "throw") {
throw record.arg;
}
if (record.type === "break" ||
record.type === "continue") {
this.next = record.arg;
} else if (record.type === "return") {
this.rval = this.arg = record.arg;
this.method = "return";
this.next = "end";
} else if (record.type === "normal" && afterLoc) {
this.next = afterLoc;
}
return ContinueSentinel;
},
finish: function(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) {
this.complete(entry.completion, entry.afterLoc);
resetTryEntry(entry);
return ContinueSentinel;
}
}
},
"catch": function(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if (record.type === "throw") {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
// The context.catch method must only be called with a location
// argument that corresponds to a known catch block.
throw new Error("illegal catch attempt");
},
delegateYield: function(iterable, resultName, nextLoc) {
this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
};
if (this.method === "next") {
// Deliberately forget the last sent value so that we don't
// accidentally pass it on to the delegate.
this.arg = undefined$1;
}
return ContinueSentinel;
}
};
// Regardless of whether this script is executing as a CommonJS module
// or not, return the runtime object so that we can declare the variable
// regeneratorRuntime in the outer scope, which allows this module to be
// injected easily by `bin/regenerator --include-runtime script.js`.
return exports;
}(
// If this script is executing as a CommonJS module, use module.exports
// as the regeneratorRuntime namespace. Otherwise create a new empty
// object. Either way, the resulting object will be used to initialize
// the regeneratorRuntime variable at the top of this file.
module.exports
));
try {
regeneratorRuntime = runtime;
} catch (accidentalStrictMode) {
// This module should not be running in strict mode, so the above
// assignment should always work unless something is misconfigured. Just
// in case runtime.js accidentally runs in strict mode, we can escape
// strict mode using a global Function call. This could conceivably fail
// if a Content Security Policy forbids using Function, but in that case
// the proper solution is to fix the accidental strict mode problem. If
// you've misconfigured your bundler to force strict mode and applied a
// CSP to forbid Function, and you're not willing to fix either of those
// problems, please detail your unique predicament in a GitHub issue.
Function("r", "regeneratorRuntime = r")(runtime);
return false;
}
});
var _marked4 = /*#__PURE__*/runtime_1.mark(traverseGenerator);
/*
from https://github.com/bendtherules/react-fiber-traverse
The MIT License (MIT)
Copyright (c) 2019-present bendtherules <abhasbhattacharya2@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/**
* Traverse nodes recursively using generators.
*
* This is the advanced traverse function, which can be used used
* to write other variants of traversal and find.
*
* Type signature for generator.next first argument is `{ skipChild?: boolean; skipSibling?: boolean } | void `
* Throw any error into the generator to finish the generator and let it cleanup its internals.
*
* It allows inversion of control -
* so, application code can decide to
* 1. change order of traversal,
* 2. skip some elements,
* 3. cancel traversal mid-way.
*
* @example
* ```js
* // Basic use (for-of)
*
* const nodeIterator = traverseGenerator(rootNode);
* for (const node of nodeIterator) {
* // do something with each node here
* }
* ```
* ------
*
* @example
* ```js
* // Breadth-first
*
* // note the order below
* const nodeIterator = traverseGenerator(rootNode, ["self", "sibling", "child"]);
* // rest - same as above
* ```
* -----
*
* @example
* ```js
* // Get first 3 nodes and then stop the generator
*
* const nodeIterator = traverseGenerator(rootNode);
*
* var count = 0;
* var next;
* while (
* count < 3 &&
* !(next = nodeIterator.next()).done
* ) {
* count++;
* const node = next.value;
* // do something with each node here
* }
*
* // Finish generator, to prevent memory leak
* nodeIterator.throw(new Error());
* ```
* -----
*
*/
function traverseGenerator(node, _temp) {
var _marked, _marked2, _marked3, _ref, _ref$order, order, _ref$skipSiblingForSt, skipSiblingForStartNode, _ref$skipSelfForStart, skipSelfForStartNode, skipChild, skipSibling, skipSelf, traverseSelf, traverseChild, traverseSibling, traverseMap, orderedGenerators, _iterator, _step, eachGen;
return runtime_1.wrap(function traverseGenerator$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
traverseSibling = function _traverseSibling() {
var nextNode;
return runtime_1.wrap(function traverseSibling$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
if (!(!skipSibling && node.sibling !== null)) {
_context3.next = 3;
break;
}
nextNode = node.sibling;
return _context3.delegateYield(traverseGenerator(nextNode, {
order: order,
skipSiblingForStartNode: false,
skipSelfForStartNode: false
}), "t0", 3);
case 3:
case "end":
return _context3.stop();
}
}
}, _marked3);
};
traverseChild = function _traverseChild() {
var nextNode;
return runtime_1.wrap(function traverseChild$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!(!skipChild && node.child !== null)) {
_context2.next = 3;
break;
}
nextNode = node.child;
return _context2.delegateYield(traverseGenerator(nextNode, {
order: order,
skipSiblingForStartNode: false,
skipSelfForStartNode: false
}), "t0", 3);
case 3:
case "end":
return _context2.stop();
}
}
}, _marked2);
};
traverseSelf = function _traverseSelf() {
var controlInput, _controlInput$skipChi, _controlInput$skipSib;
return runtime_1.wrap(function traverseSelf$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (skipSelf) {
_context.next = 5;
break;
}
_context.next = 3;
return node;
case 3:
controlInput = _context.sent;
if (controlInput !== undefined) {
_controlInput$skipChi = controlInput.skipChild;
skipChild = _controlInput$skipChi === void 0 ? skipChild : _controlInput$skipChi;
_controlInput$skipSib = controlInput.skipSibling;
skipSibling = _controlInput$skipSib === void 0 ? skipSibling : _controlInput$skipSib;
}
case 5:
case "end":
return _context.stop();
}
}
}, _marked);
};
_marked = /*#__PURE__*/runtime_1.mark(traverseSelf), _marked2 = /*#__PURE__*/runtime_1.mark(traverseChild), _marked3 = /*#__PURE__*/runtime_1.mark(traverseSibling);
_ref = _temp === void 0 ? {} : _temp, _ref$order = _ref.order, order = _ref$order === void 0 ? ["self", "child", "sibling"] : _ref$order, _ref$skipSiblingForSt = _ref.skipSiblingForStartNode, skipSiblingForStartNode = _ref$skipSiblingForSt === void 0 ? true : _ref$skipSiblingForSt, _ref$skipSelfForStart = _ref.skipSelfForStartNode, skipSelfForStartNode = _ref$skipSelfForStart === void 0 ? false : _ref$skipSelfForStart;
skipChild = false, skipSibling = skipSiblingForStartNode, skipSelf = skipSelfForStartNode;
traverseMap = {
self: traverseSelf,
child: traverseChild,
sibling: traverseSibling
}; // For each item mentioned in order, find generator functions to run
orderedGenerators = order.map(function (step) {
return traverseMap[step];
}).filter(function (tmp) {
return tmp !== undefined;
}); // Now run each generator till end
_iterator = _createForOfIteratorHelperLoose(orderedGenerators);
case 9:
if ((_step = _iterator()).done) {
_context4.next = 14;
break;
}
eachGen = _step.value;
return _context4.delegateYield(eachGen(), "t0", 12);
case 12:
_context4.next = 9;
break;
case 14:
case "end":
return _context4.stop();
}
}
}, _marked4);
}
/**
* Traverse nodes recursively in depth-first manner, starting from a start node.
*
* This is the default and basic traversal function, which covers basic use cases.
* You can't do advanced things like change the order of traversal, skip or cancel traversal after any node, etc.
* For more advanced usecases, see {@link traverseGenerator}
*
* @example
* ```js
* // calls fn for each node inside startNode
* traverse(startNode, fn);
* ```
*
*/
function traverse(node, fn, traverseConfig) {
var nodeIterator = traverseGenerator(node, traverseConfig);
for (var _iterator2 = _createForOfIteratorHelperLoose(nodeIterator), _step2; !(_step2 = _iterator2()).done;) {
var tmpNode = _step2.value;
fn.call(null, tmpNode);
}
}
var root = /*#__PURE__*/require("window-or-global");

@@ -1121,31 +285,4 @@

if (codeComponents) {
ensure(officialHook); // Return true if this is a canvas frame's tree.
// Performs a BFS and checks if any of the first 30 nodes contain the
// "frameInfo" property.
// Right now we rely on one of the first elements in the tree passing a prop
// with this name. It's not the first element in the React tree because
// it's below some React context providers for example.
// It's important to filter canvas frames to avoid performance regressions.
assert(!!officialHook);
var isCanvasFrame = function isCanvasFrame(rootNode) {
var nodeIterator = traverseGenerator(rootNode, {
order: ["self", "sibling", "child"]
});
var count = 0;
var next; // Get first 150 nodes and then stop the generator
while (count < 150 && !(next = nodeIterator.next()).done) {
count++;
var node = next.value;
if ([].concat(Object.keys(node.pendingProps || {}), Object.keys(node.memoizedProps || {})).includes("frameInfo")) {
return true;
}
} // Finish generator, to prevent memory leak
nodeIterator["return"] == null ? void 0 : nodeIterator["return"]();
return false;
};
if (!officialHook.plasmic) {

@@ -1156,15 +293,5 @@ var officialHookProps = /*#__PURE__*/_extends({}, officialHook);

officialHook.plasmic = {
uidToFiber: /*#__PURE__*/new Map(),
startedEvalCount: 0,
finishedEvalCount: 0
}; // To avoid unnecessary traversals, we keep track of the number of evals
// that started before the current root commit, and the number of finished
// evals before the last time a react tree has been traversed. This way,
// we won't miss any change that happended during eval (so we will traverse
// on every commit between eval starts and eval finishes) but won't traverse
// on changes that didn't happen in the eval phase to avoid performance
// regressions.
uidToFiber: /*#__PURE__*/new Map()
};
var lastSynced = 0;
var tryGetValNodeUid = function tryGetValNodeUid(node) {

@@ -1179,7 +306,55 @@ var hasValNodeData = function hasValNodeData(v) {

if (hasValNodeData(node.pendingProps)) {
return +node.pendingProps[valNodeData];
return undefined;
};
var traversedFibers = /*#__PURE__*/new Set();
var nonCanvasFibers = /*#__PURE__*/new Set();
var canvasRootFiberToUids = /*#__PURE__*/new Map();
var addNode = function addNode(node, uids) {
var valNodeUid = tryGetValNodeUid(node);
if (valNodeUid) {
officialHook.plasmic.uidToFiber.set(valNodeUid, node);
uids.push(valNodeUid);
}
return undefined;
return false;
}; // Return true if this is a canvas frame's tree.
// Performs a BFS and checks if any of the first 100 nodes contain the
// "frameInfo" property.
// Right now we rely on one of the first elements in the tree passing a prop
// with this name. It's not the first element in the React tree because
// it's below some React context providers for example.
// It's important to filter canvas frames to avoid performance regressions.
var isCanvasFrame = function isCanvasFrame(rootNode) {
if (canvasRootFiberToUids.has(rootNode)) {
return true;
}
if (nonCanvasFibers.has(rootNode)) {
return false;
}
var count = 0;
var result = false;
traversedFibers.add(rootNode);
traverseTree(rootNode, function (node) {
if ([].concat(Object.keys(node.memoizedProps || {})).includes("frameInfo")) {
result = true;
return true;
}
count++;
return count >= 100;
}, false, false);
if (count >= 100) {
// Likely not canvas
nonCanvasFibers.add(rootNode);
}
return result;
};

@@ -1189,18 +364,37 @@

onCommitFiberRoot: function onCommitFiberRoot(rendererID, fiberRoot, priorityLevel) {
if (lastSynced < officialHook.plasmic.startedEvalCount) {
var rootNode = fiberRoot.current; // We only need to traverse canvas frames
var rootNode = fiberRoot.current; // We only need to traverse canvas frames
if (isCanvasFrame(rootNode)) {
traverse(rootNode, function (node) {
var valNodeUid = tryGetValNodeUid(node);
if (isCanvasFrame(rootNode)) {
var wasMounted = rootNode.alternate != null && rootNode.alternate.memoizedState != null && rootNode.alternate.memoizedState.element != null;
if (valNodeUid) {
officialHook.plasmic.uidToFiber.set(valNodeUid, node);
if (!canvasRootFiberToUids.has(rootNode) || !wasMounted) {
// New tree, traverse it entirely
var uids = [];
canvasRootFiberToUids.set(rootNode, uids);
traverseTree(rootNode, function (fiber) {
return addNode(fiber, uids);
}, true, false);
} else {
var isMounted = rootNode.memoizedState != null && rootNode.memoizedState.element != null;
if (isMounted) {
var _canvasRootFiberToUid;
var _uids = (_canvasRootFiberToUid = canvasRootFiberToUids.get(rootNode)) != null ? _canvasRootFiberToUid : [];
if (!canvasRootFiberToUids.has(rootNode)) {
canvasRootFiberToUids.set(rootNode, _uids);
}
}, {
// If several nodes receive the data props, we want the root to
// overwrite them, so it should be the last one to be visited.
order: ["child", "sibling", "self"]
});
lastSynced = officialHook.plasmic.finishedEvalCount;
if (rootNode.alternate) {
traverseUpdates(rootNode, rootNode.alternate, function (fiber) {
return addNode(fiber, _uids);
});
} else {
// New tree
traverseTree(rootNode, function (fiber) {
return addNode(fiber, _uids);
}, true, false);
}
}
}

@@ -1227,9 +421,15 @@ }

var globalHookCtx = (officialHook == null ? void 0 : officialHook.plasmic) || {
uidToFiber: /*#__PURE__*/new Map(),
startedEvalCount: 0,
finishedEvalCount: 0
};
uidToFiber: /*#__PURE__*/new Map()
}; // TODO: remove this later, keeping now to avoid compatibility issues with
// stale JS bundle
globalHookCtx.startedEvalCount = 0;
globalHookCtx.finishedEvalCount = 0;
var root$1 = /*#__PURE__*/require("window-or-global");
mobx.configure({
isolateGlobalState: true,
enforceActions: "never"
});
root$1.__PlasmicHostVersion = "1";

@@ -1289,3 +489,9 @@ root$1.__PlasmicComponentRegistry = [];

}
/**
* React context to detect whether the component is rendered on Plasmic editor.
*/
var PlasmicCanvasContext = /*#__PURE__*/React.createContext(false);
var _PlasmicCanvasHost = /*#__PURE__*/mobxReactLite.observer(function PlasmicCanvasHost() {

@@ -1297,3 +503,5 @@ // If window.parent is null, then this is a window whose containing iframe

var isFrameAttached = !!window.parent;
var shouldRenderStudio = isFrameAttached && !document.querySelector("#plasmic-studio-tag") && !location.hash.match(/\bcanvas=true\b/) && !location.hash.match(/\blive=true\b/);
var isCanvas = !!location.hash.match(/\bcanvas=true\b/);
var isLive = !!location.hash.match(/\blive=true\b/);
var shouldRenderStudio = isFrameAttached && !document.querySelector("#plasmic-studio-tag") && !isCanvas && !isLive;
React.useEffect(function () {

@@ -1305,3 +513,3 @@ if (shouldRenderStudio && isFrameAttached) {

React.useEffect(function () {
if (!shouldRenderStudio && !document.querySelector("#getlibs") && location.hash.match(/\blive=true\b/)) {
if (!shouldRenderStudio && !document.querySelector("#getlibs") && isLive) {
var scriptElt = document.createElement("script");

@@ -1324,8 +532,8 @@ scriptElt.id = "getlibs";

if (location.hash.match(/\bcanvas=true\b/) || location.hash.match(/\blive=true\b/)) {
var appDiv = document.querySelector("#app.__wab_user-body");
if (isCanvas || isLive) {
var appDiv = document.querySelector("#plasmic-app.__wab_user-body");
if (!appDiv) {
appDiv = document.createElement("div");
appDiv.id = "app";
appDiv.id = "plasmic-app";
appDiv.classList.add("__wab_user-body");

@@ -1337,3 +545,5 @@ document.body.appendChild(appDiv);

key: "" + renderCount
}, plasmicRootNode.get()), appDiv, "app");
}, React.createElement(PlasmicCanvasContext.Provider, {
value: isCanvas
}, plasmicRootNode.get())), appDiv, "plasmic-app");
}

@@ -1405,2 +615,3 @@

exports.PlasmicCanvasContext = PlasmicCanvasContext;
exports.PlasmicCanvasHost = PlasmicCanvasHost;

@@ -1407,0 +618,0 @@ exports.registerComponent = registerComponent;

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@plasmicapp/react-web"),r=require("mobx"),n=require("mobx-react-lite"),o=require("react"),i=require("react-dom"),a=(t=require("resize-observer-polyfill"))&&"object"==typeof t&&"default"in t?t.default:t,c=require("slate"),u=require("slate-react");function s(){return(s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function d(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return f(t,void 0);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(t,void 0):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(t,e){if(void 0===e&&(e=""),null==t)throw e=(function(t){return"string"==typeof t}(e)?e:e())||"",new Error("Value must not be undefined or null"+(e?"- "+e:""));return t}var p,v=(function(t){var e=function(t){var e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=Object.create((e&&e.prototype instanceof f?e:f).prototype),i=new E(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=w(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function f(){}function d(){}function h(){}var p={};p[o]=function(){return this};var v=Object.getPrototypeOf,m=v&&v(v(L([])));m&&m!==e&&r.call(m,o)&&(p=m);var y=h.prototype=f.prototype=Object.create(p);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var n;this._invoke=function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function L(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:S}}function S(){return{value:void 0,done:!0}}return d.prototype=y.constructor=h,h.constructor=d,d.displayName=c(h,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,c(t,a,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},g(b.prototype),b.prototype[i]=function(){return this},t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(y),c(y,a,"Generator"),y[o]=function(){return this},y.toString=function(){return"[object Generator]"},t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=L,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:L(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},t}(t.exports);try{regeneratorRuntime=e}catch(t){Function("r","regeneratorRuntime = r")(e)}}(p={exports:{}}),p.exports),m=v.mark(y);function y(t,e){var r,n,o,i,a,c,u,s,l,f,h,p,g,b,w,x,_,E;return v.wrap((function(m){for(;;)switch(m.prev=m.next){case 0:b=function(){return v.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(f||null===t.sibling){e.next=3;break}return e.delegateYield(y(t.sibling,{order:c,skipSiblingForStartNode:!1,skipSelfForStartNode:!1}),"t0",3);case 3:case"end":return e.stop()}}),o)},g=function(){return v.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l||null===t.child){e.next=3;break}return e.delegateYield(y(t.child,{order:c,skipSiblingForStartNode:!1,skipSelfForStartNode:!1}),"t0",3);case 3:case"end":return e.stop()}}),n)},p=function(){var e,n,o;return v.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(h){r.next=5;break}return r.next=3,t;case 3:void 0!==(e=r.sent)&&(l=void 0===(n=e.skipChild)?l:n,f=void 0===(o=e.skipSibling)?f:o);case 5:case"end":return r.stop()}}),r)},r=v.mark(p),n=v.mark(g),o=v.mark(b),l=!1,f=void 0===(u=(i=void 0===e?{}:e).skipSiblingForStartNode)||u,h=void 0!==(s=i.skipSelfForStartNode)&&s,w={self:p,child:g,sibling:b},x=(c=void 0===(a=i.order)?["self","child","sibling"]:a).map((function(t){return w[t]})).filter((function(t){return void 0!==t})),_=d(x);case 9:if((E=_()).done){m.next=14;break}return m.delegateYield((0,E.value)(),"t0",12);case 12:m.next=9;break;case 14:case"end":return m.stop()}}),m)}var g=require("window-or-global").__REACT_DEVTOOLS_GLOBAL_HOOK__;if("true"===function(){try{var t,e;return new URLSearchParams(location.search||new URL(location.toString().replace(/#/,"?")).searchParams.get("searchParams")||(null==(t=window)||null==(e=t.parent)?void 0:e.location.search)||"")}catch(t){return new URLSearchParams}}().get("codeComponents")&&(h(g),!g.plasmic)){var b=s({},g);g.plasmic={uidToFiber:new Map,startedEvalCount:0,finishedEvalCount:0};for(var w=0,x={onCommitFiberRoot:function(t,e,r){if(w<g.plasmic.startedEvalCount){var n=e.current;(function(t){for(var e,r=y(t,{order:["self","sibling","child"]}),n=0;n<150&&!(e=r.next()).done;){n++;var o=e.value;if([].concat(Object.keys(o.pendingProps||{}),Object.keys(o.memoizedProps||{})).includes("frameInfo"))return!0}return null==r.return||r.return(),!1})(n)&&(function(t,e,r){for(var n,o=d(y(t,{order:["child","sibling","self"]}));!(n=o()).done;)e.call(null,n.value)}(n,(function(t){var e=function(t){var e=function(t){return"object"==typeof t&&null!==t&&"data-plasmic-valnode"in t};return e(t.memoizedProps)?+t.memoizedProps["data-plasmic-valnode"]:e(t.pendingProps)?+t.pendingProps["data-plasmic-valnode"]:void 0}(t);e&&g.plasmic.uidToFiber.set(e,t)})),w=g.plasmic.finishedEvalCount)}b.onCommitFiberRoot(t,e,r)}},_=0,E=Object.entries(x);_<E.length;_++){var L=E[_],S=L[1];"function"==typeof S&&(g[L[0]]=S)}}var O=(null==g?void 0:g.plasmic)||{uidToFiber:new Map,startedEvalCount:0,finishedEvalCount:0},j=require("window-or-global");j.__PlasmicHostVersion="1",j.__PlasmicComponentRegistry=[],j.__PlasmicFetcherRegistry=[];var k=r.observable.box(null,{deep:!1});function P(){return h(new URL("https://fakeurl/"+location.hash.replace(/#/,"?")).searchParams.get("origin"),"Missing information from Plasmic window.")}j.__Sub={React:o,ReactDOM:i,ReactWeb:e,ResizeObserver:a,mobx:r,mobxReactLite:n,slate:c,slateReact:u,localObject:Object,localElement:"undefined"!=typeof window?Element:void 0,globalHookCtx:O,setPlasmicRootNode:function(t){R++,k.set(t)},registerRenderErrorListener:function(t){return F.push(t),function(){var e=F.indexOf(t);e>=0&&F.splice(e,1)}}};var R=0,C=n.observer((function(){var t=!!window.parent,e=t&&!document.querySelector("#plasmic-studio-tag")&&!location.hash.match(/\bcanvas=true\b/)&&!location.hash.match(/\blive=true\b/);if(o.useEffect((function(){var r,n;e&&t&&(r=document.createElement("script"),n=P(),r.src=n+"/static/js/studio.js",document.body.appendChild(r))}),[e,t]),o.useEffect((function(){if(!e&&!document.querySelector("#getlibs")&&location.hash.match(/\blive=true\b/)){var t=document.createElement("script");t.id="getlibs",t.src=P()+"/static/js/getlibs.js",t.async=!1,t.onload=function(){null==window.__GetlibsReadyResolver||window.__GetlibsReadyResolver()},document.head.append(t)}}),[e]),!t)return null;if(location.hash.match(/\bcanvas=true\b/)||location.hash.match(/\blive=true\b/)){var r=document.querySelector("#app.__wab_user-body");return r||((r=document.createElement("div")).id="app",r.classList.add("__wab_user-body"),document.body.appendChild(r)),i.createPortal(o.createElement(N,{key:""+R},k.get()),r,"app")}return null})),F=[],N=function(t){var e,r;function n(e){var r;return(r=t.call(this,e)||this).state={},r}r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,l(e,r),n.getDerivedStateFromError=function(t){return{error:t}};var i=n.prototype;return i.componentDidCatch=function(t){F.forEach((function(e){return e(t)}))},i.render=function(){return this.state.error?o.createElement("div",null,"Error: ",""+this.state.error.message):this.props.children},n}(o.Component);e.setPlumeStrictMode(!1),exports.PlasmicCanvasHost=function(){var t=o.useState(null),e=t[0],r=t[1];return o.useEffect((function(){r(o.createElement(C,null))}),[]),e},exports.registerComponent=function(t,e){j.__PlasmicComponentRegistry.push({component:t,meta:e})},exports.registerFetcher=function(t,e){j.__PlasmicFetcherRegistry.push({fetcher:t,meta:e})};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@plasmicapp/react-web"),r=require("mobx"),n=require("mobx-react-lite"),o=require("react"),i=require("react-dom"),a=(e=require("resize-observer-polyfill"))&&"object"==typeof e&&"default"in e?e.default:e,l=require("slate"),c=require("slate-react");function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function s(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,d(e,t)}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function m(e,t,r){return(m=p()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&d(o,r.prototype),o}).apply(null,arguments)}function v(e){var t="function"==typeof Map?new Map:void 0;return(v=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return m(e,arguments,f(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),d(r,e)})(e)}function h(e){return"string"==typeof e}var b=function(e){function t(t){return void 0===t&&(t="Assertion failed"),e.call(this,t)||this}return s(t,e),t}(v(Error));function y(e,t,r,n){if(!r&&t(e))return!0;var o=13===e.tag;if(o&&o&&null!==e.memoizedState){var i=e.child,a=i?i.sibling:null,l=a?a.child:null;if(null!==l&&y(l,t,r,!0))return!0}else if(null!==e.child&&y(e.child,t,r,!0))return!0;return!(!n||null===e.sibling||!y(e.sibling,t,r,!0))||!!r&&t(e)}var g=require("window-or-global").__REACT_DEVTOOLS_GLOBAL_HOOK__;if("true"===function(){try{var e,t;return new URLSearchParams(location.search||new URL(location.toString().replace(/#/,"?")).searchParams.get("searchParams")||(null==(e=window)||null==(t=e.parent)?void 0:t.location.search)||"")}catch(e){return new URLSearchParams}}().get("codeComponents")&&(function(e,t){if(void 0===t&&(t="Assertion failed"),!g)throw t=(h(t)?t:t())||"Assertion failed",new b(t)}(),!g.plasmic)){var _=u({},g);g.plasmic={uidToFiber:new Map};for(var w=new Set,O=new Set,R=new Map,P=function(e,t){var r=function(e){var t;if("object"==typeof(t=e.memoizedProps)&&null!==t&&"data-plasmic-valnode"in t)return+e.memoizedProps["data-plasmic-valnode"]}(e);return r&&(g.plasmic.uidToFiber.set(r,e),t.push(r)),!1},E={onCommitFiberRoot:function(e,t,r){var n=t.current;if(function(e){if(R.has(e))return!0;if(O.has(e))return!1;var t=0,r=!1;return w.add(e),y(e,(function(e){return[].concat(Object.keys(e.memoizedProps||{})).includes("frameInfo")?(r=!0,!0):++t>=100}),!1,!1),t>=100&&O.add(e),r}(n)){var o=null!=n.alternate&&null!=n.alternate.memoizedState&&null!=n.alternate.memoizedState.element;if(R.has(n)&&o){if(null!=n.memoizedState&&null!=n.memoizedState.element){var i,a=null!=(i=R.get(n))?i:[];R.has(n)||R.set(n,a),n.alternate?function e(t,r,n){var o=13===t.tag,i=o&&null!==r.memoizedState,a=o&&null!==t.memoizedState;if(i&&a){var l=t.child,c=l?l.sibling:null,u=r.child,s=u?u.sibling:null;null!=c&&null!=s&&e(c,s,n)}else if(i&&!a){var f=t.child;null!=f&&y(f,n,!0,!0)}else if(!i&&a){var d=t.child,p=d?d.sibling:null;null!=p&&y(p,n,!0,!0)}else if(t.child!==r.child)for(var m=t.child;m;)m.alternate?e(m,m.alternate,n):y(m,n,!0,!1),m=m.sibling;n(t)}(n,n.alternate,(function(e){return P(e,a)})):y(n,(function(e){return P(e,a)}),!0,!1)}}else{var l=[];R.set(n,l),y(n,(function(e){return P(e,l)}),!0,!1)}}_.onCommitFiberRoot(e,t,r)}},S=0,j=Object.entries(E);S<j.length;S++){var C=j[S],x=C[1];"function"==typeof x&&(g[C[0]]=x)}}var q=(null==g?void 0:g.plasmic)||{uidToFiber:new Map};q.startedEvalCount=0,q.finishedEvalCount=0;var z=require("window-or-global");r.configure({isolateGlobalState:!0,enforceActions:"never"}),z.__PlasmicHostVersion="1",z.__PlasmicComponentRegistry=[],z.__PlasmicFetcherRegistry=[];var F=r.observable.box(null,{deep:!1});function L(){return function(e,t){if(void 0===t&&(t=""),null==e)throw t=(h(t)?t:t())||"",new Error("Value must not be undefined or null"+(t?"- "+t:""));return e}(new URL("https://fakeurl/"+location.hash.replace(/#/,"?")).searchParams.get("origin"),"Missing information from Plasmic window.")}z.__Sub={React:o,ReactDOM:i,ReactWeb:t,ResizeObserver:a,mobx:r,mobxReactLite:n,slate:l,slateReact:c,localObject:Object,localElement:"undefined"!=typeof window?Element:void 0,globalHookCtx:q,setPlasmicRootNode:function(e){M++,F.set(e)},registerRenderErrorListener:function(e){return k.push(e),function(){var t=k.indexOf(e);t>=0&&k.splice(t,1)}}};var M=0,A=o.createContext(!1),T=n.observer((function(){var e=!!window.parent,t=!!location.hash.match(/\bcanvas=true\b/),r=!!location.hash.match(/\blive=true\b/),n=e&&!document.querySelector("#plasmic-studio-tag")&&!t&&!r;if(o.useEffect((function(){var t,r;n&&e&&(t=document.createElement("script"),r=L(),t.src=r+"/static/js/studio.js",document.body.appendChild(t))}),[n,e]),o.useEffect((function(){if(!n&&!document.querySelector("#getlibs")&&r){var e=document.createElement("script");e.id="getlibs",e.src=L()+"/static/js/getlibs.js",e.async=!1,e.onload=function(){null==window.__GetlibsReadyResolver||window.__GetlibsReadyResolver()},document.head.append(e)}}),[n]),!e)return null;if(t||r){var a=document.querySelector("#plasmic-app.__wab_user-body");return a||((a=document.createElement("div")).id="plasmic-app",a.classList.add("__wab_user-body"),document.body.appendChild(a)),i.createPortal(o.createElement(D,{key:""+M},o.createElement(A.Provider,{value:t},F.get())),a,"plasmic-app")}return null})),k=[],D=function(e){function t(t){var r;return(r=e.call(this,t)||this).state={},r}s(t,e),t.getDerivedStateFromError=function(e){return{error:e}};var r=t.prototype;return r.componentDidCatch=function(e){k.forEach((function(t){return t(e)}))},r.render=function(){return this.state.error?o.createElement("div",null,"Error: ",""+this.state.error.message):this.props.children},t}(o.Component);t.setPlumeStrictMode(!1),exports.PlasmicCanvasContext=A,exports.PlasmicCanvasHost=function(){var e=o.useState(null),t=e[0],r=e[1];return o.useEffect((function(){r(o.createElement(T,null))}),[]),t},exports.registerComponent=function(e,t){z.__PlasmicComponentRegistry.push({component:e,meta:t})},exports.registerFetcher=function(e,t){z.__PlasmicFetcherRegistry.push({fetcher:e,meta:t})};
//# sourceMappingURL=host.cjs.production.min.js.map
import * as ReactWeb from '@plasmicapp/react-web';
import { setPlumeStrictMode } from '@plasmicapp/react-web';
import * as mobx from 'mobx';
import { observable } from 'mobx';
import { configure, observable } from 'mobx';
import * as mobxReactLite from 'mobx-react-lite';
import { observer } from 'mobx-react-lite';
import * as React from 'react';
import { useState, useEffect, createElement, Component } from 'react';
import { createContext, useState, useEffect, createElement, Component } from 'react';
import * as ReactDOM from 'react-dom';

@@ -40,2 +40,9 @@ import { createPortal } from 'react-dom';

function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {

@@ -50,38 +57,68 @@ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {

function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
function _construct(Parent, args, Class) {
if (_isNativeReflectConstruct()) {
_construct = Reflect.construct;
} else {
_construct = function _construct(Parent, args, Class) {
var a = [null];
a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype);
return instance;
};
}
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return _construct.apply(null, arguments);
}
return arr2;
function _isNativeFunction(fn) {
return Function.toString.call(fn).indexOf("[native code]") !== -1;
}
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
function _wrapNativeSuper(Class) {
var _cache = typeof Map === "function" ? new Map() : undefined;
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
_wrapNativeSuper = function _wrapNativeSuper(Class) {
if (Class === null || !_isNativeFunction(Class)) return Class;
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
if (typeof Class !== "function") {
throw new TypeError("Super expression must either be null or a function");
}
if (typeof _cache !== "undefined") {
if (_cache.has(Class)) return _cache.get(Class);
_cache.set(Class, Wrapper);
}
function Wrapper() {
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
}
Wrapper.prototype = Object.create(Class.prototype, {
constructor: {
value: Wrapper,
enumerable: false,
writable: true,
configurable: true
}
});
return _setPrototypeOf(Wrapper, Class);
};
return _wrapNativeSuper(Class);
}

@@ -105,998 +142,125 @@

}
var AssertionError = /*#__PURE__*/function (_Error) {
_inheritsLoose(AssertionError, _Error);
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
function AssertionError(msg) {
if (msg === void 0) {
msg = "Assertion failed";
}
var runtime_1 = createCommonjsModule(function (module) {
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var runtime = (function (exports) {
var Op = Object.prototype;
var hasOwn = Op.hasOwnProperty;
var undefined$1; // More compressible than void 0.
var $Symbol = typeof Symbol === "function" ? Symbol : {};
var iteratorSymbol = $Symbol.iterator || "@@iterator";
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
function define(obj, key, value) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
return obj[key];
return _Error.call(this, msg) || this;
}
try {
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
define({}, "");
} catch (err) {
define = function(obj, key, value) {
return obj[key] = value;
};
}
function wrap(innerFn, outerFn, self, tryLocsList) {
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
var generator = Object.create(protoGenerator.prototype);
var context = new Context(tryLocsList || []);
// The ._invoke method unifies the implementations of the .next,
// .throw, and .return methods.
generator._invoke = makeInvokeMethod(innerFn, self, context);
return generator;
return AssertionError;
}( /*#__PURE__*/_wrapNativeSuper(Error));
function assert(cond, msg) {
if (msg === void 0) {
msg = "Assertion failed";
}
exports.wrap = wrap;
// Try/catch helper to minimize deoptimizations. Returns a completion
// record like context.tryEntries[i].completion. This interface could
// have been (and was previously) designed to take a closure to be
// invoked without arguments, but in all the cases we care about we
// already have an existing method we want to call, so there's no need
// to create a new function object. We can even get away with assuming
// the method takes exactly one argument, since that happens to be true
// in every case, so we don't have to touch the arguments object. The
// only additional allocation required is the completion record, which
// has a stable shape and so hopefully should be cheap to allocate.
function tryCatch(fn, obj, arg) {
try {
return { type: "normal", arg: fn.call(obj, arg) };
} catch (err) {
return { type: "throw", arg: err };
}
if (!cond) {
// We always generate an non empty message so that it doesn't get swallowed
// by the async library.
msg = (isString(msg) ? msg : msg()) || "Assertion failed";
debugger;
throw new AssertionError(msg);
}
}
var GenStateSuspendedStart = "suspendedStart";
var GenStateSuspendedYield = "suspendedYield";
var GenStateExecuting = "executing";
var GenStateCompleted = "completed";
var SuspenseComponent = 13;
// Returning this object from the innerFn has the same effect as
// breaking out of the dispatch switch statement.
var ContinueSentinel = {};
function traverseUpdates(node, prev, visit) {
// Suspense nodes are special cases that need some magic
// (when they timout, they don't unmount because might lose important state)
var isSuspense = node.tag === SuspenseComponent;
var prevDidTimeout = isSuspense && prev.memoizedState !== null;
var nextDidTimeOut = isSuspense && node.memoizedState !== null;
// Dummy constructor functions that we use as the .constructor and
// .constructor.prototype properties for functions that return Generator
// objects. For full spec compliance, you may wish to configure your
// minifier not to mangle the names of these two functions.
function Generator() {}
function GeneratorFunction() {}
function GeneratorFunctionPrototype() {}
if (prevDidTimeout && nextDidTimeOut) {
// Special case
var child = node.child;
var nextFallback = child ? child.sibling : null;
var prevChild = prev.child;
var prevFallback = prevChild ? prevChild.sibling : null;
// This is a polyfill for %IteratorPrototype% for environments that
// don't natively support it.
var IteratorPrototype = {};
IteratorPrototype[iteratorSymbol] = function () {
return this;
};
if (nextFallback != null && prevFallback != null) {
traverseUpdates(nextFallback, prevFallback, visit);
}
} else if (prevDidTimeout && !nextDidTimeOut) {
// Special case
var nextPrimaryChildSet = node.child;
var getProto = Object.getPrototypeOf;
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
if (NativeIteratorPrototype &&
NativeIteratorPrototype !== Op &&
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
// This environment has a native %IteratorPrototype%; use it instead
// of the polyfill.
IteratorPrototype = NativeIteratorPrototype;
}
if (nextPrimaryChildSet != null) {
traverseTree(nextPrimaryChildSet, visit, true, true);
}
} else if (!prevDidTimeout && nextDidTimeOut) {
// Special case
var _child = node.child;
var Gp = GeneratorFunctionPrototype.prototype =
Generator.prototype = Object.create(IteratorPrototype);
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
GeneratorFunctionPrototype.constructor = GeneratorFunction;
GeneratorFunction.displayName = define(
GeneratorFunctionPrototype,
toStringTagSymbol,
"GeneratorFunction"
);
var _nextFallback = _child ? _child.sibling : null;
// Helper for defining the .next, .throw, and .return methods of the
// Iterator interface in terms of a single ._invoke method.
function defineIteratorMethods(prototype) {
["next", "throw", "return"].forEach(function(method) {
define(prototype, method, function(arg) {
return this._invoke(method, arg);
});
});
}
exports.isGeneratorFunction = function(genFun) {
var ctor = typeof genFun === "function" && genFun.constructor;
return ctor
? ctor === GeneratorFunction ||
// For the native GeneratorFunction constructor, the best we can
// do is to check its .name property.
(ctor.displayName || ctor.name) === "GeneratorFunction"
: false;
};
exports.mark = function(genFun) {
if (Object.setPrototypeOf) {
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
} else {
genFun.__proto__ = GeneratorFunctionPrototype;
define(genFun, toStringTagSymbol, "GeneratorFunction");
if (_nextFallback != null) {
traverseTree(_nextFallback, visit, true, true);
}
genFun.prototype = Object.create(Gp);
return genFun;
};
} else {
// Common case
if (node.child !== prev.child) {
var _child2 = node.child;
// Within the body of any async function, `await x` is transformed to
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
// `hasOwn.call(value, "__await")` to determine if the yielded value is
// meant to be awaited.
exports.awrap = function(arg) {
return { __await: arg };
};
function AsyncIterator(generator, PromiseImpl) {
function invoke(method, arg, resolve, reject) {
var record = tryCatch(generator[method], generator, arg);
if (record.type === "throw") {
reject(record.arg);
} else {
var result = record.arg;
var value = result.value;
if (value &&
typeof value === "object" &&
hasOwn.call(value, "__await")) {
return PromiseImpl.resolve(value.__await).then(function(value) {
invoke("next", value, resolve, reject);
}, function(err) {
invoke("throw", err, resolve, reject);
});
while (_child2) {
if (_child2.alternate) {
traverseUpdates(_child2, _child2.alternate, visit);
} else {
traverseTree(_child2, visit, true, false);
}
return PromiseImpl.resolve(value).then(function(unwrapped) {
// When a yielded Promise is resolved, its final value becomes
// the .value of the Promise<{value,done}> result for the
// current iteration.
result.value = unwrapped;
resolve(result);
}, function(error) {
// If a rejected Promise was yielded, throw the rejection back
// into the async generator function so it can be handled there.
return invoke("throw", error, resolve, reject);
});
_child2 = _child2.sibling;
}
}
}
var previousPromise;
function enqueue(method, arg) {
function callInvokeWithMethodAndArg() {
return new PromiseImpl(function(resolve, reject) {
invoke(method, arg, resolve, reject);
});
}
return previousPromise =
// If enqueue has been called before, then we want to wait until
// all previous Promises have been resolved before calling invoke,
// so that results are always delivered in the correct order. If
// enqueue has not been called before, then it is important to
// call invoke immediately, without waiting on a callback to fire,
// so that the async generator function has the opportunity to do
// any necessary setup in a predictable way. This predictability
// is why the Promise constructor synchronously invokes its
// executor callback, and why async functions synchronously
// execute code before the first await. Since we implement simple
// async functions in terms of async generators, it is especially
// important to get this right, even though it requires care.
previousPromise ? previousPromise.then(
callInvokeWithMethodAndArg,
// Avoid propagating failures to Promises returned by later
// invocations of the iterator.
callInvokeWithMethodAndArg
) : callInvokeWithMethodAndArg();
visit(node);
}
function traverseTree(node, // Returns true if we should stop traversing
visit, visitChildFirst, visitSiblings) {
if (!visitChildFirst) {
if (visit(node)) {
return true;
}
// Define the unified helper method that is used to implement .next,
// .throw, and .return (see defineIteratorMethods).
this._invoke = enqueue;
}
defineIteratorMethods(AsyncIterator.prototype);
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
return this;
};
exports.AsyncIterator = AsyncIterator;
var isSuspense = node.tag === SuspenseComponent;
var didTimeout = isSuspense && node.memoizedState !== null;
// Note that simple async functions are implemented on top of
// AsyncIterator objects; they just return a Promise for the value of
// the final result produced by the iterator.
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
if (PromiseImpl === void 0) PromiseImpl = Promise;
if (isSuspense && didTimeout) {
var primary = node.child;
var fallback = primary ? primary.sibling : null;
var fallbackChild = fallback ? fallback.child : null;
var iter = new AsyncIterator(
wrap(innerFn, outerFn, self, tryLocsList),
PromiseImpl
);
return exports.isGeneratorFunction(outerFn)
? iter // If outerFn is a generator, return the full iterator.
: iter.next().then(function(result) {
return result.done ? result.value : iter.next();
});
};
function makeInvokeMethod(innerFn, self, context) {
var state = GenStateSuspendedStart;
return function invoke(method, arg) {
if (state === GenStateExecuting) {
throw new Error("Generator is already running");
if (fallbackChild !== null) {
if (traverseTree(fallbackChild, visit, visitChildFirst, true)) {
return true;
}
if (state === GenStateCompleted) {
if (method === "throw") {
throw arg;
}
// Be forgiving, per 25.3.3.3.3 of the spec:
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
return doneResult();
}
context.method = method;
context.arg = arg;
while (true) {
var delegate = context.delegate;
if (delegate) {
var delegateResult = maybeInvokeDelegate(delegate, context);
if (delegateResult) {
if (delegateResult === ContinueSentinel) continue;
return delegateResult;
}
}
if (context.method === "next") {
// Setting context._sent for legacy support of Babel's
// function.sent implementation.
context.sent = context._sent = context.arg;
} else if (context.method === "throw") {
if (state === GenStateSuspendedStart) {
state = GenStateCompleted;
throw context.arg;
}
context.dispatchException(context.arg);
} else if (context.method === "return") {
context.abrupt("return", context.arg);
}
state = GenStateExecuting;
var record = tryCatch(innerFn, self, context);
if (record.type === "normal") {
// If an exception is thrown from innerFn, we leave state ===
// GenStateExecuting and loop back for another invocation.
state = context.done
? GenStateCompleted
: GenStateSuspendedYield;
if (record.arg === ContinueSentinel) {
continue;
}
return {
value: record.arg,
done: context.done
};
} else if (record.type === "throw") {
state = GenStateCompleted;
// Dispatch the exception by looping back around to the
// context.dispatchException(context.arg) call above.
context.method = "throw";
context.arg = record.arg;
}
}
};
}
// Call delegate.iterator[context.method](context.arg) and handle the
// result, either by returning a { value, done } result from the
// delegate iterator, or by modifying context.method and context.arg,
// setting context.delegate to null, and returning the ContinueSentinel.
function maybeInvokeDelegate(delegate, context) {
var method = delegate.iterator[context.method];
if (method === undefined$1) {
// A .throw or .return when the delegate iterator has no .throw
// method always terminates the yield* loop.
context.delegate = null;
if (context.method === "throw") {
// Note: ["return"] must be used for ES3 parsing compatibility.
if (delegate.iterator["return"]) {
// If the delegate iterator has a return method, give it a
// chance to clean up.
context.method = "return";
context.arg = undefined$1;
maybeInvokeDelegate(delegate, context);
if (context.method === "throw") {
// If maybeInvokeDelegate(context) changed context.method from
// "return" to "throw", let that override the TypeError below.
return ContinueSentinel;
}
}
context.method = "throw";
context.arg = new TypeError(
"The iterator does not provide a 'throw' method");
}
return ContinueSentinel;
}
var record = tryCatch(method, delegate.iterator, context.arg);
if (record.type === "throw") {
context.method = "throw";
context.arg = record.arg;
context.delegate = null;
return ContinueSentinel;
}
var info = record.arg;
if (! info) {
context.method = "throw";
context.arg = new TypeError("iterator result is not an object");
context.delegate = null;
return ContinueSentinel;
}
if (info.done) {
// Assign the result of the finished delegate to the temporary
// variable specified by delegate.resultName (see delegateYield).
context[delegate.resultName] = info.value;
// Resume execution at the desired location (see delegateYield).
context.next = delegate.nextLoc;
// If context.method was "throw" but the delegate handled the
// exception, let the outer generator proceed normally. If
// context.method was "next", forget context.arg since it has been
// "consumed" by the delegate iterator. If context.method was
// "return", allow the original .return call to continue in the
// outer generator.
if (context.method !== "return") {
context.method = "next";
context.arg = undefined$1;
} else {
if (node.child !== null) {
if (traverseTree(node.child, visit, visitChildFirst, true)) {
return true;
}
} else {
// Re-yield the result returned by the delegate method.
return info;
}
// The delegate iterator is finished, so forget it and continue with
// the outer generator.
context.delegate = null;
return ContinueSentinel;
}
// Define Generator.prototype.{next,throw,return} in terms of the
// unified ._invoke helper method.
defineIteratorMethods(Gp);
define(Gp, toStringTagSymbol, "Generator");
// A Generator should always return itself as the iterator object when the
// @@iterator function is called on it. Some browsers' implementations of the
// iterator prototype chain incorrectly implement this, causing the Generator
// object to not be returned from this call. This ensures that doesn't happen.
// See https://github.com/facebook/regenerator/issues/274 for more details.
Gp[iteratorSymbol] = function() {
return this;
};
Gp.toString = function() {
return "[object Generator]";
};
function pushTryEntry(locs) {
var entry = { tryLoc: locs[0] };
if (1 in locs) {
entry.catchLoc = locs[1];
if (visitSiblings && node.sibling !== null) {
if (traverseTree(node.sibling, visit, visitChildFirst, true)) {
return true;
}
if (2 in locs) {
entry.finallyLoc = locs[2];
entry.afterLoc = locs[3];
}
this.tryEntries.push(entry);
}
function resetTryEntry(entry) {
var record = entry.completion || {};
record.type = "normal";
delete record.arg;
entry.completion = record;
if (visitChildFirst) {
return visit(node);
}
function Context(tryLocsList) {
// The root entry object (effectively a try statement without a catch
// or a finally block) gives us a place to store values thrown from
// locations where there is no enclosing try statement.
this.tryEntries = [{ tryLoc: "root" }];
tryLocsList.forEach(pushTryEntry, this);
this.reset(true);
}
exports.keys = function(object) {
var keys = [];
for (var key in object) {
keys.push(key);
}
keys.reverse();
// Rather than returning an object with a next method, we keep
// things simple and return the next function itself.
return function next() {
while (keys.length) {
var key = keys.pop();
if (key in object) {
next.value = key;
next.done = false;
return next;
}
}
// To avoid creating an additional object, we just hang the .value
// and .done properties off the next function object itself. This
// also ensures that the minifier will not anonymize the function.
next.done = true;
return next;
};
};
function values(iterable) {
if (iterable) {
var iteratorMethod = iterable[iteratorSymbol];
if (iteratorMethod) {
return iteratorMethod.call(iterable);
}
if (typeof iterable.next === "function") {
return iterable;
}
if (!isNaN(iterable.length)) {
var i = -1, next = function next() {
while (++i < iterable.length) {
if (hasOwn.call(iterable, i)) {
next.value = iterable[i];
next.done = false;
return next;
}
}
next.value = undefined$1;
next.done = true;
return next;
};
return next.next = next;
}
}
// Return an iterator with no values.
return { next: doneResult };
}
exports.values = values;
function doneResult() {
return { value: undefined$1, done: true };
}
Context.prototype = {
constructor: Context,
reset: function(skipTempReset) {
this.prev = 0;
this.next = 0;
// Resetting context._sent for legacy support of Babel's
// function.sent implementation.
this.sent = this._sent = undefined$1;
this.done = false;
this.delegate = null;
this.method = "next";
this.arg = undefined$1;
this.tryEntries.forEach(resetTryEntry);
if (!skipTempReset) {
for (var name in this) {
// Not sure about the optimal order of these conditions:
if (name.charAt(0) === "t" &&
hasOwn.call(this, name) &&
!isNaN(+name.slice(1))) {
this[name] = undefined$1;
}
}
}
},
stop: function() {
this.done = true;
var rootEntry = this.tryEntries[0];
var rootRecord = rootEntry.completion;
if (rootRecord.type === "throw") {
throw rootRecord.arg;
}
return this.rval;
},
dispatchException: function(exception) {
if (this.done) {
throw exception;
}
var context = this;
function handle(loc, caught) {
record.type = "throw";
record.arg = exception;
context.next = loc;
if (caught) {
// If the dispatched exception was caught by a catch block,
// then let that catch block handle the exception normally.
context.method = "next";
context.arg = undefined$1;
}
return !! caught;
}
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
var record = entry.completion;
if (entry.tryLoc === "root") {
// Exception thrown outside of any try block that could handle
// it, so set the completion value of the entire function to
// throw the exception.
return handle("end");
}
if (entry.tryLoc <= this.prev) {
var hasCatch = hasOwn.call(entry, "catchLoc");
var hasFinally = hasOwn.call(entry, "finallyLoc");
if (hasCatch && hasFinally) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
} else if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else if (hasCatch) {
if (this.prev < entry.catchLoc) {
return handle(entry.catchLoc, true);
}
} else if (hasFinally) {
if (this.prev < entry.finallyLoc) {
return handle(entry.finallyLoc);
}
} else {
throw new Error("try statement without catch or finally");
}
}
}
},
abrupt: function(type, arg) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc <= this.prev &&
hasOwn.call(entry, "finallyLoc") &&
this.prev < entry.finallyLoc) {
var finallyEntry = entry;
break;
}
}
if (finallyEntry &&
(type === "break" ||
type === "continue") &&
finallyEntry.tryLoc <= arg &&
arg <= finallyEntry.finallyLoc) {
// Ignore the finally entry if control is not jumping to a
// location outside the try/catch block.
finallyEntry = null;
}
var record = finallyEntry ? finallyEntry.completion : {};
record.type = type;
record.arg = arg;
if (finallyEntry) {
this.method = "next";
this.next = finallyEntry.finallyLoc;
return ContinueSentinel;
}
return this.complete(record);
},
complete: function(record, afterLoc) {
if (record.type === "throw") {
throw record.arg;
}
if (record.type === "break" ||
record.type === "continue") {
this.next = record.arg;
} else if (record.type === "return") {
this.rval = this.arg = record.arg;
this.method = "return";
this.next = "end";
} else if (record.type === "normal" && afterLoc) {
this.next = afterLoc;
}
return ContinueSentinel;
},
finish: function(finallyLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.finallyLoc === finallyLoc) {
this.complete(entry.completion, entry.afterLoc);
resetTryEntry(entry);
return ContinueSentinel;
}
}
},
"catch": function(tryLoc) {
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
var entry = this.tryEntries[i];
if (entry.tryLoc === tryLoc) {
var record = entry.completion;
if (record.type === "throw") {
var thrown = record.arg;
resetTryEntry(entry);
}
return thrown;
}
}
// The context.catch method must only be called with a location
// argument that corresponds to a known catch block.
throw new Error("illegal catch attempt");
},
delegateYield: function(iterable, resultName, nextLoc) {
this.delegate = {
iterator: values(iterable),
resultName: resultName,
nextLoc: nextLoc
};
if (this.method === "next") {
// Deliberately forget the last sent value so that we don't
// accidentally pass it on to the delegate.
this.arg = undefined$1;
}
return ContinueSentinel;
}
};
// Regardless of whether this script is executing as a CommonJS module
// or not, return the runtime object so that we can declare the variable
// regeneratorRuntime in the outer scope, which allows this module to be
// injected easily by `bin/regenerator --include-runtime script.js`.
return exports;
}(
// If this script is executing as a CommonJS module, use module.exports
// as the regeneratorRuntime namespace. Otherwise create a new empty
// object. Either way, the resulting object will be used to initialize
// the regeneratorRuntime variable at the top of this file.
module.exports
));
try {
regeneratorRuntime = runtime;
} catch (accidentalStrictMode) {
// This module should not be running in strict mode, so the above
// assignment should always work unless something is misconfigured. Just
// in case runtime.js accidentally runs in strict mode, we can escape
// strict mode using a global Function call. This could conceivably fail
// if a Content Security Policy forbids using Function, but in that case
// the proper solution is to fix the accidental strict mode problem. If
// you've misconfigured your bundler to force strict mode and applied a
// CSP to forbid Function, and you're not willing to fix either of those
// problems, please detail your unique predicament in a GitHub issue.
Function("r", "regeneratorRuntime = r")(runtime);
return false;
}
});
var _marked4 = /*#__PURE__*/runtime_1.mark(traverseGenerator);
/*
from https://github.com/bendtherules/react-fiber-traverse
The MIT License (MIT)
Copyright (c) 2019-present bendtherules <abhasbhattacharya2@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/**
* Traverse nodes recursively using generators.
*
* This is the advanced traverse function, which can be used used
* to write other variants of traversal and find.
*
* Type signature for generator.next first argument is `{ skipChild?: boolean; skipSibling?: boolean } | void `
* Throw any error into the generator to finish the generator and let it cleanup its internals.
*
* It allows inversion of control -
* so, application code can decide to
* 1. change order of traversal,
* 2. skip some elements,
* 3. cancel traversal mid-way.
*
* @example
* ```js
* // Basic use (for-of)
*
* const nodeIterator = traverseGenerator(rootNode);
* for (const node of nodeIterator) {
* // do something with each node here
* }
* ```
* ------
*
* @example
* ```js
* // Breadth-first
*
* // note the order below
* const nodeIterator = traverseGenerator(rootNode, ["self", "sibling", "child"]);
* // rest - same as above
* ```
* -----
*
* @example
* ```js
* // Get first 3 nodes and then stop the generator
*
* const nodeIterator = traverseGenerator(rootNode);
*
* var count = 0;
* var next;
* while (
* count < 3 &&
* !(next = nodeIterator.next()).done
* ) {
* count++;
* const node = next.value;
* // do something with each node here
* }
*
* // Finish generator, to prevent memory leak
* nodeIterator.throw(new Error());
* ```
* -----
*
*/
function traverseGenerator(node, _temp) {
var _marked, _marked2, _marked3, _ref, _ref$order, order, _ref$skipSiblingForSt, skipSiblingForStartNode, _ref$skipSelfForStart, skipSelfForStartNode, skipChild, skipSibling, skipSelf, traverseSelf, traverseChild, traverseSibling, traverseMap, orderedGenerators, _iterator, _step, eachGen;
return runtime_1.wrap(function traverseGenerator$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
traverseSibling = function _traverseSibling() {
var nextNode;
return runtime_1.wrap(function traverseSibling$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
if (!(!skipSibling && node.sibling !== null)) {
_context3.next = 3;
break;
}
nextNode = node.sibling;
return _context3.delegateYield(traverseGenerator(nextNode, {
order: order,
skipSiblingForStartNode: false,
skipSelfForStartNode: false
}), "t0", 3);
case 3:
case "end":
return _context3.stop();
}
}
}, _marked3);
};
traverseChild = function _traverseChild() {
var nextNode;
return runtime_1.wrap(function traverseChild$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!(!skipChild && node.child !== null)) {
_context2.next = 3;
break;
}
nextNode = node.child;
return _context2.delegateYield(traverseGenerator(nextNode, {
order: order,
skipSiblingForStartNode: false,
skipSelfForStartNode: false
}), "t0", 3);
case 3:
case "end":
return _context2.stop();
}
}
}, _marked2);
};
traverseSelf = function _traverseSelf() {
var controlInput, _controlInput$skipChi, _controlInput$skipSib;
return runtime_1.wrap(function traverseSelf$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (skipSelf) {
_context.next = 5;
break;
}
_context.next = 3;
return node;
case 3:
controlInput = _context.sent;
if (controlInput !== undefined) {
_controlInput$skipChi = controlInput.skipChild;
skipChild = _controlInput$skipChi === void 0 ? skipChild : _controlInput$skipChi;
_controlInput$skipSib = controlInput.skipSibling;
skipSibling = _controlInput$skipSib === void 0 ? skipSibling : _controlInput$skipSib;
}
case 5:
case "end":
return _context.stop();
}
}
}, _marked);
};
_marked = /*#__PURE__*/runtime_1.mark(traverseSelf), _marked2 = /*#__PURE__*/runtime_1.mark(traverseChild), _marked3 = /*#__PURE__*/runtime_1.mark(traverseSibling);
_ref = _temp === void 0 ? {} : _temp, _ref$order = _ref.order, order = _ref$order === void 0 ? ["self", "child", "sibling"] : _ref$order, _ref$skipSiblingForSt = _ref.skipSiblingForStartNode, skipSiblingForStartNode = _ref$skipSiblingForSt === void 0 ? true : _ref$skipSiblingForSt, _ref$skipSelfForStart = _ref.skipSelfForStartNode, skipSelfForStartNode = _ref$skipSelfForStart === void 0 ? false : _ref$skipSelfForStart;
skipChild = false, skipSibling = skipSiblingForStartNode, skipSelf = skipSelfForStartNode;
traverseMap = {
self: traverseSelf,
child: traverseChild,
sibling: traverseSibling
}; // For each item mentioned in order, find generator functions to run
orderedGenerators = order.map(function (step) {
return traverseMap[step];
}).filter(function (tmp) {
return tmp !== undefined;
}); // Now run each generator till end
_iterator = _createForOfIteratorHelperLoose(orderedGenerators);
case 9:
if ((_step = _iterator()).done) {
_context4.next = 14;
break;
}
eachGen = _step.value;
return _context4.delegateYield(eachGen(), "t0", 12);
case 12:
_context4.next = 9;
break;
case 14:
case "end":
return _context4.stop();
}
}
}, _marked4);
}
/**
* Traverse nodes recursively in depth-first manner, starting from a start node.
*
* This is the default and basic traversal function, which covers basic use cases.
* You can't do advanced things like change the order of traversal, skip or cancel traversal after any node, etc.
* For more advanced usecases, see {@link traverseGenerator}
*
* @example
* ```js
* // calls fn for each node inside startNode
* traverse(startNode, fn);
* ```
*
*/
function traverse(node, fn, traverseConfig) {
var nodeIterator = traverseGenerator(node, traverseConfig);
for (var _iterator2 = _createForOfIteratorHelperLoose(nodeIterator), _step2; !(_step2 = _iterator2()).done;) {
var tmpNode = _step2.value;
fn.call(null, tmpNode);
}
}
var root = /*#__PURE__*/require("window-or-global");

@@ -1120,31 +284,4 @@

if (codeComponents) {
ensure(officialHook); // Return true if this is a canvas frame's tree.
// Performs a BFS and checks if any of the first 30 nodes contain the
// "frameInfo" property.
// Right now we rely on one of the first elements in the tree passing a prop
// with this name. It's not the first element in the React tree because
// it's below some React context providers for example.
// It's important to filter canvas frames to avoid performance regressions.
assert(!!officialHook);
var isCanvasFrame = function isCanvasFrame(rootNode) {
var nodeIterator = traverseGenerator(rootNode, {
order: ["self", "sibling", "child"]
});
var count = 0;
var next; // Get first 150 nodes and then stop the generator
while (count < 150 && !(next = nodeIterator.next()).done) {
count++;
var node = next.value;
if ([].concat(Object.keys(node.pendingProps || {}), Object.keys(node.memoizedProps || {})).includes("frameInfo")) {
return true;
}
} // Finish generator, to prevent memory leak
nodeIterator["return"] == null ? void 0 : nodeIterator["return"]();
return false;
};
if (!officialHook.plasmic) {

@@ -1155,15 +292,5 @@ var officialHookProps = /*#__PURE__*/_extends({}, officialHook);

officialHook.plasmic = {
uidToFiber: /*#__PURE__*/new Map(),
startedEvalCount: 0,
finishedEvalCount: 0
}; // To avoid unnecessary traversals, we keep track of the number of evals
// that started before the current root commit, and the number of finished
// evals before the last time a react tree has been traversed. This way,
// we won't miss any change that happended during eval (so we will traverse
// on every commit between eval starts and eval finishes) but won't traverse
// on changes that didn't happen in the eval phase to avoid performance
// regressions.
uidToFiber: /*#__PURE__*/new Map()
};
var lastSynced = 0;
var tryGetValNodeUid = function tryGetValNodeUid(node) {

@@ -1178,7 +305,55 @@ var hasValNodeData = function hasValNodeData(v) {

if (hasValNodeData(node.pendingProps)) {
return +node.pendingProps[valNodeData];
return undefined;
};
var traversedFibers = /*#__PURE__*/new Set();
var nonCanvasFibers = /*#__PURE__*/new Set();
var canvasRootFiberToUids = /*#__PURE__*/new Map();
var addNode = function addNode(node, uids) {
var valNodeUid = tryGetValNodeUid(node);
if (valNodeUid) {
officialHook.plasmic.uidToFiber.set(valNodeUid, node);
uids.push(valNodeUid);
}
return undefined;
return false;
}; // Return true if this is a canvas frame's tree.
// Performs a BFS and checks if any of the first 100 nodes contain the
// "frameInfo" property.
// Right now we rely on one of the first elements in the tree passing a prop
// with this name. It's not the first element in the React tree because
// it's below some React context providers for example.
// It's important to filter canvas frames to avoid performance regressions.
var isCanvasFrame = function isCanvasFrame(rootNode) {
if (canvasRootFiberToUids.has(rootNode)) {
return true;
}
if (nonCanvasFibers.has(rootNode)) {
return false;
}
var count = 0;
var result = false;
traversedFibers.add(rootNode);
traverseTree(rootNode, function (node) {
if ([].concat(Object.keys(node.memoizedProps || {})).includes("frameInfo")) {
result = true;
return true;
}
count++;
return count >= 100;
}, false, false);
if (count >= 100) {
// Likely not canvas
nonCanvasFibers.add(rootNode);
}
return result;
};

@@ -1188,18 +363,37 @@

onCommitFiberRoot: function onCommitFiberRoot(rendererID, fiberRoot, priorityLevel) {
if (lastSynced < officialHook.plasmic.startedEvalCount) {
var rootNode = fiberRoot.current; // We only need to traverse canvas frames
var rootNode = fiberRoot.current; // We only need to traverse canvas frames
if (isCanvasFrame(rootNode)) {
traverse(rootNode, function (node) {
var valNodeUid = tryGetValNodeUid(node);
if (isCanvasFrame(rootNode)) {
var wasMounted = rootNode.alternate != null && rootNode.alternate.memoizedState != null && rootNode.alternate.memoizedState.element != null;
if (valNodeUid) {
officialHook.plasmic.uidToFiber.set(valNodeUid, node);
if (!canvasRootFiberToUids.has(rootNode) || !wasMounted) {
// New tree, traverse it entirely
var uids = [];
canvasRootFiberToUids.set(rootNode, uids);
traverseTree(rootNode, function (fiber) {
return addNode(fiber, uids);
}, true, false);
} else {
var isMounted = rootNode.memoizedState != null && rootNode.memoizedState.element != null;
if (isMounted) {
var _canvasRootFiberToUid;
var _uids = (_canvasRootFiberToUid = canvasRootFiberToUids.get(rootNode)) != null ? _canvasRootFiberToUid : [];
if (!canvasRootFiberToUids.has(rootNode)) {
canvasRootFiberToUids.set(rootNode, _uids);
}
}, {
// If several nodes receive the data props, we want the root to
// overwrite them, so it should be the last one to be visited.
order: ["child", "sibling", "self"]
});
lastSynced = officialHook.plasmic.finishedEvalCount;
if (rootNode.alternate) {
traverseUpdates(rootNode, rootNode.alternate, function (fiber) {
return addNode(fiber, _uids);
});
} else {
// New tree
traverseTree(rootNode, function (fiber) {
return addNode(fiber, _uids);
}, true, false);
}
}
}

@@ -1226,9 +420,15 @@ }

var globalHookCtx = (officialHook == null ? void 0 : officialHook.plasmic) || {
uidToFiber: /*#__PURE__*/new Map(),
startedEvalCount: 0,
finishedEvalCount: 0
};
uidToFiber: /*#__PURE__*/new Map()
}; // TODO: remove this later, keeping now to avoid compatibility issues with
// stale JS bundle
globalHookCtx.startedEvalCount = 0;
globalHookCtx.finishedEvalCount = 0;
var root$1 = /*#__PURE__*/require("window-or-global");
configure({
isolateGlobalState: true,
enforceActions: "never"
});
root$1.__PlasmicHostVersion = "1";

@@ -1288,3 +488,9 @@ root$1.__PlasmicComponentRegistry = [];

}
/**
* React context to detect whether the component is rendered on Plasmic editor.
*/
var PlasmicCanvasContext = /*#__PURE__*/createContext(false);
var _PlasmicCanvasHost = /*#__PURE__*/observer(function PlasmicCanvasHost() {

@@ -1296,3 +502,5 @@ // If window.parent is null, then this is a window whose containing iframe

var isFrameAttached = !!window.parent;
var shouldRenderStudio = isFrameAttached && !document.querySelector("#plasmic-studio-tag") && !location.hash.match(/\bcanvas=true\b/) && !location.hash.match(/\blive=true\b/);
var isCanvas = !!location.hash.match(/\bcanvas=true\b/);
var isLive = !!location.hash.match(/\blive=true\b/);
var shouldRenderStudio = isFrameAttached && !document.querySelector("#plasmic-studio-tag") && !isCanvas && !isLive;
useEffect(function () {

@@ -1304,3 +512,3 @@ if (shouldRenderStudio && isFrameAttached) {

useEffect(function () {
if (!shouldRenderStudio && !document.querySelector("#getlibs") && location.hash.match(/\blive=true\b/)) {
if (!shouldRenderStudio && !document.querySelector("#getlibs") && isLive) {
var scriptElt = document.createElement("script");

@@ -1323,8 +531,8 @@ scriptElt.id = "getlibs";

if (location.hash.match(/\bcanvas=true\b/) || location.hash.match(/\blive=true\b/)) {
var appDiv = document.querySelector("#app.__wab_user-body");
if (isCanvas || isLive) {
var appDiv = document.querySelector("#plasmic-app.__wab_user-body");
if (!appDiv) {
appDiv = document.createElement("div");
appDiv.id = "app";
appDiv.id = "plasmic-app";
appDiv.classList.add("__wab_user-body");

@@ -1336,3 +544,5 @@ document.body.appendChild(appDiv);

key: "" + renderCount
}, plasmicRootNode.get()), appDiv, "app");
}, createElement(PlasmicCanvasContext.Provider, {
value: isCanvas
}, plasmicRootNode.get())), appDiv, "plasmic-app");
}

@@ -1404,3 +614,3 @@

export { PlasmicCanvasHost, registerComponent, registerFetcher };
export { PlasmicCanvasContext, PlasmicCanvasHost, registerComponent, registerFetcher };
//# sourceMappingURL=host.esm.js.map

@@ -8,13 +8,22 @@ import * as React from "react";

/**
* Any unique identifying string for this fetcher.
* Any unique string name used to identify that component. Each component
* should be registered with a different `meta.name`, even if they have the
* same name in the code.
*/
name: string;
/**
* The Studio-user-friendly display name.
* The name to be displayed for the component in Studio. Optional: if not
* specified, `meta.name` is used.
*/
displayName?: string;
/**
* The symbol to import from the importPath.
* The javascript name to be used when generating code. Optional: if not
* provided, `meta.name` is used.
*/
importName?: string;
/**
* An object describing the component properties to be used in Studio.
* For each `prop`, there should be an entry `meta.props[prop]` describing
* its type.
*/
props: {

@@ -24,14 +33,17 @@ [prop: string]: PrimitiveType;

/**
* Either the path to the component relative to `rootDir` or the npm
* package name
* The path to be used when importing the component in the generated code.
* It can be the name of the package that contains the component, or the path
* to the file in the project (relative to the root directory).
*/
importPath: string;
/**
* Whether it's a default export or named export
* Whether the component is the default export from that path. Optional: if
* not specified, it's considered `false`.
*/
isDefaultExport?: boolean;
/**
* The prop that expects CSS class names, required for styling code component
* instances from Plasmic Studio. If not specified, it's assumed to be
* "className".
* The prop that expects the CSS classes with styles to be applied to the
* component. Optional: if not specified, Plasmic will expect it to be
* `className`. Notice that if the component does not accept CSS classes, the
* component will not be able to receive styles from the Studio.
*/

@@ -86,2 +98,6 @@ classNameProp?: string;

export declare function registerFetcher(fetcher: Fetcher, meta: FetcherMeta): void;
/**
* React context to detect whether the component is rendered on Plasmic editor.
*/
export declare const PlasmicCanvasContext: React.Context<boolean>;
export declare const PlasmicCanvasHost: React.FunctionComponent;
import { Fiber } from "./fiber";
interface TTraverseConfig {
order?: Array<"self" | "child" | "sibling">;
skipSiblingForStartNode?: boolean;
skipSelfForStartNode?: boolean;
}
/**
* Traverse nodes recursively using generators.
*
* This is the advanced traverse function, which can be used used
* to write other variants of traversal and find.
*
* Type signature for generator.next first argument is `{ skipChild?: boolean; skipSibling?: boolean } | void `
* Throw any error into the generator to finish the generator and let it cleanup its internals.
*
* It allows inversion of control -
* so, application code can decide to
* 1. change order of traversal,
* 2. skip some elements,
* 3. cancel traversal mid-way.
*
* @example
* ```js
* // Basic use (for-of)
*
* const nodeIterator = traverseGenerator(rootNode);
* for (const node of nodeIterator) {
* // do something with each node here
* }
* ```
* ------
*
* @example
* ```js
* // Breadth-first
*
* // note the order below
* const nodeIterator = traverseGenerator(rootNode, ["self", "sibling", "child"]);
* // rest - same as above
* ```
* -----
*
* @example
* ```js
* // Get first 3 nodes and then stop the generator
*
* const nodeIterator = traverseGenerator(rootNode);
*
* var count = 0;
* var next;
* while (
* count < 3 &&
* !(next = nodeIterator.next()).done
* ) {
* count++;
* const node = next.value;
* // do something with each node here
* }
*
* // Finish generator, to prevent memory leak
* nodeIterator.throw(new Error());
* ```
* -----
*
*/
declare function traverseGenerator(node: Fiber, { order, skipSiblingForStartNode, skipSelfForStartNode, }?: TTraverseConfig): IterableIterator<Fiber>;
/**
* Traverse nodes recursively in depth-first manner, starting from a start node.
*
* This is the default and basic traversal function, which covers basic use cases.
* You can't do advanced things like change the order of traversal, skip or cancel traversal after any node, etc.
* For more advanced usecases, see {@link traverseGenerator}
*
* @example
* ```js
* // calls fn for each node inside startNode
* traverse(startNode, fn);
* ```
*
*/
declare function traverse(node: Fiber, fn: (node: Fiber) => any, traverseConfig?: TTraverseConfig): void;
export { traverse, traverseGenerator, TTraverseConfig };
export declare function traverseUpdates(node: Fiber, prev: Fiber, visit: (node: Fiber) => boolean): void;
export declare function traverseTree(node: Fiber, visit: (node: Fiber) => boolean, visitChildFirst: boolean, visitSiblings: boolean): boolean;
{
"name": "@plasmicapp/host",
"version": "0.0.4",
"version": "0.0.5",
"description": "plasmic library for app hosting",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc