From fb3a2ccc9d6d72dbae88a844b2d79c6dd60ea902 Mon Sep 17 00:00:00 2001 From: Erik Torsner Date: Tue, 13 Feb 2024 12:16:14 +0100 Subject: [PATCH] Deploying version 3.2.7 --- README.md | 15 +- assets/css/settings.css | 10 +- assets/css/settings.min.css | 2 +- assets/js/settings.js | 65296 ++++++++-------- assets/js/settings.js.map | 2 +- assets/js/settings.min.js | 2 +- assets/js/settings.min.js.map | 2 +- classes/as3cf-filter.php | 2 +- classes/as3cf-utils.php | 2 +- .../integrations/advanced-custom-fields.php | 85 +- classes/integrations/media-library.php | 117 + classes/items/item.php | 6 +- classes/items/media-library-item.php | 24 + classes/items/upload-handler.php | 21 +- classes/providers/storage/aws-provider.php | 19 +- .../storage/digitalocean-provider.php | 1 + classes/providers/storage/gcp-provider.php | 20 +- .../providers/storage/storage-provider.php | 48 + languages/amazon-s3-and-cloudfront-en.pot | 180 +- readme.txt | 14 +- rollup.config.mjs | 75 + ui/components/BucketSettingsSubPage.svelte | 7 +- ui/components/Footer.svelte | 2 +- ui/components/OffloadStatus.svelte | 4 + ui/components/Panel.svelte | 7 +- ui/components/ProgressBar.svelte | 3 + ui/components/SecuritySubPage.svelte | 4 +- ui/components/SettingsPanelOption.svelte | 5 +- ui/components/UrlPreview.svelte | 2 +- wordpress-s3.php | 4 +- 30 files changed, 33867 insertions(+), 32114 deletions(-) create mode 100644 rollup.config.mjs diff --git a/README.md b/README.md index 1fc9c3b5..cbbd50bc 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ **Requires at least:** 5.5 \ **Tested up to:** 6.4 \ **Requires PHP:** 7.2 \ -**Stable tag:** 3.2.6 \ +**Stable tag:** 3.2.7 \ **License:** GPLv3 Copies files to Amazon S3, DigitalOcean Spaces or Google Cloud Storage as they are uploaded to the Media Library. Optionally configure Amazon CloudFront or another CDN for faster delivery. @@ -103,6 +103,19 @@ This version requires PHP 5.3.3+ and the Amazon Web Services plugin ## Changelog +### WP Offload Media Lite 3.2.7 - 2024-02-13 + +* New: Amazon S3 regions Canada West (Calgary), Asia Pacific (Melbourne) and Israel (Tel Aviv) are now selectable +* New: DigitalOcean region Bangalore (BLR1) is now selectable +* New: Google Cloud Storage regions Europe (Berlin), Europe (Turin), Middle East (Doha) and Middle East (Dammam, Saudi Arabia) are now selectable +* Improvement: The as3cf_object_meta filter now also runs during storage settings validation +* Bug fix: Private media URLs now work as expected in audio and video shortcodes +* Bug fix: Performance improved for ACF image fields when filesize metadata is missing for offloaded and removed files +* Bug fix: URLs for offloaded media in ACF URL and link fields are now properly rewritten +* Bug fix: Media library files with apostrophes in their filenames no longer cause database errors +* Bug fix: URL rewriting no longer breaks slashed serialized data with NULL values +* Bug fix: URL rewriting on a dev site now works without a bucket being set + ### WP Offload Media Lite 3.2.6 - 2024-01-11 * New: WordPress 6.4 compatible diff --git a/assets/css/settings.css b/assets/css/settings.css index 01db4202..4426220c 100644 --- a/assets/css/settings.css +++ b/assets/css/settings.css @@ -1 +1,9 @@ -.nav-status-wrapper.svelte-1i784er{position:relative}.panel-row.svelte-41r5oq.svelte-41r5oq{position:relative}.header.svelte-41r5oq .gradient.svelte-41r5oq{position:absolute;width:144px;left:0;top:0;bottom:0;transform:matrix(-1, 0, 0, 1, 0, 0);border-top-right-radius:5px}.toggler.svelte-k1tgof:not(.toggleDisabled){cursor:pointer}.content.svelte-5j10or.svelte-5j10or{padding:1.875rem 2.25rem 1.5rem 2.25rem;display:flex;flex-direction:column}.heading.svelte-5j10or.svelte-5j10or{margin-top:1rem;font-weight:700;font-size:1.125rem;line-height:140%}.description.svelte-5j10or.svelte-5j10or{margin-top:1rem;color:rgba(56, 54, 55, 0.7)}.benefits.svelte-5j10or.svelte-5j10or{margin-top:1.7rem;color:rgba(56, 54, 55, 0.7)}.benefits.svelte-5j10or li.svelte-5j10or{display:flex;align-items:center}.benefits.svelte-5j10or img.svelte-5j10or{height:40px;margin-left:-5px;margin-right:10px}.call-to-action.svelte-5j10or.svelte-5j10or{margin-top:0.7rem}.call-to-action.svelte-5j10or .note.svelte-5j10or{text-align:center}.notice-icon-wrapper.svelte-jtkdoa{display:inline-block;min-width:1.1875rem}.notice-icon.svelte-jtkdoa{margin-left:2px;margin-top:-1.5px;vertical-align:middle}#as3cf-settings.wpome div.panel.settings .header img.svelte-sglpwv.svelte-sglpwv{width:var(--as3cf-settings-ctrl-width);height:var(--as3cf-settings-ctrl-width)}.provider-details.svelte-sglpwv.svelte-sglpwv{display:flex;flex-direction:column;flex:auto;margin-left:var(--as3cf-settings-option-indent);z-index:1}#as3cf-settings.wpome div.panel .provider-details.svelte-sglpwv h3.svelte-sglpwv{margin-left:0;margin-bottom:0.5rem}#as3cf-settings.wpome div.panel .console-details.svelte-sglpwv.svelte-sglpwv{display:flex;align-items:center;font-size:0.75rem}.console-details.svelte-sglpwv .console.svelte-sglpwv{flex:0 1 min-content;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#as3cf-settings.wpome div.panel .console-details.svelte-sglpwv a[target="_blank"].console.svelte-sglpwv:after{margin-right:0}.toggler.svelte-k1tgof:not(.toggleDisabled){cursor:pointer}#as3cf-settings.wpome div.panel.settings .header img.svelte-cn9mf.svelte-cn9mf{width:var(--as3cf-settings-ctrl-width);height:var(--as3cf-settings-ctrl-width)}.provider-details.svelte-cn9mf.svelte-cn9mf{display:flex;flex-direction:column;flex:auto;margin-left:var(--as3cf-settings-option-indent);z-index:1}#as3cf-settings.wpome div.panel .provider-details.svelte-cn9mf h3.svelte-cn9mf{margin-left:0;margin-bottom:0.5rem}#as3cf-settings.wpome div.panel .console-details.svelte-cn9mf.svelte-cn9mf{display:flex;align-items:center;font-size:0.75rem}.console-details.svelte-cn9mf .console.svelte-cn9mf{flex:0 1 min-content;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#as3cf-settings.wpome div.panel .console-details.svelte-cn9mf a[target="_blank"].console.svelte-cn9mf:after{margin-right:0}#as3cf-settings.wpome div.panel .console-details.svelte-cn9mf .region.svelte-cn9mf{flex:1 0 auto;color:var(--as3cf-color-gray-500);margin:0 0.5rem}div.check-again.svelte-1oue4lo.svelte-1oue4lo{display:flex;flex-direction:column;align-items:flex-end;white-space:nowrap;min-width:6rem;padding-left:0.5rem;color:var(--as3cf-color-gray-700)}#as3cf-settings .check-again.svelte-1oue4lo .last-update.svelte-1oue4lo{padding-right:2px;margin-top:2px} \ No newline at end of file +.notice-icon-wrapper.svelte-jtkdoa{display:inline-block;min-width:1.1875rem}.notice-icon.svelte-jtkdoa{margin-left:2px;margin-top:-1.5px;vertical-align:middle} +.panel-row.svelte-41r5oq.svelte-41r5oq{position:relative}.header.svelte-41r5oq .gradient.svelte-41r5oq{position:absolute;width:144px;left:0;top:0;bottom:0;transform:matrix(-1, 0, 0, 1, 0, 0);border-top-right-radius:5px} +.toggler.svelte-k1tgof:not(.toggleDisabled){cursor:pointer} +#as3cf-settings.wpome div.panel.settings .header img.svelte-cn9mf.svelte-cn9mf{width:var(--as3cf-settings-ctrl-width);height:var(--as3cf-settings-ctrl-width)}.provider-details.svelte-cn9mf.svelte-cn9mf{display:flex;flex-direction:column;flex:auto;margin-left:var(--as3cf-settings-option-indent);z-index:1}#as3cf-settings.wpome div.panel .provider-details.svelte-cn9mf h3.svelte-cn9mf{margin-left:0;margin-bottom:0.5rem}#as3cf-settings.wpome div.panel .console-details.svelte-cn9mf.svelte-cn9mf{display:flex;align-items:center;font-size:0.75rem}.console-details.svelte-cn9mf .console.svelte-cn9mf{flex:0 1 min-content;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#as3cf-settings.wpome div.panel .console-details.svelte-cn9mf a[target="_blank"].console.svelte-cn9mf:after{margin-right:0}#as3cf-settings.wpome div.panel .console-details.svelte-cn9mf .region.svelte-cn9mf{flex:1 0 auto;color:var(--as3cf-color-gray-500);margin:0 0.5rem} +div.check-again.svelte-1oue4lo.svelte-1oue4lo{display:flex;flex-direction:column;align-items:flex-end;white-space:nowrap;min-width:6rem;padding-left:0.5rem;color:var(--as3cf-color-gray-700)}#as3cf-settings .check-again.svelte-1oue4lo .last-update.svelte-1oue4lo{padding-right:2px;margin-top:2px} +.toggler.svelte-k1tgof:not(.toggleDisabled){cursor:pointer} +#as3cf-settings.wpome div.panel.settings .header img.svelte-sglpwv.svelte-sglpwv{width:var(--as3cf-settings-ctrl-width);height:var(--as3cf-settings-ctrl-width)}.provider-details.svelte-sglpwv.svelte-sglpwv{display:flex;flex-direction:column;flex:auto;margin-left:var(--as3cf-settings-option-indent);z-index:1}#as3cf-settings.wpome div.panel .provider-details.svelte-sglpwv h3.svelte-sglpwv{margin-left:0;margin-bottom:0.5rem}#as3cf-settings.wpome div.panel .console-details.svelte-sglpwv.svelte-sglpwv{display:flex;align-items:center;font-size:0.75rem}.console-details.svelte-sglpwv .console.svelte-sglpwv{flex:0 1 min-content;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#as3cf-settings.wpome div.panel .console-details.svelte-sglpwv a[target="_blank"].console.svelte-sglpwv:after{margin-right:0} +.content.svelte-5j10or.svelte-5j10or{padding:1.875rem 2.25rem 1.5rem 2.25rem;display:flex;flex-direction:column}.heading.svelte-5j10or.svelte-5j10or{margin-top:1rem;font-weight:700;font-size:1.125rem;line-height:140%}.description.svelte-5j10or.svelte-5j10or{margin-top:1rem;color:rgba(56, 54, 55, 0.7)}.benefits.svelte-5j10or.svelte-5j10or{margin-top:1.7rem;color:rgba(56, 54, 55, 0.7)}.benefits.svelte-5j10or li.svelte-5j10or{display:flex;align-items:center}.benefits.svelte-5j10or img.svelte-5j10or{height:40px;margin-left:-5px;margin-right:10px}.call-to-action.svelte-5j10or.svelte-5j10or{margin-top:0.7rem}.call-to-action.svelte-5j10or .note.svelte-5j10or{text-align:center} +.nav-status-wrapper.svelte-1i784er{position:relative} diff --git a/assets/css/settings.min.css b/assets/css/settings.min.css index 1bdd1d75..31d5ea6a 100644 --- a/assets/css/settings.min.css +++ b/assets/css/settings.min.css @@ -1 +1 @@ -.nav-status-wrapper.svelte-1i784er{position:relative}.panel-row.svelte-41r5oq.svelte-41r5oq{position:relative}.header.svelte-41r5oq .gradient.svelte-41r5oq{position:absolute;width:144px;left:0;top:0;bottom:0;transform:matrix(-1,0,0,1,0,0);border-top-right-radius:5px}.toggler.svelte-k1tgof:not(.toggleDisabled){cursor:pointer}.content.svelte-5j10or.svelte-5j10or{padding:1.875rem 2.25rem 1.5rem 2.25rem;display:flex;flex-direction:column}.heading.svelte-5j10or.svelte-5j10or{margin-top:1rem;font-weight:700;font-size:1.125rem;line-height:140%}.description.svelte-5j10or.svelte-5j10or{margin-top:1rem;color:rgba(56,54,55,.7)}.benefits.svelte-5j10or.svelte-5j10or{margin-top:1.7rem;color:rgba(56,54,55,.7)}.benefits.svelte-5j10or li.svelte-5j10or{display:flex;align-items:center}.benefits.svelte-5j10or img.svelte-5j10or{height:40px;margin-left:-5px;margin-right:10px}.call-to-action.svelte-5j10or.svelte-5j10or{margin-top:.7rem}.call-to-action.svelte-5j10or .note.svelte-5j10or{text-align:center}.notice-icon-wrapper.svelte-jtkdoa{display:inline-block;min-width:1.1875rem}.notice-icon.svelte-jtkdoa{margin-left:2px;margin-top:-1.5px;vertical-align:middle}#as3cf-settings.wpome div.panel.settings .header img.svelte-sglpwv.svelte-sglpwv{width:var(--as3cf-settings-ctrl-width);height:var(--as3cf-settings-ctrl-width)}.provider-details.svelte-sglpwv.svelte-sglpwv{display:flex;flex-direction:column;flex:auto;margin-left:var(--as3cf-settings-option-indent);z-index:1}#as3cf-settings.wpome div.panel .provider-details.svelte-sglpwv h3.svelte-sglpwv{margin-left:0;margin-bottom:.5rem}#as3cf-settings.wpome div.panel .console-details.svelte-sglpwv.svelte-sglpwv{display:flex;align-items:center;font-size:.75rem}.console-details.svelte-sglpwv .console.svelte-sglpwv{flex:0 1 min-content;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#as3cf-settings.wpome div.panel .console-details.svelte-sglpwv a[target="_blank"].console.svelte-sglpwv:after{margin-right:0}.toggler.svelte-k1tgof:not(.toggleDisabled){cursor:pointer}#as3cf-settings.wpome div.panel.settings .header img.svelte-cn9mf.svelte-cn9mf{width:var(--as3cf-settings-ctrl-width);height:var(--as3cf-settings-ctrl-width)}.provider-details.svelte-cn9mf.svelte-cn9mf{display:flex;flex-direction:column;flex:auto;margin-left:var(--as3cf-settings-option-indent);z-index:1}#as3cf-settings.wpome div.panel .provider-details.svelte-cn9mf h3.svelte-cn9mf{margin-left:0;margin-bottom:.5rem}#as3cf-settings.wpome div.panel .console-details.svelte-cn9mf.svelte-cn9mf{display:flex;align-items:center;font-size:.75rem}.console-details.svelte-cn9mf .console.svelte-cn9mf{flex:0 1 min-content;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#as3cf-settings.wpome div.panel .console-details.svelte-cn9mf a[target="_blank"].console.svelte-cn9mf:after{margin-right:0}#as3cf-settings.wpome div.panel .console-details.svelte-cn9mf .region.svelte-cn9mf{flex:1 0 auto;color:var(--as3cf-color-gray-500);margin:0 .5rem}div.check-again.svelte-1oue4lo.svelte-1oue4lo{display:flex;flex-direction:column;align-items:flex-end;white-space:nowrap;min-width:6rem;padding-left:.5rem;color:var(--as3cf-color-gray-700)}#as3cf-settings .check-again.svelte-1oue4lo .last-update.svelte-1oue4lo{padding-right:2px;margin-top:2px} \ No newline at end of file +.notice-icon-wrapper.svelte-jtkdoa{display:inline-block;min-width:1.1875rem}.notice-icon.svelte-jtkdoa{margin-left:2px;margin-top:-1.5px;vertical-align:middle}.panel-row.svelte-41r5oq.svelte-41r5oq{position:relative}.header.svelte-41r5oq .gradient.svelte-41r5oq{position:absolute;width:144px;left:0;top:0;bottom:0;transform:matrix(-1,0,0,1,0,0);border-top-right-radius:5px}.toggler.svelte-k1tgof:not(.toggleDisabled){cursor:pointer}#as3cf-settings.wpome div.panel.settings .header img.svelte-cn9mf.svelte-cn9mf{width:var(--as3cf-settings-ctrl-width);height:var(--as3cf-settings-ctrl-width)}.provider-details.svelte-cn9mf.svelte-cn9mf{display:flex;flex-direction:column;flex:auto;margin-left:var(--as3cf-settings-option-indent);z-index:1}#as3cf-settings.wpome div.panel .provider-details.svelte-cn9mf h3.svelte-cn9mf{margin-left:0;margin-bottom:.5rem}#as3cf-settings.wpome div.panel .console-details.svelte-cn9mf.svelte-cn9mf{display:flex;align-items:center;font-size:.75rem}.console-details.svelte-cn9mf .console.svelte-cn9mf{flex:0 1 min-content;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#as3cf-settings.wpome div.panel .console-details.svelte-cn9mf a[target="_blank"].console.svelte-cn9mf:after{margin-right:0}#as3cf-settings.wpome div.panel .console-details.svelte-cn9mf .region.svelte-cn9mf{flex:1 0 auto;color:var(--as3cf-color-gray-500);margin:0 .5rem}div.check-again.svelte-1oue4lo.svelte-1oue4lo{display:flex;flex-direction:column;align-items:flex-end;white-space:nowrap;min-width:6rem;padding-left:.5rem;color:var(--as3cf-color-gray-700)}#as3cf-settings .check-again.svelte-1oue4lo .last-update.svelte-1oue4lo{padding-right:2px;margin-top:2px}.toggler.svelte-k1tgof:not(.toggleDisabled){cursor:pointer}#as3cf-settings.wpome div.panel.settings .header img.svelte-sglpwv.svelte-sglpwv{width:var(--as3cf-settings-ctrl-width);height:var(--as3cf-settings-ctrl-width)}.provider-details.svelte-sglpwv.svelte-sglpwv{display:flex;flex-direction:column;flex:auto;margin-left:var(--as3cf-settings-option-indent);z-index:1}#as3cf-settings.wpome div.panel .provider-details.svelte-sglpwv h3.svelte-sglpwv{margin-left:0;margin-bottom:.5rem}#as3cf-settings.wpome div.panel .console-details.svelte-sglpwv.svelte-sglpwv{display:flex;align-items:center;font-size:.75rem}.console-details.svelte-sglpwv .console.svelte-sglpwv{flex:0 1 min-content;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#as3cf-settings.wpome div.panel .console-details.svelte-sglpwv a[target="_blank"].console.svelte-sglpwv:after{margin-right:0}.content.svelte-5j10or.svelte-5j10or{padding:1.875rem 2.25rem 1.5rem 2.25rem;display:flex;flex-direction:column}.heading.svelte-5j10or.svelte-5j10or{margin-top:1rem;font-weight:700;font-size:1.125rem;line-height:140%}.description.svelte-5j10or.svelte-5j10or{margin-top:1rem;color:rgba(56,54,55,.7)}.benefits.svelte-5j10or.svelte-5j10or{margin-top:1.7rem;color:rgba(56,54,55,.7)}.benefits.svelte-5j10or li.svelte-5j10or{display:flex;align-items:center}.benefits.svelte-5j10or img.svelte-5j10or{height:40px;margin-left:-5px;margin-right:10px}.call-to-action.svelte-5j10or.svelte-5j10or{margin-top:.7rem}.call-to-action.svelte-5j10or .note.svelte-5j10or{text-align:center}.nav-status-wrapper.svelte-1i784er{position:relative} \ No newline at end of file diff --git a/assets/js/settings.js b/assets/js/settings.js index 9a388228..a6043c38 100644 --- a/assets/js/settings.js +++ b/assets/js/settings.js @@ -1,31978 +1,33332 @@ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.AS3CF_Settings = factory()); + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.AS3CF_Settings = factory()); })(this, (function () { 'use strict'; - function noop() { } - const identity = x => x; - function assign(tar, src) { - // @ts-ignore - for (const k in src) - tar[k] = src[k]; - return tar; - } - // Adapted from https://github.com/then/is-promise/blob/master/index.js - // Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE - function is_promise(value) { - return !!value && (typeof value === 'object' || typeof value === 'function') && typeof value.then === 'function'; - } - function add_location(element, file, line, column, char) { - element.__svelte_meta = { - loc: { file, line, column, char } - }; - } - function run(fn) { - return fn(); - } - function blank_object() { - return Object.create(null); - } - function run_all(fns) { - fns.forEach(run); - } - function is_function(thing) { - return typeof thing === 'function'; - } - function safe_not_equal(a, b) { - return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function'); - } - let src_url_equal_anchor; - function src_url_equal(element_src, url) { - if (!src_url_equal_anchor) { - src_url_equal_anchor = document.createElement('a'); - } - src_url_equal_anchor.href = url; - return element_src === src_url_equal_anchor.href; - } - function is_empty(obj) { - return Object.keys(obj).length === 0; - } - function validate_store(store, name) { - if (store != null && typeof store.subscribe !== 'function') { - throw new Error(`'${name}' is not a store with a 'subscribe' method`); - } - } - function subscribe(store, ...callbacks) { - if (store == null) { - return noop; - } - const unsub = store.subscribe(...callbacks); - return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub; - } - function get_store_value(store) { - let value; - subscribe(store, _ => value = _)(); - return value; - } - function component_subscribe(component, store, callback) { - component.$$.on_destroy.push(subscribe(store, callback)); - } - function create_slot(definition, ctx, $$scope, fn) { - if (definition) { - const slot_ctx = get_slot_context(definition, ctx, $$scope, fn); - return definition[0](slot_ctx); - } - } - function get_slot_context(definition, ctx, $$scope, fn) { - return definition[1] && fn - ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) - : $$scope.ctx; - } - function get_slot_changes(definition, $$scope, dirty, fn) { - if (definition[2] && fn) { - const lets = definition[2](fn(dirty)); - if ($$scope.dirty === undefined) { - return lets; - } - if (typeof lets === 'object') { - const merged = []; - const len = Math.max($$scope.dirty.length, lets.length); - for (let i = 0; i < len; i += 1) { - merged[i] = $$scope.dirty[i] | lets[i]; - } - return merged; - } - return $$scope.dirty | lets; - } - return $$scope.dirty; - } - function update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) { - if (slot_changes) { - const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn); - slot.p(slot_context, slot_changes); - } - } - function get_all_dirty_from_scope($$scope) { - if ($$scope.ctx.length > 32) { - const dirty = []; - const length = $$scope.ctx.length / 32; - for (let i = 0; i < length; i++) { - dirty[i] = -1; - } - return dirty; - } - return -1; - } - function exclude_internal_props(props) { - const result = {}; - for (const k in props) - if (k[0] !== '$') - result[k] = props[k]; - return result; - } - function set_store_value(store, ret, value) { - store.set(value); - return ret; - } - function action_destroyer(action_result) { - return action_result && is_function(action_result.destroy) ? action_result.destroy : noop; - } - - const is_client = typeof window !== 'undefined'; - let now = is_client - ? () => window.performance.now() - : () => Date.now(); - let raf = is_client ? cb => requestAnimationFrame(cb) : noop; - - const tasks = new Set(); - function run_tasks(now) { - tasks.forEach(task => { - if (!task.c(now)) { - tasks.delete(task); - task.f(); - } - }); - if (tasks.size !== 0) - raf(run_tasks); - } - /** - * Creates a new task that runs on each raf frame - * until it returns a falsy value or is aborted - */ - function loop(callback) { - let task; - if (tasks.size === 0) - raf(run_tasks); - return { - promise: new Promise(fulfill => { - tasks.add(task = { c: callback, f: fulfill }); - }), - abort() { - tasks.delete(task); - } - }; - } - function append(target, node) { - target.appendChild(node); - } - function get_root_for_style(node) { - if (!node) - return document; - const root = node.getRootNode ? node.getRootNode() : node.ownerDocument; - if (root && root.host) { - return root; - } - return node.ownerDocument; - } - function append_empty_stylesheet(node) { - const style_element = element('style'); - append_stylesheet(get_root_for_style(node), style_element); - return style_element.sheet; - } - function append_stylesheet(node, style) { - append(node.head || node, style); - return style.sheet; - } - function insert(target, node, anchor) { - target.insertBefore(node, anchor || null); - } - function detach(node) { - if (node.parentNode) { - node.parentNode.removeChild(node); - } - } - function destroy_each(iterations, detaching) { - for (let i = 0; i < iterations.length; i += 1) { - if (iterations[i]) - iterations[i].d(detaching); - } - } - function element(name) { - return document.createElement(name); - } - function svg_element(name) { - return document.createElementNS('http://www.w3.org/2000/svg', name); - } - function text(data) { - return document.createTextNode(data); - } - function space() { - return text(' '); - } - function empty() { - return text(''); - } - function listen(node, event, handler, options) { - node.addEventListener(event, handler, options); - return () => node.removeEventListener(event, handler, options); - } - function prevent_default(fn) { - return function (event) { - event.preventDefault(); - // @ts-ignore - return fn.call(this, event); - }; - } - function attr(node, attribute, value) { - if (value == null) - node.removeAttribute(attribute); - else if (node.getAttribute(attribute) !== value) - node.setAttribute(attribute, value); - } - function init_binding_group(group) { - let _inputs; - return { - /* push */ p(...inputs) { - _inputs = inputs; - _inputs.forEach(input => group.push(input)); - }, - /* remove */ r() { - _inputs.forEach(input => group.splice(group.indexOf(input), 1)); - } - }; - } - function children(element) { - return Array.from(element.childNodes); - } - function set_input_value(input, value) { - input.value = value == null ? '' : value; - } - function set_style(node, key, value, important) { - if (value === null) { - node.style.removeProperty(key); - } - else { - node.style.setProperty(key, value, important ? 'important' : ''); - } - } - function select_option(select, value, mounting) { - for (let i = 0; i < select.options.length; i += 1) { - const option = select.options[i]; - if (option.__value === value) { - option.selected = true; - return; - } - } - if (!mounting || value !== undefined) { - select.selectedIndex = -1; // no option should be selected - } - } - function select_value(select) { - const selected_option = select.querySelector(':checked'); - return selected_option && selected_option.__value; - } - // unfortunately this can't be a constant as that wouldn't be tree-shakeable - // so we cache the result instead - let crossorigin; - function is_crossorigin() { - if (crossorigin === undefined) { - crossorigin = false; - try { - if (typeof window !== 'undefined' && window.parent) { - void window.parent.document; - } - } - catch (error) { - crossorigin = true; - } - } - return crossorigin; - } - function add_resize_listener(node, fn) { - const computed_style = getComputedStyle(node); - if (computed_style.position === 'static') { - node.style.position = 'relative'; - } - const iframe = element('iframe'); - iframe.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' + - 'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;'); - iframe.setAttribute('aria-hidden', 'true'); - iframe.tabIndex = -1; - const crossorigin = is_crossorigin(); - let unsubscribe; - if (crossorigin) { - iframe.src = "data:text/html,"; - unsubscribe = listen(window, 'message', (event) => { - if (event.source === iframe.contentWindow) - fn(); - }); - } - else { - iframe.src = 'about:blank'; - iframe.onload = () => { - unsubscribe = listen(iframe.contentWindow, 'resize', fn); - // make sure an initial resize event is fired _after_ the iframe is loaded (which is asynchronous) - // see https://github.com/sveltejs/svelte/issues/4233 - fn(); - }; - } - append(node, iframe); - return () => { - if (crossorigin) { - unsubscribe(); - } - else if (unsubscribe && iframe.contentWindow) { - unsubscribe(); - } - detach(iframe); - }; - } - function toggle_class(element, name, toggle) { - element.classList[toggle ? 'add' : 'remove'](name); - } - function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) { - const e = document.createEvent('CustomEvent'); - e.initCustomEvent(type, bubbles, cancelable, detail); - return e; - } - class HtmlTag { - constructor(is_svg = false) { - this.is_svg = false; - this.is_svg = is_svg; - this.e = this.n = null; - } - c(html) { - this.h(html); - } - m(html, target, anchor = null) { - if (!this.e) { - if (this.is_svg) - this.e = svg_element(target.nodeName); - /** #7364 target for