app/assets/build/coco/app.js in coveragebook_components-0.6.4 vs app/assets/build/coco/app.js in coveragebook_components-0.6.5

- old
+ new

@@ -32,13 +32,10 @@ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) target[prop] = source[prop]; } return target; }; - var __esm = (fn3, res) => function __init() { - return fn3 && (res = (0, fn3[__getOwnPropNames(fn3)[0]])(fn3 = 0)), res; - }; var __commonJS = (cb, mod3) => function __require() { return mod3 || (0, cb[__getOwnPropNames(cb)[0]])((mod3 = { exports: {} }).exports, mod3), mod3.exports; }; var __export = (target, all) => { for (var name in all) @@ -59,579 +56,10 @@ // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod3 || !mod3.__esModule ? __defProp(target, "default", { value: mod3, enumerable: true }) : target, mod3 )); - // ../../../node_modules/@rails/actioncable/src/adapters.js - var adapters_default; - var init_adapters = __esm({ - "../../../node_modules/@rails/actioncable/src/adapters.js"() { - adapters_default = { - logger: self.console, - WebSocket: self.WebSocket - }; - } - }); - - // ../../../node_modules/@rails/actioncable/src/logger.js - var logger_default; - var init_logger = __esm({ - "../../../node_modules/@rails/actioncable/src/logger.js"() { - init_adapters(); - logger_default = { - log(...messages) { - if (this.enabled) { - messages.push(Date.now()); - adapters_default.logger.log("[ActionCable]", ...messages); - } - } - }; - } - }); - - // ../../../node_modules/@rails/actioncable/src/connection_monitor.js - var now, secondsSince, ConnectionMonitor, connection_monitor_default; - var init_connection_monitor = __esm({ - "../../../node_modules/@rails/actioncable/src/connection_monitor.js"() { - init_logger(); - now = () => (/* @__PURE__ */ new Date()).getTime(); - secondsSince = (time) => (now() - time) / 1e3; - ConnectionMonitor = class { - constructor(connection) { - this.visibilityDidChange = this.visibilityDidChange.bind(this); - this.connection = connection; - this.reconnectAttempts = 0; - } - start() { - if (!this.isRunning()) { - this.startedAt = now(); - delete this.stoppedAt; - this.startPolling(); - addEventListener("visibilitychange", this.visibilityDidChange); - logger_default.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`); - } - } - stop() { - if (this.isRunning()) { - this.stoppedAt = now(); - this.stopPolling(); - removeEventListener("visibilitychange", this.visibilityDidChange); - logger_default.log("ConnectionMonitor stopped"); - } - } - isRunning() { - return this.startedAt && !this.stoppedAt; - } - recordPing() { - this.pingedAt = now(); - } - recordConnect() { - this.reconnectAttempts = 0; - this.recordPing(); - delete this.disconnectedAt; - logger_default.log("ConnectionMonitor recorded connect"); - } - recordDisconnect() { - this.disconnectedAt = now(); - logger_default.log("ConnectionMonitor recorded disconnect"); - } - // Private - startPolling() { - this.stopPolling(); - this.poll(); - } - stopPolling() { - clearTimeout(this.pollTimeout); - } - poll() { - this.pollTimeout = setTimeout( - () => { - this.reconnectIfStale(); - this.poll(); - }, - this.getPollInterval() - ); - } - getPollInterval() { - const { staleThreshold, reconnectionBackoffRate } = this.constructor; - const backoff = Math.pow(1 + reconnectionBackoffRate, Math.min(this.reconnectAttempts, 10)); - const jitterMax = this.reconnectAttempts === 0 ? 1 : reconnectionBackoffRate; - const jitter = jitterMax * Math.random(); - return staleThreshold * 1e3 * backoff * (1 + jitter); - } - reconnectIfStale() { - if (this.connectionIsStale()) { - logger_default.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${secondsSince(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`); - this.reconnectAttempts++; - if (this.disconnectedRecently()) { - logger_default.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${secondsSince(this.disconnectedAt)} s`); - } else { - logger_default.log("ConnectionMonitor reopening"); - this.connection.reopen(); - } - } - } - get refreshedAt() { - return this.pingedAt ? this.pingedAt : this.startedAt; - } - connectionIsStale() { - return secondsSince(this.refreshedAt) > this.constructor.staleThreshold; - } - disconnectedRecently() { - return this.disconnectedAt && secondsSince(this.disconnectedAt) < this.constructor.staleThreshold; - } - visibilityDidChange() { - if (document.visibilityState === "visible") { - setTimeout( - () => { - if (this.connectionIsStale() || !this.connection.isOpen()) { - logger_default.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`); - this.connection.reopen(); - } - }, - 200 - ); - } - } - }; - ConnectionMonitor.staleThreshold = 6; - ConnectionMonitor.reconnectionBackoffRate = 0.15; - connection_monitor_default = ConnectionMonitor; - } - }); - - // ../../../node_modules/@rails/actioncable/src/internal.js - var internal_default; - var init_internal = __esm({ - "../../../node_modules/@rails/actioncable/src/internal.js"() { - internal_default = { - "message_types": { - "welcome": "welcome", - "disconnect": "disconnect", - "ping": "ping", - "confirmation": "confirm_subscription", - "rejection": "reject_subscription" - }, - "disconnect_reasons": { - "unauthorized": "unauthorized", - "invalid_request": "invalid_request", - "server_restart": "server_restart" - }, - "default_mount_path": "/cable", - "protocols": [ - "actioncable-v1-json", - "actioncable-unsupported" - ] - }; - } - }); - - // ../../../node_modules/@rails/actioncable/src/connection.js - var message_types, protocols, supportedProtocols, indexOf, Connection, connection_default; - var init_connection = __esm({ - "../../../node_modules/@rails/actioncable/src/connection.js"() { - init_adapters(); - init_connection_monitor(); - init_internal(); - init_logger(); - ({ message_types, protocols } = internal_default); - supportedProtocols = protocols.slice(0, protocols.length - 1); - indexOf = [].indexOf; - Connection = class { - constructor(consumer2) { - this.open = this.open.bind(this); - this.consumer = consumer2; - this.subscriptions = this.consumer.subscriptions; - this.monitor = new connection_monitor_default(this); - this.disconnected = true; - } - send(data2) { - if (this.isOpen()) { - this.webSocket.send(JSON.stringify(data2)); - return true; - } else { - return false; - } - } - open() { - if (this.isActive()) { - logger_default.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`); - return false; - } else { - logger_default.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${protocols}`); - if (this.webSocket) { - this.uninstallEventHandlers(); - } - this.webSocket = new adapters_default.WebSocket(this.consumer.url, protocols); - this.installEventHandlers(); - this.monitor.start(); - return true; - } - } - close({ allowReconnect } = { allowReconnect: true }) { - if (!allowReconnect) { - this.monitor.stop(); - } - if (this.isOpen()) { - return this.webSocket.close(); - } - } - reopen() { - logger_default.log(`Reopening WebSocket, current state is ${this.getState()}`); - if (this.isActive()) { - try { - return this.close(); - } catch (error2) { - logger_default.log("Failed to reopen WebSocket", error2); - } finally { - logger_default.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`); - setTimeout(this.open, this.constructor.reopenDelay); - } - } else { - return this.open(); - } - } - getProtocol() { - if (this.webSocket) { - return this.webSocket.protocol; - } - } - isOpen() { - return this.isState("open"); - } - isActive() { - return this.isState("open", "connecting"); - } - // Private - isProtocolSupported() { - return indexOf.call(supportedProtocols, this.getProtocol()) >= 0; - } - isState(...states) { - return indexOf.call(states, this.getState()) >= 0; - } - getState() { - if (this.webSocket) { - for (let state in adapters_default.WebSocket) { - if (adapters_default.WebSocket[state] === this.webSocket.readyState) { - return state.toLowerCase(); - } - } - } - return null; - } - installEventHandlers() { - for (let eventName in this.events) { - const handler3 = this.events[eventName].bind(this); - this.webSocket[`on${eventName}`] = handler3; - } - } - uninstallEventHandlers() { - for (let eventName in this.events) { - this.webSocket[`on${eventName}`] = function() { - }; - } - } - }; - Connection.reopenDelay = 500; - Connection.prototype.events = { - message(event) { - if (!this.isProtocolSupported()) { - return; - } - const { identifier, message: message2, reason, reconnect, type } = JSON.parse(event.data); - switch (type) { - case message_types.welcome: - this.monitor.recordConnect(); - return this.subscriptions.reload(); - case message_types.disconnect: - logger_default.log(`Disconnecting. Reason: ${reason}`); - return this.close({ allowReconnect: reconnect }); - case message_types.ping: - return this.monitor.recordPing(); - case message_types.confirmation: - this.subscriptions.confirmSubscription(identifier); - return this.subscriptions.notify(identifier, "connected"); - case message_types.rejection: - return this.subscriptions.reject(identifier); - default: - return this.subscriptions.notify(identifier, "received", message2); - } - }, - open() { - logger_default.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`); - this.disconnected = false; - if (!this.isProtocolSupported()) { - logger_default.log("Protocol is unsupported. Stopping monitor and disconnecting."); - return this.close({ allowReconnect: false }); - } - }, - close(event) { - logger_default.log("WebSocket onclose event"); - if (this.disconnected) { - return; - } - this.disconnected = true; - this.monitor.recordDisconnect(); - return this.subscriptions.notifyAll("disconnected", { willAttemptReconnect: this.monitor.isRunning() }); - }, - error() { - logger_default.log("WebSocket onerror event"); - } - }; - connection_default = Connection; - } - }); - - // ../../../node_modules/@rails/actioncable/src/subscription.js - var extend, Subscription; - var init_subscription = __esm({ - "../../../node_modules/@rails/actioncable/src/subscription.js"() { - extend = function(object, properties) { - if (properties != null) { - for (let key in properties) { - const value = properties[key]; - object[key] = value; - } - } - return object; - }; - Subscription = class { - constructor(consumer2, params = {}, mixin) { - this.consumer = consumer2; - this.identifier = JSON.stringify(params); - extend(this, mixin); - } - // Perform a channel action with the optional data passed as an attribute - perform(action, data2 = {}) { - data2.action = action; - return this.send(data2); - } - send(data2) { - return this.consumer.send({ command: "message", identifier: this.identifier, data: JSON.stringify(data2) }); - } - unsubscribe() { - return this.consumer.subscriptions.remove(this); - } - }; - } - }); - - // ../../../node_modules/@rails/actioncable/src/subscription_guarantor.js - var SubscriptionGuarantor, subscription_guarantor_default; - var init_subscription_guarantor = __esm({ - "../../../node_modules/@rails/actioncable/src/subscription_guarantor.js"() { - init_logger(); - SubscriptionGuarantor = class { - constructor(subscriptions) { - this.subscriptions = subscriptions; - this.pendingSubscriptions = []; - } - guarantee(subscription) { - if (this.pendingSubscriptions.indexOf(subscription) == -1) { - logger_default.log(`SubscriptionGuarantor guaranteeing ${subscription.identifier}`); - this.pendingSubscriptions.push(subscription); - } else { - logger_default.log(`SubscriptionGuarantor already guaranteeing ${subscription.identifier}`); - } - this.startGuaranteeing(); - } - forget(subscription) { - logger_default.log(`SubscriptionGuarantor forgetting ${subscription.identifier}`); - this.pendingSubscriptions = this.pendingSubscriptions.filter((s3) => s3 !== subscription); - } - startGuaranteeing() { - this.stopGuaranteeing(); - this.retrySubscribing(); - } - stopGuaranteeing() { - clearTimeout(this.retryTimeout); - } - retrySubscribing() { - this.retryTimeout = setTimeout( - () => { - if (this.subscriptions && typeof this.subscriptions.subscribe === "function") { - this.pendingSubscriptions.map((subscription) => { - logger_default.log(`SubscriptionGuarantor resubscribing ${subscription.identifier}`); - this.subscriptions.subscribe(subscription); - }); - } - }, - 500 - ); - } - }; - subscription_guarantor_default = SubscriptionGuarantor; - } - }); - - // ../../../node_modules/@rails/actioncable/src/subscriptions.js - var Subscriptions; - var init_subscriptions = __esm({ - "../../../node_modules/@rails/actioncable/src/subscriptions.js"() { - init_subscription(); - init_subscription_guarantor(); - init_logger(); - Subscriptions = class { - constructor(consumer2) { - this.consumer = consumer2; - this.guarantor = new subscription_guarantor_default(this); - this.subscriptions = []; - } - create(channelName, mixin) { - const channel = channelName; - const params = typeof channel === "object" ? channel : { channel }; - const subscription = new Subscription(this.consumer, params, mixin); - return this.add(subscription); - } - // Private - add(subscription) { - this.subscriptions.push(subscription); - this.consumer.ensureActiveConnection(); - this.notify(subscription, "initialized"); - this.subscribe(subscription); - return subscription; - } - remove(subscription) { - this.forget(subscription); - if (!this.findAll(subscription.identifier).length) { - this.sendCommand(subscription, "unsubscribe"); - } - return subscription; - } - reject(identifier) { - return this.findAll(identifier).map((subscription) => { - this.forget(subscription); - this.notify(subscription, "rejected"); - return subscription; - }); - } - forget(subscription) { - this.guarantor.forget(subscription); - this.subscriptions = this.subscriptions.filter((s3) => s3 !== subscription); - return subscription; - } - findAll(identifier) { - return this.subscriptions.filter((s3) => s3.identifier === identifier); - } - reload() { - return this.subscriptions.map((subscription) => this.subscribe(subscription)); - } - notifyAll(callbackName, ...args) { - return this.subscriptions.map((subscription) => this.notify(subscription, callbackName, ...args)); - } - notify(subscription, callbackName, ...args) { - let subscriptions; - if (typeof subscription === "string") { - subscriptions = this.findAll(subscription); - } else { - subscriptions = [subscription]; - } - return subscriptions.map((subscription2) => typeof subscription2[callbackName] === "function" ? subscription2[callbackName](...args) : void 0); - } - subscribe(subscription) { - if (this.sendCommand(subscription, "subscribe")) { - this.guarantor.guarantee(subscription); - } - } - confirmSubscription(identifier) { - logger_default.log(`Subscription confirmed ${identifier}`); - this.findAll(identifier).map((subscription) => this.guarantor.forget(subscription)); - } - sendCommand(subscription, command) { - const { identifier } = subscription; - return this.consumer.send({ command, identifier }); - } - }; - } - }); - - // ../../../node_modules/@rails/actioncable/src/consumer.js - function createWebSocketURL(url) { - if (typeof url === "function") { - url = url(); - } - if (url && !/^wss?:/i.test(url)) { - const a3 = document.createElement("a"); - a3.href = url; - a3.href = a3.href; - a3.protocol = a3.protocol.replace("http", "ws"); - return a3.href; - } else { - return url; - } - } - var Consumer; - var init_consumer = __esm({ - "../../../node_modules/@rails/actioncable/src/consumer.js"() { - init_connection(); - init_subscriptions(); - Consumer = class { - constructor(url) { - this._url = url; - this.subscriptions = new Subscriptions(this); - this.connection = new connection_default(this); - } - get url() { - return createWebSocketURL(this._url); - } - send(data2) { - return this.connection.send(data2); - } - connect() { - return this.connection.open(); - } - disconnect() { - return this.connection.close({ allowReconnect: false }); - } - ensureActiveConnection() { - if (!this.connection.isActive()) { - return this.connection.open(); - } - } - }; - } - }); - - // ../../../node_modules/@rails/actioncable/src/index.js - var src_exports = {}; - __export(src_exports, { - Connection: () => connection_default, - ConnectionMonitor: () => connection_monitor_default, - Consumer: () => Consumer, - INTERNAL: () => internal_default, - Subscription: () => Subscription, - SubscriptionGuarantor: () => subscription_guarantor_default, - Subscriptions: () => Subscriptions, - adapters: () => adapters_default, - createConsumer: () => createConsumer, - createWebSocketURL: () => createWebSocketURL, - getConfig: () => getConfig, - logger: () => logger_default - }); - function createConsumer(url = getConfig("url") || internal_default.default_mount_path) { - return new Consumer(url); - } - function getConfig(name) { - const element = document.head.querySelector(`meta[name='action-cable-${name}']`); - if (element) { - return element.getAttribute("content"); - } - } - var init_src = __esm({ - "../../../node_modules/@rails/actioncable/src/index.js"() { - init_connection(); - init_connection_monitor(); - init_consumer(); - init_internal(); - init_subscription(); - init_subscriptions(); - init_subscription_guarantor(); - init_adapters(); - init_logger(); - } - }); - // ../../../node_modules/lodash/lodash.js var require_lodash = __commonJS({ "../../../node_modules/lodash/lodash.js"(exports, module) { (function() { var undefined2; @@ -1191,12 +619,12 @@ function baseValues(object, props) { return arrayMap(props, function(key) { return object[key]; }); } - function cacheHas(cache2, key) { - return cache2.has(key); + function cacheHas(cache, key) { + return cache.has(key); } function charsStartIndex(strSymbols, chrSymbols) { var index = -1, length = strSymbols.length; while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) { } @@ -1467,11 +895,11 @@ result2.__dir__ *= -1; } return result2; } function lazyValue() { - var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray2(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start5 = view.start, end2 = view.end, length = end2 - start5, index = isRight ? end2 : start5 - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); + var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray2(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start3 = view.start, end2 = view.end, length = end2 - start3, index = isRight ? end2 : start3 - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); if (!isArr || !isRight && arrLength == length && takeCount == length) { return baseWrapperValue(array, this.__actions__); } var result2 = []; outer: @@ -1902,23 +1330,23 @@ var computed = current, result2 = value; } } return result2; } - function baseFill(array, value, start5, end2) { + function baseFill(array, value, start3, end2) { var length = array.length; - start5 = toInteger(start5); - if (start5 < 0) { - start5 = -start5 > length ? 0 : length + start5; + start3 = toInteger(start3); + if (start3 < 0) { + start3 = -start3 > length ? 0 : length + start3; } end2 = end2 === undefined2 || end2 > length ? length : toInteger(end2); if (end2 < 0) { end2 += length; } - end2 = start5 > end2 ? 0 : toLength(end2); - while (start5 < end2) { - array[start5++] = value; + end2 = start3 > end2 ? 0 : toLength(end2); + while (start3 < end2) { + array[start3++] = value; } return array; } function baseFilter(collection, predicate) { var result2 = []; @@ -1985,12 +1413,12 @@ return object != null && hasOwnProperty3.call(object, key); } function baseHasIn(object, key) { return object != null && key in Object2(object); } - function baseInRange(number, start5, end2) { - return number >= nativeMin(start5, end2) && number < nativeMax(start5, end2); + function baseInRange(number, start3, end2) { + return number >= nativeMin(start3, end2) && number < nativeMax(start3, end2); } function baseIntersection(arrays, iteratee2, comparator) { var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = []; while (othIndex--) { var array = arrays[othIndex]; @@ -2007,12 +1435,12 @@ var value = array[index], computed = iteratee2 ? iteratee2(value) : value; value = comparator || value !== 0 ? value : 0; if (!(seen ? cacheHas(seen, computed) : includes2(result2, computed, comparator))) { othIndex = othLength; while (--othIndex) { - var cache2 = caches[othIndex]; - if (!(cache2 ? cacheHas(cache2, computed) : includes2(arrays[othIndex], computed, comparator))) { + var cache = caches[othIndex]; + if (!(cache ? cacheHas(cache, computed) : includes2(arrays[othIndex], computed, comparator))) { continue outer; } } if (seen) { seen.push(computed); @@ -2308,20 +1736,20 @@ return function(object) { return baseGet(object, path); }; } function basePullAll(array, values2, iteratee2, comparator) { - var indexOf3 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array; + var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array; if (array === values2) { values2 = copyArray(values2); } if (iteratee2) { seen = arrayMap(array, baseUnary(iteratee2)); } while (++index < length) { var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value; - while ((fromIndex = indexOf3(seen, computed, fromIndex, comparator)) > -1) { + while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) { if (seen !== array) { splice.call(seen, fromIndex, 1); } splice.call(array, fromIndex, 1); } @@ -2344,15 +1772,15 @@ return array; } function baseRandom(lower, upper) { return lower + nativeFloor(nativeRandom() * (upper - lower + 1)); } - function baseRange(start5, end2, step, fromRight) { - var index = -1, length = nativeMax(nativeCeil((end2 - start5) / (step || 1)), 0), result2 = Array2(length); + function baseRange(start3, end2, step, fromRight) { + var index = -1, length = nativeMax(nativeCeil((end2 - start3) / (step || 1)), 0), result2 = Array2(length); while (length--) { - result2[fromRight ? length : ++index] = start5; - start5 += step; + result2[fromRight ? length : ++index] = start3; + start3 += step; } return result2; } function baseRepeat(string, n3) { var result2 = ""; @@ -2368,12 +1796,12 @@ string += string; } } while (n3); return result2; } - function baseRest(func, start5) { - return setToString(overRest(func, start5, identity), func + ""); + function baseRest(func, start3) { + return setToString(overRest(func, start3, identity), func + ""); } function baseSample(collection) { return arraySample(values(collection)); } function baseSampleSize(collection, n3) { @@ -2416,24 +1844,24 @@ }); }; function baseShuffle(collection) { return shuffleSelf(values(collection)); } - function baseSlice(array, start5, end2) { + function baseSlice(array, start3, end2) { var index = -1, length = array.length; - if (start5 < 0) { - start5 = -start5 > length ? 0 : length + start5; + if (start3 < 0) { + start3 = -start3 > length ? 0 : length + start3; } end2 = end2 > length ? length : end2; if (end2 < 0) { end2 += length; } - length = start5 > end2 ? 0 : end2 - start5 >>> 0; - start5 >>>= 0; + length = start3 > end2 ? 0 : end2 - start3 >>> 0; + start3 >>>= 0; var result2 = Array2(length); while (++index < length) { - result2[index] = array[index + start5]; + result2[index] = array[index + start3]; } return result2; } function baseSome(collection, predicate) { var result2; @@ -2619,17 +2047,17 @@ return value; } return isKey(value, object) ? [value] : stringToPath(toString(value)); } var castRest = baseRest; - function castSlice(array, start5, end2) { + function castSlice(array, start3, end2) { var length = array.length; end2 = end2 === undefined2 ? length : end2; - return !start5 && end2 >= length ? array : baseSlice(array, start5, end2); + return !start3 && end2 >= length ? array : baseSlice(array, start3, end2); } - var clearTimeout2 = ctxClearTimeout || function(id2) { - return root.clearTimeout(id2); + var clearTimeout2 = ctxClearTimeout || function(id) { + return root.clearTimeout(id); }; function cloneBuffer(buffer, isDeep) { if (isDeep) { return buffer.slice(); } @@ -3040,23 +2468,23 @@ return apply(fn3, isBind ? thisArg : this, args); } return wrapper; } function createRange(fromRight) { - return function(start5, end2, step) { - if (step && typeof step != "number" && isIterateeCall(start5, end2, step)) { + return function(start3, end2, step) { + if (step && typeof step != "number" && isIterateeCall(start3, end2, step)) { end2 = step = undefined2; } - start5 = toFinite(start5); + start3 = toFinite(start3); if (end2 === undefined2) { - end2 = start5; - start5 = 0; + end2 = start3; + start3 = 0; } else { end2 = toFinite(end2); } - step = step === undefined2 ? start5 < end2 ? 1 : -1 : toFinite(step); - return baseRange(start5, end2, step, fromRight); + step = step === undefined2 ? start3 < end2 ? 1 : -1 : toFinite(step); + return baseRange(start3, end2, step, fromRight); }; } function createRelationalOperation(operator) { return function(value, other) { if (!(typeof value == "string" && typeof other == "string")) { @@ -3423,30 +2851,30 @@ } } return result2; }; } - function getView(start5, end2, transforms) { + function getView(start3, end2, transforms) { var index = -1, length = transforms.length; while (++index < length) { var data2 = transforms[index], size3 = data2.size; switch (data2.type) { case "drop": - start5 += size3; + start3 += size3; break; case "dropRight": end2 -= size3; break; case "take": - end2 = nativeMin(end2, start5 + size3); + end2 = nativeMin(end2, start3 + size3); break; case "takeRight": - start5 = nativeMax(start5, end2 - size3); + start3 = nativeMax(start3, end2 - size3); break; } } - return { "start": start5, "end": end2 }; + return { "start": start3, "end": end2 }; } function getWrapDetails(source) { var match = source.match(reWrapDetails); return match ? match[1].split(reSplitDetails) : []; } @@ -3582,16 +3010,16 @@ return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object)); }; } function memoizeCapped(func) { var result2 = memoize(func, function(key) { - if (cache2.size === MAX_MEMOIZE_SIZE) { - cache2.clear(); + if (cache.size === MAX_MEMOIZE_SIZE) { + cache.clear(); } return key; }); - var cache2 = result2.cache; + var cache = result2.cache; return result2; } function mergeData(data2, source) { var bitmask = data2[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG); var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data2[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG; @@ -3638,23 +3066,23 @@ return result2; } function objectToString2(value) { return nativeObjectToString.call(value); } - function overRest(func, start5, transform2) { - start5 = nativeMax(start5 === undefined2 ? func.length - 1 : start5, 0); + function overRest(func, start3, transform2) { + start3 = nativeMax(start3 === undefined2 ? func.length - 1 : start3, 0); return function() { - var args = arguments, index = -1, length = nativeMax(args.length - start5, 0), array = Array2(length); + var args = arguments, index = -1, length = nativeMax(args.length - start3, 0), array = Array2(length); while (++index < length) { - array[index] = args[start5 + index]; + array[index] = args[start3 + index]; } index = -1; - var otherArgs = Array2(start5 + 1); - while (++index < start5) { + var otherArgs = Array2(start3 + 1); + while (++index < start3) { otherArgs[index] = args[index]; } - otherArgs[start5] = transform2(array); + otherArgs[start3] = transform2(array); return apply(func, this, otherArgs); }; } function parent(object, path) { return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1)); @@ -3835,20 +3263,20 @@ return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true, true) : []; } function dropWhile(array, predicate) { return array && array.length ? baseWhile(array, getIteratee(predicate, 3), true) : []; } - function fill(array, value, start5, end2) { + function fill(array, value, start3, end2) { var length = array == null ? 0 : array.length; if (!length) { return []; } - if (start5 && typeof start5 != "number" && isIterateeCall(array, value, start5)) { - start5 = 0; + if (start3 && typeof start3 != "number" && isIterateeCall(array, value, start3)) { + start3 = 0; end2 = length; } - return baseFill(array, value, start5, end2); + return baseFill(array, value, start3, end2); } function findIndex3(array, predicate, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; @@ -3896,11 +3324,11 @@ return result2; } function head(array) { return array && array.length ? array[0] : undefined2; } - function indexOf2(array, value, fromIndex) { + function indexOf(array, value, fromIndex) { var length = array == null ? 0 : array.length; if (!length) { return -1; } var index = fromIndex == null ? 0 : toInteger(fromIndex); @@ -3991,23 +3419,23 @@ return result2; } function reverse(array) { return array == null ? array : nativeReverse.call(array); } - function slice(array, start5, end2) { + function slice(array, start3, end2) { var length = array == null ? 0 : array.length; if (!length) { return []; } - if (end2 && typeof end2 != "number" && isIterateeCall(array, start5, end2)) { - start5 = 0; + if (end2 && typeof end2 != "number" && isIterateeCall(array, start3, end2)) { + start3 = 0; end2 = length; } else { - start5 = start5 == null ? 0 : toInteger(start5); + start3 = start3 == null ? 0 : toInteger(start3); end2 = end2 === undefined2 ? length : toInteger(end2); } - return baseSlice(array, start5, end2); + return baseSlice(array, start3, end2); } function sortedIndex(array, value) { return baseSortedIndex(array, value); } function sortedIndexBy(array, value, iteratee2) { @@ -4164,17 +3592,17 @@ } function thru(value, interceptor2) { return interceptor2(value); } var wrapperAt = flatRest(function(paths) { - var length = paths.length, start5 = length ? paths[0] : 0, value = this.__wrapped__, interceptor2 = function(object) { + var length = paths.length, start3 = length ? paths[0] : 0, value = this.__wrapped__, interceptor2 = function(object) { return baseAt(object, paths); }; - if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start5)) { + if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start3)) { return this.thru(interceptor2); } - value = value.slice(start5, +start5 + (length ? 1 : 0)); + value = value.slice(start3, +start3 + (length ? 1 : 0)); value.__actions__.push({ "func": thru, "args": [interceptor2], "thisArg": undefined2 }); @@ -4191,11 +3619,11 @@ function wrapperCommit() { return new LodashWrapper(this.value(), this.__chain__); } function wrapperNext() { if (this.__values__ === undefined2) { - this.__values__ = toArray2(this.value()); + this.__values__ = toArray(this.value()); } var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++]; return { "done": done, "value": value }; } function wrapperToIterator() { @@ -4383,11 +3811,11 @@ } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) { iteratees = [iteratees[0]]; } return baseOrderBy(collection, baseFlatten(iteratees, 1), []); }); - var now2 = ctxNow || function() { + var now = ctxNow || function() { return root.Date.now(); }; function after(n3, func) { if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); @@ -4479,11 +3907,11 @@ function shouldInvoke(time) { var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime; return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; } function timerExpired() { - var time = now2(); + var time = now(); if (shouldInvoke(time)) { return trailingEdge(time); } timerId = setTimeout2(timerExpired, remainingWait(time)); } @@ -4501,14 +3929,14 @@ } lastInvokeTime = 0; lastArgs = lastCallTime = lastThis = timerId = undefined2; } function flush() { - return timerId === undefined2 ? result2 : trailingEdge(now2()); + return timerId === undefined2 ? result2 : trailingEdge(now()); } function debounced() { - var time = now2(), isInvoking = shouldInvoke(time); + var time = now(), isInvoking = shouldInvoke(time); lastArgs = arguments; lastThis = this; lastCallTime = time; if (isInvoking) { if (timerId === undefined2) { @@ -4541,16 +3969,16 @@ function memoize(func, resolver) { if (typeof func != "function" || resolver != null && typeof resolver != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } var memoized = function() { - var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache2 = memoized.cache; - if (cache2.has(key)) { - return cache2.get(key); + var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; + if (cache.has(key)) { + return cache.get(key); } var result2 = func.apply(this, args); - memoized.cache = cache2.set(key, result2) || cache2; + memoized.cache = cache.set(key, result2) || cache; return result2; }; memoized.cache = new (memoize.Cache || MapCache)(); return memoized; } @@ -4597,24 +4025,24 @@ return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders); }); var rearg = flatRest(function(func, indexes) { return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes); }); - function rest(func, start5) { + function rest(func, start3) { if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } - start5 = start5 === undefined2 ? start5 : toInteger(start5); - return baseRest(func, start5); + start3 = start3 === undefined2 ? start3 : toInteger(start3); + return baseRest(func, start3); } - function spread(func, start5) { + function spread(func, start3) { if (typeof func != "function") { throw new TypeError2(FUNC_ERROR_TEXT); } - start5 = start5 == null ? 0 : nativeMax(toInteger(start5), 0); + start3 = start3 == null ? 0 : nativeMax(toInteger(start3), 0); return baseRest(function(args) { - var array = args[start5], otherArgs = castSlice(args, 0, start5); + var array = args[start3], otherArgs = castSlice(args, 0, start3); if (array) { arrayPush(otherArgs, array); } return apply(func, this, otherArgs); }); @@ -4811,11 +4239,11 @@ } var lt2 = createRelationalOperation(baseLt); var lte = createRelationalOperation(function(value, other) { return value <= other; }); - function toArray2(value) { + function toArray(value) { if (!value) { return []; } if (isArrayLike(value)) { return isString2(value) ? stringToArray(value) : copyArray(value); @@ -5114,20 +4542,20 @@ lower = toNumber(lower); lower = lower === lower ? lower : 0; } return baseClamp(toNumber(number), lower, upper); } - function inRange(number, start5, end2) { - start5 = toFinite(start5); + function inRange(number, start3, end2) { + start3 = toFinite(start3); if (end2 === undefined2) { - end2 = start5; - start5 = 0; + end2 = start3; + start3 = 0; } else { end2 = toFinite(end2); } number = toNumber(number); - return baseInRange(number, start5, end2); + return baseInRange(number, start3, end2); } function random(lower, upper, floating) { if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) { upper = floating = undefined2; } @@ -5275,13 +4703,13 @@ options = undefined2; } string = toString(string); options = assignInWith({}, options, settings, customDefaultsAssignIn); var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys); - var isEscaping, isEvaluating, index = 0, interpolate2 = options.interpolate || reNoMatch, source = "__p += '"; + var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '"; var reDelimiters = RegExp2( - (options.escape || reNoMatch).source + "|" + interpolate2.source + "|" + (interpolate2 === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", + (options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g" ); var sourceURL = "//# sourceURL=" + (hasOwnProperty3.call(options, "sourceURL") ? (options.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n"; string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset2) { interpolateValue || (interpolateValue = esTemplateValue); @@ -5330,12 +4758,12 @@ return baseTrim(string); } if (!string || !(chars = baseToString(chars))) { return string; } - var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start5 = charsStartIndex(strSymbols, chrSymbols), end2 = charsEndIndex(strSymbols, chrSymbols) + 1; - return castSlice(strSymbols, start5, end2).join(""); + var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start3 = charsStartIndex(strSymbols, chrSymbols), end2 = charsEndIndex(strSymbols, chrSymbols) + 1; + return castSlice(strSymbols, start3, end2).join(""); } function trimEnd(string, chars, guard) { string = toString(string); if (string && (guard || chars === undefined2)) { return string.slice(0, trimmedEndIndex(string) + 1); @@ -5352,12 +4780,12 @@ return string.replace(reTrimStart, ""); } if (!string || !(chars = baseToString(chars))) { return string; } - var strSymbols = stringToArray(string), start5 = charsStartIndex(strSymbols, stringToArray(chars)); - return castSlice(strSymbols, start5).join(""); + var strSymbols = stringToArray(string), start3 = charsStartIndex(strSymbols, stringToArray(chars)); + return castSlice(strSymbols, start3).join(""); } function truncate(string, options) { var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION; if (isObject3(options)) { var separator = "separator" in options ? options.separator : separator; @@ -5402,11 +4830,11 @@ result2 = result2.slice(0, index); } } return result2 + omission; } - function unescape2(string) { + function unescape(string) { string = toString(string); return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string; } var upperCase = createCompounder(function(result2, word, index) { return result2 + (index ? " " : "") + word.toUpperCase(); @@ -5575,12 +5003,12 @@ return arrayMap(value, toKey); } return isSymbol2(value) ? [value] : copyArray(stringToPath(toString(value))); } function uniqueId(prefix2) { - var id2 = ++idCounter2; - return toString(prefix2) + id2; + var id = ++idCounter2; + return toString(prefix2) + id; } var add2 = createMathOperation(function(augend, addend) { return augend + addend; }, 0); var ceil = createRound("ceil"); @@ -5736,11 +5164,11 @@ lodash.takeRightWhile = takeRightWhile; lodash.takeWhile = takeWhile; lodash.tap = tap; lodash.throttle = throttle2; lodash.thru = thru; - lodash.toArray = toArray2; + lodash.toArray = toArray; lodash.toPairs = toPairs2; lodash.toPairsIn = toPairsIn; lodash.toPath = toPath; lodash.toPlainObject = toPlainObject; lodash.transform = transform; @@ -5811,11 +5239,11 @@ lodash.has = has2; lodash.hasIn = hasIn; lodash.head = head; lodash.identity = identity; lodash.includes = includes; - lodash.indexOf = indexOf2; + lodash.indexOf = indexOf; lodash.inRange = inRange; lodash.invoke = invoke; lodash.isArguments = isArguments; lodash.isArray = isArray2; lodash.isArrayBuffer = isArrayBuffer; @@ -5874,11 +5302,11 @@ lodash.stubTrue = stubTrue; lodash.multiply = multiply; lodash.nth = nth; lodash.noConflict = noConflict; lodash.noop = noop; - lodash.now = now2; + lodash.now = now; lodash.pad = pad; lodash.padEnd = padEnd; lodash.padStart = padStart; lodash.parseInt = parseInt2; lodash.random = random; @@ -5916,11 +5344,11 @@ lodash.toUpper = toUpper; lodash.trim = trim; lodash.trimEnd = trimEnd; lodash.trimStart = trimStart; lodash.truncate = truncate; - lodash.unescape = unescape2; + lodash.unescape = unescape; lodash.uniqueId = uniqueId; lodash.upperCase = upperCase; lodash.upperFirst = upperFirst; lodash.each = forEach; lodash.eachRight = forEachRight; @@ -5998,24 +5426,24 @@ }); }); LazyWrapper.prototype.reject = function(predicate) { return this.filter(negate(getIteratee(predicate))); }; - LazyWrapper.prototype.slice = function(start5, end2) { - start5 = toInteger(start5); + LazyWrapper.prototype.slice = function(start3, end2) { + start3 = toInteger(start3); var result2 = this; - if (result2.__filtered__ && (start5 > 0 || end2 < 0)) { + if (result2.__filtered__ && (start3 > 0 || end2 < 0)) { return new LazyWrapper(result2); } - if (start5 < 0) { - result2 = result2.takeRight(-start5); - } else if (start5) { - result2 = result2.drop(start5); + if (start3 < 0) { + result2 = result2.takeRight(-start3); + } else if (start3) { + result2 = result2.drop(start3); } if (end2 !== undefined2) { end2 = toInteger(end2); - result2 = end2 < 0 ? result2.dropRight(-end2) : result2.take(end2 - start5); + result2 = end2 < 0 ? result2.dropRight(-end2) : result2.take(end2 - start3); } return result2; }; LazyWrapper.prototype.takeRightWhile = function(predicate) { return this.reverse().takeWhile(predicate).reverse(); @@ -7073,21 +6501,21 @@ var UTRIE2_UTF8_2B_INDEX_2_LENGTH$1 = 2048 >> 6; var UTRIE2_INDEX_1_OFFSET$1 = UTRIE2_UTF8_2B_INDEX_2_OFFSET$1 + UTRIE2_UTF8_2B_INDEX_2_LENGTH$1; var UTRIE2_OMITTED_BMP_INDEX_1_LENGTH$1 = 65536 >> UTRIE2_SHIFT_1$1; var UTRIE2_INDEX_2_BLOCK_LENGTH$1 = 1 << UTRIE2_SHIFT_1_2$1; var UTRIE2_INDEX_2_MASK$1 = UTRIE2_INDEX_2_BLOCK_LENGTH$1 - 1; - var slice16$1 = function(view, start5, end2) { + var slice16$1 = function(view, start3, end2) { if (view.slice) { - return view.slice(start5, end2); + return view.slice(start3, end2); } - return new Uint16Array(Array.prototype.slice.call(view, start5, end2)); + return new Uint16Array(Array.prototype.slice.call(view, start3, end2)); }; - var slice32$1 = function(view, start5, end2) { + var slice32$1 = function(view, start3, end2) { if (view.slice) { - return view.slice(start5, end2); + return view.slice(start3, end2); } - return new Uint32Array(Array.prototype.slice.call(view, start5, end2)); + return new Uint32Array(Array.prototype.slice.call(view, start3, end2)); }; var createTrieFromBase64$1 = function(base642, _byteLength) { var buffer = decode$1(base642); var view32 = Array.isArray(buffer) ? polyUint32Array$1(buffer) : new Uint32Array(buffer); var view16 = Array.isArray(buffer) ? polyUint16Array$1(buffer) : new Uint16Array(buffer); @@ -7478,14 +6906,14 @@ return [indicies, classTypes, forbiddenBreakpoints]; }; var Break = ( /** @class */ function() { - function Break2(codePoints, lineBreak2, start5, end2) { + function Break2(codePoints, lineBreak2, start3, end2) { this.codePoints = codePoints; this.required = lineBreak2 === BREAK_MANDATORY; - this.start = start5; + this.start = start3; this.end = end2; } Break2.prototype.slice = function() { return fromCodePoint$1.apply(void 0, this.codePoints.slice(this.start, this.end)); }; @@ -7973,23 +7401,23 @@ var end2 = parseInt(fromCodePoint$1.apply(void 0, digits.map(function(digit) { return digit === QUESTION_MARK ? F2 : digit; })), 16); return { type: 30, start: start_1, end: end2 }; } - var start5 = parseInt(fromCodePoint$1.apply(void 0, digits), 16); + var start3 = parseInt(fromCodePoint$1.apply(void 0, digits), 16); if (this.peekCodePoint(0) === HYPHEN_MINUS && isHex(this.peekCodePoint(1))) { this.consumeCodePoint(); codePoint = this.consumeCodePoint(); var endDigits = []; while (isHex(codePoint) && endDigits.length < 6) { endDigits.push(codePoint); codePoint = this.consumeCodePoint(); } var end2 = parseInt(fromCodePoint$1.apply(void 0, endDigits), 16); - return { type: 30, start: start5, end: end2 }; + return { type: 30, start: start3, end: end2 }; } else { - return { type: 30, start: start5, end: start5 }; + return { type: 30, start: start3, end: start3 }; } }; Tokenizer2.prototype.consumeIdentLikeToken = function() { var value = this.consumeName(); if (value.toLowerCase() === "url" && this.peekCodePoint(0) === LEFT_PARENTHESIS) { @@ -10521,12 +9949,12 @@ default: return 0; } }; var isDebugging = function(element, type) { - var elementType2 = getElementDebugType(element); - return elementType2 === 1 || type === elementType2; + var elementType = getElementDebugType(element); + return elementType === 1 || type === elementType; }; var ElementContainer = ( /** @class */ function() { function ElementContainer2(context, element) { @@ -10620,21 +10048,21 @@ var UTRIE2_UTF8_2B_INDEX_2_LENGTH = 2048 >> 6; var UTRIE2_INDEX_1_OFFSET = UTRIE2_UTF8_2B_INDEX_2_OFFSET + UTRIE2_UTF8_2B_INDEX_2_LENGTH; var UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = 65536 >> UTRIE2_SHIFT_1; var UTRIE2_INDEX_2_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_1_2; var UTRIE2_INDEX_2_MASK = UTRIE2_INDEX_2_BLOCK_LENGTH - 1; - var slice16 = function(view, start5, end2) { + var slice16 = function(view, start3, end2) { if (view.slice) { - return view.slice(start5, end2); + return view.slice(start3, end2); } - return new Uint16Array(Array.prototype.slice.call(view, start5, end2)); + return new Uint16Array(Array.prototype.slice.call(view, start3, end2)); }; - var slice32 = function(view, start5, end2) { + var slice32 = function(view, start3, end2) { if (view.slice) { - return view.slice(start5, end2); + return view.slice(start3, end2); } - return new Uint32Array(Array.prototype.slice.call(view, start5, end2)); + return new Uint32Array(Array.prototype.slice.call(view, start3, end2)); }; var createTrieFromBase64 = function(base642, _byteLength) { var buffer = decode(base642); var view32 = Array.isArray(buffer) ? polyUint32Array(buffer) : new Uint32Array(buffer); var view16 = Array.isArray(buffer) ? polyUint16Array(buffer) : new Uint16Array(buffer); @@ -12456,19 +11884,19 @@ }; CacheStorage2._origin = "about:blank"; return CacheStorage2; }() ); - var Cache2 = ( + var Cache = ( /** @class */ function() { - function Cache3(context, _options) { + function Cache2(context, _options) { this.context = context; this._options = _options; this._cache = {}; } - Cache3.prototype.addImage = function(src) { + Cache2.prototype.addImage = function(src) { var result = Promise.resolve(); if (this.has(src)) { return result; } if (isBlobImage(src) || isRenderable(src)) { @@ -12476,14 +11904,14 @@ }); return result; } return result; }; - Cache3.prototype.match = function(src) { + Cache2.prototype.match = function(src) { return this._cache[src]; }; - Cache3.prototype.loadImage = function(key) { + Cache2.prototype.loadImage = function(key) { return __awaiter(this, void 0, void 0, function() { var isSameOrigin, useCORS, useProxy, src; var _this = this; return __generator(this, function(_a) { switch (_a.label) { @@ -12531,17 +11959,17 @@ return [2, _a.sent()]; } }); }); }; - Cache3.prototype.has = function(key) { + Cache2.prototype.has = function(key) { return typeof this._cache[key] !== "undefined"; }; - Cache3.prototype.keys = function() { + Cache2.prototype.keys = function() { return Promise.resolve(Object.keys(this._cache)); }; - Cache3.prototype.proxy = function(src) { + Cache2.prototype.proxy = function(src) { var _this = this; var proxy = this._options.proxy; if (!proxy) { throw new Error("No proxy defined"); } @@ -12581,11 +12009,11 @@ }; } xhr.send(); }); }; - return Cache3; + return Cache2; }() ); var INLINE_SVG = /^data:image\/svg\+xml/i; var INLINE_BASE64 = /^data:image\/.*;base64,/i; var INLINE_IMG = /^data:image\/.*/i; @@ -12622,13 +12050,13 @@ return new Vector(a4.x + (b3.x - a4.x) * t3, a4.y + (b3.y - a4.y) * t3); }; var BezierCurve = ( /** @class */ function() { - function BezierCurve2(start5, startControl, endControl, end2) { + function BezierCurve2(start3, startControl, endControl, end2) { this.type = 1; - this.start = start5; + this.start = start3; this.startControl = startControl; this.endControl = endControl; this.end = end2; } BezierCurve2.prototype.subdivide = function(t3, firstHalf) { @@ -13329,18 +12757,18 @@ return this._data[key]; }; return FontMetrics2; }() ); - var Renderer2 = ( + var Renderer = ( /** @class */ function() { - function Renderer3(context, options) { + function Renderer2(context, options) { this.context = context; this.options = options; } - return Renderer3; + return Renderer2; }() ); var MASK_OFFSET = 1e4; var CanvasRenderer = ( /** @class */ @@ -13879,15 +13307,15 @@ this.ctx.closePath(); }; CanvasRenderer2.prototype.formatPath = function(paths) { var _this = this; paths.forEach(function(point, index) { - var start5 = isBezierCurve(point) ? point.start : point; + var start3 = isBezierCurve(point) ? point.start : point; if (index === 0) { - _this.ctx.moveTo(start5.x, start5.y); + _this.ctx.moveTo(start3.x, start3.y); } else { - _this.ctx.lineTo(start5.x, start5.y); + _this.ctx.lineTo(start3.x, start3.y); } if (isBezierCurve(point)) { _this.ctx.bezierCurveTo(point.startControl.x, point.startControl.y, point.endControl.x, point.endControl.y, point.end.x, point.end.y); } }); @@ -14312,11 +13740,11 @@ } }); }); }; return CanvasRenderer2; - }(Renderer2) + }(Renderer) ); var isTextInputElement = function(container) { if (container instanceof TextareaElementContainer) { return true; } else if (container instanceof SelectElementContainer) { @@ -14391,11 +13819,11 @@ } }); }); }; return ForeignObjectRenderer2; - }(Renderer2) + }(Renderer) ); var loadSerializedSVG = function(svg) { return new Promise(function(resolve, reject) { var img = new Image(); img.onload = function() { @@ -14407,12 +13835,12 @@ }; var Logger = ( /** @class */ function() { function Logger2(_a) { - var id2 = _a.id, enabled = _a.enabled; - this.id = id2; + var id = _a.id, enabled = _a.enabled; + this.id = id; this.enabled = enabled; this.start = Date.now(); } Logger2.prototype.debug = function() { var args = []; @@ -14477,11 +13905,11 @@ function Context2(options, windowBounds) { var _a; this.windowBounds = windowBounds; this.instanceName = "#" + Context2.instanceCount++; this.logger = new Logger({ id: this.instanceName, enabled: options.logging }); - this.cache = (_a = options.cache) !== null && _a !== void 0 ? _a : new Cache2(this, options); + this.cache = (_a = options.cache) !== null && _a !== void 0 ? _a : new Cache(this, options); } Context2.instanceCount = 1; return Context2; }() ); @@ -14602,11 +14030,11 @@ // ../../../package.json var package_default = { name: "coveragebook-components", type: "module", - version: "0.6.4", + version: "0.6.5", main: "index.js", repository: "git@github.com:coveragebook/coco.git", author: "Mark Perkins <mark@coveragebook.com>", license: "NO LICENSE", browserslist: [ @@ -14616,16 +14044,13 @@ "@alpinejs/collapse": "^3.11.1", "@alpinejs/focus": "^3.11.1", "@alpinejs/intersect": "^3.11.1", "@alpinejs/mask": "^3.12.0", "@alpinejs/morph": "^3.11.1", - "@hotwired/turbo-rails": "^7.3.0", "@jaames/iro": "^5.5.2", - "@rails/activestorage": "^7.0.5", "@tailwindcss/container-queries": "^0.1.0", "@tailwindcss/forms": "^0.5.3", - "alpine-turbo-drive-adapter": "^2.0.0", alpinejs: "^3.11.1", "container-query-polyfill": "^1.0.2", del: "^7.0.0", html2canvas: "^1.4.1", lodash: "^4.17.21", @@ -16200,4852 +15625,10 @@ return f3; } u3.prepend(s3, o3), A3(u3), S2(); }(); - // ../../../node_modules/alpine-turbo-drive-adapter/dist/alpine-turbo-drive-adapter.esm.js - function isValidVersion(required, current) { - var requiredArray = required.split("."); - var currentArray = current.split("."); - for (var i3 = 0; i3 < requiredArray.length; i3++) { - if (currentArray[i3] && currentArray[i3] > requiredArray[i3]) { - return true; - } - } - return currentArray[requiredArray.length - 1] === requiredArray[requiredArray.length - 1]; - } - function dispatch(el, name) { - var detail = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; - el.dispatchEvent(new CustomEvent(name, { - detail, - bubbles: true, - composed: true, - cancelable: true - })); - } - var Bridge = class { - init() { - if (!window.Alpine.version || !isValidVersion("3.0.0", window.Alpine.version)) { - throw new Error("Invalid Alpine version. Please use Alpine 3.0.0 or above"); - } - window.Alpine.mutateDom(() => { - document.body.querySelectorAll("[x-cloak]").forEach((el) => { - var _el$getAttribute; - el.setAttribute("data-alpine-was-cloaked", (_el$getAttribute = el.getAttribute("x-cloak")) !== null && _el$getAttribute !== void 0 ? _el$getAttribute : ""); - }); - }); - this.configureEventHandlers(); - } - configureEventHandlers() { - var renderCallback = (event) => { - if (document.documentElement.hasAttribute("data-turbo-preview")) { - return; - } - dispatch(document, "alpine:init"); - dispatch(document, "alpine:initializing"); - window.Alpine.flushAndStopDeferringMutations(); - dispatch(document, "alpine:initialised"); - window.Alpine.mutateDom(() => { - document.querySelectorAll("[data-alpine-ignored]").forEach((el) => { - el.removeAttribute("x-ignore"); - el.removeAttribute("data-alpine-ignored"); - }); - }); - }; - var beforeRenderCallback = (event) => { - window.Alpine.mutateDom(() => { - if (document.documentElement.hasAttribute("data-turbo-preview")) { - return; - } - event.detail.newBody.querySelectorAll("[data-alpine-generated-me],[x-cloak]").forEach((el) => { - if (el.hasAttribute("x-cloak")) { - var _el$getAttribute2; - el.setAttribute("data-alpine-was-cloaked", (_el$getAttribute2 = el.getAttribute("x-cloak")) !== null && _el$getAttribute2 !== void 0 ? _el$getAttribute2 : ""); - } - if (el.hasAttribute("data-alpine-generated-me")) { - el.removeAttribute("data-alpine-generated-me"); - el.remove(); - } - }); - }); - window.Alpine.deferMutations(); - }; - var beforeCacheCallback = (event) => { - window.Alpine.mutateDom(() => { - document.body.querySelectorAll("[x-for],[x-if],[data-alpine-was-cloaked]").forEach((el) => { - if (el.hasAttribute("data-alpine-was-cloaked")) { - var _el$getAttribute3; - el.setAttribute("x-cloak", (_el$getAttribute3 = el.getAttribute("data-alpine-was-cloaked")) !== null && _el$getAttribute3 !== void 0 ? _el$getAttribute3 : ""); - el.removeAttribute("data-alpine-was-cloaked"); - } - if (el.hasAttribute("x-for") && el._x_lookup) { - Object.values(el._x_lookup).forEach((el2) => el2.setAttribute("data-alpine-generated-me", true)); - } - if (el.hasAttribute("x-if") && el._x_currentIfEl) { - el._x_currentIfEl.setAttribute("data-alpine-generated-me", true); - } - }); - }); - document.querySelectorAll("[data-turbo-permanent]").forEach((el) => { - window.Alpine.mutateDom(() => { - if (!el.hasAttribute("x-ignore")) { - el.setAttribute("x-ignore", true); - el.setAttribute("data-alpine-ignored", true); - } - el.querySelectorAll("[data-alpine-generated-me]").forEach((sub) => { - sub.removeAttribute("data-alpine-generated-me"); - }); - }); - }); - }; - document.addEventListener("turbo:render", renderCallback); - document.addEventListener("turbo:before-render", beforeRenderCallback); - document.addEventListener("turbo:before-cache", beforeCacheCallback); - } - }; - if (window.Alpine) { - console.error("Alpine-turbo-drive-adapter must be included before AlpineJs"); - } - if (!Object.getOwnPropertyDescriptor(NodeList.prototype, "forEach")) { - Object.defineProperty(NodeList.prototype, "forEach", Object.getOwnPropertyDescriptor(Array.prototype, "forEach")); - } - document.addEventListener("alpine:init", () => { - var bridge = new Bridge(); - bridge.init(); - }, { - once: true - }); - - // ../../../node_modules/@hotwired/turbo/dist/turbo.es2017-esm.js - (function() { - if (window.Reflect === void 0 || window.customElements === void 0 || window.customElements.polyfillWrapFlushCallback) { - return; - } - const BuiltInHTMLElement = HTMLElement; - const wrapperForTheName = { - HTMLElement: function HTMLElement2() { - return Reflect.construct(BuiltInHTMLElement, [], this.constructor); - } - }; - window.HTMLElement = wrapperForTheName["HTMLElement"]; - HTMLElement.prototype = BuiltInHTMLElement.prototype; - HTMLElement.prototype.constructor = HTMLElement; - Object.setPrototypeOf(HTMLElement, BuiltInHTMLElement); - })(); - (function(prototype) { - if (typeof prototype.requestSubmit == "function") - return; - prototype.requestSubmit = function(submitter) { - if (submitter) { - validateSubmitter(submitter, this); - submitter.click(); - } else { - submitter = document.createElement("input"); - submitter.type = "submit"; - submitter.hidden = true; - this.appendChild(submitter); - submitter.click(); - this.removeChild(submitter); - } - }; - function validateSubmitter(submitter, form) { - submitter instanceof HTMLElement || raise(TypeError, "parameter 1 is not of type 'HTMLElement'"); - submitter.type == "submit" || raise(TypeError, "The specified element is not a submit button"); - submitter.form == form || raise(DOMException, "The specified element is not owned by this form element", "NotFoundError"); - } - function raise(errorConstructor, message2, name) { - throw new errorConstructor("Failed to execute 'requestSubmit' on 'HTMLFormElement': " + message2 + ".", name); - } - })(HTMLFormElement.prototype); - var submittersByForm = /* @__PURE__ */ new WeakMap(); - function findSubmitterFromClickTarget(target) { - const element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null; - const candidate = element ? element.closest("input, button") : null; - return (candidate === null || candidate === void 0 ? void 0 : candidate.type) == "submit" ? candidate : null; - } - function clickCaptured(event) { - const submitter = findSubmitterFromClickTarget(event.target); - if (submitter && submitter.form) { - submittersByForm.set(submitter.form, submitter); - } - } - (function() { - if ("submitter" in Event.prototype) - return; - let prototype = window.Event.prototype; - if ("SubmitEvent" in window && /Apple Computer/.test(navigator.vendor)) { - prototype = window.SubmitEvent.prototype; - } else if ("SubmitEvent" in window) { - return; - } - addEventListener("click", clickCaptured, true); - Object.defineProperty(prototype, "submitter", { - get() { - if (this.type == "submit" && this.target instanceof HTMLFormElement) { - return submittersByForm.get(this.target); - } - } - }); - })(); - var FrameLoadingStyle; - (function(FrameLoadingStyle2) { - FrameLoadingStyle2["eager"] = "eager"; - FrameLoadingStyle2["lazy"] = "lazy"; - })(FrameLoadingStyle || (FrameLoadingStyle = {})); - var FrameElement = class extends HTMLElement { - static get observedAttributes() { - return ["disabled", "complete", "loading", "src"]; - } - constructor() { - super(); - this.loaded = Promise.resolve(); - this.delegate = new FrameElement.delegateConstructor(this); - } - connectedCallback() { - this.delegate.connect(); - } - disconnectedCallback() { - this.delegate.disconnect(); - } - reload() { - return this.delegate.sourceURLReloaded(); - } - attributeChangedCallback(name) { - if (name == "loading") { - this.delegate.loadingStyleChanged(); - } else if (name == "complete") { - this.delegate.completeChanged(); - } else if (name == "src") { - this.delegate.sourceURLChanged(); - } else { - this.delegate.disabledChanged(); - } - } - get src() { - return this.getAttribute("src"); - } - set src(value) { - if (value) { - this.setAttribute("src", value); - } else { - this.removeAttribute("src"); - } - } - get loading() { - return frameLoadingStyleFromString(this.getAttribute("loading") || ""); - } - set loading(value) { - if (value) { - this.setAttribute("loading", value); - } else { - this.removeAttribute("loading"); - } - } - get disabled() { - return this.hasAttribute("disabled"); - } - set disabled(value) { - if (value) { - this.setAttribute("disabled", ""); - } else { - this.removeAttribute("disabled"); - } - } - get autoscroll() { - return this.hasAttribute("autoscroll"); - } - set autoscroll(value) { - if (value) { - this.setAttribute("autoscroll", ""); - } else { - this.removeAttribute("autoscroll"); - } - } - get complete() { - return !this.delegate.isLoading; - } - get isActive() { - return this.ownerDocument === document && !this.isPreview; - } - get isPreview() { - var _a, _b; - return (_b = (_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.documentElement) === null || _b === void 0 ? void 0 : _b.hasAttribute("data-turbo-preview"); - } - }; - function frameLoadingStyleFromString(style) { - switch (style.toLowerCase()) { - case "lazy": - return FrameLoadingStyle.lazy; - default: - return FrameLoadingStyle.eager; - } - } - function expandURL(locatable) { - return new URL(locatable.toString(), document.baseURI); - } - function getAnchor(url) { - let anchorMatch; - if (url.hash) { - return url.hash.slice(1); - } else if (anchorMatch = url.href.match(/#(.*)$/)) { - return anchorMatch[1]; - } - } - function getAction(form, submitter) { - const action = (submitter === null || submitter === void 0 ? void 0 : submitter.getAttribute("formaction")) || form.getAttribute("action") || form.action; - return expandURL(action); - } - function getExtension(url) { - return (getLastPathComponent(url).match(/\.[^.]*$/) || [])[0] || ""; - } - function isHTML(url) { - return !!getExtension(url).match(/^(?:|\.(?:htm|html|xhtml|php))$/); - } - function isPrefixedBy(baseURL, url) { - const prefix2 = getPrefix(url); - return baseURL.href === expandURL(prefix2).href || baseURL.href.startsWith(prefix2); - } - function locationIsVisitable(location2, rootLocation) { - return isPrefixedBy(location2, rootLocation) && isHTML(location2); - } - function getRequestURL(url) { - const anchor = getAnchor(url); - return anchor != null ? url.href.slice(0, -(anchor.length + 1)) : url.href; - } - function toCacheKey(url) { - return getRequestURL(url); - } - function urlsAreEqual(left2, right2) { - return expandURL(left2).href == expandURL(right2).href; - } - function getPathComponents(url) { - return url.pathname.split("/").slice(1); - } - function getLastPathComponent(url) { - return getPathComponents(url).slice(-1)[0]; - } - function getPrefix(url) { - return addTrailingSlash(url.origin + url.pathname); - } - function addTrailingSlash(value) { - return value.endsWith("/") ? value : value + "/"; - } - var FetchResponse = class { - constructor(response) { - this.response = response; - } - get succeeded() { - return this.response.ok; - } - get failed() { - return !this.succeeded; - } - get clientError() { - return this.statusCode >= 400 && this.statusCode <= 499; - } - get serverError() { - return this.statusCode >= 500 && this.statusCode <= 599; - } - get redirected() { - return this.response.redirected; - } - get location() { - return expandURL(this.response.url); - } - get isHTML() { - return this.contentType && this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/); - } - get statusCode() { - return this.response.status; - } - get contentType() { - return this.header("Content-Type"); - } - get responseText() { - return this.response.clone().text(); - } - get responseHTML() { - if (this.isHTML) { - return this.response.clone().text(); - } else { - return Promise.resolve(void 0); - } - } - header(name) { - return this.response.headers.get(name); - } - }; - function activateScriptElement(element) { - if (element.getAttribute("data-turbo-eval") == "false") { - return element; - } else { - const createdScriptElement = document.createElement("script"); - const cspNonce = getMetaContent("csp-nonce"); - if (cspNonce) { - createdScriptElement.nonce = cspNonce; - } - createdScriptElement.textContent = element.textContent; - createdScriptElement.async = false; - copyElementAttributes(createdScriptElement, element); - return createdScriptElement; - } - } - function copyElementAttributes(destinationElement, sourceElement) { - for (const { name, value } of sourceElement.attributes) { - destinationElement.setAttribute(name, value); - } - } - function createDocumentFragment(html) { - const template = document.createElement("template"); - template.innerHTML = html; - return template.content; - } - function dispatch2(eventName, { target, cancelable, detail } = {}) { - const event = new CustomEvent(eventName, { - cancelable, - bubbles: true, - composed: true, - detail - }); - if (target && target.isConnected) { - target.dispatchEvent(event); - } else { - document.documentElement.dispatchEvent(event); - } - return event; - } - function nextAnimationFrame() { - return new Promise((resolve) => requestAnimationFrame(() => resolve())); - } - function nextEventLoopTick() { - return new Promise((resolve) => setTimeout(() => resolve(), 0)); - } - function nextMicrotask() { - return Promise.resolve(); - } - function parseHTMLDocument(html = "") { - return new DOMParser().parseFromString(html, "text/html"); - } - function unindent(strings, ...values) { - const lines = interpolate(strings, values).replace(/^\n/, "").split("\n"); - const match = lines[0].match(/^\s+/); - const indent = match ? match[0].length : 0; - return lines.map((line) => line.slice(indent)).join("\n"); - } - function interpolate(strings, values) { - return strings.reduce((result, string, i3) => { - const value = values[i3] == void 0 ? "" : values[i3]; - return result + string + value; - }, ""); - } - function uuid() { - return Array.from({ length: 36 }).map((_3, i3) => { - if (i3 == 8 || i3 == 13 || i3 == 18 || i3 == 23) { - return "-"; - } else if (i3 == 14) { - return "4"; - } else if (i3 == 19) { - return (Math.floor(Math.random() * 4) + 8).toString(16); - } else { - return Math.floor(Math.random() * 15).toString(16); - } - }).join(""); - } - function getAttribute(attributeName, ...elements) { - for (const value of elements.map((element) => element === null || element === void 0 ? void 0 : element.getAttribute(attributeName))) { - if (typeof value == "string") - return value; - } - return null; - } - function hasAttribute(attributeName, ...elements) { - return elements.some((element) => element && element.hasAttribute(attributeName)); - } - function markAsBusy(...elements) { - for (const element of elements) { - if (element.localName == "turbo-frame") { - element.setAttribute("busy", ""); - } - element.setAttribute("aria-busy", "true"); - } - } - function clearBusyState(...elements) { - for (const element of elements) { - if (element.localName == "turbo-frame") { - element.removeAttribute("busy"); - } - element.removeAttribute("aria-busy"); - } - } - function waitForLoad(element, timeoutInMilliseconds = 2e3) { - return new Promise((resolve) => { - const onComplete = () => { - element.removeEventListener("error", onComplete); - element.removeEventListener("load", onComplete); - resolve(); - }; - element.addEventListener("load", onComplete, { once: true }); - element.addEventListener("error", onComplete, { once: true }); - setTimeout(resolve, timeoutInMilliseconds); - }); - } - function getHistoryMethodForAction(action) { - switch (action) { - case "replace": - return history.replaceState; - case "advance": - case "restore": - return history.pushState; - } - } - function isAction(action) { - return action == "advance" || action == "replace" || action == "restore"; - } - function getVisitAction(...elements) { - const action = getAttribute("data-turbo-action", ...elements); - return isAction(action) ? action : null; - } - function getMetaElement(name) { - return document.querySelector(`meta[name="${name}"]`); - } - function getMetaContent(name) { - const element = getMetaElement(name); - return element && element.content; - } - function setMetaContent(name, content2) { - let element = getMetaElement(name); - if (!element) { - element = document.createElement("meta"); - element.setAttribute("name", name); - document.head.appendChild(element); - } - element.setAttribute("content", content2); - return element; - } - function findClosestRecursively(element, selector) { - var _a; - if (element instanceof Element) { - return element.closest(selector) || findClosestRecursively(element.assignedSlot || ((_a = element.getRootNode()) === null || _a === void 0 ? void 0 : _a.host), selector); - } - } - var FetchMethod; - (function(FetchMethod2) { - FetchMethod2[FetchMethod2["get"] = 0] = "get"; - FetchMethod2[FetchMethod2["post"] = 1] = "post"; - FetchMethod2[FetchMethod2["put"] = 2] = "put"; - FetchMethod2[FetchMethod2["patch"] = 3] = "patch"; - FetchMethod2[FetchMethod2["delete"] = 4] = "delete"; - })(FetchMethod || (FetchMethod = {})); - function fetchMethodFromString(method) { - switch (method.toLowerCase()) { - case "get": - return FetchMethod.get; - case "post": - return FetchMethod.post; - case "put": - return FetchMethod.put; - case "patch": - return FetchMethod.patch; - case "delete": - return FetchMethod.delete; - } - } - var FetchRequest = class { - constructor(delegate, method, location2, body = new URLSearchParams(), target = null) { - this.abortController = new AbortController(); - this.resolveRequestPromise = (_value) => { - }; - this.delegate = delegate; - this.method = method; - this.headers = this.defaultHeaders; - this.body = body; - this.url = location2; - this.target = target; - } - get location() { - return this.url; - } - get params() { - return this.url.searchParams; - } - get entries() { - return this.body ? Array.from(this.body.entries()) : []; - } - cancel() { - this.abortController.abort(); - } - async perform() { - const { fetchOptions } = this; - this.delegate.prepareRequest(this); - await this.allowRequestToBeIntercepted(fetchOptions); - try { - this.delegate.requestStarted(this); - const response = await fetch(this.url.href, fetchOptions); - return await this.receive(response); - } catch (error2) { - if (error2.name !== "AbortError") { - if (this.willDelegateErrorHandling(error2)) { - this.delegate.requestErrored(this, error2); - } - throw error2; - } - } finally { - this.delegate.requestFinished(this); - } - } - async receive(response) { - const fetchResponse = new FetchResponse(response); - const event = dispatch2("turbo:before-fetch-response", { - cancelable: true, - detail: { fetchResponse }, - target: this.target - }); - if (event.defaultPrevented) { - this.delegate.requestPreventedHandlingResponse(this, fetchResponse); - } else if (fetchResponse.succeeded) { - this.delegate.requestSucceededWithResponse(this, fetchResponse); - } else { - this.delegate.requestFailedWithResponse(this, fetchResponse); - } - return fetchResponse; - } - get fetchOptions() { - var _a; - return { - method: FetchMethod[this.method].toUpperCase(), - credentials: "same-origin", - headers: this.headers, - redirect: "follow", - body: this.isSafe ? null : this.body, - signal: this.abortSignal, - referrer: (_a = this.delegate.referrer) === null || _a === void 0 ? void 0 : _a.href - }; - } - get defaultHeaders() { - return { - Accept: "text/html, application/xhtml+xml" - }; - } - get isSafe() { - return this.method === FetchMethod.get; - } - get abortSignal() { - return this.abortController.signal; - } - acceptResponseType(mimeType) { - this.headers["Accept"] = [mimeType, this.headers["Accept"]].join(", "); - } - async allowRequestToBeIntercepted(fetchOptions) { - const requestInterception = new Promise((resolve) => this.resolveRequestPromise = resolve); - const event = dispatch2("turbo:before-fetch-request", { - cancelable: true, - detail: { - fetchOptions, - url: this.url, - resume: this.resolveRequestPromise - }, - target: this.target - }); - if (event.defaultPrevented) - await requestInterception; - } - willDelegateErrorHandling(error2) { - const event = dispatch2("turbo:fetch-request-error", { - target: this.target, - cancelable: true, - detail: { request: this, error: error2 } - }); - return !event.defaultPrevented; - } - }; - var AppearanceObserver = class { - constructor(delegate, element) { - this.started = false; - this.intersect = (entries) => { - const lastEntry = entries.slice(-1)[0]; - if (lastEntry === null || lastEntry === void 0 ? void 0 : lastEntry.isIntersecting) { - this.delegate.elementAppearedInViewport(this.element); - } - }; - this.delegate = delegate; - this.element = element; - this.intersectionObserver = new IntersectionObserver(this.intersect); - } - start() { - if (!this.started) { - this.started = true; - this.intersectionObserver.observe(this.element); - } - } - stop() { - if (this.started) { - this.started = false; - this.intersectionObserver.unobserve(this.element); - } - } - }; - var StreamMessage = class { - static wrap(message2) { - if (typeof message2 == "string") { - return new this(createDocumentFragment(message2)); - } else { - return message2; - } - } - constructor(fragment) { - this.fragment = importStreamElements(fragment); - } - }; - StreamMessage.contentType = "text/vnd.turbo-stream.html"; - function importStreamElements(fragment) { - for (const element of fragment.querySelectorAll("turbo-stream")) { - const streamElement = document.importNode(element, true); - for (const inertScriptElement of streamElement.templateElement.content.querySelectorAll("script")) { - inertScriptElement.replaceWith(activateScriptElement(inertScriptElement)); - } - element.replaceWith(streamElement); - } - return fragment; - } - var FormSubmissionState; - (function(FormSubmissionState2) { - FormSubmissionState2[FormSubmissionState2["initialized"] = 0] = "initialized"; - FormSubmissionState2[FormSubmissionState2["requesting"] = 1] = "requesting"; - FormSubmissionState2[FormSubmissionState2["waiting"] = 2] = "waiting"; - FormSubmissionState2[FormSubmissionState2["receiving"] = 3] = "receiving"; - FormSubmissionState2[FormSubmissionState2["stopping"] = 4] = "stopping"; - FormSubmissionState2[FormSubmissionState2["stopped"] = 5] = "stopped"; - })(FormSubmissionState || (FormSubmissionState = {})); - var FormEnctype; - (function(FormEnctype2) { - FormEnctype2["urlEncoded"] = "application/x-www-form-urlencoded"; - FormEnctype2["multipart"] = "multipart/form-data"; - FormEnctype2["plain"] = "text/plain"; - })(FormEnctype || (FormEnctype = {})); - function formEnctypeFromString(encoding) { - switch (encoding.toLowerCase()) { - case FormEnctype.multipart: - return FormEnctype.multipart; - case FormEnctype.plain: - return FormEnctype.plain; - default: - return FormEnctype.urlEncoded; - } - } - var FormSubmission = class { - static confirmMethod(message2, _element, _submitter) { - return Promise.resolve(confirm(message2)); - } - constructor(delegate, formElement, submitter, mustRedirect = false) { - this.state = FormSubmissionState.initialized; - this.delegate = delegate; - this.formElement = formElement; - this.submitter = submitter; - this.formData = buildFormData(formElement, submitter); - this.location = expandURL(this.action); - if (this.method == FetchMethod.get) { - mergeFormDataEntries(this.location, [...this.body.entries()]); - } - this.fetchRequest = new FetchRequest(this, this.method, this.location, this.body, this.formElement); - this.mustRedirect = mustRedirect; - } - get method() { - var _a; - const method = ((_a = this.submitter) === null || _a === void 0 ? void 0 : _a.getAttribute("formmethod")) || this.formElement.getAttribute("method") || ""; - return fetchMethodFromString(method.toLowerCase()) || FetchMethod.get; - } - get action() { - var _a; - const formElementAction = typeof this.formElement.action === "string" ? this.formElement.action : null; - if ((_a = this.submitter) === null || _a === void 0 ? void 0 : _a.hasAttribute("formaction")) { - return this.submitter.getAttribute("formaction") || ""; - } else { - return this.formElement.getAttribute("action") || formElementAction || ""; - } - } - get body() { - if (this.enctype == FormEnctype.urlEncoded || this.method == FetchMethod.get) { - return new URLSearchParams(this.stringFormData); - } else { - return this.formData; - } - } - get enctype() { - var _a; - return formEnctypeFromString(((_a = this.submitter) === null || _a === void 0 ? void 0 : _a.getAttribute("formenctype")) || this.formElement.enctype); - } - get isSafe() { - return this.fetchRequest.isSafe; - } - get stringFormData() { - return [...this.formData].reduce((entries, [name, value]) => { - return entries.concat(typeof value == "string" ? [[name, value]] : []); - }, []); - } - async start() { - const { initialized, requesting } = FormSubmissionState; - const confirmationMessage = getAttribute("data-turbo-confirm", this.submitter, this.formElement); - if (typeof confirmationMessage === "string") { - const answer = await FormSubmission.confirmMethod(confirmationMessage, this.formElement, this.submitter); - if (!answer) { - return; - } - } - if (this.state == initialized) { - this.state = requesting; - return this.fetchRequest.perform(); - } - } - stop() { - const { stopping, stopped } = FormSubmissionState; - if (this.state != stopping && this.state != stopped) { - this.state = stopping; - this.fetchRequest.cancel(); - return true; - } - } - prepareRequest(request) { - if (!request.isSafe) { - const token = getCookieValue(getMetaContent("csrf-param")) || getMetaContent("csrf-token"); - if (token) { - request.headers["X-CSRF-Token"] = token; - } - } - if (this.requestAcceptsTurboStreamResponse(request)) { - request.acceptResponseType(StreamMessage.contentType); - } - } - requestStarted(_request) { - var _a; - this.state = FormSubmissionState.waiting; - (_a = this.submitter) === null || _a === void 0 ? void 0 : _a.setAttribute("disabled", ""); - this.setSubmitsWith(); - dispatch2("turbo:submit-start", { - target: this.formElement, - detail: { formSubmission: this } - }); - this.delegate.formSubmissionStarted(this); - } - requestPreventedHandlingResponse(request, response) { - this.result = { success: response.succeeded, fetchResponse: response }; - } - requestSucceededWithResponse(request, response) { - if (response.clientError || response.serverError) { - this.delegate.formSubmissionFailedWithResponse(this, response); - } else if (this.requestMustRedirect(request) && responseSucceededWithoutRedirect(response)) { - const error2 = new Error("Form responses must redirect to another location"); - this.delegate.formSubmissionErrored(this, error2); - } else { - this.state = FormSubmissionState.receiving; - this.result = { success: true, fetchResponse: response }; - this.delegate.formSubmissionSucceededWithResponse(this, response); - } - } - requestFailedWithResponse(request, response) { - this.result = { success: false, fetchResponse: response }; - this.delegate.formSubmissionFailedWithResponse(this, response); - } - requestErrored(request, error2) { - this.result = { success: false, error: error2 }; - this.delegate.formSubmissionErrored(this, error2); - } - requestFinished(_request) { - var _a; - this.state = FormSubmissionState.stopped; - (_a = this.submitter) === null || _a === void 0 ? void 0 : _a.removeAttribute("disabled"); - this.resetSubmitterText(); - dispatch2("turbo:submit-end", { - target: this.formElement, - detail: Object.assign({ formSubmission: this }, this.result) - }); - this.delegate.formSubmissionFinished(this); - } - setSubmitsWith() { - if (!this.submitter || !this.submitsWith) - return; - if (this.submitter.matches("button")) { - this.originalSubmitText = this.submitter.innerHTML; - this.submitter.innerHTML = this.submitsWith; - } else if (this.submitter.matches("input")) { - const input = this.submitter; - this.originalSubmitText = input.value; - input.value = this.submitsWith; - } - } - resetSubmitterText() { - if (!this.submitter || !this.originalSubmitText) - return; - if (this.submitter.matches("button")) { - this.submitter.innerHTML = this.originalSubmitText; - } else if (this.submitter.matches("input")) { - const input = this.submitter; - input.value = this.originalSubmitText; - } - } - requestMustRedirect(request) { - return !request.isSafe && this.mustRedirect; - } - requestAcceptsTurboStreamResponse(request) { - return !request.isSafe || hasAttribute("data-turbo-stream", this.submitter, this.formElement); - } - get submitsWith() { - var _a; - return (_a = this.submitter) === null || _a === void 0 ? void 0 : _a.getAttribute("data-turbo-submits-with"); - } - }; - function buildFormData(formElement, submitter) { - const formData = new FormData(formElement); - const name = submitter === null || submitter === void 0 ? void 0 : submitter.getAttribute("name"); - const value = submitter === null || submitter === void 0 ? void 0 : submitter.getAttribute("value"); - if (name) { - formData.append(name, value || ""); - } - return formData; - } - function getCookieValue(cookieName) { - if (cookieName != null) { - const cookies = document.cookie ? document.cookie.split("; ") : []; - const cookie = cookies.find((cookie2) => cookie2.startsWith(cookieName)); - if (cookie) { - const value = cookie.split("=").slice(1).join("="); - return value ? decodeURIComponent(value) : void 0; - } - } - } - function responseSucceededWithoutRedirect(response) { - return response.statusCode == 200 && !response.redirected; - } - function mergeFormDataEntries(url, entries) { - const searchParams = new URLSearchParams(); - for (const [name, value] of entries) { - if (value instanceof File) - continue; - searchParams.append(name, value); - } - url.search = searchParams.toString(); - return url; - } - var Snapshot = class { - constructor(element) { - this.element = element; - } - get activeElement() { - return this.element.ownerDocument.activeElement; - } - get children() { - return [...this.element.children]; - } - hasAnchor(anchor) { - return this.getElementForAnchor(anchor) != null; - } - getElementForAnchor(anchor) { - return anchor ? this.element.querySelector(`[id='${anchor}'], a[name='${anchor}']`) : null; - } - get isConnected() { - return this.element.isConnected; - } - get firstAutofocusableElement() { - const inertDisabledOrHidden = "[inert], :disabled, [hidden], details:not([open]), dialog:not([open])"; - for (const element of this.element.querySelectorAll("[autofocus]")) { - if (element.closest(inertDisabledOrHidden) == null) - return element; - else - continue; - } - return null; - } - get permanentElements() { - return queryPermanentElementsAll(this.element); - } - getPermanentElementById(id2) { - return getPermanentElementById(this.element, id2); - } - getPermanentElementMapForSnapshot(snapshot) { - const permanentElementMap = {}; - for (const currentPermanentElement of this.permanentElements) { - const { id: id2 } = currentPermanentElement; - const newPermanentElement = snapshot.getPermanentElementById(id2); - if (newPermanentElement) { - permanentElementMap[id2] = [currentPermanentElement, newPermanentElement]; - } - } - return permanentElementMap; - } - }; - function getPermanentElementById(node, id2) { - return node.querySelector(`#${id2}[data-turbo-permanent]`); - } - function queryPermanentElementsAll(node) { - return node.querySelectorAll("[id][data-turbo-permanent]"); - } - var FormSubmitObserver = class { - constructor(delegate, eventTarget) { - this.started = false; - this.submitCaptured = () => { - this.eventTarget.removeEventListener("submit", this.submitBubbled, false); - this.eventTarget.addEventListener("submit", this.submitBubbled, false); - }; - this.submitBubbled = (event) => { - if (!event.defaultPrevented) { - const form = event.target instanceof HTMLFormElement ? event.target : void 0; - const submitter = event.submitter || void 0; - if (form && submissionDoesNotDismissDialog(form, submitter) && submissionDoesNotTargetIFrame(form, submitter) && this.delegate.willSubmitForm(form, submitter)) { - event.preventDefault(); - event.stopImmediatePropagation(); - this.delegate.formSubmitted(form, submitter); - } - } - }; - this.delegate = delegate; - this.eventTarget = eventTarget; - } - start() { - if (!this.started) { - this.eventTarget.addEventListener("submit", this.submitCaptured, true); - this.started = true; - } - } - stop() { - if (this.started) { - this.eventTarget.removeEventListener("submit", this.submitCaptured, true); - this.started = false; - } - } - }; - function submissionDoesNotDismissDialog(form, submitter) { - const method = (submitter === null || submitter === void 0 ? void 0 : submitter.getAttribute("formmethod")) || form.getAttribute("method"); - return method != "dialog"; - } - function submissionDoesNotTargetIFrame(form, submitter) { - if ((submitter === null || submitter === void 0 ? void 0 : submitter.hasAttribute("formtarget")) || form.hasAttribute("target")) { - const target = (submitter === null || submitter === void 0 ? void 0 : submitter.getAttribute("formtarget")) || form.target; - for (const element of document.getElementsByName(target)) { - if (element instanceof HTMLIFrameElement) - return false; - } - return true; - } else { - return true; - } - } - var View = class { - constructor(delegate, element) { - this.resolveRenderPromise = (_value) => { - }; - this.resolveInterceptionPromise = (_value) => { - }; - this.delegate = delegate; - this.element = element; - } - scrollToAnchor(anchor) { - const element = this.snapshot.getElementForAnchor(anchor); - if (element) { - this.scrollToElement(element); - this.focusElement(element); - } else { - this.scrollToPosition({ x: 0, y: 0 }); - } - } - scrollToAnchorFromLocation(location2) { - this.scrollToAnchor(getAnchor(location2)); - } - scrollToElement(element) { - element.scrollIntoView(); - } - focusElement(element) { - if (element instanceof HTMLElement) { - if (element.hasAttribute("tabindex")) { - element.focus(); - } else { - element.setAttribute("tabindex", "-1"); - element.focus(); - element.removeAttribute("tabindex"); - } - } - } - scrollToPosition({ x: x3, y: y3 }) { - this.scrollRoot.scrollTo(x3, y3); - } - scrollToTop() { - this.scrollToPosition({ x: 0, y: 0 }); - } - get scrollRoot() { - return window; - } - async render(renderer) { - const { isPreview, shouldRender, newSnapshot: snapshot } = renderer; - if (shouldRender) { - try { - this.renderPromise = new Promise((resolve) => this.resolveRenderPromise = resolve); - this.renderer = renderer; - await this.prepareToRenderSnapshot(renderer); - const renderInterception = new Promise((resolve) => this.resolveInterceptionPromise = resolve); - const options = { resume: this.resolveInterceptionPromise, render: this.renderer.renderElement }; - const immediateRender = this.delegate.allowsImmediateRender(snapshot, options); - if (!immediateRender) - await renderInterception; - await this.renderSnapshot(renderer); - this.delegate.viewRenderedSnapshot(snapshot, isPreview); - this.delegate.preloadOnLoadLinksForView(this.element); - this.finishRenderingSnapshot(renderer); - } finally { - delete this.renderer; - this.resolveRenderPromise(void 0); - delete this.renderPromise; - } - } else { - this.invalidate(renderer.reloadReason); - } - } - invalidate(reason) { - this.delegate.viewInvalidated(reason); - } - async prepareToRenderSnapshot(renderer) { - this.markAsPreview(renderer.isPreview); - await renderer.prepareToRender(); - } - markAsPreview(isPreview) { - if (isPreview) { - this.element.setAttribute("data-turbo-preview", ""); - } else { - this.element.removeAttribute("data-turbo-preview"); - } - } - async renderSnapshot(renderer) { - await renderer.render(); - } - finishRenderingSnapshot(renderer) { - renderer.finishRendering(); - } - }; - var FrameView = class extends View { - missing() { - this.element.innerHTML = `<strong class="turbo-frame-error">Content missing</strong>`; - } - get snapshot() { - return new Snapshot(this.element); - } - }; - var LinkInterceptor = class { - constructor(delegate, element) { - this.clickBubbled = (event) => { - if (this.respondsToEventTarget(event.target)) { - this.clickEvent = event; - } else { - delete this.clickEvent; - } - }; - this.linkClicked = (event) => { - if (this.clickEvent && this.respondsToEventTarget(event.target) && event.target instanceof Element) { - if (this.delegate.shouldInterceptLinkClick(event.target, event.detail.url, event.detail.originalEvent)) { - this.clickEvent.preventDefault(); - event.preventDefault(); - this.delegate.linkClickIntercepted(event.target, event.detail.url, event.detail.originalEvent); - } - } - delete this.clickEvent; - }; - this.willVisit = (_event) => { - delete this.clickEvent; - }; - this.delegate = delegate; - this.element = element; - } - start() { - this.element.addEventListener("click", this.clickBubbled); - document.addEventListener("turbo:click", this.linkClicked); - document.addEventListener("turbo:before-visit", this.willVisit); - } - stop() { - this.element.removeEventListener("click", this.clickBubbled); - document.removeEventListener("turbo:click", this.linkClicked); - document.removeEventListener("turbo:before-visit", this.willVisit); - } - respondsToEventTarget(target) { - const element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null; - return element && element.closest("turbo-frame, html") == this.element; - } - }; - var LinkClickObserver = class { - constructor(delegate, eventTarget) { - this.started = false; - this.clickCaptured = () => { - this.eventTarget.removeEventListener("click", this.clickBubbled, false); - this.eventTarget.addEventListener("click", this.clickBubbled, false); - }; - this.clickBubbled = (event) => { - if (event instanceof MouseEvent && this.clickEventIsSignificant(event)) { - const target = event.composedPath && event.composedPath()[0] || event.target; - const link = this.findLinkFromClickTarget(target); - if (link && doesNotTargetIFrame(link)) { - const location2 = this.getLocationForLink(link); - if (this.delegate.willFollowLinkToLocation(link, location2, event)) { - event.preventDefault(); - this.delegate.followedLinkToLocation(link, location2); - } - } - } - }; - this.delegate = delegate; - this.eventTarget = eventTarget; - } - start() { - if (!this.started) { - this.eventTarget.addEventListener("click", this.clickCaptured, true); - this.started = true; - } - } - stop() { - if (this.started) { - this.eventTarget.removeEventListener("click", this.clickCaptured, true); - this.started = false; - } - } - clickEventIsSignificant(event) { - return !(event.target && event.target.isContentEditable || event.defaultPrevented || event.which > 1 || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey); - } - findLinkFromClickTarget(target) { - return findClosestRecursively(target, "a[href]:not([target^=_]):not([download])"); - } - getLocationForLink(link) { - return expandURL(link.getAttribute("href") || ""); - } - }; - function doesNotTargetIFrame(anchor) { - if (anchor.hasAttribute("target")) { - for (const element of document.getElementsByName(anchor.target)) { - if (element instanceof HTMLIFrameElement) - return false; - } - return true; - } else { - return true; - } - } - var FormLinkClickObserver = class { - constructor(delegate, element) { - this.delegate = delegate; - this.linkInterceptor = new LinkClickObserver(this, element); - } - start() { - this.linkInterceptor.start(); - } - stop() { - this.linkInterceptor.stop(); - } - willFollowLinkToLocation(link, location2, originalEvent) { - return this.delegate.willSubmitFormLinkToLocation(link, location2, originalEvent) && link.hasAttribute("data-turbo-method"); - } - followedLinkToLocation(link, location2) { - const form = document.createElement("form"); - const type = "hidden"; - for (const [name, value] of location2.searchParams) { - form.append(Object.assign(document.createElement("input"), { type, name, value })); - } - const action = Object.assign(location2, { search: "" }); - form.setAttribute("data-turbo", "true"); - form.setAttribute("action", action.href); - form.setAttribute("hidden", ""); - const method = link.getAttribute("data-turbo-method"); - if (method) - form.setAttribute("method", method); - const turboFrame = link.getAttribute("data-turbo-frame"); - if (turboFrame) - form.setAttribute("data-turbo-frame", turboFrame); - const turboAction = getVisitAction(link); - if (turboAction) - form.setAttribute("data-turbo-action", turboAction); - const turboConfirm = link.getAttribute("data-turbo-confirm"); - if (turboConfirm) - form.setAttribute("data-turbo-confirm", turboConfirm); - const turboStream = link.hasAttribute("data-turbo-stream"); - if (turboStream) - form.setAttribute("data-turbo-stream", ""); - this.delegate.submittedFormLinkToLocation(link, location2, form); - document.body.appendChild(form); - form.addEventListener("turbo:submit-end", () => form.remove(), { once: true }); - requestAnimationFrame(() => form.requestSubmit()); - } - }; - var Bardo = class { - static async preservingPermanentElements(delegate, permanentElementMap, callback) { - const bardo = new this(delegate, permanentElementMap); - bardo.enter(); - await callback(); - bardo.leave(); - } - constructor(delegate, permanentElementMap) { - this.delegate = delegate; - this.permanentElementMap = permanentElementMap; - } - enter() { - for (const id2 in this.permanentElementMap) { - const [currentPermanentElement, newPermanentElement] = this.permanentElementMap[id2]; - this.delegate.enteringBardo(currentPermanentElement, newPermanentElement); - this.replaceNewPermanentElementWithPlaceholder(newPermanentElement); - } - } - leave() { - for (const id2 in this.permanentElementMap) { - const [currentPermanentElement] = this.permanentElementMap[id2]; - this.replaceCurrentPermanentElementWithClone(currentPermanentElement); - this.replacePlaceholderWithPermanentElement(currentPermanentElement); - this.delegate.leavingBardo(currentPermanentElement); - } - } - replaceNewPermanentElementWithPlaceholder(permanentElement) { - const placeholder = createPlaceholderForPermanentElement(permanentElement); - permanentElement.replaceWith(placeholder); - } - replaceCurrentPermanentElementWithClone(permanentElement) { - const clone2 = permanentElement.cloneNode(true); - permanentElement.replaceWith(clone2); - } - replacePlaceholderWithPermanentElement(permanentElement) { - const placeholder = this.getPlaceholderById(permanentElement.id); - placeholder === null || placeholder === void 0 ? void 0 : placeholder.replaceWith(permanentElement); - } - getPlaceholderById(id2) { - return this.placeholders.find((element) => element.content == id2); - } - get placeholders() { - return [...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]; - } - }; - function createPlaceholderForPermanentElement(permanentElement) { - const element = document.createElement("meta"); - element.setAttribute("name", "turbo-permanent-placeholder"); - element.setAttribute("content", permanentElement.id); - return element; - } - var Renderer = class { - constructor(currentSnapshot, newSnapshot, renderElement, isPreview, willRender = true) { - this.activeElement = null; - this.currentSnapshot = currentSnapshot; - this.newSnapshot = newSnapshot; - this.isPreview = isPreview; - this.willRender = willRender; - this.renderElement = renderElement; - this.promise = new Promise((resolve, reject) => this.resolvingFunctions = { resolve, reject }); - } - get shouldRender() { - return true; - } - get reloadReason() { - return; - } - prepareToRender() { - return; - } - finishRendering() { - if (this.resolvingFunctions) { - this.resolvingFunctions.resolve(); - delete this.resolvingFunctions; - } - } - async preservingPermanentElements(callback) { - await Bardo.preservingPermanentElements(this, this.permanentElementMap, callback); - } - focusFirstAutofocusableElement() { - const element = this.connectedSnapshot.firstAutofocusableElement; - if (elementIsFocusable(element)) { - element.focus(); - } - } - enteringBardo(currentPermanentElement) { - if (this.activeElement) - return; - if (currentPermanentElement.contains(this.currentSnapshot.activeElement)) { - this.activeElement = this.currentSnapshot.activeElement; - } - } - leavingBardo(currentPermanentElement) { - if (currentPermanentElement.contains(this.activeElement) && this.activeElement instanceof HTMLElement) { - this.activeElement.focus(); - this.activeElement = null; - } - } - get connectedSnapshot() { - return this.newSnapshot.isConnected ? this.newSnapshot : this.currentSnapshot; - } - get currentElement() { - return this.currentSnapshot.element; - } - get newElement() { - return this.newSnapshot.element; - } - get permanentElementMap() { - return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot); - } - }; - function elementIsFocusable(element) { - return element && typeof element.focus == "function"; - } - var FrameRenderer = class extends Renderer { - static renderElement(currentElement, newElement) { - var _a; - const destinationRange = document.createRange(); - destinationRange.selectNodeContents(currentElement); - destinationRange.deleteContents(); - const frameElement = newElement; - const sourceRange = (_a = frameElement.ownerDocument) === null || _a === void 0 ? void 0 : _a.createRange(); - if (sourceRange) { - sourceRange.selectNodeContents(frameElement); - currentElement.appendChild(sourceRange.extractContents()); - } - } - constructor(delegate, currentSnapshot, newSnapshot, renderElement, isPreview, willRender = true) { - super(currentSnapshot, newSnapshot, renderElement, isPreview, willRender); - this.delegate = delegate; - } - get shouldRender() { - return true; - } - async render() { - await nextAnimationFrame(); - this.preservingPermanentElements(() => { - this.loadFrameElement(); - }); - this.scrollFrameIntoView(); - await nextAnimationFrame(); - this.focusFirstAutofocusableElement(); - await nextAnimationFrame(); - this.activateScriptElements(); - } - loadFrameElement() { - this.delegate.willRenderFrame(this.currentElement, this.newElement); - this.renderElement(this.currentElement, this.newElement); - } - scrollFrameIntoView() { - if (this.currentElement.autoscroll || this.newElement.autoscroll) { - const element = this.currentElement.firstElementChild; - const block = readScrollLogicalPosition(this.currentElement.getAttribute("data-autoscroll-block"), "end"); - const behavior = readScrollBehavior(this.currentElement.getAttribute("data-autoscroll-behavior"), "auto"); - if (element) { - element.scrollIntoView({ block, behavior }); - return true; - } - } - return false; - } - activateScriptElements() { - for (const inertScriptElement of this.newScriptElements) { - const activatedScriptElement = activateScriptElement(inertScriptElement); - inertScriptElement.replaceWith(activatedScriptElement); - } - } - get newScriptElements() { - return this.currentElement.querySelectorAll("script"); - } - }; - function readScrollLogicalPosition(value, defaultValue) { - if (value == "end" || value == "start" || value == "center" || value == "nearest") { - return value; - } else { - return defaultValue; - } - } - function readScrollBehavior(value, defaultValue) { - if (value == "auto" || value == "smooth") { - return value; - } else { - return defaultValue; - } - } - var ProgressBar = class { - static get defaultCSS() { - return unindent` - .turbo-progress-bar { - position: fixed; - display: block; - top: 0; - left: 0; - height: 3px; - background: #0076ff; - z-index: 2147483647; - transition: - width ${ProgressBar.animationDuration}ms ease-out, - opacity ${ProgressBar.animationDuration / 2}ms ${ProgressBar.animationDuration / 2}ms ease-in; - transform: translate3d(0, 0, 0); - } - `; - } - constructor() { - this.hiding = false; - this.value = 0; - this.visible = false; - this.trickle = () => { - this.setValue(this.value + Math.random() / 100); - }; - this.stylesheetElement = this.createStylesheetElement(); - this.progressElement = this.createProgressElement(); - this.installStylesheetElement(); - this.setValue(0); - } - show() { - if (!this.visible) { - this.visible = true; - this.installProgressElement(); - this.startTrickling(); - } - } - hide() { - if (this.visible && !this.hiding) { - this.hiding = true; - this.fadeProgressElement(() => { - this.uninstallProgressElement(); - this.stopTrickling(); - this.visible = false; - this.hiding = false; - }); - } - } - setValue(value) { - this.value = value; - this.refresh(); - } - installStylesheetElement() { - document.head.insertBefore(this.stylesheetElement, document.head.firstChild); - } - installProgressElement() { - this.progressElement.style.width = "0"; - this.progressElement.style.opacity = "1"; - document.documentElement.insertBefore(this.progressElement, document.body); - this.refresh(); - } - fadeProgressElement(callback) { - this.progressElement.style.opacity = "0"; - setTimeout(callback, ProgressBar.animationDuration * 1.5); - } - uninstallProgressElement() { - if (this.progressElement.parentNode) { - document.documentElement.removeChild(this.progressElement); - } - } - startTrickling() { - if (!this.trickleInterval) { - this.trickleInterval = window.setInterval(this.trickle, ProgressBar.animationDuration); - } - } - stopTrickling() { - window.clearInterval(this.trickleInterval); - delete this.trickleInterval; - } - refresh() { - requestAnimationFrame(() => { - this.progressElement.style.width = `${10 + this.value * 90}%`; - }); - } - createStylesheetElement() { - const element = document.createElement("style"); - element.type = "text/css"; - element.textContent = ProgressBar.defaultCSS; - if (this.cspNonce) { - element.nonce = this.cspNonce; - } - return element; - } - createProgressElement() { - const element = document.createElement("div"); - element.className = "turbo-progress-bar"; - return element; - } - get cspNonce() { - return getMetaContent("csp-nonce"); - } - }; - ProgressBar.animationDuration = 300; - var HeadSnapshot = class extends Snapshot { - constructor() { - super(...arguments); - this.detailsByOuterHTML = this.children.filter((element) => !elementIsNoscript(element)).map((element) => elementWithoutNonce(element)).reduce((result, element) => { - const { outerHTML } = element; - const details = outerHTML in result ? result[outerHTML] : { - type: elementType(element), - tracked: elementIsTracked(element), - elements: [] - }; - return Object.assign(Object.assign({}, result), { [outerHTML]: Object.assign(Object.assign({}, details), { elements: [...details.elements, element] }) }); - }, {}); - } - get trackedElementSignature() { - return Object.keys(this.detailsByOuterHTML).filter((outerHTML) => this.detailsByOuterHTML[outerHTML].tracked).join(""); - } - getScriptElementsNotInSnapshot(snapshot) { - return this.getElementsMatchingTypeNotInSnapshot("script", snapshot); - } - getStylesheetElementsNotInSnapshot(snapshot) { - return this.getElementsMatchingTypeNotInSnapshot("stylesheet", snapshot); - } - getElementsMatchingTypeNotInSnapshot(matchedType, snapshot) { - return Object.keys(this.detailsByOuterHTML).filter((outerHTML) => !(outerHTML in snapshot.detailsByOuterHTML)).map((outerHTML) => this.detailsByOuterHTML[outerHTML]).filter(({ type }) => type == matchedType).map(({ elements: [element] }) => element); - } - get provisionalElements() { - return Object.keys(this.detailsByOuterHTML).reduce((result, outerHTML) => { - const { type, tracked, elements } = this.detailsByOuterHTML[outerHTML]; - if (type == null && !tracked) { - return [...result, ...elements]; - } else if (elements.length > 1) { - return [...result, ...elements.slice(1)]; - } else { - return result; - } - }, []); - } - getMetaValue(name) { - const element = this.findMetaElementByName(name); - return element ? element.getAttribute("content") : null; - } - findMetaElementByName(name) { - return Object.keys(this.detailsByOuterHTML).reduce((result, outerHTML) => { - const { elements: [element] } = this.detailsByOuterHTML[outerHTML]; - return elementIsMetaElementWithName(element, name) ? element : result; - }, void 0); - } - }; - function elementType(element) { - if (elementIsScript(element)) { - return "script"; - } else if (elementIsStylesheet(element)) { - return "stylesheet"; - } - } - function elementIsTracked(element) { - return element.getAttribute("data-turbo-track") == "reload"; - } - function elementIsScript(element) { - const tagName = element.localName; - return tagName == "script"; - } - function elementIsNoscript(element) { - const tagName = element.localName; - return tagName == "noscript"; - } - function elementIsStylesheet(element) { - const tagName = element.localName; - return tagName == "style" || tagName == "link" && element.getAttribute("rel") == "stylesheet"; - } - function elementIsMetaElementWithName(element, name) { - const tagName = element.localName; - return tagName == "meta" && element.getAttribute("name") == name; - } - function elementWithoutNonce(element) { - if (element.hasAttribute("nonce")) { - element.setAttribute("nonce", ""); - } - return element; - } - var PageSnapshot = class extends Snapshot { - static fromHTMLString(html = "") { - return this.fromDocument(parseHTMLDocument(html)); - } - static fromElement(element) { - return this.fromDocument(element.ownerDocument); - } - static fromDocument({ head, body }) { - return new this(body, new HeadSnapshot(head)); - } - constructor(element, headSnapshot) { - super(element); - this.headSnapshot = headSnapshot; - } - clone() { - const clonedElement = this.element.cloneNode(true); - const selectElements = this.element.querySelectorAll("select"); - const clonedSelectElements = clonedElement.querySelectorAll("select"); - for (const [index, source] of selectElements.entries()) { - const clone2 = clonedSelectElements[index]; - for (const option of clone2.selectedOptions) - option.selected = false; - for (const option of source.selectedOptions) - clone2.options[option.index].selected = true; - } - for (const clonedPasswordInput of clonedElement.querySelectorAll('input[type="password"]')) { - clonedPasswordInput.value = ""; - } - return new PageSnapshot(clonedElement, this.headSnapshot); - } - get headElement() { - return this.headSnapshot.element; - } - get rootLocation() { - var _a; - const root = (_a = this.getSetting("root")) !== null && _a !== void 0 ? _a : "/"; - return expandURL(root); - } - get cacheControlValue() { - return this.getSetting("cache-control"); - } - get isPreviewable() { - return this.cacheControlValue != "no-preview"; - } - get isCacheable() { - return this.cacheControlValue != "no-cache"; - } - get isVisitable() { - return this.getSetting("visit-control") != "reload"; - } - getSetting(name) { - return this.headSnapshot.getMetaValue(`turbo-${name}`); - } - }; - var TimingMetric; - (function(TimingMetric2) { - TimingMetric2["visitStart"] = "visitStart"; - TimingMetric2["requestStart"] = "requestStart"; - TimingMetric2["requestEnd"] = "requestEnd"; - TimingMetric2["visitEnd"] = "visitEnd"; - })(TimingMetric || (TimingMetric = {})); - var VisitState; - (function(VisitState2) { - VisitState2["initialized"] = "initialized"; - VisitState2["started"] = "started"; - VisitState2["canceled"] = "canceled"; - VisitState2["failed"] = "failed"; - VisitState2["completed"] = "completed"; - })(VisitState || (VisitState = {})); - var defaultOptions = { - action: "advance", - historyChanged: false, - visitCachedSnapshot: () => { - }, - willRender: true, - updateHistory: true, - shouldCacheSnapshot: true, - acceptsStreamResponse: false - }; - var SystemStatusCode; - (function(SystemStatusCode2) { - SystemStatusCode2[SystemStatusCode2["networkFailure"] = 0] = "networkFailure"; - SystemStatusCode2[SystemStatusCode2["timeoutFailure"] = -1] = "timeoutFailure"; - SystemStatusCode2[SystemStatusCode2["contentTypeMismatch"] = -2] = "contentTypeMismatch"; - })(SystemStatusCode || (SystemStatusCode = {})); - var Visit = class { - constructor(delegate, location2, restorationIdentifier, options = {}) { - this.identifier = uuid(); - this.timingMetrics = {}; - this.followedRedirect = false; - this.historyChanged = false; - this.scrolled = false; - this.shouldCacheSnapshot = true; - this.acceptsStreamResponse = false; - this.snapshotCached = false; - this.state = VisitState.initialized; - this.delegate = delegate; - this.location = location2; - this.restorationIdentifier = restorationIdentifier || uuid(); - const { action, historyChanged, referrer, snapshot, snapshotHTML, response, visitCachedSnapshot, willRender, updateHistory, shouldCacheSnapshot, acceptsStreamResponse } = Object.assign(Object.assign({}, defaultOptions), options); - this.action = action; - this.historyChanged = historyChanged; - this.referrer = referrer; - this.snapshot = snapshot; - this.snapshotHTML = snapshotHTML; - this.response = response; - this.isSamePage = this.delegate.locationWithActionIsSamePage(this.location, this.action); - this.visitCachedSnapshot = visitCachedSnapshot; - this.willRender = willRender; - this.updateHistory = updateHistory; - this.scrolled = !willRender; - this.shouldCacheSnapshot = shouldCacheSnapshot; - this.acceptsStreamResponse = acceptsStreamResponse; - } - get adapter() { - return this.delegate.adapter; - } - get view() { - return this.delegate.view; - } - get history() { - return this.delegate.history; - } - get restorationData() { - return this.history.getRestorationDataForIdentifier(this.restorationIdentifier); - } - get silent() { - return this.isSamePage; - } - start() { - if (this.state == VisitState.initialized) { - this.recordTimingMetric(TimingMetric.visitStart); - this.state = VisitState.started; - this.adapter.visitStarted(this); - this.delegate.visitStarted(this); - } - } - cancel() { - if (this.state == VisitState.started) { - if (this.request) { - this.request.cancel(); - } - this.cancelRender(); - this.state = VisitState.canceled; - } - } - complete() { - if (this.state == VisitState.started) { - this.recordTimingMetric(TimingMetric.visitEnd); - this.state = VisitState.completed; - this.followRedirect(); - if (!this.followedRedirect) { - this.adapter.visitCompleted(this); - this.delegate.visitCompleted(this); - } - } - } - fail() { - if (this.state == VisitState.started) { - this.state = VisitState.failed; - this.adapter.visitFailed(this); - } - } - changeHistory() { - var _a; - if (!this.historyChanged && this.updateHistory) { - const actionForHistory = this.location.href === ((_a = this.referrer) === null || _a === void 0 ? void 0 : _a.href) ? "replace" : this.action; - const method = getHistoryMethodForAction(actionForHistory); - this.history.update(method, this.location, this.restorationIdentifier); - this.historyChanged = true; - } - } - issueRequest() { - if (this.hasPreloadedResponse()) { - this.simulateRequest(); - } else if (this.shouldIssueRequest() && !this.request) { - this.request = new FetchRequest(this, FetchMethod.get, this.location); - this.request.perform(); - } - } - simulateRequest() { - if (this.response) { - this.startRequest(); - this.recordResponse(); - this.finishRequest(); - } - } - startRequest() { - this.recordTimingMetric(TimingMetric.requestStart); - this.adapter.visitRequestStarted(this); - } - recordResponse(response = this.response) { - this.response = response; - if (response) { - const { statusCode } = response; - if (isSuccessful(statusCode)) { - this.adapter.visitRequestCompleted(this); - } else { - this.adapter.visitRequestFailedWithStatusCode(this, statusCode); - } - } - } - finishRequest() { - this.recordTimingMetric(TimingMetric.requestEnd); - this.adapter.visitRequestFinished(this); - } - loadResponse() { - if (this.response) { - const { statusCode, responseHTML } = this.response; - this.render(async () => { - if (this.shouldCacheSnapshot) - this.cacheSnapshot(); - if (this.view.renderPromise) - await this.view.renderPromise; - if (isSuccessful(statusCode) && responseHTML != null) { - await this.view.renderPage(PageSnapshot.fromHTMLString(responseHTML), false, this.willRender, this); - this.performScroll(); - this.adapter.visitRendered(this); - this.complete(); - } else { - await this.view.renderError(PageSnapshot.fromHTMLString(responseHTML), this); - this.adapter.visitRendered(this); - this.fail(); - } - }); - } - } - getCachedSnapshot() { - const snapshot = this.view.getCachedSnapshotForLocation(this.location) || this.getPreloadedSnapshot(); - if (snapshot && (!getAnchor(this.location) || snapshot.hasAnchor(getAnchor(this.location)))) { - if (this.action == "restore" || snapshot.isPreviewable) { - return snapshot; - } - } - } - getPreloadedSnapshot() { - if (this.snapshotHTML) { - return PageSnapshot.fromHTMLString(this.snapshotHTML); - } - } - hasCachedSnapshot() { - return this.getCachedSnapshot() != null; - } - loadCachedSnapshot() { - const snapshot = this.getCachedSnapshot(); - if (snapshot) { - const isPreview = this.shouldIssueRequest(); - this.render(async () => { - this.cacheSnapshot(); - if (this.isSamePage) { - this.adapter.visitRendered(this); - } else { - if (this.view.renderPromise) - await this.view.renderPromise; - await this.view.renderPage(snapshot, isPreview, this.willRender, this); - this.performScroll(); - this.adapter.visitRendered(this); - if (!isPreview) { - this.complete(); - } - } - }); - } - } - followRedirect() { - var _a; - if (this.redirectedToLocation && !this.followedRedirect && ((_a = this.response) === null || _a === void 0 ? void 0 : _a.redirected)) { - this.adapter.visitProposedToLocation(this.redirectedToLocation, { - action: "replace", - response: this.response, - shouldCacheSnapshot: false, - willRender: false - }); - this.followedRedirect = true; - } - } - goToSamePageAnchor() { - if (this.isSamePage) { - this.render(async () => { - this.cacheSnapshot(); - this.performScroll(); - this.changeHistory(); - this.adapter.visitRendered(this); - }); - } - } - prepareRequest(request) { - if (this.acceptsStreamResponse) { - request.acceptResponseType(StreamMessage.contentType); - } - } - requestStarted() { - this.startRequest(); - } - requestPreventedHandlingResponse(_request, _response) { - } - async requestSucceededWithResponse(request, response) { - const responseHTML = await response.responseHTML; - const { redirected, statusCode } = response; - if (responseHTML == void 0) { - this.recordResponse({ - statusCode: SystemStatusCode.contentTypeMismatch, - redirected - }); - } else { - this.redirectedToLocation = response.redirected ? response.location : void 0; - this.recordResponse({ statusCode, responseHTML, redirected }); - } - } - async requestFailedWithResponse(request, response) { - const responseHTML = await response.responseHTML; - const { redirected, statusCode } = response; - if (responseHTML == void 0) { - this.recordResponse({ - statusCode: SystemStatusCode.contentTypeMismatch, - redirected - }); - } else { - this.recordResponse({ statusCode, responseHTML, redirected }); - } - } - requestErrored(_request, _error) { - this.recordResponse({ - statusCode: SystemStatusCode.networkFailure, - redirected: false - }); - } - requestFinished() { - this.finishRequest(); - } - performScroll() { - if (!this.scrolled && !this.view.forceReloaded) { - if (this.action == "restore") { - this.scrollToRestoredPosition() || this.scrollToAnchor() || this.view.scrollToTop(); - } else { - this.scrollToAnchor() || this.view.scrollToTop(); - } - if (this.isSamePage) { - this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation, this.location); - } - this.scrolled = true; - } - } - scrollToRestoredPosition() { - const { scrollPosition } = this.restorationData; - if (scrollPosition) { - this.view.scrollToPosition(scrollPosition); - return true; - } - } - scrollToAnchor() { - const anchor = getAnchor(this.location); - if (anchor != null) { - this.view.scrollToAnchor(anchor); - return true; - } - } - recordTimingMetric(metric) { - this.timingMetrics[metric] = (/* @__PURE__ */ new Date()).getTime(); - } - getTimingMetrics() { - return Object.assign({}, this.timingMetrics); - } - getHistoryMethodForAction(action) { - switch (action) { - case "replace": - return history.replaceState; - case "advance": - case "restore": - return history.pushState; - } - } - hasPreloadedResponse() { - return typeof this.response == "object"; - } - shouldIssueRequest() { - if (this.isSamePage) { - return false; - } else if (this.action == "restore") { - return !this.hasCachedSnapshot(); - } else { - return this.willRender; - } - } - cacheSnapshot() { - if (!this.snapshotCached) { - this.view.cacheSnapshot(this.snapshot).then((snapshot) => snapshot && this.visitCachedSnapshot(snapshot)); - this.snapshotCached = true; - } - } - async render(callback) { - this.cancelRender(); - await new Promise((resolve) => { - this.frame = requestAnimationFrame(() => resolve()); - }); - await callback(); - delete this.frame; - } - cancelRender() { - if (this.frame) { - cancelAnimationFrame(this.frame); - delete this.frame; - } - } - }; - function isSuccessful(statusCode) { - return statusCode >= 200 && statusCode < 300; - } - var BrowserAdapter = class { - constructor(session2) { - this.progressBar = new ProgressBar(); - this.showProgressBar = () => { - this.progressBar.show(); - }; - this.session = session2; - } - visitProposedToLocation(location2, options) { - this.navigator.startVisit(location2, (options === null || options === void 0 ? void 0 : options.restorationIdentifier) || uuid(), options); - } - visitStarted(visit2) { - this.location = visit2.location; - visit2.loadCachedSnapshot(); - visit2.issueRequest(); - visit2.goToSamePageAnchor(); - } - visitRequestStarted(visit2) { - this.progressBar.setValue(0); - if (visit2.hasCachedSnapshot() || visit2.action != "restore") { - this.showVisitProgressBarAfterDelay(); - } else { - this.showProgressBar(); - } - } - visitRequestCompleted(visit2) { - visit2.loadResponse(); - } - visitRequestFailedWithStatusCode(visit2, statusCode) { - switch (statusCode) { - case SystemStatusCode.networkFailure: - case SystemStatusCode.timeoutFailure: - case SystemStatusCode.contentTypeMismatch: - return this.reload({ - reason: "request_failed", - context: { - statusCode - } - }); - default: - return visit2.loadResponse(); - } - } - visitRequestFinished(_visit) { - this.progressBar.setValue(1); - this.hideVisitProgressBar(); - } - visitCompleted(_visit) { - } - pageInvalidated(reason) { - this.reload(reason); - } - visitFailed(_visit) { - } - visitRendered(_visit) { - } - formSubmissionStarted(_formSubmission) { - this.progressBar.setValue(0); - this.showFormProgressBarAfterDelay(); - } - formSubmissionFinished(_formSubmission) { - this.progressBar.setValue(1); - this.hideFormProgressBar(); - } - showVisitProgressBarAfterDelay() { - this.visitProgressBarTimeout = window.setTimeout(this.showProgressBar, this.session.progressBarDelay); - } - hideVisitProgressBar() { - this.progressBar.hide(); - if (this.visitProgressBarTimeout != null) { - window.clearTimeout(this.visitProgressBarTimeout); - delete this.visitProgressBarTimeout; - } - } - showFormProgressBarAfterDelay() { - if (this.formProgressBarTimeout == null) { - this.formProgressBarTimeout = window.setTimeout(this.showProgressBar, this.session.progressBarDelay); - } - } - hideFormProgressBar() { - this.progressBar.hide(); - if (this.formProgressBarTimeout != null) { - window.clearTimeout(this.formProgressBarTimeout); - delete this.formProgressBarTimeout; - } - } - reload(reason) { - var _a; - dispatch2("turbo:reload", { detail: reason }); - window.location.href = ((_a = this.location) === null || _a === void 0 ? void 0 : _a.toString()) || window.location.href; - } - get navigator() { - return this.session.navigator; - } - }; - var CacheObserver = class { - constructor() { - this.selector = "[data-turbo-temporary]"; - this.deprecatedSelector = "[data-turbo-cache=false]"; - this.started = false; - this.removeTemporaryElements = (_event) => { - for (const element of this.temporaryElements) { - element.remove(); - } - }; - } - start() { - if (!this.started) { - this.started = true; - addEventListener("turbo:before-cache", this.removeTemporaryElements, false); - } - } - stop() { - if (this.started) { - this.started = false; - removeEventListener("turbo:before-cache", this.removeTemporaryElements, false); - } - } - get temporaryElements() { - return [...document.querySelectorAll(this.selector), ...this.temporaryElementsWithDeprecation]; - } - get temporaryElementsWithDeprecation() { - const elements = document.querySelectorAll(this.deprecatedSelector); - if (elements.length) { - console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`); - } - return [...elements]; - } - }; - var FrameRedirector = class { - constructor(session2, element) { - this.session = session2; - this.element = element; - this.linkInterceptor = new LinkInterceptor(this, element); - this.formSubmitObserver = new FormSubmitObserver(this, element); - } - start() { - this.linkInterceptor.start(); - this.formSubmitObserver.start(); - } - stop() { - this.linkInterceptor.stop(); - this.formSubmitObserver.stop(); - } - shouldInterceptLinkClick(element, _location, _event) { - return this.shouldRedirect(element); - } - linkClickIntercepted(element, url, event) { - const frame = this.findFrameElement(element); - if (frame) { - frame.delegate.linkClickIntercepted(element, url, event); - } - } - willSubmitForm(element, submitter) { - return element.closest("turbo-frame") == null && this.shouldSubmit(element, submitter) && this.shouldRedirect(element, submitter); - } - formSubmitted(element, submitter) { - const frame = this.findFrameElement(element, submitter); - if (frame) { - frame.delegate.formSubmitted(element, submitter); - } - } - shouldSubmit(form, submitter) { - var _a; - const action = getAction(form, submitter); - const meta = this.element.ownerDocument.querySelector(`meta[name="turbo-root"]`); - const rootLocation = expandURL((_a = meta === null || meta === void 0 ? void 0 : meta.content) !== null && _a !== void 0 ? _a : "/"); - return this.shouldRedirect(form, submitter) && locationIsVisitable(action, rootLocation); - } - shouldRedirect(element, submitter) { - const isNavigatable = element instanceof HTMLFormElement ? this.session.submissionIsNavigatable(element, submitter) : this.session.elementIsNavigatable(element); - if (isNavigatable) { - const frame = this.findFrameElement(element, submitter); - return frame ? frame != element.closest("turbo-frame") : false; - } else { - return false; - } - } - findFrameElement(element, submitter) { - const id2 = (submitter === null || submitter === void 0 ? void 0 : submitter.getAttribute("data-turbo-frame")) || element.getAttribute("data-turbo-frame"); - if (id2 && id2 != "_top") { - const frame = this.element.querySelector(`#${id2}:not([disabled])`); - if (frame instanceof FrameElement) { - return frame; - } - } - } - }; - var History = class { - constructor(delegate) { - this.restorationIdentifier = uuid(); - this.restorationData = {}; - this.started = false; - this.pageLoaded = false; - this.onPopState = (event) => { - if (this.shouldHandlePopState()) { - const { turbo } = event.state || {}; - if (turbo) { - this.location = new URL(window.location.href); - const { restorationIdentifier } = turbo; - this.restorationIdentifier = restorationIdentifier; - this.delegate.historyPoppedToLocationWithRestorationIdentifier(this.location, restorationIdentifier); - } - } - }; - this.onPageLoad = async (_event) => { - await nextMicrotask(); - this.pageLoaded = true; - }; - this.delegate = delegate; - } - start() { - if (!this.started) { - addEventListener("popstate", this.onPopState, false); - addEventListener("load", this.onPageLoad, false); - this.started = true; - this.replace(new URL(window.location.href)); - } - } - stop() { - if (this.started) { - removeEventListener("popstate", this.onPopState, false); - removeEventListener("load", this.onPageLoad, false); - this.started = false; - } - } - push(location2, restorationIdentifier) { - this.update(history.pushState, location2, restorationIdentifier); - } - replace(location2, restorationIdentifier) { - this.update(history.replaceState, location2, restorationIdentifier); - } - update(method, location2, restorationIdentifier = uuid()) { - const state = { turbo: { restorationIdentifier } }; - method.call(history, state, "", location2.href); - this.location = location2; - this.restorationIdentifier = restorationIdentifier; - } - getRestorationDataForIdentifier(restorationIdentifier) { - return this.restorationData[restorationIdentifier] || {}; - } - updateRestorationData(additionalData) { - const { restorationIdentifier } = this; - const restorationData = this.restorationData[restorationIdentifier]; - this.restorationData[restorationIdentifier] = Object.assign(Object.assign({}, restorationData), additionalData); - } - assumeControlOfScrollRestoration() { - var _a; - if (!this.previousScrollRestoration) { - this.previousScrollRestoration = (_a = history.scrollRestoration) !== null && _a !== void 0 ? _a : "auto"; - history.scrollRestoration = "manual"; - } - } - relinquishControlOfScrollRestoration() { - if (this.previousScrollRestoration) { - history.scrollRestoration = this.previousScrollRestoration; - delete this.previousScrollRestoration; - } - } - shouldHandlePopState() { - return this.pageIsLoaded(); - } - pageIsLoaded() { - return this.pageLoaded || document.readyState == "complete"; - } - }; - var Navigator = class { - constructor(delegate) { - this.delegate = delegate; - } - proposeVisit(location2, options = {}) { - if (this.delegate.allowsVisitingLocationWithAction(location2, options.action)) { - if (locationIsVisitable(location2, this.view.snapshot.rootLocation)) { - this.delegate.visitProposedToLocation(location2, options); - } else { - window.location.href = location2.toString(); - } - } - } - startVisit(locatable, restorationIdentifier, options = {}) { - this.stop(); - this.currentVisit = new Visit(this, expandURL(locatable), restorationIdentifier, Object.assign({ referrer: this.location }, options)); - this.currentVisit.start(); - } - submitForm(form, submitter) { - this.stop(); - this.formSubmission = new FormSubmission(this, form, submitter, true); - this.formSubmission.start(); - } - stop() { - if (this.formSubmission) { - this.formSubmission.stop(); - delete this.formSubmission; - } - if (this.currentVisit) { - this.currentVisit.cancel(); - delete this.currentVisit; - } - } - get adapter() { - return this.delegate.adapter; - } - get view() { - return this.delegate.view; - } - get history() { - return this.delegate.history; - } - formSubmissionStarted(formSubmission) { - if (typeof this.adapter.formSubmissionStarted === "function") { - this.adapter.formSubmissionStarted(formSubmission); - } - } - async formSubmissionSucceededWithResponse(formSubmission, fetchResponse) { - if (formSubmission == this.formSubmission) { - const responseHTML = await fetchResponse.responseHTML; - if (responseHTML) { - const shouldCacheSnapshot = formSubmission.isSafe; - if (!shouldCacheSnapshot) { - this.view.clearSnapshotCache(); - } - const { statusCode, redirected } = fetchResponse; - const action = this.getActionForFormSubmission(formSubmission); - const visitOptions = { - action, - shouldCacheSnapshot, - response: { statusCode, responseHTML, redirected } - }; - this.proposeVisit(fetchResponse.location, visitOptions); - } - } - } - async formSubmissionFailedWithResponse(formSubmission, fetchResponse) { - const responseHTML = await fetchResponse.responseHTML; - if (responseHTML) { - const snapshot = PageSnapshot.fromHTMLString(responseHTML); - if (fetchResponse.serverError) { - await this.view.renderError(snapshot, this.currentVisit); - } else { - await this.view.renderPage(snapshot, false, true, this.currentVisit); - } - this.view.scrollToTop(); - this.view.clearSnapshotCache(); - } - } - formSubmissionErrored(formSubmission, error2) { - console.error(error2); - } - formSubmissionFinished(formSubmission) { - if (typeof this.adapter.formSubmissionFinished === "function") { - this.adapter.formSubmissionFinished(formSubmission); - } - } - visitStarted(visit2) { - this.delegate.visitStarted(visit2); - } - visitCompleted(visit2) { - this.delegate.visitCompleted(visit2); - } - locationWithActionIsSamePage(location2, action) { - const anchor = getAnchor(location2); - const currentAnchor = getAnchor(this.view.lastRenderedLocation); - const isRestorationToTop = action === "restore" && typeof anchor === "undefined"; - return action !== "replace" && getRequestURL(location2) === getRequestURL(this.view.lastRenderedLocation) && (isRestorationToTop || anchor != null && anchor !== currentAnchor); - } - visitScrolledToSamePageLocation(oldURL, newURL) { - this.delegate.visitScrolledToSamePageLocation(oldURL, newURL); - } - get location() { - return this.history.location; - } - get restorationIdentifier() { - return this.history.restorationIdentifier; - } - getActionForFormSubmission({ submitter, formElement }) { - return getVisitAction(submitter, formElement) || "advance"; - } - }; - var PageStage; - (function(PageStage2) { - PageStage2[PageStage2["initial"] = 0] = "initial"; - PageStage2[PageStage2["loading"] = 1] = "loading"; - PageStage2[PageStage2["interactive"] = 2] = "interactive"; - PageStage2[PageStage2["complete"] = 3] = "complete"; - })(PageStage || (PageStage = {})); - var PageObserver = class { - constructor(delegate) { - this.stage = PageStage.initial; - this.started = false; - this.interpretReadyState = () => { - const { readyState } = this; - if (readyState == "interactive") { - this.pageIsInteractive(); - } else if (readyState == "complete") { - this.pageIsComplete(); - } - }; - this.pageWillUnload = () => { - this.delegate.pageWillUnload(); - }; - this.delegate = delegate; - } - start() { - if (!this.started) { - if (this.stage == PageStage.initial) { - this.stage = PageStage.loading; - } - document.addEventListener("readystatechange", this.interpretReadyState, false); - addEventListener("pagehide", this.pageWillUnload, false); - this.started = true; - } - } - stop() { - if (this.started) { - document.removeEventListener("readystatechange", this.interpretReadyState, false); - removeEventListener("pagehide", this.pageWillUnload, false); - this.started = false; - } - } - pageIsInteractive() { - if (this.stage == PageStage.loading) { - this.stage = PageStage.interactive; - this.delegate.pageBecameInteractive(); - } - } - pageIsComplete() { - this.pageIsInteractive(); - if (this.stage == PageStage.interactive) { - this.stage = PageStage.complete; - this.delegate.pageLoaded(); - } - } - get readyState() { - return document.readyState; - } - }; - var ScrollObserver = class { - constructor(delegate) { - this.started = false; - this.onScroll = () => { - this.updatePosition({ x: window.pageXOffset, y: window.pageYOffset }); - }; - this.delegate = delegate; - } - start() { - if (!this.started) { - addEventListener("scroll", this.onScroll, false); - this.onScroll(); - this.started = true; - } - } - stop() { - if (this.started) { - removeEventListener("scroll", this.onScroll, false); - this.started = false; - } - } - updatePosition(position) { - this.delegate.scrollPositionChanged(position); - } - }; - var StreamMessageRenderer = class { - render({ fragment }) { - Bardo.preservingPermanentElements(this, getPermanentElementMapForFragment(fragment), () => document.documentElement.appendChild(fragment)); - } - enteringBardo(currentPermanentElement, newPermanentElement) { - newPermanentElement.replaceWith(currentPermanentElement.cloneNode(true)); - } - leavingBardo() { - } - }; - function getPermanentElementMapForFragment(fragment) { - const permanentElementsInDocument = queryPermanentElementsAll(document.documentElement); - const permanentElementMap = {}; - for (const permanentElementInDocument of permanentElementsInDocument) { - const { id: id2 } = permanentElementInDocument; - for (const streamElement of fragment.querySelectorAll("turbo-stream")) { - const elementInStream = getPermanentElementById(streamElement.templateElement.content, id2); - if (elementInStream) { - permanentElementMap[id2] = [permanentElementInDocument, elementInStream]; - } - } - } - return permanentElementMap; - } - var StreamObserver = class { - constructor(delegate) { - this.sources = /* @__PURE__ */ new Set(); - this.started = false; - this.inspectFetchResponse = (event) => { - const response = fetchResponseFromEvent(event); - if (response && fetchResponseIsStream(response)) { - event.preventDefault(); - this.receiveMessageResponse(response); - } - }; - this.receiveMessageEvent = (event) => { - if (this.started && typeof event.data == "string") { - this.receiveMessageHTML(event.data); - } - }; - this.delegate = delegate; - } - start() { - if (!this.started) { - this.started = true; - addEventListener("turbo:before-fetch-response", this.inspectFetchResponse, false); - } - } - stop() { - if (this.started) { - this.started = false; - removeEventListener("turbo:before-fetch-response", this.inspectFetchResponse, false); - } - } - connectStreamSource(source) { - if (!this.streamSourceIsConnected(source)) { - this.sources.add(source); - source.addEventListener("message", this.receiveMessageEvent, false); - } - } - disconnectStreamSource(source) { - if (this.streamSourceIsConnected(source)) { - this.sources.delete(source); - source.removeEventListener("message", this.receiveMessageEvent, false); - } - } - streamSourceIsConnected(source) { - return this.sources.has(source); - } - async receiveMessageResponse(response) { - const html = await response.responseHTML; - if (html) { - this.receiveMessageHTML(html); - } - } - receiveMessageHTML(html) { - this.delegate.receivedMessageFromStream(StreamMessage.wrap(html)); - } - }; - function fetchResponseFromEvent(event) { - var _a; - const fetchResponse = (_a = event.detail) === null || _a === void 0 ? void 0 : _a.fetchResponse; - if (fetchResponse instanceof FetchResponse) { - return fetchResponse; - } - } - function fetchResponseIsStream(response) { - var _a; - const contentType = (_a = response.contentType) !== null && _a !== void 0 ? _a : ""; - return contentType.startsWith(StreamMessage.contentType); - } - var ErrorRenderer = class extends Renderer { - static renderElement(currentElement, newElement) { - const { documentElement, body } = document; - documentElement.replaceChild(newElement, body); - } - async render() { - this.replaceHeadAndBody(); - this.activateScriptElements(); - } - replaceHeadAndBody() { - const { documentElement, head } = document; - documentElement.replaceChild(this.newHead, head); - this.renderElement(this.currentElement, this.newElement); - } - activateScriptElements() { - for (const replaceableElement of this.scriptElements) { - const parentNode = replaceableElement.parentNode; - if (parentNode) { - const element = activateScriptElement(replaceableElement); - parentNode.replaceChild(element, replaceableElement); - } - } - } - get newHead() { - return this.newSnapshot.headSnapshot.element; - } - get scriptElements() { - return document.documentElement.querySelectorAll("script"); - } - }; - var PageRenderer = class extends Renderer { - static renderElement(currentElement, newElement) { - if (document.body && newElement instanceof HTMLBodyElement) { - document.body.replaceWith(newElement); - } else { - document.documentElement.appendChild(newElement); - } - } - get shouldRender() { - return this.newSnapshot.isVisitable && this.trackedElementsAreIdentical; - } - get reloadReason() { - if (!this.newSnapshot.isVisitable) { - return { - reason: "turbo_visit_control_is_reload" - }; - } - if (!this.trackedElementsAreIdentical) { - return { - reason: "tracked_element_mismatch" - }; - } - } - async prepareToRender() { - await this.mergeHead(); - } - async render() { - if (this.willRender) { - await this.replaceBody(); - } - } - finishRendering() { - super.finishRendering(); - if (!this.isPreview) { - this.focusFirstAutofocusableElement(); - } - } - get currentHeadSnapshot() { - return this.currentSnapshot.headSnapshot; - } - get newHeadSnapshot() { - return this.newSnapshot.headSnapshot; - } - get newElement() { - return this.newSnapshot.element; - } - async mergeHead() { - const mergedHeadElements = this.mergeProvisionalElements(); - const newStylesheetElements = this.copyNewHeadStylesheetElements(); - this.copyNewHeadScriptElements(); - await mergedHeadElements; - await newStylesheetElements; - } - async replaceBody() { - await this.preservingPermanentElements(async () => { - this.activateNewBody(); - await this.assignNewBody(); - }); - } - get trackedElementsAreIdentical() { - return this.currentHeadSnapshot.trackedElementSignature == this.newHeadSnapshot.trackedElementSignature; - } - async copyNewHeadStylesheetElements() { - const loadingElements = []; - for (const element of this.newHeadStylesheetElements) { - loadingElements.push(waitForLoad(element)); - document.head.appendChild(element); - } - await Promise.all(loadingElements); - } - copyNewHeadScriptElements() { - for (const element of this.newHeadScriptElements) { - document.head.appendChild(activateScriptElement(element)); - } - } - async mergeProvisionalElements() { - const newHeadElements = [...this.newHeadProvisionalElements]; - for (const element of this.currentHeadProvisionalElements) { - if (!this.isCurrentElementInElementList(element, newHeadElements)) { - document.head.removeChild(element); - } - } - for (const element of newHeadElements) { - document.head.appendChild(element); - } - } - isCurrentElementInElementList(element, elementList) { - for (const [index, newElement] of elementList.entries()) { - if (element.tagName == "TITLE") { - if (newElement.tagName != "TITLE") { - continue; - } - if (element.innerHTML == newElement.innerHTML) { - elementList.splice(index, 1); - return true; - } - } - if (newElement.isEqualNode(element)) { - elementList.splice(index, 1); - return true; - } - } - return false; - } - removeCurrentHeadProvisionalElements() { - for (const element of this.currentHeadProvisionalElements) { - document.head.removeChild(element); - } - } - copyNewHeadProvisionalElements() { - for (const element of this.newHeadProvisionalElements) { - document.head.appendChild(element); - } - } - activateNewBody() { - document.adoptNode(this.newElement); - this.activateNewBodyScriptElements(); - } - activateNewBodyScriptElements() { - for (const inertScriptElement of this.newBodyScriptElements) { - const activatedScriptElement = activateScriptElement(inertScriptElement); - inertScriptElement.replaceWith(activatedScriptElement); - } - } - async assignNewBody() { - await this.renderElement(this.currentElement, this.newElement); - } - get newHeadStylesheetElements() { - return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot); - } - get newHeadScriptElements() { - return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot); - } - get currentHeadProvisionalElements() { - return this.currentHeadSnapshot.provisionalElements; - } - get newHeadProvisionalElements() { - return this.newHeadSnapshot.provisionalElements; - } - get newBodyScriptElements() { - return this.newElement.querySelectorAll("script"); - } - }; - var SnapshotCache = class { - constructor(size2) { - this.keys = []; - this.snapshots = {}; - this.size = size2; - } - has(location2) { - return toCacheKey(location2) in this.snapshots; - } - get(location2) { - if (this.has(location2)) { - const snapshot = this.read(location2); - this.touch(location2); - return snapshot; - } - } - put(location2, snapshot) { - this.write(location2, snapshot); - this.touch(location2); - return snapshot; - } - clear() { - this.snapshots = {}; - } - read(location2) { - return this.snapshots[toCacheKey(location2)]; - } - write(location2, snapshot) { - this.snapshots[toCacheKey(location2)] = snapshot; - } - touch(location2) { - const key = toCacheKey(location2); - const index = this.keys.indexOf(key); - if (index > -1) - this.keys.splice(index, 1); - this.keys.unshift(key); - this.trim(); - } - trim() { - for (const key of this.keys.splice(this.size)) { - delete this.snapshots[key]; - } - } - }; - var PageView = class extends View { - constructor() { - super(...arguments); - this.snapshotCache = new SnapshotCache(10); - this.lastRenderedLocation = new URL(location.href); - this.forceReloaded = false; - } - renderPage(snapshot, isPreview = false, willRender = true, visit2) { - const renderer = new PageRenderer(this.snapshot, snapshot, PageRenderer.renderElement, isPreview, willRender); - if (!renderer.shouldRender) { - this.forceReloaded = true; - } else { - visit2 === null || visit2 === void 0 ? void 0 : visit2.changeHistory(); - } - return this.render(renderer); - } - renderError(snapshot, visit2) { - visit2 === null || visit2 === void 0 ? void 0 : visit2.changeHistory(); - const renderer = new ErrorRenderer(this.snapshot, snapshot, ErrorRenderer.renderElement, false); - return this.render(renderer); - } - clearSnapshotCache() { - this.snapshotCache.clear(); - } - async cacheSnapshot(snapshot = this.snapshot) { - if (snapshot.isCacheable) { - this.delegate.viewWillCacheSnapshot(); - const { lastRenderedLocation: location2 } = this; - await nextEventLoopTick(); - const cachedSnapshot = snapshot.clone(); - this.snapshotCache.put(location2, cachedSnapshot); - return cachedSnapshot; - } - } - getCachedSnapshotForLocation(location2) { - return this.snapshotCache.get(location2); - } - get snapshot() { - return PageSnapshot.fromElement(this.element); - } - }; - var Preloader = class { - constructor(delegate) { - this.selector = "a[data-turbo-preload]"; - this.delegate = delegate; - } - get snapshotCache() { - return this.delegate.navigator.view.snapshotCache; - } - start() { - if (document.readyState === "loading") { - return document.addEventListener("DOMContentLoaded", () => { - this.preloadOnLoadLinksForView(document.body); - }); - } else { - this.preloadOnLoadLinksForView(document.body); - } - } - preloadOnLoadLinksForView(element) { - for (const link of element.querySelectorAll(this.selector)) { - this.preloadURL(link); - } - } - async preloadURL(link) { - const location2 = new URL(link.href); - if (this.snapshotCache.has(location2)) { - return; - } - try { - const response = await fetch(location2.toString(), { headers: { "VND.PREFETCH": "true", Accept: "text/html" } }); - const responseText = await response.text(); - const snapshot = PageSnapshot.fromHTMLString(responseText); - this.snapshotCache.put(location2, snapshot); - } catch (_3) { - } - } - }; - var Session = class { - constructor() { - this.navigator = new Navigator(this); - this.history = new History(this); - this.preloader = new Preloader(this); - this.view = new PageView(this, document.documentElement); - this.adapter = new BrowserAdapter(this); - this.pageObserver = new PageObserver(this); - this.cacheObserver = new CacheObserver(); - this.linkClickObserver = new LinkClickObserver(this, window); - this.formSubmitObserver = new FormSubmitObserver(this, document); - this.scrollObserver = new ScrollObserver(this); - this.streamObserver = new StreamObserver(this); - this.formLinkClickObserver = new FormLinkClickObserver(this, document.documentElement); - this.frameRedirector = new FrameRedirector(this, document.documentElement); - this.streamMessageRenderer = new StreamMessageRenderer(); - this.drive = true; - this.enabled = true; - this.progressBarDelay = 500; - this.started = false; - this.formMode = "on"; - } - start() { - if (!this.started) { - this.pageObserver.start(); - this.cacheObserver.start(); - this.formLinkClickObserver.start(); - this.linkClickObserver.start(); - this.formSubmitObserver.start(); - this.scrollObserver.start(); - this.streamObserver.start(); - this.frameRedirector.start(); - this.history.start(); - this.preloader.start(); - this.started = true; - this.enabled = true; - } - } - disable() { - this.enabled = false; - } - stop() { - if (this.started) { - this.pageObserver.stop(); - this.cacheObserver.stop(); - this.formLinkClickObserver.stop(); - this.linkClickObserver.stop(); - this.formSubmitObserver.stop(); - this.scrollObserver.stop(); - this.streamObserver.stop(); - this.frameRedirector.stop(); - this.history.stop(); - this.started = false; - } - } - registerAdapter(adapter) { - this.adapter = adapter; - } - visit(location2, options = {}) { - const frameElement = options.frame ? document.getElementById(options.frame) : null; - if (frameElement instanceof FrameElement) { - frameElement.src = location2.toString(); - frameElement.loaded; - } else { - this.navigator.proposeVisit(expandURL(location2), options); - } - } - connectStreamSource(source) { - this.streamObserver.connectStreamSource(source); - } - disconnectStreamSource(source) { - this.streamObserver.disconnectStreamSource(source); - } - renderStreamMessage(message2) { - this.streamMessageRenderer.render(StreamMessage.wrap(message2)); - } - clearCache() { - this.view.clearSnapshotCache(); - } - setProgressBarDelay(delay3) { - this.progressBarDelay = delay3; - } - setFormMode(mode) { - this.formMode = mode; - } - get location() { - return this.history.location; - } - get restorationIdentifier() { - return this.history.restorationIdentifier; - } - historyPoppedToLocationWithRestorationIdentifier(location2, restorationIdentifier) { - if (this.enabled) { - this.navigator.startVisit(location2, restorationIdentifier, { - action: "restore", - historyChanged: true - }); - } else { - this.adapter.pageInvalidated({ - reason: "turbo_disabled" - }); - } - } - scrollPositionChanged(position) { - this.history.updateRestorationData({ scrollPosition: position }); - } - willSubmitFormLinkToLocation(link, location2) { - return this.elementIsNavigatable(link) && locationIsVisitable(location2, this.snapshot.rootLocation); - } - submittedFormLinkToLocation() { - } - willFollowLinkToLocation(link, location2, event) { - return this.elementIsNavigatable(link) && locationIsVisitable(location2, this.snapshot.rootLocation) && this.applicationAllowsFollowingLinkToLocation(link, location2, event); - } - followedLinkToLocation(link, location2) { - const action = this.getActionForLink(link); - const acceptsStreamResponse = link.hasAttribute("data-turbo-stream"); - this.visit(location2.href, { action, acceptsStreamResponse }); - } - allowsVisitingLocationWithAction(location2, action) { - return this.locationWithActionIsSamePage(location2, action) || this.applicationAllowsVisitingLocation(location2); - } - visitProposedToLocation(location2, options) { - extendURLWithDeprecatedProperties(location2); - this.adapter.visitProposedToLocation(location2, options); - } - visitStarted(visit2) { - if (!visit2.acceptsStreamResponse) { - markAsBusy(document.documentElement); - } - extendURLWithDeprecatedProperties(visit2.location); - if (!visit2.silent) { - this.notifyApplicationAfterVisitingLocation(visit2.location, visit2.action); - } - } - visitCompleted(visit2) { - clearBusyState(document.documentElement); - this.notifyApplicationAfterPageLoad(visit2.getTimingMetrics()); - } - locationWithActionIsSamePage(location2, action) { - return this.navigator.locationWithActionIsSamePage(location2, action); - } - visitScrolledToSamePageLocation(oldURL, newURL) { - this.notifyApplicationAfterVisitingSamePageLocation(oldURL, newURL); - } - willSubmitForm(form, submitter) { - const action = getAction(form, submitter); - return this.submissionIsNavigatable(form, submitter) && locationIsVisitable(expandURL(action), this.snapshot.rootLocation); - } - formSubmitted(form, submitter) { - this.navigator.submitForm(form, submitter); - } - pageBecameInteractive() { - this.view.lastRenderedLocation = this.location; - this.notifyApplicationAfterPageLoad(); - } - pageLoaded() { - this.history.assumeControlOfScrollRestoration(); - } - pageWillUnload() { - this.history.relinquishControlOfScrollRestoration(); - } - receivedMessageFromStream(message2) { - this.renderStreamMessage(message2); - } - viewWillCacheSnapshot() { - var _a; - if (!((_a = this.navigator.currentVisit) === null || _a === void 0 ? void 0 : _a.silent)) { - this.notifyApplicationBeforeCachingSnapshot(); - } - } - allowsImmediateRender({ element }, options) { - const event = this.notifyApplicationBeforeRender(element, options); - const { defaultPrevented, detail: { render: render2 } } = event; - if (this.view.renderer && render2) { - this.view.renderer.renderElement = render2; - } - return !defaultPrevented; - } - viewRenderedSnapshot(_snapshot, _isPreview) { - this.view.lastRenderedLocation = this.history.location; - this.notifyApplicationAfterRender(); - } - preloadOnLoadLinksForView(element) { - this.preloader.preloadOnLoadLinksForView(element); - } - viewInvalidated(reason) { - this.adapter.pageInvalidated(reason); - } - frameLoaded(frame) { - this.notifyApplicationAfterFrameLoad(frame); - } - frameRendered(fetchResponse, frame) { - this.notifyApplicationAfterFrameRender(fetchResponse, frame); - } - applicationAllowsFollowingLinkToLocation(link, location2, ev) { - const event = this.notifyApplicationAfterClickingLinkToLocation(link, location2, ev); - return !event.defaultPrevented; - } - applicationAllowsVisitingLocation(location2) { - const event = this.notifyApplicationBeforeVisitingLocation(location2); - return !event.defaultPrevented; - } - notifyApplicationAfterClickingLinkToLocation(link, location2, event) { - return dispatch2("turbo:click", { - target: link, - detail: { url: location2.href, originalEvent: event }, - cancelable: true - }); - } - notifyApplicationBeforeVisitingLocation(location2) { - return dispatch2("turbo:before-visit", { - detail: { url: location2.href }, - cancelable: true - }); - } - notifyApplicationAfterVisitingLocation(location2, action) { - return dispatch2("turbo:visit", { detail: { url: location2.href, action } }); - } - notifyApplicationBeforeCachingSnapshot() { - return dispatch2("turbo:before-cache"); - } - notifyApplicationBeforeRender(newBody, options) { - return dispatch2("turbo:before-render", { - detail: Object.assign({ newBody }, options), - cancelable: true - }); - } - notifyApplicationAfterRender() { - return dispatch2("turbo:render"); - } - notifyApplicationAfterPageLoad(timing = {}) { - return dispatch2("turbo:load", { - detail: { url: this.location.href, timing } - }); - } - notifyApplicationAfterVisitingSamePageLocation(oldURL, newURL) { - dispatchEvent(new HashChangeEvent("hashchange", { - oldURL: oldURL.toString(), - newURL: newURL.toString() - })); - } - notifyApplicationAfterFrameLoad(frame) { - return dispatch2("turbo:frame-load", { target: frame }); - } - notifyApplicationAfterFrameRender(fetchResponse, frame) { - return dispatch2("turbo:frame-render", { - detail: { fetchResponse }, - target: frame, - cancelable: true - }); - } - submissionIsNavigatable(form, submitter) { - if (this.formMode == "off") { - return false; - } else { - const submitterIsNavigatable = submitter ? this.elementIsNavigatable(submitter) : true; - if (this.formMode == "optin") { - return submitterIsNavigatable && form.closest('[data-turbo="true"]') != null; - } else { - return submitterIsNavigatable && this.elementIsNavigatable(form); - } - } - } - elementIsNavigatable(element) { - const container = findClosestRecursively(element, "[data-turbo]"); - const withinFrame = findClosestRecursively(element, "turbo-frame"); - if (this.drive || withinFrame) { - if (container) { - return container.getAttribute("data-turbo") != "false"; - } else { - return true; - } - } else { - if (container) { - return container.getAttribute("data-turbo") == "true"; - } else { - return false; - } - } - } - getActionForLink(link) { - return getVisitAction(link) || "advance"; - } - get snapshot() { - return this.view.snapshot; - } - }; - function extendURLWithDeprecatedProperties(url) { - Object.defineProperties(url, deprecatedLocationPropertyDescriptors); - } - var deprecatedLocationPropertyDescriptors = { - absoluteURL: { - get() { - return this.toString(); - } - } - }; - var Cache = class { - constructor(session2) { - this.session = session2; - } - clear() { - this.session.clearCache(); - } - resetCacheControl() { - this.setCacheControl(""); - } - exemptPageFromCache() { - this.setCacheControl("no-cache"); - } - exemptPageFromPreview() { - this.setCacheControl("no-preview"); - } - setCacheControl(value) { - setMetaContent("turbo-cache-control", value); - } - }; - var StreamActions = { - after() { - this.targetElements.forEach((e3) => { - var _a; - return (_a = e3.parentElement) === null || _a === void 0 ? void 0 : _a.insertBefore(this.templateContent, e3.nextSibling); - }); - }, - append() { - this.removeDuplicateTargetChildren(); - this.targetElements.forEach((e3) => e3.append(this.templateContent)); - }, - before() { - this.targetElements.forEach((e3) => { - var _a; - return (_a = e3.parentElement) === null || _a === void 0 ? void 0 : _a.insertBefore(this.templateContent, e3); - }); - }, - prepend() { - this.removeDuplicateTargetChildren(); - this.targetElements.forEach((e3) => e3.prepend(this.templateContent)); - }, - remove() { - this.targetElements.forEach((e3) => e3.remove()); - }, - replace() { - this.targetElements.forEach((e3) => e3.replaceWith(this.templateContent)); - }, - update() { - this.targetElements.forEach((targetElement) => { - targetElement.innerHTML = ""; - targetElement.append(this.templateContent); - }); - } - }; - var session = new Session(); - var cache = new Cache(session); - var { navigator: navigator$1 } = session; - function start() { - session.start(); - } - function registerAdapter(adapter) { - session.registerAdapter(adapter); - } - function visit(location2, options) { - session.visit(location2, options); - } - function connectStreamSource(source) { - session.connectStreamSource(source); - } - function disconnectStreamSource(source) { - session.disconnectStreamSource(source); - } - function renderStreamMessage(message2) { - session.renderStreamMessage(message2); - } - function clearCache() { - console.warn("Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`"); - session.clearCache(); - } - function setProgressBarDelay(delay3) { - session.setProgressBarDelay(delay3); - } - function setConfirmMethod(confirmMethod) { - FormSubmission.confirmMethod = confirmMethod; - } - function setFormMode(mode) { - session.setFormMode(mode); - } - var Turbo = /* @__PURE__ */ Object.freeze({ - __proto__: null, - navigator: navigator$1, - session, - cache, - PageRenderer, - PageSnapshot, - FrameRenderer, - start, - registerAdapter, - visit, - connectStreamSource, - disconnectStreamSource, - renderStreamMessage, - clearCache, - setProgressBarDelay, - setConfirmMethod, - setFormMode, - StreamActions - }); - var TurboFrameMissingError = class extends Error { - }; - var FrameController = class { - constructor(element) { - this.fetchResponseLoaded = (_fetchResponse) => { - }; - this.currentFetchRequest = null; - this.resolveVisitPromise = () => { - }; - this.connected = false; - this.hasBeenLoaded = false; - this.ignoredAttributes = /* @__PURE__ */ new Set(); - this.action = null; - this.visitCachedSnapshot = ({ element: element2 }) => { - const frame = element2.querySelector("#" + this.element.id); - if (frame && this.previousFrameElement) { - frame.replaceChildren(...this.previousFrameElement.children); - } - delete this.previousFrameElement; - }; - this.element = element; - this.view = new FrameView(this, this.element); - this.appearanceObserver = new AppearanceObserver(this, this.element); - this.formLinkClickObserver = new FormLinkClickObserver(this, this.element); - this.linkInterceptor = new LinkInterceptor(this, this.element); - this.restorationIdentifier = uuid(); - this.formSubmitObserver = new FormSubmitObserver(this, this.element); - } - connect() { - if (!this.connected) { - this.connected = true; - if (this.loadingStyle == FrameLoadingStyle.lazy) { - this.appearanceObserver.start(); - } else { - this.loadSourceURL(); - } - this.formLinkClickObserver.start(); - this.linkInterceptor.start(); - this.formSubmitObserver.start(); - } - } - disconnect() { - if (this.connected) { - this.connected = false; - this.appearanceObserver.stop(); - this.formLinkClickObserver.stop(); - this.linkInterceptor.stop(); - this.formSubmitObserver.stop(); - } - } - disabledChanged() { - if (this.loadingStyle == FrameLoadingStyle.eager) { - this.loadSourceURL(); - } - } - sourceURLChanged() { - if (this.isIgnoringChangesTo("src")) - return; - if (this.element.isConnected) { - this.complete = false; - } - if (this.loadingStyle == FrameLoadingStyle.eager || this.hasBeenLoaded) { - this.loadSourceURL(); - } - } - sourceURLReloaded() { - const { src } = this.element; - this.ignoringChangesToAttribute("complete", () => { - this.element.removeAttribute("complete"); - }); - this.element.src = null; - this.element.src = src; - return this.element.loaded; - } - completeChanged() { - if (this.isIgnoringChangesTo("complete")) - return; - this.loadSourceURL(); - } - loadingStyleChanged() { - if (this.loadingStyle == FrameLoadingStyle.lazy) { - this.appearanceObserver.start(); - } else { - this.appearanceObserver.stop(); - this.loadSourceURL(); - } - } - async loadSourceURL() { - if (this.enabled && this.isActive && !this.complete && this.sourceURL) { - this.element.loaded = this.visit(expandURL(this.sourceURL)); - this.appearanceObserver.stop(); - await this.element.loaded; - this.hasBeenLoaded = true; - } - } - async loadResponse(fetchResponse) { - if (fetchResponse.redirected || fetchResponse.succeeded && fetchResponse.isHTML) { - this.sourceURL = fetchResponse.response.url; - } - try { - const html = await fetchResponse.responseHTML; - if (html) { - const document2 = parseHTMLDocument(html); - const pageSnapshot = PageSnapshot.fromDocument(document2); - if (pageSnapshot.isVisitable) { - await this.loadFrameResponse(fetchResponse, document2); - } else { - await this.handleUnvisitableFrameResponse(fetchResponse); - } - } - } finally { - this.fetchResponseLoaded = () => { - }; - } - } - elementAppearedInViewport(element) { - this.proposeVisitIfNavigatedWithAction(element, element); - this.loadSourceURL(); - } - willSubmitFormLinkToLocation(link) { - return this.shouldInterceptNavigation(link); - } - submittedFormLinkToLocation(link, _location, form) { - const frame = this.findFrameElement(link); - if (frame) - form.setAttribute("data-turbo-frame", frame.id); - } - shouldInterceptLinkClick(element, _location, _event) { - return this.shouldInterceptNavigation(element); - } - linkClickIntercepted(element, location2) { - this.navigateFrame(element, location2); - } - willSubmitForm(element, submitter) { - return element.closest("turbo-frame") == this.element && this.shouldInterceptNavigation(element, submitter); - } - formSubmitted(element, submitter) { - if (this.formSubmission) { - this.formSubmission.stop(); - } - this.formSubmission = new FormSubmission(this, element, submitter); - const { fetchRequest } = this.formSubmission; - this.prepareRequest(fetchRequest); - this.formSubmission.start(); - } - prepareRequest(request) { - var _a; - request.headers["Turbo-Frame"] = this.id; - if ((_a = this.currentNavigationElement) === null || _a === void 0 ? void 0 : _a.hasAttribute("data-turbo-stream")) { - request.acceptResponseType(StreamMessage.contentType); - } - } - requestStarted(_request) { - markAsBusy(this.element); - } - requestPreventedHandlingResponse(_request, _response) { - this.resolveVisitPromise(); - } - async requestSucceededWithResponse(request, response) { - await this.loadResponse(response); - this.resolveVisitPromise(); - } - async requestFailedWithResponse(request, response) { - await this.loadResponse(response); - this.resolveVisitPromise(); - } - requestErrored(request, error2) { - console.error(error2); - this.resolveVisitPromise(); - } - requestFinished(_request) { - clearBusyState(this.element); - } - formSubmissionStarted({ formElement }) { - markAsBusy(formElement, this.findFrameElement(formElement)); - } - formSubmissionSucceededWithResponse(formSubmission, response) { - const frame = this.findFrameElement(formSubmission.formElement, formSubmission.submitter); - frame.delegate.proposeVisitIfNavigatedWithAction(frame, formSubmission.formElement, formSubmission.submitter); - frame.delegate.loadResponse(response); - if (!formSubmission.isSafe) { - session.clearCache(); - } - } - formSubmissionFailedWithResponse(formSubmission, fetchResponse) { - this.element.delegate.loadResponse(fetchResponse); - session.clearCache(); - } - formSubmissionErrored(formSubmission, error2) { - console.error(error2); - } - formSubmissionFinished({ formElement }) { - clearBusyState(formElement, this.findFrameElement(formElement)); - } - allowsImmediateRender({ element: newFrame }, options) { - const event = dispatch2("turbo:before-frame-render", { - target: this.element, - detail: Object.assign({ newFrame }, options), - cancelable: true - }); - const { defaultPrevented, detail: { render: render2 } } = event; - if (this.view.renderer && render2) { - this.view.renderer.renderElement = render2; - } - return !defaultPrevented; - } - viewRenderedSnapshot(_snapshot, _isPreview) { - } - preloadOnLoadLinksForView(element) { - session.preloadOnLoadLinksForView(element); - } - viewInvalidated() { - } - willRenderFrame(currentElement, _newElement) { - this.previousFrameElement = currentElement.cloneNode(true); - } - async loadFrameResponse(fetchResponse, document2) { - const newFrameElement = await this.extractForeignFrameElement(document2.body); - if (newFrameElement) { - const snapshot = new Snapshot(newFrameElement); - const renderer = new FrameRenderer(this, this.view.snapshot, snapshot, FrameRenderer.renderElement, false, false); - if (this.view.renderPromise) - await this.view.renderPromise; - this.changeHistory(); - await this.view.render(renderer); - this.complete = true; - session.frameRendered(fetchResponse, this.element); - session.frameLoaded(this.element); - this.fetchResponseLoaded(fetchResponse); - } else if (this.willHandleFrameMissingFromResponse(fetchResponse)) { - this.handleFrameMissingFromResponse(fetchResponse); - } - } - async visit(url) { - var _a; - const request = new FetchRequest(this, FetchMethod.get, url, new URLSearchParams(), this.element); - (_a = this.currentFetchRequest) === null || _a === void 0 ? void 0 : _a.cancel(); - this.currentFetchRequest = request; - return new Promise((resolve) => { - this.resolveVisitPromise = () => { - this.resolveVisitPromise = () => { - }; - this.currentFetchRequest = null; - resolve(); - }; - request.perform(); - }); - } - navigateFrame(element, url, submitter) { - const frame = this.findFrameElement(element, submitter); - frame.delegate.proposeVisitIfNavigatedWithAction(frame, element, submitter); - this.withCurrentNavigationElement(element, () => { - frame.src = url; - }); - } - proposeVisitIfNavigatedWithAction(frame, element, submitter) { - this.action = getVisitAction(submitter, element, frame); - if (this.action) { - const pageSnapshot = PageSnapshot.fromElement(frame).clone(); - const { visitCachedSnapshot } = frame.delegate; - frame.delegate.fetchResponseLoaded = (fetchResponse) => { - if (frame.src) { - const { statusCode, redirected } = fetchResponse; - const responseHTML = frame.ownerDocument.documentElement.outerHTML; - const response = { statusCode, redirected, responseHTML }; - const options = { - response, - visitCachedSnapshot, - willRender: false, - updateHistory: false, - restorationIdentifier: this.restorationIdentifier, - snapshot: pageSnapshot - }; - if (this.action) - options.action = this.action; - session.visit(frame.src, options); - } - }; - } - } - changeHistory() { - if (this.action) { - const method = getHistoryMethodForAction(this.action); - session.history.update(method, expandURL(this.element.src || ""), this.restorationIdentifier); - } - } - async handleUnvisitableFrameResponse(fetchResponse) { - console.warn(`The response (${fetchResponse.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`); - await this.visitResponse(fetchResponse.response); - } - willHandleFrameMissingFromResponse(fetchResponse) { - this.element.setAttribute("complete", ""); - const response = fetchResponse.response; - const visit2 = async (url, options = {}) => { - if (url instanceof Response) { - this.visitResponse(url); - } else { - session.visit(url, options); - } - }; - const event = dispatch2("turbo:frame-missing", { - target: this.element, - detail: { response, visit: visit2 }, - cancelable: true - }); - return !event.defaultPrevented; - } - handleFrameMissingFromResponse(fetchResponse) { - this.view.missing(); - this.throwFrameMissingError(fetchResponse); - } - throwFrameMissingError(fetchResponse) { - const message2 = `The response (${fetchResponse.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`; - throw new TurboFrameMissingError(message2); - } - async visitResponse(response) { - const wrapped = new FetchResponse(response); - const responseHTML = await wrapped.responseHTML; - const { location: location2, redirected, statusCode } = wrapped; - return session.visit(location2, { response: { redirected, statusCode, responseHTML } }); - } - findFrameElement(element, submitter) { - var _a; - const id2 = getAttribute("data-turbo-frame", submitter, element) || this.element.getAttribute("target"); - return (_a = getFrameElementById(id2)) !== null && _a !== void 0 ? _a : this.element; - } - async extractForeignFrameElement(container) { - let element; - const id2 = CSS.escape(this.id); - try { - element = activateElement(container.querySelector(`turbo-frame#${id2}`), this.sourceURL); - if (element) { - return element; - } - element = activateElement(container.querySelector(`turbo-frame[src][recurse~=${id2}]`), this.sourceURL); - if (element) { - await element.loaded; - return await this.extractForeignFrameElement(element); - } - } catch (error2) { - console.error(error2); - return new FrameElement(); - } - return null; - } - formActionIsVisitable(form, submitter) { - const action = getAction(form, submitter); - return locationIsVisitable(expandURL(action), this.rootLocation); - } - shouldInterceptNavigation(element, submitter) { - const id2 = getAttribute("data-turbo-frame", submitter, element) || this.element.getAttribute("target"); - if (element instanceof HTMLFormElement && !this.formActionIsVisitable(element, submitter)) { - return false; - } - if (!this.enabled || id2 == "_top") { - return false; - } - if (id2) { - const frameElement = getFrameElementById(id2); - if (frameElement) { - return !frameElement.disabled; - } - } - if (!session.elementIsNavigatable(element)) { - return false; - } - if (submitter && !session.elementIsNavigatable(submitter)) { - return false; - } - return true; - } - get id() { - return this.element.id; - } - get enabled() { - return !this.element.disabled; - } - get sourceURL() { - if (this.element.src) { - return this.element.src; - } - } - set sourceURL(sourceURL) { - this.ignoringChangesToAttribute("src", () => { - this.element.src = sourceURL !== null && sourceURL !== void 0 ? sourceURL : null; - }); - } - get loadingStyle() { - return this.element.loading; - } - get isLoading() { - return this.formSubmission !== void 0 || this.resolveVisitPromise() !== void 0; - } - get complete() { - return this.element.hasAttribute("complete"); - } - set complete(value) { - this.ignoringChangesToAttribute("complete", () => { - if (value) { - this.element.setAttribute("complete", ""); - } else { - this.element.removeAttribute("complete"); - } - }); - } - get isActive() { - return this.element.isActive && this.connected; - } - get rootLocation() { - var _a; - const meta = this.element.ownerDocument.querySelector(`meta[name="turbo-root"]`); - const root = (_a = meta === null || meta === void 0 ? void 0 : meta.content) !== null && _a !== void 0 ? _a : "/"; - return expandURL(root); - } - isIgnoringChangesTo(attributeName) { - return this.ignoredAttributes.has(attributeName); - } - ignoringChangesToAttribute(attributeName, callback) { - this.ignoredAttributes.add(attributeName); - callback(); - this.ignoredAttributes.delete(attributeName); - } - withCurrentNavigationElement(element, callback) { - this.currentNavigationElement = element; - callback(); - delete this.currentNavigationElement; - } - }; - function getFrameElementById(id2) { - if (id2 != null) { - const element = document.getElementById(id2); - if (element instanceof FrameElement) { - return element; - } - } - } - function activateElement(element, currentURL) { - if (element) { - const src = element.getAttribute("src"); - if (src != null && currentURL != null && urlsAreEqual(src, currentURL)) { - throw new Error(`Matching <turbo-frame id="${element.id}"> element has a source URL which references itself`); - } - if (element.ownerDocument !== document) { - element = document.importNode(element, true); - } - if (element instanceof FrameElement) { - element.connectedCallback(); - element.disconnectedCallback(); - return element; - } - } - } - var StreamElement = class extends HTMLElement { - static async renderElement(newElement) { - await newElement.performAction(); - } - async connectedCallback() { - try { - await this.render(); - } catch (error2) { - console.error(error2); - } finally { - this.disconnect(); - } - } - async render() { - var _a; - return (_a = this.renderPromise) !== null && _a !== void 0 ? _a : this.renderPromise = (async () => { - const event = this.beforeRenderEvent; - if (this.dispatchEvent(event)) { - await nextAnimationFrame(); - await event.detail.render(this); - } - })(); - } - disconnect() { - try { - this.remove(); - } catch (_a) { - } - } - removeDuplicateTargetChildren() { - this.duplicateChildren.forEach((c3) => c3.remove()); - } - get duplicateChildren() { - var _a; - const existingChildren = this.targetElements.flatMap((e3) => [...e3.children]).filter((c3) => !!c3.id); - const newChildrenIds = [...((_a = this.templateContent) === null || _a === void 0 ? void 0 : _a.children) || []].filter((c3) => !!c3.id).map((c3) => c3.id); - return existingChildren.filter((c3) => newChildrenIds.includes(c3.id)); - } - get performAction() { - if (this.action) { - const actionFunction = StreamActions[this.action]; - if (actionFunction) { - return actionFunction; - } - this.raise("unknown action"); - } - this.raise("action attribute is missing"); - } - get targetElements() { - if (this.target) { - return this.targetElementsById; - } else if (this.targets) { - return this.targetElementsByQuery; - } else { - this.raise("target or targets attribute is missing"); - } - } - get templateContent() { - return this.templateElement.content.cloneNode(true); - } - get templateElement() { - if (this.firstElementChild === null) { - const template = this.ownerDocument.createElement("template"); - this.appendChild(template); - return template; - } else if (this.firstElementChild instanceof HTMLTemplateElement) { - return this.firstElementChild; - } - this.raise("first child element must be a <template> element"); - } - get action() { - return this.getAttribute("action"); - } - get target() { - return this.getAttribute("target"); - } - get targets() { - return this.getAttribute("targets"); - } - raise(message2) { - throw new Error(`${this.description}: ${message2}`); - } - get description() { - var _a, _b; - return (_b = ((_a = this.outerHTML.match(/<[^>]+>/)) !== null && _a !== void 0 ? _a : [])[0]) !== null && _b !== void 0 ? _b : "<turbo-stream>"; - } - get beforeRenderEvent() { - return new CustomEvent("turbo:before-stream-render", { - bubbles: true, - cancelable: true, - detail: { newStream: this, render: StreamElement.renderElement } - }); - } - get targetElementsById() { - var _a; - const element = (_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.getElementById(this.target); - if (element !== null) { - return [element]; - } else { - return []; - } - } - get targetElementsByQuery() { - var _a; - const elements = (_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.querySelectorAll(this.targets); - if (elements.length !== 0) { - return Array.prototype.slice.call(elements); - } else { - return []; - } - } - }; - var StreamSourceElement = class extends HTMLElement { - constructor() { - super(...arguments); - this.streamSource = null; - } - connectedCallback() { - this.streamSource = this.src.match(/^ws{1,2}:/) ? new WebSocket(this.src) : new EventSource(this.src); - connectStreamSource(this.streamSource); - } - disconnectedCallback() { - if (this.streamSource) { - disconnectStreamSource(this.streamSource); - } - } - get src() { - return this.getAttribute("src") || ""; - } - }; - FrameElement.delegateConstructor = FrameController; - if (customElements.get("turbo-frame") === void 0) { - customElements.define("turbo-frame", FrameElement); - } - if (customElements.get("turbo-stream") === void 0) { - customElements.define("turbo-stream", StreamElement); - } - if (customElements.get("turbo-stream-source") === void 0) { - customElements.define("turbo-stream-source", StreamSourceElement); - } - (() => { - let element = document.currentScript; - if (!element) - return; - if (element.hasAttribute("data-turbo-suppress-warning")) - return; - element = element.parentElement; - while (element) { - if (element == document.body) { - return console.warn(unindent` - You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do! - - Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change. - - For more information, see: https://turbo.hotwired.dev/handbook/building#working-with-script-elements - - —— - Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s - `, element.outerHTML); - } - element = element.parentElement; - } - })(); - window.Turbo = Turbo; - start(); - - // ../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable.js - var consumer; - async function getConsumer() { - return consumer || setConsumer(createConsumer2().then(setConsumer)); - } - function setConsumer(newConsumer) { - return consumer = newConsumer; - } - async function createConsumer2() { - const { createConsumer: createConsumer3 } = await Promise.resolve().then(() => (init_src(), src_exports)); - return createConsumer3(); - } - async function subscribeTo(channel, mixin) { - const { subscriptions } = await getConsumer(); - return subscriptions.create(channel, mixin); - } - - // ../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/snakeize.js - function walk(obj) { - if (!obj || typeof obj !== "object") - return obj; - if (obj instanceof Date || obj instanceof RegExp) - return obj; - if (Array.isArray(obj)) - return obj.map(walk); - return Object.keys(obj).reduce(function(acc, key) { - var camel = key[0].toLowerCase() + key.slice(1).replace(/([A-Z]+)/g, function(m3, x3) { - return "_" + x3.toLowerCase(); - }); - acc[camel] = walk(obj[key]); - return acc; - }, {}); - } - - // ../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/cable_stream_source_element.js - var TurboCableStreamSourceElement = class extends HTMLElement { - async connectedCallback() { - connectStreamSource(this); - this.subscription = await subscribeTo(this.channel, { - received: this.dispatchMessageEvent.bind(this), - connected: this.subscriptionConnected.bind(this), - disconnected: this.subscriptionDisconnected.bind(this) - }); - } - disconnectedCallback() { - disconnectStreamSource(this); - if (this.subscription) - this.subscription.unsubscribe(); - } - dispatchMessageEvent(data2) { - const event = new MessageEvent("message", { data: data2 }); - return this.dispatchEvent(event); - } - subscriptionConnected() { - this.setAttribute("connected", ""); - } - subscriptionDisconnected() { - this.removeAttribute("connected"); - } - get channel() { - const channel = this.getAttribute("channel"); - const signed_stream_name = this.getAttribute("signed-stream-name"); - return __spreadValues({ channel, signed_stream_name }, walk(__spreadValues({}, this.dataset))); - } - }; - if (customElements.get("turbo-cable-stream-source") === void 0) { - customElements.define("turbo-cable-stream-source", TurboCableStreamSourceElement); - } - - // ../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/fetch_requests.js - function encodeMethodIntoRequestBody(event) { - if (event.target instanceof HTMLFormElement) { - const { target: form, detail: { fetchOptions } } = event; - form.addEventListener("turbo:submit-start", ({ detail: { formSubmission: { submitter } } }) => { - const body = isBodyInit(fetchOptions.body) ? fetchOptions.body : new URLSearchParams(); - const method = determineFetchMethod(submitter, body, form); - if (!/get/i.test(method)) { - if (/post/i.test(method)) { - body.delete("_method"); - } else { - body.set("_method", method); - } - fetchOptions.method = "post"; - } - }, { once: true }); - } - } - function determineFetchMethod(submitter, body, form) { - const formMethod = determineFormMethod(submitter); - const overrideMethod = body.get("_method"); - const method = form.getAttribute("method") || "get"; - if (typeof formMethod == "string") { - return formMethod; - } else if (typeof overrideMethod == "string") { - return overrideMethod; - } else { - return method; - } - } - function determineFormMethod(submitter) { - if (submitter instanceof HTMLButtonElement || submitter instanceof HTMLInputElement) { - if (submitter.hasAttribute("formmethod")) { - return submitter.formMethod; - } else { - return null; - } - } else { - return null; - } - } - function isBodyInit(body) { - return body instanceof FormData || body instanceof URLSearchParams; - } - - // ../../../node_modules/@hotwired/turbo-rails/app/javascript/turbo/index.js - addEventListener("turbo:before-fetch-request", encodeMethodIntoRequestBody); - - // ../../../node_modules/@rails/activestorage/app/assets/javascripts/activestorage.esm.js - var sparkMd5 = { - exports: {} - }; - (function(module, exports) { - (function(factory) { - { - module.exports = factory(); - } - })(function(undefined$1) { - var hex_chr = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]; - function md5cycle(x3, k3) { - var a3 = x3[0], b3 = x3[1], c3 = x3[2], d3 = x3[3]; - a3 += (b3 & c3 | ~b3 & d3) + k3[0] - 680876936 | 0; - a3 = (a3 << 7 | a3 >>> 25) + b3 | 0; - d3 += (a3 & b3 | ~a3 & c3) + k3[1] - 389564586 | 0; - d3 = (d3 << 12 | d3 >>> 20) + a3 | 0; - c3 += (d3 & a3 | ~d3 & b3) + k3[2] + 606105819 | 0; - c3 = (c3 << 17 | c3 >>> 15) + d3 | 0; - b3 += (c3 & d3 | ~c3 & a3) + k3[3] - 1044525330 | 0; - b3 = (b3 << 22 | b3 >>> 10) + c3 | 0; - a3 += (b3 & c3 | ~b3 & d3) + k3[4] - 176418897 | 0; - a3 = (a3 << 7 | a3 >>> 25) + b3 | 0; - d3 += (a3 & b3 | ~a3 & c3) + k3[5] + 1200080426 | 0; - d3 = (d3 << 12 | d3 >>> 20) + a3 | 0; - c3 += (d3 & a3 | ~d3 & b3) + k3[6] - 1473231341 | 0; - c3 = (c3 << 17 | c3 >>> 15) + d3 | 0; - b3 += (c3 & d3 | ~c3 & a3) + k3[7] - 45705983 | 0; - b3 = (b3 << 22 | b3 >>> 10) + c3 | 0; - a3 += (b3 & c3 | ~b3 & d3) + k3[8] + 1770035416 | 0; - a3 = (a3 << 7 | a3 >>> 25) + b3 | 0; - d3 += (a3 & b3 | ~a3 & c3) + k3[9] - 1958414417 | 0; - d3 = (d3 << 12 | d3 >>> 20) + a3 | 0; - c3 += (d3 & a3 | ~d3 & b3) + k3[10] - 42063 | 0; - c3 = (c3 << 17 | c3 >>> 15) + d3 | 0; - b3 += (c3 & d3 | ~c3 & a3) + k3[11] - 1990404162 | 0; - b3 = (b3 << 22 | b3 >>> 10) + c3 | 0; - a3 += (b3 & c3 | ~b3 & d3) + k3[12] + 1804603682 | 0; - a3 = (a3 << 7 | a3 >>> 25) + b3 | 0; - d3 += (a3 & b3 | ~a3 & c3) + k3[13] - 40341101 | 0; - d3 = (d3 << 12 | d3 >>> 20) + a3 | 0; - c3 += (d3 & a3 | ~d3 & b3) + k3[14] - 1502002290 | 0; - c3 = (c3 << 17 | c3 >>> 15) + d3 | 0; - b3 += (c3 & d3 | ~c3 & a3) + k3[15] + 1236535329 | 0; - b3 = (b3 << 22 | b3 >>> 10) + c3 | 0; - a3 += (b3 & d3 | c3 & ~d3) + k3[1] - 165796510 | 0; - a3 = (a3 << 5 | a3 >>> 27) + b3 | 0; - d3 += (a3 & c3 | b3 & ~c3) + k3[6] - 1069501632 | 0; - d3 = (d3 << 9 | d3 >>> 23) + a3 | 0; - c3 += (d3 & b3 | a3 & ~b3) + k3[11] + 643717713 | 0; - c3 = (c3 << 14 | c3 >>> 18) + d3 | 0; - b3 += (c3 & a3 | d3 & ~a3) + k3[0] - 373897302 | 0; - b3 = (b3 << 20 | b3 >>> 12) + c3 | 0; - a3 += (b3 & d3 | c3 & ~d3) + k3[5] - 701558691 | 0; - a3 = (a3 << 5 | a3 >>> 27) + b3 | 0; - d3 += (a3 & c3 | b3 & ~c3) + k3[10] + 38016083 | 0; - d3 = (d3 << 9 | d3 >>> 23) + a3 | 0; - c3 += (d3 & b3 | a3 & ~b3) + k3[15] - 660478335 | 0; - c3 = (c3 << 14 | c3 >>> 18) + d3 | 0; - b3 += (c3 & a3 | d3 & ~a3) + k3[4] - 405537848 | 0; - b3 = (b3 << 20 | b3 >>> 12) + c3 | 0; - a3 += (b3 & d3 | c3 & ~d3) + k3[9] + 568446438 | 0; - a3 = (a3 << 5 | a3 >>> 27) + b3 | 0; - d3 += (a3 & c3 | b3 & ~c3) + k3[14] - 1019803690 | 0; - d3 = (d3 << 9 | d3 >>> 23) + a3 | 0; - c3 += (d3 & b3 | a3 & ~b3) + k3[3] - 187363961 | 0; - c3 = (c3 << 14 | c3 >>> 18) + d3 | 0; - b3 += (c3 & a3 | d3 & ~a3) + k3[8] + 1163531501 | 0; - b3 = (b3 << 20 | b3 >>> 12) + c3 | 0; - a3 += (b3 & d3 | c3 & ~d3) + k3[13] - 1444681467 | 0; - a3 = (a3 << 5 | a3 >>> 27) + b3 | 0; - d3 += (a3 & c3 | b3 & ~c3) + k3[2] - 51403784 | 0; - d3 = (d3 << 9 | d3 >>> 23) + a3 | 0; - c3 += (d3 & b3 | a3 & ~b3) + k3[7] + 1735328473 | 0; - c3 = (c3 << 14 | c3 >>> 18) + d3 | 0; - b3 += (c3 & a3 | d3 & ~a3) + k3[12] - 1926607734 | 0; - b3 = (b3 << 20 | b3 >>> 12) + c3 | 0; - a3 += (b3 ^ c3 ^ d3) + k3[5] - 378558 | 0; - a3 = (a3 << 4 | a3 >>> 28) + b3 | 0; - d3 += (a3 ^ b3 ^ c3) + k3[8] - 2022574463 | 0; - d3 = (d3 << 11 | d3 >>> 21) + a3 | 0; - c3 += (d3 ^ a3 ^ b3) + k3[11] + 1839030562 | 0; - c3 = (c3 << 16 | c3 >>> 16) + d3 | 0; - b3 += (c3 ^ d3 ^ a3) + k3[14] - 35309556 | 0; - b3 = (b3 << 23 | b3 >>> 9) + c3 | 0; - a3 += (b3 ^ c3 ^ d3) + k3[1] - 1530992060 | 0; - a3 = (a3 << 4 | a3 >>> 28) + b3 | 0; - d3 += (a3 ^ b3 ^ c3) + k3[4] + 1272893353 | 0; - d3 = (d3 << 11 | d3 >>> 21) + a3 | 0; - c3 += (d3 ^ a3 ^ b3) + k3[7] - 155497632 | 0; - c3 = (c3 << 16 | c3 >>> 16) + d3 | 0; - b3 += (c3 ^ d3 ^ a3) + k3[10] - 1094730640 | 0; - b3 = (b3 << 23 | b3 >>> 9) + c3 | 0; - a3 += (b3 ^ c3 ^ d3) + k3[13] + 681279174 | 0; - a3 = (a3 << 4 | a3 >>> 28) + b3 | 0; - d3 += (a3 ^ b3 ^ c3) + k3[0] - 358537222 | 0; - d3 = (d3 << 11 | d3 >>> 21) + a3 | 0; - c3 += (d3 ^ a3 ^ b3) + k3[3] - 722521979 | 0; - c3 = (c3 << 16 | c3 >>> 16) + d3 | 0; - b3 += (c3 ^ d3 ^ a3) + k3[6] + 76029189 | 0; - b3 = (b3 << 23 | b3 >>> 9) + c3 | 0; - a3 += (b3 ^ c3 ^ d3) + k3[9] - 640364487 | 0; - a3 = (a3 << 4 | a3 >>> 28) + b3 | 0; - d3 += (a3 ^ b3 ^ c3) + k3[12] - 421815835 | 0; - d3 = (d3 << 11 | d3 >>> 21) + a3 | 0; - c3 += (d3 ^ a3 ^ b3) + k3[15] + 530742520 | 0; - c3 = (c3 << 16 | c3 >>> 16) + d3 | 0; - b3 += (c3 ^ d3 ^ a3) + k3[2] - 995338651 | 0; - b3 = (b3 << 23 | b3 >>> 9) + c3 | 0; - a3 += (c3 ^ (b3 | ~d3)) + k3[0] - 198630844 | 0; - a3 = (a3 << 6 | a3 >>> 26) + b3 | 0; - d3 += (b3 ^ (a3 | ~c3)) + k3[7] + 1126891415 | 0; - d3 = (d3 << 10 | d3 >>> 22) + a3 | 0; - c3 += (a3 ^ (d3 | ~b3)) + k3[14] - 1416354905 | 0; - c3 = (c3 << 15 | c3 >>> 17) + d3 | 0; - b3 += (d3 ^ (c3 | ~a3)) + k3[5] - 57434055 | 0; - b3 = (b3 << 21 | b3 >>> 11) + c3 | 0; - a3 += (c3 ^ (b3 | ~d3)) + k3[12] + 1700485571 | 0; - a3 = (a3 << 6 | a3 >>> 26) + b3 | 0; - d3 += (b3 ^ (a3 | ~c3)) + k3[3] - 1894986606 | 0; - d3 = (d3 << 10 | d3 >>> 22) + a3 | 0; - c3 += (a3 ^ (d3 | ~b3)) + k3[10] - 1051523 | 0; - c3 = (c3 << 15 | c3 >>> 17) + d3 | 0; - b3 += (d3 ^ (c3 | ~a3)) + k3[1] - 2054922799 | 0; - b3 = (b3 << 21 | b3 >>> 11) + c3 | 0; - a3 += (c3 ^ (b3 | ~d3)) + k3[8] + 1873313359 | 0; - a3 = (a3 << 6 | a3 >>> 26) + b3 | 0; - d3 += (b3 ^ (a3 | ~c3)) + k3[15] - 30611744 | 0; - d3 = (d3 << 10 | d3 >>> 22) + a3 | 0; - c3 += (a3 ^ (d3 | ~b3)) + k3[6] - 1560198380 | 0; - c3 = (c3 << 15 | c3 >>> 17) + d3 | 0; - b3 += (d3 ^ (c3 | ~a3)) + k3[13] + 1309151649 | 0; - b3 = (b3 << 21 | b3 >>> 11) + c3 | 0; - a3 += (c3 ^ (b3 | ~d3)) + k3[4] - 145523070 | 0; - a3 = (a3 << 6 | a3 >>> 26) + b3 | 0; - d3 += (b3 ^ (a3 | ~c3)) + k3[11] - 1120210379 | 0; - d3 = (d3 << 10 | d3 >>> 22) + a3 | 0; - c3 += (a3 ^ (d3 | ~b3)) + k3[2] + 718787259 | 0; - c3 = (c3 << 15 | c3 >>> 17) + d3 | 0; - b3 += (d3 ^ (c3 | ~a3)) + k3[9] - 343485551 | 0; - b3 = (b3 << 21 | b3 >>> 11) + c3 | 0; - x3[0] = a3 + x3[0] | 0; - x3[1] = b3 + x3[1] | 0; - x3[2] = c3 + x3[2] | 0; - x3[3] = d3 + x3[3] | 0; - } - function md5blk(s3) { - var md5blks = [], i3; - for (i3 = 0; i3 < 64; i3 += 4) { - md5blks[i3 >> 2] = s3.charCodeAt(i3) + (s3.charCodeAt(i3 + 1) << 8) + (s3.charCodeAt(i3 + 2) << 16) + (s3.charCodeAt(i3 + 3) << 24); - } - return md5blks; - } - function md5blk_array(a3) { - var md5blks = [], i3; - for (i3 = 0; i3 < 64; i3 += 4) { - md5blks[i3 >> 2] = a3[i3] + (a3[i3 + 1] << 8) + (a3[i3 + 2] << 16) + (a3[i3 + 3] << 24); - } - return md5blks; - } - function md51(s3) { - var n3 = s3.length, state = [1732584193, -271733879, -1732584194, 271733878], i3, length, tail, tmp, lo, hi; - for (i3 = 64; i3 <= n3; i3 += 64) { - md5cycle(state, md5blk(s3.substring(i3 - 64, i3))); - } - s3 = s3.substring(i3 - 64); - length = s3.length; - tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - for (i3 = 0; i3 < length; i3 += 1) { - tail[i3 >> 2] |= s3.charCodeAt(i3) << (i3 % 4 << 3); - } - tail[i3 >> 2] |= 128 << (i3 % 4 << 3); - if (i3 > 55) { - md5cycle(state, tail); - for (i3 = 0; i3 < 16; i3 += 1) { - tail[i3] = 0; - } - } - tmp = n3 * 8; - tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); - lo = parseInt(tmp[2], 16); - hi = parseInt(tmp[1], 16) || 0; - tail[14] = lo; - tail[15] = hi; - md5cycle(state, tail); - return state; - } - function md51_array(a3) { - var n3 = a3.length, state = [1732584193, -271733879, -1732584194, 271733878], i3, length, tail, tmp, lo, hi; - for (i3 = 64; i3 <= n3; i3 += 64) { - md5cycle(state, md5blk_array(a3.subarray(i3 - 64, i3))); - } - a3 = i3 - 64 < n3 ? a3.subarray(i3 - 64) : new Uint8Array(0); - length = a3.length; - tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - for (i3 = 0; i3 < length; i3 += 1) { - tail[i3 >> 2] |= a3[i3] << (i3 % 4 << 3); - } - tail[i3 >> 2] |= 128 << (i3 % 4 << 3); - if (i3 > 55) { - md5cycle(state, tail); - for (i3 = 0; i3 < 16; i3 += 1) { - tail[i3] = 0; - } - } - tmp = n3 * 8; - tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); - lo = parseInt(tmp[2], 16); - hi = parseInt(tmp[1], 16) || 0; - tail[14] = lo; - tail[15] = hi; - md5cycle(state, tail); - return state; - } - function rhex(n3) { - var s3 = "", j3; - for (j3 = 0; j3 < 4; j3 += 1) { - s3 += hex_chr[n3 >> j3 * 8 + 4 & 15] + hex_chr[n3 >> j3 * 8 & 15]; - } - return s3; - } - function hex(x3) { - var i3; - for (i3 = 0; i3 < x3.length; i3 += 1) { - x3[i3] = rhex(x3[i3]); - } - return x3.join(""); - } - if (hex(md51("hello")) !== "5d41402abc4b2a76b9719d911017c592") - ; - if (typeof ArrayBuffer !== "undefined" && !ArrayBuffer.prototype.slice) { - (function() { - function clamp2(val, length) { - val = val | 0 || 0; - if (val < 0) { - return Math.max(val + length, 0); - } - return Math.min(val, length); - } - ArrayBuffer.prototype.slice = function(from, to) { - var length = this.byteLength, begin = clamp2(from, length), end2 = length, num, target, targetArray, sourceArray; - if (to !== undefined$1) { - end2 = clamp2(to, length); - } - if (begin > end2) { - return new ArrayBuffer(0); - } - num = end2 - begin; - target = new ArrayBuffer(num); - targetArray = new Uint8Array(target); - sourceArray = new Uint8Array(this, begin, num); - targetArray.set(sourceArray); - return target; - }; - })(); - } - function toUtf8(str) { - if (/[\u0080-\uFFFF]/.test(str)) { - str = unescape(encodeURIComponent(str)); - } - return str; - } - function utf8Str2ArrayBuffer(str, returnUInt8Array) { - var length = str.length, buff = new ArrayBuffer(length), arr = new Uint8Array(buff), i3; - for (i3 = 0; i3 < length; i3 += 1) { - arr[i3] = str.charCodeAt(i3); - } - return returnUInt8Array ? arr : buff; - } - function arrayBuffer2Utf8Str(buff) { - return String.fromCharCode.apply(null, new Uint8Array(buff)); - } - function concatenateArrayBuffers(first, second, returnUInt8Array) { - var result = new Uint8Array(first.byteLength + second.byteLength); - result.set(new Uint8Array(first)); - result.set(new Uint8Array(second), first.byteLength); - return returnUInt8Array ? result : result.buffer; - } - function hexToBinaryString(hex2) { - var bytes = [], length = hex2.length, x3; - for (x3 = 0; x3 < length - 1; x3 += 2) { - bytes.push(parseInt(hex2.substr(x3, 2), 16)); - } - return String.fromCharCode.apply(String, bytes); - } - function SparkMD52() { - this.reset(); - } - SparkMD52.prototype.append = function(str) { - this.appendBinary(toUtf8(str)); - return this; - }; - SparkMD52.prototype.appendBinary = function(contents) { - this._buff += contents; - this._length += contents.length; - var length = this._buff.length, i3; - for (i3 = 64; i3 <= length; i3 += 64) { - md5cycle(this._hash, md5blk(this._buff.substring(i3 - 64, i3))); - } - this._buff = this._buff.substring(i3 - 64); - return this; - }; - SparkMD52.prototype.end = function(raw2) { - var buff = this._buff, length = buff.length, i3, tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ret; - for (i3 = 0; i3 < length; i3 += 1) { - tail[i3 >> 2] |= buff.charCodeAt(i3) << (i3 % 4 << 3); - } - this._finish(tail, length); - ret = hex(this._hash); - if (raw2) { - ret = hexToBinaryString(ret); - } - this.reset(); - return ret; - }; - SparkMD52.prototype.reset = function() { - this._buff = ""; - this._length = 0; - this._hash = [1732584193, -271733879, -1732584194, 271733878]; - return this; - }; - SparkMD52.prototype.getState = function() { - return { - buff: this._buff, - length: this._length, - hash: this._hash.slice() - }; - }; - SparkMD52.prototype.setState = function(state) { - this._buff = state.buff; - this._length = state.length; - this._hash = state.hash; - return this; - }; - SparkMD52.prototype.destroy = function() { - delete this._hash; - delete this._buff; - delete this._length; - }; - SparkMD52.prototype._finish = function(tail, length) { - var i3 = length, tmp, lo, hi; - tail[i3 >> 2] |= 128 << (i3 % 4 << 3); - if (i3 > 55) { - md5cycle(this._hash, tail); - for (i3 = 0; i3 < 16; i3 += 1) { - tail[i3] = 0; - } - } - tmp = this._length * 8; - tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); - lo = parseInt(tmp[2], 16); - hi = parseInt(tmp[1], 16) || 0; - tail[14] = lo; - tail[15] = hi; - md5cycle(this._hash, tail); - }; - SparkMD52.hash = function(str, raw2) { - return SparkMD52.hashBinary(toUtf8(str), raw2); - }; - SparkMD52.hashBinary = function(content2, raw2) { - var hash3 = md51(content2), ret = hex(hash3); - return raw2 ? hexToBinaryString(ret) : ret; - }; - SparkMD52.ArrayBuffer = function() { - this.reset(); - }; - SparkMD52.ArrayBuffer.prototype.append = function(arr) { - var buff = concatenateArrayBuffers(this._buff.buffer, arr, true), length = buff.length, i3; - this._length += arr.byteLength; - for (i3 = 64; i3 <= length; i3 += 64) { - md5cycle(this._hash, md5blk_array(buff.subarray(i3 - 64, i3))); - } - this._buff = i3 - 64 < length ? new Uint8Array(buff.buffer.slice(i3 - 64)) : new Uint8Array(0); - return this; - }; - SparkMD52.ArrayBuffer.prototype.end = function(raw2) { - var buff = this._buff, length = buff.length, tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], i3, ret; - for (i3 = 0; i3 < length; i3 += 1) { - tail[i3 >> 2] |= buff[i3] << (i3 % 4 << 3); - } - this._finish(tail, length); - ret = hex(this._hash); - if (raw2) { - ret = hexToBinaryString(ret); - } - this.reset(); - return ret; - }; - SparkMD52.ArrayBuffer.prototype.reset = function() { - this._buff = new Uint8Array(0); - this._length = 0; - this._hash = [1732584193, -271733879, -1732584194, 271733878]; - return this; - }; - SparkMD52.ArrayBuffer.prototype.getState = function() { - var state = SparkMD52.prototype.getState.call(this); - state.buff = arrayBuffer2Utf8Str(state.buff); - return state; - }; - SparkMD52.ArrayBuffer.prototype.setState = function(state) { - state.buff = utf8Str2ArrayBuffer(state.buff, true); - return SparkMD52.prototype.setState.call(this, state); - }; - SparkMD52.ArrayBuffer.prototype.destroy = SparkMD52.prototype.destroy; - SparkMD52.ArrayBuffer.prototype._finish = SparkMD52.prototype._finish; - SparkMD52.ArrayBuffer.hash = function(arr, raw2) { - var hash3 = md51_array(new Uint8Array(arr)), ret = hex(hash3); - return raw2 ? hexToBinaryString(ret) : ret; - }; - return SparkMD52; - }); - })(sparkMd5); - var SparkMD5 = sparkMd5.exports; - var fileSlice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice; - var FileChecksum = class { - static create(file, callback) { - const instance = new FileChecksum(file); - instance.create(callback); - } - constructor(file) { - this.file = file; - this.chunkSize = 2097152; - this.chunkCount = Math.ceil(this.file.size / this.chunkSize); - this.chunkIndex = 0; - } - create(callback) { - this.callback = callback; - this.md5Buffer = new SparkMD5.ArrayBuffer(); - this.fileReader = new FileReader(); - this.fileReader.addEventListener("load", (event) => this.fileReaderDidLoad(event)); - this.fileReader.addEventListener("error", (event) => this.fileReaderDidError(event)); - this.readNextChunk(); - } - fileReaderDidLoad(event) { - this.md5Buffer.append(event.target.result); - if (!this.readNextChunk()) { - const binaryDigest = this.md5Buffer.end(true); - const base64digest = btoa(binaryDigest); - this.callback(null, base64digest); - } - } - fileReaderDidError(event) { - this.callback(`Error reading ${this.file.name}`); - } - readNextChunk() { - if (this.chunkIndex < this.chunkCount || this.chunkIndex == 0 && this.chunkCount == 0) { - const start5 = this.chunkIndex * this.chunkSize; - const end2 = Math.min(start5 + this.chunkSize, this.file.size); - const bytes = fileSlice.call(this.file, start5, end2); - this.fileReader.readAsArrayBuffer(bytes); - this.chunkIndex++; - return true; - } else { - return false; - } - } - }; - function getMetaValue(name) { - const element = findElement(document.head, `meta[name="${name}"]`); - if (element) { - return element.getAttribute("content"); - } - } - function findElements(root, selector) { - if (typeof root == "string") { - selector = root; - root = document; - } - const elements = root.querySelectorAll(selector); - return toArray(elements); - } - function findElement(root, selector) { - if (typeof root == "string") { - selector = root; - root = document; - } - return root.querySelector(selector); - } - function dispatchEvent2(element, type, eventInit = {}) { - const { disabled } = element; - const { bubbles, cancelable, detail } = eventInit; - const event = document.createEvent("Event"); - event.initEvent(type, bubbles || true, cancelable || true); - event.detail = detail || {}; - try { - element.disabled = false; - element.dispatchEvent(event); - } finally { - element.disabled = disabled; - } - return event; - } - function toArray(value) { - if (Array.isArray(value)) { - return value; - } else if (Array.from) { - return Array.from(value); - } else { - return [].slice.call(value); - } - } - var BlobRecord = class { - constructor(file, checksum, url) { - this.file = file; - this.attributes = { - filename: file.name, - content_type: file.type || "application/octet-stream", - byte_size: file.size, - checksum - }; - this.xhr = new XMLHttpRequest(); - this.xhr.open("POST", url, true); - this.xhr.responseType = "json"; - this.xhr.setRequestHeader("Content-Type", "application/json"); - this.xhr.setRequestHeader("Accept", "application/json"); - this.xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); - const csrfToken = getMetaValue("csrf-token"); - if (csrfToken != void 0) { - this.xhr.setRequestHeader("X-CSRF-Token", csrfToken); - } - this.xhr.addEventListener("load", (event) => this.requestDidLoad(event)); - this.xhr.addEventListener("error", (event) => this.requestDidError(event)); - } - get status() { - return this.xhr.status; - } - get response() { - const { responseType, response } = this.xhr; - if (responseType == "json") { - return response; - } else { - return JSON.parse(response); - } - } - create(callback) { - this.callback = callback; - this.xhr.send(JSON.stringify({ - blob: this.attributes - })); - } - requestDidLoad(event) { - if (this.status >= 200 && this.status < 300) { - const { response } = this; - const { direct_upload } = response; - delete response.direct_upload; - this.attributes = response; - this.directUploadData = direct_upload; - this.callback(null, this.toJSON()); - } else { - this.requestDidError(event); - } - } - requestDidError(event) { - this.callback(`Error creating Blob for "${this.file.name}". Status: ${this.status}`); - } - toJSON() { - const result = {}; - for (const key in this.attributes) { - result[key] = this.attributes[key]; - } - return result; - } - }; - var BlobUpload = class { - constructor(blob) { - this.blob = blob; - this.file = blob.file; - const { url, headers } = blob.directUploadData; - this.xhr = new XMLHttpRequest(); - this.xhr.open("PUT", url, true); - this.xhr.responseType = "text"; - for (const key in headers) { - this.xhr.setRequestHeader(key, headers[key]); - } - this.xhr.addEventListener("load", (event) => this.requestDidLoad(event)); - this.xhr.addEventListener("error", (event) => this.requestDidError(event)); - } - create(callback) { - this.callback = callback; - this.xhr.send(this.file.slice()); - } - requestDidLoad(event) { - const { status, response } = this.xhr; - if (status >= 200 && status < 300) { - this.callback(null, response); - } else { - this.requestDidError(event); - } - } - requestDidError(event) { - this.callback(`Error storing "${this.file.name}". Status: ${this.xhr.status}`); - } - }; - var id = 0; - var DirectUpload = class { - constructor(file, url, delegate) { - this.id = ++id; - this.file = file; - this.url = url; - this.delegate = delegate; - } - create(callback) { - FileChecksum.create(this.file, (error2, checksum) => { - if (error2) { - callback(error2); - return; - } - const blob = new BlobRecord(this.file, checksum, this.url); - notify(this.delegate, "directUploadWillCreateBlobWithXHR", blob.xhr); - blob.create((error3) => { - if (error3) { - callback(error3); - } else { - const upload = new BlobUpload(blob); - notify(this.delegate, "directUploadWillStoreFileWithXHR", upload.xhr); - upload.create((error4) => { - if (error4) { - callback(error4); - } else { - callback(null, blob.toJSON()); - } - }); - } - }); - }); - } - }; - function notify(object, methodName, ...messages) { - if (object && typeof object[methodName] == "function") { - return object[methodName](...messages); - } - } - var DirectUploadController = class { - constructor(input, file) { - this.input = input; - this.file = file; - this.directUpload = new DirectUpload(this.file, this.url, this); - this.dispatch("initialize"); - } - start(callback) { - const hiddenInput = document.createElement("input"); - hiddenInput.type = "hidden"; - hiddenInput.name = this.input.name; - this.input.insertAdjacentElement("beforebegin", hiddenInput); - this.dispatch("start"); - this.directUpload.create((error2, attributes) => { - if (error2) { - hiddenInput.parentNode.removeChild(hiddenInput); - this.dispatchError(error2); - } else { - hiddenInput.value = attributes.signed_id; - } - this.dispatch("end"); - callback(error2); - }); - } - uploadRequestDidProgress(event) { - const progress = event.loaded / event.total * 100; - if (progress) { - this.dispatch("progress", { - progress - }); - } - } - get url() { - return this.input.getAttribute("data-direct-upload-url"); - } - dispatch(name, detail = {}) { - detail.file = this.file; - detail.id = this.directUpload.id; - return dispatchEvent2(this.input, `direct-upload:${name}`, { - detail - }); - } - dispatchError(error2) { - const event = this.dispatch("error", { - error: error2 - }); - if (!event.defaultPrevented) { - alert(error2); - } - } - directUploadWillCreateBlobWithXHR(xhr) { - this.dispatch("before-blob-request", { - xhr - }); - } - directUploadWillStoreFileWithXHR(xhr) { - this.dispatch("before-storage-request", { - xhr - }); - xhr.upload.addEventListener("progress", (event) => this.uploadRequestDidProgress(event)); - } - }; - var inputSelector = "input[type=file][data-direct-upload-url]:not([disabled])"; - var DirectUploadsController = class { - constructor(form) { - this.form = form; - this.inputs = findElements(form, inputSelector).filter((input) => input.files.length); - } - start(callback) { - const controllers = this.createDirectUploadControllers(); - const startNextController = () => { - const controller = controllers.shift(); - if (controller) { - controller.start((error2) => { - if (error2) { - callback(error2); - this.dispatch("end"); - } else { - startNextController(); - } - }); - } else { - callback(); - this.dispatch("end"); - } - }; - this.dispatch("start"); - startNextController(); - } - createDirectUploadControllers() { - const controllers = []; - this.inputs.forEach((input) => { - toArray(input.files).forEach((file) => { - const controller = new DirectUploadController(input, file); - controllers.push(controller); - }); - }); - return controllers; - } - dispatch(name, detail = {}) { - return dispatchEvent2(this.form, `direct-uploads:${name}`, { - detail - }); - } - }; - var processingAttribute = "data-direct-uploads-processing"; - var submitButtonsByForm = /* @__PURE__ */ new WeakMap(); - var started = false; - function start2() { - if (!started) { - started = true; - document.addEventListener("click", didClick, true); - document.addEventListener("submit", didSubmitForm, true); - document.addEventListener("ajax:before", didSubmitRemoteElement); - } - } - function didClick(event) { - const { target } = event; - if ((target.tagName == "INPUT" || target.tagName == "BUTTON") && target.type == "submit" && target.form) { - submitButtonsByForm.set(target.form, target); - } - } - function didSubmitForm(event) { - handleFormSubmissionEvent(event); - } - function didSubmitRemoteElement(event) { - if (event.target.tagName == "FORM") { - handleFormSubmissionEvent(event); - } - } - function handleFormSubmissionEvent(event) { - const form = event.target; - if (form.hasAttribute(processingAttribute)) { - event.preventDefault(); - return; - } - const controller = new DirectUploadsController(form); - const { inputs } = controller; - if (inputs.length) { - event.preventDefault(); - form.setAttribute(processingAttribute, ""); - inputs.forEach(disable); - controller.start((error2) => { - form.removeAttribute(processingAttribute); - if (error2) { - inputs.forEach(enable); - } else { - submitForm(form); - } - }); - } - } - function submitForm(form) { - let button = submitButtonsByForm.get(form) || findElement(form, "input[type=submit], button[type=submit]"); - if (button) { - const { disabled } = button; - button.disabled = false; - button.focus(); - button.click(); - button.disabled = disabled; - } else { - button = document.createElement("input"); - button.type = "submit"; - button.style.display = "none"; - form.appendChild(button); - button.click(); - form.removeChild(button); - } - submitButtonsByForm.delete(form); - } - function disable(input) { - input.disabled = true; - } - function enable(input) { - input.disabled = false; - } - function autostart() { - if (window.ActiveStorage) { - start2(); - } - } - setTimeout(autostart, 1); - // ../../../node_modules/alpinejs/dist/module.esm.js var flushPending = false; var flushing = false; var queue = []; var lastFlushedIndex = -1; @@ -21458,14 +16041,14 @@ throw error2; }, 0); } var shouldAutoEvaluateFunctions = true; function dontAutoEvaluateFunctions(callback) { - let cache2 = shouldAutoEvaluateFunctions; + let cache = shouldAutoEvaluateFunctions; shouldAutoEvaluateFunctions = false; callback(); - shouldAutoEvaluateFunctions = cache2; + shouldAutoEvaluateFunctions = cache; } function evaluate(el, expression, extras = {}) { let result; evaluateLater(el, expression)((value) => result = value, extras); return result; @@ -21702,56 +16285,56 @@ function byPriority(a3, b3) { let typeA = directiveOrder.indexOf(a3.type) === -1 ? DEFAULT : a3.type; let typeB = directiveOrder.indexOf(b3.type) === -1 ? DEFAULT : b3.type; return directiveOrder.indexOf(typeA) - directiveOrder.indexOf(typeB); } - function dispatch3(el, name, detail = {}) { + function dispatch(el, name, detail = {}) { el.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true, cancelable: true })); } - function walk2(el, callback) { + function walk(el, callback) { if (typeof ShadowRoot === "function" && el instanceof ShadowRoot) { - Array.from(el.children).forEach((el2) => walk2(el2, callback)); + Array.from(el.children).forEach((el2) => walk(el2, callback)); return; } let skip = false; callback(el, () => skip = true); if (skip) return; let node = el.firstElementChild; while (node) { - walk2(node, callback, false); + walk(node, callback, false); node = node.nextElementSibling; } } function warn(message2, ...args) { console.warn(`Alpine Warning: ${message2}`, ...args); } - var started2 = false; - function start3() { - if (started2) + var started = false; + function start() { + if (started) warn("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."); - started2 = true; + started = true; if (!document.body) warn("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"); - dispatch3(document, "alpine:init"); - dispatch3(document, "alpine:initializing"); + dispatch(document, "alpine:init"); + dispatch(document, "alpine:initializing"); startObservingMutations(); - onElAdded((el) => initTree(el, walk2)); + onElAdded((el) => initTree(el, walk)); onElRemoved((el) => destroyTree(el)); onAttributesAdded((el, attrs) => { directives(el, attrs).forEach((handle) => handle()); }); let outNestedComponents = (el) => !closestRoot(el.parentElement, true); Array.from(document.querySelectorAll(allSelectors())).filter(outNestedComponents).forEach((el) => { initTree(el); }); - dispatch3(document, "alpine:initialized"); + dispatch(document, "alpine:initialized"); } var rootSelectorCallbacks = []; var initSelectorCallbacks = []; function rootSelectors() { return rootSelectorCallbacks.map((fn3) => fn3()); @@ -21788,11 +16371,11 @@ } var initInterceptors2 = []; function interceptInit(callback) { initInterceptors2.push(callback); } - function initTree(el, walker = walk2, intercept = () => { + function initTree(el, walker = walk, intercept = () => { }) { deferHandlingDirectives(() => { walker(el, (el2, skip) => { intercept(el2, skip); initInterceptors2.forEach((i3) => i3(el2, skip)); @@ -21800,11 +16383,11 @@ el2._x_ignore && skip(); }); }); } function destroyTree(root) { - walk2(root, (el) => cleanupAttributes(el)); + walk(root, (el) => cleanupAttributes(el)); } var tickStack = []; var isHolding = false; function nextTick(callback = () => { }) { @@ -21896,14 +16479,14 @@ return () => { setStyles(el, previousStyles); }; } function setStylesFromString(el, value) { - let cache2 = el.getAttribute("style", value); + let cache = el.getAttribute("style", value); el.setAttribute("style", value); return () => { - el.setAttribute("style", cache2 || ""); + el.setAttribute("style", cache || ""); }; } function kebabCase(subject) { return subject.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(); } @@ -22212,29 +16795,29 @@ isCloning = false; } function cloneTree(el) { let hasRunThroughFirstEl = false; let shallowWalker = (el2, callback) => { - walk2(el2, (el3, skip) => { + walk(el2, (el3, skip) => { if (hasRunThroughFirstEl && isRoot(el3)) return skip(); hasRunThroughFirstEl = true; callback(el3, skip); }); }; initTree(el, shallowWalker); } function dontRegisterReactiveSideEffects(callback) { - let cache2 = effect; + let cache = effect; overrideEffect((callback2, el) => { - let storedEffect = cache2(callback2); + let storedEffect = cache(callback2); release(storedEffect); return () => { }; }); callback(); - overrideEffect(cache2); + overrideEffect(cache); } function bind(el, name, value, modifiers = []) { if (!el._x_bindings) el._x_bindings = reactive({}); el._x_bindings[name] = value; @@ -22531,15 +17114,15 @@ prefixed: prefix, prefix: setPrefix, plugin, magic, store, - start: start3, + start, clone, bound: getBinding, $data: scope, - walk: walk2, + walk, data, bind: bind2 }; var alpine_default = Alpine2; function makeMap(str, expectsLowerCase) { @@ -22552,11 +17135,11 @@ } var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; var isBooleanAttr2 = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`); var EMPTY_OBJ = true ? Object.freeze({}) : {}; var EMPTY_ARR = true ? Object.freeze([]) : []; - var extend2 = Object.assign; + var extend = Object.assign; var hasOwnProperty = Object.prototype.hasOwnProperty; var hasOwn = (val, key) => hasOwnProperty.call(val, key); var isArray = Array.isArray; var isMap = (val) => toTypeString(val) === "[object Map]"; var isString = (val) => typeof val === "string"; @@ -22567,14 +17150,14 @@ var toRawType = (value) => { return toTypeString(value).slice(8, -1); }; var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; var cacheStringFunction = (fn3) => { - const cache2 = /* @__PURE__ */ Object.create(null); + const cache = /* @__PURE__ */ Object.create(null); return (str) => { - const hit = cache2[str]; - return hit || (cache2[str] = fn3(str)); + const hit = cache[str]; + return hit || (cache[str] = fn3(str)); }; }; var camelizeRE = /-(\w)/g; var camelize = cacheStringFunction((str) => { return str.replace(camelizeRE, (_3, c3) => c3 ? c3.toUpperCase() : ""); @@ -22890,15 +17473,15 @@ console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target); } return true; } }; - var shallowReactiveHandlers = extend2({}, mutableHandlers, { + var shallowReactiveHandlers = extend({}, mutableHandlers, { get: shallowGet, set: shallowSet }); - var shallowReadonlyHandlers = extend2({}, readonlyHandlers, { + var shallowReadonlyHandlers = extend({}, readonlyHandlers, { get: shallowReadonlyGet }); var toReactive = (value) => isObject(value) ? reactive2(value) : value; var toReadonly = (value) => isObject(value) ? readonly(value) : value; var toShallow = (value) => value; @@ -23195,11 +17778,11 @@ } function isRef(r3) { return Boolean(r3 && r3.__v_isRef === true); } magic("nextTick", () => nextTick); - magic("dispatch", (el) => dispatch3.bind(dispatch3, el)); + magic("dispatch", (el) => dispatch.bind(dispatch, el)); magic("watch", (el, { evaluateLater: evaluateLater2, effect: effect32 }) => (key, callback) => { let evaluate2 = evaluateLater2(key); let firstTime = true; let oldValue; let effectReference = effect32(() => evaluate2((value) => { @@ -23253,12 +17836,12 @@ if (!el._x_ids[name]) el._x_ids[name] = findAndIncrementId(name); } magic("id", (el) => (name, key = null) => { let root = closestIdRoot(el, name); - let id2 = root ? root._x_ids[name] : findAndIncrementId(name); - return key ? `${name}-${id2}-${key}` : `${name}-${id2}`; + let id = root ? root._x_ids[name] : findAndIncrementId(name); + return key ? `${name}-${id}-${key}` : `${name}-${id}`; }); magic("el", (el) => el); warnMissingPluginMagic("Focus", "focus", "focus"); warnMissingPluginMagic("Persist", "persist", "persist"); function warnMissingPluginMagic(name, magicName, slug) { @@ -23954,11 +18537,11 @@ el.after(clone2); initTree(clone2); }); el._x_currentIfEl = clone2; el._x_undoIf = () => { - walk2(clone2, (node) => { + walk(clone2, (node) => { if (!!node._x_effects) { node._x_effects.forEach(dequeueJob); } }); clone2.remove(); @@ -25430,13 +20013,13 @@ })); } function setInert(el) { let undos = []; crawlSiblingsUp(el, (sibling) => { - let cache2 = sibling.hasAttribute("aria-hidden"); + let cache = sibling.hasAttribute("aria-hidden"); sibling.setAttribute("aria-hidden", "true"); - undos.push(() => cache2 || sibling.removeAttribute("aria-hidden")); + undos.push(() => cache || sibling.removeAttribute("aria-hidden")); }); return () => { while (undos.length) undos.pop()(); }; @@ -25646,21 +20229,21 @@ var bottom = "bottom"; var right = "right"; var left = "left"; var auto = "auto"; var basePlacements = [top, bottom, right, left]; - var start4 = "start"; + var start2 = "start"; var end = "end"; var clippingParents = "clippingParents"; var viewport = "viewport"; var popper = "popper"; var reference = "reference"; var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) { - return acc.concat([placement + "-" + start4, placement + "-" + end]); + return acc.concat([placement + "-" + start2, placement + "-" + end]); }, []); var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) { - return acc.concat([placement, placement + "-" + start4, placement + "-" + end]); + return acc.concat([placement, placement + "-" + start2, placement + "-" + end]); }, []); var beforeRead = "beforeRead"; var read = "read"; var afterRead = "afterRead"; var beforeMain = "beforeMain"; @@ -26427,11 +21010,11 @@ } var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null; if (mainAxis != null) { var len = mainAxis === "y" ? "height" : "width"; switch (variation) { - case start4: + case start2: offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2); break; case end: offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2); break; @@ -26543,11 +21126,11 @@ var makeFallbackChecks = true; var firstFittingPlacement = placements2[0]; for (var i3 = 0; i3 < placements2.length; i3++) { var placement = placements2[i3]; var _basePlacement = getBasePlacement(placement); - var isStartVariation = getVariation(placement) === start4; + var isStartVariation = getVariation(placement) === start2; var isVertical = [top, bottom].indexOf(_basePlacement) >= 0; var len = isVertical ? "width" : "height"; var overflow = detectOverflow(state, { placement, boundary, @@ -26774,12 +21357,12 @@ var len = mainAxis === "y" ? "height" : "width"; var offset2 = popperOffsets2[mainAxis]; var min2 = offset2 + overflow[mainSide]; var max2 = offset2 - overflow[altSide]; var additive = tether ? -popperRect[len] / 2 : 0; - var minLen = variation === start4 ? referenceRect[len] : popperRect[len]; - var maxLen = variation === start4 ? -popperRect[len] : -referenceRect[len]; + var minLen = variation === start2 ? referenceRect[len] : popperRect[len]; + var maxLen = variation === start2 ? -popperRect[len] : -referenceRect[len]; var arrowElement = state.elements.arrow; var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : { width: 0, height: 0 }; @@ -26969,19 +21552,19 @@ } function popperGenerator(generatorOptions) { if (generatorOptions === void 0) { generatorOptions = {}; } - var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions2 = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2; + var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2; return function createPopper2(reference2, popper2, options) { if (options === void 0) { - options = defaultOptions2; + options = defaultOptions; } var state = { placement: "bottom", orderedModifiers: [], - options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions2), + options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions), modifiersData: {}, elements: { reference: reference2, popper: popper2 }, @@ -26993,11 +21576,11 @@ var instance = { state, setOptions: function setOptions(setOptionsAction) { var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction; cleanupModifierEffects(); - state.options = Object.assign({}, defaultOptions2, state.options, options2); + state.options = Object.assign({}, defaultOptions, state.options, options2); state.scrollParents = { reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [], popper: listScrollParents(popper2) }; var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers))); @@ -27277,16 +21860,16 @@ if (window.performance) { document.addEventListener("mousemove", onDocumentMouseMove); } } function onDocumentMouseMove() { - var now2 = performance.now(); - if (now2 - lastMouseMoveTime < 20) { + var now = performance.now(); + if (now - lastMouseMoveTime < 20) { currentInput.isTouch = false; document.removeEventListener("mousemove", onDocumentMouseMove); } - lastMouseMoveTime = now2; + lastMouseMoveTime = now; } function onWindowBlur() { var activeElement = document.activeElement; if (isReferenceElement(activeElement)) { var instance = activeElement._tippy; @@ -27614,11 +22197,11 @@ var currentTransitionEndListener; var onFirstUpdate; var listeners = []; var debouncedOnMouseMove = debounce3(onMouseMove, props.interactiveDebounce); var currentTarget; - var id2 = idCounter++; + var id = idCounter++; var popperInstance = null; var plugins = unique(props.plugins); var state = { // Is the instance currently enabled? isEnabled: true, @@ -27631,11 +22214,11 @@ // Has the tippy finished transitioning in? isShown: false }; var instance = { // properties - id: id2, + id, reference: reference2, popper: div(), popperInstance, props, state, @@ -27645,12 +22228,12 @@ setProps, setContent: setContent2, show, hide: hide2, hideWithInteractivity, - enable: enable2, - disable: disable2, + enable, + disable, unmount, destroy }; if (!props.render) { if (true) { @@ -27738,18 +22321,18 @@ var aria = instance.props.aria; if (!aria.content) { return; } var attr = "aria-" + aria.content; - var id3 = popper2.id; + var id2 = popper2.id; var nodes = normalizeToArray(instance.props.triggerTarget || reference2); nodes.forEach(function(node) { var currentValue = node.getAttribute(attr); if (instance.state.isVisible) { - node.setAttribute(attr, currentValue ? currentValue + " " + id3 : id3); + node.setAttribute(attr, currentValue ? currentValue + " " + id2 : id2); } else { - var nextValue = currentValue && currentValue.replace(id3, "").trim(); + var nextValue = currentValue && currentValue.replace(id2, "").trim(); if (nextValue) { node.setAttribute(attr, nextValue); } else { node.removeAttribute(attr); } @@ -28118,14 +22701,14 @@ scheduleHideAnimationFrame = requestAnimationFrame(function() { instance.hide(); }); } } - function enable2() { + function enable() { instance.state.isEnabled = true; } - function disable2() { + function disable() { instance.hide(); instance.state.isEnabled = false; } function clearDelayTimeouts() { clearTimeout(showTimeout); @@ -29158,72 +23741,72 @@ // base/mixins/undo.js function withUndo(props = {}) { function withUndoMixin(component) { const maxHistorySize = props.maxEntries || 100; - const history2 = Alpine.reactive({ + const history = Alpine.reactive({ stack: [], stackPos: -1, adding: false, clear() { - history2.stack.length = 0; - history2.stackPos = -1; + history.stack.length = 0; + history.stackPos = -1; }, add(name, newValue, oldValue) { - if (!history2.adding && newValue !== oldValue) { - if (history2.stackPos < history2.stackSize - 1) { - const stack = Alpine.raw(history2.stack); - history2.stack = stack.slice(0, history2.stackPos + 1); + if (!history.adding && newValue !== oldValue) { + if (history.stackPos < history.stackSize - 1) { + const stack = Alpine.raw(history.stack); + history.stack = stack.slice(0, history.stackPos + 1); } - history2.stack.push({ name, newValue, oldValue }); - if (history2.stackSize > maxHistorySize) { - history2.stack.pop(); + history.stack.push({ name, newValue, oldValue }); + if (history.stackSize > maxHistorySize) { + history.stack.pop(); } else { - history2.stackPos++; + history.stackPos++; } } }, undo() { if (!component.undo) { console.error("Missing `undo` method"); return; } - if (history2.undoable) { - history2.adding = true; - const entry = history2.stack[history2.stackPos]; + if (history.undoable) { + history.adding = true; + const entry = history.stack[history.stackPos]; component.undo(entry.name, entry.oldValue); - history2.stackPos--; - this.$nextTick(() => history2.adding = false); + history.stackPos--; + this.$nextTick(() => history.adding = false); } }, redo() { if (!component.redo) { console.error("Missing `redo` method"); return; } - if (history2.redoable) { - history2.adding = true; - history2.stackPos++; - const entry = history2.stack[history2.stackPos]; + if (history.redoable) { + history.adding = true; + history.stackPos++; + const entry = history.stack[history.stackPos]; component.redo(entry.name, entry.newValue); - this.$nextTick(() => history2.adding = false); + this.$nextTick(() => history.adding = false); } }, get undoable() { - return history2.stackPos >= 0; + return history.stackPos >= 0; }, get redoable() { - return history2.stackPos < history2.stackSize - 1; + return history.stackPos < history.stackSize - 1; }, get stackSize() { - return history2.stack.length; + return history.stack.length; }, get stackMemoryUsage() { - return roughSizeOfObject(history2.stack); + return roughSizeOfObject(history.stack); } }); - return Object.assign(component, { history: history2 }); + return Object.assign(component, { history }); } withUndoMixin.props = ["history"]; return withUndoMixin; } @@ -32118,10 +26701,9 @@ // app/components.js var components_default3 = registerComponents(__default3); // app.js console.info("Initializing Coco JS", package_default.version); - start2(); alpine_default2.start(); })(); /*! Bundled license information: lodash/lodash.js: