@inkandswitch/patchwork-pkg-base 0.0.38 → 0.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/drafts/dist/assets/{DraftListProvider-D3dHIGmO.js → DraftListProvider-D41q9O5B.js} +3 -2
- package/packages/drafts/dist/assets/{DraftListProvider-D3dHIGmO.js.map → DraftListProvider-D41q9O5B.js.map} +1 -1
- package/packages/drafts/dist/assets/{DraftOverlayProvider-Cae4SJD7.js → DraftOverlayProvider-B0Mtq1UF.js} +3 -2
- package/packages/drafts/dist/assets/{DraftOverlayProvider-Cae4SJD7.js.map → DraftOverlayProvider-B0Mtq1UF.js.map} +1 -1
- package/packages/drafts/dist/assets/{index-DAqs20jZ.js → index-FKZtof6Z.js} +6 -4
- package/packages/drafts/dist/assets/index-FKZtof6Z.js.map +1 -0
- package/packages/drafts/dist/assets/{main-9LQJEnZS.js → main-Cp8VsNHh.js} +22 -1197
- package/packages/drafts/dist/assets/main-Cp8VsNHh.js.map +1 -0
- package/packages/drafts/dist/index.js +5 -5
- package/packages/drafts/package.json +11 -11
- package/packages/sync-indicator/dist/assets/SyncIndicator-DxVkpuKE.js.map +1 -1
- package/packages/tldraw4/dist/tool.js +2 -2
- package/packages/tldraw4/dist/tool.js.map +1 -1
- package/packages/tldraw5/dist/tool.js +2 -2
- package/packages/tldraw5/dist/tool.js.map +1 -1
- package/packages/drafts/dist/assets/index-DAqs20jZ.js.map +0 -1
- package/packages/drafts/dist/assets/main-9LQJEnZS.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SyncIndicator-DxVkpuKE.js","sources":["../../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js","../../../node_modules/.pnpm/debug@4.4.3_supports-color@7.2.0/node_modules/debug/src/common.js","../../../node_modules/.pnpm/debug@4.4.3_supports-color@7.2.0/node_modules/debug/src/browser.js","../../../node_modules/.pnpm/cabbages@0.2.10_supports-color@7.2.0/node_modules/cabbages/output/cabbages.js","../../../node_modules/.pnpm/solid-automerge@2.0.1_@automerge+automerge-repo@2.6.0-subduction.39_supports-color@7.2._227dd52f84bb1cffabe2033f455b43b1/node_modules/solid-automerge/out/context.js","../../../node_modules/.pnpm/solid-automerge@2.0.1_@automerge+automerge-repo@2.6.0-subduction.39_supports-color@7.2._227dd52f84bb1cffabe2033f455b43b1/node_modules/solid-automerge/out/useRepo.js","../../../node_modules/.pnpm/@inkandswitch+patchwork-bootloader@0.3.2_@automerge+automerge-repo-keyhive@0.3.0-alpha._aa65a3e278e618fbe96d7480f82f9381/node_modules/@inkandswitch/patchwork-bootloader/dist/types.js","../../src/lib/relative-time.ts","../../src/lib/ui/Button.tsx","../../src/lib/ui/Popover.tsx","../../src/SyncIcon.tsx","../../src/CopyIcon.tsx","../../src/SyncIndicator.tsx"],"sourcesContent":["/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function (val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '')\n\t\t\t.trim()\n\t\t\t.replace(/\\s+/g, ',')\n\t\t\t.split(',')\n\t\t\t.filter(Boolean);\n\n\t\tfor (const ns of split) {\n\t\t\tif (ns[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(ns.slice(1));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(ns);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the given string matches a namespace template, honoring\n\t * asterisks as wildcards.\n\t *\n\t * @param {String} search\n\t * @param {String} template\n\t * @return {Boolean}\n\t */\n\tfunction matchesTemplate(search, template) {\n\t\tlet searchIndex = 0;\n\t\tlet templateIndex = 0;\n\t\tlet starIndex = -1;\n\t\tlet matchIndex = 0;\n\n\t\twhile (searchIndex < search.length) {\n\t\t\tif (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {\n\t\t\t\t// Match character or proceed with wildcard\n\t\t\t\tif (template[templateIndex] === '*') {\n\t\t\t\t\tstarIndex = templateIndex;\n\t\t\t\t\tmatchIndex = searchIndex;\n\t\t\t\t\ttemplateIndex++; // Skip the '*'\n\t\t\t\t} else {\n\t\t\t\t\tsearchIndex++;\n\t\t\t\t\ttemplateIndex++;\n\t\t\t\t}\n\t\t\t} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition\n\t\t\t\t// Backtrack to the last '*' and try to match more characters\n\t\t\t\ttemplateIndex = starIndex + 1;\n\t\t\t\tmatchIndex++;\n\t\t\t\tsearchIndex = matchIndex;\n\t\t\t} else {\n\t\t\t\treturn false; // No match\n\t\t\t}\n\t\t}\n\n\t\t// Handle trailing '*' in template\n\t\twhile (templateIndex < template.length && template[templateIndex] === '*') {\n\t\t\ttemplateIndex++;\n\t\t}\n\n\t\treturn templateIndex === template.length;\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names,\n\t\t\t...createDebug.skips.map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tfor (const skip of createDebug.skips) {\n\t\t\tif (matchesTemplate(name, skip)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (const ns of createDebug.names) {\n\t\t\tif (matchesTemplate(name, ns)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\tlet m;\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\t// eslint-disable-next-line no-return-assign\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)) && parseInt(m[1], 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n","// cabbages.ts\nimport debug from \"debug\";\nvar log = debug(\"cabbages\");\nfunction pojo(target) {\n return typeof target == \"object\" && typeof target != null && Object.getPrototypeOf(target) == Object.prototype;\n}\nvar BLOCK_MARKER = \"\\uFFFC\";\nfunction apply(target, ...rest) {\n if (rest.length == 0) {\n log(\"empty patch\");\n return;\n }\n const [path, range, val] = rest;\n let p = [...path];\n while (true) {\n let key = p.shift();\n if (!p.length) {\n const RANGE_ARRAY = Array.isArray(range);\n if (pojo(target) && RANGE_ARRAY && typeof key == \"undefined\" && typeof range[0] == \"string\") {\n delete target[range[0]];\n return;\n }\n if (RANGE_ARRAY || typeof range == \"number\") {\n if (typeof key == \"undefined\") {\n throw new Error(\"cant treat top level as a seq\");\n }\n key = key;\n let [start, end] = Array.isArray(range) ? range : [range, range + 1];\n const ZERO_LENGTH = Array.isArray(range) && range.length == 0;\n if (!ZERO_LENGTH && (start == null || end == null)) {\n throw new RangeError(\"it's all or nothing, no half measures\");\n }\n const DELETE = typeof val == \"undefined\";\n const INSERT = start === end && !DELETE;\n const APPEND = ZERO_LENGTH && !DELETE;\n const REPLACE = !INSERT && !DELETE && !APPEND;\n if (typeof target[key] == \"undefined\") {\n if (typeof target == \"string\") {\n return;\n } else if (typeof val == \"string\") {\n target[key] = \"\";\n } else {\n target[key] = [];\n }\n }\n let seq = target[key];\n if (Array.isArray(seq)) {\n if (APPEND) {\n Array.isArray(val) ? seq.push(...val) : seq.push(val);\n return;\n }\n if (INSERT || REPLACE) {\n Array.isArray(val) ? seq.splice(start, end - start, ...val) : seq.splice(start, end - start, val);\n return;\n }\n if (DELETE) {\n seq.splice(start, end - start);\n return;\n }\n throw new Error(\"i don't know what happened\");\n }\n if (typeof seq == \"string\") {\n if (APPEND) {\n target[key] = seq + val;\n return;\n }\n if (REPLACE || INSERT) {\n target[key] = seq.slice(0, start) + (typeof val == \"string\" ? val : val.map(\n (n) => typeof n == \"string\" ? n : BLOCK_MARKER\n ).join(\"\")) + seq.slice(end);\n return;\n }\n if (DELETE) {\n target[key] = seq.slice(0, start) + seq.slice(end);\n return;\n }\n throw new Error(\"i don't know what happened\");\n }\n if (pojo(seq) && RANGE_ARRAY && typeof range[0] == \"string\") {\n delete seq[range[0]];\n return;\n }\n throw new Error(\"not implemented\");\n }\n if (typeof key == \"undefined\") {\n if (typeof range != \"string\") {\n throw new Error(`can't index top-level map with ${range}`);\n }\n if (typeof val == \"undefined\") {\n delete target[range];\n } else {\n target[range] = val;\n }\n return;\n }\n if (typeof target[key] == \"undefined\") {\n target[key] = {};\n }\n if (RANGE_ARRAY) {\n let [a, b] = range;\n if (a != null && b != null) {\n if (typeof val == \"undefined\" && a != null && b != null) {\n delete target[key][a || b];\n } else {\n target[key][a || b] = val;\n }\n }\n } else {\n if (typeof val == \"undefined\") {\n delete target[key][range];\n } else if (typeof target[key] == \"string\") {\n return;\n } else {\n target[key][range] = val;\n }\n }\n return;\n }\n if (typeof key == \"undefined\") {\n throw new Error(\"cant treat top level as a seq\");\n }\n key = key;\n let nextkey = p[0];\n if (typeof target[key] == \"undefined\") {\n if (typeof nextkey == \"string\") {\n target[key] = {};\n } else if (typeof nextkey == \"number\") {\n target[key] = [];\n } else {\n throw new Error(`can't go down this road ${target}.${key}.${nextkey}`);\n }\n }\n target = target[key];\n }\n}\nvar patch = apply;\nfunction get(obj, key) {\n for (let p = 0; p < key.length; p++) {\n obj = obj ? obj[key[p]] : void 0;\n }\n return obj;\n}\nfunction fromAutomerge(autopatch, payload) {\n const path = autopatch.path.slice(0, -1);\n const key = autopatch.path[autopatch.path.length - 1];\n switch (autopatch.action) {\n case \"mark\":\n case \"unmark\":\n log(\n `skipping ${autopatch.action} because it doesn't affect material reality`\n );\n return [];\n case \"inc\":\n if (payload) {\n return [path, key, get(payload.patchInfo.after, autopatch.path)];\n } else {\n throw new Error(\n `can't apply ${autopatch.action} without payload argument`\n );\n }\n case \"conflict\":\n if (payload) {\n return [path, key, get(payload.patchInfo.after, autopatch.path)];\n } else {\n throw new Error(\n `can't apply ${autopatch.action} without payload argument`\n );\n }\n case \"del\": {\n return typeof key == \"string\" ? [path, key] : [path, [key, key + (autopatch.length || 1)]];\n }\n case \"insert\": {\n return [\n path,\n [key, key],\n structuredClone(autopatch.values)\n ];\n }\n case \"splice\": {\n return [path, [key, key], [autopatch.value]];\n }\n case \"put\": {\n return [path, key, structuredClone(autopatch.value)];\n }\n }\n}\nexport {\n apply,\n fromAutomerge,\n patch,\n pojo\n};\n","\"use strict\";\nimport { createContext } from \"solid-js\";\nexport const RepoContext = createContext(\n null\n);\n//# sourceMappingURL=context.js.map\n","\"use strict\";\nimport { RepoContext } from \"./context.js\";\nimport { useContext } from \"solid-js\";\nexport default function useRepo() {\n const repo = useContext(RepoContext);\n if (!repo) throw new Error(\"Please wrap me in a <RepoContext value={repo}>\");\n return repo;\n}\n//# sourceMappingURL=useRepo.js.map\n","/**\n * The BroadcastChannel the service worker and the automerge shared worker\n * use to hand requests off to each other. Broadcast (rather than a\n * MessagePort handed from one to the other) so the two never need to be\n * reintroduced when either of them restarts — and so tabs can listen in.\n */\nexport const HANDOFF_CHANNEL = \"@patchwork/handoff\";\n/**\n * BroadcastChannel on which the automerge shared worker announces remote\n * heads it learns about from the sync server. Any tab can listen to stay\n * informed of sync progress without repo-to-repo gossiping.\n */\nexport const SYNCSTATE_CHANNEL = \"@patchwork/syncstate\";\n","/**\n * Converts a timestamp to a relative time string (e.g. \"2 minutes ago\")\n */\nexport const getRelativeTimeString = (timestamp: number): string => {\n const now = Date.now();\n const diff = now - timestamp;\n\n const seconds = Math.floor(diff / 1000);\n const minutes = Math.floor(seconds / 60);\n const hours = Math.floor(minutes / 60);\n const days = Math.floor(hours / 24);\n const weeks = Math.floor(days / 7);\n const months = Math.floor(days / 30);\n const years = Math.floor(days / 365);\n\n if (seconds < 60) {\n return \"just now\";\n } else if (minutes < 60) {\n return `${minutes} minute${minutes === 1 ? \"\" : \"s\"} ago`;\n } else if (hours < 24) {\n return `${hours} hour${hours === 1 ? \"\" : \"s\"} ago`;\n } else if (days < 7) {\n return `${days} day${days === 1 ? \"\" : \"s\"} ago`;\n } else if (weeks < 4) {\n return `${weeks} week${weeks === 1 ? \"\" : \"s\"} ago`;\n } else if (months < 12) {\n return `${months} month${months === 1 ? \"\" : \"s\"} ago`;\n } else {\n return `${years} year${years === 1 ? \"\" : \"s\"} ago`;\n }\n};\n","import type { JSX } from \"solid-js\";\n\ninterface ButtonProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: \"default\" | \"ghost\";\n size?: \"default\" | \"sm\";\n}\n\nexport function Button(props: ButtonProps) {\n return (\n <button\n {...props}\n class={`sync-copy-btn ${props.class ?? \"\"}`}\n >\n {props.children}\n </button>\n );\n}\n","import {\n type JSX,\n createSignal,\n createContext,\n useContext,\n onCleanup,\n createEffect,\n on,\n} from \"solid-js\";\nimport { Portal } from \"solid-js/web\";\n\ninterface PopoverContextValue {\n open: () => boolean;\n setOpen: (v: boolean) => void;\n triggerRef: () => HTMLButtonElement | undefined;\n setTriggerRef: (el: HTMLButtonElement) => void;\n}\n\nconst PopoverContext = createContext<PopoverContextValue>();\n\nexport function Popover(props: {\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n children: JSX.Element;\n}) {\n const [internalOpen, setInternalOpen] = createSignal(false);\n const [triggerRef, setTriggerRef] = createSignal<HTMLButtonElement>();\n\n const isOpen = () =>\n props.open !== undefined ? props.open : internalOpen();\n\n const setOpen = (v: boolean) => {\n if (props.open === undefined) {\n setInternalOpen(v);\n }\n props.onOpenChange?.(v);\n };\n\n return (\n <PopoverContext.Provider\n value={{ open: isOpen, setOpen, triggerRef, setTriggerRef }}\n >\n <div class=\"sync-popover-wrapper\">{props.children}</div>\n </PopoverContext.Provider>\n );\n}\n\nexport function PopoverTrigger(props: {\n class?: string;\n children: JSX.Element;\n}) {\n const ctx = useContext(PopoverContext)!;\n\n return (\n <button\n ref={(el) => ctx.setTriggerRef(el)}\n type=\"button\"\n class={props.class ?? \"\"}\n onClick={() => ctx.setOpen(!ctx.open())}\n >\n {props.children}\n </button>\n );\n}\n\nexport function PopoverContent(props: {\n class?: string;\n children: JSX.Element;\n}) {\n const ctx = useContext(PopoverContext)!;\n let contentRef!: HTMLDivElement;\n const [position, setPosition] = createSignal({ top: 0, left: 0 });\n\n const updatePosition = () => {\n const trigger = ctx.triggerRef();\n if (!trigger) return;\n const rect = trigger.getBoundingClientRect();\n setPosition({\n top: rect.bottom + 8,\n left: Math.max(0, rect.right - 288),\n });\n };\n\n createEffect(\n on(ctx.open, (open) => {\n if (!open) return;\n\n updatePosition();\n\n const handleClickOutside = (event: MouseEvent) => {\n const target = event.target as Node;\n if (\n contentRef &&\n !contentRef.contains(target) &&\n ctx.triggerRef() &&\n !ctx.triggerRef()!.contains(target)\n ) {\n ctx.setOpen(false);\n }\n };\n\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n ctx.setOpen(false);\n }\n };\n\n document.addEventListener(\"mousedown\", handleClickOutside);\n document.addEventListener(\"keydown\", handleEscape);\n window.addEventListener(\"resize\", updatePosition);\n window.addEventListener(\"scroll\", updatePosition, true);\n\n onCleanup(() => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n document.removeEventListener(\"keydown\", handleEscape);\n window.removeEventListener(\"resize\", updatePosition);\n window.removeEventListener(\"scroll\", updatePosition, true);\n });\n })\n );\n\n return (\n <>\n {ctx.open() && (\n <Portal>\n <div\n ref={contentRef}\n class=\"sync-popover\"\n style={{\n top: `${position().top}px`,\n left: `${position().left}px`,\n }}\n >\n {props.children}\n </div>\n </Portal>\n )}\n </>\n );\n}\n","interface SyncIconProps {\n size?: number;\n class?: string;\n state?: \"synced\" | \"syncing\" | \"error\" | \"unknown\";\n}\n\nexport function SyncIcon(props: SyncIconProps) {\n const s = () => props.size ?? 20;\n const state = () => props.state ?? \"synced\";\n\n return (\n <svg\n width={s()}\n height={s()}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n class={props.class ?? \"\"}\n >\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"8\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n fill=\"currentColor\"\n fill-opacity={state() === \"synced\" ? 1 : 0}\n style={{\n transition: state() === \"synced\"\n ? \"fill-opacity 0s\"\n : \"fill-opacity 2s ease-out\",\n }}\n />\n {state() === \"error\" && (\n <circle cx=\"12\" cy=\"12\" r=\"2.5\" fill=\"currentColor\" />\n )}\n {state() === \"unknown\" && (\n <text\n x=\"12\"\n y=\"12\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n fill=\"currentColor\"\n font-size=\"11\"\n font-weight=\"bold\"\n >\n ?\n </text>\n )}\n </svg>\n );\n}\n","interface CopyIconProps {\n size?: number;\n}\n\nexport function CopyIcon(props: CopyIconProps) {\n const s = () => props.size ?? 14;\n return (\n <svg\n width={s()}\n height={s()}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\" />\n <path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\" />\n </svg>\n );\n}\n","import Debug from \"debug\";\nimport * as A from \"@automerge/automerge/slim\";\nimport {\n type DocHandle,\n type StorageId,\n type UrlHeads,\n type PeerId,\n} from \"@automerge/automerge-repo/slim\";\nimport {\n useRepo,\n RepoContext,\n} from \"solid-automerge\";\nimport {\n createSignal,\n createMemo,\n createEffect,\n on,\n onCleanup,\n untrack,\n Show,\n For,\n} from \"solid-js\";\nimport { createStore, reconcile } from \"solid-js/store\";\nimport {\n SYNCSTATE_CHANNEL,\n type SyncStateDocMessage,\n type SyncStateBroadcast,\n} from \"@inkandswitch/patchwork-bootloader/types\";\nimport { render } from \"solid-js/web\";\nimport type { ToolImplementation } from \"@inkandswitch/patchwork-plugins\";\nimport { getRelativeTimeString } from \"./lib/relative-time\";\nimport { Button, Popover, PopoverTrigger, PopoverContent } from \"./lib/ui\";\nimport { SyncIcon } from \"./SyncIcon\";\nimport { CopyIcon } from \"./CopyIcon\";\nimport \"./styles.css\";\n\nconst log = Debug(\"patchwork:sync-indicator\");\n\ndeclare global {\n // eslint-disable-next-line no-var\n var patchwork:\n | {\n sw?: {\n /**\n * Watch one document's sync heads. Calls `listener` on every update,\n * replaying current state on subscribe. Returns an unsubscribe fn.\n */\n subscribeSyncState?: (\n documentId: string,\n listener: (update: SyncStateDocMessage) => void\n ) => () => void;\n };\n }\n | undefined;\n}\n\nexport { RepoContext };\n\ninterface PeerSyncInfo {\n id: string;\n name: string;\n storageId: StorageId | undefined;\n heads: UrlHeads | undefined;\n lastSyncTimestamp: number | undefined;\n inSync: boolean;\n}\n\nfunction peerName(peerId: PeerId): string {\n if (\n peerId.startsWith(\"shared-worker\") ||\n peerId.startsWith(\"automerge-worker\")\n )\n return \"Shared Worker\";\n if (peerId.startsWith(\"service-worker\")) return \"Service Worker\";\n if (peerId.startsWith(\"storage-server\")) return \"Sync Server\";\n return String(peerId);\n}\n\nexport function SyncIndicator(props: { handle: DocHandle<unknown> }) {\n const repo = useRepo();\n const [isPopoverOpen, setIsPopoverOpen] = createSignal(false);\n const [now, setNow] = createSignal(Date.now());\n const [ownHeads, setOwnHeads] = createSignal<UrlHeads | undefined>();\n\n // Global sync signals from the shared worker's @patchwork/syncstate channel.\n // `connected` is the real Subduction link to the sync server — authoritative,\n // unlike navigator.onLine which only knows the OS network is up. `serverPeerIds`\n // are the sync server's storage ids and `workerPeerId` is the shared worker's\n // id; together they let us tell the server's heads apart from the worker's own\n // (which are identical to ours) instead of guessing \"unknown ⇒ server\".\n const [connected, setConnected] = createSignal(false);\n const [serverPeerIds, setServerPeerIds] = createSignal<string[]>([]);\n const [workerPeerId, setWorkerPeerId] = createSignal<string | undefined>();\n\n // sync server state — driven by the shared worker's BroadcastChannel\n const [syncServerHeads, setSyncServerHeads] = createSignal<\n UrlHeads | undefined\n >();\n const [syncServerTimestamp, setSyncServerTimestamp] = createSignal<\n number | undefined\n >();\n const [syncServerStorageId, setSyncServerStorageId] = createSignal<\n StorageId | undefined\n >();\n\n // connected peers (shared worker, etc)\n const [peers, setPeers] = createStore<PeerSyncInfo[]>([]);\n\n // \"Up to date with the sync server\". The server advertises Subduction\n // *sedimentree* heads (loose-commit + fragment-boundary ids), NOT the Automerge\n // frontier, so they can't be compared to our heads with A.equals — that's why\n // the row only ever read \"synced\" off the (mis-attributed) worker's automerge\n // heads. Ask the handle whether we already hold everything the server\n // advertises instead, exactly like the worker's own resync check.\n const containsServerHeads = (heads: UrlHeads | undefined): boolean => {\n if (!heads || heads.length === 0) return false;\n try {\n return props.handle.containsHeads(heads);\n } catch {\n return false; // doc not ready, or an undecodable head\n }\n };\n\n /**\n * Trim the sync server's advertised heads for display: drop heads we already\n * hold in our history (most server sedimentree tips are interior commits we\n * have), keeping our current frontier tip(s) plus any head we genuinely lack.\n * Display only; the synced verdict still considers the full set.\n */\n function trimSeenServerHeads(\n heads: UrlHeads | undefined\n ): UrlHeads | undefined {\n if (!heads) return heads;\n\n let frontier: Set<string>;\n try {\n frontier = new Set<string>([...props.handle.heads()]);\n } catch {\n return heads;\n }\n\n return heads.filter((h) => {\n if (frontier.has(h)) return true; // our latest shared tip — keep\n try {\n return !props.handle.containsHeads([h] as UrlHeads);\n } catch {\n return true; // can't decide → keep\n }\n }) as UrlHeads;\n }\n\n // tick every second while popover is open (for relative times), and rebuild\n // the peer list from repo.peers each time it opens so every currently\n // connected peer shows up (the repo has no peer connect/disconnect event to\n // subscribe to, so we refresh on open rather than trying to track it live).\n createEffect(\n on(isPopoverOpen, (open) => {\n if (!open) return;\n untrack(refreshPeers);\n const interval = setInterval(() => setNow(Date.now()), 1000);\n onCleanup(() => clearInterval(interval));\n })\n );\n\n // Global connection + whoami signals arrive over the worker's\n // @patchwork/syncstate BroadcastChannel (per-doc heads do NOT — those are the\n // addressed subscribeSyncState pushes below). Open it once, ask the worker to\n // replay the current snapshot, and keep our signals live.\n createEffect(() => {\n let channel: BroadcastChannel;\n try {\n channel = new BroadcastChannel(SYNCSTATE_CHANNEL);\n } catch {\n return; // no BroadcastChannel available — degrade gracefully\n }\n const onMessage = (event: MessageEvent) => {\n const data = event.data as SyncStateBroadcast | undefined;\n if (!data) return;\n if (data.type === \"connection\") {\n setConnected(data.connected);\n setServerPeerIds(data.serverPeerIds ?? []);\n } else if (data.type === \"whoami\") {\n setWorkerPeerId(data.peerId);\n }\n };\n channel.addEventListener(\"message\", onMessage);\n // Replay the current global snapshot to this freshly-opened tab.\n channel.postMessage({ type: \"request\" });\n onCleanup(() => {\n channel.removeEventListener(\"message\", onMessage);\n channel.close();\n });\n });\n\n /** Update sync-server signals and the \"Sync Server\" peer-list entry. */\n function applySyncServerUpdate(\n storageId: StorageId,\n heads: UrlHeads,\n timestamp: number\n ) {\n setSyncServerStorageId(storageId);\n setSyncServerHeads(heads);\n setSyncServerTimestamp(timestamp);\n\n const idx = peers.findIndex((p) => p.name === \"Sync Server\");\n if (idx >= 0) {\n setPeers(idx, {\n storageId,\n heads,\n lastSyncTimestamp: timestamp,\n inSync: containsServerHeads(heads),\n });\n }\n }\n\n // track own heads + remote heads\n createEffect(() => {\n const h = props.handle;\n\n setOwnHeads(h.heads());\n\n const onChange = () => {\n if (h.doc()) setOwnHeads(h.heads());\n };\n\n const onRemoteHeads = ({\n storageId,\n heads,\n timestamp,\n }: {\n storageId: StorageId;\n heads: UrlHeads;\n timestamp: number;\n }) => {\n log(\"remote-heads\", { storageId, heads, timestamp });\n\n // update peer entry if it matches a known peer\n const idx = peers.findIndex((p) => p.storageId === storageId);\n if (idx >= 0) {\n const currentHeads = ownHeads();\n setPeers(idx, {\n heads,\n lastSyncTimestamp: timestamp,\n inSync: currentHeads ? A.equals(currentHeads, heads) : false,\n });\n }\n };\n\n h.on(\"change\", onChange);\n h.on(\"remote-heads\", onRemoteHeads);\n\n // Update one repo-peer row (another tab, storage server): those advertise\n // Automerge frontier heads, so A.equals is the right \"in sync\" test here.\n const updatePeerRow = (idx: number, heads: UrlHeads, timestamp: number) => {\n const currentHeads = ownHeads();\n setPeers(idx, {\n heads,\n lastSyncTimestamp: timestamp,\n inSync: currentHeads ? A.equals(currentHeads, heads) : false,\n });\n };\n\n // Subscribe to this doc's sync heads from the automerge worker. It replays\n // the current state on subscribe and pushes every update, keyed by the\n // sender's storage id. Attribute each update by *who* sent it, using the\n // identities the worker announces on the syncstate channel — NEVER \"unknown\n // ⇒ must be the server\", which funnels the worker's OWN heads (identical to\n // ours) into the server row so it looks perpetually \"synced\".\n const onSyncState = (update: SyncStateDocMessage) => {\n if (update.documentId !== h.documentId) return;\n log(\"sync-state\", update);\n\n const heads = update.heads as UrlHeads;\n const sid = update.storageId;\n\n // The real sync server (definitive: it told us its ids over `connection`).\n if (serverPeerIds().includes(sid)) {\n applySyncServerUpdate(sid as StorageId, heads, update.timestamp);\n return;\n }\n // The shared worker's own heads (keyed by its whoami peerId). Its row is\n // hidden outside debug; update it if present, otherwise ignore — it must\n // never fall through to the sync-server slot.\n if (workerPeerId() && sid === workerPeerId()) {\n const idx = peers.findIndex((p) => p.storageId === sid);\n if (idx >= 0) updatePeerRow(idx, heads, update.timestamp);\n return;\n }\n // A known repo peer, matched by storage id.\n const idx = peers.findIndex((p) => p.storageId === sid);\n if (idx >= 0) {\n updatePeerRow(idx, heads, update.timestamp);\n return;\n }\n // Unknown sender that isn't the worker: once whoami has arrived the only\n // remaining Subduction sender is the sync server, so attribute it there.\n // Before whoami lands, drop it rather than risk mislabeling worker heads.\n if (workerPeerId()) {\n applySyncServerUpdate(sid as StorageId, heads, update.timestamp);\n }\n };\n\n const unsubscribeSyncState =\n globalThis?.patchwork?.sw?.subscribeSyncState?.(\n h.documentId,\n onSyncState\n );\n\n // Build the initial peer list. refreshPeers() reads the syncServer* signals,\n // and onSyncState *writes* them on every update — so tracking those reads\n // here would make this effect re-run (tearing down and re-subscribing, which\n // makes the worker replay) on every single sync-state message: a feedback\n // loop that floods messages, flickers the peer list, and kills the shared\n // worker. untrack keeps this effect depending on props.handle alone.\n untrack(refreshPeers);\n\n onCleanup(() => {\n h.off(\"change\", onChange);\n h.off(\"remote-heads\", onRemoteHeads);\n unsubscribeSyncState?.();\n });\n });\n\n function refreshPeers() {\n const h = props.handle;\n const currentHeads = h.heads();\n const peerList: PeerSyncInfo[] = repo.peers.map((peerId) => {\n const storageId = repo.getStorageIdOfPeer(peerId);\n const syncInfo = storageId ? h.getSyncInfo(storageId) : undefined;\n return {\n id: peerId,\n name: peerName(peerId),\n storageId,\n heads: syncInfo?.lastHeads,\n lastSyncTimestamp: syncInfo?.lastSyncTimestamp,\n inSync:\n syncInfo?.lastHeads && currentHeads\n ? A.equals(currentHeads, syncInfo.lastHeads)\n : false,\n };\n });\n\n // Always add sync server as a virtual peer — the main thread\n // doesn't talk to it directly; its state comes from the shared\n // worker's @patchwork/syncstate BroadcastChannel / IndexedDB.\n {\n const serverHeads = syncServerHeads();\n const serverTs = syncServerTimestamp();\n peerList.push({\n id: \"sync-server\",\n name: \"Sync Server\",\n storageId: syncServerStorageId(),\n heads: serverHeads,\n lastSyncTimestamp: serverTs,\n // sedimentree heads — use containsHeads, not A.equals (see helper).\n inSync: containsServerHeads(serverHeads),\n });\n }\n\n // sort: shared worker first, sync server last\n const peerOrder = (p: PeerSyncInfo) =>\n p.name === \"Shared Worker\" ? 0 : p.name === \"Sync Server\" ? 2 : 1;\n peerList.sort((a, b) => peerOrder(a) - peerOrder(b));\n\n log(\"peers\", peerList);\n // Show every connected peer, including our own shared worker — the icon\n // stays driven by the sync server (see syncedToServer), but the popover is\n // a full readout of who we're talking to.\n setPeers(reconcile(peerList));\n }\n\n // recompute inSync when own heads change\n createEffect(() => {\n const currentHeads = ownHeads();\n if (!currentHeads) return;\n for (let i = 0; i < peers.length; i++) {\n const peer = peers[i];\n // The sync server advertises sedimentree heads → containsHeads, not\n // A.equals (which is right for automerge-frontier peers).\n const inSync =\n peer.name === \"Sync Server\"\n ? containsServerHeads(peer.heads)\n : peer.heads\n ? A.equals(currentHeads, peer.heads)\n : false;\n if (peer.inSync !== inSync) {\n setPeers(i, \"inSync\", inSync);\n }\n }\n });\n\n // Single source of truth for \"are we up to date with the sync server\". Both\n // the icon AND the Sync Server row read this one memo. Previously the icon\n // derived it live (`containsServerHeads`) while the row rendered a separately\n // stored `peer.inSync` snapshot, set on a different code path — so a fast\n // burst of edits could settle with the two disagreeing (icon still \"syncing\"\n // while the row already said \"synced\"). One memo, read in both places, can't\n // diverge.\n const syncedToServer = createMemo(() => {\n ownHeads(); // re-evaluate when our heads move (containsHeads reads the doc)\n return containsServerHeads(syncServerHeads());\n });\n\n const syncServerKnown = () => !!syncServerHeads();\n\n // Status label for one peer row. The Sync Server row reflects `syncedToServer`\n // (the same memo the icon uses); everyone else compares stored heads.\n const peerStatusLabel = (peer: PeerSyncInfo) => {\n const inSync = peer.name === \"Sync Server\" ? syncedToServer() : peer.inSync;\n return inSync ? \"synced\" : peer.heads ? \"behind\" : \"unknown\";\n };\n\n const displayHeads = (peer: PeerSyncInfo) => {\n if (peer.name !== \"Sync Server\") return peer.heads;\n ownHeads(); // re-render the trimmed display when our frontier moves\n return trimSeenServerHeads(peer.heads);\n };\n\n const iconState = (): \"synced\" | \"syncing\" | \"error\" | \"unknown\" => {\n if (!connected()) return \"error\"; // no live link to the sync server\n if (!syncServerKnown()) return \"unknown\";\n return syncedToServer() ? \"synced\" : \"syncing\";\n };\n\n const statusText = () => {\n if (!connected()) return \"Offline\";\n if (!syncServerKnown()) return \"Connecting…\";\n return syncedToServer() ? \"Synced to server\" : \"Syncing…\";\n };\n\n const onCopy = async () => {\n const data = {\n ownHeads: ownHeads(),\n syncServer: {\n storageId: syncServerStorageId(),\n heads: syncServerHeads(),\n lastSyncTimestamp: syncServerTimestamp(),\n inSync: syncedToServer(),\n },\n peers: peers.map((p) => ({\n name: p.name,\n id: p.id,\n storageId: p.storageId,\n heads: p.heads,\n lastSyncTimestamp: p.lastSyncTimestamp,\n inSync: p.inSync,\n })),\n };\n try {\n await navigator.clipboard.writeText(JSON.stringify(data, null, 2));\n log(\"copied sync state to clipboard\", data);\n } catch (err) {\n log(\"failed to copy sync state:\", err);\n }\n };\n\n const relativeTime = (ts: number | undefined) => {\n void now();\n return ts ? getRelativeTimeString(ts) : \"-\";\n };\n\n const copyHeads = async (heads: UrlHeads | undefined) => {\n if (!heads) return;\n try {\n await navigator.clipboard.writeText(JSON.stringify(heads));\n } catch (err) {\n log(\"failed to copy heads:\", err);\n }\n };\n\n return (\n <Popover open={isPopoverOpen()} onOpenChange={setIsPopoverOpen}>\n <PopoverTrigger\n class={connected() ? \"sync-trigger\" : \"sync-trigger-offline\"}\n >\n <SyncIcon size={20} state={iconState()} />\n </PopoverTrigger>\n <PopoverContent>\n <div class=\"sync-popover-body\">\n <div class=\"sync-status-header\">{statusText()}</div>\n\n <div class=\"sync-peers\">\n <div\n class=\"sync-peer sync-peer-clickable\"\n onClick={() => copyHeads(ownHeads())}\n >\n <div class=\"sync-peer-header\">\n <span class=\"sync-peer-name\">Tab</span>\n </div>\n <div class=\"sync-peer-detail\">\n heads:{\" \"}\n {JSON.stringify((ownHeads() ?? []).map((h) => h.slice(0, 6)))}\n </div>\n </div>\n\n <For each={peers}>\n {(peer) => (\n <>\n <div\n class=\"sync-peer sync-peer-clickable\"\n onClick={() => copyHeads(peer.heads)}\n >\n <div class=\"sync-peer-header\">\n <span class=\"sync-peer-name\">{peer.name}</span>\n <span class=\"sync-peer-status\">\n {peerStatusLabel(peer)}\n </span>\n </div>\n <Show when={displayHeads(peer)}>\n {(heads) => (\n <div class=\"sync-peer-detail\">\n heads:{\" \"}\n {JSON.stringify(heads().map((h) => h.slice(0, 6)))}\n </div>\n )}\n </Show>\n <Show when={peer.lastSyncTimestamp}>\n <div class=\"sync-peer-detail\">\n {relativeTime(peer.lastSyncTimestamp)}\n </div>\n </Show>\n </div>\n </>\n )}\n </For>\n </div>\n\n <div class=\"sync-footer\">\n <Button onClick={onCopy}>\n <CopyIcon size={14} />\n </Button>\n </div>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\nexport const renderSyncIndicator: ToolImplementation = (handle, element) => {\n element.style.width = \"fit-content\";\n element.style.zIndex = \"10\";\n\n const dispose = render(\n () => (\n <RepoContext.Provider value={element.repo}>\n <SyncIndicator handle={handle} />\n </RepoContext.Provider>\n ),\n element\n );\n return () => dispose();\n};\n"],"names":["s","m","h","d","w","y","ms","val","options","type","parse","fmtLong","fmtShort","str","match","n","msAbs","plural","name","isPlural","setup","env","createDebug","coerce","disable","enable","enabled","require$$0","destroy","key","selectColor","namespace","hash","i","prevTime","enableOverride","namespacesCache","enabledCache","debug","args","self","curr","index","format","formatter","extend","v","delimiter","newDebug","namespaces","split","ns","matchesTemplate","search","template","searchIndex","templateIndex","starIndex","matchIndex","skip","common","exports","formatArgs","save","load","useColors","localstorage","warned","module","lastC","r","define_process_env_default","formatters","error","RepoContext","createContext","useRepo","repo","useContext","SYNCSTATE_CHANNEL","getRelativeTimeString","timestamp","diff","seconds","minutes","hours","days","weeks","months","years","Button","props","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","children","PopoverContext","Popover","internalOpen","setInternalOpen","createSignal","triggerRef","setTriggerRef","isOpen","open","undefined","setOpen","onOpenChange","_$createComponent","Provider","value","PopoverTrigger","ctx","_el$2","_tmpl$2","$$click","_$use","el","_$effect","_$className","PopoverContent","contentRef","position","setPosition","top","left","updatePosition","trigger","rect","getBoundingClientRect","bottom","Math","max","right","createEffect","on","handleClickOutside","event","target","contains","handleEscape","document","addEventListener","window","onCleanup","removeEventListener","_$memo","Portal","_el$3","_tmpl$3","_ref$","_p$","_v$","_v$2","e","_$setStyleProperty","t","_$delegateEvents","SyncIcon","size","state","firstChild","_c$","_c$2","_v$3","_v$4","_v$5","_$setAttribute","a","o","CopyIcon","log","Debug","peerName","peerId","startsWith","String","SyncIndicator","isPopoverOpen","setIsPopoverOpen","now","setNow","Date","ownHeads","setOwnHeads","connected","setConnected","serverPeerIds","setServerPeerIds","workerPeerId","setWorkerPeerId","syncServerHeads","setSyncServerHeads","syncServerTimestamp","setSyncServerTimestamp","syncServerStorageId","setSyncServerStorageId","peers","setPeers","createStore","containsServerHeads","heads","length","handle","containsHeads","trimSeenServerHeads","frontier","Set","filter","has","untrack","refreshPeers","interval","setInterval","clearInterval","channel","BroadcastChannel","onMessage","data","postMessage","close","applySyncServerUpdate","storageId","idx","findIndex","p","lastSyncTimestamp","inSync","onChange","doc","onRemoteHeads","currentHeads","A","equals","updatePeerRow","onSyncState","update","documentId","sid","includes","unsubscribeSyncState","globalThis","patchwork","sw","subscribeSyncState","off","peerList","map","getStorageIdOfPeer","syncInfo","getSyncInfo","id","lastHeads","serverHeads","serverTs","push","peerOrder","sort","b","reconcile","peer","syncedToServer","createMemo","syncServerKnown","peerStatusLabel","displayHeads","iconState","statusText","onCopy","syncServer","navigator","clipboard","writeText","JSON","stringify","err","relativeTime","ts","copyHeads","nextSibling","_el$4","_el$5","_el$6","_el$9","slice","For","each","_el$0","_el$1","_el$10","_el$11","Show","when","_el$13","_tmpl$4","_el$12","onClick","renderSyncIndicator","element","style","width","zIndex","dispose","render"],"mappings":"0sBAIA,IAAIA,EAAI,IACJC,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,EAAID,EAAI,EACRE,EAAIF,EAAI,OAgBZG,EAAiB,SAAUC,EAAKC,EAAS,CACvCA,EAAUA,GAAW,CAAA,EACrB,IAAIC,EAAO,OAAOF,EAClB,GAAIE,IAAS,UAAYF,EAAI,OAAS,EACpC,OAAOG,EAAMH,CAAG,EACX,GAAIE,IAAS,UAAY,SAASF,CAAG,EAC1C,OAAOC,EAAQ,KAAOG,EAAQJ,CAAG,EAAIK,EAASL,CAAG,EAEnD,MAAM,IAAI,MACR,wDACE,KAAK,UAAUA,CAAG,EAExB,EAUA,SAASG,EAAMG,EAAK,CAElB,GADAA,EAAM,OAAOA,CAAG,EACZ,EAAAA,EAAI,OAAS,KAGjB,KAAIC,EAAQ,mIAAmI,KAC7ID,GAEF,GAAKC,EAGL,KAAIC,EAAI,WAAWD,EAAM,CAAC,CAAC,EACvBL,GAAQK,EAAM,CAAC,GAAK,MAAM,YAAW,EACzC,OAAQL,EAAI,CACV,IAAK,QACL,IAAK,OACL,IAAK,MACL,IAAK,KACL,IAAK,IACH,OAAOM,EAAIV,EACb,IAAK,QACL,IAAK,OACL,IAAK,IACH,OAAOU,EAAIX,EACb,IAAK,OACL,IAAK,MACL,IAAK,IACH,OAAOW,EAAIZ,EACb,IAAK,QACL,IAAK,OACL,IAAK,MACL,IAAK,KACL,IAAK,IACH,OAAOY,EAAIb,EACb,IAAK,UACL,IAAK,SACL,IAAK,OACL,IAAK,MACL,IAAK,IACH,OAAOa,EAAId,EACb,IAAK,UACL,IAAK,SACL,IAAK,OACL,IAAK,MACL,IAAK,IACH,OAAOc,EAAIf,EACb,IAAK,eACL,IAAK,cACL,IAAK,QACL,IAAK,OACL,IAAK,KACH,OAAOe,EACT,QACE,MACN,GACA,CAUA,SAASH,EAASN,EAAI,CACpB,I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C,CAQC,SAAS9B,GAAU,CAClB,MAAMyB,EAAa,CAClB,GAAG3B,EAAY,MACf,GAAGA,EAAY,MAAM,IAAIS,GAAa,IAAMA,CAAS,CACxD,EAAI,KAAK,GAAG,EACV,OAAAT,EAAY,OAAO,EAAE,EACd2B,CACT,CASC,SAASvB,EAAQR,EAAM,CACtB,UAAWyC,KAAQrC,EAAY,MAC9B,GAAI8B,EAAgBlC,EAAMyC,CAAI,EAC7B,MAAO,GAIT,UAAWR,KAAM7B,EAAY,MAC5B,GAAI8B,EAAgBlC,EAAMiC,CAAE,EAC3B,MAAO,GAIT,MAAO,EACT,CASC,SAAS5B,EAAOhB,EAAK,CACpB,OAAIA,aAAe,MACXA,EAAI,OAASA,EAAI,QAElBA,CACT,CAMC,SAASqB,GAAU,CAClB,QAAQ,KAAK,uIAAuI,CACtJ,CAEC,OAAAN,EAAY,OAAOA,EAAY,MAAM,EAE9BA,CACR,CAEA,OAAAsC,GAAiBxC,mEC7RjByC,EAAA,WAAqBC,EACrBD,EAAA,KAAeE,EACfF,EAAA,KAAeG,EACfH,EAAA,UAAoBI,EACpBJ,EAAA,QAAkBK,EAAA,EAClBL,EAAA,SAAmB,IAAM,CACxB,IAAIM,EAAS,GAEb,MAAO,IAAM,CACPA,IACJA,EAAS,GACT,QAAQ,KAAK,uIAAuI,EACrJ,CAEF,GAAA,EAMAN,EAAA,OAAiB,CAChB,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,WAYD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AA,CAAA,CAOhC,CAEO,MAAMgN,GAA0CA,CAAC9F,EAAQ+F,IAAY,CAC1EA,EAAQC,MAAMC,MAAQ,cACtBF,EAAQC,MAAME,OAAS,KAEvB,MAAMC,EAAUC,GACd,IAAAnM,EACGrC,GAAYsC,SAAQ,CAAA,IAACC,OAAK,CAAA,OAAE4L,EAAQhO,IAAI,EAAA,IAAAqB,UAAA,CAAA,OAAAa,EACtCqE,GAAa,CAAC0B,OAAAA,CAAAA,CAAc,CAAA,CAAA,CAAA,EAGjC+F,CACF,EACA,MAAO,IAAMI,EAAAA,CACf,EAAEjJ,GAAA,CAAA,OAAA,CAAA","x_google_ignoreList":[0,1,2,3,4,5,6]}
|
|
1
|
+
{"version":3,"file":"SyncIndicator-DxVkpuKE.js","sources":["../../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js","../../../node_modules/.pnpm/debug@4.4.3_supports-color@7.2.0/node_modules/debug/src/common.js","../../../node_modules/.pnpm/debug@4.4.3_supports-color@7.2.0/node_modules/debug/src/browser.js","../../../node_modules/.pnpm/cabbages@0.2.10_supports-color@7.2.0/node_modules/cabbages/output/cabbages.js","../../../node_modules/.pnpm/solid-automerge@2.0.1_@automerge+automerge-repo@2.6.0-subduction.39_supports-color@7.2._227dd52f84bb1cffabe2033f455b43b1/node_modules/solid-automerge/out/context.js","../../../node_modules/.pnpm/solid-automerge@2.0.1_@automerge+automerge-repo@2.6.0-subduction.39_supports-color@7.2._227dd52f84bb1cffabe2033f455b43b1/node_modules/solid-automerge/out/useRepo.js","../../../node_modules/.pnpm/@inkandswitch+patchwork-bootloader@0.3.2_@automerge+automerge-repo-keyhive@0.3.0-alpha._e6f87c1441acf6c8d0dfa0aa51c76588/node_modules/@inkandswitch/patchwork-bootloader/dist/types.js","../../src/lib/relative-time.ts","../../src/lib/ui/Button.tsx","../../src/lib/ui/Popover.tsx","../../src/SyncIcon.tsx","../../src/CopyIcon.tsx","../../src/SyncIndicator.tsx"],"sourcesContent":["/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function (val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '')\n\t\t\t.trim()\n\t\t\t.replace(/\\s+/g, ',')\n\t\t\t.split(',')\n\t\t\t.filter(Boolean);\n\n\t\tfor (const ns of split) {\n\t\t\tif (ns[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(ns.slice(1));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(ns);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the given string matches a namespace template, honoring\n\t * asterisks as wildcards.\n\t *\n\t * @param {String} search\n\t * @param {String} template\n\t * @return {Boolean}\n\t */\n\tfunction matchesTemplate(search, template) {\n\t\tlet searchIndex = 0;\n\t\tlet templateIndex = 0;\n\t\tlet starIndex = -1;\n\t\tlet matchIndex = 0;\n\n\t\twhile (searchIndex < search.length) {\n\t\t\tif (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {\n\t\t\t\t// Match character or proceed with wildcard\n\t\t\t\tif (template[templateIndex] === '*') {\n\t\t\t\t\tstarIndex = templateIndex;\n\t\t\t\t\tmatchIndex = searchIndex;\n\t\t\t\t\ttemplateIndex++; // Skip the '*'\n\t\t\t\t} else {\n\t\t\t\t\tsearchIndex++;\n\t\t\t\t\ttemplateIndex++;\n\t\t\t\t}\n\t\t\t} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition\n\t\t\t\t// Backtrack to the last '*' and try to match more characters\n\t\t\t\ttemplateIndex = starIndex + 1;\n\t\t\t\tmatchIndex++;\n\t\t\t\tsearchIndex = matchIndex;\n\t\t\t} else {\n\t\t\t\treturn false; // No match\n\t\t\t}\n\t\t}\n\n\t\t// Handle trailing '*' in template\n\t\twhile (templateIndex < template.length && template[templateIndex] === '*') {\n\t\t\ttemplateIndex++;\n\t\t}\n\n\t\treturn templateIndex === template.length;\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names,\n\t\t\t...createDebug.skips.map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tfor (const skip of createDebug.skips) {\n\t\t\tif (matchesTemplate(name, skip)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (const ns of createDebug.names) {\n\t\t\tif (matchesTemplate(name, ns)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\tlet m;\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\t// eslint-disable-next-line no-return-assign\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)) && parseInt(m[1], 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n","// cabbages.ts\nimport debug from \"debug\";\nvar log = debug(\"cabbages\");\nfunction pojo(target) {\n return typeof target == \"object\" && typeof target != null && Object.getPrototypeOf(target) == Object.prototype;\n}\nvar BLOCK_MARKER = \"\\uFFFC\";\nfunction apply(target, ...rest) {\n if (rest.length == 0) {\n log(\"empty patch\");\n return;\n }\n const [path, range, val] = rest;\n let p = [...path];\n while (true) {\n let key = p.shift();\n if (!p.length) {\n const RANGE_ARRAY = Array.isArray(range);\n if (pojo(target) && RANGE_ARRAY && typeof key == \"undefined\" && typeof range[0] == \"string\") {\n delete target[range[0]];\n return;\n }\n if (RANGE_ARRAY || typeof range == \"number\") {\n if (typeof key == \"undefined\") {\n throw new Error(\"cant treat top level as a seq\");\n }\n key = key;\n let [start, end] = Array.isArray(range) ? range : [range, range + 1];\n const ZERO_LENGTH = Array.isArray(range) && range.length == 0;\n if (!ZERO_LENGTH && (start == null || end == null)) {\n throw new RangeError(\"it's all or nothing, no half measures\");\n }\n const DELETE = typeof val == \"undefined\";\n const INSERT = start === end && !DELETE;\n const APPEND = ZERO_LENGTH && !DELETE;\n const REPLACE = !INSERT && !DELETE && !APPEND;\n if (typeof target[key] == \"undefined\") {\n if (typeof target == \"string\") {\n return;\n } else if (typeof val == \"string\") {\n target[key] = \"\";\n } else {\n target[key] = [];\n }\n }\n let seq = target[key];\n if (Array.isArray(seq)) {\n if (APPEND) {\n Array.isArray(val) ? seq.push(...val) : seq.push(val);\n return;\n }\n if (INSERT || REPLACE) {\n Array.isArray(val) ? seq.splice(start, end - start, ...val) : seq.splice(start, end - start, val);\n return;\n }\n if (DELETE) {\n seq.splice(start, end - start);\n return;\n }\n throw new Error(\"i don't know what happened\");\n }\n if (typeof seq == \"string\") {\n if (APPEND) {\n target[key] = seq + val;\n return;\n }\n if (REPLACE || INSERT) {\n target[key] = seq.slice(0, start) + (typeof val == \"string\" ? val : val.map(\n (n) => typeof n == \"string\" ? n : BLOCK_MARKER\n ).join(\"\")) + seq.slice(end);\n return;\n }\n if (DELETE) {\n target[key] = seq.slice(0, start) + seq.slice(end);\n return;\n }\n throw new Error(\"i don't know what happened\");\n }\n if (pojo(seq) && RANGE_ARRAY && typeof range[0] == \"string\") {\n delete seq[range[0]];\n return;\n }\n throw new Error(\"not implemented\");\n }\n if (typeof key == \"undefined\") {\n if (typeof range != \"string\") {\n throw new Error(`can't index top-level map with ${range}`);\n }\n if (typeof val == \"undefined\") {\n delete target[range];\n } else {\n target[range] = val;\n }\n return;\n }\n if (typeof target[key] == \"undefined\") {\n target[key] = {};\n }\n if (RANGE_ARRAY) {\n let [a, b] = range;\n if (a != null && b != null) {\n if (typeof val == \"undefined\" && a != null && b != null) {\n delete target[key][a || b];\n } else {\n target[key][a || b] = val;\n }\n }\n } else {\n if (typeof val == \"undefined\") {\n delete target[key][range];\n } else if (typeof target[key] == \"string\") {\n return;\n } else {\n target[key][range] = val;\n }\n }\n return;\n }\n if (typeof key == \"undefined\") {\n throw new Error(\"cant treat top level as a seq\");\n }\n key = key;\n let nextkey = p[0];\n if (typeof target[key] == \"undefined\") {\n if (typeof nextkey == \"string\") {\n target[key] = {};\n } else if (typeof nextkey == \"number\") {\n target[key] = [];\n } else {\n throw new Error(`can't go down this road ${target}.${key}.${nextkey}`);\n }\n }\n target = target[key];\n }\n}\nvar patch = apply;\nfunction get(obj, key) {\n for (let p = 0; p < key.length; p++) {\n obj = obj ? obj[key[p]] : void 0;\n }\n return obj;\n}\nfunction fromAutomerge(autopatch, payload) {\n const path = autopatch.path.slice(0, -1);\n const key = autopatch.path[autopatch.path.length - 1];\n switch (autopatch.action) {\n case \"mark\":\n case \"unmark\":\n log(\n `skipping ${autopatch.action} because it doesn't affect material reality`\n );\n return [];\n case \"inc\":\n if (payload) {\n return [path, key, get(payload.patchInfo.after, autopatch.path)];\n } else {\n throw new Error(\n `can't apply ${autopatch.action} without payload argument`\n );\n }\n case \"conflict\":\n if (payload) {\n return [path, key, get(payload.patchInfo.after, autopatch.path)];\n } else {\n throw new Error(\n `can't apply ${autopatch.action} without payload argument`\n );\n }\n case \"del\": {\n return typeof key == \"string\" ? [path, key] : [path, [key, key + (autopatch.length || 1)]];\n }\n case \"insert\": {\n return [\n path,\n [key, key],\n structuredClone(autopatch.values)\n ];\n }\n case \"splice\": {\n return [path, [key, key], [autopatch.value]];\n }\n case \"put\": {\n return [path, key, structuredClone(autopatch.value)];\n }\n }\n}\nexport {\n apply,\n fromAutomerge,\n patch,\n pojo\n};\n","\"use strict\";\nimport { createContext } from \"solid-js\";\nexport const RepoContext = createContext(\n null\n);\n//# sourceMappingURL=context.js.map\n","\"use strict\";\nimport { RepoContext } from \"./context.js\";\nimport { useContext } from \"solid-js\";\nexport default function useRepo() {\n const repo = useContext(RepoContext);\n if (!repo) throw new Error(\"Please wrap me in a <RepoContext value={repo}>\");\n return repo;\n}\n//# sourceMappingURL=useRepo.js.map\n","/**\n * The BroadcastChannel the service worker and the automerge shared worker\n * use to hand requests off to each other. Broadcast (rather than a\n * MessagePort handed from one to the other) so the two never need to be\n * reintroduced when either of them restarts — and so tabs can listen in.\n */\nexport const HANDOFF_CHANNEL = \"@patchwork/handoff\";\n/**\n * BroadcastChannel on which the automerge shared worker announces remote\n * heads it learns about from the sync server. Any tab can listen to stay\n * informed of sync progress without repo-to-repo gossiping.\n */\nexport const SYNCSTATE_CHANNEL = \"@patchwork/syncstate\";\n","/**\n * Converts a timestamp to a relative time string (e.g. \"2 minutes ago\")\n */\nexport const getRelativeTimeString = (timestamp: number): string => {\n const now = Date.now();\n const diff = now - timestamp;\n\n const seconds = Math.floor(diff / 1000);\n const minutes = Math.floor(seconds / 60);\n const hours = Math.floor(minutes / 60);\n const days = Math.floor(hours / 24);\n const weeks = Math.floor(days / 7);\n const months = Math.floor(days / 30);\n const years = Math.floor(days / 365);\n\n if (seconds < 60) {\n return \"just now\";\n } else if (minutes < 60) {\n return `${minutes} minute${minutes === 1 ? \"\" : \"s\"} ago`;\n } else if (hours < 24) {\n return `${hours} hour${hours === 1 ? \"\" : \"s\"} ago`;\n } else if (days < 7) {\n return `${days} day${days === 1 ? \"\" : \"s\"} ago`;\n } else if (weeks < 4) {\n return `${weeks} week${weeks === 1 ? \"\" : \"s\"} ago`;\n } else if (months < 12) {\n return `${months} month${months === 1 ? \"\" : \"s\"} ago`;\n } else {\n return `${years} year${years === 1 ? \"\" : \"s\"} ago`;\n }\n};\n","import type { JSX } from \"solid-js\";\n\ninterface ButtonProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: \"default\" | \"ghost\";\n size?: \"default\" | \"sm\";\n}\n\nexport function Button(props: ButtonProps) {\n return (\n <button\n {...props}\n class={`sync-copy-btn ${props.class ?? \"\"}`}\n >\n {props.children}\n </button>\n );\n}\n","import {\n type JSX,\n createSignal,\n createContext,\n useContext,\n onCleanup,\n createEffect,\n on,\n} from \"solid-js\";\nimport { Portal } from \"solid-js/web\";\n\ninterface PopoverContextValue {\n open: () => boolean;\n setOpen: (v: boolean) => void;\n triggerRef: () => HTMLButtonElement | undefined;\n setTriggerRef: (el: HTMLButtonElement) => void;\n}\n\nconst PopoverContext = createContext<PopoverContextValue>();\n\nexport function Popover(props: {\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n children: JSX.Element;\n}) {\n const [internalOpen, setInternalOpen] = createSignal(false);\n const [triggerRef, setTriggerRef] = createSignal<HTMLButtonElement>();\n\n const isOpen = () =>\n props.open !== undefined ? props.open : internalOpen();\n\n const setOpen = (v: boolean) => {\n if (props.open === undefined) {\n setInternalOpen(v);\n }\n props.onOpenChange?.(v);\n };\n\n return (\n <PopoverContext.Provider\n value={{ open: isOpen, setOpen, triggerRef, setTriggerRef }}\n >\n <div class=\"sync-popover-wrapper\">{props.children}</div>\n </PopoverContext.Provider>\n );\n}\n\nexport function PopoverTrigger(props: {\n class?: string;\n children: JSX.Element;\n}) {\n const ctx = useContext(PopoverContext)!;\n\n return (\n <button\n ref={(el) => ctx.setTriggerRef(el)}\n type=\"button\"\n class={props.class ?? \"\"}\n onClick={() => ctx.setOpen(!ctx.open())}\n >\n {props.children}\n </button>\n );\n}\n\nexport function PopoverContent(props: {\n class?: string;\n children: JSX.Element;\n}) {\n const ctx = useContext(PopoverContext)!;\n let contentRef!: HTMLDivElement;\n const [position, setPosition] = createSignal({ top: 0, left: 0 });\n\n const updatePosition = () => {\n const trigger = ctx.triggerRef();\n if (!trigger) return;\n const rect = trigger.getBoundingClientRect();\n setPosition({\n top: rect.bottom + 8,\n left: Math.max(0, rect.right - 288),\n });\n };\n\n createEffect(\n on(ctx.open, (open) => {\n if (!open) return;\n\n updatePosition();\n\n const handleClickOutside = (event: MouseEvent) => {\n const target = event.target as Node;\n if (\n contentRef &&\n !contentRef.contains(target) &&\n ctx.triggerRef() &&\n !ctx.triggerRef()!.contains(target)\n ) {\n ctx.setOpen(false);\n }\n };\n\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n ctx.setOpen(false);\n }\n };\n\n document.addEventListener(\"mousedown\", handleClickOutside);\n document.addEventListener(\"keydown\", handleEscape);\n window.addEventListener(\"resize\", updatePosition);\n window.addEventListener(\"scroll\", updatePosition, true);\n\n onCleanup(() => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n document.removeEventListener(\"keydown\", handleEscape);\n window.removeEventListener(\"resize\", updatePosition);\n window.removeEventListener(\"scroll\", updatePosition, true);\n });\n })\n );\n\n return (\n <>\n {ctx.open() && (\n <Portal>\n <div\n ref={contentRef}\n class=\"sync-popover\"\n style={{\n top: `${position().top}px`,\n left: `${position().left}px`,\n }}\n >\n {props.children}\n </div>\n </Portal>\n )}\n </>\n );\n}\n","interface SyncIconProps {\n size?: number;\n class?: string;\n state?: \"synced\" | \"syncing\" | \"error\" | \"unknown\";\n}\n\nexport function SyncIcon(props: SyncIconProps) {\n const s = () => props.size ?? 20;\n const state = () => props.state ?? \"synced\";\n\n return (\n <svg\n width={s()}\n height={s()}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n class={props.class ?? \"\"}\n >\n <circle\n cx=\"12\"\n cy=\"12\"\n r=\"8\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n fill=\"currentColor\"\n fill-opacity={state() === \"synced\" ? 1 : 0}\n style={{\n transition: state() === \"synced\"\n ? \"fill-opacity 0s\"\n : \"fill-opacity 2s ease-out\",\n }}\n />\n {state() === \"error\" && (\n <circle cx=\"12\" cy=\"12\" r=\"2.5\" fill=\"currentColor\" />\n )}\n {state() === \"unknown\" && (\n <text\n x=\"12\"\n y=\"12\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n fill=\"currentColor\"\n font-size=\"11\"\n font-weight=\"bold\"\n >\n ?\n </text>\n )}\n </svg>\n );\n}\n","interface CopyIconProps {\n size?: number;\n}\n\nexport function CopyIcon(props: CopyIconProps) {\n const s = () => props.size ?? 14;\n return (\n <svg\n width={s()}\n height={s()}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\" />\n <path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\" />\n </svg>\n );\n}\n","import Debug from \"debug\";\nimport * as A from \"@automerge/automerge/slim\";\nimport {\n type DocHandle,\n type StorageId,\n type UrlHeads,\n type PeerId,\n} from \"@automerge/automerge-repo/slim\";\nimport {\n useRepo,\n RepoContext,\n} from \"solid-automerge\";\nimport {\n createSignal,\n createMemo,\n createEffect,\n on,\n onCleanup,\n untrack,\n Show,\n For,\n} from \"solid-js\";\nimport { createStore, reconcile } from \"solid-js/store\";\nimport {\n SYNCSTATE_CHANNEL,\n type SyncStateDocMessage,\n type SyncStateBroadcast,\n} from \"@inkandswitch/patchwork-bootloader/types\";\nimport { render } from \"solid-js/web\";\nimport type { ToolImplementation } from \"@inkandswitch/patchwork-plugins\";\nimport { getRelativeTimeString } from \"./lib/relative-time\";\nimport { Button, Popover, PopoverTrigger, PopoverContent } from \"./lib/ui\";\nimport { SyncIcon } from \"./SyncIcon\";\nimport { CopyIcon } from \"./CopyIcon\";\nimport \"./styles.css\";\n\nconst log = Debug(\"patchwork:sync-indicator\");\n\ndeclare global {\n // eslint-disable-next-line no-var\n var patchwork:\n | {\n sw?: {\n /**\n * Watch one document's sync heads. Calls `listener` on every update,\n * replaying current state on subscribe. Returns an unsubscribe fn.\n */\n subscribeSyncState?: (\n documentId: string,\n listener: (update: SyncStateDocMessage) => void\n ) => () => void;\n };\n }\n | undefined;\n}\n\nexport { RepoContext };\n\ninterface PeerSyncInfo {\n id: string;\n name: string;\n storageId: StorageId | undefined;\n heads: UrlHeads | undefined;\n lastSyncTimestamp: number | undefined;\n inSync: boolean;\n}\n\nfunction peerName(peerId: PeerId): string {\n if (\n peerId.startsWith(\"shared-worker\") ||\n peerId.startsWith(\"automerge-worker\")\n )\n return \"Shared Worker\";\n if (peerId.startsWith(\"service-worker\")) return \"Service Worker\";\n if (peerId.startsWith(\"storage-server\")) return \"Sync Server\";\n return String(peerId);\n}\n\nexport function SyncIndicator(props: { handle: DocHandle<unknown> }) {\n const repo = useRepo();\n const [isPopoverOpen, setIsPopoverOpen] = createSignal(false);\n const [now, setNow] = createSignal(Date.now());\n const [ownHeads, setOwnHeads] = createSignal<UrlHeads | undefined>();\n\n // Global sync signals from the shared worker's @patchwork/syncstate channel.\n // `connected` is the real Subduction link to the sync server — authoritative,\n // unlike navigator.onLine which only knows the OS network is up. `serverPeerIds`\n // are the sync server's storage ids and `workerPeerId` is the shared worker's\n // id; together they let us tell the server's heads apart from the worker's own\n // (which are identical to ours) instead of guessing \"unknown ⇒ server\".\n const [connected, setConnected] = createSignal(false);\n const [serverPeerIds, setServerPeerIds] = createSignal<string[]>([]);\n const [workerPeerId, setWorkerPeerId] = createSignal<string | undefined>();\n\n // sync server state — driven by the shared worker's BroadcastChannel\n const [syncServerHeads, setSyncServerHeads] = createSignal<\n UrlHeads | undefined\n >();\n const [syncServerTimestamp, setSyncServerTimestamp] = createSignal<\n number | undefined\n >();\n const [syncServerStorageId, setSyncServerStorageId] = createSignal<\n StorageId | undefined\n >();\n\n // connected peers (shared worker, etc)\n const [peers, setPeers] = createStore<PeerSyncInfo[]>([]);\n\n // \"Up to date with the sync server\". The server advertises Subduction\n // *sedimentree* heads (loose-commit + fragment-boundary ids), NOT the Automerge\n // frontier, so they can't be compared to our heads with A.equals — that's why\n // the row only ever read \"synced\" off the (mis-attributed) worker's automerge\n // heads. Ask the handle whether we already hold everything the server\n // advertises instead, exactly like the worker's own resync check.\n const containsServerHeads = (heads: UrlHeads | undefined): boolean => {\n if (!heads || heads.length === 0) return false;\n try {\n return props.handle.containsHeads(heads);\n } catch {\n return false; // doc not ready, or an undecodable head\n }\n };\n\n /**\n * Trim the sync server's advertised heads for display: drop heads we already\n * hold in our history (most server sedimentree tips are interior commits we\n * have), keeping our current frontier tip(s) plus any head we genuinely lack.\n * Display only; the synced verdict still considers the full set.\n */\n function trimSeenServerHeads(\n heads: UrlHeads | undefined\n ): UrlHeads | undefined {\n if (!heads) return heads;\n\n let frontier: Set<string>;\n try {\n frontier = new Set<string>([...props.handle.heads()]);\n } catch {\n return heads;\n }\n\n return heads.filter((h) => {\n if (frontier.has(h)) return true; // our latest shared tip — keep\n try {\n return !props.handle.containsHeads([h] as UrlHeads);\n } catch {\n return true; // can't decide → keep\n }\n }) as UrlHeads;\n }\n\n // tick every second while popover is open (for relative times), and rebuild\n // the peer list from repo.peers each time it opens so every currently\n // connected peer shows up (the repo has no peer connect/disconnect event to\n // subscribe to, so we refresh on open rather than trying to track it live).\n createEffect(\n on(isPopoverOpen, (open) => {\n if (!open) return;\n untrack(refreshPeers);\n const interval = setInterval(() => setNow(Date.now()), 1000);\n onCleanup(() => clearInterval(interval));\n })\n );\n\n // Global connection + whoami signals arrive over the worker's\n // @patchwork/syncstate BroadcastChannel (per-doc heads do NOT — those are the\n // addressed subscribeSyncState pushes below). Open it once, ask the worker to\n // replay the current snapshot, and keep our signals live.\n createEffect(() => {\n let channel: BroadcastChannel;\n try {\n channel = new BroadcastChannel(SYNCSTATE_CHANNEL);\n } catch {\n return; // no BroadcastChannel available — degrade gracefully\n }\n const onMessage = (event: MessageEvent) => {\n const data = event.data as SyncStateBroadcast | undefined;\n if (!data) return;\n if (data.type === \"connection\") {\n setConnected(data.connected);\n setServerPeerIds(data.serverPeerIds ?? []);\n } else if (data.type === \"whoami\") {\n setWorkerPeerId(data.peerId);\n }\n };\n channel.addEventListener(\"message\", onMessage);\n // Replay the current global snapshot to this freshly-opened tab.\n channel.postMessage({ type: \"request\" });\n onCleanup(() => {\n channel.removeEventListener(\"message\", onMessage);\n channel.close();\n });\n });\n\n /** Update sync-server signals and the \"Sync Server\" peer-list entry. */\n function applySyncServerUpdate(\n storageId: StorageId,\n heads: UrlHeads,\n timestamp: number\n ) {\n setSyncServerStorageId(storageId);\n setSyncServerHeads(heads);\n setSyncServerTimestamp(timestamp);\n\n const idx = peers.findIndex((p) => p.name === \"Sync Server\");\n if (idx >= 0) {\n setPeers(idx, {\n storageId,\n heads,\n lastSyncTimestamp: timestamp,\n inSync: containsServerHeads(heads),\n });\n }\n }\n\n // track own heads + remote heads\n createEffect(() => {\n const h = props.handle;\n\n setOwnHeads(h.heads());\n\n const onChange = () => {\n if (h.doc()) setOwnHeads(h.heads());\n };\n\n const onRemoteHeads = ({\n storageId,\n heads,\n timestamp,\n }: {\n storageId: StorageId;\n heads: UrlHeads;\n timestamp: number;\n }) => {\n log(\"remote-heads\", { storageId, heads, timestamp });\n\n // update peer entry if it matches a known peer\n const idx = peers.findIndex((p) => p.storageId === storageId);\n if (idx >= 0) {\n const currentHeads = ownHeads();\n setPeers(idx, {\n heads,\n lastSyncTimestamp: timestamp,\n inSync: currentHeads ? A.equals(currentHeads, heads) : false,\n });\n }\n };\n\n h.on(\"change\", onChange);\n h.on(\"remote-heads\", onRemoteHeads);\n\n // Update one repo-peer row (another tab, storage server): those advertise\n // Automerge frontier heads, so A.equals is the right \"in sync\" test here.\n const updatePeerRow = (idx: number, heads: UrlHeads, timestamp: number) => {\n const currentHeads = ownHeads();\n setPeers(idx, {\n heads,\n lastSyncTimestamp: timestamp,\n inSync: currentHeads ? A.equals(currentHeads, heads) : false,\n });\n };\n\n // Subscribe to this doc's sync heads from the automerge worker. It replays\n // the current state on subscribe and pushes every update, keyed by the\n // sender's storage id. Attribute each update by *who* sent it, using the\n // identities the worker announces on the syncstate channel — NEVER \"unknown\n // ⇒ must be the server\", which funnels the worker's OWN heads (identical to\n // ours) into the server row so it looks perpetually \"synced\".\n const onSyncState = (update: SyncStateDocMessage) => {\n if (update.documentId !== h.documentId) return;\n log(\"sync-state\", update);\n\n const heads = update.heads as UrlHeads;\n const sid = update.storageId;\n\n // The real sync server (definitive: it told us its ids over `connection`).\n if (serverPeerIds().includes(sid)) {\n applySyncServerUpdate(sid as StorageId, heads, update.timestamp);\n return;\n }\n // The shared worker's own heads (keyed by its whoami peerId). Its row is\n // hidden outside debug; update it if present, otherwise ignore — it must\n // never fall through to the sync-server slot.\n if (workerPeerId() && sid === workerPeerId()) {\n const idx = peers.findIndex((p) => p.storageId === sid);\n if (idx >= 0) updatePeerRow(idx, heads, update.timestamp);\n return;\n }\n // A known repo peer, matched by storage id.\n const idx = peers.findIndex((p) => p.storageId === sid);\n if (idx >= 0) {\n updatePeerRow(idx, heads, update.timestamp);\n return;\n }\n // Unknown sender that isn't the worker: once whoami has arrived the only\n // remaining Subduction sender is the sync server, so attribute it there.\n // Before whoami lands, drop it rather than risk mislabeling worker heads.\n if (workerPeerId()) {\n applySyncServerUpdate(sid as StorageId, heads, update.timestamp);\n }\n };\n\n const unsubscribeSyncState =\n globalThis?.patchwork?.sw?.subscribeSyncState?.(\n h.documentId,\n onSyncState\n );\n\n // Build the initial peer list. refreshPeers() reads the syncServer* signals,\n // and onSyncState *writes* them on every update — so tracking those reads\n // here would make this effect re-run (tearing down and re-subscribing, which\n // makes the worker replay) on every single sync-state message: a feedback\n // loop that floods messages, flickers the peer list, and kills the shared\n // worker. untrack keeps this effect depending on props.handle alone.\n untrack(refreshPeers);\n\n onCleanup(() => {\n h.off(\"change\", onChange);\n h.off(\"remote-heads\", onRemoteHeads);\n unsubscribeSyncState?.();\n });\n });\n\n function refreshPeers() {\n const h = props.handle;\n const currentHeads = h.heads();\n const peerList: PeerSyncInfo[] = repo.peers.map((peerId) => {\n const storageId = repo.getStorageIdOfPeer(peerId);\n const syncInfo = storageId ? h.getSyncInfo(storageId) : undefined;\n return {\n id: peerId,\n name: peerName(peerId),\n storageId,\n heads: syncInfo?.lastHeads,\n lastSyncTimestamp: syncInfo?.lastSyncTimestamp,\n inSync:\n syncInfo?.lastHeads && currentHeads\n ? A.equals(currentHeads, syncInfo.lastHeads)\n : false,\n };\n });\n\n // Always add sync server as a virtual peer — the main thread\n // doesn't talk to it directly; its state comes from the shared\n // worker's @patchwork/syncstate BroadcastChannel / IndexedDB.\n {\n const serverHeads = syncServerHeads();\n const serverTs = syncServerTimestamp();\n peerList.push({\n id: \"sync-server\",\n name: \"Sync Server\",\n storageId: syncServerStorageId(),\n heads: serverHeads,\n lastSyncTimestamp: serverTs,\n // sedimentree heads — use containsHeads, not A.equals (see helper).\n inSync: containsServerHeads(serverHeads),\n });\n }\n\n // sort: shared worker first, sync server last\n const peerOrder = (p: PeerSyncInfo) =>\n p.name === \"Shared Worker\" ? 0 : p.name === \"Sync Server\" ? 2 : 1;\n peerList.sort((a, b) => peerOrder(a) - peerOrder(b));\n\n log(\"peers\", peerList);\n // Show every connected peer, including our own shared worker — the icon\n // stays driven by the sync server (see syncedToServer), but the popover is\n // a full readout of who we're talking to.\n setPeers(reconcile(peerList));\n }\n\n // recompute inSync when own heads change\n createEffect(() => {\n const currentHeads = ownHeads();\n if (!currentHeads) return;\n for (let i = 0; i < peers.length; i++) {\n const peer = peers[i];\n // The sync server advertises sedimentree heads → containsHeads, not\n // A.equals (which is right for automerge-frontier peers).\n const inSync =\n peer.name === \"Sync Server\"\n ? containsServerHeads(peer.heads)\n : peer.heads\n ? A.equals(currentHeads, peer.heads)\n : false;\n if (peer.inSync !== inSync) {\n setPeers(i, \"inSync\", inSync);\n }\n }\n });\n\n // Single source of truth for \"are we up to date with the sync server\". Both\n // the icon AND the Sync Server row read this one memo. Previously the icon\n // derived it live (`containsServerHeads`) while the row rendered a separately\n // stored `peer.inSync` snapshot, set on a different code path — so a fast\n // burst of edits could settle with the two disagreeing (icon still \"syncing\"\n // while the row already said \"synced\"). One memo, read in both places, can't\n // diverge.\n const syncedToServer = createMemo(() => {\n ownHeads(); // re-evaluate when our heads move (containsHeads reads the doc)\n return containsServerHeads(syncServerHeads());\n });\n\n const syncServerKnown = () => !!syncServerHeads();\n\n // Status label for one peer row. The Sync Server row reflects `syncedToServer`\n // (the same memo the icon uses); everyone else compares stored heads.\n const peerStatusLabel = (peer: PeerSyncInfo) => {\n const inSync = peer.name === \"Sync Server\" ? syncedToServer() : peer.inSync;\n return inSync ? \"synced\" : peer.heads ? \"behind\" : \"unknown\";\n };\n\n const displayHeads = (peer: PeerSyncInfo) => {\n if (peer.name !== \"Sync Server\") return peer.heads;\n ownHeads(); // re-render the trimmed display when our frontier moves\n return trimSeenServerHeads(peer.heads);\n };\n\n const iconState = (): \"synced\" | \"syncing\" | \"error\" | \"unknown\" => {\n if (!connected()) return \"error\"; // no live link to the sync server\n if (!syncServerKnown()) return \"unknown\";\n return syncedToServer() ? \"synced\" : \"syncing\";\n };\n\n const statusText = () => {\n if (!connected()) return \"Offline\";\n if (!syncServerKnown()) return \"Connecting…\";\n return syncedToServer() ? \"Synced to server\" : \"Syncing…\";\n };\n\n const onCopy = async () => {\n const data = {\n ownHeads: ownHeads(),\n syncServer: {\n storageId: syncServerStorageId(),\n heads: syncServerHeads(),\n lastSyncTimestamp: syncServerTimestamp(),\n inSync: syncedToServer(),\n },\n peers: peers.map((p) => ({\n name: p.name,\n id: p.id,\n storageId: p.storageId,\n heads: p.heads,\n lastSyncTimestamp: p.lastSyncTimestamp,\n inSync: p.inSync,\n })),\n };\n try {\n await navigator.clipboard.writeText(JSON.stringify(data, null, 2));\n log(\"copied sync state to clipboard\", data);\n } catch (err) {\n log(\"failed to copy sync state:\", err);\n }\n };\n\n const relativeTime = (ts: number | undefined) => {\n void now();\n return ts ? getRelativeTimeString(ts) : \"-\";\n };\n\n const copyHeads = async (heads: UrlHeads | undefined) => {\n if (!heads) return;\n try {\n await navigator.clipboard.writeText(JSON.stringify(heads));\n } catch (err) {\n log(\"failed to copy heads:\", err);\n }\n };\n\n return (\n <Popover open={isPopoverOpen()} onOpenChange={setIsPopoverOpen}>\n <PopoverTrigger\n class={connected() ? \"sync-trigger\" : \"sync-trigger-offline\"}\n >\n <SyncIcon size={20} state={iconState()} />\n </PopoverTrigger>\n <PopoverContent>\n <div class=\"sync-popover-body\">\n <div class=\"sync-status-header\">{statusText()}</div>\n\n <div class=\"sync-peers\">\n <div\n class=\"sync-peer sync-peer-clickable\"\n onClick={() => copyHeads(ownHeads())}\n >\n <div class=\"sync-peer-header\">\n <span class=\"sync-peer-name\">Tab</span>\n </div>\n <div class=\"sync-peer-detail\">\n heads:{\" \"}\n {JSON.stringify((ownHeads() ?? []).map((h) => h.slice(0, 6)))}\n </div>\n </div>\n\n <For each={peers}>\n {(peer) => (\n <>\n <div\n class=\"sync-peer sync-peer-clickable\"\n onClick={() => copyHeads(peer.heads)}\n >\n <div class=\"sync-peer-header\">\n <span class=\"sync-peer-name\">{peer.name}</span>\n <span class=\"sync-peer-status\">\n {peerStatusLabel(peer)}\n </span>\n </div>\n <Show when={displayHeads(peer)}>\n {(heads) => (\n <div class=\"sync-peer-detail\">\n heads:{\" \"}\n {JSON.stringify(heads().map((h) => h.slice(0, 6)))}\n </div>\n )}\n </Show>\n <Show when={peer.lastSyncTimestamp}>\n <div class=\"sync-peer-detail\">\n {relativeTime(peer.lastSyncTimestamp)}\n </div>\n </Show>\n </div>\n </>\n )}\n </For>\n </div>\n\n <div class=\"sync-footer\">\n <Button onClick={onCopy}>\n <CopyIcon size={14} />\n </Button>\n </div>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n\nexport const renderSyncIndicator: ToolImplementation = (handle, element) => {\n element.style.width = \"fit-content\";\n element.style.zIndex = \"10\";\n\n const dispose = render(\n () => (\n <RepoContext.Provider value={element.repo}>\n <SyncIndicator handle={handle} />\n </RepoContext.Provider>\n ),\n element\n );\n return () => dispose();\n};\n"],"names":["s","m","h","d","w","y","ms","val","options","type","parse","fmtLong","fmtShort","str","match","n","msAbs","plural","name","isPlural","setup","env","createDebug","coerce","disable","enable","enabled","require$$0","destroy","key","selectColor","namespace","hash","i","prevTime","enableOverride","namespacesCache","enabledCache","debug","args","self","curr","index","format","formatter","extend","v","delimiter","newDebug","namespaces","split","ns","matchesTemplate","search","template","searchIndex","templateIndex","starIndex","matchIndex","skip","common","exports","formatArgs","save","load","useColors","localstorage","warned","module","lastC","r","define_process_env_default","formatters","error","RepoContext","createContext","useRepo","repo","useContext","SYNCSTATE_CHANNEL","getRelativeTimeString","timestamp","diff","seconds","minutes","hours","days","weeks","months","years","Button","props","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","children","PopoverContext","Popover","internalOpen","setInternalOpen","createSignal","triggerRef","setTriggerRef","isOpen","open","undefined","setOpen","onOpenChange","_$createComponent","Provider","value","PopoverTrigger","ctx","_el$2","_tmpl$2","$$click","_$use","el","_$effect","_$className","PopoverContent","contentRef","position","setPosition","top","left","updatePosition","trigger","rect","getBoundingClientRect","bottom","Math","max","right","createEffect","on","handleClickOutside","event","target","contains","handleEscape","document","addEventListener","window","onCleanup","removeEventListener","_$memo","Portal","_el$3","_tmpl$3","_ref$","_p$","_v$","_v$2","e","_$setStyleProperty","t","_$delegateEvents","SyncIcon","size","state","firstChild","_c$","_c$2","_v$3","_v$4","_v$5","_$setAttribute","a","o","CopyIcon","log","Debug","peerName","peerId","startsWith","String","SyncIndicator","isPopoverOpen","setIsPopoverOpen","now","setNow","Date","ownHeads","setOwnHeads","connected","setConnected","serverPeerIds","setServerPeerIds","workerPeerId","setWorkerPeerId","syncServerHeads","setSyncServerHeads","syncServerTimestamp","setSyncServerTimestamp","syncServerStorageId","setSyncServerStorageId","peers","setPeers","createStore","containsServerHeads","heads","length","handle","containsHeads","trimSeenServerHeads","frontier","Set","filter","has","untrack","refreshPeers","interval","setInterval","clearInterval","channel","BroadcastChannel","onMessage","data","postMessage","close","applySyncServerUpdate","storageId","idx","findIndex","p","lastSyncTimestamp","inSync","onChange","doc","onRemoteHeads","currentHeads","A","equals","updatePeerRow","onSyncState","update","documentId","sid","includes","unsubscribeSyncState","globalThis","patchwork","sw","subscribeSyncState","off","peerList","map","getStorageIdOfPeer","syncInfo","getSyncInfo","id","lastHeads","serverHeads","serverTs","push","peerOrder","sort","b","reconcile","peer","syncedToServer","createMemo","syncServerKnown","peerStatusLabel","displayHeads","iconState","statusText","onCopy","syncServer","navigator","clipboard","writeText","JSON","stringify","err","relativeTime","ts","copyHeads","nextSibling","_el$4","_el$5","_el$6","_el$9","slice","For","each","_el$0","_el$1","_el$10","_el$11","Show","when","_el$13","_tmpl$4","_el$12","onClick","renderSyncIndicator","element","style","width","zIndex","dispose","render"],"mappings":"0sBAIA,IAAIA,EAAI,IACJC,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,EAAID,EAAI,GACRE,EAAID,EAAI,EACRE,EAAIF,EAAI,OAgBZG,EAAiB,SAAUC,EAAKC,EAAS,CACvCA,EAAUA,GAAW,CAAA,EACrB,IAAIC,EAAO,OAAOF,EAClB,GAAIE,IAAS,UAAYF,EAAI,OAAS,EACpC,OAAOG,EAAMH,CAAG,EACX,GAAIE,IAAS,UAAY,SAASF,CAAG,EAC1C,OAAOC,EAAQ,KAAOG,EAAQJ,CAAG,EAAIK,EAASL,CAAG,EAEnD,MAAM,IAAI,MACR,wDACE,KAAK,UAAUA,CAAG,EAExB,EAUA,SAASG,EAAMG,EAAK,CAElB,GADAA,EAAM,OAAOA,CAAG,EACZ,EAAAA,EAAI,OAAS,KAGj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
// ../node_modules/.pnpm/ws@8.21.2/node_modules/ws/browser.js
|
|
506
506
|
var require_browser2 = __commonJS({
|
|
507
|
-
"../node_modules/.pnpm/ws@8.21.
|
|
507
|
+
"../node_modules/.pnpm/ws@8.21.2/node_modules/ws/browser.js"(exports, module) {
|
|
508
508
|
"use strict";
|
|
509
509
|
module.exports = function() {
|
|
510
510
|
throw new Error(
|