@uploadcare/file-uploader 1.25.0-alpha.2 → 1.25.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract/loadFileUploaderFrom.js +4 -79
- package/dist/env.js +4 -33
- package/dist/index.css +5 -2664
- package/dist/index.d.ts +933 -927
- package/dist/index.js +6 -13594
- package/dist/index.layered.css +4 -2720
- package/dist/index.ssr.js +34 -29
- package/dist/locales/file-uploader/ar.js +4 -165
- package/dist/locales/file-uploader/az.js +4 -157
- package/dist/locales/file-uploader/ca.js +4 -159
- package/dist/locales/file-uploader/cs.js +4 -161
- package/dist/locales/file-uploader/da.js +4 -157
- package/dist/locales/file-uploader/de.js +4 -157
- package/dist/locales/file-uploader/el.js +4 -157
- package/dist/locales/file-uploader/en.js +4 -157
- package/dist/locales/file-uploader/es.js +4 -159
- package/dist/locales/file-uploader/et.js +4 -157
- package/dist/locales/file-uploader/fi.js +4 -157
- package/dist/locales/file-uploader/fr.js +4 -159
- package/dist/locales/file-uploader/he.js +4 -159
- package/dist/locales/file-uploader/hy.js +4 -157
- package/dist/locales/file-uploader/is.js +4 -157
- package/dist/locales/file-uploader/it.js +4 -159
- package/dist/locales/file-uploader/ja.js +4 -157
- package/dist/locales/file-uploader/ka.js +4 -157
- package/dist/locales/file-uploader/kk.js +4 -157
- package/dist/locales/file-uploader/ko.js +4 -157
- package/dist/locales/file-uploader/lv.js +4 -159
- package/dist/locales/file-uploader/nb.js +4 -157
- package/dist/locales/file-uploader/nl.js +4 -157
- package/dist/locales/file-uploader/pl.js +4 -161
- package/dist/locales/file-uploader/pt.js +4 -159
- package/dist/locales/file-uploader/ro.js +4 -159
- package/dist/locales/file-uploader/ru.js +4 -161
- package/dist/locales/file-uploader/sk.js +4 -161
- package/dist/locales/file-uploader/sr.js +4 -159
- package/dist/locales/file-uploader/sv.js +4 -157
- package/dist/locales/file-uploader/tr.js +4 -157
- package/dist/locales/file-uploader/uk.js +4 -161
- package/dist/locales/file-uploader/vi.js +4 -157
- package/dist/locales/file-uploader/zh-TW.js +4 -157
- package/dist/locales/file-uploader/zh.js +4 -157
- package/package.json +12 -11
- package/types/jsx.d.ts +75 -48
- package/web/file-uploader.iife.min.d.ts +935 -929
- package/web/file-uploader.iife.min.js +6 -31
- package/web/file-uploader.iife.min.js.LEGAL.txt +71 -0
- package/web/file-uploader.min.d.ts +935 -929
- package/web/file-uploader.min.js +5 -29
- package/web/file-uploader.min.js.LEGAL.txt +71 -0
- package/web/uc-basic.layered.min.css +4 -23
- package/web/uc-basic.min.css +4 -23
- package/web/uc-cloud-image-editor.layered.min.css +4 -23
- package/web/uc-cloud-image-editor.min.css +4 -23
- package/web/uc-cloud-image-editor.min.d.ts +489 -494
- package/web/uc-cloud-image-editor.min.js +5 -29
- package/web/uc-cloud-image-editor.min.js.LEGAL.txt +70 -0
- package/web/uc-file-uploader-inline.layered.min.css +4 -23
- package/web/uc-file-uploader-inline.min.css +4 -23
- package/web/uc-file-uploader-inline.min.d.ts +935 -929
- package/web/uc-file-uploader-inline.min.js +5 -29
- package/web/uc-file-uploader-inline.min.js.LEGAL.txt +71 -0
- package/web/uc-file-uploader-minimal.layered.min.css +4 -23
- package/web/uc-file-uploader-minimal.min.css +4 -23
- package/web/uc-file-uploader-minimal.min.d.ts +935 -929
- package/web/uc-file-uploader-minimal.min.js +5 -29
- package/web/uc-file-uploader-minimal.min.js.LEGAL.txt +71 -0
- package/web/uc-file-uploader-regular.layered.min.css +4 -23
- package/web/uc-file-uploader-regular.min.css +4 -23
- package/web/uc-file-uploader-regular.min.d.ts +935 -929
- package/web/uc-file-uploader-regular.min.js +5 -29
- package/web/uc-file-uploader-regular.min.js.LEGAL.txt +71 -0
- package/web/uc-img.min.d.ts +28 -38
- package/web/uc-img.min.js +5 -25
- package/web/uc-img.min.js.LEGAL.txt +24 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Bundled license information:
|
|
2
|
+
|
|
3
|
+
@lit/reactive-element/css-tag.js:
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2019 Google LLC
|
|
7
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
@lit/reactive-element/reactive-element.js:
|
|
11
|
+
lit-html/lit-html.js:
|
|
12
|
+
lit-element/lit-element.js:
|
|
13
|
+
@lit/context/lib/decorators/provide.js:
|
|
14
|
+
@lit/reactive-element/decorators/custom-element.js:
|
|
15
|
+
@lit/reactive-element/decorators/property.js:
|
|
16
|
+
@lit/reactive-element/decorators/state.js:
|
|
17
|
+
@lit/reactive-element/decorators/event-options.js:
|
|
18
|
+
@lit/reactive-element/decorators/base.js:
|
|
19
|
+
@lit/reactive-element/decorators/query.js:
|
|
20
|
+
@lit/reactive-element/decorators/query-all.js:
|
|
21
|
+
@lit/reactive-element/decorators/query-async.js:
|
|
22
|
+
@lit/reactive-element/decorators/query-assigned-nodes.js:
|
|
23
|
+
lit-html/directive.js:
|
|
24
|
+
lit-html/async-directive.js:
|
|
25
|
+
lit-html/directives/repeat.js:
|
|
26
|
+
lit-html/directives/unsafe-html.js:
|
|
27
|
+
lit-html/directives/unsafe-svg.js:
|
|
28
|
+
/**
|
|
29
|
+
* @license
|
|
30
|
+
* Copyright 2017 Google LLC
|
|
31
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
lit-html/is-server.js:
|
|
35
|
+
@lit/context/lib/decorators/consume.js:
|
|
36
|
+
/**
|
|
37
|
+
* @license
|
|
38
|
+
* Copyright 2022 Google LLC
|
|
39
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
@lit/context/lib/context-request-event.js:
|
|
43
|
+
@lit/context/lib/create-context.js:
|
|
44
|
+
@lit/context/lib/controllers/context-consumer.js:
|
|
45
|
+
@lit/context/lib/value-notifier.js:
|
|
46
|
+
@lit/context/lib/controllers/context-provider.js:
|
|
47
|
+
@lit/context/lib/context-root.js:
|
|
48
|
+
@lit/reactive-element/decorators/query-assigned-elements.js:
|
|
49
|
+
lit-html/directives/when.js:
|
|
50
|
+
/**
|
|
51
|
+
* @license
|
|
52
|
+
* Copyright 2021 Google LLC
|
|
53
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
lit-html/directive-helpers.js:
|
|
57
|
+
lit-html/directives/ref.js:
|
|
58
|
+
/**
|
|
59
|
+
* @license
|
|
60
|
+
* Copyright 2020 Google LLC
|
|
61
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
lit-html/directives/style-map.js:
|
|
65
|
+
lit-html/directives/class-map.js:
|
|
66
|
+
lit-html/directives/if-defined.js:
|
|
67
|
+
/**
|
|
68
|
+
* @license
|
|
69
|
+
* Copyright 2018 Google LLC
|
|
70
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
71
|
+
*/
|
package/web/uc-img.min.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
PREVIEW: "PREVIEW";
|
|
5
|
-
MAIN: "MAIN";
|
|
6
|
-
}>;
|
|
7
|
-
|
|
8
|
-
type Constructor<T = {}> = new (...args: any[]) => T;
|
|
3
|
+
type Constructor<T = unknown> = new (...args: any[]) => T;
|
|
9
4
|
|
|
10
5
|
type CssPropValue = string | number | undefined | null;
|
|
11
6
|
declare const ImgConfig_base: typeof LitElement & Constructor<LitElement> & {
|
|
@@ -20,13 +15,13 @@ declare class ImgConfig extends ImgConfig_base {
|
|
|
20
15
|
private _observed;
|
|
21
16
|
createRenderRoot(): HTMLElement | ShadowRoot;
|
|
22
17
|
constructor();
|
|
23
|
-
$$(key: string): unknown;
|
|
24
|
-
set$$(kvObj: Record<string, CssPropValue>): void;
|
|
25
|
-
sub$$<T = unknown>(key: string, kbFn: (val: T) => void): void;
|
|
18
|
+
protected $$(key: string): unknown;
|
|
19
|
+
protected set$$(kvObj: Record<string, CssPropValue>): void;
|
|
20
|
+
protected sub$$<T = unknown>(key: string, kbFn: (val: T) => void): void;
|
|
26
21
|
private _notify;
|
|
27
|
-
analyticsParams(): string;
|
|
28
|
-
initAttributes(el: HTMLElement): void;
|
|
29
|
-
initIntersection(el: HTMLElement, cbkFn: () => void): void;
|
|
22
|
+
protected analyticsParams(): string;
|
|
23
|
+
protected initAttributes(el: HTMLElement): void;
|
|
24
|
+
protected initIntersection(el: HTMLElement, cbkFn: () => void): void;
|
|
30
25
|
connectedCallback(): void;
|
|
31
26
|
private _initCssProperties;
|
|
32
27
|
disconnectedCallback(): void;
|
|
@@ -34,19 +29,9 @@ declare class ImgConfig extends ImgConfig_base {
|
|
|
34
29
|
attributeChangedCallback(name: string, _oldVal: string | null, newVal: string | null): void;
|
|
35
30
|
}
|
|
36
31
|
|
|
37
|
-
type ImgType = (typeof ImgTypeEnum)[keyof typeof ImgTypeEnum];
|
|
38
|
-
type LoaderParams = {
|
|
39
|
-
src?: string;
|
|
40
|
-
srcset?: string;
|
|
41
|
-
elNode: HTMLImageElement;
|
|
42
|
-
};
|
|
43
|
-
type CurrentImg = {
|
|
44
|
-
type: ImgType;
|
|
45
|
-
img: HTMLImageElement;
|
|
46
|
-
};
|
|
47
32
|
declare class ImgBase extends ImgConfig {
|
|
48
|
-
|
|
49
|
-
|
|
33
|
+
private _img;
|
|
34
|
+
private _imgPreview;
|
|
50
35
|
private _fmtAbs;
|
|
51
36
|
private _validateSize;
|
|
52
37
|
private _getCdnModifiers;
|
|
@@ -55,25 +40,30 @@ declare class ImgBase extends ImgConfig {
|
|
|
55
40
|
private _proxyUrl;
|
|
56
41
|
protected _getElSize(el: HTMLElement, k?: number, wOnly?: boolean): string | null;
|
|
57
42
|
private _setupEventProxy;
|
|
58
|
-
get img(): HTMLImageElement;
|
|
59
|
-
get
|
|
60
|
-
get
|
|
61
|
-
get
|
|
62
|
-
get
|
|
63
|
-
get
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
get
|
|
68
|
-
|
|
43
|
+
protected get img(): HTMLImageElement;
|
|
44
|
+
private get _currentImg();
|
|
45
|
+
private get _hasPreviewImage();
|
|
46
|
+
private get _bgSelector();
|
|
47
|
+
private get _breakpoints();
|
|
48
|
+
private get _hasFormatJPG();
|
|
49
|
+
private _renderBg;
|
|
50
|
+
private _getSrcset;
|
|
51
|
+
private _getSrc;
|
|
52
|
+
private get _srcUrlPreview();
|
|
53
|
+
private _renderBackground;
|
|
69
54
|
private _appendURL;
|
|
70
55
|
private _setupConfigForImage;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
init(): void;
|
|
56
|
+
private _loaderImage;
|
|
57
|
+
private _renderImage;
|
|
58
|
+
protected init(): void;
|
|
74
59
|
}
|
|
75
60
|
|
|
76
61
|
declare class Img extends ImgBase {
|
|
62
|
+
attributesMeta: {
|
|
63
|
+
src: string;
|
|
64
|
+
} | {
|
|
65
|
+
uuid: string;
|
|
66
|
+
};
|
|
77
67
|
connectedCallback(): void;
|
|
78
68
|
}
|
|
79
69
|
|
package/web/uc-img.min.js
CHANGED
|
@@ -1,28 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* MIT
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*
|
|
3
|
+
* Package: @uploadcare/file-uploader@1.25.0-alpha.4 (MIT)
|
|
4
|
+
* License: https://github.com/uploadcare/file-uploader/blob/main/LICENSE
|
|
5
|
+
* Built: 2025-12-09T11:47:58.277Z
|
|
25
6
|
*/
|
|
26
|
-
var z=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var T=(r,s,t,e)=>{if(s&&typeof s=="object"||typeof s=="function")for(let i of F(s))!H.call(r,i)&&i!==t&&z(r,i,{get:()=>s[i],enumerable:!(e=N(s,i))||e.enumerable});return r},u=(r,s,t)=>(T(r,s,"default"),t&&T(t,s,"default"));var W=r=>{if(typeof r!="string"||!r)return"";let s=r.trim();return s.startsWith("-/")?s=s.slice(2):s.startsWith("/")&&(s=s.slice(1)),s.endsWith("/")&&(s=s.slice(0,s.length-1)),s},Q=(...r)=>r.filter(s=>typeof s=="string"&&!!s).map(s=>W(s)).join("/-/"),$=(...r)=>{let s=Q(...r);return s?`-/${s}/`:""};function S(r){let s=new URL(r),t=s.pathname+s.search+s.hash,e=t.lastIndexOf("http"),i=t.lastIndexOf("/"),n="";return e>=0?n=t.slice(e):i>=0&&(n=t.slice(i+1)),n}function G(r){let s=new URL(r),t=S(r),e=O(t)?U(t).pathname:t;return s.pathname=s.pathname.replace(e,""),s.search="",s.hash="",s.toString()}function O(r){return r.startsWith("http")}function U(r){let s=new URL(r);return{pathname:`${s.origin}${s.pathname??""}`,search:s.search??"",hash:s.hash??""}}var d=(r,s,t)=>{let e=new URL(G(r)),i=t??S(r),n=s??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),i&&O(i)){let a=U(i);e.pathname=`${e.pathname}${n}${a.pathname||""}`,e.search=a.search,e.hash=a.hash}else e.pathname=`${e.pathname}${n}${i||""}`;return e.toString()},_=(r,s)=>{let t=new URL(r);return t.pathname=`${s}/`,t.toString()};var L=(r,s=",")=>r.trim().split(s).map(t=>t.trim()).filter(t=>t.length>0);var q=r=>r;function j(r,s={},t={}){let{openToken:e="{{",closeToken:i="}}",transform:n=q}=t;for(let a in s){let l=s[a],c=l?.toString(),m=typeof c=="string"?n(c):String(c);r=r.replaceAll(e+a+i,m)}return r}var k=r=>[...new Set(r)];var p="--uc-img-",E="unresolved";var w=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),x=3e3,C=5e3,P=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var o={};u(o,ut);u(o,pt);import"@lit/reactive-element";import"lit-html";import*as ut from"lit-element/lit-element.js";import*as pt from"lit-html/is-server.js";var M="1.25.0-alpha.2";var R="blocks",A=M;var X=/\\([0-9a-fA-F]{1,6} ?)/g;function Y(r){return r.length<2?!1:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}function Z(r){let s=r;return(s[0]==='"'||s[0]==="'")&&(s=s.slice(1)),(s[s.length-1]==='"'||s[s.length-1]==="'")&&(s=s.slice(0,-1)),s}function tt(r){let s="",t="";for(let e=0;e<r.length;e++){let i=r[e+1];r[e]==="\\"&&i==='"'?(s+='\\"',e++):r[e]==='"'&&t!=="\\"?s+='\\"':s+=r[e],t=r[e]??""}return s}function D(r){let s=r;Y(r)&&(s=Z(s),s=s.replace(X,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),s=s.replaceAll(`\\
|
|
27
|
-
|
|
28
|
-
`));return}window.customElements.define(e,i)}}return s}var et="https://ucarecdn.com",g=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:et},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var h=class extends B(K(o.LitElement)){constructor(){super();this._state={};this._subscribers=new Map;this._isnObserver=null;this._observed=null;for(let t in g){let e=g[t];this._state[p+t]=e?.default||""}}createRenderRoot(){return this}$$(t){return this._state[p+t]}set$$(t){for(let e in t){let i=p+e,n=t[e];this._state[i]=n,this._notify(i,n)}}sub$$(t,e){let i=p+t;this._subscribers.has(i)||this._subscribers.set(i,new Set),this._subscribers.get(i).add(e);let n=this._state[i];n!==null&&n!==""&&e(n)}_notify(t,e){this._subscribers.has(t)&&this._subscribers.get(t).forEach(i=>{e===null||e===""||i(e)})}analyticsParams(){return`-/@clib/${R}/${A}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let i=e;g[i.name]||t.setAttribute(i.name,i.value)})}initIntersection(t,e){let i={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(n=>{n.forEach(a=>{a.isIntersecting&&(e(),this._isnObserver.unobserve(t))})},i),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}connectedCallback(){super.connectedCallback(),this._initCssProperties()}_initCssProperties(){for(let t in g){let e=p+t,i=this.getCssData(e,!0);i!=null&&(this._state[e]=i)}}disconnectedCallback(){super.disconnectedCallback(),this._isnObserver&&(this._observed?.forEach(t=>{this._isnObserver?.unobserve(t)}),this._isnObserver=null),this._subscribers.clear()}static get observedAttributes(){return Object.keys(g)}attributeChangedCallback(t,e,i){window.setTimeout(()=>{let n=p+t;this._state[n]=i,this._notify(n,i)})}};var V=r=>Object.entries(r).filter(([s,t])=>t!==void 0&&t!=="").map(([s,t])=>s==="cdn-operations"||s==="analytics"?t:`${s}/${t}`);var y=class extends h{constructor(){super(...arguments);this._img=new Image;this._imgPreview=new Image}_fmtAbs(t){return!t.includes("//")&&!w&&(t=new URL(t,document.baseURI).href),t}_validateSize(t){if(t?.trim()!==""){let e=t,i=e.match(/\d+/)[0],n=e.match(/[a-zA-Z]+/)[0],a=parseInt(i,10);if(Number(a)>C&&this.hasFormatJPG)return C+n;if(Number(a)>x&&!this.hasFormatJPG)return x+n}return t}_getCdnModifiers(t,e){let i={format:this._getTypedCssValue("format"),quality:this._getTypedCssValue("quality"),resize:this._validateSize(t),blur:e,"cdn-operations":this._getTypedCssValue("cdn-operations")??void 0,analytics:this.analyticsParams()};return $(...V(i))}_getTypedCssValue(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}_getUrlBase(t="",e=""){let i=this.$$("src");if(i.startsWith("data:")||i.startsWith("blob:"))return i;if(w&&i&&!i.includes("//"))return this._proxyUrl(i);let n=this._getCdnModifiers(t,e),a=this.$$("cdn-cname"),l=a;if(i.startsWith(String(a)))return d(i,n);let c=this.$$("uuid");if(l&&c)return this._proxyUrl(d(_(l,c),n));if(c)return this._proxyUrl(d(_(l,c),n));let m=this.$$("proxy-cname");if(m)return this._proxyUrl(d(m,n,this._fmtAbs(i)));let I=this.$$("pubkey");if(I)return this._proxyUrl(d(`https://${I}.ucr.io/`,n,this._fmtAbs(i)))}_proxyUrl(t){let e=this.$$("secure-delivery-proxy");return e?j(e,{previewUrl:t},{transform:i=>window.encodeURIComponent(i)}):t}_getElSize(t,e=1,i=!0){let n=t.getBoundingClientRect(),a=e*Math.round(n.width),l=i?"":e*Math.round(n.height);return a||l?`${a||""}x${l||""}`:null}_setupEventProxy(t){let e=n=>{n.stopPropagation();let a=new Event(n.type,n);this.dispatchEvent(a)},i=["load","error"];for(let n of i)t.addEventListener(n,e)}get img(){return this.hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get currentImg(){return this.hasPreviewImage?{type:P.PREVIEW,img:this._imgPreview}:{type:P.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){let t=this.$$("breakpoints");if(t){let e=L(t);return k(e.map(i=>parseInt(i,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(t){let e=new Set;e.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,3))}") ${3}x`);let i=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",i),t.style.setProperty("background-image","-webkit-"+i)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(e=>{t.add(`${this._getUrlBase(`${e}x`)} ${this._validateSize(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this._getUrlBase(`${e*2}x`)} ${this._validateSize(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this._getUrlBase(`${e*3}x`)} ${this._validateSize(`${e*3}w`)}`)}):(t.add(`${this._getUrlBase(this._getElSize(this.currentImg.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this._getUrlBase(this._getElSize(this.currentImg.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this._getUrlBase(this._getElSize(this.currentImg.img,3))} 3x`)),[...t].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){let t=this.bgSelector;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.renderBg(e)}):this.renderBg(e)})}_appendURL({elNode:t,src:e,srcset:i}){e&&(t.src=e),i&&(t.srcset=i)}_setupConfigForImage({elNode:t}){this._setupEventProxy(t),this.initAttributes(t)}loaderImage({src:t,srcset:e,elNode:i}){return new Promise((n,a)=>{this._setupConfigForImage({elNode:i}),i.setAttribute(E,""),i.addEventListener("load",()=>{i.removeAttribute(E),n(i)}),i.addEventListener("error",()=>{a(!1)}),this._appendURL({elNode:i,src:t,srcset:e})})}async renderImage(){if(this.$$("intersection")){this.hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this.currentImg.img,async()=>{this.hasPreviewImage&&(this._imgPreview.src=this.srcUrlPreview);try{await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img)}catch{this.hasPreviewImage&&await this._imgPreview?.remove(),this.appendChild(this._img)}});return}try{this.hasPreviewImage&&(await this.loaderImage({src:this.srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await this._imgPreview?.remove(),this.appendChild(this._img)}catch{this.hasPreviewImage&&await this._imgPreview?.remove(),this.appendChild(this._img)}}init(){this.bgSelector?this.renderBackground():this.renderImage()}};var v=class extends y{connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",s=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=s?"lazy":"eager")})}};v.reg("uc-img");export{v as Img};
|
|
7
|
+
var Kt=n=>{if(typeof n!="string"||!n)return "";let t=n.trim();return t.startsWith("-/")?t=t.slice(2):t.startsWith("/")&&(t=t.slice(1)),t.endsWith("/")&&(t=t.slice(0,t.length-1)),t},Vt=(...n)=>n.filter(t=>typeof t=="string"&&!!t).map(t=>Kt(t)).join("/-/"),lt=(...n)=>{let t=Vt(...n);return t?`-/${t}/`:""};function ct(n){let t=new URL(n),e=t.pathname+t.search+t.hash,s=e.lastIndexOf("http"),i=e.lastIndexOf("/"),r="";return s>=0?r=e.slice(s):i>=0&&(r=e.slice(i+1)),r}function Bt(n){let t=new URL(n),e=ct(n),s=ht(e)?pt(e).pathname:e;return t.pathname=t.pathname.replace(s,""),t.search="",t.hash="",t.toString()}function ht(n){return n.startsWith("http")}function pt(n){let t=new URL(n);return {pathname:`${t.origin}${t.pathname??""}`,search:t.search??"",hash:t.hash??""}}var S=(n,t,e)=>{let s=new URL(Bt(n)),i=e??ct(n),r=t??"";if(s.pathname.startsWith("//")&&(s.pathname=s.pathname.replace("//","/")),i&&ht(i)){let o=pt(i);s.pathname=`${s.pathname}${r}${o.pathname||""}`,s.search=o.search,s.hash=o.hash;}else s.pathname=`${s.pathname}${r}${i||""}`;return s.toString()},z=(n,t)=>{let e=new URL(n);return e.pathname=`${t}/`,e.toString()};var dt=(n,t=",")=>n.trim().split(t).map(e=>e.trim()).filter(e=>e.length>0);var Ht=n=>n;function ut(n,t={},e={}){let{openToken:s="{{",closeToken:i="}}",transform:r=Ht}=e;for(let o in t){let l=t[o],a=l?.toString(),h=typeof a=="string"?r(a):String(a);n=n.replaceAll(s+o+i,h);}return n}var mt=n=>[...new Set(n)];var b="--uc-img-",W="unresolved";var F=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Q=3e3,q=5e3,G=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var k=globalThis,j=k.ShadowRoot&&(k.ShadyCSS===void 0||k.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,gt=Symbol(),ft=new WeakMap,L=class{constructor(t,e,s){if(this.St=true,s!==gt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o,e=this.t;if(j&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=ft.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&ft.set(e,t));}return t}toString(){return this.cssText}},yt=n=>new L(typeof n=="string"?n:n+"",void 0,gt);var bt=(n,t)=>{if(j)n.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(let e of t){let s=document.createElement("style"),i=k.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,n.appendChild(s);}},J=j?n=>n:n=>n instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return yt(e)})(n):n;var{is:zt,defineProperty:Wt,getOwnPropertyDescriptor:Ft,getOwnPropertyNames:Qt,getOwnPropertySymbols:qt,getPrototypeOf:Gt}=Object,_=globalThis,vt=_.trustedTypes,Jt=vt?vt.emptyScript:"",Xt=_.reactiveElementPolyfillSupport,$=(n,t)=>n,X={toAttribute(n,t){switch(t){case Boolean:n=n?Jt:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n);}return n},fromAttribute(n,t){let e=n;switch(t){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n);}catch{e=null;}}return e}},wt=(n,t)=>!zt(n,t),xt={attribute:true,type:String,converter:X,reflect:false,useDefault:false,hasChanged:wt};Symbol.metadata??=Symbol("metadata"),_.litPropertyMetadata??=new WeakMap;var m=class extends HTMLElement{static addInitializer(t){this.G(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this.S&&[...this.S.keys()]}static createProperty(t,e=xt){if(e.state&&(e.attribute=false),this.G(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=true),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&Wt(this.prototype,t,i);}}static getPropertyDescriptor(t,e,s){let{get:i,set:r}=Ft(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o;}};return {get:i,set(o){let l=i?.call(this);r?.call(this,o),this.requestUpdate(t,l,s);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??xt}static G(){if(this.hasOwnProperty($("elementProperties")))return;let t=Gt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty($("finalized")))return;if(this.finalized=true,this.G(),this.hasOwnProperty($("properties"))){let e=this.properties,s=[...Qt(e),...qt(e)];for(let i of s)this.createProperty(i,e[i]);}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,i]of e)this.elementProperties.set(s,i);}this.S=new Map;for(let[e,s]of this.elementProperties){let i=this.J(e,s);i!==void 0&&this.S.set(i,e);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let i of s)e.unshift(J(i));}else t!==void 0&&e.push(J(t));return e}static J(t,e){let s=e.attribute;return s===false?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.f=null,this.Ct();}Ct(){this.X=new Promise((t=>this.enableUpdating=t)),this.c=new Map,this.Tt(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this.x??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.();}removeController(t){this.x?.delete(t);}Tt(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._=t);}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return bt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.x?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this.x?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,e,s){this.Z(t,s);}Pt(t,e){let s=this.constructor.elementProperties.get(t),i=this.constructor.J(t,s);if(i!==void 0&&s.reflect===true){let r=(s.converter?.toAttribute!==void 0?s.converter:X).toAttribute(e,s.type);this.f=t,r==null?this.removeAttribute(i):this.setAttribute(i,r),this.f=null;}}Z(t,e){let s=this.constructor,i=s.S.get(t);if(i!==void 0&&this.f!==i){let r=s.getPropertyOptions(i),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:X;this.f=i;let l=o.fromAttribute(e,r.type);this[i]=l??this.Y?.get(i)??l,this.f=null;}}requestUpdate(t,e,s){if(t!==void 0){let i=this.constructor,r=this[t];if(s??=i.getPropertyOptions(t),!((s.hasChanged??wt)(r,e)||s.useDefault&&s.reflect&&r===this.Y?.get(t)&&!this.hasAttribute(i.J(t,s))))return;this.C(t,e,s);}this.isUpdatePending===false&&(this.X=this.$t());}C(t,e,{useDefault:s,reflect:i,wrapped:r},o){s&&!(this.Y??=new Map).has(t)&&(this.Y.set(t,o??e??this[t]),r!==true||o!==void 0)||(this.c.has(t)||(this.hasUpdated||s||(e=void 0),this.c.set(t,e)),i===true&&this.f!==t&&(this.lt??=new Set).add(t));}async $t(){this.isUpdatePending=true;try{await this.X;}catch(e){Promise.reject(e);}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._){for(let[i,r]of this._)this[i]=r;this._=void 0;}let s=this.constructor.elementProperties;if(s.size>0)for(let[i,r]of s){let{wrapped:o}=r,l=this[i];o!==true||this.c.has(i)||l===void 0||this.C(i,void 0,r,l);}}let t=false,e=this.c;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this.x?.forEach((s=>s.hostUpdate?.())),this.update(e)):this.tt();}catch(s){throw t=false,this.tt(),s}t&&this.Ot(e);}willUpdate(t){}Ot(t){this.x?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}tt(){this.c=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.X}shouldUpdate(t){return true}update(t){this.lt&&=this.lt.forEach((e=>this.Pt(e,this[e]))),this.tt();}updated(t){}firstUpdated(t){}};m.elementStyles=[],m.shadowRootOptions={mode:"open"},m[$("elementProperties")]=new Map,m[$("finalized")]=new Map,Xt?.({ReactiveElement:m}),(_.reactiveElementVersions??=[]).push("2.1.1");var nt=globalThis,N=nt.trustedTypes,Et=N?N.createPolicy("lit-html",{createHTML:n=>n}):void 0,Ot="$lit$",g=`lit$${Math.random().toFixed(9).slice(2)}$`,At="?"+g,Zt=`<${At}>`,w=document,A=()=>w.createComment(""),U=n=>n===null||typeof n!="object"&&typeof n!="function",rt=Array.isArray,Yt=n=>rt(n)||typeof n?.[Symbol.iterator]=="function",Z=`[ \f\r]`,O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,St=/-->/g,Ct=/>/g,v=RegExp(`>|${Z}(?:([^\\s"'>=/]+)(${Z}*=${Z}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Tt=/'/g,Pt=/"/g,Ut=/^(?:script|style|textarea|title)$/i,E=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),$t=new WeakMap,x=w.createTreeWalker(w,129);function Rt(n,t){if(!rt(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Et!==void 0?Et.createHTML(t):t}var te=(n,t)=>{let e=n.length-1,s=[],i,r=t===2?"<svg>":t===3?"<math>":"",o=O;for(let l=0;l<e;l++){let a=n[l],h,p,c=-1,u=0;for(;u<a.length&&(o.lastIndex=u,p=o.exec(a),p!==null);)u=o.lastIndex,o===O?p[1]==="!--"?o=St:p[1]!==void 0?o=Ct:p[2]!==void 0?(Ut.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=v):p[3]!==void 0&&(o=v):o===v?p[0]===">"?(o=i??O,c=-1):p[1]===void 0?c=-2:(c=o.lastIndex-p[2].length,h=p[1],o=p[3]===void 0?v:p[3]==='"'?Pt:Tt):o===Pt||o===Tt?o=v:o===St||o===Ct?o=O:(o=v,i=void 0);let f=o===v&&n[l+1].startsWith("/>")?" ":"";r+=o===O?a+Zt:c>=0?(s.push(h),a.slice(0,c)+Ot+a.slice(c)+g+f):a+g+(c===-2?l:f);}return [Rt(n,r+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},R=class n{constructor({strings:t,et:e},s){let i;this.parts=[];let r=0,o=0,l=t.length-1,a=this.parts,[h,p]=te(t,e);if(this.el=n.createElement(h,s),x.currentNode=this.el.content,e===2||e===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes);}for(;(i=x.nextNode())!==null&&a.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(let c of i.getAttributeNames())if(c.endsWith(Ot)){let u=p[o++],f=i.getAttribute(c).split(g),M=/([.?@])?(.*)/.exec(u);a.push({type:1,index:r,name:M[2],strings:f,ctor:M[1]==="."?tt:M[1]==="?"?et:M[1]==="@"?st:T}),i.removeAttribute(c);}else c.startsWith(g)&&(a.push({type:6,index:r}),i.removeAttribute(c));if(Ut.test(i.tagName)){let c=i.textContent.split(g),u=c.length-1;if(u>0){i.textContent=N?N.emptyScript:"";for(let f=0;f<u;f++)i.append(c[f],A()),x.nextNode(),a.push({type:2,index:++r});i.append(c[u],A());}}}else if(i.nodeType===8)if(i.data===At)a.push({type:2,index:r});else {let c=-1;for(;(c=i.data.indexOf(g,c+1))!==-1;)a.push({type:7,index:r}),c+=g.length-1;}r++;}}static createElement(t,e){let s=w.createElement("template");return s.innerHTML=t,s}};function C(n,t,e=n,s){if(t===E)return t;let i=s!==void 0?e.At?.[s]:e.Ut,r=U(t)?void 0:t.Kt;return i?.constructor!==r&&(i?.Vt?.(false),r===void 0?i=void 0:(i=new r(n),i.Bt(n,e,s)),s!==void 0?(e.At??=[])[s]=i:e.Ut=i),i!==void 0&&(t=C(n,i.Ht(n,t.values),i,s)),t}var Y=class{constructor(t,e){this.ct=[],this.st=void 0,this.ht=t,this.i=e;}get parentNode(){return this.i.parentNode}get d(){return this.i.d}u(t){let{el:{content:e},parts:s}=this.ht,i=(t?.creationScope??w).importNode(e,true);x.currentNode=i;let r=x.nextNode(),o=0,l=0,a=s[0];for(;a!==void 0;){if(o===a.index){let h;a.type===2?h=new I(r,r.nextSibling,this,t):a.type===1?h=new a.ctor(r,a.name,a.strings,this,t):a.type===6&&(h=new it(r,this,t)),this.ct.push(h),a=s[++l];}o!==a?.index&&(r=x.nextNode(),o++);}return x.currentNode=w,i}p(t){let e=0;for(let s of this.ct)s!==void 0&&(s.strings!==void 0?(s.m(t,s,e),e+=s.strings.length-2):s.m(t[e])),e++;}},I=class n{get d(){return this.i?.d??this.pt}constructor(t,e,s,i){this.type=2,this.e=d,this.st=void 0,this.w=t,this.K=e,this.i=s,this.options=i,this.pt=i?.isConnected??true;}get parentNode(){let t=this.w.parentNode,e=this.i;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this.w}get endNode(){return this.K}m(t,e=this){t=C(this,t,e),U(t)?t===d||t==null||t===""?(this.e!==d&&this.z(),this.e=d):t!==this.e&&t!==E&&this.dt(t):t.et!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Yt(t)?this.k(t):this.dt(t);}O(t){return this.w.parentNode.insertBefore(t,this.K)}T(t){this.e!==t&&(this.z(),this.e=this.O(t));}dt(t){this.e!==d&&U(this.e)?this.w.nextSibling.data=t:this.T(w.createTextNode(t)),this.e=t;}$(t){let{values:e,et:s}=t,i=typeof s=="number"?this.Rt(t):(s.el===void 0&&(s.el=R.createElement(Rt(s.h,s.h[0]),this.options)),s);if(this.e?.ht===i)this.e.p(e);else {let r=new Y(i,this),o=r.u(this.options);r.p(e),this.T(o),this.e=r;}}Rt(t){let e=$t.get(t.strings);return e===void 0&&$t.set(t.strings,e=new R(t)),e}k(t){rt(this.e)||(this.e=[],this.z());let e=this.e,s,i=0;for(let r of t)i===e.length?e.push(s=new n(this.O(A()),this.O(A()),this,this.options)):s=e[i],s.m(r),i++;i<e.length&&(this.z(s&&s.K.nextSibling,i),e.length=i);}z(t=this.w.nextSibling,e){for(this.It?.(false,true,e);t!==this.K;){let s=t.nextSibling;t.remove(),t=s;}}setConnected(t){this.i===void 0&&(this.pt=t,this.It?.(t));}},T=class{get tagName(){return this.element.tagName}get d(){return this.i.d}constructor(t,e,s,i,r){this.type=1,this.e=d,this.st=void 0,this.element=t,this.name=e,this.i=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this.e=Array(s.length-1).fill(new String),this.strings=s):this.e=d;}m(t,e=this,s,i){let r=this.strings,o=false;if(r===void 0)t=C(this,t,e,0),o=!U(t)||t!==this.e&&t!==E,o&&(this.e=t);else {let l=t,a,h;for(t=r[0],a=0;a<r.length-1;a++)h=C(this,l[s+a],e,a),h===E&&(h=this.e[a]),o||=!U(h)||h!==this.e[a],h===d?t=d:t!==d&&(t+=(h??"")+r[a+1]),this.e[a]=h;}o&&!i&&this.j(t);}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}},tt=class extends T{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===d?void 0:t;}},et=class extends T{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d);}},st=class extends T{constructor(t,e,s,i,r){super(t,e,s,i,r),this.type=5;}m(t,e=this){if((t=C(this,t,e,0)??d)===E)return;let s=this.e,i=t===d&&s!==d||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==d&&(s===d||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this.e=t;}handleEvent(t){typeof this.e=="function"?this.e.call(this.options?.host??this.element,t):this.e.handleEvent(t);}},it=class{constructor(t,e,s){this.element=t,this.type=6,this.st=void 0,this.i=e,this.options=s;}get d(){return this.i.d}m(t){C(this,t);}};var ee=nt.litHtmlPolyfillSupport;ee?.(R,I),(nt.litHtmlVersions??=[]).push("3.3.1");var It=(n,t,e)=>{let s=e?.renderBefore??t,i=s.Mt;if(i===void 0){let r=e?.renderBefore??null;s.Mt=i=new I(t.insertBefore(A(),r),r,void 0,e??{});}return i.m(n),i};var at=globalThis,y=class extends m{constructor(){super(...arguments),this.renderOptions={host:this},this.it=void 0;}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this.it=It(e,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.it?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.it?.setConnected(false);}render(){return E}};y.zt=true,y.finalized=true,at.litElementHydrateSupport?.({LitElement:y});var se=at.litElementPolyfillSupport;se?.({LitElement:y});(at.litElementVersions??=[]).push("4.2.1");var Mt="1.25.0-alpha.4";var kt="blocks",Lt=Mt;var ne=/\\([0-9a-fA-F]{1,6} ?)/g;function re(n){return n.length<2?false:(n[0]==='"'||n[0]==="'")&&(n[n.length-1]==='"'||n[n.length-1]==="'")}function oe(n){let t=n;return (t[0]==='"'||t[0]==="'")&&(t=t.slice(1)),(t[t.length-1]==='"'||t[t.length-1]==="'")&&(t=t.slice(0,-1)),t}function ae(n){let t="",e="";for(let s=0;s<n.length;s++){let i=n[s+1];n[s]==="\\"&&i==='"'?(t+='\\"',s++):n[s]==='"'&&e!=="\\"?t+='\\"':t+=n[s],e=n[s]??"";}return t}function jt(n){let t=n;re(n)&&(t=oe(t),t=t.replace(ne,(e,s)=>String.fromCodePoint(parseInt(s.trim(),16))),t=t.replaceAll(`\\ `,"\\n"),t=ae(t),t='"'+t+'"');try{return JSON.parse(t)}catch{return}}function _t(n){class t extends n{constructor(){super(...arguments);this.ut=null;this.nt=null;}getCssData(i,r=false){let o=this.ut??Object.create(null);if(!Object.keys(o).includes(i)||!o[i]){this.nt||(this.nt=window.getComputedStyle(this));let l=this.nt.getPropertyValue(i).trim();try{o[i]=jt(l);}catch(a){r||console.warn(`CSS Data error: ${i}`,a),o[i]=null;}}return this.ut=o,o[i]}}return t}function Nt(n){class t extends n{static reg(s){let i=this,r=window.customElements.get(s);if(r){r!==i&&console.warn([`Element with tag name "${s}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(s,i);}}return t}var le="https://ucarecdn.com",P=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:le},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var D=class extends _t(Nt(y)){constructor(){super();this.g={};this.y=new Map;this.b=null;this.W=null;for(let e in P){let s=P[e];this.g[b+e]=s?.default||"";}}createRenderRoot(){return this}$$(e){return this.g[b+e]}set$$(e){for(let s in e){let i=b+s,r=e[s];this.g[i]=r,this.mt(i,r);}}sub$$(e,s){let i=b+e;this.y.has(i)||this.y.set(i,new Set),this.y.get(i)?.add(s);let r=this.g[i];r!==null&&r!==""&&s(r);}mt(e,s){this.y.has(e)&&this.y.get(e)?.forEach(i=>{s===null||s===""||i(s);});}analyticsParams(){return `-/@clib/${kt}/${Lt}/uc-img/`}initAttributes(e){Array.from(this.attributes).forEach(s=>{let i=s;P[i.name]||e.setAttribute(i.name,i.value);});}initIntersection(e,s){let i={root:null,rootMargin:"0px"};this.b=new IntersectionObserver(r=>{r.forEach(o=>{o.isIntersecting&&(s(),this.b?.unobserve(e));});},i),this.b.observe(e),this.W||(this.W=new Set),this.W.add(e);}connectedCallback(){super.connectedCallback(),this.kt();}kt(){for(let e in P){let s=b+e,i=this.getCssData(s,true);i!=null&&(this.g[s]=i);}}disconnectedCallback(){super.disconnectedCallback(),this.b&&(this.W?.forEach(e=>{this.b?.unobserve(e);}),this.b=null),this.y.clear();}static get observedAttributes(){return Object.keys(P)}attributeChangedCallback(e,s,i){window.setTimeout(()=>{let r=b+e;this.g[r]=i,this.mt(r,i);});}};var Dt=n=>Object.entries(n).filter(([t,e])=>e!==void 0&&e!=="").map(([t,e])=>t==="cdn-operations"||t==="analytics"?e:`${t}/${e}`);var B=class extends D{constructor(){super(...arguments);this.r=new Image;this.n=new Image;}ft(e){return !e.includes("//")&&!F&&(e=new URL(e,document.baseURI).href),e}Q(e){if(!e)return;let s=e,i=s.match(/\d+/)?.[0],r=s.match(/[a-zA-Z]+/)?.[0];if(!i||!r)return;let o=parseInt(i,10);return Number(o)>q&&this.gt?q+r:Number(o)>Q&&!this.gt?Q+r:e}Lt(e,s){let i={format:this.rt("format"),quality:this.rt("quality"),resize:this.Q(e),blur:s,"cdn-operations":this.rt("cdn-operations")??void 0,analytics:this.analyticsParams()};return lt(...Dt(i))}rt(e){let s=this.$$(e);if(s==null||typeof s=="string"||typeof s=="number"||typeof s=="boolean")return s}s(e="",s=""){let i=this.$$("src");if(i.startsWith("data:")||i.startsWith("blob:"))return i;if(F&&i&&!i.includes("//"))return this.E(i);let r=this.Lt(e,s),o=this.$$("cdn-cname"),l=o;if(i.startsWith(String(o)))return S(i,r);let a=this.$$("uuid");if(l&&a)return this.E(S(z(l,a),r));if(a)return this.E(S(z(l,a),r));let h=this.$$("proxy-cname");if(h)return this.E(S(h,r,this.ft(i)));let p=this.$$("pubkey");if(p)return this.E(S(`https://${p}.ucr.io/`,r,this.ft(i)))}E(e){let s=this.$$("secure-delivery-proxy");return s?ut(s,{previewUrl:e},{transform:i=>window.encodeURIComponent(i)}):e}v(e,s=1,i=true){let r=e.getBoundingClientRect(),o=s*Math.round(r.width),l=i?"":s*Math.round(r.height);return o||l?`${o||""}x${l||""}`:null}jt(e){let s=r=>{r.stopPropagation();let o=new Event(r.type,r);this.dispatchEvent(o);},i=["load","error"];for(let r of i)e.addEventListener(r,s);}get img(){return this.a||(this.ot({elNode:this.r}),this.appendChild(this.r)),this.r}get q(){return this.a?{type:G.PREVIEW,img:this.n}:{type:G.MAIN,img:this.img}}get a(){return this.$$("is-preview-blur")}get yt(){return this.$$("is-background-for")}get bt(){let e=this.$$("breakpoints");if(e){let s=dt(e);return mt(s.map(i=>parseInt(i,10)))}else return null}get gt(){return this.$$("format").toLowerCase()==="jpeg"}vt(e){let s=new Set;s.add(`url("${this.s(this.v(e))}") 1x`),this.$$("hi-res-support")&&s.add(`url("${this.s(this.v(e,2))}") ${2}x`),this.$$("ultra-res-support")&&s.add(`url("${this.s(this.v(e,3))}") ${3}x`);let i=`image-set(${[...s].join(", ")})`;e.style.setProperty("background-image",i),e.style.setProperty("background-image",`-webkit-${i}`);}xt(){let e=new Set;return this.bt?this.bt.forEach(s=>{e.add(`${this.s(`${s}x`)} ${this.Q(`${s}w`)}`),this.$$("hi-res-support")&&e.add(`${this.s(`${s*2}x`)} ${this.Q(`${s*2}w`)}`),this.$$("ultra-res-support")&&e.add(`${this.s(`${s*3}x`)} ${this.Q(`${s*3}w`)}`);}):(e.add(`${this.s(this.v(this.q.img))} 1x`),this.$$("hi-res-support")&&e.add(`${this.s(this.v(this.q.img,2))} 2x`),this.$$("ultra-res-support")&&e.add(`${this.s(this.v(this.q.img,3))} 3x`)),[...e].join()}wt(){return this.s()}get Et(){return this.s("100x","100")}_t(){let e=this.yt;[...document.querySelectorAll(e)].forEach(s=>{this.$$("intersection")?this.initIntersection(s,()=>{this.vt(s);}):this.vt(s);});}Nt({elNode:e,src:s,srcset:i}){s&&(e.src=s),i&&(e.srcset=i);}ot({elNode:e}){this.jt(e),this.initAttributes(e);}at({src:e,srcset:s,elNode:i}){return new Promise((r,o)=>{this.ot({elNode:i}),i.setAttribute(W,""),i.addEventListener("load",()=>{i.removeAttribute(W),r(i);}),i.addEventListener("error",()=>{o(false);}),this.Nt({elNode:i,src:e,srcset:s});})}async Dt(){if(this.$$("intersection")){this.a&&(this.ot({elNode:this.n}),this.appendChild(this.n)),this.initIntersection(this.q.img,async()=>{this.a&&(this.n.src=this.Et);try{await this.at({src:this.wt(),srcset:this.xt(),elNode:this.r}),this.a&&await this.n.remove(),this.appendChild(this.r);}catch{this.a&&await this.n?.remove(),this.appendChild(this.r);}});return}try{this.a&&(await this.at({src:this.Et,elNode:this.n}),this.appendChild(this.n)),await this.at({src:this.wt(),srcset:this.xt(),elNode:this.r}),this.a&&await this.n?.remove(),this.appendChild(this.r);}catch{this.a&&await this.n?.remove(),this.appendChild(this.r);}}init(){this.yt?this._t():this.Dt();}};var H=class extends B{connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",t=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=t?"lazy":"eager");});}};H.reg("uc-img");/*! For license information please see uc-img.min.js.LEGAL.txt */
|
|
8
|
+
export{H as Img};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Bundled license information:
|
|
2
|
+
|
|
3
|
+
@lit/reactive-element/css-tag.js:
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2019 Google LLC
|
|
7
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
@lit/reactive-element/reactive-element.js:
|
|
11
|
+
lit-html/lit-html.js:
|
|
12
|
+
lit-element/lit-element.js:
|
|
13
|
+
/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright 2017 Google LLC
|
|
16
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
lit-html/is-server.js:
|
|
20
|
+
/**
|
|
21
|
+
* @license
|
|
22
|
+
* Copyright 2022 Google LLC
|
|
23
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
24
|
+
*/
|