let taskIdCounter = 1, isCallbackScheduled = false, isPerformingWork = false, taskQueue = [], currentTask = null, shouldYieldToHost = null, yieldInterval = 5, deadline = 0, maxYieldInterval = 300, scheduleCallback = null, scheduledCallback = null; const maxSigned31BitInt = 1073741823; function setupScheduler() { const channel = new MessageChannel(), port = channel.port2; scheduleCallback = () => port.postMessage(null); channel.port1.onmessage = () => { if (scheduledCallback !== null) { const currentTime = performance.now(); deadline = currentTime + yieldInterval; const hasTimeRemaining = true; try { const hasMoreWork = scheduledCallback(hasTimeRemaining, currentTime); if (!hasMoreWork) { scheduledCallback = null; } else port.postMessage(null); } catch (error) { port.postMessage(null); throw error; } } }; if (navigator && navigator.scheduling && navigator.scheduling.isInputPending) { const scheduling = navigator.scheduling; shouldYieldToHost = () => { const currentTime = performance.now(); if (currentTime >= deadline) { if (scheduling.isInputPending()) { return true; } return currentTime >= maxYieldInterval; } else { return false; } }; } else { shouldYieldToHost = () => performance.now() >= deadline; } } function enqueue(taskQueue, task) { function findIndex() { let m = 0; let n = taskQueue.length - 1; while (m <= n) { const k = n + m >> 1; const cmp = task.expirationTime - taskQueue[k].expirationTime; if (cmp > 0) m = k + 1;else if (cmp < 0) n = k - 1;else return k; } return m; } taskQueue.splice(findIndex(), 0, task); } function requestCallback(fn, options) { if (!scheduleCallback) setupScheduler(); let startTime = performance.now(), timeout = maxSigned31BitInt; if (options && options.timeout) timeout = options.timeout; const newTask = { id: taskIdCounter++, fn, startTime, expirationTime: startTime + timeout }; enqueue(taskQueue, newTask); if (!isCallbackScheduled && !isPerformingWork) { isCallbackScheduled = true; scheduledCallback = flushWork; scheduleCallback(); } return newTask; } function cancelCallback(task) { task.fn = null; } function flushWork(hasTimeRemaining, initialTime) { isCallbackScheduled = false; isPerformingWork = true; try { return workLoop(hasTimeRemaining, initialTime); } finally { currentTask = null; isPerformingWork = false; } } function workLoop(hasTimeRemaining, initialTime) { let currentTime = initialTime; currentTask = taskQueue[0] || null; while (currentTask !== null) { if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) { break; } const callback = currentTask.fn; if (callback !== null) { currentTask.fn = null; const didUserCallbackTimeout = currentTask.expirationTime <= currentTime; callback(didUserCallbackTimeout); currentTime = performance.now(); if (currentTask === taskQueue[0]) { taskQueue.shift(); } } else taskQueue.shift(); currentTask = taskQueue[0] || null; } return currentTask !== null; } const sharedConfig = {}; function setHydrateContext(context) { sharedConfig.context = context; } function nextHydrateContext() { return { ...sharedConfig.context, id: `${sharedConfig.context.id}${sharedConfig.context.count++}-`, count: 0 }; } const equalFn = (a, b) => a === b; const $PROXY = Symbol("solid-proxy"); const $TRACK = Symbol("solid-track"); const $DEVCOMP = Symbol("solid-dev-component"); const signalOptions = { equals: equalFn }; let ERROR = null; let runEffects = runQueue; const NOTPENDING = {}; const STALE = 1; const PENDING = 2; const UNOWNED = { owned: null, cleanups: null, context: null, owner: null }; const [transPending, setTransPending] = /*@__PURE__*/createSignal(false); var Owner = null; let Transition = null; let Scheduler = null; let ExternalSourceFactory = null; let Listener = null; let Pending = null; let Updates = null; let Effects = null; let ExecCount = 0; function createRoot(fn, detachedOwner) { const listener = Listener, owner = Owner, unowned = fn.length === 0, root = unowned && !false ? UNOWNED : { owned: null, cleanups: null, context: null, owner: detachedOwner || owner }, updateFn = unowned ? fn : () => fn(() => cleanNode(root)); Owner = root; Listener = null; try { return runUpdates(updateFn, true); } finally { Listener = listener; Owner = owner; } } function createSignal(value, options) { options = options ? Object.assign({}, signalOptions, options) : signalOptions; const s = { value, observers: null, observerSlots: null, pending: NOTPENDING, comparator: options.equals || undefined }; const setter = value => { if (typeof value === "function") { if (Transition && Transition.running && Transition.sources.has(s)) value = value(s.pending !== NOTPENDING ? s.pending : s.tValue);else value = value(s.pending !== NOTPENDING ? s.pending : s.value); } return writeSignal(s, value); }; return [readSignal.bind(s), setter]; } function createComputed(fn, value, options) { const c = createComputation(fn, value, true, STALE); if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c); } function createRenderEffect(fn, value, options) { const c = createComputation(fn, value, false, STALE); if (Scheduler && Transition && Transition.running) Updates.push(c);else updateComputation(c); } function createEffect(fn, value, options) { runEffects = runUserEffects; const c = createComputation(fn, value, false, STALE), s = SuspenseContext && lookup(Owner, SuspenseContext.id); if (s) c.suspense = s; c.user = true; Effects ? Effects.push(c) : updateComputation(c); } function createReaction(onInvalidate, options) { let fn; const c = createComputation(() => { fn ? fn() : untrack(onInvalidate); fn = undefined; }, undefined, false, 0), s = SuspenseContext && lookup(Owner, SuspenseContext.id); if (s) c.suspense = s; c.user = true; return tracking => { fn = tracking; updateComputation(c); }; } function createMemo(fn, value, options) { options = options ? Object.assign({}, signalOptions, options) : signalOptions; const c = createComputation(fn, value, true, 0); c.pending = NOTPENDING; c.observers = null; c.observerSlots = null; c.comparator = options.equals || undefined; if (Scheduler && Transition && Transition.running) { c.tState = STALE; Updates.push(c); } else updateComputation(c); return readSignal.bind(c); } function createResource(source, fetcher, options) { if (arguments.length === 2) { if (typeof fetcher === "object") { options = fetcher; fetcher = source; source = true; } } else if (arguments.length === 1) { fetcher = source; source = true; } options || (options = {}); const contexts = new Set(), [value, setValue] = createSignal(options.initialValue), [track, trigger] = createSignal(undefined, { equals: false }), [loading, setLoading] = createSignal(false), [error, setError] = createSignal(); let err = undefined, pr = null, initP = null, id = null, loadedUnderTransition = false, scheduled = false, resolved = ("initialValue" in options), dynamic = typeof source === "function" && createMemo(source); if (sharedConfig.context) { id = `${sharedConfig.context.id}${sharedConfig.context.count++}`; if (sharedConfig.load) initP = sharedConfig.load(id); } function loadEnd(p, v, e, key) { if (pr === p) { pr = null; resolved = true; if (initP && (p === initP || v === initP) && options.onHydrated) queueMicrotask(() => options.onHydrated(key, { value: v })); initP = null; setError(err = e); if (Transition && p && loadedUnderTransition) { Transition.promises.delete(p); loadedUnderTransition = false; runUpdates(() => { Transition.running = true; if (!Transition.promises.size) { Effects.push.apply(Effects, Transition.effects); Transition.effects = []; } completeLoad(v); }, false); } else completeLoad(v); } return v; } function completeLoad(v) { batch(() => { setValue(() => v); setLoading(false); for (const c of contexts.keys()) c.decrement(); contexts.clear(); }); } function read() { const c = SuspenseContext && lookup(Owner, SuspenseContext.id), v = value(); if (err) throw err; if (Listener && !Listener.user && c) { createComputed(() => { track(); if (pr) { if (c.resolved && Transition) Transition.promises.add(pr);else if (!contexts.has(c)) { c.increment(); contexts.add(c); } } }); } return v; } function load(refetching = true) { if (refetching && scheduled) return; scheduled = false; setError(err = undefined); const lookup = dynamic ? dynamic() : source; loadedUnderTransition = Transition && Transition.running; if (lookup == null || lookup === false) { loadEnd(pr, untrack(value)); return; } if (Transition && pr) Transition.promises.delete(pr); const p = initP || untrack(() => fetcher(lookup, { value: value(), refetching })); if (typeof p !== "object" || !("then" in p)) { loadEnd(pr, p); return p; } pr = p; scheduled = true; queueMicrotask(() => scheduled = false); batch(() => { setLoading(true); trigger(); }); return p.then(v => loadEnd(p, v, undefined, lookup), e => loadEnd(p, e, e)); } Object.defineProperties(read, { loading: { get() { return loading(); } }, error: { get() { return error(); } }, latest: { get() { if (!resolved) return read(); if (err) throw err; return value(); } } }); if (dynamic) createComputed(() => load(false));else load(false); return [read, { refetch: load, mutate: setValue }]; } function createDeferred(source, options) { let t, timeout = options ? options.timeoutMs : undefined; const node = createComputation(() => { if (!t || !t.fn) t = requestCallback(() => setDeferred(() => node.value), timeout !== undefined ? { timeout } : undefined); return source(); }, undefined, true); const [deferred, setDeferred] = createSignal(node.value, options); updateComputation(node); setDeferred(() => node.value); return deferred; } function createSelector(source, fn = equalFn, options) { const subs = new Map(); const node = createComputation(p => { const v = source(); for (const key of subs.keys()) if (fn(key, v) !== fn(key, p)) { const l = subs.get(key); for (const c of l.values()) { c.state = STALE; if (c.pure) Updates.push(c);else Effects.push(c); } } return v; }, undefined, true, STALE); updateComputation(node); return key => { let listener; if (listener = Listener) { let l; if (l = subs.get(key)) l.add(listener);else subs.set(key, l = new Set([listener])); onCleanup(() => { l.delete(listener); !l.size && subs.delete(key); }); } return fn(key, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value); }; } function batch(fn) { if (Pending) return fn(); let result; const q = Pending = []; try { result = fn(); } finally { Pending = null; } runUpdates(() => { for (let i = 0; i < q.length; i += 1) { const data = q[i]; if (data.pending !== NOTPENDING) { const pending = data.pending; data.pending = NOTPENDING; writeSignal(data, pending); } } }, false); return result; } function untrack(fn) { let result, listener = Listener; Listener = null; result = fn(); Listener = listener; return result; } function on(deps, fn, options) { const isArray = Array.isArray(deps); let prevInput; let defer = options && options.defer; return prevValue => { let input; if (isArray) { input = Array(deps.length); for (let i = 0; i < deps.length; i++) input[i] = deps[i](); } else input = deps(); if (defer) { defer = false; return undefined; } const result = untrack(() => fn(input, prevInput, prevValue)); prevInput = input; return result; }; } function onMount(fn) { createEffect(() => untrack(fn)); } function onCleanup(fn) { if (Owner === null) ;else if (Owner.cleanups === null) Owner.cleanups = [fn];else Owner.cleanups.push(fn); return fn; } function onError(fn) { ERROR || (ERROR = Symbol("error")); if (Owner === null) ;else if (Owner.context === null) Owner.context = { [ERROR]: [fn] };else if (!Owner.context[ERROR]) Owner.context[ERROR] = [fn];else Owner.context[ERROR].push(fn); } function getListener() { return Listener; } function getOwner() { return Owner; } function runWithOwner(o, fn) { const prev = Owner; Owner = o; try { return runUpdates(fn, true); } finally { Owner = prev; } } function enableScheduling(scheduler = requestCallback) { Scheduler = scheduler; } function startTransition(fn) { if (Transition && Transition.running) { fn(); return Transition.done; } const l = Listener; const o = Owner; return Promise.resolve().then(() => { Listener = l; Owner = o; let t; if (Scheduler || SuspenseContext) { t = Transition || (Transition = { sources: new Set(), effects: [], promises: new Set(), disposed: new Set(), queue: new Set(), running: true }); t.done || (t.done = new Promise(res => t.resolve = res)); t.running = true; } batch(fn); Listener = Owner = null; return t ? t.done : undefined; }); } function useTransition() { return [transPending, startTransition]; } function resumeEffects(e) { Effects.push.apply(Effects, e); e.length = 0; } function createContext(defaultValue) { const id = Symbol("context"); return { id, Provider: createProvider(id), defaultValue }; } function useContext(context) { let ctx; return (ctx = lookup(Owner, context.id)) !== undefined ? ctx : context.defaultValue; } function children(fn) { const children = createMemo(fn); return createMemo(() => resolveChildren(children())); } let SuspenseContext; function getSuspenseContext() { return SuspenseContext || (SuspenseContext = createContext({})); } function enableExternalSource(factory) { if (ExternalSourceFactory) { const oldFactory = ExternalSourceFactory; ExternalSourceFactory = (fn, trigger) => { const oldSource = oldFactory(fn, trigger); const source = factory(x => oldSource.track(x), trigger); return { track: x => source.track(x), dispose() { source.dispose(); oldSource.dispose(); } }; }; } else { ExternalSourceFactory = factory; } } function readSignal() { const runningTransition = Transition && Transition.running; if (this.sources && (!runningTransition && this.state || runningTransition && this.tState)) { const updates = Updates; Updates = null; !runningTransition && this.state === STALE || runningTransition && this.tState === STALE ? updateComputation(this) : lookUpstream(this); Updates = updates; } if (Listener) { const sSlot = this.observers ? this.observers.length : 0; if (!Listener.sources) { Listener.sources = [this]; Listener.sourceSlots = [sSlot]; } else { Listener.sources.push(this); Listener.sourceSlots.push(sSlot); } if (!this.observers) { this.observers = [Listener]; this.observerSlots = [Listener.sources.length - 1]; } else { this.observers.push(Listener); this.observerSlots.push(Listener.sources.length - 1); } } if (runningTransition && Transition.sources.has(this)) return this.tValue; return this.value; } function writeSignal(node, value, isComp) { if (Pending) { if (node.pending === NOTPENDING) Pending.push(node); node.pending = value; return value; } if (node.comparator) { if (Transition && Transition.running && Transition.sources.has(node)) { if (node.comparator(node.tValue, value)) return value; } else if (node.comparator(node.value, value)) return value; } let TransitionRunning = false; if (Transition) { TransitionRunning = Transition.running; if (TransitionRunning || !isComp && Transition.sources.has(node)) { Transition.sources.add(node); node.tValue = value; } if (!TransitionRunning) node.value = value; } else node.value = value; if (node.observers && node.observers.length) { runUpdates(() => { for (let i = 0; i < node.observers.length; i += 1) { const o = node.observers[i]; if (TransitionRunning && Transition.disposed.has(o)) continue; if (TransitionRunning && !o.tState || !TransitionRunning && !o.state) { if (o.pure) Updates.push(o);else Effects.push(o); if (o.observers) markDownstream(o); } if (TransitionRunning) o.tState = STALE;else o.state = STALE; } if (Updates.length > 10e5) { Updates = []; if (false) ; throw new Error(); } }, false); } return value; } function updateComputation(node) { if (!node.fn) return; cleanNode(node); const owner = Owner, listener = Listener, time = ExecCount; Listener = Owner = node; runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time); if (Transition && !Transition.running && Transition.sources.has(node)) { queueMicrotask(() => { runUpdates(() => { Transition && (Transition.running = true); runComputation(node, node.tValue, time); }, false); }); } Listener = listener; Owner = owner; } function runComputation(node, value, time) { let nextValue; try { nextValue = node.fn(value); } catch (err) { handleError(err); } if (!node.updatedAt || node.updatedAt <= time) { if (node.observers && node.observers.length) { writeSignal(node, nextValue, true); } else if (Transition && Transition.running && node.pure) { Transition.sources.add(node); node.tValue = nextValue; } else node.value = nextValue; node.updatedAt = time; } } function createComputation(fn, init, pure, state = STALE, options) { const c = { fn, state: state, updatedAt: null, owned: null, sources: null, sourceSlots: null, cleanups: null, value: init, owner: Owner, context: null, pure }; if (Transition && Transition.running) { c.state = 0; c.tState = state; } if (Owner === null) ;else if (Owner !== UNOWNED) { if (Transition && Transition.running && Owner.pure) { if (!Owner.tOwned) Owner.tOwned = [c];else Owner.tOwned.push(c); } else { if (!Owner.owned) Owner.owned = [c];else Owner.owned.push(c); } } if (ExternalSourceFactory) { const [track, trigger] = createSignal(undefined, { equals: false }); const ordinary = ExternalSourceFactory(c.fn, trigger); onCleanup(() => ordinary.dispose()); const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose()); const inTransition = ExternalSourceFactory(c.fn, triggerInTransition); c.fn = x => { track(); return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x); }; } return c; } function runTop(node) { const runningTransition = Transition && Transition.running; if (!runningTransition && node.state === 0 || runningTransition && node.tState === 0) return; if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) return lookUpstream(node); if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node); const ancestors = [node]; while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) { if (runningTransition && Transition.disposed.has(node)) return; if (!runningTransition && node.state || runningTransition && node.tState) ancestors.push(node); } for (let i = ancestors.length - 1; i >= 0; i--) { node = ancestors[i]; if (runningTransition) { let top = node, prev = ancestors[i + 1]; while ((top = top.owner) && top !== prev) { if (Transition.disposed.has(top)) return; } } if (!runningTransition && node.state === STALE || runningTransition && node.tState === STALE) { updateComputation(node); } else if (!runningTransition && node.state === PENDING || runningTransition && node.tState === PENDING) { const updates = Updates; Updates = null; lookUpstream(node, ancestors[0]); Updates = updates; } } } function runUpdates(fn, init) { if (Updates) return fn(); let wait = false; if (!init) Updates = []; if (Effects) wait = true;else Effects = []; ExecCount++; try { const res = fn(); completeUpdates(wait); return res; } catch (err) { if (!Updates) Effects = null; handleError(err); } } function completeUpdates(wait) { if (Updates) { if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);else runQueue(Updates); Updates = null; } if (wait) return; let res; if (Transition && Transition.running) { if (Transition.promises.size || Transition.queue.size) { Transition.running = false; Transition.effects.push.apply(Transition.effects, Effects); Effects = null; setTransPending(true); return; } const sources = Transition.sources; const disposed = Transition.disposed; res = Transition.resolve; for (const e of Effects) { "tState" in e && (e.state = e.tState); delete e.tState; } Transition = null; batch(() => { for (const d of disposed) cleanNode(d); for (const v of sources) { v.value = v.tValue; if (v.owned) { for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]); } if (v.tOwned) v.owned = v.tOwned; delete v.tValue; delete v.tOwned; v.tState = 0; } setTransPending(false); }); } if (Effects.length) batch(() => { runEffects(Effects); Effects = null; });else { Effects = null; } if (res) res(); } function runQueue(queue) { for (let i = 0; i < queue.length; i++) runTop(queue[i]); } function scheduleQueue(queue) { for (let i = 0; i < queue.length; i++) { const item = queue[i]; const tasks = Transition.queue; if (!tasks.has(item)) { tasks.add(item); Scheduler(() => { tasks.delete(item); runUpdates(() => { Transition.running = true; runTop(item); if (!tasks.size) { Effects.push.apply(Effects, Transition.effects); Transition.effects = []; } }, false); Transition && (Transition.running = false); }); } } } function runUserEffects(queue) { let i, userLength = 0; for (i = 0; i < queue.length; i++) { const e = queue[i]; if (!e.user) runTop(e);else queue[userLength++] = e; } if (sharedConfig.context) setHydrateContext(); const resume = queue.length; for (i = 0; i < userLength; i++) runTop(queue[i]); for (i = resume; i < queue.length; i++) runTop(queue[i]); } function lookUpstream(node, ignore) { const runningTransition = Transition && Transition.running; if (runningTransition) node.tState = 0;else node.state = 0; for (let i = 0; i < node.sources.length; i += 1) { const source = node.sources[i]; if (source.sources) { if (!runningTransition && source.state === STALE || runningTransition && source.tState === STALE) { if (source !== ignore) runTop(source); } else if (!runningTransition && source.state === PENDING || runningTransition && source.tState === PENDING) lookUpstream(source, ignore); } } } function markDownstream(node) { const runningTransition = Transition && Transition.running; for (let i = 0; i < node.observers.length; i += 1) { const o = node.observers[i]; if (!runningTransition && !o.state || runningTransition && !o.tState) { if (runningTransition) o.tState = PENDING;else o.state = PENDING; if (o.pure) Updates.push(o);else Effects.push(o); o.observers && markDownstream(o); } } } function cleanNode(node) { let i; if (node.sources) { while (node.sources.length) { const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers; if (obs && obs.length) { const n = obs.pop(), s = source.observerSlots.pop(); if (index < obs.length) { n.sourceSlots[s] = index; obs[index] = n; source.observerSlots[index] = s; } } } } if (Transition && Transition.running && node.pure) { if (node.tOwned) { for (i = 0; i < node.tOwned.length; i++) cleanNode(node.tOwned[i]); delete node.tOwned; } reset(node, true); } else if (node.owned) { for (i = 0; i < node.owned.length; i++) cleanNode(node.owned[i]); node.owned = null; } if (node.cleanups) { for (i = 0; i < node.cleanups.length; i++) node.cleanups[i](); node.cleanups = null; } if (Transition && Transition.running) node.tState = 0;else node.state = 0; node.context = null; } function reset(node, top) { if (!top) { node.tState = 0; Transition.disposed.add(node); } if (node.owned) { for (let i = 0; i < node.owned.length; i++) reset(node.owned[i]); } } function handleError(err) { const fns = ERROR && lookup(Owner, ERROR); if (!fns) throw err; for (const f of fns) f(err); } function lookup(owner, key) { return owner ? owner.context && owner.context[key] !== undefined ? owner.context[key] : lookup(owner.owner, key) : undefined; } function resolveChildren(children) { if (typeof children === "function" && !children.length) return resolveChildren(children()); if (Array.isArray(children)) { const results = []; for (let i = 0; i < children.length; i++) { const result = resolveChildren(children[i]); Array.isArray(result) ? results.push.apply(results, result) : results.push(result); } return results; } return children; } function createProvider(id) { return function provider(props) { let res; createComputed(() => res = untrack(() => { Owner.context = { [id]: props.value }; return children(() => props.children); })); return res; }; } function getSymbol() { const SymbolCopy = Symbol; return SymbolCopy.observable || "@@observable"; } function observable(input) { const $$observable = getSymbol(); return { subscribe(observer) { if (!(observer instanceof Object) || observer == null) { throw new TypeError("Expected the observer to be an object."); } const handler = "next" in observer ? observer.next.bind(observer) : observer; let complete = false; createComputed(() => { if (complete) return; const v = input(); untrack(() => handler(v)); }); return { unsubscribe() { complete = true; } }; }, [$$observable]() { return this; } }; } function from(producer) { const [s, set] = createSignal(undefined, { equals: false }); if ("subscribe" in producer) { const unsub = producer.subscribe(v => set(() => v)); onCleanup(() => "unsubscribe" in unsub ? unsub.unsubscribe() : unsub()); } else { const clean = producer(set); onCleanup(clean); } return s; } const FALLBACK = Symbol("fallback"); function dispose(d) { for (let i = 0; i < d.length; i++) d[i](); } function mapArray(list, mapFn, options = {}) { let items = [], mapped = [], disposers = [], len = 0, indexes = mapFn.length > 1 ? [] : null; onCleanup(() => dispose(disposers)); return () => { let newItems = list() || [], i, j; newItems[$TRACK]; return untrack(() => { let newLen = newItems.length, newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item; if (newLen === 0) { if (len !== 0) { dispose(disposers); disposers = []; items = []; mapped = []; len = 0; indexes && (indexes = []); } if (options.fallback) { items = [FALLBACK]; mapped[0] = createRoot(disposer => { disposers[0] = disposer; return options.fallback(); }); len = 1; } } else if (len === 0) { mapped = new Array(newLen); for (j = 0; j < newLen; j++) { items[j] = newItems[j]; mapped[j] = createRoot(mapper); } len = newLen; } else { temp = new Array(newLen); tempdisposers = new Array(newLen); indexes && (tempIndexes = new Array(newLen)); for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++); for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) { temp[newEnd] = mapped[end]; tempdisposers[newEnd] = disposers[end]; indexes && (tempIndexes[newEnd] = indexes[end]); } newIndices = new Map(); newIndicesNext = new Array(newEnd + 1); for (j = newEnd; j >= start; j--) { item = newItems[j]; i = newIndices.get(item); newIndicesNext[j] = i === undefined ? -1 : i; newIndices.set(item, j); } for (i = start; i <= end; i++) { item = items[i]; j = newIndices.get(item); if (j !== undefined && j !== -1) { temp[j] = mapped[i]; tempdisposers[j] = disposers[i]; indexes && (tempIndexes[j] = indexes[i]); j = newIndicesNext[j]; newIndices.set(item, j); } else disposers[i](); } for (j = start; j < newLen; j++) { if (j in temp) { mapped[j] = temp[j]; disposers[j] = tempdisposers[j]; if (indexes) { indexes[j] = tempIndexes[j]; indexes[j](j); } } else mapped[j] = createRoot(mapper); } mapped = mapped.slice(0, len = newLen); items = newItems.slice(0); } return mapped; }); function mapper(disposer) { disposers[j] = disposer; if (indexes) { const [s, set] = createSignal(j); indexes[j] = set; return mapFn(newItems[j], s); } return mapFn(newItems[j]); } }; } function indexArray(list, mapFn, options = {}) { let items = [], mapped = [], disposers = [], signals = [], len = 0, i; onCleanup(() => dispose(disposers)); return () => { const newItems = list() || []; newItems[$TRACK]; return untrack(() => { if (newItems.length === 0) { if (len !== 0) { dispose(disposers); disposers = []; items = []; mapped = []; len = 0; signals = []; } if (options.fallback) { items = [FALLBACK]; mapped[0] = createRoot(disposer => { disposers[0] = disposer; return options.fallback(); }); len = 1; } return mapped; } if (items[0] === FALLBACK) { disposers[0](); disposers = []; items = []; mapped = []; len = 0; } for (i = 0; i < newItems.length; i++) { if (i < items.length && items[i] !== newItems[i]) { signals[i](() => newItems[i]); } else if (i >= items.length) { mapped[i] = createRoot(mapper); } } for (; i < items.length; i++) { disposers[i](); } len = signals.length = disposers.length = newItems.length; items = newItems.slice(0); return mapped = mapped.slice(0, len); }); function mapper(disposer) { disposers[i] = disposer; const [s, set] = createSignal(newItems[i]); signals[i] = set; return mapFn(s, i); } }; } let hydrationEnabled = false; function enableHydration() { hydrationEnabled = true; } function createComponent(Comp, props) { if (hydrationEnabled) { if (sharedConfig.context) { const c = sharedConfig.context; setHydrateContext(nextHydrateContext()); const r = untrack(() => Comp(props || {})); setHydrateContext(c); return r; } } return untrack(() => Comp(props || {})); } function trueFn() { return true; } const propTraps = { get(_, property, receiver) { if (property === $PROXY) return receiver; return _.get(property); }, has(_, property) { return _.has(property); }, set: trueFn, deleteProperty: trueFn, getOwnPropertyDescriptor(_, property) { return { configurable: true, enumerable: true, get() { return _.get(property); }, set: trueFn, deleteProperty: trueFn }; }, ownKeys(_) { return _.keys(); } }; function resolveSource(s) { return (s = typeof s === "function" ? s() : s) == null ? {} : s; } function mergeProps(...sources) { return new Proxy({ get(property) { for (let i = sources.length - 1; i >= 0; i--) { const v = resolveSource(sources[i])[property]; if (v !== undefined) return v; } }, has(property) { for (let i = sources.length - 1; i >= 0; i--) { if (property in resolveSource(sources[i])) return true; } return false; }, keys() { const keys = []; for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i]))); return [...new Set(keys)]; } }, propTraps); } function splitProps(props, ...keys) { const blocked = new Set(keys.flat()); const descriptors = Object.getOwnPropertyDescriptors(props); const res = keys.map(k => { const clone = {}; for (let i = 0; i < k.length; i++) { const key = k[i]; Object.defineProperty(clone, key, descriptors[key] ? descriptors[key] : { get() { return props[key]; }, set() { return true; } }); } return clone; }); res.push(new Proxy({ get(property) { return blocked.has(property) ? undefined : props[property]; }, has(property) { return blocked.has(property) ? false : property in props; }, keys() { return Object.keys(props).filter(k => !blocked.has(k)); } }, propTraps)); return res; } function lazy(fn) { let comp; let p; const wrap = props => { const ctx = sharedConfig.context; if (ctx) { const [s, set] = createSignal(); (p || (p = fn())).then(mod => { setHydrateContext(ctx); set(() => mod.default); setHydrateContext(); }); comp = s; } else if (!comp) { const [s] = createResource(() => (p || (p = fn())).then(mod => mod.default)); comp = s; } else { const c = comp(); if (c) return c(props); } let Comp; return createMemo(() => (Comp = comp()) && untrack(() => { if (!ctx) return Comp(props); const c = sharedConfig.context; setHydrateContext(ctx); const r = Comp(props); setHydrateContext(c); return r; })); }; wrap.preload = () => p || ((p = fn()).then(mod => comp = () => mod.default), p); return wrap; } let counter = 0; function createUniqueId() { const ctx = sharedConfig.context; return ctx ? `${ctx.id}${ctx.count++}` : `cl-${counter++}`; } function For(props) { const fallback = "fallback" in props && { fallback: () => props.fallback }; return createMemo(mapArray(() => props.each, props.children, fallback ? fallback : undefined)); } function Index(props) { const fallback = "fallback" in props && { fallback: () => props.fallback }; return createMemo(indexArray(() => props.each, props.children, fallback ? fallback : undefined)); } function Show(props) { let strictEqual = false; const condition = createMemo(() => props.when, undefined, { equals: (a, b) => strictEqual ? a === b : !a === !b }); return createMemo(() => { const c = condition(); if (c) { const child = props.children; return (strictEqual = typeof child === "function" && child.length > 0) ? untrack(() => child(c)) : child; } return props.fallback; }); } function Switch(props) { let strictEqual = false; const conditions = children(() => props.children), evalConditions = createMemo(() => { let conds = conditions(); if (!Array.isArray(conds)) conds = [conds]; for (let i = 0; i < conds.length; i++) { const c = conds[i].when; if (c) return [i, c, conds[i]]; } return [-1]; }, undefined, { equals: (a, b) => a[0] === b[0] && (strictEqual ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2] }); return createMemo(() => { const [index, when, cond] = evalConditions(); if (index < 0) return props.fallback; const c = cond.children; return (strictEqual = typeof c === "function" && c.length > 0) ? untrack(() => c(when)) : c; }); } function Match(props) { return props; } let Errors; const NoErrors = {}; function resetErrorBoundaries() { Errors && [...Errors].forEach(fn => fn(NoErrors)); } function ErrorBoundary(props) { let err = NoErrors; if (sharedConfig.context && sharedConfig.load) { err = sharedConfig.load(sharedConfig.context.id + sharedConfig.context.count) || NoErrors; } const [errored, setErrored] = createSignal(err); Errors || (Errors = new Set()); Errors.add(setErrored); onCleanup(() => Errors.delete(setErrored)); return createMemo(() => { let e; if ((e = errored()) !== NoErrors) { const f = props.fallback; return typeof f === "function" && f.length ? untrack(() => f(e, () => setErrored(NoErrors))) : f; } onError(setErrored); return props.children; }); } const SuspenseListContext = createContext(); function SuspenseList(props) { let suspenseSetter, showContent, showFallback; const listContext = useContext(SuspenseListContext); if (listContext) { const [inFallback, setFallback] = createSignal(false); suspenseSetter = setFallback; [showContent, showFallback] = listContext.register(inFallback); } const [registry, setRegistry] = createSignal([]), comp = createComponent(SuspenseListContext.Provider, { value: { register: inFallback => { const [showingContent, showContent] = createSignal(false), [showingFallback, showFallback] = createSignal(false); setRegistry(registry => [...registry, { inFallback, showContent, showFallback }]); return [showingContent, showingFallback]; } }, get children() { return props.children; } }); createComputed(() => { const reveal = props.revealOrder, tail = props.tail, visibleContent = showContent ? showContent() : true, visibleFallback = showFallback ? showFallback() : true, reg = registry(), reverse = reveal === "backwards"; if (reveal === "together") { const all = reg.every(i => !i.inFallback()); suspenseSetter && suspenseSetter(!all); reg.forEach(i => { i.showContent(all && visibleContent); i.showFallback(visibleFallback); }); return; } let stop = false; for (let i = 0, len = reg.length; i < len; i++) { const n = reverse ? len - i - 1 : i, s = reg[n].inFallback(); if (!stop && !s) { reg[n].showContent(visibleContent); reg[n].showFallback(visibleFallback); } else { const next = !stop; if (next && suspenseSetter) suspenseSetter(true); if (!tail || next && tail === "collapsed") { reg[n].showFallback(visibleFallback); } else reg[n].showFallback(false); stop = true; reg[n].showContent(next); } } if (!stop && suspenseSetter) suspenseSetter(false); }); return comp; } function Suspense(props) { let counter = 0, showContent, showFallback, ctx, p, flicker, error; const [inFallback, setFallback] = createSignal(false), SuspenseContext = getSuspenseContext(), store = { increment: () => { if (++counter === 1) setFallback(true); }, decrement: () => { if (--counter === 0) setFallback(false); }, inFallback, effects: [], resolved: false }, owner = getOwner(); if (sharedConfig.context && sharedConfig.load) { const key = sharedConfig.context.id + sharedConfig.context.count; p = sharedConfig.load(key); if (p) { if (typeof p !== "object" || !("then" in p)) p = Promise.resolve(p); const [s, set] = createSignal(undefined, { equals: false }); flicker = s; p.then(err => { if ((error = err) || sharedConfig.done) return set(); sharedConfig.gather(key); setHydrateContext(ctx); set(); setHydrateContext(); }); } else if (p === null) sharedConfig.gather(key); } const listContext = useContext(SuspenseListContext); if (listContext) [showContent, showFallback] = listContext.register(store.inFallback); let dispose; onCleanup(() => dispose && dispose()); return createComponent(SuspenseContext.Provider, { value: store, get children() { return createMemo(() => { if (error) throw error; ctx = sharedConfig.context; if (flicker) { flicker(); return flicker = undefined; } if (ctx && p === undefined) setHydrateContext(); const rendered = createMemo(() => props.children); return createMemo(() => { const inFallback = store.inFallback(), visibleContent = showContent ? showContent() : true, visibleFallback = showFallback ? showFallback() : true; dispose && dispose(); if ((!inFallback || p !== undefined) && visibleContent) { store.resolved = true; ctx = p = undefined; resumeEffects(store.effects); return rendered(); } if (!visibleFallback) return; return createRoot(disposer => { dispose = disposer; if (ctx) { setHydrateContext({ id: ctx.id + "f", count: 0 }); ctx = undefined; } return props.fallback; }, owner); }); }); } }); } let DEV; // web.js const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"]; const Properties = /*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]); const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]); const Aliases = { className: "class", htmlFor: "for" }; const PropAliases = { class: "className", formnovalidate: "formNoValidate", ismap: "isMap", nomodule: "noModule", playsinline: "playsInline", readonly: "readOnly" }; const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]); const SVGElements = /*#__PURE__*/new Set([ "altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "set", "stop", "svg", "switch", "symbol", "text", "textPath", "tref", "tspan", "use", "view", "vkern"]); const SVGNamespace = { xlink: "http://www.w3.org/1999/xlink", xml: "http://www.w3.org/XML/1998/namespace" }; const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input"]); function memo(fn, equals) { return createMemo(fn, undefined, !equals ? { equals } : undefined); } function reconcileArrays(parentNode, a, b) { let bLength = b.length, aEnd = a.length, bEnd = bLength, aStart = 0, bStart = 0, after = a[aEnd - 1].nextSibling, map = null; while (aStart < aEnd || bStart < bEnd) { if (a[aStart] === b[bStart]) { aStart++; bStart++; continue; } while (a[aEnd - 1] === b[bEnd - 1]) { aEnd--; bEnd--; } if (aEnd === aStart) { const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after; while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node); } else if (bEnd === bStart) { while (aStart < aEnd) { if (!map || !map.has(a[aStart])) a[aStart].remove(); aStart++; } } else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) { const node = a[--aEnd].nextSibling; parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling); parentNode.insertBefore(b[--bEnd], node); a[aEnd] = b[bEnd]; } else { if (!map) { map = new Map(); let i = bStart; while (i < bEnd) map.set(b[i], i++); } const index = map.get(a[aStart]); if (index != null) { if (bStart < index && index < bEnd) { let i = aStart, sequence = 1, t; while (++i < aEnd && i < bEnd) { if ((t = map.get(a[i])) == null || t !== index + sequence) break; sequence++; } if (sequence > index - bStart) { const node = a[aStart]; while (bStart < index) parentNode.insertBefore(b[bStart++], node); } else parentNode.replaceChild(b[bStart++], a[aStart++]); } else aStart++; } else a[aStart++].remove(); } } } const $$EVENTS = "_$DX_DELEGATE"; function render(code, element, init) { let disposer; createRoot(dispose => { disposer = dispose; element === document ? code() : insert(element, code(), element.firstChild ? null : undefined, init); }); return () => { disposer(); element.textContent = ""; }; } function template(html, check, isSVG) { const t = document.createElement("template"); t.innerHTML = html; let node = t.content.firstChild; if (isSVG) node = node.firstChild; return node; } function delegateEvents(eventNames, document = window.document) { const e = document[$$EVENTS] || (document[$$EVENTS] = new Set()); for (let i = 0, l = eventNames.length; i < l; i++) { const name = eventNames[i]; if (!e.has(name)) { e.add(name); document.addEventListener(name, eventHandler); } } } function clearDelegatedEvents(document = window.document) { if (document[$$EVENTS]) { for (let name of document[$$EVENTS].keys()) document.removeEventListener(name, eventHandler); delete document[$$EVENTS]; } } function setAttribute(node, name, value) { if (value == null) node.removeAttribute(name);else node.setAttribute(name, value); } function setAttributeNS(node, namespace, name, value) { if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value); } function className(node, value) { if (value == null) node.removeAttribute("class");else node.className = value; } function addEventListener(node, name, handler, delegate) { if (delegate) { if (Array.isArray(handler)) { node[`$$${name}`] = handler[0]; node[`$$${name}Data`] = handler[1]; } else node[`$$${name}`] = handler; } else if (Array.isArray(handler)) { const handlerFn = handler[0]; node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e)); } else node.addEventListener(name, handler); } function classList(node, value, prev = {}) { const classKeys = Object.keys(value || {}), prevKeys = Object.keys(prev); let i, len; for (i = 0, len = prevKeys.length; i < len; i++) { const key = prevKeys[i]; if (!key || key === "undefined" || value[key]) continue; toggleClassKey(node, key, false); delete prev[key]; } for (i = 0, len = classKeys.length; i < len; i++) { const key = classKeys[i], classValue = !!value[key]; if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue; toggleClassKey(node, key, true); prev[key] = classValue; } return prev; } function style(node, value, prev = {}) { const nodeStyle = node.style; const prevString = typeof prev === "string"; if (value == null && prevString || typeof value === "string") return nodeStyle.cssText = value; prevString && (nodeStyle.cssText = undefined, prev = {}); value || (value = {}); let v, s; for (s in prev) { value[s] == null && nodeStyle.removeProperty(s); delete prev[s]; } for (s in value) { v = value[s]; if (v !== prev[s]) { nodeStyle.setProperty(s, v); prev[s] = v; } } return prev; } function spread(node, accessor, isSVG, skipChildren) { if (typeof accessor === "function") { createRenderEffect(current => spreadExpression(node, accessor(), current, isSVG, skipChildren)); } else spreadExpression(node, accessor, undefined, isSVG, skipChildren); } function dynamicProperty(props, key) { const src = props[key]; Object.defineProperty(props, key, { get() { return src(); }, enumerable: true }); return props; } function innerHTML(parent, content) { !sharedConfig.context && (parent.innerHTML = content); } function insert(parent, accessor, marker, initial) { if (marker !== undefined && !initial) initial = []; if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker); createRenderEffect(current => insertExpression(parent, accessor(), current, marker), initial); } function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) { props || (props = {}); for (const prop in prevProps) { if (!(prop in props)) { if (prop === "children") continue; assignProp(node, prop, null, prevProps[prop], isSVG, skipRef); } } for (const prop in props) { if (prop === "children") { if (!skipChildren) insertExpression(node, props.children); continue; } const value = props[prop]; prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef); } } function hydrate$1(code, element, options = {}) { sharedConfig.completed = globalThis._$HY.completed; sharedConfig.events = globalThis._$HY.events; sharedConfig.load = globalThis._$HY.load; sharedConfig.gather = root => gatherHydratable(element, root); sharedConfig.registry = new Map(); sharedConfig.context = { id: options.renderId || "", count: 0 }; gatherHydratable(element, options.renderId); const dispose = render(code, element, [...element.childNodes]); sharedConfig.context = null; return dispose; } function getNextElement(template) { let node, key; if (!sharedConfig.context || !(node = sharedConfig.registry.get(key = getHydrationKey()))) { return template.cloneNode(true); } if (sharedConfig.completed) sharedConfig.completed.add(node); sharedConfig.registry.delete(key); return node; } function getNextMatch(el, nodeName) { while (el && el.localName !== nodeName) el = el.nextSibling; return el; } function getNextMarker(start) { let end = start, count = 0, current = []; if (sharedConfig.context) { while (end) { if (end.nodeType === 8) { const v = end.nodeValue; if (v === "#") count++;else if (v === "/") { if (count === 0) return [end, current]; count--; } } current.push(end); end = end.nextSibling; } } return [end, current]; } function runHydrationEvents() { if (sharedConfig.events && !sharedConfig.events.queued) { queueMicrotask(() => { const { completed, events } = sharedConfig; events.queued = false; while (events.length) { const [el, e] = events[0]; if (!completed.has(el)) return; eventHandler(e); events.shift(); } }); sharedConfig.events.queued = true; } } // function toPropertyName(name) { // return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase()); // } function toggleClassKey(node, key, value) { const classNames = key.trim().split(/\s+/); for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value); } function assignProp(node, prop, value, prev, isSVG, skipRef) { let isCE, isProp, isChildProp; if (prop === "style") return style(node, value, prev); if (prop === "classList") return classList(node, value, prev); if (value === prev) return prev; if (prop === "ref") { if (!skipRef) { value(node); } } else if (prop.slice(0, 3) === "on:") { const e = prop.slice(3); prev && node.removeEventListener(e, prev); value && node.addEventListener(e, value); } else if (prop.slice(0, 10) === "oncapture:") { const e = prop.slice(10); prev && node.removeEventListener(e, prev, true); value && node.addEventListener(e, value, true); } else if (prop.slice(0, 2) === "on") { const name = prop.slice(2).toLowerCase(); const delegate = DelegatedEvents.has(name); if (!delegate && prev) { const h = Array.isArray(prev) ? prev[0] : prev; node.removeEventListener(name, h); } if (delegate || value) { addEventListener(node, name, value, delegate); delegate && delegateEvents([name]); } } else if ((isChildProp = ChildProperties.has(prop)) || !isSVG && (PropAliases[prop] || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-"))) { if (prop === "class" || prop === "className") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[PropAliases[prop] || prop] = value; } else { const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]]; if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, Aliases[prop] || prop, value); } return value; } function eventHandler(e) { const key = `$$${e.type}`; let node = e.composedPath && e.composedPath()[0] || e.target; if (e.target !== node) { Object.defineProperty(e, "target", { configurable: true, value: node }); } Object.defineProperty(e, "currentTarget", { configurable: true, get() { return node || document; } }); if (sharedConfig.registry && !sharedConfig.done) { sharedConfig.done = true; document.querySelectorAll("[id^=pl-]").forEach(elem => elem.remove()); } while (node !== null) { const handler = node[key]; if (handler && !node.disabled) { const data = node[`${key}Data`]; data !== undefined ? handler.call(node, data, e) : handler.call(node, e); if (e.cancelBubble) return; } node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode; } } function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) { props || (props = {}); if (!skipChildren && "children" in props) { createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children)); } props.ref && props.ref(node); createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true)); return prevProps; } function insertExpression(parent, value, current, marker, unwrapArray) { if (sharedConfig.context && !current) current = [...parent.childNodes]; while (typeof current === "function") current = current(); if (value === current) return current; const t = typeof value, multi = marker !== undefined; parent = multi && current[0] && current[0].parentNode || parent; if (t === "string" || t === "number") { if (sharedConfig.context) return current; if (t === "number") value = value.toString(); if (multi) { let node = current[0]; if (node && node.nodeType === 3) { node.data = value; } else node = document.createTextNode(value); current = cleanChildren(parent, current, marker, node); } else { if (current !== "" && typeof current === "string") { current = parent.firstChild.data = value; } else current = parent.textContent = value; } } else if (value == null || t === "boolean") { if (sharedConfig.context) return current; current = cleanChildren(parent, current, marker); } else if (t === "function") { createRenderEffect(() => { let v = value(); while (typeof v === "function") v = v(); current = insertExpression(parent, v, current, marker); }); return () => current; } else if (Array.isArray(value)) { const array = []; const currentArray = current && Array.isArray(current); if (normalizeIncomingArray(array, value, current, unwrapArray)) { createRenderEffect(() => current = insertExpression(parent, array, current, marker, true)); return () => current; } if (sharedConfig.context) { for (let i = 0; i < array.length; i++) { if (array[i].parentNode) return current = array; } } if (array.length === 0) { current = cleanChildren(parent, current, marker); if (multi) return current; } else if (currentArray) { if (current.length === 0) { appendNodes(parent, array, marker); } else reconcileArrays(parent, current, array); } else { current && cleanChildren(parent); appendNodes(parent, array); } current = array; } else if (value instanceof Node) { if (sharedConfig.context && value.parentNode) return current = multi ? [value] : value; if (Array.isArray(current)) { if (multi) return current = cleanChildren(parent, current, marker, value); cleanChildren(parent, current, null, value); } else if (current == null || current === "" || !parent.firstChild) { parent.appendChild(value); } else parent.replaceChild(value, parent.firstChild); current = value; } else ; return current; } function normalizeIncomingArray(normalized, array, current, unwrap) { let dynamic = false; for (let i = 0, len = array.length; i < len; i++) { let item = array[i], prev = current && current[i]; if (item instanceof Node) { normalized.push(item); } else if (item == null || item === true || item === false) ; else if (Array.isArray(item)) { dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic; } else if ((typeof item) === "function") { if (unwrap) { while (typeof item === "function") item = item(); dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], prev) || dynamic; } else { normalized.push(item); dynamic = true; } } else { const value = String(item); if (prev && prev.nodeType === 3 && prev.data === value) { normalized.push(prev); } else normalized.push(document.createTextNode(value)); } } return dynamic; } function appendNodes(parent, array, marker) { for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker); } function cleanChildren(parent, current, marker, replacement) { if (marker === undefined) return parent.textContent = ""; const node = replacement || document.createTextNode(""); if (current.length) { let inserted = false; for (let i = current.length - 1; i >= 0; i--) { const el = current[i]; if (node !== el) { const isParent = el.parentNode === parent; if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent && el.remove(); } else inserted = true; } } else parent.insertBefore(node, marker); return [node]; } function gatherHydratable(element, root) { const templates = element.querySelectorAll(`*[data-hk]`); for (let i = 0; i < templates.length; i++) { const node = templates[i]; const key = node.getAttribute("data-hk"); if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node); } } function getHydrationKey() { const hydrate = sharedConfig.context; return `${hydrate.id}${hydrate.count++}`; } function Assets() { return; } function NoHydration(props) { return sharedConfig.context ? undefined : props.children; } function throwInBrowser(func) { const err = new Error(`${func.name} is not supported in the browser, returning undefined`); console.error(err); } function renderToString(fn, options) { throwInBrowser(renderToString); } function renderToStringAsync(fn, options) { throwInBrowser(renderToStringAsync); } function renderToStream(fn, options) { throwInBrowser(renderToStream); } function ssr(template, ...nodes) {} function resolveSSRNode(node) {} function ssrClassList(value) {} function ssrStyle(value) {} function ssrSpread(accessor) {} function ssrAttribute(key, value) {} function ssrHydrationKey() {} function escape(html) {} function generateHydrationScript() {} const isServer = false; const SVG_NAMESPACE = "http://www.w3.org/2000/svg"; function createElement(tagName, isSVG = false) { return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName); } const hydrate = (...args) => { enableHydration(); return hydrate$1(...args); }; function Portal(props) { const { useShadow } = props, marker = document.createTextNode(""), mount = props.mount || document.body; function renderPortal() { if (sharedConfig.context) { const [s, set] = createSignal(false); queueMicrotask(() => set(true)); return () => s() && props.children; } else return () => props.children; } if (mount instanceof HTMLHeadElement) { const [clean, setClean] = createSignal(false); const cleanup = () => setClean(true); createRoot(dispose => insert(mount, () => !clean() ? renderPortal()() : dispose(), null)); onCleanup(() => { if (sharedConfig.context) queueMicrotask(cleanup);else cleanup(); }); } else { const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({ mode: "open" }) : container; Object.defineProperty(container, "host", { get() { return marker.parentNode; } }); insert(renderRoot, renderPortal()); mount.appendChild(container); props.ref && props.ref(container); onCleanup(() => mount.removeChild(container)); } return marker; } function Dynamic(props) { const [p, others] = splitProps(props, ["component"]); const cached = createMemo(() => p.component); return createMemo(() => { const component = cached(); switch (typeof component) { case "function": return untrack(() => component(others)); case "string": const isSvg = SVGElements.has(component); const el = sharedConfig.context ? getNextElement() : createElement(component, isSvg); spread(el, others, isSvg); return el; } }); } // html.js var attrRE, /*lookup,*/ parseTag, pushCommentNode, pushTextNode, tagRE; tagRE = /(?:|<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>)/g; attrRE = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g; lookup = { area: true, base: true, br: true, col: true, embed: true, hr: true, img: true, input: true, keygen: true, link: true, menuitem: true, meta: true, param: true, source: true, track: true, wbr: true }; parseTag = function (tag) { var res; res = { type: 'tag', name: '', voidElement: false, attrs: {}, children: [] }; const tagMatch = tag.match(/<\/?([^\s]+?)[/\s>]/); if (tagMatch) { res.name = tagMatch[1]; if (lookup[tagMatch[1].toLowerCase()] || tag.charAt(tag.length - 2) === '/') { res.voidElement = true; } if (res.name.startsWith('!--')) { const endIndex = tag.indexOf('-->'); return { type: 'comment', comment: endIndex !== -1 ? tag.slice(4, endIndex) : '' }; } } const reg = new RegExp(attrRE); let result = null; for (;;) { result = reg.exec(tag); if (result === null) { break; } if (!result[0].trim()) { continue; } if (result[1]) { const attr = result[1].trim(); let arr = [attr, '']; if (attr.indexOf('=') > -1) { arr = attr.split('='); } res.attrs[arr[0]] = arr[1]; reg.lastIndex--; } else if (result[2]) { res.attrs[result[2]] = result[3].trim().substring(1, result[3].length - 1); } } return res; }; pushTextNode = function (list, html, start) { var content, end; end = html.indexOf('<', start); content = html.slice(start, end === -1 ? void 0 : end); if (!/^\s*$/.test(content)) { list.push({ type: 'text', content: content }); } }; pushCommentNode = function (list, tag) { var content; content = tag.replace('', ''); if (!/^\s*$/.test(content)) { list.push({ type: 'comment', content: content }); } }; function parse(html) { var arr, byTag, current, level, result; result = []; current = void 0; level = -1; arr = []; byTag = {}; html.replace(tagRE, function (tag, index) { var isComment, isOpen, nextChar, parent, start; isOpen = tag.charAt(1) !== '/'; isComment = tag.slice(0, 4) === ''; } }; function stringify(doc) { return doc.reduce(function (token, rootEl) { return token + stringifier('', rootEl); }, ''); } const cache = new Map(); const VOID_ELEMENTS = /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i; const spaces = " \\f\\n\\r\\t"; const almostEverything = "[^ " + spaces + "\\/>\"'=]+"; const attrName = "[ " + spaces + "]+" + almostEverything; const tagName = "<([A-Za-z$#]+[A-Za-z0-9:_-]*)((?:"; const attrPartials = "(?:\\s*=\\s*(?:'[^']*?'|\"[^\"]*?\"|\\([^)]*?\\)|<[^>]*?>|" + almostEverything + "))?)"; const attrSeeker = new RegExp(tagName + attrName + attrPartials + "+)([ " + spaces + "]*/?>)", "g"); const findAttributes = new RegExp("(" + attrName + "\\s*=\\s*)(|['\"(]([\\w\\s]*[\\w\\s]*)*['\")])", "gi"); const selfClosing = new RegExp(tagName + attrName + attrPartials + "*)([ " + spaces + "]*/>)", "g"); const marker = ""; const reservedNameSpaces = new Set(["class", "on", "oncapture", "style", "use", "prop", "attr"]); function attrReplacer($0, $1, $2, $3) { return "<" + $1 + $2.replace(findAttributes, replaceAttributes) + $3; } function replaceAttributes($0, $1, $2) { return $1 + ($2[0] === '"' || $2[0] === "'" ? $2.replace(//g, "###") : '"###"'); } function fullClosing($0, $1, $2) { return VOID_ELEMENTS.test($1) ? $0 : "<" + $1 + $2 + ">"; } function toPropertyName(name) { return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase()); } function createHTML(r, { delegateEvents = true } = {}) { let uuid = 1; r.wrapProps = props => { const d = Object.getOwnPropertyDescriptors(props); for (const k in d) { if (typeof d[k].value === "function" && !d[k].value.length) r.dynamicProperty(props, k); } return props; }; function createTemplate(statics) { let i = 0, markup = ""; for (; i < statics.length - 1; i++) { markup = markup + statics[i] + ""; } markup = markup + statics[i]; markup = markup.replace(selfClosing, fullClosing).replace(/<()/g, "<###").replace(/\.\.\.()/g, "###").replace(attrSeeker, attrReplacer).replace(/>\n+\s*/g, ">").replace(/\n+\s*\s+/g, "> "); const [html, code] = parseTemplate(parse(markup)), templates = []; for (let i = 0; i < html.length; i++) { templates.push(document.createElement("template")); templates[i].innerHTML = html[i]; const nomarkers = templates[i].content.querySelectorAll("script,style"); for (let j = 0; j < nomarkers.length; j++) { const d = nomarkers[j].firstChild.data || ""; if (d.indexOf(marker) > -1) { const parts = d.split(marker).reduce((memo, p, i) => { i && memo.push(""); memo.push(p); return memo; }, []); nomarkers[i].firstChild.replaceWith(...parts); } } } templates[0].create = code; cache.set(statics, templates); return templates; } function parseKeyValue(tag, name, value, isSVG, isCE, options) { let expr = value === "###" ? `!doNotWrap ? exprs[${options.counter}]() : exprs[${options.counter++}]` : value.split("###").map((v, i) => i ? ` + (typeof exprs[${options.counter}] === "function" ? exprs[${options.counter}]() : exprs[${options.counter++}]) + "${v}"` : `"${v}"`).join(""), parts, namespace; if ((parts = name.split(":")) && parts[1] && reservedNameSpaces.has(parts[0])) { name = parts[1]; namespace = parts[0]; } const isChildProp = r.ChildProperties.has(name); const isProp = r.Properties.has(name); if (name === "style") { const prev = `_$v${uuid++}`; options.decl.push(`${prev}={}`); options.exprs.push(`r.style(${tag},${expr},${prev})`); } else if (name === "classList") { const prev = `_$v${uuid++}`; options.decl.push(`${prev}={}`); options.exprs.push(`r.classList(${tag},${expr},${prev})`); } else if (namespace !== "attr" && (isChildProp || !isSVG && (r.PropAliases[name] || isProp) || isCE || namespace === "prop")) { if (isCE && !isChildProp && !isProp && namespace !== "prop") name = toPropertyName(name); options.exprs.push(`${tag}.${r.PropAliases[name] || name} = ${expr}`); } else { const ns = isSVG && name.indexOf(":") > -1 && r.SVGNamespace[name.split(":")[0]]; if (ns) options.exprs.push(`r.setAttributeNS(${tag},"${ns}","${name}",${expr})`);else options.exprs.push(`r.setAttribute(${tag},"${r.Aliases[name] || name}",${expr})`); } } function parseAttribute(tag, name, value, isSVG, isCE, options) { if (name.slice(0, 2) === "on") { if (!name.includes(":")) { const lc = name.slice(2).toLowerCase(); const delegate = delegateEvents && r.DelegatedEvents.has(lc); options.exprs.push(`r.addEventListener(${tag},"${lc}",exprs[${options.counter++}],${delegate})`); delegate && options.delegatedEvents.add(lc); } else { let capture = name.startsWith("oncapture:"); options.exprs.push(`${tag}.addEventListener("${name.slice(capture ? 10 : 3)}",exprs[${options.counter++}]${capture ? ",true" : ""})`); } } else if (name === "ref") { options.exprs.push(`exprs[${options.counter++}](${tag})`); } else { const childOptions = Object.assign({}, options, { exprs: [] }), count = options.counter; parseKeyValue(tag, name, value, isSVG, isCE, childOptions); options.decl.push(`_fn${count} = (${value === "###" ? "doNotWrap" : ""}) => {\n${childOptions.exprs.join(";\n")};\n}`); if (value === "###") { options.exprs.push(`typeof exprs[${count}] === "function" ? r.effect(_fn${count}) : _fn${count}(true)`); } else { let check = ""; for (let i = count; i < childOptions.counter; i++) { i !== count && (check += " || "); check += `typeof exprs[${i}] === "function"`; } options.exprs.push(check + ` ? r.effect(_fn${count}) : _fn${count}()`); } options.counter = childOptions.counter; options.wrap = false; } } function processChildren(node, options) { const childOptions = Object.assign({}, options, { first: true, multi: false, parent: options.path }); if (node.children.length > 1) { for (let i = 0; i < node.children.length; i++) { const child = node.children[i]; if (child.type === "comment" && child.content === "#" || child.type === "tag" && child.name === "###") { childOptions.multi = true; break; } } } let i = 0; while (i < node.children.length) { const child = node.children[i]; if (child.name === "###") { if (childOptions.multi) { node.children[i] = { type: "comment", content: "#" }; i++; } else node.children.splice(i, 1); processComponent(child, childOptions); continue; } parseNode(child, childOptions); i++; } options.counter = childOptions.counter; options.templateId = childOptions.templateId; options.hasCustomElement = options.hasCustomElement || childOptions.hasCustomElement; } function processComponentProps(propGroups) { let result = []; for (const props of propGroups) { if (Array.isArray(props)) { if (!props.length) continue; result.push(`r.wrapProps({${props.join(",") || ""}})`); } else result.push(props); } return result.length > 1 ? `r.mergeProps(${result.join(",")})` : result[0]; } function processComponent(node, options) { let props = []; const keys = Object.keys(node.attrs), propGroups = [props], componentIdentifier = options.counter++; for (let i = 0; i < keys.length; i++) { const name = keys[i], value = node.attrs[name]; if (name === "###") { propGroups.push(`exprs[${options.counter++}]`); propGroups.push(props = []); } else if (value === "###") { props.push(`${name}: exprs[${options.counter++}]`); } else props.push(`${name}: "${value}"`); } if (node.children.length === 1 && node.children[0].type === "comment" && node.children[0].content === "#") { props.push(`children: () => exprs[${options.counter++}]`); } else if (node.children.length) { const children = { type: "fragment", children: node.children }, childOptions = Object.assign({}, options, { first: true, decl: [], exprs: [], parent: false }); parseNode(children, childOptions); props.push(`children: () => { ${childOptions.exprs.join(";\n")}}`); options.templateId = childOptions.templateId; options.counter = childOptions.counter; } let tag; if (options.multi) { tag = `_$el${uuid++}`; options.decl.push(`${tag} = ${options.path}.${options.first ? "firstChild" : "nextSibling"}`); } if (options.parent) options.exprs.push(`r.insert(${options.parent}, r.createComponent(exprs[${componentIdentifier}],${processComponentProps(propGroups)})${tag ? `, ${tag}` : ""})`);else options.exprs.push(`${options.fragment ? "" : "return "}r.createComponent(exprs[${componentIdentifier}],${processComponentProps(propGroups)})`); options.path = tag; options.first = false; } function parseNode(node, options) { if (node.type === "fragment") { const parts = []; node.children.forEach(child => { if (child.type === "tag") { if (child.name === "###") { const childOptions = Object.assign({}, options, { first: true, fragment: true, decl: [], exprs: [] }); processComponent(child, childOptions); parts.push(childOptions.exprs[0]); options.counter = childOptions.counter; options.templateId = childOptions.templateId; return; } options.templateId++; const id = uuid; const childOptions = Object.assign({}, options, { first: true, decl: [], exprs: [] }); options.templateNodes.push([child]); parseNode(child, childOptions); parts.push(`function() { ${childOptions.decl.join(",\n") + ";\n" + childOptions.exprs.join(";\n") + `;\nreturn _$el${id};\n`}}()`); options.counter = childOptions.counter; options.templateId = childOptions.templateId; } else if (child.type === "text") { parts.push(`"${child.content}"`); } else if (child.type === "comment" && child.content === "#") { parts.push(`exprs[${options.counter++}]`); } }); options.exprs.push(`return [${parts.join(", \n")}]`); } else if (node.type === "tag") { const tag = `_$el${uuid++}`; const topDecl = !options.decl.length; const templateId = options.templateId; options.decl.push(topDecl ? "" : `${tag} = ${options.path}.${options.first ? "firstChild" : "nextSibling"}`); const keys = Object.keys(node.attrs); const isSVG = r.SVGElements.has(node.name); const isCE = node.name.includes("-"); options.hasCustomElement = isCE; for (let i = 0; i < keys.length; i++) { const name = keys[i], value = node.attrs[name]; if (value.includes("###")) { delete node.attrs[name]; parseAttribute(tag, name, value, isSVG, isCE, options); } else if (name === "###") { delete node.attrs[name]; options.exprs.push(`r.spread(${tag},exprs[${options.counter++}],${isSVG},${!!node.children.length})`); } } options.path = tag; options.first = false; processChildren(node, options); if (topDecl) { options.decl[0] = options.hasCustomElement ? `const ${tag} = document.importNode(tmpls[${templateId}].content.firstChild, true)` : `const ${tag} = tmpls[${templateId}].content.firstChild.cloneNode(true)`; } } else if (node.type === "text") { const tag = `_$el${uuid++}`; options.decl.push(`${tag} = ${options.path}.${options.first ? "firstChild" : "nextSibling"}`); options.path = tag; options.first = false; } else if (node.type === "comment") { const tag = `_$el${uuid++}`; options.decl.push(`${tag} = ${options.path}.${options.first ? "firstChild" : "nextSibling"}`); if (node.content === "#") { if (options.multi) { options.exprs.push(`r.insert(${options.parent}, exprs[${options.counter++}], ${tag})`); } else options.exprs.push(`r.insert(${options.parent}, exprs[${options.counter++}])`); } options.path = tag; options.first = false; } } function parseTemplate(nodes) { const options = { path: "", decl: [], exprs: [], delegatedEvents: new Set(), counter: 0, first: true, multi: false, templateId: 0, templateNodes: [] }, id = uuid, origNodes = nodes; let toplevel; if (nodes.length > 1) { nodes = [{ type: "fragment", children: nodes }]; } if (nodes[0].name === "###") { toplevel = true; processComponent(nodes[0], options); } else parseNode(nodes[0], options); r.delegateEvents(Array.from(options.delegatedEvents)); const templateNodes = [origNodes].concat(options.templateNodes); return [templateNodes.map(t => stringify(t)), new Function("tmpls", "exprs", "r", options.decl.join(",\n") + ";\n" + options.exprs.join(";\n") + (toplevel ? "" : `;\nreturn _$el${id};\n`))]; } function html(statics, ...args) { const templates = cache.get(statics) || createTemplate(statics); return templates[0].create(templates, args, r); } return html; } var index = createHTML({ createRenderEffect, style, insert, spread, createComponent, delegateEvents, classList, mergeProps, dynamicProperty, setAttribute, setAttributeNS, addEventListener, Aliases, PropAliases, Properties, ChildProperties, DelegatedEvents, SVGElements, SVGNamespace }); export { $DEVCOMP, $PROXY, $TRACK, DEV, ErrorBoundary, For, Index, Match, Show, Suspense, SuspenseList, Switch, batch, cancelCallback, children, createComponent, createComputed, createContext, createDeferred, createEffect, createMemo, createReaction, createRenderEffect as effect, createResource, createRoot, createSelector, createSignal, createUniqueId, enableExternalSource, enableHydration, enableScheduling, equalFn, from, getListener, getOwner, indexArray, lazy, mapArray, mergeProps, observable, on, onCleanup, onError, onMount, requestCallback, resetErrorBoundaries, runWithOwner, sharedConfig, splitProps, startTransition, untrack, useContext, useTransition, Aliases, Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Assets as HydrationScript, NoHydration, Portal, PropAliases, Properties, SVGElements, SVGNamespace, addEventListener, assign, classList, className, clearDelegatedEvents, delegateEvents, dynamicProperty, escape, generateHydrationScript, getHydrationKey, getNextElement, getNextMarker, getNextMatch, hydrate, innerHTML, insert, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, spread, ssr, ssrAttribute, ssrClassList, ssrHydrationKey, ssrSpread, ssrStyle, style, template, index as html };