Skip to content

Instantly share code, notes, and snippets.

@ricky9w
Last active May 27, 2026 05:49
Show Gist options
  • Select an option

  • Save ricky9w/07dcf4711fbab64bda9b8617b6d1088e to your computer and use it in GitHub Desktop.

Select an option

Save ricky9w/07dcf4711fbab64bda9b8617b6d1088e to your computer and use it in GitHub Desktop.
Amazon 利润计算器 — 油猴脚本(自动更新源 / revcal)

Amazon 利润计算器 · 油猴脚本

www.amazon.com 商品页一键估算单品毛利毛利率,辅助选品 / 市场考察。仅支持美国站

这是项目的油猴脚本端说明。还有功能一致的网页版(部署在 Cloudflare Workers)。

安装(从 Gist 安装才能自动更新)

  1. 浏览器安装 Tampermonkey
  2. 打开下面的链接,Tampermonkey 会拦截 .user.js 并弹出安装页: https://gist.githubusercontent.com/ricky9w/07dcf4711fbab64bda9b8617b6d1088e/raw/userscript.user.js
  3. 脚本内置 @updateURL/@downloadURL 指向本 Gist,Tampermonkey 之后会自动检查并更新

⚠️ 不要拖本地文件安装——那样不会自动更新。请用上面的 Gist 链接安装一次。

首次使用前:配置数据源

商品数据来自 Amazon SP-API,经你自部署的 Cloudflare Worker 取数(凭据是机密、SP-API 无 CORS,脚本不能直连)。Worker 受 Cloudflare Access 保护,脚本用 Service Token 非交互认证。

  1. 在 Cloudflare Zero Trust → Access → Service Auth 建一个 Service Token,并在保护 Worker 的 Access 应用里加一条 Service Auth 策略放行。
  2. 打开计算器 → 设置 → 数据源,填:
    • Worker 地址(默认 https://revcal-web.ricky9w.workers.dev)
    • CF-Access-Client-Id / CF-Access-Client-Secret(上一步的 Service Token)
  3. 保存。凭据存于 Tampermonkey 沙箱存储,页面读不到。

部署 Worker 与获取 SP-API 凭据的完整步骤见主仓库 docs/(sp-api-credentials.mddeployment.md)。

使用

打开任意 www.amazon.com 商品页,点右下角 ¥ 浮动按钮弹出计算器:

  • 三栏布局,所有字段可编辑、改动即时重算:售价 / 汇率 / 采购成本 / 头程物流 / FBA 配送费 / 佣金。
  • 顶部填 ASIN(或在商品页自动识别),自动带出 Buy Box 售价、佣金、FBA 配送费、尺寸、重量。
  • 左侧成本柱状图(成本构成 / 成本占售价两种视图),右栏实时显示毛利与毛利率。
  • 设置页可维护汇率与头程运费默认值。

计算模型

  • 以站点货币(USD)为基准:毛利 = 售价 − 佣金 − FBA − 采购成本 − 头程,毛利率 = 毛利 / 售价
  • 头程:计费重 × 运费,计费重 = max(实重, 体积重),体积重 = 长×宽×高 / 6000(cm)。
  • CNY 成本(采购、头程)按汇率换算为 USD;汇率方向为 1 USD = N CNY
  • 佣金按 售价 × 费率 实时重算,含 $0.30 最低下限。

源码与网页版:https://github.com/ricky9w/revcal(私有)

// ==UserScript==
// @name Amazon 利润计算器
// @namespace https://github.com/ricky9w/revcal
// @version 0.2.2
// @description 亚马逊商品毛利与利润率计算器(美国站)
// @homepageURL https://github.com/ricky9w/revcal
// @supportURL https://github.com/ricky9w/revcal/issues
// @downloadURL https://gist.githubusercontent.com/ricky9w/07dcf4711fbab64bda9b8617b6d1088e/raw/userscript.user.js
// @updateURL https://gist.githubusercontent.com/ricky9w/07dcf4711fbab64bda9b8617b6d1088e/raw/userscript.meta.js
// @match https://www.amazon.com/*
// @connect revcal-web.ricky9w.workers.dev
// @connect api.frankfurter.dev
// @connect open.er-api.com
// @grant GM_deleteValue
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_xmlhttpRequest
// ==/UserScript==
// ==UserScript==
// @name Amazon 利润计算器
// @namespace https://github.com/ricky9w/revcal
// @version 0.2.2
// @description 亚马逊商品毛利与利润率计算器(美国站)
// @homepageURL https://github.com/ricky9w/revcal
// @supportURL https://github.com/ricky9w/revcal/issues
// @downloadURL https://gist.githubusercontent.com/ricky9w/07dcf4711fbab64bda9b8617b6d1088e/raw/userscript.user.js
// @updateURL https://gist.githubusercontent.com/ricky9w/07dcf4711fbab64bda9b8617b6d1088e/raw/userscript.meta.js
// @match https://www.amazon.com/*
// @connect revcal-web.ricky9w.workers.dev
// @connect api.frankfurter.dev
// @connect open.er-api.com
// @grant GM_deleteValue
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_xmlhttpRequest
// ==/UserScript==
(function() {
'use strict';
var is_array = Array.isArray;
var index_of = Array.prototype.indexOf;
var includes = Array.prototype.includes;
var array_from = Array.from;
var define_property = Object.defineProperty;
var get_descriptor = Object.getOwnPropertyDescriptor;
var get_descriptors = Object.getOwnPropertyDescriptors;
var object_prototype = Object.prototype;
var array_prototype = Array.prototype;
var get_prototype_of = Object.getPrototypeOf;
var is_extensible = Object.isExtensible;
var noop = () => {};
function run_all(arr) {
for (var i = 0; i < arr.length; i++) arr[i]();
}
function deferred() {
var resolve;
var reject;
return {
promise: new Promise((res, rej) => {
resolve = res;
reject = rej;
}),
resolve,
reject
};
}
function to_array(value, n) {
if (Array.isArray(value)) return value;
if (n === void 0 || !(Symbol.iterator in value)) return Array.from(value);
const array = [];
for (const element of value) {
array.push(element);
if (array.length === n) break;
}
return array;
}
var CLEAN = 1024;
var DIRTY = 2048;
var MAYBE_DIRTY = 4096;
var INERT = 8192;
var DESTROYED = 16384;
var REACTION_RAN = 32768;
var DESTROYING = 1 << 25;
var EFFECT_TRANSPARENT = 65536;
var EFFECT_PRESERVED = 1 << 19;
var USER_EFFECT = 1 << 20;
var EFFECT_OFFSCREEN = 1 << 25;
var WAS_MARKED = 65536;
var REACTION_IS_UPDATING = 1 << 21;
var ASYNC = 1 << 22;
var ERROR_VALUE = 1 << 23;
var STATE_SYMBOL = Symbol("$state");
var LEGACY_PROPS = Symbol("legacy props");
var LOADING_ATTR_SYMBOL = Symbol("");
var ATTRIBUTES_CACHE = Symbol("attributes");
var CLASS_CACHE = Symbol("class");
var STYLE_CACHE = Symbol("style");
var TEXT_CACHE = Symbol("text");
var FORM_RESET_HANDLER = Symbol("form reset");
var STALE_REACTION = new class StaleReactionError extends Error {
name = "StaleReactionError";
message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
}();
var IS_XHTML = !!globalThis.document?.contentType && globalThis.document.contentType.includes("xml");
function async_derived_orphan() {
throw new Error(`https://svelte.dev/e/async_derived_orphan`);
}
function each_key_duplicate(a, b, value) {
throw new Error(`https://svelte.dev/e/each_key_duplicate`);
}
function effect_in_teardown(rune) {
throw new Error(`https://svelte.dev/e/effect_in_teardown`);
}
function effect_in_unowned_derived() {
throw new Error(`https://svelte.dev/e/effect_in_unowned_derived`);
}
function effect_orphan(rune) {
throw new Error(`https://svelte.dev/e/effect_orphan`);
}
function effect_update_depth_exceeded() {
throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
}
function props_invalid_value(key) {
throw new Error(`https://svelte.dev/e/props_invalid_value`);
}
function state_descriptors_fixed() {
throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
}
function state_prototype_fixed() {
throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
}
function state_unsafe_mutation() {
throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
}
function svelte_boundary_reset_onerror() {
throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
}
var HYDRATION_ERROR = {};
var UNINITIALIZED = Symbol("uninitialized");
var NAMESPACE_HTML = "http://www.w3.org/1999/xhtml";
function derived_inert() {
console.warn(`https://svelte.dev/e/derived_inert`);
}
function hydration_mismatch(location) {
console.warn(`https://svelte.dev/e/hydration_mismatch`);
}
function select_multiple_invalid_value() {
console.warn(`https://svelte.dev/e/select_multiple_invalid_value`);
}
function svelte_boundary_reset_noop() {
console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
}
var hydrating = false;
function set_hydrating(value) {
hydrating = value;
}
var hydrate_node;
function set_hydrate_node(node) {
if (node === null) {
hydration_mismatch();
throw HYDRATION_ERROR;
}
return hydrate_node = node;
}
function hydrate_next() {
return set_hydrate_node(get_next_sibling(hydrate_node));
}
function reset(node) {
if (!hydrating) return;
if (get_next_sibling(hydrate_node) !== null) {
hydration_mismatch();
throw HYDRATION_ERROR;
}
hydrate_node = node;
}
function next(count = 1) {
if (hydrating) {
var i = count;
var node = hydrate_node;
while (i--) node = get_next_sibling(node);
hydrate_node = node;
}
}
function skip_nodes(remove = true) {
var depth = 0;
var node = hydrate_node;
while (true) {
if (node.nodeType === 8) {
var data = node.data;
if (data === "]") {
if (depth === 0) return node;
depth -= 1;
} else if (data === "[" || data === "[!" || data[0] === "[" && !isNaN(Number(data.slice(1)))) depth += 1;
}
var next = get_next_sibling(node);
if (remove) node.remove();
node = next;
}
}
function read_hydration_instruction(node) {
if (!node || node.nodeType !== 8) {
hydration_mismatch();
throw HYDRATION_ERROR;
}
return node.data;
}
function equals(value) {
return value === this.v;
}
function safe_not_equal(a, b) {
return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
}
function safe_equals(value) {
return !safe_not_equal(value, this.v);
}
var async_mode_flag = false;
var legacy_mode_flag = false;
var component_context = null;
function set_component_context(context) {
component_context = context;
}
function push(props, runes = false, fn) {
component_context = {
p: component_context,
i: false,
c: null,
e: null,
s: props,
x: null,
r: active_effect,
l: legacy_mode_flag && !runes ? {
s: null,
u: null,
$: []
} : null
};
}
function pop(component) {
var context = component_context;
var effects = context.e;
if (effects !== null) {
context.e = null;
for (var fn of effects) create_user_effect(fn);
}
if (component !== void 0) context.x = component;
context.i = true;
component_context = context.p;
return component ?? {};
}
function is_runes() {
return !legacy_mode_flag || component_context !== null && component_context.l === null;
}
var micro_tasks = [];
function run_micro_tasks() {
var tasks = micro_tasks;
micro_tasks = [];
run_all(tasks);
}
function queue_micro_task(fn) {
if (micro_tasks.length === 0 && !is_flushing_sync) {
var tasks = micro_tasks;
queueMicrotask(() => {
if (tasks === micro_tasks) run_micro_tasks();
});
}
micro_tasks.push(fn);
}
function flush_tasks() {
while (micro_tasks.length > 0) run_micro_tasks();
}
function handle_error(error) {
var effect = active_effect;
if (effect === null) {
active_reaction.f |= ERROR_VALUE;
return error;
}
if ((effect.f & 32768) === 0 && (effect.f & 4) === 0) throw error;
invoke_error_boundary(error, effect);
}
function invoke_error_boundary(error, effect) {
while (effect !== null) {
if ((effect.f & 128) !== 0) {
if ((effect.f & 32768) === 0) throw error;
try {
effect.b.error(error);
return;
} catch (e) {
error = e;
}
}
effect = effect.parent;
}
throw error;
}
var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
function set_signal_status(signal, status) {
signal.f = signal.f & STATUS_MASK | status;
}
function update_derived_status(derived) {
if ((derived.f & 512) !== 0 || derived.deps === null) set_signal_status(derived, CLEAN);
else set_signal_status(derived, MAYBE_DIRTY);
}
function clear_marked(deps) {
if (deps === null) return;
for (const dep of deps) {
if ((dep.f & 2) === 0 || (dep.f & 65536) === 0) continue;
dep.f ^= WAS_MARKED;
clear_marked(dep.deps);
}
}
function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
if ((effect.f & 2048) !== 0) dirty_effects.add(effect);
else if ((effect.f & 4096) !== 0) maybe_dirty_effects.add(effect);
clear_marked(effect.deps);
set_signal_status(effect, CLEAN);
}
var legacy_is_updating_store = false;
var is_store_binding = false;
function capture_store_binding(fn) {
var previous_is_store_binding = is_store_binding;
try {
is_store_binding = false;
return [fn(), is_store_binding];
} finally {
is_store_binding = previous_is_store_binding;
}
}
var first_batch = null;
var last_batch = null;
var current_batch = null;
var previous_batch = null;
var batch_values = null;
var last_scheduled_effect = null;
var is_flushing_sync = false;
var is_processing = false;
var collected_effects = null;
var legacy_updates = null;
var flush_count = 0;
var uid = 1;
var Batch = class Batch {
id = uid++;
#started = false;
linked = true;
#prev = null;
#next = null;
async_deriveds = new Map();
current = new Map();
previous = new Map();
unblocked = new Set();
#commit_callbacks = new Set();
#discard_callbacks = new Set();
#fork_commit_callbacks = new Set();
#pending = 0;
#blocking_pending = new Map();
#deferred = null;
#roots = [];
#new_effects = [];
#dirty_effects = new Set();
#maybe_dirty_effects = new Set();
#skipped_branches = new Map();
#unskipped_branches = new Set();
is_fork = false;
#decrement_queued = false;
#is_deferred() {
if (this.is_fork) return true;
for (const effect of this.#blocking_pending.keys()) {
var e = effect;
var skipped = false;
while (e.parent !== null) {
if (this.#skipped_branches.has(e)) {
skipped = true;
break;
}
e = e.parent;
}
if (!skipped) return true;
}
return false;
}
skip_effect(effect) {
if (!this.#skipped_branches.has(effect)) this.#skipped_branches.set(effect, {
d: [],
m: []
});
this.#unskipped_branches.delete(effect);
}
unskip_effect(effect, callback = (e) => this.schedule(e)) {
var tracked = this.#skipped_branches.get(effect);
if (tracked) {
this.#skipped_branches.delete(effect);
for (var e of tracked.d) {
set_signal_status(e, DIRTY);
callback(e);
}
for (e of tracked.m) {
set_signal_status(e, MAYBE_DIRTY);
callback(e);
}
}
this.#unskipped_branches.add(effect);
}
#process() {
this.#started = true;
if (flush_count++ > 1e3) {
this.#unlink();
infinite_loop_guard();
}
if (!this.#is_deferred()) {
for (const e of this.#dirty_effects) {
this.#maybe_dirty_effects.delete(e);
set_signal_status(e, DIRTY);
this.schedule(e);
}
for (const e of this.#maybe_dirty_effects) {
set_signal_status(e, MAYBE_DIRTY);
this.schedule(e);
}
}
const roots = this.#roots;
this.#roots = [];
this.apply();
var effects = collected_effects = [];
var render_effects = [];
var updates = legacy_updates = [];
for (const root of roots) try {
this.#traverse(root, effects, render_effects);
} catch (e) {
reset_all(root);
throw e;
}
current_batch = null;
if (updates.length > 0) {
var batch = Batch.ensure();
for (const e of updates) batch.schedule(e);
}
collected_effects = null;
legacy_updates = null;
if (this.#is_deferred()) {
this.#defer_effects(render_effects);
this.#defer_effects(effects);
for (const [e, t] of this.#skipped_branches) reset_branch(e, t);
if (updates.length > 0) current_batch.#process();
return;
}
const earlier_batch = this.#find_earlier_batch();
if (earlier_batch) {
earlier_batch.#merge(this);
return;
}
this.#dirty_effects.clear();
this.#maybe_dirty_effects.clear();
for (const fn of this.#commit_callbacks) fn(this);
this.#commit_callbacks.clear();
previous_batch = this;
flush_queued_effects(render_effects);
flush_queued_effects(effects);
previous_batch = null;
this.#deferred?.resolve();
var next_batch = current_batch;
if (this.linked && this.#pending === 0) this.#unlink();
if (async_mode_flag && !this.linked) {
this.#commit();
current_batch = next_batch;
}
if (this.#roots.length > 0) {
if (next_batch === null) {
next_batch = this;
this.#link();
}
const batch = next_batch;
batch.#roots.push(...this.#roots.filter((r) => !batch.#roots.includes(r)));
}
if (next_batch !== null) next_batch.#process();
}
#traverse(root, effects, render_effects) {
root.f ^= CLEAN;
var effect = root.first;
while (effect !== null) {
var flags = effect.f;
var is_branch = (flags & 96) !== 0;
if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || this.#skipped_branches.has(effect)) && effect.fn !== null) {
if (is_branch) effect.f ^= CLEAN;
else if ((flags & 4) !== 0) effects.push(effect);
else if (async_mode_flag && (flags & 16777224) !== 0) render_effects.push(effect);
else if (is_dirty(effect)) {
if ((flags & 16) !== 0) this.#maybe_dirty_effects.add(effect);
update_effect(effect);
}
var child = effect.first;
if (child !== null) {
effect = child;
continue;
}
}
while (effect !== null) {
var next = effect.next;
if (next !== null) {
effect = next;
break;
}
effect = effect.parent;
}
}
}
#find_earlier_batch() {
var batch = this.#prev;
while (batch !== null) {
if (!batch.is_fork) {
for (const [value, [, is_derived]] of this.current) if (batch.current.has(value) && !is_derived) return batch;
}
batch = batch.#prev;
}
return null;
}
#merge(batch) {
for (const [source, value] of batch.current) {
if (!this.previous.has(source) && batch.previous.has(source)) this.previous.set(source, batch.previous.get(source));
this.current.set(source, value);
}
for (const [effect, deferred] of batch.async_deriveds) {
const d = this.async_deriveds.get(effect);
if (d) deferred.promise.then(d.resolve);
}
const mark = (value) => {
var reactions = value.reactions;
if (reactions === null) return;
for (const reaction of reactions) {
var flags = reaction.f;
if ((flags & 2) !== 0) mark(reaction);
else {
var effect = reaction;
if (flags & 4194320 && !this.async_deriveds.has(effect)) {
this.#maybe_dirty_effects.delete(effect);
set_signal_status(effect, DIRTY);
this.schedule(effect);
}
}
}
};
for (const source of this.current.keys()) mark(source);
this.oncommit(() => batch.discard());
batch.#unlink();
current_batch = this;
this.#process();
}
#defer_effects(effects) {
for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);
}
capture(source, value, is_derived = false) {
if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
if ((source.f & 8388608) === 0) {
this.current.set(source, [value, is_derived]);
batch_values?.set(source, value);
}
if (!this.is_fork) source.v = value;
}
activate() {
current_batch = this;
}
deactivate() {
current_batch = null;
batch_values = null;
}
flush() {
try {
is_processing = true;
current_batch = this;
this.#process();
} finally {
flush_count = 0;
last_scheduled_effect = null;
collected_effects = null;
legacy_updates = null;
is_processing = false;
current_batch = null;
batch_values = null;
old_values.clear();
}
}
discard() {
for (const fn of this.#discard_callbacks) fn(this);
this.#discard_callbacks.clear();
this.#fork_commit_callbacks.clear();
this.#unlink();
}
register_created_effect(effect) {
this.#new_effects.push(effect);
}
#commit() {
this.#unlink();
for (let batch = first_batch; batch !== null; batch = batch.#next) {
var is_earlier = batch.id < this.id;
var sources = [];
for (const [source, [value, is_derived]] of this.current) {
if (batch.current.has(source)) {
var batch_value = batch.current.get(source)[0];
if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
else continue;
}
sources.push(source);
}
if (is_earlier) for (const [effect, deferred] of this.async_deriveds) {
const d = batch.async_deriveds.get(effect);
if (d) deferred.promise.then(d.resolve);
}
if (!batch.#started) continue;
var others = [...batch.current.keys()].filter((s) => !this.current.has(s));
if (others.length === 0) {
if (is_earlier) batch.discard();
} else if (sources.length > 0) {
if (is_earlier) for (const unskipped of this.#unskipped_branches) batch.unskip_effect(unskipped, (e) => {
if ((e.f & 4194320) !== 0) batch.schedule(e);
else batch.#defer_effects([e]);
});
batch.activate();
var marked = new Set();
var checked = new Map();
for (var source of sources) mark_effects(source, others, marked, checked);
checked = new Map();
var current_unequal = [...batch.current.keys()].filter((c) => this.current.has(c) ? this.current.get(c)[0] !== c.v : true);
if (current_unequal.length > 0) {
for (const effect of this.#new_effects) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
set_signal_status(effect, DIRTY);
batch.schedule(effect);
} else batch.#dirty_effects.add(effect);
}
if (batch.#roots.length > 0 && !batch.#decrement_queued) {
batch.apply();
for (var root of batch.#roots) batch.#traverse(root, [], []);
batch.#roots = [];
}
batch.deactivate();
}
}
}
increment(blocking, effect) {
this.#pending += 1;
if (blocking) {
let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
this.#blocking_pending.set(effect, blocking_pending_count + 1);
}
}
decrement(blocking, effect) {
this.#pending -= 1;
if (blocking) {
let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
if (blocking_pending_count === 1) this.#blocking_pending.delete(effect);
else this.#blocking_pending.set(effect, blocking_pending_count - 1);
}
if (this.#decrement_queued) return;
this.#decrement_queued = true;
queue_micro_task(() => {
this.#decrement_queued = false;
if (this.linked) this.flush();
});
}
transfer_effects(dirty_effects, maybe_dirty_effects) {
for (const e of dirty_effects) this.#dirty_effects.add(e);
for (const e of maybe_dirty_effects) this.#maybe_dirty_effects.add(e);
dirty_effects.clear();
maybe_dirty_effects.clear();
}
oncommit(fn) {
this.#commit_callbacks.add(fn);
}
ondiscard(fn) {
this.#discard_callbacks.add(fn);
}
on_fork_commit(fn) {
this.#fork_commit_callbacks.add(fn);
}
run_fork_commit_callbacks() {
for (const fn of this.#fork_commit_callbacks) fn(this);
this.#fork_commit_callbacks.clear();
}
settled() {
return (this.#deferred ??= deferred()).promise;
}
static ensure() {
if (current_batch === null) {
const batch = current_batch = new Batch();
batch.#link();
if (!is_processing && !is_flushing_sync) queue_micro_task(() => {
if (!batch.#started) batch.flush();
});
}
return current_batch;
}
apply() {
if (!async_mode_flag || !this.is_fork && this.#prev === null && this.#next === null) {
batch_values = null;
return;
}
batch_values = new Map();
for (const [source, [value]] of this.current) batch_values.set(source, value);
for (let batch = first_batch; batch !== null; batch = batch.#next) {
if (batch === this || batch.is_fork) continue;
var intersects = false;
if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) {
if (is_derived) continue;
if (this.current.has(source)) {
intersects = true;
break;
}
}
if (!intersects) {
for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
}
}
}
schedule(effect) {
last_scheduled_effect = effect;
if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
effect.b.defer_effect(effect);
return;
}
var e = effect;
while (e.parent !== null) {
e = e.parent;
var flags = e.f;
if (collected_effects !== null && e === active_effect) {
if (async_mode_flag) return;
if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
}
if ((flags & 96) !== 0) {
if ((flags & 1024) === 0) return;
e.f ^= CLEAN;
}
}
this.#roots.push(e);
}
#link() {
if (last_batch === null) first_batch = last_batch = this;
else {
last_batch.#next = this;
this.#prev = last_batch;
}
last_batch = this;
}
#unlink() {
var prev = this.#prev;
var next = this.#next;
if (prev === null) first_batch = next;
else prev.#next = next;
if (next === null) last_batch = prev;
else next.#prev = prev;
this.linked = false;
}
};
function flushSync(fn) {
var was_flushing_sync = is_flushing_sync;
is_flushing_sync = true;
try {
var result;
if (fn) {
if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
result = fn();
}
while (true) {
flush_tasks();
if (current_batch === null) return result;
current_batch.flush();
}
} finally {
is_flushing_sync = was_flushing_sync;
}
}
function infinite_loop_guard() {
try {
effect_update_depth_exceeded();
} catch (error) {
invoke_error_boundary(error, last_scheduled_effect);
}
}
var eager_block_effects = null;
function flush_queued_effects(effects) {
var length = effects.length;
if (length === 0) return;
var i = 0;
while (i < length) {
var effect = effects[i++];
if ((effect.f & 24576) === 0 && is_dirty(effect)) {
eager_block_effects = new Set();
update_effect(effect);
if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
if (eager_block_effects?.size > 0) {
old_values.clear();
for (const e of eager_block_effects) {
if ((e.f & 24576) !== 0) continue;
const ordered_effects = [e];
let ancestor = e.parent;
while (ancestor !== null) {
if (eager_block_effects.has(ancestor)) {
eager_block_effects.delete(ancestor);
ordered_effects.push(ancestor);
}
ancestor = ancestor.parent;
}
for (let j = ordered_effects.length - 1; j >= 0; j--) {
const e = ordered_effects[j];
if ((e.f & 24576) !== 0) continue;
update_effect(e);
}
}
eager_block_effects.clear();
}
}
}
eager_block_effects = null;
}
function mark_effects(value, sources, marked, checked) {
if (marked.has(value)) return;
marked.add(value);
if (value.reactions !== null) for (const reaction of value.reactions) {
const flags = reaction.f;
if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
set_signal_status(reaction, DIRTY);
schedule_effect(reaction);
}
}
}
function depends_on(reaction, sources, checked) {
const depends = checked.get(reaction);
if (depends !== void 0) return depends;
if (reaction.deps !== null) for (const dep of reaction.deps) {
if (includes.call(sources, dep)) return true;
if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
checked.set(dep, true);
return true;
}
}
checked.set(reaction, false);
return false;
}
function schedule_effect(effect) {
current_batch.schedule(effect);
}
function reset_branch(effect, tracked) {
if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
if ((effect.f & 2048) !== 0) tracked.d.push(effect);
else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
set_signal_status(effect, CLEAN);
var e = effect.first;
while (e !== null) {
reset_branch(e, tracked);
e = e.next;
}
}
function reset_all(effect) {
set_signal_status(effect, CLEAN);
var e = effect.first;
while (e !== null) {
reset_all(e);
e = e.next;
}
}
function createSubscriber(start) {
let subscribers = 0;
let version = source(0);
let stop;
return () => {
if (effect_tracking()) {
get(version);
render_effect(() => {
if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
subscribers += 1;
return () => {
queue_micro_task(() => {
subscribers -= 1;
if (subscribers === 0) {
stop?.();
stop = void 0;
increment(version);
}
});
};
});
}
};
}
var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
function boundary(node, props, children, transform_error) {
new Boundary(node, props, children, transform_error);
}
var Boundary = class {
parent;
is_pending = false;
transform_error;
#anchor;
#hydrate_open = hydrating ? hydrate_node : null;
#props;
#children;
#effect;
#main_effect = null;
#pending_effect = null;
#failed_effect = null;
#offscreen_fragment = null;
#local_pending_count = 0;
#pending_count = 0;
#pending_count_update_queued = false;
#dirty_effects = new Set();
#maybe_dirty_effects = new Set();
#effect_pending = null;
#effect_pending_subscriber = createSubscriber(() => {
this.#effect_pending = source(this.#local_pending_count);
return () => {
this.#effect_pending = null;
};
});
constructor(node, props, children, transform_error) {
this.#anchor = node;
this.#props = props;
this.#children = (anchor) => {
var effect = active_effect;
effect.b = this;
effect.f |= 128;
children(anchor);
};
this.parent = active_effect.b;
this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
this.#effect = block(() => {
if (hydrating) {
const comment = this.#hydrate_open;
hydrate_next();
const server_rendered_pending = comment.data === "[!";
if (comment.data.startsWith("[?")) {
const serialized_error = JSON.parse(comment.data.slice(2));
this.#hydrate_failed_content(serialized_error);
} else if (server_rendered_pending) this.#hydrate_pending_content();
else this.#hydrate_resolved_content();
} else this.#render();
}, flags);
if (hydrating) this.#anchor = hydrate_node;
}
#hydrate_resolved_content() {
try {
this.#main_effect = branch(() => this.#children(this.#anchor));
} catch (error) {
this.error(error);
}
}
#hydrate_failed_content(error) {
const failed = this.#props.failed;
if (!failed) return;
this.#failed_effect = branch(() => {
failed(this.#anchor, () => error, () => () => {});
});
}
#hydrate_pending_content() {
const pending = this.#props.pending;
if (!pending) return;
this.is_pending = true;
this.#pending_effect = branch(() => pending(this.#anchor));
queue_micro_task(() => {
var fragment = this.#offscreen_fragment = document.createDocumentFragment();
var anchor = create_text();
fragment.append(anchor);
this.#main_effect = this.#run(() => {
return branch(() => this.#children(anchor));
});
if (this.#pending_count === 0) {
this.#anchor.before(fragment);
this.#offscreen_fragment = null;
pause_effect(this.#pending_effect, () => {
this.#pending_effect = null;
});
this.#resolve(current_batch);
}
});
}
#render() {
try {
this.is_pending = this.has_pending_snippet();
this.#pending_count = 0;
this.#local_pending_count = 0;
this.#main_effect = branch(() => {
this.#children(this.#anchor);
});
if (this.#pending_count > 0) {
var fragment = this.#offscreen_fragment = document.createDocumentFragment();
move_effect(this.#main_effect, fragment);
const pending = this.#props.pending;
this.#pending_effect = branch(() => pending(this.#anchor));
} else this.#resolve(current_batch);
} catch (error) {
this.error(error);
}
}
#resolve(batch) {
this.is_pending = false;
batch.transfer_effects(this.#dirty_effects, this.#maybe_dirty_effects);
}
defer_effect(effect) {
defer_effect(effect, this.#dirty_effects, this.#maybe_dirty_effects);
}
is_rendered() {
return !this.is_pending && (!this.parent || this.parent.is_rendered());
}
has_pending_snippet() {
return !!this.#props.pending;
}
#run(fn) {
var previous_effect = active_effect;
var previous_reaction = active_reaction;
var previous_ctx = component_context;
set_active_effect(this.#effect);
set_active_reaction(this.#effect);
set_component_context(this.#effect.ctx);
try {
Batch.ensure();
return fn();
} catch (e) {
handle_error(e);
return null;
} finally {
set_active_effect(previous_effect);
set_active_reaction(previous_reaction);
set_component_context(previous_ctx);
}
}
#update_pending_count(d, batch) {
if (!this.has_pending_snippet()) {
if (this.parent) this.parent.#update_pending_count(d, batch);
return;
}
this.#pending_count += d;
if (this.#pending_count === 0) {
this.#resolve(batch);
if (this.#pending_effect) pause_effect(this.#pending_effect, () => {
this.#pending_effect = null;
});
if (this.#offscreen_fragment) {
this.#anchor.before(this.#offscreen_fragment);
this.#offscreen_fragment = null;
}
}
}
update_pending_count(d, batch) {
this.#update_pending_count(d, batch);
this.#local_pending_count += d;
if (!this.#effect_pending || this.#pending_count_update_queued) return;
this.#pending_count_update_queued = true;
queue_micro_task(() => {
this.#pending_count_update_queued = false;
if (this.#effect_pending) internal_set(this.#effect_pending, this.#local_pending_count);
});
}
get_effect_pending() {
this.#effect_pending_subscriber();
return get(this.#effect_pending);
}
error(error) {
if (!this.#props.onerror && !this.#props.failed) throw error;
if (current_batch?.is_fork) {
if (this.#main_effect) current_batch.skip_effect(this.#main_effect);
if (this.#pending_effect) current_batch.skip_effect(this.#pending_effect);
if (this.#failed_effect) current_batch.skip_effect(this.#failed_effect);
current_batch.on_fork_commit(() => {
this.#handle_error(error);
});
} else this.#handle_error(error);
}
#handle_error(error) {
if (this.#main_effect) {
destroy_effect(this.#main_effect);
this.#main_effect = null;
}
if (this.#pending_effect) {
destroy_effect(this.#pending_effect);
this.#pending_effect = null;
}
if (this.#failed_effect) {
destroy_effect(this.#failed_effect);
this.#failed_effect = null;
}
if (hydrating) {
set_hydrate_node(this.#hydrate_open);
next();
set_hydrate_node(skip_nodes());
}
var onerror = this.#props.onerror;
let failed = this.#props.failed;
var did_reset = false;
var calling_on_error = false;
const reset = () => {
if (did_reset) {
svelte_boundary_reset_noop();
return;
}
did_reset = true;
if (calling_on_error) svelte_boundary_reset_onerror();
if (this.#failed_effect !== null) pause_effect(this.#failed_effect, () => {
this.#failed_effect = null;
});
this.#run(() => {
this.#render();
});
};
const handle_error_result = (transformed_error) => {
try {
calling_on_error = true;
onerror?.(transformed_error, reset);
calling_on_error = false;
} catch (error) {
invoke_error_boundary(error, this.#effect && this.#effect.parent);
}
if (failed) this.#failed_effect = this.#run(() => {
try {
return branch(() => {
var effect = active_effect;
effect.b = this;
effect.f |= 128;
failed(this.#anchor, () => transformed_error, () => reset);
});
} catch (error) {
invoke_error_boundary(error, this.#effect.parent);
return null;
}
});
};
queue_micro_task(() => {
var result;
try {
result = this.transform_error(error);
} catch (e) {
invoke_error_boundary(e, this.#effect && this.#effect.parent);
return;
}
if (result !== null && typeof result === "object" && typeof result.then === "function") result.then(handle_error_result, (e) => invoke_error_boundary(e, this.#effect && this.#effect.parent));
else handle_error_result(result);
});
}
};
function flatten(blockers, sync, async, fn) {
const d = is_runes() ? derived : derived_safe_equal;
var pending = blockers.filter((b) => !b.settled);
if (async.length === 0 && pending.length === 0) {
fn(sync.map(d));
return;
}
var parent = active_effect;
var restore = capture();
var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
function finish(values) {
if ((parent.f & 16384) !== 0) return;
restore();
try {
fn(values);
} catch (error) {
invoke_error_boundary(error, parent);
}
unset_context();
}
var decrement_pending = increment_pending();
if (async.length === 0) {
blocker_promise.then(() => finish(sync.map(d))).finally(decrement_pending);
return;
}
function run() {
Promise.all(async.map((expression) => async_derived(expression))).then((result) => finish([...sync.map(d), ...result])).catch((error) => invoke_error_boundary(error, parent)).finally(decrement_pending);
}
if (blocker_promise) blocker_promise.then(() => {
restore();
run();
unset_context();
});
else run();
}
function capture() {
var previous_effect = active_effect;
var previous_reaction = active_reaction;
var previous_component_context = component_context;
var previous_batch = current_batch;
return function restore(activate_batch = true) {
set_active_effect(previous_effect);
set_active_reaction(previous_reaction);
set_component_context(previous_component_context);
if (activate_batch && (previous_effect.f & 16384) === 0) {
previous_batch?.activate();
previous_batch?.apply();
}
};
}
function unset_context(deactivate_batch = true) {
set_active_effect(null);
set_active_reaction(null);
set_component_context(null);
if (deactivate_batch) current_batch?.deactivate();
}
function increment_pending() {
var effect = active_effect;
var boundary = effect.b;
var batch = current_batch;
var blocking = boundary.is_rendered();
boundary.update_pending_count(1, batch);
batch.increment(blocking, effect);
return () => {
boundary.update_pending_count(-1, batch);
batch.decrement(blocking, effect);
};
}
function derived(fn) {
var flags = 2 | DIRTY;
if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED;
return {
ctx: component_context,
deps: null,
effects: null,
equals,
f: flags,
fn,
reactions: null,
rv: 0,
v: UNINITIALIZED,
wv: 0,
parent: active_effect,
ac: null
};
}
var OBSOLETE = Symbol("obsolete");
function async_derived(fn, label, location) {
let parent = active_effect;
if (parent === null) async_derived_orphan();
var promise = void 0;
var signal = source(UNINITIALIZED);
var should_suspend = !active_reaction;
var deferreds = new Set();
async_effect(() => {
var effect = active_effect;
var d = deferred();
promise = d.promise;
try {
Promise.resolve(fn()).then(d.resolve, (e) => {
if (e !== STALE_REACTION) d.reject(e);
}).finally(unset_context);
} catch (error) {
d.reject(error);
unset_context();
}
var batch = current_batch;
if (should_suspend) {
if ((effect.f & 32768) !== 0) var decrement_pending = increment_pending();
if (parent.b.is_rendered()) batch.async_deriveds.get(effect)?.reject(OBSOLETE);
else for (const d of deferreds.values()) d.reject(OBSOLETE);
deferreds.add(d);
batch.async_deriveds.set(effect, d);
}
const handler = (value, error = void 0) => {
decrement_pending?.();
deferreds.delete(d);
if (error === OBSOLETE) return;
batch.activate();
if (error) {
signal.f |= ERROR_VALUE;
internal_set(signal, error);
} else {
if ((signal.f & 8388608) !== 0) signal.f ^= ERROR_VALUE;
internal_set(signal, value);
}
batch.deactivate();
};
d.promise.then(handler, (e) => handler(null, e || "unknown"));
});
teardown(() => {
for (const d of deferreds) d.reject(OBSOLETE);
});
return new Promise((fulfil) => {
function next(p) {
function go() {
if (p === promise) fulfil(signal);
else next(promise);
}
p.then(go, go);
}
next(promise);
});
}
function user_derived(fn) {
const d = derived(fn);
if (!async_mode_flag) push_reaction_value(d);
return d;
}
function derived_safe_equal(fn) {
const signal = derived(fn);
signal.equals = safe_equals;
return signal;
}
function destroy_derived_effects(derived) {
var effects = derived.effects;
if (effects !== null) {
derived.effects = null;
for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
}
}
function execute_derived(derived) {
var value;
var prev_active_effect = active_effect;
var parent = derived.parent;
if (!is_destroying_effect && parent !== null && derived.v !== UNINITIALIZED && (parent.f & 24576) !== 0) {
derived_inert();
return derived.v;
}
set_active_effect(parent);
try {
derived.f &= ~WAS_MARKED;
destroy_derived_effects(derived);
value = update_reaction(derived);
} finally {
set_active_effect(prev_active_effect);
}
return value;
}
function update_derived(derived) {
var value = execute_derived(derived);
if (!derived.equals(value)) {
derived.wv = increment_write_version();
if (!current_batch?.is_fork || derived.deps === null) {
if (current_batch !== null) {
current_batch.capture(derived, value, true);
previous_batch?.capture(derived, value, true);
} else derived.v = value;
if (derived.deps === null) {
set_signal_status(derived, CLEAN);
return;
}
}
}
if (is_destroying_effect) return;
if (batch_values !== null) {
if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
} else update_derived_status(derived);
}
function freeze_derived_effects(derived) {
if (derived.effects === null) return;
for (const e of derived.effects) if (e.teardown || e.ac) {
e.teardown?.();
e.ac?.abort(STALE_REACTION);
if (e.fn !== null) e.teardown = noop;
e.ac = null;
remove_reactions(e, 0);
destroy_effect_children(e);
}
}
function unfreeze_derived_effects(derived) {
if (derived.effects === null) return;
for (const e of derived.effects) if (e.teardown && e.fn !== null) update_effect(e);
}
var eager_effects = new Set();
var old_values = new Map();
var eager_effects_deferred = false;
function source(v, stack) {
return {
f: 0,
v,
reactions: null,
equals,
rv: 0,
wv: 0
};
}
function state(v, stack) {
const s = source(v, stack);
push_reaction_value(s);
return s;
}
function mutable_source(initial_value, immutable = false, trackable = true) {
const s = source(initial_value);
if (!immutable) s.equals = safe_equals;
if (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) (component_context.l.s ??= []).push(s);
return s;
}
function set(source, value, should_proxy = false) {
if (active_reaction !== null && (!untracking || (active_reaction.f & 131072) !== 0) && is_runes() && (active_reaction.f & 4325394) !== 0 && (current_sources === null || !includes.call(current_sources, source))) state_unsafe_mutation();
return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates);
}
function internal_set(source, value, updated_during_traversal = null) {
if (!source.equals(value)) {
old_values.set(source, is_destroying_effect ? value : source.v);
var batch = Batch.ensure();
batch.capture(source, value);
if ((source.f & 2) !== 0) {
const derived = source;
if ((source.f & 2048) !== 0) execute_derived(derived);
if (batch_values === null) update_derived_status(derived);
}
source.wv = increment_write_version();
mark_reactions(source, DIRTY, updated_during_traversal);
if (is_runes() && active_effect !== null && (active_effect.f & 1024) !== 0 && (active_effect.f & 96) === 0) if (untracked_writes === null) set_untracked_writes([source]);
else untracked_writes.push(source);
if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) flush_eager_effects();
}
return value;
}
function flush_eager_effects() {
eager_effects_deferred = false;
for (const effect of eager_effects) {
if ((effect.f & 1024) !== 0) set_signal_status(effect, MAYBE_DIRTY);
let dirty;
try {
dirty = is_dirty(effect);
} catch {
dirty = true;
}
if (dirty) update_effect(effect);
}
eager_effects.clear();
}
function increment(source) {
set(source, source.v + 1);
}
function mark_reactions(signal, status, updated_during_traversal) {
var reactions = signal.reactions;
if (reactions === null) return;
var runes = is_runes();
var length = reactions.length;
for (var i = 0; i < length; i++) {
var reaction = reactions[i];
var flags = reaction.f;
if (!runes && reaction === active_effect) continue;
var not_dirty = (flags & DIRTY) === 0;
if (not_dirty) set_signal_status(reaction, status);
if ((flags & 131072) !== 0) eager_effects.add(reaction);
else if ((flags & 2) !== 0) {
var derived = reaction;
batch_values?.delete(derived);
if ((flags & 65536) === 0) {
if (flags & 512 && (active_effect === null || (active_effect.f & 2097152) === 0)) reaction.f |= WAS_MARKED;
mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);
}
} else if (not_dirty) {
var effect = reaction;
if ((flags & 16) !== 0 && eager_block_effects !== null) eager_block_effects.add(effect);
if (updated_during_traversal !== null) updated_during_traversal.push(effect);
else schedule_effect(effect);
}
}
}
function proxy(value) {
if (typeof value !== "object" || value === null || STATE_SYMBOL in value) return value;
const prototype = get_prototype_of(value);
if (prototype !== object_prototype && prototype !== array_prototype) return value;
var sources = new Map();
var is_proxied_array = is_array(value);
var version = state(0);
var stack = null;
var parent_version = update_version;
var with_parent = (fn) => {
if (update_version === parent_version) return fn();
var reaction = active_reaction;
var version = update_version;
set_active_reaction(null);
set_update_version(parent_version);
var result = fn();
set_active_reaction(reaction);
set_update_version(version);
return result;
};
if (is_proxied_array) sources.set("length", state(value.length, stack));
return new Proxy(value, {
defineProperty(_, prop, descriptor) {
if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) state_descriptors_fixed();
var s = sources.get(prop);
if (s === void 0) with_parent(() => {
var s = state(descriptor.value, stack);
sources.set(prop, s);
return s;
});
else set(s, descriptor.value, true);
return true;
},
deleteProperty(target, prop) {
var s = sources.get(prop);
if (s === void 0) {
if (prop in target) {
const s = with_parent(() => state(UNINITIALIZED, stack));
sources.set(prop, s);
increment(version);
}
} else {
set(s, UNINITIALIZED);
increment(version);
}
return true;
},
get(target, prop, receiver) {
if (prop === STATE_SYMBOL) return value;
var s = sources.get(prop);
var exists = prop in target;
if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) {
s = with_parent(() => {
return state(proxy(exists ? target[prop] : UNINITIALIZED), stack);
});
sources.set(prop, s);
}
if (s !== void 0) {
var v = get(s);
return v === UNINITIALIZED ? void 0 : v;
}
return Reflect.get(target, prop, receiver);
},
getOwnPropertyDescriptor(target, prop) {
var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
if (descriptor && "value" in descriptor) {
var s = sources.get(prop);
if (s) descriptor.value = get(s);
} else if (descriptor === void 0) {
var source = sources.get(prop);
var value = source?.v;
if (source !== void 0 && value !== UNINITIALIZED) return {
enumerable: true,
configurable: true,
value,
writable: true
};
}
return descriptor;
},
has(target, prop) {
if (prop === STATE_SYMBOL) return true;
var s = sources.get(prop);
var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop);
if (s !== void 0 || active_effect !== null && (!has || get_descriptor(target, prop)?.writable)) {
if (s === void 0) {
s = with_parent(() => {
return state(has ? proxy(target[prop]) : UNINITIALIZED, stack);
});
sources.set(prop, s);
}
if (get(s) === UNINITIALIZED) return false;
}
return has;
},
set(target, prop, value, receiver) {
var s = sources.get(prop);
var has = prop in target;
if (is_proxied_array && prop === "length") for (var i = value; i < s.v; i += 1) {
var other_s = sources.get(i + "");
if (other_s !== void 0) set(other_s, UNINITIALIZED);
else if (i in target) {
other_s = with_parent(() => state(UNINITIALIZED, stack));
sources.set(i + "", other_s);
}
}
if (s === void 0) {
if (!has || get_descriptor(target, prop)?.writable) {
s = with_parent(() => state(void 0, stack));
set(s, proxy(value));
sources.set(prop, s);
}
} else {
has = s.v !== UNINITIALIZED;
var p = with_parent(() => proxy(value));
set(s, p);
}
var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
if (descriptor?.set) descriptor.set.call(receiver, value);
if (!has) {
if (is_proxied_array && typeof prop === "string") {
var ls = sources.get("length");
var n = Number(prop);
if (Number.isInteger(n) && n >= ls.v) set(ls, n + 1);
}
increment(version);
}
return true;
},
ownKeys(target) {
get(version);
var own_keys = Reflect.ownKeys(target).filter((key) => {
var source = sources.get(key);
return source === void 0 || source.v !== UNINITIALIZED;
});
for (var [key, source] of sources) if (source.v !== UNINITIALIZED && !(key in target)) own_keys.push(key);
return own_keys;
},
setPrototypeOf() {
state_prototype_fixed();
}
});
}
function get_proxied_value(value) {
try {
if (value !== null && typeof value === "object" && STATE_SYMBOL in value) return value[STATE_SYMBOL];
} catch {}
return value;
}
function is(a, b) {
return Object.is(get_proxied_value(a), get_proxied_value(b));
}
var $window;
var is_firefox;
var first_child_getter;
var next_sibling_getter;
function init_operations() {
if ($window !== void 0) return;
$window = window;
is_firefox = /Firefox/.test(navigator.userAgent);
var element_prototype = Element.prototype;
var node_prototype = Node.prototype;
var text_prototype = Text.prototype;
first_child_getter = get_descriptor(node_prototype, "firstChild").get;
next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
if (is_extensible(element_prototype)) {
element_prototype[CLASS_CACHE] = void 0;
element_prototype[ATTRIBUTES_CACHE] = null;
element_prototype[STYLE_CACHE] = void 0;
element_prototype.__e = void 0;
}
if (is_extensible(text_prototype)) text_prototype[TEXT_CACHE] = void 0;
}
function create_text(value = "") {
return document.createTextNode(value);
}
function get_first_child(node) {
return first_child_getter.call(node);
}
function get_next_sibling(node) {
return next_sibling_getter.call(node);
}
function child(node, is_text) {
if (!hydrating) return get_first_child(node);
var child = get_first_child(hydrate_node);
if (child === null) child = hydrate_node.appendChild(create_text());
else if (is_text && child.nodeType !== 3) {
var text = create_text();
child?.before(text);
set_hydrate_node(text);
return text;
}
if (is_text) merge_text_nodes(child);
set_hydrate_node(child);
return child;
}
function first_child(node, is_text = false) {
if (!hydrating) {
var first = get_first_child(node);
if (first instanceof Comment && first.data === "") return get_next_sibling(first);
return first;
}
if (is_text) {
if (hydrate_node?.nodeType !== 3) {
var text = create_text();
hydrate_node?.before(text);
set_hydrate_node(text);
return text;
}
merge_text_nodes(hydrate_node);
}
return hydrate_node;
}
function sibling(node, count = 1, is_text = false) {
let next_sibling = hydrating ? hydrate_node : node;
var last_sibling;
while (count--) {
last_sibling = next_sibling;
next_sibling = get_next_sibling(next_sibling);
}
if (!hydrating) return next_sibling;
if (is_text) {
if (next_sibling?.nodeType !== 3) {
var text = create_text();
if (next_sibling === null) last_sibling?.after(text);
else next_sibling.before(text);
set_hydrate_node(text);
return text;
}
merge_text_nodes(next_sibling);
}
set_hydrate_node(next_sibling);
return next_sibling;
}
function clear_text_content(node) {
node.textContent = "";
}
function should_defer_append() {
if (!async_mode_flag) return false;
if (eager_block_effects !== null) return false;
return (active_effect.f & REACTION_RAN) !== 0;
}
function create_element(tag, namespace, is) {
let options = is ? { is } : void 0;
return document.createElementNS(namespace ?? "http://www.w3.org/1999/xhtml", tag, options);
}
function merge_text_nodes(text) {
if (text.nodeValue.length < 65536) return;
let next = text.nextSibling;
while (next !== null && next.nodeType === 3) {
next.remove();
text.nodeValue += next.nodeValue;
next = text.nextSibling;
}
}
var listening_to_form_reset = false;
function add_form_reset_listener() {
if (!listening_to_form_reset) {
listening_to_form_reset = true;
document.addEventListener("reset", (evt) => {
Promise.resolve().then(() => {
if (!evt.defaultPrevented) for (const e of evt.target.elements) e[FORM_RESET_HANDLER]?.();
});
}, { capture: true });
}
}
function without_reactive_context(fn) {
var previous_reaction = active_reaction;
var previous_effect = active_effect;
set_active_reaction(null);
set_active_effect(null);
try {
return fn();
} finally {
set_active_reaction(previous_reaction);
set_active_effect(previous_effect);
}
}
function listen_to_event_and_reset_event(element, event, handler, on_reset = handler) {
element.addEventListener(event, () => without_reactive_context(handler));
const prev = element[FORM_RESET_HANDLER];
if (prev) element[FORM_RESET_HANDLER] = () => {
prev();
on_reset(true);
};
else element[FORM_RESET_HANDLER] = () => on_reset(true);
add_form_reset_listener();
}
function validate_effect(rune) {
if (active_effect === null) {
if (active_reaction === null) effect_orphan(rune);
effect_in_unowned_derived();
}
if (is_destroying_effect) effect_in_teardown(rune);
}
function push_effect(effect, parent_effect) {
var parent_last = parent_effect.last;
if (parent_last === null) parent_effect.last = parent_effect.first = effect;
else {
parent_last.next = effect;
effect.prev = parent_last;
parent_effect.last = effect;
}
}
function create_effect(type, fn) {
var parent = active_effect;
if (parent !== null && (parent.f & 8192) !== 0) type |= INERT;
var effect = {
ctx: component_context,
deps: null,
nodes: null,
f: type | DIRTY | 512,
first: null,
fn,
last: null,
next: null,
parent,
b: parent && parent.b,
prev: null,
teardown: null,
wv: 0,
ac: null
};
current_batch?.register_created_effect(effect);
var e = effect;
if ((type & 4) !== 0) if (collected_effects !== null) collected_effects.push(effect);
else Batch.ensure().schedule(effect);
else if (fn !== null) {
try {
update_effect(effect);
} catch (e) {
destroy_effect(effect);
throw e;
}
if (e.deps === null && e.teardown === null && e.nodes === null && e.first === e.last && (e.f & 524288) === 0) {
e = e.first;
if ((type & 16) !== 0 && (type & 65536) !== 0 && e !== null) e.f |= EFFECT_TRANSPARENT;
}
}
if (e !== null) {
e.parent = parent;
if (parent !== null) push_effect(e, parent);
if (active_reaction !== null && (active_reaction.f & 2) !== 0 && (type & 64) === 0) {
var derived = active_reaction;
(derived.effects ??= []).push(e);
}
}
return effect;
}
function effect_tracking() {
return active_reaction !== null && !untracking;
}
function teardown(fn) {
const effect = create_effect(8, null);
set_signal_status(effect, CLEAN);
effect.teardown = fn;
return effect;
}
function user_effect(fn) {
validate_effect("$effect");
var flags = active_effect.f;
if (!active_reaction && (flags & 32) !== 0 && (flags & 32768) === 0) {
var context = component_context;
(context.e ??= []).push(fn);
} else return create_user_effect(fn);
}
function create_user_effect(fn) {
return create_effect(4 | USER_EFFECT, fn);
}
function component_root(fn) {
Batch.ensure();
const effect = create_effect(64 | EFFECT_PRESERVED, fn);
return (options = {}) => {
return new Promise((fulfil) => {
if (options.outro) pause_effect(effect, () => {
destroy_effect(effect);
fulfil(void 0);
});
else {
destroy_effect(effect);
fulfil(void 0);
}
});
};
}
function effect(fn) {
return create_effect(4, fn);
}
function async_effect(fn) {
return create_effect(ASYNC | EFFECT_PRESERVED, fn);
}
function render_effect(fn, flags = 0) {
return create_effect(8 | flags, fn);
}
function template_effect(fn, sync = [], async = [], blockers = []) {
flatten(blockers, sync, async, (values) => {
create_effect(8, () => fn(...values.map(get)));
});
}
function block(fn, flags = 0) {
return create_effect(16 | flags, fn);
}
function branch(fn) {
return create_effect(32 | EFFECT_PRESERVED, fn);
}
function execute_effect_teardown(effect) {
var teardown = effect.teardown;
if (teardown !== null) {
const previously_destroying_effect = is_destroying_effect;
const previous_reaction = active_reaction;
set_is_destroying_effect(true);
set_active_reaction(null);
try {
teardown.call(null);
} finally {
set_is_destroying_effect(previously_destroying_effect);
set_active_reaction(previous_reaction);
}
}
}
function destroy_effect_children(signal, remove_dom = false) {
var effect = signal.first;
signal.first = signal.last = null;
while (effect !== null) {
const controller = effect.ac;
if (controller !== null) without_reactive_context(() => {
controller.abort(STALE_REACTION);
});
var next = effect.next;
if ((effect.f & 64) !== 0) effect.parent = null;
else destroy_effect(effect, remove_dom);
effect = next;
}
}
function destroy_block_effect_children(signal) {
var effect = signal.first;
while (effect !== null) {
var next = effect.next;
if ((effect.f & 32) === 0) destroy_effect(effect);
effect = next;
}
}
function destroy_effect(effect, remove_dom = true) {
var removed = false;
if ((remove_dom || (effect.f & 262144) !== 0) && effect.nodes !== null && effect.nodes.end !== null) {
remove_effect_dom(effect.nodes.start, effect.nodes.end);
removed = true;
}
set_signal_status(effect, DESTROYING);
destroy_effect_children(effect, remove_dom && !removed);
remove_reactions(effect, 0);
var transitions = effect.nodes && effect.nodes.t;
if (transitions !== null) for (const transition of transitions) transition.stop();
execute_effect_teardown(effect);
effect.f ^= DESTROYING;
effect.f |= DESTROYED;
var parent = effect.parent;
if (parent !== null && parent.first !== null) unlink_effect(effect);
effect.next = effect.prev = effect.teardown = effect.ctx = effect.deps = effect.fn = effect.nodes = effect.ac = effect.b = null;
}
function remove_effect_dom(node, end) {
while (node !== null) {
var next = node === end ? null : get_next_sibling(node);
node.remove();
node = next;
}
}
function unlink_effect(effect) {
var parent = effect.parent;
var prev = effect.prev;
var next = effect.next;
if (prev !== null) prev.next = next;
if (next !== null) next.prev = prev;
if (parent !== null) {
if (parent.first === effect) parent.first = next;
if (parent.last === effect) parent.last = prev;
}
}
function pause_effect(effect, callback, destroy = true) {
var transitions = [];
pause_children(effect, transitions, true);
var fn = () => {
if (destroy) destroy_effect(effect);
if (callback) callback();
};
var remaining = transitions.length;
if (remaining > 0) {
var check = () => --remaining || fn();
for (var transition of transitions) transition.out(check);
} else fn();
}
function pause_children(effect, transitions, local) {
if ((effect.f & 8192) !== 0) return;
effect.f ^= INERT;
var t = effect.nodes && effect.nodes.t;
if (t !== null) {
for (const transition of t) if (transition.is_global || local) transitions.push(transition);
}
var child = effect.first;
while (child !== null) {
var sibling = child.next;
if ((child.f & 64) === 0) {
var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0 && (effect.f & 16) !== 0;
pause_children(child, transitions, transparent ? local : false);
}
child = sibling;
}
}
function resume_effect(effect) {
resume_children(effect, true);
}
function resume_children(effect, local) {
if ((effect.f & 8192) === 0) return;
effect.f ^= INERT;
if ((effect.f & 1024) === 0) {
set_signal_status(effect, DIRTY);
Batch.ensure().schedule(effect);
}
var child = effect.first;
while (child !== null) {
var sibling = child.next;
var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0;
resume_children(child, transparent ? local : false);
child = sibling;
}
var t = effect.nodes && effect.nodes.t;
if (t !== null) {
for (const transition of t) if (transition.is_global || local) transition.in();
}
}
function move_effect(effect, fragment) {
if (!effect.nodes) return;
var node = effect.nodes.start;
var end = effect.nodes.end;
while (node !== null) {
var next = node === end ? null : get_next_sibling(node);
fragment.append(node);
node = next;
}
}
var captured_signals = null;
var is_updating_effect = false;
var is_destroying_effect = false;
function set_is_destroying_effect(value) {
is_destroying_effect = value;
}
var active_reaction = null;
var untracking = false;
function set_active_reaction(reaction) {
active_reaction = reaction;
}
var active_effect = null;
function set_active_effect(effect) {
active_effect = effect;
}
var current_sources = null;
function push_reaction_value(value) {
if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) if (current_sources === null) current_sources = [value];
else current_sources.push(value);
}
var new_deps = null;
var skipped_deps = 0;
var untracked_writes = null;
function set_untracked_writes(value) {
untracked_writes = value;
}
var write_version = 1;
var read_version = 0;
var update_version = read_version;
function set_update_version(value) {
update_version = value;
}
function increment_write_version() {
return ++write_version;
}
function is_dirty(reaction) {
var flags = reaction.f;
if ((flags & 2048) !== 0) return true;
if (flags & 2) reaction.f &= ~WAS_MARKED;
if ((flags & 4096) !== 0) {
var dependencies = reaction.deps;
var length = dependencies.length;
for (var i = 0; i < length; i++) {
var dependency = dependencies[i];
if (is_dirty(dependency)) update_derived(dependency);
if (dependency.wv > reaction.wv) return true;
}
if ((flags & 512) !== 0 && batch_values === null) set_signal_status(reaction, CLEAN);
}
return false;
}
function schedule_possible_effect_self_invalidation(signal, effect, root = true) {
var reactions = signal.reactions;
if (reactions === null) return;
if (!async_mode_flag && current_sources !== null && includes.call(current_sources, signal)) return;
for (var i = 0; i < reactions.length; i++) {
var reaction = reactions[i];
if ((reaction.f & 2) !== 0) schedule_possible_effect_self_invalidation(reaction, effect, false);
else if (effect === reaction) {
if (root) set_signal_status(reaction, DIRTY);
else if ((reaction.f & 1024) !== 0) set_signal_status(reaction, MAYBE_DIRTY);
schedule_effect(reaction);
}
}
}
function update_reaction(reaction) {
var previous_deps = new_deps;
var previous_skipped_deps = skipped_deps;
var previous_untracked_writes = untracked_writes;
var previous_reaction = active_reaction;
var previous_sources = current_sources;
var previous_component_context = component_context;
var previous_untracking = untracking;
var previous_update_version = update_version;
var flags = reaction.f;
new_deps = null;
skipped_deps = 0;
untracked_writes = null;
active_reaction = (flags & 96) === 0 ? reaction : null;
current_sources = null;
set_component_context(reaction.ctx);
untracking = false;
update_version = ++read_version;
if (reaction.ac !== null) {
without_reactive_context(() => {
reaction.ac.abort(STALE_REACTION);
});
reaction.ac = null;
}
try {
reaction.f |= REACTION_IS_UPDATING;
var fn = reaction.fn;
var result = fn();
reaction.f |= REACTION_RAN;
var deps = reaction.deps;
var is_fork = current_batch?.is_fork;
if (new_deps !== null) {
var i;
if (!is_fork) remove_reactions(reaction, skipped_deps);
if (deps !== null && skipped_deps > 0) {
deps.length = skipped_deps + new_deps.length;
for (i = 0; i < new_deps.length; i++) deps[skipped_deps + i] = new_deps[i];
} else reaction.deps = deps = new_deps;
if (effect_tracking() && (reaction.f & 512) !== 0) for (i = skipped_deps; i < deps.length; i++) (deps[i].reactions ??= []).push(reaction);
} else if (!is_fork && deps !== null && skipped_deps < deps.length) {
remove_reactions(reaction, skipped_deps);
deps.length = skipped_deps;
}
if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & 6146) === 0) for (i = 0; i < untracked_writes.length; i++) schedule_possible_effect_self_invalidation(untracked_writes[i], reaction);
if (previous_reaction !== null && previous_reaction !== reaction) {
read_version++;
if (previous_reaction.deps !== null) for (let i = 0; i < previous_skipped_deps; i += 1) previous_reaction.deps[i].rv = read_version;
if (previous_deps !== null) for (const dep of previous_deps) dep.rv = read_version;
if (untracked_writes !== null) if (previous_untracked_writes === null) previous_untracked_writes = untracked_writes;
else previous_untracked_writes.push(...untracked_writes);
}
if ((reaction.f & 8388608) !== 0) reaction.f ^= ERROR_VALUE;
return result;
} catch (error) {
return handle_error(error);
} finally {
reaction.f ^= REACTION_IS_UPDATING;
new_deps = previous_deps;
skipped_deps = previous_skipped_deps;
untracked_writes = previous_untracked_writes;
active_reaction = previous_reaction;
current_sources = previous_sources;
set_component_context(previous_component_context);
untracking = previous_untracking;
update_version = previous_update_version;
}
}
function remove_reaction(signal, dependency) {
let reactions = dependency.reactions;
if (reactions !== null) {
var index = index_of.call(reactions, signal);
if (index !== -1) {
var new_length = reactions.length - 1;
if (new_length === 0) reactions = dependency.reactions = null;
else {
reactions[index] = reactions[new_length];
reactions.pop();
}
}
}
if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) {
var derived = dependency;
if ((derived.f & 512) !== 0) {
derived.f ^= 512;
derived.f &= ~WAS_MARKED;
}
if (derived.v !== UNINITIALIZED) update_derived_status(derived);
freeze_derived_effects(derived);
remove_reactions(derived, 0);
}
}
function remove_reactions(signal, start_index) {
var dependencies = signal.deps;
if (dependencies === null) return;
for (var i = start_index; i < dependencies.length; i++) remove_reaction(signal, dependencies[i]);
}
function update_effect(effect) {
var flags = effect.f;
if ((flags & 16384) !== 0) return;
set_signal_status(effect, CLEAN);
var previous_effect = active_effect;
var was_updating_effect = is_updating_effect;
active_effect = effect;
is_updating_effect = true;
try {
if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
else destroy_effect_children(effect);
execute_effect_teardown(effect);
var teardown = update_reaction(effect);
effect.teardown = typeof teardown === "function" ? teardown : null;
effect.wv = write_version;
} finally {
is_updating_effect = was_updating_effect;
active_effect = previous_effect;
}
}
async function tick() {
if (async_mode_flag) return new Promise((f) => {
requestAnimationFrame(() => f());
setTimeout(() => f());
});
await Promise.resolve();
flushSync();
}
function get(signal) {
var is_derived = (signal.f & 2) !== 0;
captured_signals?.add(signal);
if (active_reaction !== null && !untracking) {
if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !includes.call(current_sources, signal))) {
var deps = active_reaction.deps;
if ((active_reaction.f & 2097152) !== 0) {
if (signal.rv < read_version) {
signal.rv = read_version;
if (new_deps === null && deps !== null && deps[skipped_deps] === signal) skipped_deps++;
else if (new_deps === null) new_deps = [signal];
else new_deps.push(signal);
}
} else {
active_reaction.deps ??= [];
if (!includes.call(active_reaction.deps, signal)) active_reaction.deps.push(signal);
var reactions = signal.reactions;
if (reactions === null) signal.reactions = [active_reaction];
else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction);
}
}
}
if (is_destroying_effect && old_values.has(signal)) return old_values.get(signal);
if (is_derived) {
var derived = signal;
if (is_destroying_effect) {
var value = derived.v;
if ((derived.f & 1024) === 0 && derived.reactions !== null || depends_on_old_values(derived)) value = execute_derived(derived);
old_values.set(derived, value);
return value;
}
var should_connect = (derived.f & 512) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & 512) !== 0);
var is_new = (derived.f & REACTION_RAN) === 0;
if (is_dirty(derived)) {
if (should_connect) derived.f |= 512;
update_derived(derived);
}
if (should_connect && !is_new) {
unfreeze_derived_effects(derived);
reconnect(derived);
}
}
if (batch_values?.has(signal)) return batch_values.get(signal);
if ((signal.f & 8388608) !== 0) throw signal.v;
return signal.v;
}
function reconnect(derived) {
derived.f |= 512;
if (derived.deps === null) return;
for (const dep of derived.deps) {
(dep.reactions ??= []).push(derived);
if ((dep.f & 2) !== 0 && (dep.f & 512) === 0) {
unfreeze_derived_effects(dep);
reconnect(dep);
}
}
}
function depends_on_old_values(derived) {
if (derived.v === UNINITIALIZED) return true;
if (derived.deps === null) return false;
for (const dep of derived.deps) {
if (old_values.has(dep)) return true;
if ((dep.f & 2) !== 0 && depends_on_old_values(dep)) return true;
}
return false;
}
function untrack(fn) {
var previous_untracking = untracking;
try {
untracking = true;
return fn();
} finally {
untracking = previous_untracking;
}
}
var PASSIVE_EVENTS = ["touchstart", "touchmove"];
function is_passive_event(name) {
return PASSIVE_EVENTS.includes(name);
}
var event_symbol = Symbol("events");
var all_registered_events = new Set();
var root_event_handles = new Set();
function create_event(event_name, dom, handler, options = {}) {
function target_handler(event) {
if (!options.capture) handle_event_propagation.call(dom, event);
if (!event.cancelBubble) return without_reactive_context(() => {
return handler?.call(this, event);
});
}
if (event_name.startsWith("pointer") || event_name.startsWith("touch") || event_name === "wheel") queue_micro_task(() => {
dom.addEventListener(event_name, target_handler, options);
});
else dom.addEventListener(event_name, target_handler, options);
return target_handler;
}
function event(event_name, dom, handler, capture, passive) {
var options = {
capture,
passive
};
var target_handler = create_event(event_name, dom, handler, options);
if (dom === document.body || dom === window || dom === document || dom instanceof HTMLMediaElement) teardown(() => {
dom.removeEventListener(event_name, target_handler, options);
});
}
function delegated(event_name, element, handler) {
(element[event_symbol] ??= {})[event_name] = handler;
}
function delegate(events) {
for (var i = 0; i < events.length; i++) all_registered_events.add(events[i]);
for (var fn of root_event_handles) fn(events);
}
var last_propagated_event = null;
function handle_event_propagation(event) {
var handler_element = this;
var owner_document = handler_element.ownerDocument;
var event_name = event.type;
var path = event.composedPath?.() || [];
var current_target = path[0] || event.target;
last_propagated_event = event;
var path_idx = 0;
var handled_at = last_propagated_event === event && event[event_symbol];
if (handled_at) {
var at_idx = path.indexOf(handled_at);
if (at_idx !== -1 && (handler_element === document || handler_element === window)) {
event[event_symbol] = handler_element;
return;
}
var handler_idx = path.indexOf(handler_element);
if (handler_idx === -1) return;
if (at_idx <= handler_idx) path_idx = at_idx;
}
current_target = path[path_idx] || event.target;
if (current_target === handler_element) return;
define_property(event, "currentTarget", {
configurable: true,
get() {
return current_target || owner_document;
}
});
var previous_reaction = active_reaction;
var previous_effect = active_effect;
set_active_reaction(null);
set_active_effect(null);
try {
var throw_error;
var other_errors = [];
while (current_target !== null) {
var parent_element = current_target.assignedSlot || current_target.parentNode || current_target.host || null;
try {
var delegated = current_target[event_symbol]?.[event_name];
if (delegated != null && (!current_target.disabled || event.target === current_target)) delegated.call(current_target, event);
} catch (error) {
if (throw_error) other_errors.push(error);
else throw_error = error;
}
if (event.cancelBubble || parent_element === handler_element || parent_element === null) break;
current_target = parent_element;
}
if (throw_error) {
for (let error of other_errors) queueMicrotask(() => {
throw error;
});
throw throw_error;
}
} finally {
event[event_symbol] = handler_element;
delete event.currentTarget;
set_active_reaction(previous_reaction);
set_active_effect(previous_effect);
}
}
var policy = globalThis?.window?.trustedTypes && globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", { createHTML: (html) => {
return html;
} });
function create_trusted_html(html) {
return policy?.createHTML(html) ?? html;
}
function create_fragment_from_html(html) {
var elem = create_element("template");
elem.innerHTML = create_trusted_html(html.replaceAll("<!>", "<!---->"));
return elem.content;
}
function assign_nodes(start, end) {
var effect = active_effect;
if (effect.nodes === null) effect.nodes = {
start,
end,
a: null,
t: null
};
}
function from_html(content, flags) {
var is_fragment = (flags & 1) !== 0;
var use_import_node = (flags & 2) !== 0;
var node;
var has_start = !content.startsWith("<!>");
return () => {
if (hydrating) {
assign_nodes(hydrate_node, null);
return hydrate_node;
}
if (node === void 0) {
node = create_fragment_from_html(has_start ? content : "<!>" + content);
if (!is_fragment) node = get_first_child(node);
}
var clone = use_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true);
if (is_fragment) {
var start = get_first_child(clone);
var end = clone.lastChild;
assign_nodes(start, end);
} else assign_nodes(clone, clone);
return clone;
};
}
function append(anchor, dom) {
if (hydrating) {
var effect = active_effect;
if ((effect.f & 32768) === 0 || effect.nodes.end === null) effect.nodes.end = hydrate_node;
hydrate_next();
return;
}
if (anchor === null) return;
anchor.before(dom);
}
function set_text(text, value) {
var str = value == null ? "" : typeof value === "object" ? `${value}` : value;
if (str !== (text[TEXT_CACHE] ??= text.nodeValue)) {
text[TEXT_CACHE] = str;
text.nodeValue = `${str}`;
}
}
function mount(component, options) {
return _mount(component, options);
}
var listeners = new Map();
function _mount(Component, { target, anchor, props = {}, events, context, intro = true, transformError }) {
init_operations();
var component = void 0;
var unmount = component_root(() => {
var anchor_node = anchor ?? target.appendChild(create_text());
boundary(anchor_node, { pending: () => {} }, (anchor_node) => {
push({});
var ctx = component_context;
if (context) ctx.c = context;
if (events) props.$$events = events;
if (hydrating) assign_nodes(anchor_node, null);
component = Component(anchor_node, props) || {};
if (hydrating) {
active_effect.nodes.end = hydrate_node;
if (hydrate_node === null || hydrate_node.nodeType !== 8 || hydrate_node.data !== "]") {
hydration_mismatch();
throw HYDRATION_ERROR;
}
}
pop();
}, transformError);
var registered_events = new Set();
var event_handle = (events) => {
for (var i = 0; i < events.length; i++) {
var event_name = events[i];
if (registered_events.has(event_name)) continue;
registered_events.add(event_name);
var passive = is_passive_event(event_name);
for (const node of [target, document]) {
var counts = listeners.get(node);
if (counts === void 0) {
counts = new Map();
listeners.set(node, counts);
}
var count = counts.get(event_name);
if (count === void 0) {
node.addEventListener(event_name, handle_event_propagation, { passive });
counts.set(event_name, 1);
} else counts.set(event_name, count + 1);
}
}
};
event_handle(array_from(all_registered_events));
root_event_handles.add(event_handle);
return () => {
for (var event_name of registered_events) for (const node of [target, document]) {
var counts = listeners.get(node);
var count = counts.get(event_name);
if (--count == 0) {
node.removeEventListener(event_name, handle_event_propagation);
counts.delete(event_name);
if (counts.size === 0) listeners.delete(node);
} else counts.set(event_name, count);
}
root_event_handles.delete(event_handle);
if (anchor_node !== anchor) anchor_node.parentNode?.removeChild(anchor_node);
};
});
mounted_components.set(component, unmount);
return component;
}
var mounted_components = new WeakMap();
var BranchManager = class {
anchor;
#batches = new Map();
#onscreen = new Map();
#offscreen = new Map();
#outroing = new Set();
#transition = true;
constructor(anchor, transition = true) {
this.anchor = anchor;
this.#transition = transition;
}
#commit = (batch) => {
if (!this.#batches.has(batch)) return;
var key = this.#batches.get(batch);
var onscreen = this.#onscreen.get(key);
if (onscreen) {
resume_effect(onscreen);
this.#outroing.delete(key);
} else {
var offscreen = this.#offscreen.get(key);
if (offscreen) {
this.#onscreen.set(key, offscreen.effect);
this.#offscreen.delete(key);
offscreen.fragment.lastChild.remove();
this.anchor.before(offscreen.fragment);
onscreen = offscreen.effect;
}
}
for (const [b, k] of this.#batches) {
this.#batches.delete(b);
if (b === batch) break;
const offscreen = this.#offscreen.get(k);
if (offscreen) {
destroy_effect(offscreen.effect);
this.#offscreen.delete(k);
}
}
for (const [k, effect] of this.#onscreen) {
if (k === key || this.#outroing.has(k)) continue;
const on_destroy = () => {
if (Array.from(this.#batches.values()).includes(k)) {
var fragment = document.createDocumentFragment();
move_effect(effect, fragment);
fragment.append(create_text());
this.#offscreen.set(k, {
effect,
fragment
});
} else destroy_effect(effect);
this.#outroing.delete(k);
this.#onscreen.delete(k);
};
if (this.#transition || !onscreen) {
this.#outroing.add(k);
pause_effect(effect, on_destroy, false);
} else on_destroy();
}
};
#discard = (batch) => {
this.#batches.delete(batch);
const keys = Array.from(this.#batches.values());
for (const [k, branch] of this.#offscreen) if (!keys.includes(k)) {
destroy_effect(branch.effect);
this.#offscreen.delete(k);
}
};
ensure(key, fn) {
var batch = current_batch;
var defer = should_defer_append();
if (fn && !this.#onscreen.has(key) && !this.#offscreen.has(key)) if (defer) {
var fragment = document.createDocumentFragment();
var target = create_text();
fragment.append(target);
this.#offscreen.set(key, {
effect: branch(() => fn(target)),
fragment
});
} else this.#onscreen.set(key, branch(() => fn(this.anchor)));
this.#batches.set(batch, key);
if (defer) {
for (const [k, effect] of this.#onscreen) if (k === key) batch.unskip_effect(effect);
else batch.skip_effect(effect);
for (const [k, branch] of this.#offscreen) if (k === key) batch.unskip_effect(branch.effect);
else batch.skip_effect(branch.effect);
batch.oncommit(this.#commit);
batch.ondiscard(this.#discard);
} else {
if (hydrating) this.anchor = hydrate_node;
this.#commit(batch);
}
}
};
function if_block(node, fn, elseif = false) {
var marker;
if (hydrating) {
marker = hydrate_node;
hydrate_next();
}
var branches = new BranchManager(node);
var flags = elseif ? EFFECT_TRANSPARENT : 0;
function update_branch(key, fn) {
if (hydrating) {
var data = read_hydration_instruction(marker);
if (key !== parseInt(data.substring(1))) {
var anchor = skip_nodes();
set_hydrate_node(anchor);
branches.anchor = anchor;
set_hydrating(false);
branches.ensure(key, fn);
set_hydrating(true);
return;
}
}
branches.ensure(key, fn);
}
block(() => {
var has_branch = false;
fn((fn, key = 0) => {
has_branch = true;
update_branch(key, fn);
});
if (!has_branch) update_branch(-1, null);
}, flags);
}
function pause_effects(state, to_destroy, controlled_anchor) {
var transitions = [];
var length = to_destroy.length;
var group;
var remaining = to_destroy.length;
for (var i = 0; i < length; i++) {
let effect = to_destroy[i];
pause_effect(effect, () => {
if (group) {
group.pending.delete(effect);
group.done.add(effect);
if (group.pending.size === 0) {
var groups = state.outrogroups;
destroy_effects(state, array_from(group.done));
groups.delete(group);
if (groups.size === 0) state.outrogroups = null;
}
} else remaining -= 1;
}, false);
}
if (remaining === 0) {
var fast_path = transitions.length === 0 && controlled_anchor !== null;
if (fast_path) {
var anchor = controlled_anchor;
var parent_node = anchor.parentNode;
clear_text_content(parent_node);
parent_node.append(anchor);
state.items.clear();
}
destroy_effects(state, to_destroy, !fast_path);
} else {
group = {
pending: new Set(to_destroy),
done: new Set()
};
(state.outrogroups ??= new Set()).add(group);
}
}
function destroy_effects(state, to_destroy, remove_dom = true) {
var preserved_effects;
if (state.pending.size > 0) {
preserved_effects = new Set();
for (const keys of state.pending.values()) for (const key of keys) preserved_effects.add(state.items.get(key).e);
}
for (var i = 0; i < to_destroy.length; i++) {
var e = to_destroy[i];
if (preserved_effects?.has(e)) {
e.f |= EFFECT_OFFSCREEN;
move_effect(e, document.createDocumentFragment());
} else destroy_effect(to_destroy[i], remove_dom);
}
}
var offscreen_anchor;
function each(node, flags, get_collection, get_key, render_fn, fallback_fn = null) {
var anchor = node;
var items = new Map();
if ((flags & 4) !== 0) {
var parent_node = node;
anchor = hydrating ? set_hydrate_node(get_first_child(parent_node)) : parent_node.appendChild(create_text());
}
if (hydrating) hydrate_next();
var fallback = null;
var each_array = derived_safe_equal(() => {
var collection = get_collection();
return is_array(collection) ? collection : collection == null ? [] : array_from(collection);
});
var array;
var pending = new Map();
var first_run = true;
function commit(batch) {
if ((state.effect.f & 16384) !== 0) return;
state.pending.delete(batch);
state.fallback = fallback;
reconcile(state, array, anchor, flags, get_key);
if (fallback !== null) if (array.length === 0) if ((fallback.f & 33554432) === 0) resume_effect(fallback);
else {
fallback.f ^= EFFECT_OFFSCREEN;
move(fallback, null, anchor);
}
else pause_effect(fallback, () => {
fallback = null;
});
}
function discard(batch) {
state.pending.delete(batch);
}
var state = {
effect: block(() => {
array = get(each_array);
var length = array.length;
let mismatch = false;
if (hydrating) {
if (read_hydration_instruction(anchor) === "[!" !== (length === 0)) {
anchor = skip_nodes();
set_hydrate_node(anchor);
set_hydrating(false);
mismatch = true;
}
}
var keys = new Set();
var batch = current_batch;
var defer = should_defer_append();
for (var index = 0; index < length; index += 1) {
if (hydrating && hydrate_node.nodeType === 8 && hydrate_node.data === "]") {
anchor = hydrate_node;
mismatch = true;
set_hydrating(false);
}
var value = array[index];
var key = get_key(value, index);
var item = first_run ? null : items.get(key);
if (item) {
if (item.v) internal_set(item.v, value);
if (item.i) internal_set(item.i, index);
if (defer) batch.unskip_effect(item.e);
} else {
item = create_item(items, first_run ? anchor : offscreen_anchor ??= create_text(), value, key, index, render_fn, flags, get_collection);
if (!first_run) item.e.f |= EFFECT_OFFSCREEN;
items.set(key, item);
}
keys.add(key);
}
if (length === 0 && fallback_fn && !fallback) if (first_run) fallback = branch(() => fallback_fn(anchor));
else {
fallback = branch(() => fallback_fn(offscreen_anchor ??= create_text()));
fallback.f |= EFFECT_OFFSCREEN;
}
if (length > keys.size) each_key_duplicate("", "", "");
if (hydrating && length > 0) set_hydrate_node(skip_nodes());
if (!first_run) {
pending.set(batch, keys);
if (defer) {
for (const [key, item] of items) if (!keys.has(key)) batch.skip_effect(item.e);
batch.oncommit(commit);
batch.ondiscard(discard);
} else commit(batch);
}
if (mismatch) set_hydrating(true);
get(each_array);
}),
flags,
items,
pending,
outrogroups: null,
fallback
};
first_run = false;
if (hydrating) anchor = hydrate_node;
}
function skip_to_branch(effect) {
while (effect !== null && (effect.f & 32) === 0) effect = effect.next;
return effect;
}
function reconcile(state, array, anchor, flags, get_key) {
var is_animated = (flags & 8) !== 0;
var length = array.length;
var items = state.items;
var current = skip_to_branch(state.effect.first);
var seen;
var prev = null;
var to_animate;
var matched = [];
var stashed = [];
var value;
var key;
var effect;
var i;
if (is_animated) for (i = 0; i < length; i += 1) {
value = array[i];
key = get_key(value, i);
effect = items.get(key).e;
if ((effect.f & 33554432) === 0) {
effect.nodes?.a?.measure();
(to_animate ??= new Set()).add(effect);
}
}
for (i = 0; i < length; i += 1) {
value = array[i];
key = get_key(value, i);
effect = items.get(key).e;
if (state.outrogroups !== null) for (const group of state.outrogroups) {
group.pending.delete(effect);
group.done.delete(effect);
}
if ((effect.f & 8192) !== 0) {
resume_effect(effect);
if (is_animated) {
effect.nodes?.a?.unfix();
(to_animate ??= new Set()).delete(effect);
}
}
if ((effect.f & 33554432) !== 0) {
effect.f ^= EFFECT_OFFSCREEN;
if (effect === current) move(effect, null, anchor);
else {
var next = prev ? prev.next : current;
if (effect === state.effect.last) state.effect.last = effect.prev;
if (effect.prev) effect.prev.next = effect.next;
if (effect.next) effect.next.prev = effect.prev;
link(state, prev, effect);
link(state, effect, next);
move(effect, next, anchor);
prev = effect;
matched = [];
stashed = [];
current = skip_to_branch(prev.next);
continue;
}
}
if (effect !== current) {
if (seen !== void 0 && seen.has(effect)) {
if (matched.length < stashed.length) {
var start = stashed[0];
var j;
prev = start.prev;
var a = matched[0];
var b = matched[matched.length - 1];
for (j = 0; j < matched.length; j += 1) move(matched[j], start, anchor);
for (j = 0; j < stashed.length; j += 1) seen.delete(stashed[j]);
link(state, a.prev, b.next);
link(state, prev, a);
link(state, b, start);
current = start;
prev = b;
i -= 1;
matched = [];
stashed = [];
} else {
seen.delete(effect);
move(effect, current, anchor);
link(state, effect.prev, effect.next);
link(state, effect, prev === null ? state.effect.first : prev.next);
link(state, prev, effect);
prev = effect;
}
continue;
}
matched = [];
stashed = [];
while (current !== null && current !== effect) {
(seen ??= new Set()).add(current);
stashed.push(current);
current = skip_to_branch(current.next);
}
if (current === null) continue;
}
if ((effect.f & 33554432) === 0) matched.push(effect);
prev = effect;
current = skip_to_branch(effect.next);
}
if (state.outrogroups !== null) {
for (const group of state.outrogroups) if (group.pending.size === 0) {
destroy_effects(state, array_from(group.done));
state.outrogroups?.delete(group);
}
if (state.outrogroups.size === 0) state.outrogroups = null;
}
if (current !== null || seen !== void 0) {
var to_destroy = [];
if (seen !== void 0) {
for (effect of seen) if ((effect.f & 8192) === 0) to_destroy.push(effect);
}
while (current !== null) {
if ((current.f & 8192) === 0 && current !== state.fallback) to_destroy.push(current);
current = skip_to_branch(current.next);
}
var destroy_length = to_destroy.length;
if (destroy_length > 0) {
var controlled_anchor = (flags & 4) !== 0 && length === 0 ? anchor : null;
if (is_animated) {
for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.measure();
for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.fix();
}
pause_effects(state, to_destroy, controlled_anchor);
}
}
if (is_animated) queue_micro_task(() => {
if (to_animate === void 0) return;
for (effect of to_animate) effect.nodes?.a?.apply();
});
}
function create_item(items, anchor, value, key, index, render_fn, flags, get_collection) {
var v = (flags & 1) !== 0 ? (flags & 16) === 0 ? mutable_source(value, false, false) : source(value) : null;
var i = (flags & 2) !== 0 ? source(index) : null;
return {
v,
i,
e: branch(() => {
render_fn(anchor, v ?? value, i ?? index, get_collection);
return () => {
items.delete(key);
};
})
};
}
function move(effect, next, anchor) {
if (!effect.nodes) return;
var node = effect.nodes.start;
var end = effect.nodes.end;
var dest = next && (next.f & 33554432) === 0 ? next.nodes.start : anchor;
while (node !== null) {
var next_node = get_next_sibling(node);
dest.before(node);
if (node === end) return;
node = next_node;
}
}
function link(state, prev, next) {
if (prev === null) state.effect.first = next;
else prev.next = next;
if (next === null) state.effect.last = prev;
else next.prev = prev;
}
function snippet(node, get_snippet, ...args) {
var branches = new BranchManager(node);
block(() => {
const snippet = get_snippet() ?? null;
branches.ensure(snippet, snippet && ((anchor) => snippet(anchor, ...args)));
}, EFFECT_TRANSPARENT);
}
function r(e) {
var t, f, n = "";
if ("string" == typeof e || "number" == typeof e) n += e;
else if ("object" == typeof e) if (Array.isArray(e)) {
var o = e.length;
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
} else for (f in e) e[f] && (n && (n += " "), n += f);
return n;
}
function clsx$1() {
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
return n;
}
function clsx(value) {
if (typeof value === "object") return clsx$1(value);
else return value ?? "";
}
var whitespace = [..." \n\r\f\xA0\v"];
function to_class(value, hash, directives) {
var classname = value == null ? "" : "" + value;
if (hash) classname = classname ? classname + " " + hash : hash;
if (directives) {
for (var key of Object.keys(directives)) if (directives[key]) classname = classname ? classname + " " + key : key;
else if (classname.length) {
var len = key.length;
var a = 0;
while ((a = classname.indexOf(key, a)) >= 0) {
var b = a + len;
if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
else a = b;
}
}
}
return classname === "" ? null : classname;
}
function append_styles(styles, important = false) {
var separator = important ? " !important;" : ";";
var css = "";
for (var key of Object.keys(styles)) {
var value = styles[key];
if (value != null && value !== "") css += " " + key + ": " + value + separator;
}
return css;
}
function to_css_name(name) {
if (name[0] !== "-" || name[1] !== "-") return name.toLowerCase();
return name;
}
function to_style(value, styles) {
if (styles) {
var new_style = "";
var normal_styles;
var important_styles;
if (Array.isArray(styles)) {
normal_styles = styles[0];
important_styles = styles[1];
} else normal_styles = styles;
if (value) {
value = String(value).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
var in_str = false;
var in_apo = 0;
var in_comment = false;
var reserved_names = [];
if (normal_styles) reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
if (important_styles) reserved_names.push(...Object.keys(important_styles).map(to_css_name));
var start_index = 0;
var name_index = -1;
const len = value.length;
for (var i = 0; i < len; i++) {
var c = value[i];
if (in_comment) {
if (c === "/" && value[i - 1] === "*") in_comment = false;
} else if (in_str) {
if (in_str === c) in_str = false;
} else if (c === "/" && value[i + 1] === "*") in_comment = true;
else if (c === "\"" || c === "'") in_str = c;
else if (c === "(") in_apo++;
else if (c === ")") in_apo--;
if (!in_comment && in_str === false && in_apo === 0) {
if (c === ":" && name_index === -1) name_index = i;
else if (c === ";" || i === len - 1) {
if (name_index !== -1) {
var name = to_css_name(value.substring(start_index, name_index).trim());
if (!reserved_names.includes(name)) {
if (c !== ";") i++;
var property = value.substring(start_index, i).trim();
new_style += " " + property + ";";
}
}
start_index = i + 1;
name_index = -1;
}
}
}
}
if (normal_styles) new_style += append_styles(normal_styles);
if (important_styles) new_style += append_styles(important_styles, true);
new_style = new_style.trim();
return new_style === "" ? null : new_style;
}
return value == null ? null : String(value);
}
function set_class(dom, is_html, value, hash, prev_classes, next_classes) {
var prev = dom[CLASS_CACHE];
if (hydrating || prev !== value || prev === void 0) {
var next_class_name = to_class(value, hash, next_classes);
if (!hydrating || next_class_name !== dom.getAttribute("class")) if (next_class_name == null) dom.removeAttribute("class");
else if (is_html) dom.className = next_class_name;
else dom.setAttribute("class", next_class_name);
dom[CLASS_CACHE] = value;
} else if (next_classes && prev_classes !== next_classes) for (var key in next_classes) {
var is_present = !!next_classes[key];
if (prev_classes == null || is_present !== !!prev_classes[key]) dom.classList.toggle(key, is_present);
}
return next_classes;
}
function update_styles(dom, prev = {}, next, priority) {
for (var key in next) {
var value = next[key];
if (prev[key] !== value) if (next[key] == null) dom.style.removeProperty(key);
else dom.style.setProperty(key, value, priority);
}
}
function set_style(dom, value, prev_styles, next_styles) {
var prev = dom[STYLE_CACHE];
if (hydrating || prev !== value) {
var next_style_attr = to_style(value, next_styles);
if (!hydrating || next_style_attr !== dom.getAttribute("style")) if (next_style_attr == null) dom.removeAttribute("style");
else dom.style.cssText = next_style_attr;
dom[STYLE_CACHE] = value;
} else if (next_styles) if (Array.isArray(next_styles)) {
update_styles(dom, prev_styles?.[0], next_styles[0]);
update_styles(dom, prev_styles?.[1], next_styles[1], "important");
} else update_styles(dom, prev_styles, next_styles);
return next_styles;
}
function select_option(select, value, mounting = false) {
if (select.multiple) {
if (value == void 0) return;
if (!is_array(value)) return select_multiple_invalid_value();
for (var option of select.options) option.selected = value.includes(get_option_value(option));
return;
}
for (option of select.options) if (is(get_option_value(option), value)) {
option.selected = true;
return;
}
if (!mounting || value !== void 0) select.selectedIndex = -1;
}
function init_select(select) {
var observer = new MutationObserver(() => {
select_option(select, select.__value);
});
observer.observe(select, {
childList: true,
subtree: true,
attributes: true,
attributeFilter: ["value"]
});
teardown(() => {
observer.disconnect();
});
}
function bind_select_value(select, get, set = get) {
var batches = new WeakSet();
var mounting = true;
listen_to_event_and_reset_event(select, "change", (is_reset) => {
var query = is_reset ? "[selected]" : ":checked";
var value;
if (select.multiple) value = [].map.call(select.querySelectorAll(query), get_option_value);
else {
var selected_option = select.querySelector(query) ?? select.querySelector("option:not([disabled])");
value = selected_option && get_option_value(selected_option);
}
set(value);
select.__value = value;
if (current_batch !== null) batches.add(current_batch);
});
effect(() => {
var value = get();
if (select === document.activeElement) {
var batch = async_mode_flag ? previous_batch : current_batch;
if (batches.has(batch)) return;
}
select_option(select, value, mounting);
if (mounting && value === void 0) {
var selected_option = select.querySelector(":checked");
if (selected_option !== null) {
value = get_option_value(selected_option);
set(value);
}
}
select.__value = value;
mounting = false;
});
init_select(select);
}
function get_option_value(option) {
if ("__value" in option) return option.__value;
else return option.value;
}
var IS_CUSTOM_ELEMENT = Symbol("is custom element");
var IS_HTML = Symbol("is html");
var LINK_TAG = IS_XHTML ? "link" : "LINK";
function remove_input_defaults(input) {
if (!hydrating) return;
var already_removed = false;
var remove_defaults = () => {
if (already_removed) return;
already_removed = true;
if (input.hasAttribute("value")) {
var value = input.value;
set_attribute(input, "value", null);
input.value = value;
}
if (input.hasAttribute("checked")) {
var checked = input.checked;
set_attribute(input, "checked", null);
input.checked = checked;
}
};
input[FORM_RESET_HANDLER] = remove_defaults;
queue_micro_task(remove_defaults);
add_form_reset_listener();
}
function set_attribute(element, attribute, value, skip_warning) {
var attributes = get_attributes(element);
if (hydrating) {
attributes[attribute] = element.getAttribute(attribute);
if (attribute === "src" || attribute === "srcset" || attribute === "href" && element.nodeName === LINK_TAG) {
if (!skip_warning);
return;
}
}
if (attributes[attribute] === (attributes[attribute] = value)) return;
if (attribute === "loading") element[LOADING_ATTR_SYMBOL] = value;
if (value == null) element.removeAttribute(attribute);
else if (typeof value !== "string" && get_setters(element).includes(attribute)) element[attribute] = value;
else element.setAttribute(attribute, value);
}
function get_attributes(element) {
return element[ATTRIBUTES_CACHE] ??= {
[IS_CUSTOM_ELEMENT]: element.nodeName.includes("-"),
[IS_HTML]: element.namespaceURI === NAMESPACE_HTML
};
}
var setters_cache = new Map();
function get_setters(element) {
var cache_key = element.getAttribute("is") || element.nodeName;
var setters = setters_cache.get(cache_key);
if (setters) return setters;
setters_cache.set(cache_key, setters = []);
var descriptors;
var proto = element;
var element_proto = Element.prototype;
while (element_proto !== proto) {
descriptors = get_descriptors(proto);
for (var key in descriptors) if (descriptors[key].set && key !== "innerHTML" && key !== "textContent" && key !== "innerText") setters.push(key);
proto = get_prototype_of(proto);
}
return setters;
}
function bind_value(input, get, set = get) {
var batches = new WeakSet();
listen_to_event_and_reset_event(input, "input", async (is_reset) => {
var value = is_reset ? input.defaultValue : input.value;
value = is_numberlike_input(input) ? to_number(value) : value;
set(value);
if (current_batch !== null) batches.add(current_batch);
await tick();
if (value !== (value = get())) {
var start = input.selectionStart;
var end = input.selectionEnd;
var length = input.value.length;
input.value = value ?? "";
if (end !== null) {
var new_length = input.value.length;
if (start === end && end === length && new_length > length) {
input.selectionStart = new_length;
input.selectionEnd = new_length;
} else {
input.selectionStart = start;
input.selectionEnd = Math.min(end, new_length);
}
}
}
});
if (hydrating && input.defaultValue !== input.value || untrack(get) == null && input.value) {
set(is_numberlike_input(input) ? to_number(input.value) : input.value);
if (current_batch !== null) batches.add(current_batch);
}
render_effect(() => {
var value = get();
if (input === document.activeElement) {
var batch = async_mode_flag ? previous_batch : current_batch;
if (batches.has(batch)) return;
}
if (is_numberlike_input(input) && value === to_number(input.value)) return;
if (input.type === "date" && !value && !input.value) return;
if (value !== input.value) input.value = value ?? "";
});
}
function is_numberlike_input(input) {
var type = input.type;
return type === "number" || type === "range";
}
function to_number(value) {
return value === "" ? null : +value;
}
function prop(props, key, flags, fallback) {
var runes = !legacy_mode_flag || (flags & 2) !== 0;
var bindable = (flags & 8) !== 0;
var lazy = (flags & 16) !== 0;
var fallback_value = fallback;
var fallback_dirty = true;
var fallback_signal = void 0;
var get_fallback = () => {
if (lazy && runes) {
fallback_signal ??= derived(fallback);
return get(fallback_signal);
}
if (fallback_dirty) {
fallback_dirty = false;
fallback_value = lazy ? untrack(fallback) : fallback;
}
return fallback_value;
};
let setter;
if (bindable) {
var is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props;
setter = get_descriptor(props, key)?.set ?? (is_entry_props && key in props ? (v) => props[key] = v : void 0);
}
var initial_value;
var is_store_sub = false;
if (bindable) [initial_value, is_store_sub] = capture_store_binding(() => props[key]);
else initial_value = props[key];
if (initial_value === void 0 && fallback !== void 0) {
initial_value = get_fallback();
if (setter) {
if (runes) props_invalid_value(key);
setter(initial_value);
}
}
var getter;
if (runes) getter = () => {
var value = props[key];
if (value === void 0) return get_fallback();
fallback_dirty = true;
return value;
};
else getter = () => {
var value = props[key];
if (value !== void 0) fallback_value = void 0;
return value === void 0 ? fallback_value : value;
};
if (runes && (flags & 4) === 0) return getter;
if (setter) {
var legacy_parent = props.$$legacy;
return (function(value, mutation) {
if (arguments.length > 0) {
if (!runes || !mutation || legacy_parent || is_store_sub) setter(mutation ? getter() : value);
return value;
}
return getter();
});
}
var overridden = false;
var d = ((flags & 1) !== 0 ? derived : derived_safe_equal)(() => {
overridden = false;
return getter();
});
if (bindable) get(d);
var parent_effect = active_effect;
return (function(value, mutation) {
if (arguments.length > 0) {
const new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;
set(d, new_value);
overridden = true;
if (fallback_value !== void 0) fallback_value = new_value;
return value;
}
if (is_destroying_effect && overridden || (parent_effect.f & 16384) !== 0) return d.v;
return get(d);
});
}
if (typeof window !== "undefined") ((window.__svelte ??= {}).v ??= new Set()).add("5");
var DEFAULT_FREIGHT_RATES = {
sea: 8,
air: 40,
express: 60
};
var VOLUMETRIC_DIVISOR = 6e3;
var MIN_REFERRAL_FEE = { US: .3 };
function volumetricWeightKg({ lengthCm, widthCm, heightCm }, divisor = VOLUMETRIC_DIVISOR) {
return lengthCm * widthCm * heightCm / divisor;
}
function calcFreight(input) {
const { weightKg, dimensions, ratePerKg, divisor = VOLUMETRIC_DIVISOR } = input;
const volumetric = volumetricWeightKg(dimensions, divisor);
const billable = Math.max(weightKg, volumetric);
return {
volumetricWeightKg: volumetric,
actualWeightKg: weightKg,
billableWeightKg: billable,
dimRatio: weightKg > 0 ? volumetric / weightKg : Infinity,
isBulky: volumetric > weightKg,
freightCny: billable * ratePerKg
};
}
var cnyToUsd = (cny, fxRate) => fxRate > 0 ? cny / fxRate : 0;
function calcProfit(input) {
const { price, referralRate, fbaFee, purchaseCostCny, freightCny, fxRate, minReferralFee = 0 } = input;
const breakdown = {
purchase: cnyToUsd(purchaseCostCny, fxRate),
freight: cnyToUsd(freightCny, fxRate),
fba: fbaFee,
referral: Math.max(price * referralRate, minReferralFee)
};
const totalCostUsd = breakdown.purchase + breakdown.freight + breakdown.fba + breakdown.referral;
const grossProfit = price - totalCostUsd;
return {
price,
breakdown,
totalCostUsd,
grossProfit,
margin: price > 0 ? grossProfit / price : 0
};
}
function buildChartSegments(result, mode) {
const { breakdown, totalCostUsd, grossProfit, price } = result;
const costs = [
{
key: "purchase",
valueUsd: breakdown.purchase
},
{
key: "freight",
valueUsd: breakdown.freight
},
{
key: "fba",
valueUsd: breakdown.fba
},
{
key: "referral",
valueUsd: breakdown.referral
}
];
if (mode === "cost") {
const base = totalCostUsd;
return costs.map((c) => ({
...c,
percent: base > 0 ? c.valueUsd / base : 0
}));
}
const base = price;
const ratio = (v) => base > 0 ? v / base : 0;
return [{
key: "profit",
valueUsd: grossProfit,
percent: ratio(grossProfit)
}, ...costs.map((c) => ({
...c,
percent: ratio(c.valueUsd)
}))];
}
var FRANKFURTER = "https://api.frankfurter.dev/v1/latest";
var ER_API = "https://open.er-api.com/v6/latest";
function marketplaceToCurrency(mp) {
switch (mp) {
case "US": return "USD";
}
}
function parseCny(text) {
const cny = JSON.parse(text)?.rates?.CNY;
return typeof cny === "number" ? cny : void 0;
}
async function fetchCnyRate(http, base) {
try {
const res = await http.request({ url: `${FRANKFURTER}?base=${base}&symbols=CNY` });
if (res.status === 200) {
const cny = parseCny(res.text);
if (cny !== void 0) return {
base,
cnyPerUnit: cny,
date: JSON.parse(res.text).date ?? "",
source: "frankfurter"
};
}
} catch {}
const res = await http.request({ url: `${ER_API}/${base}` });
const cny = res.status === 200 ? parseCny(res.text) : void 0;
if (cny === void 0) throw new Error(`汇率获取失败 (${base})`);
return {
base,
cnyPerUnit: cny,
date: JSON.parse(res.text).time_last_update_utc ?? "",
source: "er-api"
};
}
var FX_KEY = "revcal:fx";
var FREIGHT_KEY = "revcal:freight";
var CalcState = class {
#http;
#store;
#fetchProduct;
marketplace = "US";
currency;
#loading = state(false);
get loading() {
return get(this.#loading);
}
set loading(value) {
set(this.#loading, value, true);
}
#error = state(null);
get error() {
return get(this.#error);
}
set error(value) {
set(this.#error, value, true);
}
#asin = state("");
get asin() {
return get(this.#asin);
}
set asin(value) {
set(this.#asin, value, true);
}
#price = state(0);
get price() {
return get(this.#price);
}
set price(value) {
set(this.#price, value, true);
}
#referralRate = state(.15);
get referralRate() {
return get(this.#referralRate);
}
set referralRate(value) {
set(this.#referralRate, value, true);
}
#fbaFee = state(0);
get fbaFee() {
return get(this.#fbaFee);
}
set fbaFee(value) {
set(this.#fbaFee, value, true);
}
#weightKg = state(0);
get weightKg() {
return get(this.#weightKg);
}
set weightKg(value) {
set(this.#weightKg, value, true);
}
#lengthCm = state(0);
get lengthCm() {
return get(this.#lengthCm);
}
set lengthCm(value) {
set(this.#lengthCm, value, true);
}
#widthCm = state(0);
get widthCm() {
return get(this.#widthCm);
}
set widthCm(value) {
set(this.#widthCm, value, true);
}
#heightCm = state(0);
get heightCm() {
return get(this.#heightCm);
}
set heightCm(value) {
set(this.#heightCm, value, true);
}
#purchaseCostCny = state(0);
get purchaseCostCny() {
return get(this.#purchaseCostCny);
}
set purchaseCostCny(value) {
set(this.#purchaseCostCny, value, true);
}
#channel = state(proxy("sea"));
get channel() {
return get(this.#channel);
}
set channel(value) {
set(this.#channel, value, true);
}
#freightRates = state(proxy({ ...DEFAULT_FREIGHT_RATES }));
get freightRates() {
return get(this.#freightRates);
}
set freightRates(value) {
set(this.#freightRates, value, true);
}
#fxRate = state(0);
get fxRate() {
return get(this.#fxRate);
}
set fxRate(value) {
set(this.#fxRate, value, true);
}
#fxUpdatedAt = state(null);
get fxUpdatedAt() {
return get(this.#fxUpdatedAt);
}
set fxUpdatedAt(value) {
set(this.#fxUpdatedAt, value, true);
}
#fxUpdating = state(false);
get fxUpdating() {
return get(this.#fxUpdating);
}
set fxUpdating(value) {
set(this.#fxUpdating, value, true);
}
#chartMode = state("cost");
get chartMode() {
return get(this.#chartMode);
}
set chartMode(value) {
set(this.#chartMode, value, true);
}
constructor(http, store, fetchProduct) {
this.#http = http;
this.#store = store;
this.#fetchProduct = fetchProduct;
this.currency = marketplaceToCurrency(this.marketplace);
const savedFreight = store.get(FREIGHT_KEY);
if (savedFreight) this.freightRates = savedFreight;
const fx = store.get(FX_KEY)?.[this.currency];
if (fx) {
this.fxRate = fx.cnyPerUnit;
this.fxUpdatedAt = fx.updatedAt ?? null;
}
}
#ratePerKg = user_derived(() => this.freightRates[this.channel]);
get ratePerKg() {
return get(this.#ratePerKg);
}
set ratePerKg(value) {
set(this.#ratePerKg, value);
}
#freight = user_derived(() => calcFreight({
weightKg: this.weightKg,
dimensions: {
lengthCm: this.lengthCm,
widthCm: this.widthCm,
heightCm: this.heightCm
},
ratePerKg: this.ratePerKg
}));
get freight() {
return get(this.#freight);
}
set freight(value) {
set(this.#freight, value);
}
#result = user_derived(() => calcProfit({
price: this.price,
referralRate: this.referralRate,
fbaFee: this.fbaFee,
purchaseCostCny: this.purchaseCostCny,
freightCny: this.freight.freightCny,
fxRate: this.fxRate,
minReferralFee: MIN_REFERRAL_FEE[this.marketplace]
}));
get result() {
return get(this.#result);
}
set result(value) {
set(this.#result, value);
}
#segments = user_derived(() => buildChartSegments(this.result, this.chartMode));
get segments() {
return get(this.#segments);
}
set segments(value) {
set(this.#segments, value);
}
async loadProduct(asin) {
if (!asin) {
this.error = "未能在当前页面识别到 ASIN";
return;
}
this.asin = asin;
this.loading = true;
this.error = null;
try {
const p = await this.#fetchProduct(asin, this.marketplace);
this.price = round(p.price);
this.referralRate = p.referralRate;
this.fbaFee = round(p.fbaFee);
this.weightKg = round(p.weightKg, 4);
this.lengthCm = round(p.dimensions.lengthCm, 2);
this.widthCm = round(p.dimensions.widthCm, 2);
this.heightCm = round(p.dimensions.heightCm, 2);
if (this.fxRate <= 0) await this.updateFx();
} catch (e) {
this.error = e instanceof Error ? e.message : String(e);
} finally {
this.loading = false;
}
}
async updateFx() {
this.fxUpdating = true;
try {
const fx = await fetchCnyRate(this.#http, this.currency);
this.fxRate = round(fx.cnyPerUnit, 4);
this.fxUpdatedAt = Date.now();
const all = this.#store.get(FX_KEY) ?? {};
all[this.currency] = {
cnyPerUnit: this.fxRate,
updatedAt: this.fxUpdatedAt
};
this.#store.set(FX_KEY, all);
} catch (e) {
this.error = e instanceof Error ? e.message : String(e);
} finally {
this.fxUpdating = false;
}
}
persistFreight() {
this.#store.set(FREIGHT_KEY, { ...this.freightRates });
}
};
function round(n, digits = 2) {
const f = 10 ** digits;
return Math.round(n * f) / f;
}
var concatArrays = (array1, array2) => {
const combinedArray = new Array(array1.length + array2.length);
for (let i = 0; i < array1.length; i++) combinedArray[i] = array1[i];
for (let i = 0; i < array2.length; i++) combinedArray[array1.length + i] = array2[i];
return combinedArray;
};
var createClassValidatorObject = (classGroupId, validator) => ({
classGroupId,
validator
});
var createClassPartObject = (nextPart = new Map(), validators = null, classGroupId) => ({
nextPart,
validators,
classGroupId
});
var CLASS_PART_SEPARATOR = "-";
var EMPTY_CONFLICTS = [];
var ARBITRARY_PROPERTY_PREFIX = "arbitrary..";
var createClassGroupUtils = (config) => {
const classMap = createClassMap(config);
const { conflictingClassGroups, conflictingClassGroupModifiers } = config;
const getClassGroupId = (className) => {
if (className.startsWith("[") && className.endsWith("]")) return getGroupIdForArbitraryProperty(className);
const classParts = className.split(CLASS_PART_SEPARATOR);
return getGroupRecursive(classParts, classParts[0] === "" && classParts.length > 1 ? 1 : 0, classMap);
};
const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier) => {
if (hasPostfixModifier) {
const modifierConflicts = conflictingClassGroupModifiers[classGroupId];
const baseConflicts = conflictingClassGroups[classGroupId];
if (modifierConflicts) {
if (baseConflicts) return concatArrays(baseConflicts, modifierConflicts);
return modifierConflicts;
}
return baseConflicts || EMPTY_CONFLICTS;
}
return conflictingClassGroups[classGroupId] || EMPTY_CONFLICTS;
};
return {
getClassGroupId,
getConflictingClassGroupIds
};
};
var getGroupRecursive = (classParts, startIndex, classPartObject) => {
if (classParts.length - startIndex === 0) return classPartObject.classGroupId;
const currentClassPart = classParts[startIndex];
const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
if (nextClassPartObject) {
const result = getGroupRecursive(classParts, startIndex + 1, nextClassPartObject);
if (result) return result;
}
const validators = classPartObject.validators;
if (validators === null) return;
const classRest = startIndex === 0 ? classParts.join(CLASS_PART_SEPARATOR) : classParts.slice(startIndex).join(CLASS_PART_SEPARATOR);
const validatorsLength = validators.length;
for (let i = 0; i < validatorsLength; i++) {
const validatorObj = validators[i];
if (validatorObj.validator(classRest)) return validatorObj.classGroupId;
}
};
var getGroupIdForArbitraryProperty = (className) => className.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
const content = className.slice(1, -1);
const colonIndex = content.indexOf(":");
const property = content.slice(0, colonIndex);
return property ? ARBITRARY_PROPERTY_PREFIX + property : void 0;
})();
var createClassMap = (config) => {
const { theme, classGroups } = config;
return processClassGroups(classGroups, theme);
};
var processClassGroups = (classGroups, theme) => {
const classMap = createClassPartObject();
for (const classGroupId in classGroups) {
const group = classGroups[classGroupId];
processClassesRecursively(group, classMap, classGroupId, theme);
}
return classMap;
};
var processClassesRecursively = (classGroup, classPartObject, classGroupId, theme) => {
const len = classGroup.length;
for (let i = 0; i < len; i++) {
const classDefinition = classGroup[i];
processClassDefinition(classDefinition, classPartObject, classGroupId, theme);
}
};
var processClassDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
if (typeof classDefinition === "string") {
processStringDefinition(classDefinition, classPartObject, classGroupId);
return;
}
if (typeof classDefinition === "function") {
processFunctionDefinition(classDefinition, classPartObject, classGroupId, theme);
return;
}
processObjectDefinition(classDefinition, classPartObject, classGroupId, theme);
};
var processStringDefinition = (classDefinition, classPartObject, classGroupId) => {
const classPartObjectToEdit = classDefinition === "" ? classPartObject : getPart(classPartObject, classDefinition);
classPartObjectToEdit.classGroupId = classGroupId;
};
var processFunctionDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
if (isThemeGetter(classDefinition)) {
processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
return;
}
if (classPartObject.validators === null) classPartObject.validators = [];
classPartObject.validators.push(createClassValidatorObject(classGroupId, classDefinition));
};
var processObjectDefinition = (classDefinition, classPartObject, classGroupId, theme) => {
const entries = Object.entries(classDefinition);
const len = entries.length;
for (let i = 0; i < len; i++) {
const [key, value] = entries[i];
processClassesRecursively(value, getPart(classPartObject, key), classGroupId, theme);
}
};
var getPart = (classPartObject, path) => {
let current = classPartObject;
const parts = path.split(CLASS_PART_SEPARATOR);
const len = parts.length;
for (let i = 0; i < len; i++) {
const part = parts[i];
let next = current.nextPart.get(part);
if (!next) {
next = createClassPartObject();
current.nextPart.set(part, next);
}
current = next;
}
return current;
};
var isThemeGetter = (func) => "isThemeGetter" in func && func.isThemeGetter === true;
var createLruCache = (maxCacheSize) => {
if (maxCacheSize < 1) return {
get: () => void 0,
set: () => {}
};
let cacheSize = 0;
let cache = Object.create(null);
let previousCache = Object.create(null);
const update = (key, value) => {
cache[key] = value;
cacheSize++;
if (cacheSize > maxCacheSize) {
cacheSize = 0;
previousCache = cache;
cache = Object.create(null);
}
};
return {
get(key) {
let value = cache[key];
if (value !== void 0) return value;
if ((value = previousCache[key]) !== void 0) {
update(key, value);
return value;
}
},
set(key, value) {
if (key in cache) cache[key] = value;
else update(key, value);
}
};
};
var IMPORTANT_MODIFIER = "!";
var MODIFIER_SEPARATOR = ":";
var EMPTY_MODIFIERS = [];
var createResultObject = (modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition, isExternal) => ({
modifiers,
hasImportantModifier,
baseClassName,
maybePostfixModifierPosition,
isExternal
});
var createParseClassName = (config) => {
const { prefix, experimentalParseClassName } = config;
let parseClassName = (className) => {
const modifiers = [];
let bracketDepth = 0;
let parenDepth = 0;
let modifierStart = 0;
let postfixModifierPosition;
const len = className.length;
for (let index = 0; index < len; index++) {
const currentCharacter = className[index];
if (bracketDepth === 0 && parenDepth === 0) {
if (currentCharacter === MODIFIER_SEPARATOR) {
modifiers.push(className.slice(modifierStart, index));
modifierStart = index + 1;
continue;
}
if (currentCharacter === "/") {
postfixModifierPosition = index;
continue;
}
}
if (currentCharacter === "[") bracketDepth++;
else if (currentCharacter === "]") bracketDepth--;
else if (currentCharacter === "(") parenDepth++;
else if (currentCharacter === ")") parenDepth--;
}
const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.slice(modifierStart);
let baseClassName = baseClassNameWithImportantModifier;
let hasImportantModifier = false;
if (baseClassNameWithImportantModifier.endsWith(IMPORTANT_MODIFIER)) {
baseClassName = baseClassNameWithImportantModifier.slice(0, -1);
hasImportantModifier = true;
} else if (baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER)) {
baseClassName = baseClassNameWithImportantModifier.slice(1);
hasImportantModifier = true;
}
const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : void 0;
return createResultObject(modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition);
};
if (prefix) {
const fullPrefix = prefix + MODIFIER_SEPARATOR;
const parseClassNameOriginal = parseClassName;
parseClassName = (className) => className.startsWith(fullPrefix) ? parseClassNameOriginal(className.slice(fullPrefix.length)) : createResultObject(EMPTY_MODIFIERS, false, className, void 0, true);
}
if (experimentalParseClassName) {
const parseClassNameOriginal = parseClassName;
parseClassName = (className) => experimentalParseClassName({
className,
parseClassName: parseClassNameOriginal
});
}
return parseClassName;
};
var createSortModifiers = (config) => {
const modifierWeights = new Map();
config.orderSensitiveModifiers.forEach((mod, index) => {
modifierWeights.set(mod, 1e6 + index);
});
return (modifiers) => {
const result = [];
let currentSegment = [];
for (let i = 0; i < modifiers.length; i++) {
const modifier = modifiers[i];
const isArbitrary = modifier[0] === "[";
const isOrderSensitive = modifierWeights.has(modifier);
if (isArbitrary || isOrderSensitive) {
if (currentSegment.length > 0) {
currentSegment.sort();
result.push(...currentSegment);
currentSegment = [];
}
result.push(modifier);
} else currentSegment.push(modifier);
}
if (currentSegment.length > 0) {
currentSegment.sort();
result.push(...currentSegment);
}
return result;
};
};
var createConfigUtils = (config) => ({
cache: createLruCache(config.cacheSize),
parseClassName: createParseClassName(config),
sortModifiers: createSortModifiers(config),
postfixLookupClassGroupIds: createPostfixLookupClassGroupIds(config),
...createClassGroupUtils(config)
});
var createPostfixLookupClassGroupIds = (config) => {
const lookup = Object.create(null);
const classGroupIds = config.postfixLookupClassGroups;
if (classGroupIds) for (let i = 0; i < classGroupIds.length; i++) lookup[classGroupIds[i]] = true;
return lookup;
};
var SPLIT_CLASSES_REGEX = /\s+/;
var mergeClassList = (classList, configUtils) => {
const { parseClassName, getClassGroupId, getConflictingClassGroupIds, sortModifiers, postfixLookupClassGroupIds } = configUtils;
const classGroupsInConflict = [];
const classNames = classList.trim().split(SPLIT_CLASSES_REGEX);
let result = "";
for (let index = classNames.length - 1; index >= 0; index -= 1) {
const originalClassName = classNames[index];
const { isExternal, modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition } = parseClassName(originalClassName);
if (isExternal) {
result = originalClassName + (result.length > 0 ? " " + result : result);
continue;
}
let hasPostfixModifier = !!maybePostfixModifierPosition;
let classGroupId;
if (hasPostfixModifier) {
classGroupId = getClassGroupId(baseClassName.substring(0, maybePostfixModifierPosition));
const classGroupIdWithPostfix = classGroupId && postfixLookupClassGroupIds[classGroupId] ? getClassGroupId(baseClassName) : void 0;
if (classGroupIdWithPostfix && classGroupIdWithPostfix !== classGroupId) {
classGroupId = classGroupIdWithPostfix;
hasPostfixModifier = false;
}
} else classGroupId = getClassGroupId(baseClassName);
if (!classGroupId) {
if (!hasPostfixModifier) {
result = originalClassName + (result.length > 0 ? " " + result : result);
continue;
}
classGroupId = getClassGroupId(baseClassName);
if (!classGroupId) {
result = originalClassName + (result.length > 0 ? " " + result : result);
continue;
}
hasPostfixModifier = false;
}
const variantModifier = modifiers.length === 0 ? "" : modifiers.length === 1 ? modifiers[0] : sortModifiers(modifiers).join(":");
const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
const classId = modifierId + classGroupId;
if (classGroupsInConflict.indexOf(classId) > -1) continue;
classGroupsInConflict.push(classId);
const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
for (let i = 0; i < conflictGroups.length; ++i) {
const group = conflictGroups[i];
classGroupsInConflict.push(modifierId + group);
}
result = originalClassName + (result.length > 0 ? " " + result : result);
}
return result;
};
var twJoin = (...classLists) => {
let index = 0;
let argument;
let resolvedValue;
let string = "";
while (index < classLists.length) if (argument = classLists[index++]) {
if (resolvedValue = toValue(argument)) {
string && (string += " ");
string += resolvedValue;
}
}
return string;
};
var toValue = (mix) => {
if (typeof mix === "string") return mix;
let resolvedValue;
let string = "";
for (let k = 0; k < mix.length; k++) if (mix[k]) {
if (resolvedValue = toValue(mix[k])) {
string && (string += " ");
string += resolvedValue;
}
}
return string;
};
var createTailwindMerge = (createConfigFirst, ...createConfigRest) => {
let configUtils;
let cacheGet;
let cacheSet;
let functionToCall;
const initTailwindMerge = (classList) => {
configUtils = createConfigUtils(createConfigRest.reduce((previousConfig, createConfigCurrent) => createConfigCurrent(previousConfig), createConfigFirst()));
cacheGet = configUtils.cache.get;
cacheSet = configUtils.cache.set;
functionToCall = tailwindMerge;
return tailwindMerge(classList);
};
const tailwindMerge = (classList) => {
const cachedResult = cacheGet(classList);
if (cachedResult) return cachedResult;
const result = mergeClassList(classList, configUtils);
cacheSet(classList, result);
return result;
};
functionToCall = initTailwindMerge;
return (...args) => functionToCall(twJoin(...args));
};
var fallbackThemeArr = [];
var fromTheme = (key) => {
const themeGetter = (theme) => theme[key] || fallbackThemeArr;
themeGetter.isThemeGetter = true;
return themeGetter;
};
var arbitraryValueRegex = /^\[(?:(\w[\w-]*):)?(.+)\]$/i;
var arbitraryVariableRegex = /^\((?:(\w[\w-]*):)?(.+)\)$/i;
var fractionRegex = /^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/;
var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
var colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/;
var shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
var imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
var isFraction = (value) => fractionRegex.test(value);
var isNumber = (value) => !!value && !Number.isNaN(Number(value));
var isInteger = (value) => !!value && Number.isInteger(Number(value));
var isPercent = (value) => value.endsWith("%") && isNumber(value.slice(0, -1));
var isTshirtSize = (value) => tshirtUnitRegex.test(value);
var isAny = () => true;
var isLengthOnly = (value) => lengthUnitRegex.test(value) && !colorFunctionRegex.test(value);
var isNever = () => false;
var isShadow = (value) => shadowRegex.test(value);
var isImage = (value) => imageRegex.test(value);
var isAnyNonArbitrary = (value) => !isArbitraryValue(value) && !isArbitraryVariable(value);
var isNamedContainerQuery = (value) => value.startsWith("@container") && (value[10] === "/" && value[11] !== void 0 || value[11] === "s" && value[16] !== void 0 && value.startsWith("-size/", 10) || value[11] === "n" && value[18] !== void 0 && value.startsWith("-normal/", 10));
var isArbitrarySize = (value) => getIsArbitraryValue(value, isLabelSize, isNever);
var isArbitraryValue = (value) => arbitraryValueRegex.test(value);
var isArbitraryLength = (value) => getIsArbitraryValue(value, isLabelLength, isLengthOnly);
var isArbitraryNumber = (value) => getIsArbitraryValue(value, isLabelNumber, isNumber);
var isArbitraryWeight = (value) => getIsArbitraryValue(value, isLabelWeight, isAny);
var isArbitraryFamilyName = (value) => getIsArbitraryValue(value, isLabelFamilyName, isNever);
var isArbitraryPosition = (value) => getIsArbitraryValue(value, isLabelPosition, isNever);
var isArbitraryImage = (value) => getIsArbitraryValue(value, isLabelImage, isImage);
var isArbitraryShadow = (value) => getIsArbitraryValue(value, isLabelShadow, isShadow);
var isArbitraryVariable = (value) => arbitraryVariableRegex.test(value);
var isArbitraryVariableLength = (value) => getIsArbitraryVariable(value, isLabelLength);
var isArbitraryVariableFamilyName = (value) => getIsArbitraryVariable(value, isLabelFamilyName);
var isArbitraryVariablePosition = (value) => getIsArbitraryVariable(value, isLabelPosition);
var isArbitraryVariableSize = (value) => getIsArbitraryVariable(value, isLabelSize);
var isArbitraryVariableImage = (value) => getIsArbitraryVariable(value, isLabelImage);
var isArbitraryVariableShadow = (value) => getIsArbitraryVariable(value, isLabelShadow, true);
var isArbitraryVariableWeight = (value) => getIsArbitraryVariable(value, isLabelWeight, true);
var getIsArbitraryValue = (value, testLabel, testValue) => {
const result = arbitraryValueRegex.exec(value);
if (result) {
if (result[1]) return testLabel(result[1]);
return testValue(result[2]);
}
return false;
};
var getIsArbitraryVariable = (value, testLabel, shouldMatchNoLabel = false) => {
const result = arbitraryVariableRegex.exec(value);
if (result) {
if (result[1]) return testLabel(result[1]);
return shouldMatchNoLabel;
}
return false;
};
var isLabelPosition = (label) => label === "position" || label === "percentage";
var isLabelImage = (label) => label === "image" || label === "url";
var isLabelSize = (label) => label === "length" || label === "size" || label === "bg-size";
var isLabelLength = (label) => label === "length";
var isLabelNumber = (label) => label === "number";
var isLabelFamilyName = (label) => label === "family-name";
var isLabelWeight = (label) => label === "number" || label === "weight";
var isLabelShadow = (label) => label === "shadow";
var getDefaultConfig = () => {
const themeColor = fromTheme("color");
const themeFont = fromTheme("font");
const themeText = fromTheme("text");
const themeFontWeight = fromTheme("font-weight");
const themeTracking = fromTheme("tracking");
const themeLeading = fromTheme("leading");
const themeBreakpoint = fromTheme("breakpoint");
const themeContainer = fromTheme("container");
const themeSpacing = fromTheme("spacing");
const themeRadius = fromTheme("radius");
const themeShadow = fromTheme("shadow");
const themeInsetShadow = fromTheme("inset-shadow");
const themeTextShadow = fromTheme("text-shadow");
const themeDropShadow = fromTheme("drop-shadow");
const themeBlur = fromTheme("blur");
const themePerspective = fromTheme("perspective");
const themeAspect = fromTheme("aspect");
const themeEase = fromTheme("ease");
const themeAnimate = fromTheme("animate");
const scaleBreak = () => [
"auto",
"avoid",
"all",
"avoid-page",
"page",
"left",
"right",
"column"
];
const scalePosition = () => [
"center",
"top",
"bottom",
"left",
"right",
"top-left",
"left-top",
"top-right",
"right-top",
"bottom-right",
"right-bottom",
"bottom-left",
"left-bottom"
];
const scalePositionWithArbitrary = () => [
...scalePosition(),
isArbitraryVariable,
isArbitraryValue
];
const scaleOverflow = () => [
"auto",
"hidden",
"clip",
"visible",
"scroll"
];
const scaleOverscroll = () => [
"auto",
"contain",
"none"
];
const scaleUnambiguousSpacing = () => [
isArbitraryVariable,
isArbitraryValue,
themeSpacing
];
const scaleInset = () => [
isFraction,
"full",
"auto",
...scaleUnambiguousSpacing()
];
const scaleGridTemplateColsRows = () => [
isInteger,
"none",
"subgrid",
isArbitraryVariable,
isArbitraryValue
];
const scaleGridColRowStartAndEnd = () => [
"auto",
{ span: [
"full",
isInteger,
isArbitraryVariable,
isArbitraryValue
] },
isInteger,
isArbitraryVariable,
isArbitraryValue
];
const scaleGridColRowStartOrEnd = () => [
isInteger,
"auto",
isArbitraryVariable,
isArbitraryValue
];
const scaleGridAutoColsRows = () => [
"auto",
"min",
"max",
"fr",
isArbitraryVariable,
isArbitraryValue
];
const scaleAlignPrimaryAxis = () => [
"start",
"end",
"center",
"between",
"around",
"evenly",
"stretch",
"baseline",
"center-safe",
"end-safe"
];
const scaleAlignSecondaryAxis = () => [
"start",
"end",
"center",
"stretch",
"center-safe",
"end-safe"
];
const scaleMargin = () => ["auto", ...scaleUnambiguousSpacing()];
const scaleSizing = () => [
isFraction,
"auto",
"full",
"dvw",
"dvh",
"lvw",
"lvh",
"svw",
"svh",
"min",
"max",
"fit",
...scaleUnambiguousSpacing()
];
const scaleSizingInline = () => [
isFraction,
"screen",
"full",
"dvw",
"lvw",
"svw",
"min",
"max",
"fit",
...scaleUnambiguousSpacing()
];
const scaleSizingBlock = () => [
isFraction,
"screen",
"full",
"lh",
"dvh",
"lvh",
"svh",
"min",
"max",
"fit",
...scaleUnambiguousSpacing()
];
const scaleColor = () => [
themeColor,
isArbitraryVariable,
isArbitraryValue
];
const scaleBgPosition = () => [
...scalePosition(),
isArbitraryVariablePosition,
isArbitraryPosition,
{ position: [isArbitraryVariable, isArbitraryValue] }
];
const scaleBgRepeat = () => ["no-repeat", { repeat: [
"",
"x",
"y",
"space",
"round"
] }];
const scaleBgSize = () => [
"auto",
"cover",
"contain",
isArbitraryVariableSize,
isArbitrarySize,
{ size: [isArbitraryVariable, isArbitraryValue] }
];
const scaleGradientStopPosition = () => [
isPercent,
isArbitraryVariableLength,
isArbitraryLength
];
const scaleRadius = () => [
"",
"none",
"full",
themeRadius,
isArbitraryVariable,
isArbitraryValue
];
const scaleBorderWidth = () => [
"",
isNumber,
isArbitraryVariableLength,
isArbitraryLength
];
const scaleLineStyle = () => [
"solid",
"dashed",
"dotted",
"double"
];
const scaleBlendMode = () => [
"normal",
"multiply",
"screen",
"overlay",
"darken",
"lighten",
"color-dodge",
"color-burn",
"hard-light",
"soft-light",
"difference",
"exclusion",
"hue",
"saturation",
"color",
"luminosity"
];
const scaleMaskImagePosition = () => [
isNumber,
isPercent,
isArbitraryVariablePosition,
isArbitraryPosition
];
const scaleBlur = () => [
"",
"none",
themeBlur,
isArbitraryVariable,
isArbitraryValue
];
const scaleRotate = () => [
"none",
isNumber,
isArbitraryVariable,
isArbitraryValue
];
const scaleScale = () => [
"none",
isNumber,
isArbitraryVariable,
isArbitraryValue
];
const scaleSkew = () => [
isNumber,
isArbitraryVariable,
isArbitraryValue
];
const scaleTranslate = () => [
isFraction,
"full",
...scaleUnambiguousSpacing()
];
return {
cacheSize: 500,
theme: {
animate: [
"spin",
"ping",
"pulse",
"bounce"
],
aspect: ["video"],
blur: [isTshirtSize],
breakpoint: [isTshirtSize],
color: [isAny],
container: [isTshirtSize],
"drop-shadow": [isTshirtSize],
ease: [
"in",
"out",
"in-out"
],
font: [isAnyNonArbitrary],
"font-weight": [
"thin",
"extralight",
"light",
"normal",
"medium",
"semibold",
"bold",
"extrabold",
"black"
],
"inset-shadow": [isTshirtSize],
leading: [
"none",
"tight",
"snug",
"normal",
"relaxed",
"loose"
],
perspective: [
"dramatic",
"near",
"normal",
"midrange",
"distant",
"none"
],
radius: [isTshirtSize],
shadow: [isTshirtSize],
spacing: ["px", isNumber],
text: [isTshirtSize],
"text-shadow": [isTshirtSize],
tracking: [
"tighter",
"tight",
"normal",
"wide",
"wider",
"widest"
]
},
classGroups: {
aspect: [{ aspect: [
"auto",
"square",
isFraction,
isArbitraryValue,
isArbitraryVariable,
themeAspect
] }],
container: ["container"],
"container-type": [{ "@container": [
"",
"normal",
"size",
isArbitraryVariable,
isArbitraryValue
] }],
"container-named": [isNamedContainerQuery],
columns: [{ columns: [
isNumber,
isArbitraryValue,
isArbitraryVariable,
themeContainer
] }],
"break-after": [{ "break-after": scaleBreak() }],
"break-before": [{ "break-before": scaleBreak() }],
"break-inside": [{ "break-inside": [
"auto",
"avoid",
"avoid-page",
"avoid-column"
] }],
"box-decoration": [{ "box-decoration": ["slice", "clone"] }],
box: [{ box: ["border", "content"] }],
display: [
"block",
"inline-block",
"inline",
"flex",
"inline-flex",
"table",
"inline-table",
"table-caption",
"table-cell",
"table-column",
"table-column-group",
"table-footer-group",
"table-header-group",
"table-row-group",
"table-row",
"flow-root",
"grid",
"inline-grid",
"contents",
"list-item",
"hidden"
],
sr: ["sr-only", "not-sr-only"],
float: [{ float: [
"right",
"left",
"none",
"start",
"end"
] }],
clear: [{ clear: [
"left",
"right",
"both",
"none",
"start",
"end"
] }],
isolation: ["isolate", "isolation-auto"],
"object-fit": [{ object: [
"contain",
"cover",
"fill",
"none",
"scale-down"
] }],
"object-position": [{ object: scalePositionWithArbitrary() }],
overflow: [{ overflow: scaleOverflow() }],
"overflow-x": [{ "overflow-x": scaleOverflow() }],
"overflow-y": [{ "overflow-y": scaleOverflow() }],
overscroll: [{ overscroll: scaleOverscroll() }],
"overscroll-x": [{ "overscroll-x": scaleOverscroll() }],
"overscroll-y": [{ "overscroll-y": scaleOverscroll() }],
position: [
"static",
"fixed",
"absolute",
"relative",
"sticky"
],
inset: [{ inset: scaleInset() }],
"inset-x": [{ "inset-x": scaleInset() }],
"inset-y": [{ "inset-y": scaleInset() }],
start: [{
"inset-s": scaleInset(),
start: scaleInset()
}],
end: [{
"inset-e": scaleInset(),
end: scaleInset()
}],
"inset-bs": [{ "inset-bs": scaleInset() }],
"inset-be": [{ "inset-be": scaleInset() }],
top: [{ top: scaleInset() }],
right: [{ right: scaleInset() }],
bottom: [{ bottom: scaleInset() }],
left: [{ left: scaleInset() }],
visibility: [
"visible",
"invisible",
"collapse"
],
z: [{ z: [
isInteger,
"auto",
isArbitraryVariable,
isArbitraryValue
] }],
basis: [{ basis: [
isFraction,
"full",
"auto",
themeContainer,
...scaleUnambiguousSpacing()
] }],
"flex-direction": [{ flex: [
"row",
"row-reverse",
"col",
"col-reverse"
] }],
"flex-wrap": [{ flex: [
"nowrap",
"wrap",
"wrap-reverse"
] }],
flex: [{ flex: [
isNumber,
isFraction,
"auto",
"initial",
"none",
isArbitraryValue
] }],
grow: [{ grow: [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
shrink: [{ shrink: [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
order: [{ order: [
isInteger,
"first",
"last",
"none",
isArbitraryVariable,
isArbitraryValue
] }],
"grid-cols": [{ "grid-cols": scaleGridTemplateColsRows() }],
"col-start-end": [{ col: scaleGridColRowStartAndEnd() }],
"col-start": [{ "col-start": scaleGridColRowStartOrEnd() }],
"col-end": [{ "col-end": scaleGridColRowStartOrEnd() }],
"grid-rows": [{ "grid-rows": scaleGridTemplateColsRows() }],
"row-start-end": [{ row: scaleGridColRowStartAndEnd() }],
"row-start": [{ "row-start": scaleGridColRowStartOrEnd() }],
"row-end": [{ "row-end": scaleGridColRowStartOrEnd() }],
"grid-flow": [{ "grid-flow": [
"row",
"col",
"dense",
"row-dense",
"col-dense"
] }],
"auto-cols": [{ "auto-cols": scaleGridAutoColsRows() }],
"auto-rows": [{ "auto-rows": scaleGridAutoColsRows() }],
gap: [{ gap: scaleUnambiguousSpacing() }],
"gap-x": [{ "gap-x": scaleUnambiguousSpacing() }],
"gap-y": [{ "gap-y": scaleUnambiguousSpacing() }],
"justify-content": [{ justify: [...scaleAlignPrimaryAxis(), "normal"] }],
"justify-items": [{ "justify-items": [...scaleAlignSecondaryAxis(), "normal"] }],
"justify-self": [{ "justify-self": ["auto", ...scaleAlignSecondaryAxis()] }],
"align-content": [{ content: ["normal", ...scaleAlignPrimaryAxis()] }],
"align-items": [{ items: [...scaleAlignSecondaryAxis(), { baseline: ["", "last"] }] }],
"align-self": [{ self: [
"auto",
...scaleAlignSecondaryAxis(),
{ baseline: ["", "last"] }
] }],
"place-content": [{ "place-content": scaleAlignPrimaryAxis() }],
"place-items": [{ "place-items": [...scaleAlignSecondaryAxis(), "baseline"] }],
"place-self": [{ "place-self": ["auto", ...scaleAlignSecondaryAxis()] }],
p: [{ p: scaleUnambiguousSpacing() }],
px: [{ px: scaleUnambiguousSpacing() }],
py: [{ py: scaleUnambiguousSpacing() }],
ps: [{ ps: scaleUnambiguousSpacing() }],
pe: [{ pe: scaleUnambiguousSpacing() }],
pbs: [{ pbs: scaleUnambiguousSpacing() }],
pbe: [{ pbe: scaleUnambiguousSpacing() }],
pt: [{ pt: scaleUnambiguousSpacing() }],
pr: [{ pr: scaleUnambiguousSpacing() }],
pb: [{ pb: scaleUnambiguousSpacing() }],
pl: [{ pl: scaleUnambiguousSpacing() }],
m: [{ m: scaleMargin() }],
mx: [{ mx: scaleMargin() }],
my: [{ my: scaleMargin() }],
ms: [{ ms: scaleMargin() }],
me: [{ me: scaleMargin() }],
mbs: [{ mbs: scaleMargin() }],
mbe: [{ mbe: scaleMargin() }],
mt: [{ mt: scaleMargin() }],
mr: [{ mr: scaleMargin() }],
mb: [{ mb: scaleMargin() }],
ml: [{ ml: scaleMargin() }],
"space-x": [{ "space-x": scaleUnambiguousSpacing() }],
"space-x-reverse": ["space-x-reverse"],
"space-y": [{ "space-y": scaleUnambiguousSpacing() }],
"space-y-reverse": ["space-y-reverse"],
size: [{ size: scaleSizing() }],
"inline-size": [{ inline: ["auto", ...scaleSizingInline()] }],
"min-inline-size": [{ "min-inline": ["auto", ...scaleSizingInline()] }],
"max-inline-size": [{ "max-inline": ["none", ...scaleSizingInline()] }],
"block-size": [{ block: ["auto", ...scaleSizingBlock()] }],
"min-block-size": [{ "min-block": ["auto", ...scaleSizingBlock()] }],
"max-block-size": [{ "max-block": ["none", ...scaleSizingBlock()] }],
w: [{ w: [
themeContainer,
"screen",
...scaleSizing()
] }],
"min-w": [{ "min-w": [
themeContainer,
"screen",
"none",
...scaleSizing()
] }],
"max-w": [{ "max-w": [
themeContainer,
"screen",
"none",
"prose",
{ screen: [themeBreakpoint] },
...scaleSizing()
] }],
h: [{ h: [
"screen",
"lh",
...scaleSizing()
] }],
"min-h": [{ "min-h": [
"screen",
"lh",
"none",
...scaleSizing()
] }],
"max-h": [{ "max-h": [
"screen",
"lh",
...scaleSizing()
] }],
"font-size": [{ text: [
"base",
themeText,
isArbitraryVariableLength,
isArbitraryLength
] }],
"font-smoothing": ["antialiased", "subpixel-antialiased"],
"font-style": ["italic", "not-italic"],
"font-weight": [{ font: [
themeFontWeight,
isArbitraryVariableWeight,
isArbitraryWeight
] }],
"font-stretch": [{ "font-stretch": [
"ultra-condensed",
"extra-condensed",
"condensed",
"semi-condensed",
"normal",
"semi-expanded",
"expanded",
"extra-expanded",
"ultra-expanded",
isPercent,
isArbitraryValue
] }],
"font-family": [{ font: [
isArbitraryVariableFamilyName,
isArbitraryFamilyName,
themeFont
] }],
"font-features": [{ "font-features": [isArbitraryValue] }],
"fvn-normal": ["normal-nums"],
"fvn-ordinal": ["ordinal"],
"fvn-slashed-zero": ["slashed-zero"],
"fvn-figure": ["lining-nums", "oldstyle-nums"],
"fvn-spacing": ["proportional-nums", "tabular-nums"],
"fvn-fraction": ["diagonal-fractions", "stacked-fractions"],
tracking: [{ tracking: [
themeTracking,
isArbitraryVariable,
isArbitraryValue
] }],
"line-clamp": [{ "line-clamp": [
isNumber,
"none",
isArbitraryVariable,
isArbitraryNumber
] }],
leading: [{ leading: [themeLeading, ...scaleUnambiguousSpacing()] }],
"list-image": [{ "list-image": [
"none",
isArbitraryVariable,
isArbitraryValue
] }],
"list-style-position": [{ list: ["inside", "outside"] }],
"list-style-type": [{ list: [
"disc",
"decimal",
"none",
isArbitraryVariable,
isArbitraryValue
] }],
"text-alignment": [{ text: [
"left",
"center",
"right",
"justify",
"start",
"end"
] }],
"placeholder-color": [{ placeholder: scaleColor() }],
"text-color": [{ text: scaleColor() }],
"text-decoration": [
"underline",
"overline",
"line-through",
"no-underline"
],
"text-decoration-style": [{ decoration: [...scaleLineStyle(), "wavy"] }],
"text-decoration-thickness": [{ decoration: [
isNumber,
"from-font",
"auto",
isArbitraryVariable,
isArbitraryLength
] }],
"text-decoration-color": [{ decoration: scaleColor() }],
"underline-offset": [{ "underline-offset": [
isNumber,
"auto",
isArbitraryVariable,
isArbitraryValue
] }],
"text-transform": [
"uppercase",
"lowercase",
"capitalize",
"normal-case"
],
"text-overflow": [
"truncate",
"text-ellipsis",
"text-clip"
],
"text-wrap": [{ text: [
"wrap",
"nowrap",
"balance",
"pretty"
] }],
indent: [{ indent: scaleUnambiguousSpacing() }],
"tab-size": [{ tab: [
isInteger,
isArbitraryVariable,
isArbitraryValue
] }],
"vertical-align": [{ align: [
"baseline",
"top",
"middle",
"bottom",
"text-top",
"text-bottom",
"sub",
"super",
isArbitraryVariable,
isArbitraryValue
] }],
whitespace: [{ whitespace: [
"normal",
"nowrap",
"pre",
"pre-line",
"pre-wrap",
"break-spaces"
] }],
break: [{ break: [
"normal",
"words",
"all",
"keep"
] }],
wrap: [{ wrap: [
"break-word",
"anywhere",
"normal"
] }],
hyphens: [{ hyphens: [
"none",
"manual",
"auto"
] }],
content: [{ content: [
"none",
isArbitraryVariable,
isArbitraryValue
] }],
"bg-attachment": [{ bg: [
"fixed",
"local",
"scroll"
] }],
"bg-clip": [{ "bg-clip": [
"border",
"padding",
"content",
"text"
] }],
"bg-origin": [{ "bg-origin": [
"border",
"padding",
"content"
] }],
"bg-position": [{ bg: scaleBgPosition() }],
"bg-repeat": [{ bg: scaleBgRepeat() }],
"bg-size": [{ bg: scaleBgSize() }],
"bg-image": [{ bg: [
"none",
{
linear: [
{ to: [
"t",
"tr",
"r",
"br",
"b",
"bl",
"l",
"tl"
] },
isInteger,
isArbitraryVariable,
isArbitraryValue
],
radial: [
"",
isArbitraryVariable,
isArbitraryValue
],
conic: [
isInteger,
isArbitraryVariable,
isArbitraryValue
]
},
isArbitraryVariableImage,
isArbitraryImage
] }],
"bg-color": [{ bg: scaleColor() }],
"gradient-from-pos": [{ from: scaleGradientStopPosition() }],
"gradient-via-pos": [{ via: scaleGradientStopPosition() }],
"gradient-to-pos": [{ to: scaleGradientStopPosition() }],
"gradient-from": [{ from: scaleColor() }],
"gradient-via": [{ via: scaleColor() }],
"gradient-to": [{ to: scaleColor() }],
rounded: [{ rounded: scaleRadius() }],
"rounded-s": [{ "rounded-s": scaleRadius() }],
"rounded-e": [{ "rounded-e": scaleRadius() }],
"rounded-t": [{ "rounded-t": scaleRadius() }],
"rounded-r": [{ "rounded-r": scaleRadius() }],
"rounded-b": [{ "rounded-b": scaleRadius() }],
"rounded-l": [{ "rounded-l": scaleRadius() }],
"rounded-ss": [{ "rounded-ss": scaleRadius() }],
"rounded-se": [{ "rounded-se": scaleRadius() }],
"rounded-ee": [{ "rounded-ee": scaleRadius() }],
"rounded-es": [{ "rounded-es": scaleRadius() }],
"rounded-tl": [{ "rounded-tl": scaleRadius() }],
"rounded-tr": [{ "rounded-tr": scaleRadius() }],
"rounded-br": [{ "rounded-br": scaleRadius() }],
"rounded-bl": [{ "rounded-bl": scaleRadius() }],
"border-w": [{ border: scaleBorderWidth() }],
"border-w-x": [{ "border-x": scaleBorderWidth() }],
"border-w-y": [{ "border-y": scaleBorderWidth() }],
"border-w-s": [{ "border-s": scaleBorderWidth() }],
"border-w-e": [{ "border-e": scaleBorderWidth() }],
"border-w-bs": [{ "border-bs": scaleBorderWidth() }],
"border-w-be": [{ "border-be": scaleBorderWidth() }],
"border-w-t": [{ "border-t": scaleBorderWidth() }],
"border-w-r": [{ "border-r": scaleBorderWidth() }],
"border-w-b": [{ "border-b": scaleBorderWidth() }],
"border-w-l": [{ "border-l": scaleBorderWidth() }],
"divide-x": [{ "divide-x": scaleBorderWidth() }],
"divide-x-reverse": ["divide-x-reverse"],
"divide-y": [{ "divide-y": scaleBorderWidth() }],
"divide-y-reverse": ["divide-y-reverse"],
"border-style": [{ border: [
...scaleLineStyle(),
"hidden",
"none"
] }],
"divide-style": [{ divide: [
...scaleLineStyle(),
"hidden",
"none"
] }],
"border-color": [{ border: scaleColor() }],
"border-color-x": [{ "border-x": scaleColor() }],
"border-color-y": [{ "border-y": scaleColor() }],
"border-color-s": [{ "border-s": scaleColor() }],
"border-color-e": [{ "border-e": scaleColor() }],
"border-color-bs": [{ "border-bs": scaleColor() }],
"border-color-be": [{ "border-be": scaleColor() }],
"border-color-t": [{ "border-t": scaleColor() }],
"border-color-r": [{ "border-r": scaleColor() }],
"border-color-b": [{ "border-b": scaleColor() }],
"border-color-l": [{ "border-l": scaleColor() }],
"divide-color": [{ divide: scaleColor() }],
"outline-style": [{ outline: [
...scaleLineStyle(),
"none",
"hidden"
] }],
"outline-offset": [{ "outline-offset": [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"outline-w": [{ outline: [
"",
isNumber,
isArbitraryVariableLength,
isArbitraryLength
] }],
"outline-color": [{ outline: scaleColor() }],
shadow: [{ shadow: [
"",
"none",
themeShadow,
isArbitraryVariableShadow,
isArbitraryShadow
] }],
"shadow-color": [{ shadow: scaleColor() }],
"inset-shadow": [{ "inset-shadow": [
"none",
themeInsetShadow,
isArbitraryVariableShadow,
isArbitraryShadow
] }],
"inset-shadow-color": [{ "inset-shadow": scaleColor() }],
"ring-w": [{ ring: scaleBorderWidth() }],
"ring-w-inset": ["ring-inset"],
"ring-color": [{ ring: scaleColor() }],
"ring-offset-w": [{ "ring-offset": [isNumber, isArbitraryLength] }],
"ring-offset-color": [{ "ring-offset": scaleColor() }],
"inset-ring-w": [{ "inset-ring": scaleBorderWidth() }],
"inset-ring-color": [{ "inset-ring": scaleColor() }],
"text-shadow": [{ "text-shadow": [
"none",
themeTextShadow,
isArbitraryVariableShadow,
isArbitraryShadow
] }],
"text-shadow-color": [{ "text-shadow": scaleColor() }],
opacity: [{ opacity: [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"mix-blend": [{ "mix-blend": [
...scaleBlendMode(),
"plus-darker",
"plus-lighter"
] }],
"bg-blend": [{ "bg-blend": scaleBlendMode() }],
"mask-clip": [{ "mask-clip": [
"border",
"padding",
"content",
"fill",
"stroke",
"view"
] }, "mask-no-clip"],
"mask-composite": [{ mask: [
"add",
"subtract",
"intersect",
"exclude"
] }],
"mask-image-linear-pos": [{ "mask-linear": [isNumber] }],
"mask-image-linear-from-pos": [{ "mask-linear-from": scaleMaskImagePosition() }],
"mask-image-linear-to-pos": [{ "mask-linear-to": scaleMaskImagePosition() }],
"mask-image-linear-from-color": [{ "mask-linear-from": scaleColor() }],
"mask-image-linear-to-color": [{ "mask-linear-to": scaleColor() }],
"mask-image-t-from-pos": [{ "mask-t-from": scaleMaskImagePosition() }],
"mask-image-t-to-pos": [{ "mask-t-to": scaleMaskImagePosition() }],
"mask-image-t-from-color": [{ "mask-t-from": scaleColor() }],
"mask-image-t-to-color": [{ "mask-t-to": scaleColor() }],
"mask-image-r-from-pos": [{ "mask-r-from": scaleMaskImagePosition() }],
"mask-image-r-to-pos": [{ "mask-r-to": scaleMaskImagePosition() }],
"mask-image-r-from-color": [{ "mask-r-from": scaleColor() }],
"mask-image-r-to-color": [{ "mask-r-to": scaleColor() }],
"mask-image-b-from-pos": [{ "mask-b-from": scaleMaskImagePosition() }],
"mask-image-b-to-pos": [{ "mask-b-to": scaleMaskImagePosition() }],
"mask-image-b-from-color": [{ "mask-b-from": scaleColor() }],
"mask-image-b-to-color": [{ "mask-b-to": scaleColor() }],
"mask-image-l-from-pos": [{ "mask-l-from": scaleMaskImagePosition() }],
"mask-image-l-to-pos": [{ "mask-l-to": scaleMaskImagePosition() }],
"mask-image-l-from-color": [{ "mask-l-from": scaleColor() }],
"mask-image-l-to-color": [{ "mask-l-to": scaleColor() }],
"mask-image-x-from-pos": [{ "mask-x-from": scaleMaskImagePosition() }],
"mask-image-x-to-pos": [{ "mask-x-to": scaleMaskImagePosition() }],
"mask-image-x-from-color": [{ "mask-x-from": scaleColor() }],
"mask-image-x-to-color": [{ "mask-x-to": scaleColor() }],
"mask-image-y-from-pos": [{ "mask-y-from": scaleMaskImagePosition() }],
"mask-image-y-to-pos": [{ "mask-y-to": scaleMaskImagePosition() }],
"mask-image-y-from-color": [{ "mask-y-from": scaleColor() }],
"mask-image-y-to-color": [{ "mask-y-to": scaleColor() }],
"mask-image-radial": [{ "mask-radial": [isArbitraryVariable, isArbitraryValue] }],
"mask-image-radial-from-pos": [{ "mask-radial-from": scaleMaskImagePosition() }],
"mask-image-radial-to-pos": [{ "mask-radial-to": scaleMaskImagePosition() }],
"mask-image-radial-from-color": [{ "mask-radial-from": scaleColor() }],
"mask-image-radial-to-color": [{ "mask-radial-to": scaleColor() }],
"mask-image-radial-shape": [{ "mask-radial": ["circle", "ellipse"] }],
"mask-image-radial-size": [{ "mask-radial": [{
closest: ["side", "corner"],
farthest: ["side", "corner"]
}] }],
"mask-image-radial-pos": [{ "mask-radial-at": scalePosition() }],
"mask-image-conic-pos": [{ "mask-conic": [isNumber] }],
"mask-image-conic-from-pos": [{ "mask-conic-from": scaleMaskImagePosition() }],
"mask-image-conic-to-pos": [{ "mask-conic-to": scaleMaskImagePosition() }],
"mask-image-conic-from-color": [{ "mask-conic-from": scaleColor() }],
"mask-image-conic-to-color": [{ "mask-conic-to": scaleColor() }],
"mask-mode": [{ mask: [
"alpha",
"luminance",
"match"
] }],
"mask-origin": [{ "mask-origin": [
"border",
"padding",
"content",
"fill",
"stroke",
"view"
] }],
"mask-position": [{ mask: scaleBgPosition() }],
"mask-repeat": [{ mask: scaleBgRepeat() }],
"mask-size": [{ mask: scaleBgSize() }],
"mask-type": [{ "mask-type": ["alpha", "luminance"] }],
"mask-image": [{ mask: [
"none",
isArbitraryVariable,
isArbitraryValue
] }],
filter: [{ filter: [
"",
"none",
isArbitraryVariable,
isArbitraryValue
] }],
blur: [{ blur: scaleBlur() }],
brightness: [{ brightness: [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
contrast: [{ contrast: [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"drop-shadow": [{ "drop-shadow": [
"",
"none",
themeDropShadow,
isArbitraryVariableShadow,
isArbitraryShadow
] }],
"drop-shadow-color": [{ "drop-shadow": scaleColor() }],
grayscale: [{ grayscale: [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"hue-rotate": [{ "hue-rotate": [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
invert: [{ invert: [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
saturate: [{ saturate: [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
sepia: [{ sepia: [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-filter": [{ "backdrop-filter": [
"",
"none",
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-blur": [{ "backdrop-blur": scaleBlur() }],
"backdrop-brightness": [{ "backdrop-brightness": [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-contrast": [{ "backdrop-contrast": [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-grayscale": [{ "backdrop-grayscale": [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-hue-rotate": [{ "backdrop-hue-rotate": [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-invert": [{ "backdrop-invert": [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-opacity": [{ "backdrop-opacity": [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-saturate": [{ "backdrop-saturate": [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"backdrop-sepia": [{ "backdrop-sepia": [
"",
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
"border-collapse": [{ border: ["collapse", "separate"] }],
"border-spacing": [{ "border-spacing": scaleUnambiguousSpacing() }],
"border-spacing-x": [{ "border-spacing-x": scaleUnambiguousSpacing() }],
"border-spacing-y": [{ "border-spacing-y": scaleUnambiguousSpacing() }],
"table-layout": [{ table: ["auto", "fixed"] }],
caption: [{ caption: ["top", "bottom"] }],
transition: [{ transition: [
"",
"all",
"colors",
"opacity",
"shadow",
"transform",
"none",
isArbitraryVariable,
isArbitraryValue
] }],
"transition-behavior": [{ transition: ["normal", "discrete"] }],
duration: [{ duration: [
isNumber,
"initial",
isArbitraryVariable,
isArbitraryValue
] }],
ease: [{ ease: [
"linear",
"initial",
themeEase,
isArbitraryVariable,
isArbitraryValue
] }],
delay: [{ delay: [
isNumber,
isArbitraryVariable,
isArbitraryValue
] }],
animate: [{ animate: [
"none",
themeAnimate,
isArbitraryVariable,
isArbitraryValue
] }],
backface: [{ backface: ["hidden", "visible"] }],
perspective: [{ perspective: [
themePerspective,
isArbitraryVariable,
isArbitraryValue
] }],
"perspective-origin": [{ "perspective-origin": scalePositionWithArbitrary() }],
rotate: [{ rotate: scaleRotate() }],
"rotate-x": [{ "rotate-x": scaleRotate() }],
"rotate-y": [{ "rotate-y": scaleRotate() }],
"rotate-z": [{ "rotate-z": scaleRotate() }],
scale: [{ scale: scaleScale() }],
"scale-x": [{ "scale-x": scaleScale() }],
"scale-y": [{ "scale-y": scaleScale() }],
"scale-z": [{ "scale-z": scaleScale() }],
"scale-3d": ["scale-3d"],
skew: [{ skew: scaleSkew() }],
"skew-x": [{ "skew-x": scaleSkew() }],
"skew-y": [{ "skew-y": scaleSkew() }],
transform: [{ transform: [
isArbitraryVariable,
isArbitraryValue,
"",
"none",
"gpu",
"cpu"
] }],
"transform-origin": [{ origin: scalePositionWithArbitrary() }],
"transform-style": [{ transform: ["3d", "flat"] }],
translate: [{ translate: scaleTranslate() }],
"translate-x": [{ "translate-x": scaleTranslate() }],
"translate-y": [{ "translate-y": scaleTranslate() }],
"translate-z": [{ "translate-z": scaleTranslate() }],
"translate-none": ["translate-none"],
zoom: [{ zoom: [
isInteger,
isArbitraryVariable,
isArbitraryValue
] }],
accent: [{ accent: scaleColor() }],
appearance: [{ appearance: ["none", "auto"] }],
"caret-color": [{ caret: scaleColor() }],
"color-scheme": [{ scheme: [
"normal",
"dark",
"light",
"light-dark",
"only-dark",
"only-light"
] }],
cursor: [{ cursor: [
"auto",
"default",
"pointer",
"wait",
"text",
"move",
"help",
"not-allowed",
"none",
"context-menu",
"progress",
"cell",
"crosshair",
"vertical-text",
"alias",
"copy",
"no-drop",
"grab",
"grabbing",
"all-scroll",
"col-resize",
"row-resize",
"n-resize",
"e-resize",
"s-resize",
"w-resize",
"ne-resize",
"nw-resize",
"se-resize",
"sw-resize",
"ew-resize",
"ns-resize",
"nesw-resize",
"nwse-resize",
"zoom-in",
"zoom-out",
isArbitraryVariable,
isArbitraryValue
] }],
"field-sizing": [{ "field-sizing": ["fixed", "content"] }],
"pointer-events": [{ "pointer-events": ["auto", "none"] }],
resize: [{ resize: [
"none",
"",
"y",
"x"
] }],
"scroll-behavior": [{ scroll: ["auto", "smooth"] }],
"scrollbar-thumb-color": [{ "scrollbar-thumb": scaleColor() }],
"scrollbar-track-color": [{ "scrollbar-track": scaleColor() }],
"scrollbar-gutter": [{ "scrollbar-gutter": [
"auto",
"stable",
"both"
] }],
"scrollbar-w": [{ scrollbar: [
"auto",
"thin",
"none"
] }],
"scroll-m": [{ "scroll-m": scaleUnambiguousSpacing() }],
"scroll-mx": [{ "scroll-mx": scaleUnambiguousSpacing() }],
"scroll-my": [{ "scroll-my": scaleUnambiguousSpacing() }],
"scroll-ms": [{ "scroll-ms": scaleUnambiguousSpacing() }],
"scroll-me": [{ "scroll-me": scaleUnambiguousSpacing() }],
"scroll-mbs": [{ "scroll-mbs": scaleUnambiguousSpacing() }],
"scroll-mbe": [{ "scroll-mbe": scaleUnambiguousSpacing() }],
"scroll-mt": [{ "scroll-mt": scaleUnambiguousSpacing() }],
"scroll-mr": [{ "scroll-mr": scaleUnambiguousSpacing() }],
"scroll-mb": [{ "scroll-mb": scaleUnambiguousSpacing() }],
"scroll-ml": [{ "scroll-ml": scaleUnambiguousSpacing() }],
"scroll-p": [{ "scroll-p": scaleUnambiguousSpacing() }],
"scroll-px": [{ "scroll-px": scaleUnambiguousSpacing() }],
"scroll-py": [{ "scroll-py": scaleUnambiguousSpacing() }],
"scroll-ps": [{ "scroll-ps": scaleUnambiguousSpacing() }],
"scroll-pe": [{ "scroll-pe": scaleUnambiguousSpacing() }],
"scroll-pbs": [{ "scroll-pbs": scaleUnambiguousSpacing() }],
"scroll-pbe": [{ "scroll-pbe": scaleUnambiguousSpacing() }],
"scroll-pt": [{ "scroll-pt": scaleUnambiguousSpacing() }],
"scroll-pr": [{ "scroll-pr": scaleUnambiguousSpacing() }],
"scroll-pb": [{ "scroll-pb": scaleUnambiguousSpacing() }],
"scroll-pl": [{ "scroll-pl": scaleUnambiguousSpacing() }],
"snap-align": [{ snap: [
"start",
"end",
"center",
"align-none"
] }],
"snap-stop": [{ snap: ["normal", "always"] }],
"snap-type": [{ snap: [
"none",
"x",
"y",
"both"
] }],
"snap-strictness": [{ snap: ["mandatory", "proximity"] }],
touch: [{ touch: [
"auto",
"none",
"manipulation"
] }],
"touch-x": [{ "touch-pan": [
"x",
"left",
"right"
] }],
"touch-y": [{ "touch-pan": [
"y",
"up",
"down"
] }],
"touch-pz": ["touch-pinch-zoom"],
select: [{ select: [
"none",
"text",
"all",
"auto"
] }],
"will-change": [{ "will-change": [
"auto",
"scroll",
"contents",
"transform",
isArbitraryVariable,
isArbitraryValue
] }],
fill: [{ fill: ["none", ...scaleColor()] }],
"stroke-w": [{ stroke: [
isNumber,
isArbitraryVariableLength,
isArbitraryLength,
isArbitraryNumber
] }],
stroke: [{ stroke: ["none", ...scaleColor()] }],
"forced-color-adjust": [{ "forced-color-adjust": ["auto", "none"] }]
},
conflictingClassGroups: {
"container-named": ["container-type"],
overflow: ["overflow-x", "overflow-y"],
overscroll: ["overscroll-x", "overscroll-y"],
inset: [
"inset-x",
"inset-y",
"inset-bs",
"inset-be",
"start",
"end",
"top",
"right",
"bottom",
"left"
],
"inset-x": ["right", "left"],
"inset-y": ["top", "bottom"],
flex: [
"basis",
"grow",
"shrink"
],
gap: ["gap-x", "gap-y"],
p: [
"px",
"py",
"ps",
"pe",
"pbs",
"pbe",
"pt",
"pr",
"pb",
"pl"
],
px: ["pr", "pl"],
py: ["pt", "pb"],
m: [
"mx",
"my",
"ms",
"me",
"mbs",
"mbe",
"mt",
"mr",
"mb",
"ml"
],
mx: ["mr", "ml"],
my: ["mt", "mb"],
size: ["w", "h"],
"font-size": ["leading"],
"fvn-normal": [
"fvn-ordinal",
"fvn-slashed-zero",
"fvn-figure",
"fvn-spacing",
"fvn-fraction"
],
"fvn-ordinal": ["fvn-normal"],
"fvn-slashed-zero": ["fvn-normal"],
"fvn-figure": ["fvn-normal"],
"fvn-spacing": ["fvn-normal"],
"fvn-fraction": ["fvn-normal"],
"line-clamp": ["display", "overflow"],
rounded: [
"rounded-s",
"rounded-e",
"rounded-t",
"rounded-r",
"rounded-b",
"rounded-l",
"rounded-ss",
"rounded-se",
"rounded-ee",
"rounded-es",
"rounded-tl",
"rounded-tr",
"rounded-br",
"rounded-bl"
],
"rounded-s": ["rounded-ss", "rounded-es"],
"rounded-e": ["rounded-se", "rounded-ee"],
"rounded-t": ["rounded-tl", "rounded-tr"],
"rounded-r": ["rounded-tr", "rounded-br"],
"rounded-b": ["rounded-br", "rounded-bl"],
"rounded-l": ["rounded-tl", "rounded-bl"],
"border-spacing": ["border-spacing-x", "border-spacing-y"],
"border-w": [
"border-w-x",
"border-w-y",
"border-w-s",
"border-w-e",
"border-w-bs",
"border-w-be",
"border-w-t",
"border-w-r",
"border-w-b",
"border-w-l"
],
"border-w-x": ["border-w-r", "border-w-l"],
"border-w-y": ["border-w-t", "border-w-b"],
"border-color": [
"border-color-x",
"border-color-y",
"border-color-s",
"border-color-e",
"border-color-bs",
"border-color-be",
"border-color-t",
"border-color-r",
"border-color-b",
"border-color-l"
],
"border-color-x": ["border-color-r", "border-color-l"],
"border-color-y": ["border-color-t", "border-color-b"],
translate: [
"translate-x",
"translate-y",
"translate-none"
],
"translate-none": [
"translate",
"translate-x",
"translate-y",
"translate-z"
],
"scroll-m": [
"scroll-mx",
"scroll-my",
"scroll-ms",
"scroll-me",
"scroll-mbs",
"scroll-mbe",
"scroll-mt",
"scroll-mr",
"scroll-mb",
"scroll-ml"
],
"scroll-mx": ["scroll-mr", "scroll-ml"],
"scroll-my": ["scroll-mt", "scroll-mb"],
"scroll-p": [
"scroll-px",
"scroll-py",
"scroll-ps",
"scroll-pe",
"scroll-pbs",
"scroll-pbe",
"scroll-pt",
"scroll-pr",
"scroll-pb",
"scroll-pl"
],
"scroll-px": ["scroll-pr", "scroll-pl"],
"scroll-py": ["scroll-pt", "scroll-pb"],
touch: [
"touch-x",
"touch-y",
"touch-pz"
],
"touch-x": ["touch"],
"touch-y": ["touch"],
"touch-pz": ["touch"]
},
conflictingClassGroupModifiers: { "font-size": ["leading"] },
postfixLookupClassGroups: ["container-type"],
orderSensitiveModifiers: [
"*",
"**",
"after",
"backdrop",
"before",
"details-content",
"file",
"first-letter",
"first-line",
"marker",
"placeholder",
"selection"
]
};
};
var twMerge = createTailwindMerge(getDefaultConfig);
function cn(...inputs) {
return twMerge(clsx$1(inputs));
}
function money(n, currency = "USD") {
return new Intl.NumberFormat("en-US", {
style: "currency",
currency,
maximumFractionDigits: 2
}).format(Number.isFinite(n) ? n : 0);
}
function percent(n, digits = 1) {
return `${(Number.isFinite(n) ? n * 100 : 0).toFixed(digits)}%`;
}
function formatDateTime(ms) {
const d = new Date(ms);
const p = (n) => String(n).padStart(2, "0");
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())}T${p(d.getHours())}:${p(d.getMinutes())}`;
}
var root_1$3 = from_html(`<button> </button>`);
var root_2$3 = from_html(`<div></div>`);
var root_3$1 = from_html(`<div class="absolute inset-x-0 flex items-center gap-1 text-xs leading-none"><span class="size-2 shrink-0 rounded-sm"></span> <span class="text-muted-foreground"> </span> <span class="ml-auto tabular-nums"> </span></div>`);
var root_4$1 = from_html(`<p class="text-xs font-medium text-destructive">亏损</p>`);
var root$5 = from_html(`<div class="flex h-full flex-col gap-2"><div class="flex flex-col gap-1"></div> <div class="flex min-h-0 flex-1 gap-1.5"><div class="flex w-5 shrink-0 flex-col overflow-hidden rounded-md border border-border"></div> <div class="relative flex-1"></div></div> <!></div>`);
function CostBar($$anchor, $$props) {
push($$props, true);
const META = {
purchase: {
label: "采购",
color: "#6366f1"
},
freight: {
label: "头程",
color: "#0ea5e9"
},
fba: {
label: "FBA",
color: "#f59e0b"
},
referral: {
label: "佣金",
color: "#ef4444"
},
profit: {
label: "利润",
color: "#22c55e"
}
};
const rows = user_derived(() => {
let acc = 0;
return $$props.segments.filter((s) => s.percent > 0).map((s) => {
const center = acc + s.percent / 2;
acc += s.percent;
return {
...s,
center
};
});
});
const loss = user_derived(() => $$props.segments.some((s) => s.key === "profit" && s.valueUsd < 0));
var div = root$5();
var div_1 = child(div);
each(div_1, 20, () => [["cost", "成本构成"], ["price", "成本/售价"]], ([m, label]) => m, ($$anchor, $$item) => {
var $$array = user_derived(() => to_array($$item, 2));
let m = () => get($$array)[0];
let label = () => get($$array)[1];
var button = root_1$3();
var text = child(button, true);
reset(button);
template_effect(($0) => {
set_class(button, 1, $0);
set_text(text, label());
}, [() => clsx(cn("rounded px-1.5 py-1 text-xs leading-tight transition", $$props.mode === m() ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-accent"))]);
delegated("click", button, () => $$props.onmode(m()));
append($$anchor, button);
});
reset(div_1);
var div_2 = sibling(div_1, 2);
var div_3 = child(div_2);
each(div_3, 21, () => get(rows), (r) => r.key, ($$anchor, r) => {
var div_4 = root_2$3();
template_effect(($0) => {
set_style(div_4, `height: ${get(r).percent * 100}%; background: ${META[get(r).key].color ?? ""};`);
set_attribute(div_4, "title", `${META[get(r).key].label ?? ""} ${$0 ?? ""}`);
}, [() => percent(get(r).percent)]);
append($$anchor, div_4);
});
reset(div_3);
var div_5 = sibling(div_3, 2);
each(div_5, 21, () => get(rows), (r) => r.key, ($$anchor, r) => {
var div_6 = root_3$1();
var span = child(div_6);
var span_1 = sibling(span, 2);
var text_1 = child(span_1, true);
reset(span_1);
var span_2 = sibling(span_1, 2);
var text_2 = child(span_2, true);
reset(span_2);
reset(div_6);
template_effect(($0) => {
set_style(div_6, `top: ${get(r).center * 100}%; transform: translateY(-50%);`);
set_style(span, `background: ${META[get(r).key].color ?? ""};`);
set_text(text_1, META[get(r).key].label);
set_text(text_2, $0);
}, [() => percent(get(r).percent)]);
append($$anchor, div_6);
});
reset(div_5);
reset(div_2);
var node = sibling(div_2, 2);
var consequent = ($$anchor) => {
append($$anchor, root_4$1());
};
if_block(node, ($$render) => {
if (get(loss)) $$render(consequent);
});
reset(div);
append($$anchor, div);
pop();
}
delegate(["click"]);
var root_1$2 = from_html(`<span class="pointer-events-none absolute right-2 text-xs text-muted-foreground"> </span>`);
var root_2$2 = from_html(`<span class="text-xs text-muted-foreground"> </span>`);
var root$4 = from_html(`<label><span class="text-xs font-medium text-muted-foreground"> </span> <div class="relative flex items-center"><input type="number"/> <!></div> <!></label>`);
function NumberField($$anchor, $$props) {
push($$props, true);
let value = prop($$props, "value", 15), unit = prop($$props, "unit", 3, ""), step = prop($$props, "step", 3, "any"), readonly = prop($$props, "readonly", 3, false), hint = prop($$props, "hint", 3, ""), cls = prop($$props, "class", 3, "");
var label_1 = root$4();
var span = child(label_1);
var text = child(span, true);
reset(span);
var div = sibling(span, 2);
var input = child(div);
remove_input_defaults(input);
var node = sibling(input, 2);
var consequent = ($$anchor) => {
var span_1 = root_1$2();
var text_1 = child(span_1, true);
reset(span_1);
template_effect(() => set_text(text_1, unit()));
append($$anchor, span_1);
};
if_block(node, ($$render) => {
if (unit()) $$render(consequent);
});
reset(div);
var node_1 = sibling(div, 2);
var consequent_1 = ($$anchor) => {
var span_2 = root_2$2();
var text_2 = child(span_2, true);
reset(span_2);
template_effect(() => set_text(text_2, hint()));
append($$anchor, span_2);
};
if_block(node_1, ($$render) => {
if (hint()) $$render(consequent_1);
});
reset(label_1);
template_effect(($0, $1) => {
set_class(label_1, 1, $0);
set_text(text, $$props.label);
set_attribute(input, "step", step());
input.readOnly = readonly();
set_class(input, 1, $1);
}, [() => clsx(cn("flex flex-col gap-1", cls())), () => clsx(cn("h-9 w-full rounded-md border border-input bg-background px-2.5 text-sm tabular-nums shadow-sm outline-none", "focus:border-ring focus:ring-2 focus:ring-ring/30", readonly() && "cursor-default bg-muted text-muted-foreground", unit() ? "pr-10" : ""))]);
delegated("change", input, function(...$$args) {
$$props.onchange?.apply(this, $$args);
});
bind_value(input, value);
append($$anchor, label_1);
pop();
}
delegate(["change"]);
var root_1$1 = from_html(`<div class="rounded-md border border-destructive/40 bg-destructive/10 p-2 text-xs text-destructive"> </div>`);
var root_2$1 = from_html(`<option> </option>`);
var root$3 = from_html(`<div class="flex h-full flex-col gap-3"><!> <div><div class="w-32 shrink-0"><!></div> <div class="grid min-h-0 flex-1 grid-cols-2 content-start gap-3 overflow-y-auto pr-1"><!> <div class="flex items-end gap-2"><!> <button class="h-9 shrink-0 rounded-md border border-input px-2.5 text-xs transition hover:bg-accent disabled:opacity-50"> </button></div> <!> <!> <div class="col-span-2 rounded-md border border-border p-3"><div class="flex items-center justify-between"><span class="text-xs font-medium text-muted-foreground">头程物流成本</span> <span class="flex items-center gap-1.5 text-xs"><span> </span> <span class="text-muted-foreground"> </span></span></div> <div class="mt-1 text-base font-semibold tabular-nums"> <span class="text-xs font-normal text-muted-foreground"> </span></div> <div class="mt-2 grid grid-cols-6 gap-2"><!> <label class="col-span-2 flex flex-col gap-1"><span class="text-xs font-medium text-muted-foreground">渠道</span> <select class="h-9 rounded-md border border-input bg-background px-2 text-sm outline-none focus:border-ring focus:ring-2 focus:ring-ring/30"></select></label> <!> <!> <!> <!></div></div> <!> <!></div> <div class="flex w-40 shrink-0 flex-col gap-2.5"><div class="rounded-md border border-border p-3"><div class="text-xs text-muted-foreground">产品毛利</div> <div> </div></div> <div class="rounded-md border border-border p-3"><div class="text-xs text-muted-foreground">毛利率</div> <div> </div></div> <div class="rounded-md bg-muted p-3 text-xs text-muted-foreground"><div class="flex justify-between"><span>总成本</span><span class="tabular-nums"> </span></div></div></div></div></div>`);
function Calculator($$anchor, $$props) {
push($$props, true);
let calc = prop($$props, "calc", 7);
let ratePct = user_derived(() => Math.round(calc().referralRate * 100));
function commitRate() {
const n = Number.isFinite(get(ratePct)) ? Math.max(0, Math.round(get(ratePct))) : 0;
set(ratePct, n);
calc().referralRate = n / 100;
}
const CHANNELS = [
{
value: "sea",
label: "海运"
},
{
value: "air",
label: "空运"
},
{
value: "express",
label: "快递"
}
];
const r2 = (n) => Math.round(n * 100) / 100;
var div = root$3();
var node = child(div);
var consequent = ($$anchor) => {
var div_1 = root_1$1();
var text = child(div_1, true);
reset(div_1);
template_effect(() => set_text(text, calc().error));
append($$anchor, div_1);
};
if_block(node, ($$render) => {
if (calc().error) $$render(consequent);
});
var div_2 = sibling(node, 2);
let classes;
var div_3 = child(div_2);
CostBar(child(div_3), {
get segments() {
return calc().segments;
},
get mode() {
return calc().chartMode;
},
onmode: (m) => calc().chartMode = m
});
reset(div_3);
var div_4 = sibling(div_3, 2);
var node_2 = child(div_4);
NumberField(node_2, {
label: "售价",
get unit() {
return calc().currency;
},
get value() {
return calc().price;
},
set value($$value) {
calc().price = $$value;
}
});
var div_5 = sibling(node_2, 2);
var node_3 = child(div_5);
NumberField(node_3, {
class: "flex-1",
get label() {
return `汇率 (1 ${calc().currency ?? ""}=¥)`;
},
get value() {
return calc().fxRate;
},
set value($$value) {
calc().fxRate = $$value;
}
});
var button = sibling(node_3, 2);
var text_1 = child(button, true);
reset(button);
reset(div_5);
var node_4 = sibling(div_5, 2);
NumberField(node_4, {
label: "采购成本",
unit: "¥",
get value() {
return calc().purchaseCostCny;
},
set value($$value) {
calc().purchaseCostCny = $$value;
}
});
var node_5 = sibling(node_4, 2);
NumberField(node_5, {
label: "FBA 配送费",
get unit() {
return calc().currency;
},
get value() {
return calc().fbaFee;
},
set value($$value) {
calc().fbaFee = $$value;
}
});
var div_6 = sibling(node_5, 2);
var div_7 = child(div_6);
var span = sibling(child(div_7), 2);
var span_1 = child(span);
var text_2 = child(span_1, true);
reset(span_1);
var span_2 = sibling(span_1, 2);
var text_3 = child(span_2);
reset(span_2);
reset(span);
reset(div_7);
var div_8 = sibling(div_7, 2);
var text_4 = child(div_8);
var span_3 = sibling(text_4);
var text_5 = child(span_3);
reset(span_3);
reset(div_8);
var div_9 = sibling(div_8, 2);
var node_6 = child(div_9);
NumberField(node_6, {
class: "col-span-2",
label: "实重",
unit: "kg",
get value() {
return calc().weightKg;
},
set value($$value) {
calc().weightKg = $$value;
}
});
var label = sibling(node_6, 2);
var select = sibling(child(label), 2);
each(select, 21, () => CHANNELS, (c) => c.value, ($$anchor, c) => {
var option = root_2$1();
var text_6 = child(option, true);
reset(option);
var option_value = {};
template_effect(() => {
set_text(text_6, get(c).label);
if (option_value !== (option_value = get(c).value)) option.value = (option.__value = get(c).value) ?? "";
});
append($$anchor, option);
});
reset(select);
reset(label);
var node_7 = sibling(label, 2);
NumberField(node_7, {
class: "col-span-2",
label: "运费",
unit: "¥/kg",
get value() {
return calc().freightRates[calc().channel];
},
set value($$value) {
calc().freightRates[calc().channel] = $$value;
}
});
var node_8 = sibling(node_7, 2);
NumberField(node_8, {
class: "col-span-2",
label: "长",
unit: "cm",
get value() {
return calc().lengthCm;
},
set value($$value) {
calc().lengthCm = $$value;
}
});
var node_9 = sibling(node_8, 2);
NumberField(node_9, {
class: "col-span-2",
label: "宽",
unit: "cm",
get value() {
return calc().widthCm;
},
set value($$value) {
calc().widthCm = $$value;
}
});
NumberField(sibling(node_9, 2), {
class: "col-span-2",
label: "高",
unit: "cm",
get value() {
return calc().heightCm;
},
set value($$value) {
calc().heightCm = $$value;
}
});
reset(div_9);
reset(div_6);
var node_11 = sibling(div_6, 2);
NumberField(node_11, {
label: "佣金费率",
unit: "%",
step: 1,
onchange: commitRate,
get value() {
return get(ratePct);
},
set value($$value) {
set(ratePct, $$value);
}
});
var node_12 = sibling(node_11, 2);
{
let $0 = user_derived(() => r2(calc().result.breakdown.referral));
NumberField(node_12, {
label: "佣金",
get unit() {
return calc().currency;
},
get value() {
return get($0);
},
readonly: true
});
}
reset(div_4);
var div_10 = sibling(div_4, 2);
var div_11 = child(div_10);
var div_12 = sibling(child(div_11), 2);
var text_7 = child(div_12, true);
reset(div_12);
reset(div_11);
var div_13 = sibling(div_11, 2);
var div_14 = sibling(child(div_13), 2);
var text_8 = child(div_14, true);
reset(div_14);
reset(div_13);
var div_15 = sibling(div_13, 2);
var div_16 = child(div_15);
var span_4 = sibling(child(div_16));
var text_9 = child(span_4, true);
reset(span_4);
reset(div_16);
reset(div_15);
reset(div_10);
reset(div_2);
reset(div);
template_effect(($0, $1, $2, $3, $4, $5, $6, $7, $8) => {
classes = set_class(div_2, 1, "flex min-h-0 flex-1 gap-4", null, classes, { "opacity-50": calc().loading });
button.disabled = calc().fxUpdating;
set_text(text_1, calc().fxUpdating ? "…" : "更新");
set_class(span_1, 1, $0);
set_text(text_2, calc().freight.isBulky ? "抛货" : "重货");
set_text(text_3, `抛重比 ${$1 ?? ""}`);
set_text(text_4, `¥${$2 ?? ""} `);
set_text(text_5, `(计费重 ${$3 ?? ""}kg)`);
set_class(div_12, 1, $4);
set_text(text_7, $5);
set_class(div_14, 1, $6);
set_text(text_8, $7);
set_text(text_9, $8);
}, [
() => clsx(cn("rounded px-1.5 py-0.5", calc().freight.isBulky ? "bg-sky-100 text-sky-700" : "bg-amber-100 text-amber-700")),
() => Number.isFinite(calc().freight.dimRatio) ? calc().freight.dimRatio.toFixed(2) : "—",
() => r2(calc().freight.freightCny),
() => r2(calc().freight.billableWeightKg),
() => clsx(cn("mt-0.5 text-xl font-bold tabular-nums", calc().result.grossProfit >= 0 ? "text-emerald-600" : "text-destructive")),
() => money(calc().result.grossProfit, calc().currency),
() => clsx(cn("mt-0.5 text-xl font-bold tabular-nums", calc().result.margin >= 0 ? "text-emerald-600" : "text-destructive")),
() => percent(calc().result.margin),
() => money(calc().result.totalCostUsd, calc().currency)
]);
delegated("click", button, () => calc().updateFx());
bind_select_value(select, () => calc().channel, ($$value) => calc().channel = $$value);
append($$anchor, div);
pop();
}
delegate(["click"]);
var root$2 = from_html(`<div class="flex h-full flex-col gap-4 overflow-y-auto"><section class="flex flex-col gap-2"><h3 class="text-xs font-semibold text-foreground">汇率</h3> <div class="flex items-end gap-2"><!> <button class="h-9 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground transition hover:opacity-90 disabled:opacity-50"> </button></div></section> <section class="flex flex-col gap-2"><h3 class="text-xs font-semibold text-foreground">头程运费 (¥/kg)</h3> <div class="grid grid-cols-3 gap-2"><!> <!> <!></div></section> <!></div>`);
function Settings($$anchor, $$props) {
push($$props, true);
let calc = prop($$props, "calc", 7);
user_effect(() => {
calc().freightRates.sea;
calc().freightRates.air;
calc().freightRates.express;
calc().persistFreight();
});
var div = root$2();
var section = child(div);
var div_1 = sibling(child(section), 2);
var node = child(div_1);
{
let $0 = user_derived(() => calc().fxUpdatedAt ? `最近更新 ${formatDateTime(calc().fxUpdatedAt)}` : "尚未更新");
NumberField(node, {
class: "flex-1",
get label() {
return `1 ${calc().currency ?? ""} = ¥`;
},
get hint() {
return get($0);
},
get value() {
return calc().fxRate;
},
set value($$value) {
calc().fxRate = $$value;
}
});
}
var button = sibling(node, 2);
var text = child(button, true);
reset(button);
reset(div_1);
reset(section);
var section_1 = sibling(section, 2);
var div_2 = sibling(child(section_1), 2);
var node_1 = child(div_2);
NumberField(node_1, {
label: "海运",
unit: "¥/kg",
get value() {
return calc().freightRates.sea;
},
set value($$value) {
calc().freightRates.sea = $$value;
}
});
var node_2 = sibling(node_1, 2);
NumberField(node_2, {
label: "空运",
unit: "¥/kg",
get value() {
return calc().freightRates.air;
},
set value($$value) {
calc().freightRates.air = $$value;
}
});
NumberField(sibling(node_2, 2), {
label: "快递",
unit: "¥/kg",
get value() {
return calc().freightRates.express;
},
set value($$value) {
calc().freightRates.express = $$value;
}
});
reset(div_2);
reset(section_1);
snippet(sibling(section_1, 2), () => $$props.children ?? noop);
reset(div);
template_effect(() => {
button.disabled = calc().fxUpdating;
set_text(text, calc().fxUpdating ? "更新中…" : "更新汇率");
});
delegated("click", button, () => calc().updateFx());
append($$anchor, div);
pop();
}
delegate(["click"]);
function detectAsin() {
const m = location.href.match(/\/(?:dp|gp\/product|gp\/aw\/d|product)\/([A-Z0-9]{10})(?:[/?]|$)/);
if (m?.[1]) return m[1];
for (const el of document.querySelectorAll("[data-asin]")) {
const v = el.dataset.asin ?? "";
if (/^[A-Z0-9]{10}$/.test(v)) return v;
}
const input = document.querySelector("input#ASIN, input[name='ASIN']");
if (input && /^[A-Z0-9]{10}$/.test(input.value)) return input.value;
return "";
}
function parseHeaders(raw) {
const out = {};
if (!raw) return out;
for (const line of raw.split(/\r?\n/)) {
const i = line.indexOf(":");
if (i > 0) out[line.slice(0, i).trim().toLowerCase()] = line.slice(i + 1).trim();
}
return out;
}
var gmHttp = { request: ({ url, method = "GET", headers, body }) => new Promise((resolve, reject) => {
GM_xmlhttpRequest({
url,
method,
headers,
data: body,
onload: (res) => resolve({
status: res.status,
text: res.responseText,
headers: parseHeaders(res.responseHeaders)
}),
onerror: () => reject(new Error(`网络请求失败: ${url}`)),
ontimeout: () => reject(new Error(`请求超时: ${url}`))
});
}) };
var gmStore = {
get(key) {
return GM_getValue(key, void 0);
},
set(key, value) {
GM_setValue(key, value);
},
remove(key) {
GM_deleteValue(key);
}
};
var KEY = "revcal:worker";
var DEFAULT_WORKER_BASE_URL = "https://revcal-web.ricky9w.workers.dev";
function getWorkerConfig(store) {
const saved = store.get(KEY) ?? {};
return {
baseUrl: saved.baseUrl?.trim() || "https://revcal-web.ricky9w.workers.dev",
cfClientId: saved.cfClientId ?? "",
cfClientSecret: saved.cfClientSecret ?? ""
};
}
function setWorkerConfig(store, cfg) {
store.set(KEY, {
baseUrl: cfg.baseUrl.trim(),
cfClientId: cfg.cfClientId.trim(),
cfClientSecret: cfg.cfClientSecret.trim()
});
}
function createWorkerFetcher(http, store) {
return async (asin, marketplace) => {
const cfg = getWorkerConfig(store);
if (!cfg.cfClientId || !cfg.cfClientSecret) throw new Error("未配置 Cloudflare Access 凭据:请在「设置 · 数据源」填写 Service Token");
const url = `${cfg.baseUrl.replace(/\/+$/, "")}/api/product?asin=${encodeURIComponent(asin)}&marketplace=${encodeURIComponent(marketplace)}`;
const res = await http.request({
url,
method: "GET",
headers: {
"CF-Access-Client-Id": cfg.cfClientId,
"CF-Access-Client-Secret": cfg.cfClientSecret
}
});
if (res.status < 200 || res.status >= 300) {
if (res.status === 401 || res.status === 403) throw new Error("Cloudflare Access 认证失败(" + res.status + "):请检查设置中的 Service Token 是否正确、且已在 Access 策略中放行");
let msg = `取数失败(HTTP ${res.status})`;
try {
const body = JSON.parse(res.text);
if (body?.message) msg = body.message;
} catch {
msg = `取数失败(HTTP ${res.status});若返回了登录页,请确认 Service Token 配置`;
}
throw new Error(msg);
}
try {
return JSON.parse(res.text);
} catch {
throw new Error("Worker 返回了非预期内容(可能被 Cloudflare Access 拦截):请检查 Service Token 配置");
}
};
}
var root$1 = from_html(`<section class="flex flex-col gap-2"><h3 class="text-xs font-semibold text-foreground">数据源 · Worker (SP-API)</h3> <p class="text-xs text-muted-foreground">取数经你的 Cloudflare Worker。Worker 受 Cloudflare Access 保护,需在 Zero Trust 创建
Service Token 并在 Access 策略中放行;凭据存于 Tampermonkey 沙箱存储,页面无法读取。</p> <label class="flex flex-col gap-1"><span class="text-xs text-muted-foreground">Worker 地址</span> <input spellcheck="false"/></label> <label class="flex flex-col gap-1"><span class="text-xs text-muted-foreground">CF-Access-Client-Id</span> <input autocomplete="off" spellcheck="false"/></label> <label class="flex flex-col gap-1"><span class="text-xs text-muted-foreground">CF-Access-Client-Secret</span> <div class="flex gap-2"><input autocomplete="off" spellcheck="false"/> <button type="button" class="h-9 shrink-0 rounded-md border border-input px-2 text-xs transition hover:bg-accent"> </button></div></label> <button class="h-9 self-start rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground transition hover:opacity-90"> </button></section>`);
function WorkerCredentials($$anchor, $$props) {
push($$props, true);
const initial = getWorkerConfig(gmStore);
let baseUrl = state(proxy(initial.baseUrl));
let cfClientId = state(proxy(initial.cfClientId));
let cfClientSecret = state(proxy(initial.cfClientSecret));
let showSecret = state(false);
let saved = state(false);
function save() {
setWorkerConfig(gmStore, {
baseUrl: get(baseUrl),
cfClientId: get(cfClientId),
cfClientSecret: get(cfClientSecret)
});
set(saved, true);
setTimeout(() => set(saved, false), 1500);
}
const inputCls = "h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:ring-2 focus:ring-ring";
var section = root$1();
var label = sibling(child(section), 4);
var input = sibling(child(label), 2);
remove_input_defaults(input);
set_class(input, 1, clsx(inputCls));
reset(label);
var label_1 = sibling(label, 2);
var input_1 = sibling(child(label_1), 2);
remove_input_defaults(input_1);
set_class(input_1, 1, clsx(inputCls));
reset(label_1);
var label_2 = sibling(label_1, 2);
var div = sibling(child(label_2), 2);
var input_2 = child(div);
remove_input_defaults(input_2);
set_class(input_2, 1, clsx(inputCls));
var button = sibling(input_2, 2);
var text = child(button, true);
reset(button);
reset(div);
reset(label_2);
var button_1 = sibling(label_2, 2);
var text_1 = child(button_1, true);
reset(button_1);
reset(section);
template_effect(() => {
set_attribute(input, "placeholder", DEFAULT_WORKER_BASE_URL);
set_attribute(input_2, "type", get(showSecret) ? "text" : "password");
set_text(text, get(showSecret) ? "隐藏" : "显示");
set_text(text_1, get(saved) ? "已保存 ✓" : "保存凭据");
});
bind_value(input, () => get(baseUrl), ($$value) => set(baseUrl, $$value));
bind_value(input_1, () => get(cfClientId), ($$value) => set(cfClientId, $$value));
bind_value(input_2, () => get(cfClientSecret), ($$value) => set(cfClientSecret, $$value));
delegated("click", button, () => set(showSecret, !get(showSecret)));
delegated("click", button_1, save);
append($$anchor, section);
pop();
}
delegate(["click"]);
var root_2 = from_html(`<span class="rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-muted-foreground"> </span>`);
var root_3 = from_html(`<button>设置</button>`);
var root_4 = from_html(`<button>返回</button>`);
var root_1 = from_html(`<div role="presentation" class="fixed inset-0 z-[2147483647] flex items-center justify-center bg-black/50 p-4"><div role="dialog" aria-modal="true" aria-label="利润计算器" class="flex h-[clamp(540px,76vh,720px)] max-h-[92vh] w-[clamp(680px,70vw,1080px)] max-w-[95vw] flex-col overflow-hidden rounded-xl border border-border bg-background shadow-2xl"><div class="flex items-center gap-2 border-b border-border px-4 py-2.5"><span class="text-sm font-semibold">利润计算器</span> <!> <div class="ml-auto flex items-center gap-1"><button>刷新</button> <!> <button aria-label="关闭">✕</button></div></div> <div class="min-h-0 flex-1 p-4"><!></div></div></div>`);
var root = from_html(`<button class="fixed bottom-6 right-6 z-[2147483647] flex size-12 items-center justify-center rounded-full bg-primary text-xl font-bold text-primary-foreground shadow-lg transition hover:scale-105" title="利润计算器">¥</button> <!>`, 1);
function App($$anchor, $$props) {
push($$props, true);
const calc = new CalcState(gmHttp, gmStore, createWorkerFetcher(gmHttp, gmStore));
let open = state(false);
let view = state("calc");
let loadedOnce = false;
function show() {
set(open, true);
set(view, "calc");
if (!loadedOnce) {
loadedOnce = true;
calc.loadProduct(detectAsin());
}
}
const close = () => set(open, false);
const refresh = () => calc.loadProduct(detectAsin());
const headerBtn = "rounded border border-input px-2 py-1 text-xs transition hover:bg-accent disabled:opacity-50";
var fragment = root();
event("keydown", $window, (e) => get(open) && e.key === "Escape" && close());
var button = first_child(fragment);
var node = sibling(button, 2);
var consequent_3 = ($$anchor) => {
var div = root_1();
var div_1 = child(div);
var div_2 = child(div_1);
var node_1 = sibling(child(div_2), 2);
var consequent = ($$anchor) => {
var span = root_2();
var text = child(span, true);
reset(span);
template_effect(() => set_text(text, calc.asin));
append($$anchor, span);
};
if_block(node_1, ($$render) => {
if (calc.asin) $$render(consequent);
});
var div_3 = sibling(node_1, 2);
var button_1 = child(div_3);
set_class(button_1, 1, clsx(headerBtn));
var node_2 = sibling(button_1, 2);
var consequent_1 = ($$anchor) => {
var button_2 = root_3();
set_class(button_2, 1, clsx(headerBtn));
delegated("click", button_2, () => set(view, "settings"));
append($$anchor, button_2);
};
var alternate = ($$anchor) => {
var button_3 = root_4();
set_class(button_3, 1, clsx(headerBtn));
delegated("click", button_3, () => set(view, "calc"));
append($$anchor, button_3);
};
if_block(node_2, ($$render) => {
if (get(view) === "calc") $$render(consequent_1);
else $$render(alternate, -1);
});
var button_4 = sibling(node_2, 2);
set_class(button_4, 1, clsx(headerBtn));
reset(div_3);
reset(div_2);
var div_4 = sibling(div_2, 2);
var node_3 = child(div_4);
var consequent_2 = ($$anchor) => {
Calculator($$anchor, { get calc() {
return calc;
} });
};
var alternate_1 = ($$anchor) => {
Settings($$anchor, {
get calc() {
return calc;
},
children: ($$anchor, $$slotProps) => {
WorkerCredentials($$anchor, {});
},
$$slots: { default: true }
});
};
if_block(node_3, ($$render) => {
if (get(view) === "calc") $$render(consequent_2);
else $$render(alternate_1, -1);
});
reset(div_4);
reset(div_1);
reset(div);
template_effect(() => button_1.disabled = calc.loading);
delegated("click", div, (e) => e.target === e.currentTarget && close());
delegated("click", button_1, refresh);
delegated("click", button_4, close);
append($$anchor, div);
};
if_block(node, ($$render) => {
if (get(open)) $$render(consequent_3);
});
delegated("click", button, show);
append($$anchor, fragment);
pop();
}
delegate(["click"]);
var app_default = "/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */\n@layer properties{*,:before,:after,::backdrop{--tw-border-style:solid;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--color-amber-100:oklch(96.2% .059 95.617);--color-amber-700:oklch(55.5% .163 48.998);--color-emerald-600:oklch(59.6% .145 163.225);--color-sky-100:oklch(95.1% .026 236.824);--color-sky-700:oklch(50% .134 242.749);--color-black:#000;--spacing:.25rem;--text-xs:.8125rem;--text-xs--line-height:1.45;--text-sm:.9375rem;--text-sm--line-height:1.45;--text-base:1.0625rem;--text-base--line-height:1.5;--text-xl:1.5rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--leading-tight:1.25;--radius-xl:.75rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing) * 0)}.inset-x-0{inset-inline:calc(var(--spacing) * 0)}.right-2{right:calc(var(--spacing) * 2)}.right-6{right:calc(var(--spacing) * 6)}.bottom-6{bottom:calc(var(--spacing) * 6)}.z-\\[2147483647\\]{z-index:2147483647}.col-span-2{grid-column:span 2/span 2}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.flex{display:flex}.grid{display:grid}.size-2{width:calc(var(--spacing) * 2);height:calc(var(--spacing) * 2)}.size-12{width:calc(var(--spacing) * 12);height:calc(var(--spacing) * 12)}.h-9{height:calc(var(--spacing) * 9)}.h-\\[clamp\\(540px\\,76vh\\,720px\\)\\]{height:clamp(540px,76vh,720px)}.h-full{height:100%}.max-h-\\[92vh\\]{max-height:92vh}.min-h-0{min-height:calc(var(--spacing) * 0)}.w-5{width:calc(var(--spacing) * 5)}.w-32{width:calc(var(--spacing) * 32)}.w-40{width:calc(var(--spacing) * 40)}.w-\\[clamp\\(680px\\,70vw\\,1080px\\)\\]{width:clamp(680px,70vw,1080px)}.w-full{width:100%}.max-w-\\[95vw\\]{max-width:95vw}.flex-1{flex:1}.shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-default{cursor:default}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-col{flex-direction:column}.content-start{align-content:flex-start}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.self-start{align-self:flex-start}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:var(--radius-xl)}.border{border-style:var(--tw-border-style);border-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-border{border-color:var(--border)}.border-destructive\\/40{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.border-destructive\\/40{border-color:color-mix(in oklab, var(--destructive) 40%, transparent)}}.border-input{border-color:var(--input)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-background{background-color:var(--background)}.bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-destructive\\/10{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.bg-destructive\\/10{background-color:color-mix(in oklab, var(--destructive) 10%, transparent)}}.bg-muted{background-color:var(--muted)}.bg-primary{background-color:var(--primary)}.bg-sky-100{background-color:var(--color-sky-100)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.px-1\\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2\\.5{padding-block:calc(var(--spacing) * 2.5)}.pr-1{padding-right:calc(var(--spacing) * 1)}.pr-10{padding-right:calc(var(--spacing) * 10)}.font-mono{font-family:var(--font-mono)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-none{--tw-leading:1;line-height:1}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-amber-700{color:var(--color-amber-700)}.text-destructive{color:var(--destructive)}.text-emerald-600{color:var(--color-emerald-600)}.text-foreground{color:var(--foreground)}.text-muted-foreground{color:var(--muted-foreground)}.text-primary-foreground{color:var(--primary-foreground)}.text-sky-700{color:var(--color-sky-700)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.opacity-50{opacity:.5}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.outline-none{--tw-outline-style:none;outline-style:none}@media (hover:hover){.hover\\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\\:bg-accent:hover{background-color:var(--accent)}.hover\\:opacity-90:hover{opacity:.9}}.focus\\:border-ring:focus{border-color:var(--ring)}.focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\\:ring-ring:focus,.focus\\:ring-ring\\/30:focus{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.focus\\:ring-ring\\/30:focus{--tw-ring-color:color-mix(in oklab, var(--ring) 30%, transparent)}}.disabled\\:opacity-50:disabled{opacity:.5}}:host{--radius:.625rem;--background:oklch(100% 0 0);--foreground:oklch(14.1% .005 285.823);--card:oklch(100% 0 0);--card-foreground:oklch(14.1% .005 285.823);--primary:oklch(21% .006 285.885);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(96.7% .001 286.375);--secondary-foreground:oklch(21% .006 285.885);--muted:oklch(96.7% .001 286.375);--muted-foreground:oklch(55.2% .016 285.938);--accent:oklch(96.7% .001 286.375);--accent-foreground:oklch(21% .006 285.885);--destructive:oklch(57.7% .245 27.325);--border:oklch(92% .004 286.32);--input:oklch(87.1% .006 286.286);--ring:oklch(70.5% .015 286.067);color:var(--foreground);font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;line-height:1.4}input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}input[type=number]{appearance:textfield}@property --tw-rotate-x{syntax:\"*\";inherits:false}@property --tw-rotate-y{syntax:\"*\";inherits:false}@property --tw-rotate-z{syntax:\"*\";inherits:false}@property --tw-skew-x{syntax:\"*\";inherits:false}@property --tw-skew-y{syntax:\"*\";inherits:false}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-ordinal{syntax:\"*\";inherits:false}@property --tw-slashed-zero{syntax:\"*\";inherits:false}@property --tw-numeric-figure{syntax:\"*\";inherits:false}@property --tw-numeric-spacing{syntax:\"*\";inherits:false}@property --tw-numeric-fraction{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-scale-x{syntax:\"*\";inherits:false;initial-value:1}@property --tw-scale-y{syntax:\"*\";inherits:false;initial-value:1}@property --tw-scale-z{syntax:\"*\";inherits:false;initial-value:1}";
var _style = (b, a = document.createElement("style")) => (a.append(b), a);
var app_css_default = _style(app_default);
var host = document.createElement("div");
host.id = "revcal-root";
document.body.appendChild(host);
var shadow = host.attachShadow({ mode: "open" });
shadow.appendChild(app_css_default);
mount(App, { target: shadow });
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment