timered-counter 1.2.0 → 1.3.0-beta.2
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/custom-elements.json +238 -63
- package/dist/custom-elements.json +238 -63
- package/dist/src/timered-counter-adapter.d.ts +2 -1
- package/dist/src/timered-counter-adapter.js +4 -1
- package/dist/src/timered-counter-adapter.js.map +1 -1
- package/dist/src/timered-counter-datetime-duration.js +5 -7
- package/dist/src/timered-counter-datetime-duration.js.map +1 -1
- package/dist/src/timered-counter-number.js +5 -7
- package/dist/src/timered-counter-number.js.map +1 -1
- package/dist/src/timered-counter-string.js +4 -8
- package/dist/src/timered-counter-string.js.map +1 -1
- package/dist/src/timered-counter.js +5 -7
- package/dist/src/timered-counter.js.map +1 -1
- package/dist/src/transitions/roller/roller-digit.js +5 -7
- package/dist/src/transitions/roller/roller-digit.js.map +1 -1
- package/dist/src/transitions/roller/roller.js +5 -7
- package/dist/src/transitions/roller/roller.js.map +1 -1
- package/dist/src/utils/grace-define-custom-element.d.ts +1 -0
- package/dist/src/utils/grace-define-custom-element.js +10 -0
- package/dist/src/utils/grace-define-custom-element.js.map +1 -0
- package/dist/src/wrappers/vue/format-props.d.ts +1 -0
- package/dist/src/wrappers/vue/format-props.js +22 -0
- package/dist/src/wrappers/vue/format-props.js.map +1 -0
- package/dist/src/wrappers/vue/index.d.ts +14 -0
- package/dist/src/wrappers/vue/index.js +13 -0
- package/dist/src/wrappers/vue/index.js.map +1 -0
- package/dist/src/wrappers/vue/timered-counter-datetime-duration.d.ts +14 -0
- package/dist/src/wrappers/vue/timered-counter-datetime-duration.js +39 -0
- package/dist/src/wrappers/vue/timered-counter-datetime-duration.js.map +1 -0
- package/dist/src/wrappers/vue/timered-counter-number.d.ts +14 -0
- package/dist/src/wrappers/vue/timered-counter-number.js +39 -0
- package/dist/src/wrappers/vue/timered-counter-number.js.map +1 -0
- package/dist/src/wrappers/vue/timered-counter-string.d.ts +14 -0
- package/dist/src/wrappers/vue/timered-counter-string.js +38 -0
- package/dist/src/wrappers/vue/timered-counter-string.js.map +1 -0
- package/dist/stories/timered-counter/decimaljs.stories.js +1 -1
- package/dist/stories/timered-counter/decimaljs.stories.js.map +1 -1
- package/dist/stories/timered-counter-number/decimaljs.stories.js +1 -1
- package/dist/stories/timered-counter-number/decimaljs.stories.js.map +1 -1
- package/dist/stories/timered-counter-string/decimaljs.stories.js +1 -1
- package/dist/stories/timered-counter-string/decimaljs.stories.js.map +1 -1
- package/dist/stories/timered-counter-string/grapheme-splitter.stories.js +2 -2
- package/dist/stories/timered-counter-string/grapheme-splitter.stories.js.map +1 -1
- package/dist/stories/timered-counter-string/intl-segmenter.stories.js +1 -1
- package/dist/stories/timered-counter-string/intl-segmenter.stories.js.map +1 -1
- package/dist/timered-counter.esm-browser.js +22 -27
- package/dist/timered-counter.esm-browser.js.map +1 -1
- package/dist/timered-counter.global.js +41 -46
- package/dist/timered-counter.global.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -8
@@ -27,17 +27,12 @@ let ot=class extends S{constructor(){super(...arguments),this.renderOptions={hos
|
|
27
27
|
* Copyright 2017 Google LLC
|
28
28
|
* SPDX-License-Identifier: BSD-3-Clause
|
29
29
|
*/
|
30
|
-
const lt=t
|
30
|
+
const lt={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:$},ct=(t=lt,e,i)=>{const{kind:s,metadata:r}=i;let n=globalThis.litPropertyMetadata.get(r);if(void 0===n&&globalThis.litPropertyMetadata.set(r,n=new Map),n.set(i.name,t),"accessor"===s){const{name:s}=i;return{set(i){const r=e.get.call(this);e.set.call(this,i),this.requestUpdate(s,r,t)},init(e){return void 0!==e&&this.P(s,void 0,t),e}}}if("setter"===s){const{name:s}=i;return function(i){const r=this[s];e.call(this,i),this.requestUpdate(s,r,t)}}throw Error("Unsupported decorator location: "+s)};function ht(t){return(e,i)=>"object"==typeof i?ct(t,e,i):((t,e,i)=>{const s=e.hasOwnProperty(i);return e.constructor.createProperty(i,s?{...t,wrapped:!0}:t),s?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)
|
31
31
|
/**
|
32
32
|
* @license
|
33
33
|
* Copyright 2017 Google LLC
|
34
34
|
* SPDX-License-Identifier: BSD-3-Clause
|
35
|
-
|
36
|
-
/**
|
37
|
-
* @license
|
38
|
-
* Copyright 2017 Google LLC
|
39
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
40
|
-
*/}function pt(t){return ut({...t,state:!0,attribute:!1})}
|
35
|
+
*/}function ut(t){return ht({...t,state:!0,attribute:!1})}
|
41
36
|
/**
|
42
37
|
* @license
|
43
38
|
* Copyright 2017 Google LLC
|
@@ -48,22 +43,22 @@ const lt=t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)
|
|
48
43
|
* Copyright 2017 Google LLC
|
49
44
|
* SPDX-License-Identifier: BSD-3-Clause
|
50
45
|
*/
|
51
|
-
function
|
46
|
+
function pt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i))(e,i,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}
|
52
47
|
/**
|
53
48
|
* @license
|
54
49
|
* Copyright 2017 Google LLC
|
55
50
|
* SPDX-License-Identifier: BSD-3-Clause
|
56
|
-
*/const
|
51
|
+
*/const dt=1,ft=2,mt=t=>(...e)=>({_$litDirective$:t,values:e});let _t=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
|
57
52
|
/**
|
58
53
|
* @license
|
59
54
|
* Copyright 2020 Google LLC
|
60
55
|
* SPDX-License-Identifier: BSD-3-Clause
|
61
|
-
*/const{I:
|
56
|
+
*/const{I:gt}=rt,yt=()=>document.createComment(""),At=(t,e,i)=>{const s=t._$AA.parentNode,r=void 0===e?t._$AB:e._$AA;if(void 0===i){const e=s.insertBefore(yt(),r),n=s.insertBefore(yt(),r);i=new gt(e,n,t,t.options)}else{const e=i._$AB.nextSibling,n=i._$AM,o=n!==t;if(o){let e;i._$AQ?.(t),i._$AM=t,void 0!==i._$AP&&(e=t._$AU)!==n._$AU&&i._$AP(e)}if(e!==r||o){let t=i._$AA;for(;t!==e;){const e=t.nextSibling;s.insertBefore(t,r),t=e}}}return i},bt=(t,e,i=t)=>(t._$AI(e,i),t),$t={},vt=t=>{t._$AP?.(!1,!0);let e=t._$AA;const i=t._$AB.nextSibling;for(;e!==i;){const t=e.nextSibling;e.remove(),e=t}},St=(t,e,i)=>{const s=new Map;for(let r=e;r<=i;r++)s.set(t[r],r);return s},wt=mt(class extends _t{constructor(t){if(super(t),t.type!==ft)throw Error("repeat() can only be used in text expressions")}dt(t,e,i){let s;void 0===i?i=e:void 0!==e&&(s=e);const r=[],n=[];let o=0;for(const e of t)r[o]=s?s(e,o):o,n[o]=i(e,o),o++;return{values:n,keys:r}}render(t,e,i){return this.dt(t,e,i).values}update(t,[e,i,s]){const r=(t=>t._$AH)(t),{values:n,keys:o}=this.dt(e,i,s);if(!Array.isArray(r))return this.ut=o,n;const a=this.ut??=[],l=[];let c,h,u=0,p=r.length-1,d=0,f=n.length-1;for(;u<=p&&d<=f;)if(null===r[u])u++;else if(null===r[p])p--;else if(a[u]===o[d])l[d]=bt(r[u],n[d]),u++,d++;else if(a[p]===o[f])l[f]=bt(r[p],n[f]),p--,f--;else if(a[u]===o[f])l[f]=bt(r[u],n[f]),At(t,l[f+1],r[u]),u++,f--;else if(a[p]===o[d])l[d]=bt(r[p],n[d]),At(t,r[u],r[p]),p--,d++;else if(void 0===c&&(c=St(o,d,f),h=St(a,u,p)),c.has(a[u]))if(c.has(a[p])){const e=h.get(o[d]),i=void 0!==e?r[e]:null;if(null===i){const e=At(t,r[u]);bt(e,n[d]),l[d]=e}else l[d]=bt(i,n[d]),At(t,r[u],i),r[e]=null;d++}else vt(r[p]),p--;else vt(r[u]),u++;for(;d<=f;){const e=At(t,l[f+1]);bt(e,n[d]),l[d++]=e}for(;u<=p;){const t=r[u++];null!==t&&vt(t)}return this.ut=o,((t,e=$t)=>{t._$AH=e})(t,l),F}});
|
62
57
|
/**
|
63
58
|
* @license
|
64
59
|
* Copyright 2017 Google LLC
|
65
60
|
* SPDX-License-Identifier: BSD-3-Clause
|
66
|
-
*/var Et={done:!0,hasNext:!1},Ot={done:!1,hasNext:!1},Ct=()=>Et;function Pt(t,...e){let i=t,s=e.map((t=>"lazy"in t?function(t){let{lazy:e,lazyArgs:i}=t,s=e(...i);return Object.assign(s,{isSingle:e.single??!1,index:0,items:[]})}(t):void 0)),r=0;for(;r<e.length;){if(void 0===s[r]||!Tt(i)){i=(0,e[r])(i),r+=1;continue}let t=[];for(let i=r;i<e.length;i++){let e=s[i];if(void 0===e||(t.push(e),e.isSingle))break}let n=[];for(let e of i)if(Dt(e,n,t))break;let{isSingle:o}=t.at(-1);i=o?n[0]:n,r+=t.length}return i}function Dt(t,e,i){if(0===i.length)return e.push(t),!1;let s=t,r=Ot,n=!1;for(let[t,o]of i.entries()){let{index:a,items:l}=o;if(l.push(s),r=o(s,a,l),o.index+=1,r.hasNext){if(r.hasMany){for(let s of r.next)if(Dt(s,e,i.slice(t+1)))return!0;return n}s=r.next}if(!r.hasNext)break;r.done&&(n=!0)}return r.hasNext&&e.push(s),n}function Tt(t){return"string"==typeof t||"object"==typeof t&&null!==t&&Symbol.iterator in t}function Mt(t,e,i){let s=t.length-e.length;if(0===s)return t(...e);if(1===s)return function(t,e,i){let s=i=>t(i,...e);return void 0===i?s:Object.assign(s,{lazy:i,lazyArgs:e})}(t,e,i);throw new Error("Wrong number of arguments")}function Nt(...t){return Mt(Rt,t)}var Rt=(t,e)=>t.length>=e;function kt(t,e){let i=[];for(let s=t;s<e;s++)i.push(s);return i}function Ut(t,e){if(!Nt(e,1))return{...t};if(!Nt(e,2)){let{[e[0]]:i,...s}=t;return s}let i={...t};for(let t of e)delete i[t];return i}function It(...t){return Mt(Lt,t)}var Lt=(t,e)=>({...t,...e});function Vt(...t){return Mt(jt,t,Ht)}var jt=(t,e)=>t.map(e),Ht=t=>(e,i,s)=>({done:!1,hasNext:!0,next:t(e,i,s)});function Bt(t){return"number"==typeof t&&!Number.isNaN(t)}function zt(t){return"string"==typeof t}function Ft(t){return void 0===t||("string"==typeof t||Array.isArray(t)?0===t.length:0===Object.keys(t).length)}function Yt(t){return null==t}function Wt(t){return Array.isArray(t)}function qt(t){return"boolean"==typeof t}function Qt(t){return t instanceof Date}function Kt(...t){return Mt(Gt,t)}function Gt(t,e){if(t===e||Object.is(t,e))return!0;if("object"!=typeof t||"object"!=typeof e||null===t||null===e||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;if(Array.isArray(t))return function(t,e){if(t.length!==e.length)return!1;for(let[i,s]of t.entries())if(!Gt(s,e[i]))return!1;return!0}(t,e);if(t instanceof Map)return function(t,e){if(t.size!==e.size)return!1;for(let[i,s]of t.entries())if(!e.has(i)||!Gt(s,e.get(i)))return!1;return!0}(t,e);if(t instanceof Set)return function(t,e){if(t.size!==e.size)return!1;let i=[...e];for(let e of t){let t=!1;for(let[s,r]of i.entries())if(Gt(e,r)){t=!0,i.splice(s,1);break}if(!t)return!1}return!0}(t,e);if(t instanceof Date)return t.getTime()===e.getTime();if(t instanceof RegExp)return t.toString()===e.toString();if(Object.keys(t).length!==Object.keys(e).length)return!1;for(let[i,s]of Object.entries(t))if(!(i in e)||!Gt(s,e[i]))return!1;return!0}function Jt(...t){return function(t,e){let i=e.length-t.length;if(1===i){let[i,...s]=e;return Pt(i,{lazy:t,lazyArgs:s})}if(0===i){let i={lazy:t,lazyArgs:e};return Object.assign((t=>Pt(t,i)),i)}throw new Error("Wrong number of arguments")}(Zt,t)}function Zt(t){if(0===t.length)return Ct;let e=new Map;for(let i of t)e.set(i,(e.get(i)??0)+1);return t=>{let i=e.get(t);return void 0===i||0===i?Ot:(1===i?e.delete(t):e.set(t,i-1),{hasNext:!0,next:t,done:0===e.size})}}function Xt(t,e){const i=function(t,e){return function(t){return"function"==typeof t}(t)?t(e):t}(t,e),{data:s}=e,r=[];for(let t=0;t<s.length;t+=1){const e=Wt(i)?i[t]:i;r.push(e)}return r}function te(t,e){const i=Xt(t,e),{data:s}=e,r=[];for(let t=0;t<s.length;t+=1){const{digits:e}=s[t],n=i[t];r.push([]);for(let i=0;i<e.length;i+=1){const e=Wt(n)?n[i]:n;r[t].push(e)}}return r}function ee(t,e){const i=te(t,e),{data:s}=e,r=[];for(let t=0;t<s.length;t+=1){const{digits:e}=s[t],n=i[t];r.push([]);for(let i=0;i<e.length;i+=1){const{data:s}=e[i],o=n[i];r[t].push([]);for(let e=0;e<s.length;e+=1){const s=Wt(o)?o[e]:o;r[t][i].push(s)}}}return r}function ie(t,e){return It(t??{},e??{})}function se(t=[],e=[]){const i=Array.from(new Set(Object.keys(t).concat(Object.keys(e))));for(const s of i){const i=Number.parseInt(s,10);t[i]=ie(t[i],e[i])}return t}function re(t=[],e=[]){const i=Array.from(new Set(Object.keys(t).concat(Object.keys(e))));for(const s of i){const i=Number.parseInt(s,10);t[i]=se(t[i],e[i])}return t}const ne=e=>{class i extends e{constructor(){super(...arguments),this.cellStyles={},this.cachedCellStyles=[],this.digitStyles={},this.cachedDigitStyles=[],this.partStyles={},this.cachedPartStyles=[],this.color="inherit"}extractCellStyles(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=function(t=[],e=[]){const i=Array.from(new Set(Object.keys(t).concat(Object.keys(e))));for(const s of i){const i=Number.parseInt(s,10);t[i]=re(t[i],e[i])}return t}(ee(this.cellStyles??{},t),ee(this.cellStylesDynamic??{},t));return Kt(this.cachedCellStyles,e)||(this.cachedCellStyles=e),this.cachedCellStyles}extractDigitStyles(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=re(te(this.digitStyles??{},t),te(this.digitStylesDynamic??{},t));return Kt(this.cachedDigitStyles,e)||(this.cachedDigitStyles=e),this.cachedDigitStyles}extractPartStyles(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=se(Xt(this.partStyles??{},t),Xt(this.partStylesDynamic??{},t));return Kt(this.cachedPartStyles,e)||(this.cachedPartStyles=e),this.cachedPartStyles}}return t([ut({type:Object,attribute:"cell-styles",reflect:!0})],i.prototype,"cellStyles",void 0),t([ut({type:Object,attribute:"digit-styles",reflect:!0})],i.prototype,"digitStyles",void 0),t([ut({type:Object,attribute:"part-styles",reflect:!0})],i.prototype,"partStyles",void 0),t([ut({type:String,reflect:!0})],i.prototype,"color",void 0),i};function oe(t){return t.length}function ae(){return function(t){if(!(r=t.length))return[];for(var e=-1,i=function(t,e){let i;if(void 0===e)for(const e of t)null!=e&&(i>e||void 0===i&&e>=e)&&(i=e);else{let s=-1;for(let r of t)null!=(r=e(r,++s,t))&&(i>r||void 0===i&&r>=r)&&(i=r)}return i}(t,oe),s=new Array(i);++e<i;)for(var r,n=-1,o=s[e]=new Array(r);++n<r;)o[n]=t[n][e];return s}(arguments)}function le(t,e){const[i,s]=t,[r,n]=e,o={animate:!0,cancelPrevAnimation:!1};let a="";return 1===r.data.length&&(o.animate=!1,o.cancelPrevAnimation=!0,a="only one digit"),i!==s||(r.data[0]===r.data[r.data.length-1]&&(o.animate=!1,o.cancelPrevAnimation=!0,a="same head and tail"),Kt(r,n)&&(o.animate=!1,a="same digits"),a&&(o.earlyReturn=a)),o}function ce(t){try{return JSON.parse(t)}catch(e){return t}}function he(t){const e={};return Wt(t.digitToChar)?t.digitToChar.forEach(((t,i)=>{var s;e[(s=i,String.fromCodePoint(s+48))]=t})):function(t){return"object"==typeof t&&null!==t}(t.digitToChar)&&Object.entries(t.digitToChar).forEach((([t,i])=>{e[t]=i})),{...t,digitToChar:e}}const ue=i=>{var s,r;class n extends i{constructor(){super(...arguments),r.set(this,{...s.DEFAULT_PARTS_OPTIONS}),this.parts=[],this.oldParts=[],this.partPreprocessDataList=[]}get partsOptions(){return e(this,r,"f")}set partsOptions(t){const i=e(this,r,"f");!function(t,e,i,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===s?r.call(t,i):r?r.value=i:e.set(t,i)}(this,r,he({...s.DEFAULT_PARTS_OPTIONS,...t}),"f"),this.requestUpdate("partsOptions",i)}sampling(t,e){return function(t,e,i,s){let r=s;const n=t.isInteger(e)&&t.isInteger(i)?function(t,e,i){return function(s){return t.round(t.add(t.mul(e,t.sub(t.create(1),s)),t.mul(i,s)))}}(t,e,i):function(t,e,i){return function(s){return t.add(t.mul(e,t.sub(t.create(1),s)),t.mul(i,s))}}(t,e,i);t.eq(e,i)&&(r=1);const o=[];for(let e=0;e<r;e++){const i=t.div(t.create(e),t.create(Math.max(r-1,1)));o.push(n(i))}return o}(this.numberAdapter,this.numberAdapter.max(t,e),this.numberAdapter.min(t,e),this.partsOptions.sampleCount)}sampleSplit(t){return[t.slice()]}sampleToString(t){return this.numberAdapter.toString(t)}shouldRebuildParts(t){return t.has("value")||t.has("partsOptions")}willUpdate(t){super.willUpdate(t),t.has("value")&&(this.oldParts=this.parts),this.shouldRebuildParts(t)&&(this.parts=this.processPartData()),t.has("value")&&(this.partPreprocessDataList=function(t,e,i,s){const r=[];let n=0;for(let o=0;o<e.length;o++){const a=e[o],l=s?.[o],c=[];for(let e=0;e<a.digits.length;e++){const s=a.digits[e],r=l?.digits.find((t=>t.place===s.place));c.push({...le([t,i],[s,r]),index:n++,partIndex:o,digitIndex:e})}r.push(c)}return r}(this.direction,this.parts,this.oldDirection,this.oldParts))}processPartData(){const{decimalSeparator:t,digitToChar:e,minPlaces:i,fillChar:s,type:r}=this.partsOptions,n=this.value,o=this.oldValue;let a=e=>this.sampleToString(e).split(t);"string"===r&&(a=t=>[this.sampleToString(t),""]);const l=[],c=this.sampleSplit(this.sampling(n,o));{const r=this.numberAdapter.gt(n,o)?"down":"up";for(let n=0;n<c.length;n++){const o=c[n],h=o["down"===r?0:o.length-1],[u=1,p=0]=i,d=a(h),f=Math.max(this.stringAdapter.stringToChars(d[0]).length,u),m=Math.max(this.stringAdapter.stringToChars(d[1]??"").length,p),_=ae(...o.map((e=>{const[i="",r=""]=a(e),n=this.stringAdapter.stringToChars(i),o=this.stringAdapter.stringToChars(r),l=Math.max(f-n.length,0),c=Math.max(m-o.length,0);let h=[].concat(new Array(l).fill(s),n);return m>0&&(h=h.concat([t],o,new Array(c).fill(s))),h}))).map(((t,i,s)=>({data:t.filter(((t,e,i)=>0===e||t!==i[e-1])).map((t=>e[t]??t)),place:s.length-i})));l.push({digits:_})}}return l}}return s=n,r=new WeakMap,n.DEFAULT_PARTS_OPTIONS={sampleCount:16,decimalSeparator:".",fillChar:"0",minPlaces:[1,0],digitToChar:{},type:"number"},t([ut({type:Object,attribute:"parts-options",converter:t=>ce(t??"")??{},noAccessor:!0})],n.prototype,"partsOptions",null),n},pe=()=>({create(t){const e=Number(t);return Number.isFinite(e)?e:0},add:(t,e)=>t+e,sub:(t,e)=>t-e,mul:(t,e)=>t*e,div:(t,e)=>t/e,compare:(t,e)=>t>e?1:t<e?-1:0,eq:(t,e)=>t===e,gt:(t,e)=>t>e,gte:(t,e)=>t>=e,lt:(t,e)=>t<e,lte:(t,e)=>t<=e,isInteger:t=>Number.isInteger(t),isNegative:t=>t<0,isPositive:t=>t>0,isZero:t=>0===t,isNaN:t=>Number.isNaN(t),isFinite:t=>Number.isFinite(t),abs:t=>Math.abs(t),ceil:t=>Math.ceil(t),floor:t=>Math.floor(t),round:t=>Math.round(t),max:(t,e)=>Math.max(t,e),min:(t,e)=>Math.min(t,e),toNumber:t=>Number(t),toString:t=>String(t)}),de=()=>({stringToChars:t=>Array.from(t)});class fe{static setNumberAdapter(t){let e=pe();if(zt(t)){for(const[i,s]of fe.AVAILABLE_NUMBER_ADAPTERS)if(i.includes(t)){e=s();break}}else e=t;fe.NUMBER_ADAPTER=e}static setStringAdapter(t){let e=de();if(zt(t)){for(const[i,s]of fe.AVAILABLE_STRING_ADAPTERS)if(i.includes(t)){e=s();break}}else e=t;fe.STRING_ADAPTER=e}static registerNumberAdapter(t,e){fe.AVAILABLE_NUMBER_ADAPTERS.set(t,e)}static registerStringAdapter(t,e){fe.AVAILABLE_STRING_ADAPTERS.set(t,e)}static registryAdapter(t){t.register(this)}}function me(...t){fe.setNumberAdapter(...t)}function _e(...t){fe.setStringAdapter(...t)}function ge(...t){fe.registerNumberAdapter(...t)}function ye(...t){fe.registerStringAdapter(...t)}fe.AVAILABLE_NUMBER_ADAPTERS=new Map([[["number"],pe]]),fe.AVAILABLE_STRING_ADAPTERS=new Map([[["string"],de],[["intl-segmenter"],t=>{const e=new Intl.Segmenter(t,{granularity:"grapheme"});return{stringToChars:t=>Array.from(e.segment(t)).map((t=>t.segment))}}]]),fe.NUMBER_ADAPTER=pe(),fe.STRING_ADAPTER=de(),fe.VALUE_CONVERTER={fromAttribute:t=>t,toAttribute:t=>Yt(t)?t:fe.NUMBER_ADAPTER.toString(t)};const Ae=e=>{class i extends e{get value(){return this.numberAdapter.create(this.__value)}set value(t){t=fe.NUMBER_ADAPTER.create(Yt(t)||zt(t)&&""===t.trim()?0:t);const e=this.__value;this.__value=t,this.numberAdapter.eq(this.__value,e)||this.requestUpdate("value",e)}get oldValue(){return this.numberAdapter.create(this.__oldValue)}set oldValue(t){const e=this.__oldValue;this.__oldValue=t,this.requestUpdate("oldValue",e)}get initialValue(){return Yt(this.__initialValue)?this.__initialValue:this.numberAdapter.create(this.__initialValue)}set initialValue(t){const e=this.__initialValue;this.__initialValue=t,this.requestUpdate("initialValue",e)}get locale(){return this.__locale}set locale(t){const e=this.__locale;this.__locale=t,this.requestUpdate("locale",e),this.localeInstance=zt(this.__locale)?new Intl.Locale(this.__locale):new Intl.Locale(...this.__locale)}constructor(...t){super(...t),this.__value=fe.NUMBER_ADAPTER.create(0),this.__oldValue=fe.NUMBER_ADAPTER.create(0),this.__initialValue=null,this.__locale="en-US",this.localeInstance=zt(this.locale)?new Intl.Locale(this.locale):new Intl.Locale(...this.locale),this.direction="up",this.oldDirection=this.direction,this.numberAdapter=fe.NUMBER_ADAPTER,this.stringAdapter=fe.STRING_ADAPTER}willUpdate(t){super.willUpdate(t),t.has("value")&&!t.has("oldValue")&&(this.oldValue=t.get("value")??this.value),this.oldDirection=this.direction,this.numberAdapter.eq(this.value,this.oldValue)||(this.direction=this.numberAdapter.gt(this.value,this.oldValue)?"down":"up")}connectedCallback(){super.connectedCallback(),this.oldValue=function(t){return null!=t}(this.initialValue)?this.initialValue:this.value}}return t([ut({attribute:"value",reflect:!0,converter:{toAttribute:fe.VALUE_CONVERTER.toAttribute},noAccessor:!0})],i.prototype,"value",null),t([ut({attribute:"old-value",reflect:!0,converter:fe.VALUE_CONVERTER,noAccessor:!0})],i.prototype,"oldValue",null),t([ut({attribute:"initial-value",reflect:!0,converter:fe.VALUE_CONVERTER,noAccessor:!0})],i.prototype,"initialValue",null),t([ut({converter:t=>{if(Yt(t))return t;try{return JSON.parse(t)}catch(e){return t}},reflect:!0,noAccessor:!0})],i.prototype,"locale",null),t([pt()],i.prototype,"direction",void 0),t([pt()],i.prototype,"oldDirection",void 0),i},be=a`
|
61
|
+
*/var xt={done:!0,hasNext:!1},Et={done:!1,hasNext:!1},Ot=()=>xt;function Ct(t,...e){let i=t,s=e.map((t=>"lazy"in t?function(t){let{lazy:e,lazyArgs:i}=t,s=e(...i);return Object.assign(s,{isSingle:e.single??!1,index:0,items:[]})}(t):void 0)),r=0;for(;r<e.length;){if(void 0===s[r]||!Dt(i)){i=(0,e[r])(i),r+=1;continue}let t=[];for(let i=r;i<e.length;i++){let e=s[i];if(void 0===e||(t.push(e),e.isSingle))break}let n=[];for(let e of i)if(Pt(e,n,t))break;let{isSingle:o}=t.at(-1);i=o?n[0]:n,r+=t.length}return i}function Pt(t,e,i){if(0===i.length)return e.push(t),!1;let s=t,r=Et,n=!1;for(let[t,o]of i.entries()){let{index:a,items:l}=o;if(l.push(s),r=o(s,a,l),o.index+=1,r.hasNext){if(r.hasMany){for(let s of r.next)if(Pt(s,e,i.slice(t+1)))return!0;return n}s=r.next}if(!r.hasNext)break;r.done&&(n=!0)}return r.hasNext&&e.push(s),n}function Dt(t){return"string"==typeof t||"object"==typeof t&&null!==t&&Symbol.iterator in t}function Tt(t,e,i){let s=t.length-e.length;if(0===s)return t(...e);if(1===s)return function(t,e,i){let s=i=>t(i,...e);return void 0===i?s:Object.assign(s,{lazy:i,lazyArgs:e})}(t,e,i);throw new Error("Wrong number of arguments")}function Mt(...t){return Tt(Nt,t)}var Nt=(t,e)=>t.length>=e;function Rt(t,e){let i=[];for(let s=t;s<e;s++)i.push(s);return i}function kt(t,e){if(!Mt(e,1))return{...t};if(!Mt(e,2)){let{[e[0]]:i,...s}=t;return s}let i={...t};for(let t of e)delete i[t];return i}function Ut(...t){return Tt(It,t)}var It=(t,e)=>({...t,...e});function Lt(...t){return Tt(Vt,t,jt)}var Vt=(t,e)=>t.map(e),jt=t=>(e,i,s)=>({done:!1,hasNext:!0,next:t(e,i,s)});function Ht(t){return"number"==typeof t&&!Number.isNaN(t)}function Bt(t){return"string"==typeof t}function zt(t){return void 0===t||("string"==typeof t||Array.isArray(t)?0===t.length:0===Object.keys(t).length)}function Ft(t){return null==t}function Yt(t){return Array.isArray(t)}function Wt(t){return"boolean"==typeof t}function qt(t){return t instanceof Date}function Qt(...t){return Tt(Kt,t)}function Kt(t,e){if(t===e||Object.is(t,e))return!0;if("object"!=typeof t||"object"!=typeof e||null===t||null===e||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;if(Array.isArray(t))return function(t,e){if(t.length!==e.length)return!1;for(let[i,s]of t.entries())if(!Kt(s,e[i]))return!1;return!0}(t,e);if(t instanceof Map)return function(t,e){if(t.size!==e.size)return!1;for(let[i,s]of t.entries())if(!e.has(i)||!Kt(s,e.get(i)))return!1;return!0}(t,e);if(t instanceof Set)return function(t,e){if(t.size!==e.size)return!1;let i=[...e];for(let e of t){let t=!1;for(let[s,r]of i.entries())if(Kt(e,r)){t=!0,i.splice(s,1);break}if(!t)return!1}return!0}(t,e);if(t instanceof Date)return t.getTime()===e.getTime();if(t instanceof RegExp)return t.toString()===e.toString();if(Object.keys(t).length!==Object.keys(e).length)return!1;for(let[i,s]of Object.entries(t))if(!(i in e)||!Kt(s,e[i]))return!1;return!0}function Gt(...t){return function(t,e){let i=e.length-t.length;if(1===i){let[i,...s]=e;return Ct(i,{lazy:t,lazyArgs:s})}if(0===i){let i={lazy:t,lazyArgs:e};return Object.assign((t=>Ct(t,i)),i)}throw new Error("Wrong number of arguments")}(Jt,t)}function Jt(t){if(0===t.length)return Ot;let e=new Map;for(let i of t)e.set(i,(e.get(i)??0)+1);return t=>{let i=e.get(t);return void 0===i||0===i?Et:(1===i?e.delete(t):e.set(t,i-1),{hasNext:!0,next:t,done:0===e.size})}}function Zt(t,e){const i=function(t,e){return function(t){return"function"==typeof t}(t)?t(e):t}(t,e),{data:s}=e,r=[];for(let t=0;t<s.length;t+=1){const e=Yt(i)?i[t]:i;r.push(e)}return r}function Xt(t,e){const i=Zt(t,e),{data:s}=e,r=[];for(let t=0;t<s.length;t+=1){const{digits:e}=s[t],n=i[t];r.push([]);for(let i=0;i<e.length;i+=1){const e=Yt(n)?n[i]:n;r[t].push(e)}}return r}function te(t,e){const i=Xt(t,e),{data:s}=e,r=[];for(let t=0;t<s.length;t+=1){const{digits:e}=s[t],n=i[t];r.push([]);for(let i=0;i<e.length;i+=1){const{data:s}=e[i],o=n[i];r[t].push([]);for(let e=0;e<s.length;e+=1){const s=Yt(o)?o[e]:o;r[t][i].push(s)}}}return r}function ee(t,e){return Ut(t??{},e??{})}function ie(t=[],e=[]){const i=Array.from(new Set(Object.keys(t).concat(Object.keys(e))));for(const s of i){const i=Number.parseInt(s,10);t[i]=ee(t[i],e[i])}return t}function se(t=[],e=[]){const i=Array.from(new Set(Object.keys(t).concat(Object.keys(e))));for(const s of i){const i=Number.parseInt(s,10);t[i]=ie(t[i],e[i])}return t}const re=e=>{class i extends e{constructor(){super(...arguments),this.cellStyles={},this.cachedCellStyles=[],this.digitStyles={},this.cachedDigitStyles=[],this.partStyles={},this.cachedPartStyles=[],this.color="inherit"}extractCellStyles(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=function(t=[],e=[]){const i=Array.from(new Set(Object.keys(t).concat(Object.keys(e))));for(const s of i){const i=Number.parseInt(s,10);t[i]=se(t[i],e[i])}return t}(te(this.cellStyles??{},t),te(this.cellStylesDynamic??{},t));return Qt(this.cachedCellStyles,e)||(this.cachedCellStyles=e),this.cachedCellStyles}extractDigitStyles(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=se(Xt(this.digitStyles??{},t),Xt(this.digitStylesDynamic??{},t));return Qt(this.cachedDigitStyles,e)||(this.cachedDigitStyles=e),this.cachedDigitStyles}extractPartStyles(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=ie(Zt(this.partStyles??{},t),Zt(this.partStylesDynamic??{},t));return Qt(this.cachedPartStyles,e)||(this.cachedPartStyles=e),this.cachedPartStyles}}return t([ht({type:Object,attribute:"cell-styles",reflect:!0})],i.prototype,"cellStyles",void 0),t([ht({type:Object,attribute:"digit-styles",reflect:!0})],i.prototype,"digitStyles",void 0),t([ht({type:Object,attribute:"part-styles",reflect:!0})],i.prototype,"partStyles",void 0),t([ht({type:String,reflect:!0})],i.prototype,"color",void 0),i};function ne(t){return t.length}function oe(){return function(t){if(!(r=t.length))return[];for(var e=-1,i=function(t,e){let i;if(void 0===e)for(const e of t)null!=e&&(i>e||void 0===i&&e>=e)&&(i=e);else{let s=-1;for(let r of t)null!=(r=e(r,++s,t))&&(i>r||void 0===i&&r>=r)&&(i=r)}return i}(t,ne),s=new Array(i);++e<i;)for(var r,n=-1,o=s[e]=new Array(r);++n<r;)o[n]=t[n][e];return s}(arguments)}function ae(t,e){const[i,s]=t,[r,n]=e,o={animate:!0,cancelPrevAnimation:!1};let a="";return 1===r.data.length&&(o.animate=!1,o.cancelPrevAnimation=!0,a="only one digit"),i!==s||(r.data[0]===r.data[r.data.length-1]&&(o.animate=!1,o.cancelPrevAnimation=!0,a="same head and tail"),Qt(r,n)&&(o.animate=!1,a="same digits"),a&&(o.earlyReturn=a)),o}function le(t){try{return JSON.parse(t)}catch(e){return t}}function ce(t){const e={};return Yt(t.digitToChar)?t.digitToChar.forEach(((t,i)=>{var s;e[(s=i,String.fromCodePoint(s+48))]=t})):function(t){return"object"==typeof t&&null!==t}(t.digitToChar)&&Object.entries(t.digitToChar).forEach((([t,i])=>{e[t]=i})),{...t,digitToChar:e}}const he=i=>{var s,r;class n extends i{constructor(){super(...arguments),r.set(this,{...s.DEFAULT_PARTS_OPTIONS}),this.parts=[],this.oldParts=[],this.partPreprocessDataList=[]}get partsOptions(){return e(this,r,"f")}set partsOptions(t){const i=e(this,r,"f");!function(t,e,i,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===s?r.call(t,i):r?r.value=i:e.set(t,i)}(this,r,ce({...s.DEFAULT_PARTS_OPTIONS,...t}),"f"),this.requestUpdate("partsOptions",i)}sampling(t,e){return function(t,e,i,s){let r=s;const n=t.isInteger(e)&&t.isInteger(i)?function(t,e,i){return function(s){return t.round(t.add(t.mul(e,t.sub(t.create(1),s)),t.mul(i,s)))}}(t,e,i):function(t,e,i){return function(s){return t.add(t.mul(e,t.sub(t.create(1),s)),t.mul(i,s))}}(t,e,i);t.eq(e,i)&&(r=1);const o=[];for(let e=0;e<r;e++){const i=t.div(t.create(e),t.create(Math.max(r-1,1)));o.push(n(i))}return o}(this.numberAdapter,this.numberAdapter.max(t,e),this.numberAdapter.min(t,e),this.partsOptions.sampleCount)}sampleSplit(t){return[t.slice()]}sampleToString(t){return this.numberAdapter.toString(t)}shouldRebuildParts(t){return t.has("value")||t.has("partsOptions")}willUpdate(t){super.willUpdate(t),t.has("value")&&(this.oldParts=this.parts),this.shouldRebuildParts(t)&&(this.parts=this.processPartData()),t.has("value")&&(this.partPreprocessDataList=function(t,e,i,s){const r=[];let n=0;for(let o=0;o<e.length;o++){const a=e[o],l=s?.[o],c=[];for(let e=0;e<a.digits.length;e++){const s=a.digits[e],r=l?.digits.find((t=>t.place===s.place));c.push({...ae([t,i],[s,r]),index:n++,partIndex:o,digitIndex:e})}r.push(c)}return r}(this.direction,this.parts,this.oldDirection,this.oldParts))}processPartData(){const{decimalSeparator:t,digitToChar:e,minPlaces:i,fillChar:s,type:r}=this.partsOptions,n=this.value,o=this.oldValue;let a=e=>this.sampleToString(e).split(t);"string"===r&&(a=t=>[this.sampleToString(t),""]);const l=[],c=this.sampleSplit(this.sampling(n,o));{const r=this.numberAdapter.gt(n,o)?"down":"up";for(let n=0;n<c.length;n++){const o=c[n],h=o["down"===r?0:o.length-1],[u=1,p=0]=i,d=a(h),f=Math.max(this.stringAdapter.stringToChars(d[0]).length,u),m=Math.max(this.stringAdapter.stringToChars(d[1]??"").length,p),_=oe(...o.map((e=>{const[i="",r=""]=a(e),n=this.stringAdapter.stringToChars(i),o=this.stringAdapter.stringToChars(r),l=Math.max(f-n.length,0),c=Math.max(m-o.length,0);let h=[].concat(new Array(l).fill(s),n);return m>0&&(h=h.concat([t],o,new Array(c).fill(s))),h}))).map(((t,i,s)=>({data:t.filter(((t,e,i)=>0===e||t!==i[e-1])).map((t=>e[t]??t)),place:s.length-i})));l.push({digits:_})}}return l}}return s=n,r=new WeakMap,n.DEFAULT_PARTS_OPTIONS={sampleCount:16,decimalSeparator:".",fillChar:"0",minPlaces:[1,0],digitToChar:{},type:"number"},t([ht({type:Object,attribute:"parts-options",converter:t=>le(t??"")??{},noAccessor:!0})],n.prototype,"partsOptions",null),n},ue=()=>({create(t){const e=Number(t);return Number.isFinite(e)?e:0},add:(t,e)=>t+e,sub:(t,e)=>t-e,mul:(t,e)=>t*e,div:(t,e)=>t/e,compare:(t,e)=>t>e?1:t<e?-1:0,eq:(t,e)=>t===e,gt:(t,e)=>t>e,gte:(t,e)=>t>=e,lt:(t,e)=>t<e,lte:(t,e)=>t<=e,isInteger:t=>Number.isInteger(t),isNegative:t=>t<0,isPositive:t=>t>0,isZero:t=>0===t,isNaN:t=>Number.isNaN(t),isFinite:t=>Number.isFinite(t),abs:t=>Math.abs(t),ceil:t=>Math.ceil(t),floor:t=>Math.floor(t),round:t=>Math.round(t),max:(t,e)=>Math.max(t,e),min:(t,e)=>Math.min(t,e),toNumber:t=>Number(t),toString:t=>String(t)}),pe=()=>({stringToChars:t=>Array.from(t)});class de{static setNumberAdapter(t){let e=ue();if(Bt(t)){for(const[i,s]of de.AVAILABLE_NUMBER_ADAPTERS)if(i.includes(t)){e=s();break}}else e=t;de.NUMBER_ADAPTER=e}static setStringAdapter(t){let e=pe();if(Bt(t)){for(const[i,s]of de.AVAILABLE_STRING_ADAPTERS)if(i.includes(t)){e=s();break}}else e=t;de.STRING_ADAPTER=e}static registerNumberAdapter(t,e){de.AVAILABLE_NUMBER_ADAPTERS.set(t,e)}static registerStringAdapter(t,e){de.AVAILABLE_STRING_ADAPTERS.set(t,e)}static registerAdapter(t){t.register(this)}}function fe(...t){de.setNumberAdapter(...t)}function me(...t){de.setStringAdapter(...t)}function _e(...t){de.registerNumberAdapter(...t)}function ge(...t){de.registerStringAdapter(...t)}function ye(...t){de.registerAdapter(...t)}de.AVAILABLE_NUMBER_ADAPTERS=new Map([[["number"],ue]]),de.AVAILABLE_STRING_ADAPTERS=new Map([[["string"],pe],[["intl-segmenter"],t=>{const e=new Intl.Segmenter(t,{granularity:"grapheme"});return{stringToChars:t=>Array.from(e.segment(t)).map((t=>t.segment))}}]]),de.NUMBER_ADAPTER=ue(),de.STRING_ADAPTER=pe(),de.VALUE_CONVERTER={fromAttribute:t=>t,toAttribute:t=>Ft(t)?t:de.NUMBER_ADAPTER.toString(t)};const Ae=e=>{class i extends e{get value(){return this.numberAdapter.create(this.__value)}set value(t){t=de.NUMBER_ADAPTER.create(Ft(t)||Bt(t)&&""===t.trim()?0:t);const e=this.__value;this.__value=t,this.numberAdapter.eq(this.__value,e)||this.requestUpdate("value",e)}get oldValue(){return this.numberAdapter.create(this.__oldValue)}set oldValue(t){const e=this.__oldValue;this.__oldValue=t,this.requestUpdate("oldValue",e)}get initialValue(){return Ft(this.__initialValue)?this.__initialValue:this.numberAdapter.create(this.__initialValue)}set initialValue(t){const e=this.__initialValue;this.__initialValue=t,this.requestUpdate("initialValue",e)}get locale(){return this.__locale}set locale(t){const e=this.__locale;this.__locale=t,this.requestUpdate("locale",e),this.localeInstance=Bt(this.__locale)?new Intl.Locale(this.__locale):new Intl.Locale(...this.__locale)}constructor(...t){super(...t),this.__value=de.NUMBER_ADAPTER.create(0),this.__oldValue=de.NUMBER_ADAPTER.create(0),this.__initialValue=null,this.__locale="en-US",this.localeInstance=Bt(this.locale)?new Intl.Locale(this.locale):new Intl.Locale(...this.locale),this.direction="up",this.oldDirection=this.direction,this.numberAdapter=de.NUMBER_ADAPTER,this.stringAdapter=de.STRING_ADAPTER}willUpdate(t){super.willUpdate(t),t.has("value")&&!t.has("oldValue")&&(this.oldValue=t.get("value")??this.value),this.oldDirection=this.direction,this.numberAdapter.eq(this.value,this.oldValue)||(this.direction=this.numberAdapter.gt(this.value,this.oldValue)?"down":"up")}connectedCallback(){super.connectedCallback(),this.oldValue=function(t){return null!=t}(this.initialValue)?this.initialValue:this.value}}return t([ht({attribute:"value",reflect:!0,converter:{toAttribute:de.VALUE_CONVERTER.toAttribute},noAccessor:!0})],i.prototype,"value",null),t([ht({attribute:"old-value",reflect:!0,converter:de.VALUE_CONVERTER,noAccessor:!0})],i.prototype,"oldValue",null),t([ht({attribute:"initial-value",reflect:!0,converter:de.VALUE_CONVERTER,noAccessor:!0})],i.prototype,"initialValue",null),t([ht({converter:t=>{if(Ft(t))return t;try{return JSON.parse(t)}catch(e){return t}},reflect:!0,noAccessor:!0})],i.prototype,"locale",null),t([ut()],i.prototype,"direction",void 0),t([ut()],i.prototype,"oldDirection",void 0),i},be=a`
|
67
62
|
:host {
|
68
63
|
position: relative;
|
69
64
|
white-space: nowrap;
|
@@ -92,7 +87,7 @@ function dt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
92
87
|
// font-size: 0.4em;
|
93
88
|
// line-height: 1;
|
94
89
|
//}
|
95
|
-
`,$e=e=>{class i extends e{constructor(){super(...arguments),this.animationOptions={},this.cachedAnimationOptions=[],this.keyframes={},this.cachedKeyframes=[]}extractAnimationOptions(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=
|
90
|
+
`,$e=e=>{class i extends e{constructor(){super(...arguments),this.animationOptions={},this.cachedAnimationOptions=[],this.keyframes={},this.cachedKeyframes=[]}extractAnimationOptions(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=se(Xt(this.animationOptions??{},t),Xt(this.animationOptionsDynamic??{},t));return Qt(this.cachedAnimationOptions,e)||(this.cachedAnimationOptions=e),this.cachedAnimationOptions}extractKeyframes(){const t={preprocessData:this.partPreprocessDataList,data:this.parts,direction:this.direction,value:[this.value,this.oldValue]},e=se(Xt(this.keyframes??{},t),Xt(this.keyframesDynamic??{},t));return Qt(this.cachedKeyframes,e)||(this.cachedKeyframes=e),this.cachedKeyframes}}return t([ht({type:Object,attribute:"animation-options",reflect:!0})],i.prototype,"animationOptions",void 0),t([ht({type:Object,attribute:"keyframes",reflect:!0})],i.prototype,"keyframes",void 0),i},ve="important",Se=" !"+ve,we=mt(class extends _t{constructor(t){if(super(t),t.type!==dt||"style"!==t.name||t.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(t){return Object.keys(t).reduce(((e,i)=>{const s=t[i];return null==s?e:e+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${s};`}),"")}update(t,[e]){const{style:i}=t.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(e)),this.render(e);for(const t of this.ft)null==e[t]&&(this.ft.delete(t),t.includes("-")?i.removeProperty(t):i[t]=null);for(const t in e){const s=e[t];if(null!=s){this.ft.add(t);const e="string"==typeof s&&s.endsWith(Se);t.includes("-")||e?i.setProperty(t,e?s.slice(0,-11):s,e?ve:""):i[t]=s}}return F}}),xe=mt(class extends _t{constructor(t){if(super(t),t.type!==dt||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return" "+Object.keys(t).filter((e=>t[e])).join(" ")+" "}update(t,[e]){if(void 0===this.st){this.st=new Set,void 0!==t.strings&&(this.nt=new Set(t.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in e)e[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(e)}const i=t.element.classList;for(const t of this.st)t in e||(i.remove(t),this.st.delete(t));for(const t in e){const s=!!e[t];s===this.st.has(t)||this.nt?.has(t)||(s?(i.add(t),this.st.add(t)):(i.remove(t),this.st.delete(t)))}return F}}),Ee=a`
|
96
91
|
:host {
|
97
92
|
display: inline-flex;
|
98
93
|
overflow: hidden;
|
@@ -181,7 +176,7 @@ function dt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
181
176
|
position: absolute;
|
182
177
|
bottom: 100%;
|
183
178
|
}
|
184
|
-
`,Ce=t=>t,Pe=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function De(t,e,i,s){if(t===e&&i===s)return Ce;const r=e=>function(t,e,i,s,r){let n,o,a=0;do{o=e+(i-e)/2,n=Pe(o,s,r)-t,n>0?i=o:e=o}while(Math.abs(n)>1e-7&&++a<12);return o}(e,0,1,t,i);return t=>0===t||1===t?t:Pe(r(t),e,s)}const Te=De(.12,0,.39,0),Me=De(.61,1,.88,1),Ne=De(.37,0,.63,1),Re=De(.11,0,.5,0),ke=De(.5,1,.89,1),Ue=De(.45,0,.55,1),Ie=De(.32,0,.67,0),Le=De(.33,1,.68,1),Ve=De(.65,0,.35,1),je=De(.5,0,.75,0),He=De(.25,1,.5,1),Be=De(.76,0,.24,1),ze=De(.64,0,.78,0),Fe=De(.22,1,.36,1),Ye=De(.83,0,.17,1),We=De(.7,0,.84,0),qe=De(.16,1,.3,1),Qe=De(.87,0,.13,1),Ke=De(.55,0,1,.45),Ge=De(0,.55,.45,1),Je=De(.85,0,.15,1),Ze=De(.36,0,.66,-.56),Xe=De(.34,1.56,.64,1),ti=De(.68,-.6,.32,1.6);function ei(t){const e=2*Math.PI/3;return 0===t?0:1===t?1:-(2**(10*t-10))*Math.sin((10*t-10.75)*e)}function ii(t){const e=2*Math.PI/3;return 0===t?0:1===t?1:2**(-10*t)*Math.sin((10*t-.75)*e)+1}function si(t){const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-(2**(20*t-10))*Math.sin((20*t-11.125)*e)/2:2**(-20*t+10)*Math.sin((20*t-11.125)*e)/2+1}function ri(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375}function ni(t){return 1-ri(1-t)}function oi(t){return t<.5?(1-ri(1-2*t))/2:(1+ri(2*t-1))/2}var ai=Object.freeze({__proto__:null,easeInBack:Ze,easeInBounce:ni,easeInCirc:Ke,easeInCubic:Ie,easeInElastic:ei,easeInExpo:We,easeInOutBack:ti,easeInOutBounce:oi,easeInOutCirc:Je,easeInOutCubic:Ve,easeInOutElastic:si,easeInOutExpo:Qe,easeInOutQuad:Ue,easeInOutQuart:Be,easeInOutQuint:Ye,easeInOutSine:Ne,easeInQuad:Re,easeInQuart:je,easeInQuint:ze,easeInSine:Te,easeOutBack:Xe,easeOutBounce:ri,easeOutCirc:Ge,easeOutCubic:Le,easeOutElastic:ii,easeOutExpo:qe,easeOutQuad:ke,easeOutQuart:He,easeOutQuint:Fe,easeOutSine:Me});
|
179
|
+
`,Ce=t=>t,Pe=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function De(t,e,i,s){if(t===e&&i===s)return Ce;const r=e=>function(t,e,i,s,r){let n,o,a=0;do{o=e+(i-e)/2,n=Pe(o,s,r)-t,n>0?i=o:e=o}while(Math.abs(n)>1e-7&&++a<12);return o}(e,0,1,t,i);return t=>0===t||1===t?t:Pe(r(t),e,s)}const Te=De(.12,0,.39,0),Me=De(.61,1,.88,1),Ne=De(.37,0,.63,1),Re=De(.11,0,.5,0),ke=De(.5,1,.89,1),Ue=De(.45,0,.55,1),Ie=De(.32,0,.67,0),Le=De(.33,1,.68,1),Ve=De(.65,0,.35,1),je=De(.5,0,.75,0),He=De(.25,1,.5,1),Be=De(.76,0,.24,1),ze=De(.64,0,.78,0),Fe=De(.22,1,.36,1),Ye=De(.83,0,.17,1),We=De(.7,0,.84,0),qe=De(.16,1,.3,1),Qe=De(.87,0,.13,1),Ke=De(.55,0,1,.45),Ge=De(0,.55,.45,1),Je=De(.85,0,.15,1),Ze=De(.36,0,.66,-.56),Xe=De(.34,1.56,.64,1),ti=De(.68,-.6,.32,1.6);function ei(t){const e=2*Math.PI/3;return 0===t?0:1===t?1:-(2**(10*t-10))*Math.sin((10*t-10.75)*e)}function ii(t){const e=2*Math.PI/3;return 0===t?0:1===t?1:2**(-10*t)*Math.sin((10*t-.75)*e)+1}function si(t){const e=2*Math.PI/4.5;return 0===t?0:1===t?1:t<.5?-(2**(20*t-10))*Math.sin((20*t-11.125)*e)/2:2**(-20*t+10)*Math.sin((20*t-11.125)*e)/2+1}function ri(t){const e=7.5625,i=2.75;return t<1/i?e*t*t:t<2/i?e*(t-=1.5/i)*t+.75:t<2.5/i?e*(t-=2.25/i)*t+.9375:e*(t-=2.625/i)*t+.984375}function ni(t){return 1-ri(1-t)}function oi(t){return t<.5?(1-ri(1-2*t))/2:(1+ri(2*t-1))/2}var ai=Object.freeze({__proto__:null,easeInBack:Ze,easeInBounce:ni,easeInCirc:Ke,easeInCubic:Ie,easeInElastic:ei,easeInExpo:We,easeInOutBack:ti,easeInOutBounce:oi,easeInOutCirc:Je,easeInOutCubic:Ve,easeInOutElastic:si,easeInOutExpo:Qe,easeInOutQuad:Ue,easeInOutQuart:Be,easeInOutQuint:Ye,easeInOutSine:Ne,easeInQuad:Re,easeInQuart:je,easeInQuint:ze,easeInSine:Te,easeOutBack:Xe,easeOutBounce:ri,easeOutCirc:Ge,easeOutCubic:Le,easeOutElastic:ii,easeOutExpo:qe,easeOutQuad:ke,easeOutQuart:He,easeOutQuint:Fe,easeOutSine:Me});function li(t,e){"undefined"!=typeof customElements&&(customElements.get(t)||customElements.define(t,e))}class ci extends Event{}class hi extends ot{constructor(){super(),this.digit={data:[],place:0},this.preprocessData={animate:!0,cancelPrevAnimation:!1,earlyReturn:"",index:0,partIndex:0,digitIndex:0},this.direction="up",this.textStyle={},this.cellStyle=[],this.animationOptions={},this.keyframes={},this.digitWidth=0,this.resizeObserver=new ResizeObserver((()=>{this.digitWidth=this.clonedRollDigitList?this.clonedRollDigitList.offsetWidth:0}))}firstUpdated(t){super.firstUpdated(t),this.clonedRollDigitList&&this.resizeObserver.observe(this.clonedRollDigitList)}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver.disconnect()}updated(t){super.updated(t),Gt(Array.from(t.keys()),["digit","preprocessData","direction","animationOptions","keyframes"]).length>0&&this.shouldAnimate()&&this.startAnimation().then()}render(){const t=this.cellStyle.map((t=>function(...t){return Tt(kt,t)}(t,["position"])));return z`<span class="roller-part-digit">
|
185
180
|
<!-- 占位 -->
|
186
181
|
<span
|
187
182
|
class="placeholder"
|
@@ -190,14 +185,14 @@ function dt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
190
185
|
>
|
191
186
|
<!-- 一个不可见的滚动列表的复制, 用于计算该列表的最大宽度. -->
|
192
187
|
<span class="roll-list__shadow">
|
193
|
-
${
|
188
|
+
${wt(this.digit.data,((t,e)=>e),((e,i)=>z`<span style=${we(t[i])}
|
194
189
|
>${e}</span
|
195
190
|
>`))}
|
196
191
|
</span>
|
197
192
|
<span
|
198
193
|
class=${xe({"roll-list__up":"up"===this.direction,"roll-list__down":"down"===this.direction,"roll-list":!0})}
|
199
194
|
>
|
200
|
-
${this.digit.data.length>1?
|
195
|
+
${this.digit.data.length>1?wt(this.digit.data,((t,e)=>e),((t,e)=>"up"===this.direction&&e===this.digit.data.length-1?z`<span
|
201
196
|
part="cell"
|
202
197
|
class="roll-item roll-item__head"
|
203
198
|
style=${we(this.cellStyle[e])}
|
@@ -229,7 +224,7 @@ function dt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
229
224
|
></span
|
230
225
|
>`}</span
|
231
226
|
></span
|
232
|
-
> `}shouldAnimate(){const{cancelPrevAnimation:t,animate:e}=this.preprocessData;return t&&(this.animation&&this.animation.cancel(),this.rollList&&this.rollList.style&&this.rollList.style.cssText&&(this.rollList.style.cssText="")),!!e}async startAnimation(){if(
|
227
|
+
> `}shouldAnimate(){const{cancelPrevAnimation:t,animate:e}=this.preprocessData;return t&&(this.animation&&this.animation.cancel(),this.rollList&&this.rollList.style&&this.rollList.style.cssText&&(this.rollList.style.cssText="")),!!e}async startAnimation(){if(Ft(this.rollList))return;this.__emitAnimationStart();const t=Ut({duration:1e3,iterations:1,easing:"ease-out",fill:"forwards"},this.animationOptions),e=zt(this.keyframes)?{up:{transform:["translateY(0)","translateY(-100%)"]},down:{transform:["translateY(0)","translateY(100%)"]}}[this.direction]:this.keyframes;if(Bt(t.easing)&&ai[t.easing]){const e=ai[t.easing];t.easing=`linear(${function(...t){return Tt(Rt,t)}(0,64).map(((t,i)=>e(i/63))).join(",")})`}try{this.clearAnimation(),this.animation=this.rollList.animate(e,t),this.animation.addEventListener("finish",(()=>this.__emitAnimationEnd()),{once:!0})}catch(t){console.error(t)}}clearAnimation(){this.animation?.removeEventListener("finish",this.__emitAnimationEnd),this.animation?.cancel()}__emitAnimationStart(){this.isConnected&&this.dispatchEvent(new ci("roller-digit-animation-start"))}__emitAnimationEnd(){this.isConnected&&this.dispatchEvent(new ci("roller-digit-animation-end"))}}hi.styles=[Oe],t([ht({type:Object})],hi.prototype,"digit",void 0),t([ht({type:Object})],hi.prototype,"preprocessData",void 0),t([ht({type:String})],hi.prototype,"direction",void 0),t([ht({type:Object})],hi.prototype,"textStyle",void 0),t([ht({type:Array})],hi.prototype,"cellStyle",void 0),t([ht({type:Object})],hi.prototype,"animationOptions",void 0),t([ht({type:Object})],hi.prototype,"keyframes",void 0),t([pt(".roll-list__shadow")],hi.prototype,"clonedRollDigitList",void 0),t([pt(".roll-list")],hi.prototype,"rollList",void 0),t([ut()],hi.prototype,"digitWidth",void 0),li("timered-counter-roller-digit",hi);class ui extends Event{}class pi extends ot{constructor(){super(...arguments),this.color="",this.direction="up",this.parts=[],this.partPreprocessDataList=[],this.animationOptions=[],this.keyframes=[],this.cellStyles=[],this.digitStyles=[],this.partStyles=[],this.parentContainerRect={},this.__partDigitsColorStyles=[],this.digitAnimateEndCount=0,this.digitAnimatedCount=0}render(){return z`<span
|
233
228
|
class="roller__prefix"
|
234
229
|
data-part-id="-1"
|
235
230
|
data-digit-id="0"
|
@@ -238,11 +233,11 @@ function dt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
238
233
|
<slot part="prefix" name="prefix"></slot>
|
239
234
|
</span>
|
240
235
|
<span class="counter-parts">
|
241
|
-
${
|
236
|
+
${wt(this.parts,((t,e)=>e),((t,e)=>z`<span
|
242
237
|
part="part"
|
243
238
|
class="roller-part"
|
244
239
|
style=${we(this.partStyles?.[e]??{})}
|
245
|
-
>${
|
240
|
+
>${wt(t.digits,((e,i)=>""+(t.digits.length-i)),((t,i)=>z`<timered-counter-roller-digit
|
246
241
|
exportparts="digit, cell"
|
247
242
|
part="digit"
|
248
243
|
class="roller-part__wrapper"
|
@@ -274,7 +269,7 @@ function dt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
274
269
|
data-digit-id="0"
|
275
270
|
style=${we(this.__partDigitsColorStyles?.[-2]?.[0]??{})}
|
276
271
|
><slot part="suffix" name="suffix"></slot
|
277
|
-
></span>`}willUpdate(t){super.willUpdate(t),(t.has("direction")||t.has("parts"))&&(this.digitAnimateEndCount=0,this.digitAnimatedCount=this.partPreprocessDataList.flat().filter((({animate:t})=>t)).length,this.digitAnimatedCount>0&&this.__emitAnimationStart()),this.__partDigitsColorStyles=this.__generatePartDigitsColorStyles()}__handleDigitAnimationEnd(){this.digitAnimateEndCount++,this.digitAnimateEndCount<this.digitAnimatedCount||this.__emitAnimationEnd()}__emitAnimationStart(){this.isConnected&&this.dispatchEvent(new
|
272
|
+
></span>`}willUpdate(t){super.willUpdate(t),(t.has("direction")||t.has("parts"))&&(this.digitAnimateEndCount=0,this.digitAnimatedCount=this.partPreprocessDataList.flat().filter((({animate:t})=>t)).length,this.digitAnimatedCount>0&&this.__emitAnimationStart()),this.__partDigitsColorStyles=this.__generatePartDigitsColorStyles()}__handleDigitAnimationEnd(){this.digitAnimateEndCount++,this.digitAnimateEndCount<this.digitAnimatedCount||this.__emitAnimationEnd()}__emitAnimationStart(){this.isConnected&&this.dispatchEvent(new ui("roller-animation-start"))}__emitAnimationEnd(){this.isConnected&&this.dispatchEvent(new ui("roller-animation-end"))}__generatePartDigitsColorStyles(){const t=[],e=this.parentContainerRect,{prefixContainer:i,suffixContainer:s,color:r}=this,n=Array.from(this.shadowRoot?.querySelectorAll("[data-part-id]").values()??[]);if(!e)return t;i&&(n[-1]=i),s&&(n[-2]=s);for(const e of function(...t){return Tt(Object.values,t)}(n)){const i=Number.parseInt(e.dataset.partId??"-1",10),s=Number.parseInt(e.dataset.digitId??"-1",10);if(!Ht(i)||!Ht(s))throw new Error("The data-part-id and data-digit-id attributes are required.");t[i]||(t[i]=[]),CSS.supports("color",r)?t[i][s]={color:r}:CSS.supports("background-image",r)?t[i][s]={backgroundImage:r,backgroundClip:"text",backgroundSize:`${this.offsetWidth}px ${this.offsetHeight}px`,backgroundPositionX:-e.offsetLeft+"px",backgroundPositionY:-e.offsetTop+"px",backgroundRepeat:"no-repeat",color:"transparent","-webkit-text-fill-color":"transparent"}:(t[i][s]={},console.warn(new Error("The color property is not supported.")))}return t}}pi.styles=[Ee],t([ht({type:String})],pi.prototype,"color",void 0),t([ht({type:String})],pi.prototype,"direction",void 0),t([ht({type:Array})],pi.prototype,"parts",void 0),t([ht({type:Array})],pi.prototype,"partPreprocessDataList",void 0),t([ht({type:Array})],pi.prototype,"animationOptions",void 0),t([ht({type:Array})],pi.prototype,"keyframes",void 0),t([ht({type:Array})],pi.prototype,"cellStyles",void 0),t([ht({type:Array})],pi.prototype,"digitStyles",void 0),t([ht({type:Array})],pi.prototype,"partStyles",void 0),t([ht({type:Object})],pi.prototype,"parentContainerRect",void 0),t([pt(".roller__prefix")],pi.prototype,"prefixContainer",void 0),t([pt(".roller__suffix")],pi.prototype,"suffixContainer",void 0),li("timered-counter-roller",pi);const di=e=>{class i extends e{constructor(){super(...arguments),this.ariaLabel="",this.ariaLive="polite"}generateAriaLabel(){let t="";const{direction:e}=this;for(const i of this.parts)for(const s of i.digits)t+=`${s.data["up"===e?s.data.length-1:0]}`;return t}willUpdate(t){super.willUpdate(t),this.ariaLabel=this.generateAriaLabel()}}return t([ht({attribute:"aria-label",reflect:!0})],i.prototype,"ariaLabel",void 0),t([ht({attribute:"aira-live",reflect:!0})],i.prototype,"ariaLive",void 0),i};class fi extends Event{}class mi extends(di($e(re(he(Ae(ot)))))){constructor(){super(),this.resizeObserver=new ResizeObserver((()=>{this.partsContainerRect=this.partsContainer?this.partsContainer.getBoundingClientRect():new DOMRect}))}firstUpdated(t){super.firstUpdated(t),this.partsContainer&&this.resizeObserver.observe(this.partsContainer)}render(){const t=this.extractCellStyles(),e=this.extractDigitStyles(),i=this.extractPartStyles(),s=this.extractAnimationOptions(),r=this.extractKeyframes();return z`
|
278
273
|
<timered-counter-roller
|
279
274
|
exportparts="group, part, digit, cell, prefix, suffix, part-suffix"
|
280
275
|
part="group"
|
@@ -295,12 +290,12 @@ function dt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
295
290
|
>
|
296
291
|
<slot name="prefix" slot="prefix"></slot>
|
297
292
|
<slot name="suffix" slot="suffix"></slot>
|
298
|
-
${
|
293
|
+
${wt(this.parts,((t,e)=>e),((t,e)=>z`<slot
|
299
294
|
name=${`part-suffix-${e}`}
|
300
295
|
slot=${`part-suffix-${e}`}
|
301
296
|
></slot>`))}
|
302
297
|
</timered-counter-roller>
|
303
|
-
`}dispatchTimeredCounterAnimationStart(){this.dispatchEvent(new
|
298
|
+
`}dispatchTimeredCounterAnimationStart(){this.dispatchEvent(new fi("timered-counter-animation-start"))}dispatchTimeredCounterAnimationEnd(){this.dispatchEvent(new fi("timered-counter-animation-end"))}}mi.styles=[be],t([ut()],mi.prototype,"partsContainerRect",void 0),t([pt("timered-counter-roller")],mi.prototype,"partsContainer",void 0),li("timered-counter",mi);const _i=a``;class gi extends mi{constructor(){super(...arguments),this.localeNumber=!1,this.localeNumberInstance=new Intl.NumberFormat(this.localeInstance,Wt(this.localeNumber)?{}:this.localeNumber),this.localDecimalSeparator="",this.localeGroupingSeparator=""}sampleToString(t){return this.localeNumber?this.localeNumberInstance.format(this.numberAdapter.toNumber(t)):this.numberAdapter.toString(t)}render(){const t=this.extractCellStyles(),e=this.extractDigitStyles(),i=this.extractPartStyles(),s=this.extractAnimationOptions(),r=this.extractKeyframes();return z`
|
304
299
|
<timered-counter-roller
|
305
300
|
class="timered-counter timered-counter-datetime-duration"
|
306
301
|
exportparts="group, part, digit, cell, prefix, suffix, part-suffix"
|
@@ -321,20 +316,20 @@ function dt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
321
316
|
>
|
322
317
|
<slot name="prefix" slot="prefix"></slot>
|
323
318
|
<slot name="suffix" slot="suffix"></slot>
|
324
|
-
${
|
319
|
+
${wt(this.parts,((t,e)=>e),((t,e)=>z`<slot
|
325
320
|
name=${`part-suffix-${e}`}
|
326
321
|
slot=${`part-suffix-${e}`}
|
327
322
|
></slot>`))}
|
328
323
|
</timered-counter-roller>
|
329
|
-
`}willUpdate(t){if(t.has("localeNumber")||t.has("locale")){this.localeNumberInstance=new Intl.NumberFormat(this.localeInstance,
|
324
|
+
`}willUpdate(t){if(t.has("localeNumber")||t.has("locale")){this.localeNumberInstance=new Intl.NumberFormat(this.localeInstance,Wt(this.localeNumber)?{}:this.localeNumber);{const e=this.localeNumberInstance.formatToParts(123456.789),i=e.find((t=>"decimal"===t.type))?.value||".",s=e.find((t=>"group"===t.type))?.value||"";if(this.localDecimalSeparator!==i||this.localeGroupingSeparator!==s){this.localDecimalSeparator=i;const e=this.partsOptions;this.partsOptions={...e,decimalSeparator:this.localDecimalSeparator},t.set("partsOptions",e)}}}super.willUpdate(t)}}gi.styles=[...mi.styles,_i],t([ht({converter:t=>{if(Ft(t))return!1;try{return JSON.parse(t)}catch(t){return!0}},reflect:!0,attribute:"locale-number"})],gi.prototype,"localeNumber",void 0),t([ut()],gi.prototype,"localDecimalSeparator",void 0),t([ut()],gi.prototype,"localeGroupingSeparator",void 0),li("timered-counter-number",gi);const yi=a``
|
330
325
|
/**
|
331
326
|
* @license https://github.com/HarasimowiczKamil/any-base
|
332
|
-
*/;function
|
327
|
+
*/;function Ai(t,e,i){return s=>function(t,e,i){let s,r,n,{length:o}=i;const a={},l=t.length,c=e.length,h=[];if(!function(t,e){for(const i of t)if(-1===e.indexOf(i))return!1;return!0}(i,t))throw new Error(`Number "${i}" contains of non-alphabetic digits (${t})`);if(Qt(t,e))return i.join("");for(s=0;s<o;s++)a[s]=t.indexOf(i[s]);do{for(r=0,n=0,s=0;s<o;s++)r=r*l+a[s],r>=c?(a[n++]=Math.floor(r/c),r%=c):n>0&&(a[n++]=0);o=n,h.push(e[r])}while(0!==n);return h.reverse().join("")}(t.stringToChars(e),t.stringToChars(i),t.stringToChars(s))}const bi=" ";class $i extends mi{constructor(){super(...arguments),this.__alphabet="",this.__initialValueString="",this.__valueString="",this.__oldValueString="",this.__partsOptions=null,this.__decimalToAnyBase=Ai(this.stringAdapter,"0123456789",this.__alphabet),this.__anyBaseToDecimal=Ai(this.stringAdapter,this.__alphabet,"0123456789")}get initialValue(){return super.initialValue}set initialValue(t){if(!Bt(t))try{t=t.toString()}catch(e){throw new Error(`value ${t} is not a string.`)}this.__initialValueString=t??"",zt(this.__initialValueString)?super.initialValue=this.numberAdapter.create(0):(this.__updateAlphabet(this.__valueString,this.__initialValueString),super.initialValue=this.numberAdapter.create(this.__anyBaseToDecimal(this.__initialValueString)),super.value=this.numberAdapter.create(this.__anyBaseToDecimal(this.__valueString)))}get value(){return super.value}set value(t){if(Bt(t)){if(this.__valueString===t)return}else try{t=t.toString()}catch(e){throw new Error(`value ${t} is not a string.`)}this.__oldValueString=this.__valueString,this.__valueString=t??"",zt(this.__valueString)?super.value=this.numberAdapter.create(0):(this.__updateAlphabet(this.__valueString,this.__oldValueString),super.oldValue=this.numberAdapter.create(this.__anyBaseToDecimal(this.__oldValueString)),super.value=this.numberAdapter.create(this.__anyBaseToDecimal(this.__valueString)))}get partsOptions(){return super.partsOptions}set partsOptions(t){this.__partsOptions=t,super.partsOptions={type:"string",fillChar:bi,...this.__partsOptions,digitToChar:{" ":bi,...this.__partsOptions.digitToChar}}}__updateAlphabet(t,e){const i=zt(t)&&zt(e)?"":`\0${e??""}${t??""}`,s=new Set(this.stringAdapter.stringToChars(i));this.__alphabet=Array.from(s).sort().join("");const r=this.stringAdapter,n=this.__alphabet;this.__decimalToAnyBase=Ai(r,"0123456789",n),this.__anyBaseToDecimal=Ai(r,n,"0123456789")}sampleToString(t){return this.__decimalToAnyBase(this.numberAdapter.toString(t))}connectedCallback(){this.__updateAlphabet(this.__valueString,this.__initialValueString),this.initialValue=this.__initialValueString,this.value=this.__valueString,this.partsOptions=this.__partsOptions??{},super.connectedCallback()}}$i.styles=[...mi.styles,yi],li("timered-counter-string",$i);const vi=36e5,Si=Symbol.for("constructDateFrom");function wi(t,e){return"function"==typeof t?t(e):t&&"object"==typeof t&&Si in t?t[Si](e):t instanceof Date?new t.constructor(e):new Date(e)}function xi(t,e){return wi(t,t)}function Ei(t,e,i){const s=xi(t);return isNaN(e)?wi(t,NaN):e?(s.setDate(s.getDate()+e),s):s}function Oi(t,e,i){const s=xi(t);if(isNaN(e))return wi(t,NaN);if(!e)return s;const r=s.getDate(),n=wi(t,s.getTime());n.setMonth(s.getMonth()+e+1,0);return r>=n.getDate()?n:(s.setFullYear(n.getFullYear(),n.getMonth(),r),s)}function Ci(t,e,i){return wi(t,+xi(t)+e)}function Pi(t){const e=xi(t),i=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return i.setUTCFullYear(e.getFullYear()),+t-+i}function Di(t,...e){const i=wi.bind(null,e.find((t=>"object"==typeof t)));return e.map(i)}function Ti(t,e){const i=xi(t);return i.setHours(0,0,0,0),i}function Mi(t,e){const i=+xi(t)-+xi(e);return i<0?-1:i>0?1:i}function Ni(t){return!(!((e=t)instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))&&"number"!=typeof t||isNaN(+xi(t)));var e}function Ri(t,e,i){const[s,r]=Di(0,t,e),n=ki(s,r),o=Math.abs(function(t,e){const[i,s]=Di(0,t,e),r=Ti(i),n=Ti(s),o=+r-Pi(r),a=+n-Pi(n);return Math.round((o-a)/864e5)}(s,r));s.setDate(s.getDate()-n*o);const a=n*(o-Number(ki(s,r)===-n));return 0===a?0:a}function ki(t,e){const i=t.getFullYear()-e.getFullYear()||t.getMonth()-e.getMonth()||t.getDate()-e.getDate()||t.getHours()-e.getHours()||t.getMinutes()-e.getMinutes()||t.getSeconds()-e.getSeconds()||t.getMilliseconds()-e.getMilliseconds();return i<0?-1:i>0?1:i}function Ui(t){return e=>{const i=(t?Math[t]:Math.trunc)(e);return 0===i?0:i}}function Ii(t,e,i){const[s,r]=Di(0,t,e),n=(+s-+r)/vi;return Ui(i?.roundingMethod)(n)}function Li(t,e){return+xi(t)-+xi(e)}function Vi(t,e,i){const s=Li(t,e)/6e4;return Ui(i?.roundingMethod)(s)}function ji(t,e){const i=xi(t);return+function(t){const e=xi(t);return e.setHours(23,59,59,999),e}(i)==+function(t){const e=xi(t),i=e.getMonth();return e.setFullYear(e.getFullYear(),i+1,0),e.setHours(23,59,59,999),e}(i)}function Hi(t,e,i){const[s,r,n]=Di(0,t,t,e),o=Mi(r,n),a=Math.abs(function(t,e){const[i,s]=Di(0,t,e);return 12*(i.getFullYear()-s.getFullYear())+(i.getMonth()-s.getMonth())}(r,n));if(a<1)return 0;1===r.getMonth()&&r.getDate()>27&&r.setDate(30),r.setMonth(r.getMonth()-o*a);let l=Mi(r,n)===-o;ji(s)&&1===a&&1===Mi(s,n)&&(l=!1);const c=o*(a-+l);return 0===c?0:c}function Bi(t,e,i){const s=Hi(t,e)/3;return Ui(i?.roundingMethod)(s)}function zi(t,e,i){const s=Li(t,e)/1e3;return Ui(i?.roundingMethod)(s)}function Fi(t,e,i){const s=Ri(t,e)/7;return Ui(i?.roundingMethod)(s)}function Yi(t,e,i){const[s,r]=Di(0,t,e),n=Mi(s,r),o=Math.abs(function(t,e){const[i,s]=Di(0,t,e);return i.getFullYear()-s.getFullYear()}(s,r));s.setFullYear(1584),r.setFullYear(1584);const a=n*(o-+(Mi(s,r)===-n));return 0===a?0:a}function Wi(t,e){return+xi(t)<+xi(e)}function qi(t,e,i){return Ei(t,-e)}function Qi(t,e,i){return function(t,e){return Ci(t,e*vi)}(t,-e)}function Ki(t,e,i){return Ci(t,-e)}function Gi(t,e,i){return function(t,e){const i=xi(t);return i.setTime(i.getTime()+6e4*e),i}(t,-e)}function Ji(t,e,i){return function(t,e){return Oi(t,3*e)}(t,-e)}function Zi(t,e,i){return function(t,e){return Ci(t,1e3*e)}(t,-e)}function Xi(t,e,i){return function(t,e){return Ei(t,7*e)}(t,-e)}function ts(t,e,i){return function(t,e){return Oi(t,12*e)}(t,-e)}var es;!function(t){t.Millisecond="millisecond",t.Second="second",t.Minute="minute",t.Hour="hour",t.Day="day",t.Week="weekOfYear",t.Month="month",t.Quarter="quarter",t.Year="year"}(es||(es={}));const is={[es.Millisecond]:1,[es.Second]:1e3,[es.Minute]:6e4,[es.Hour]:36e5,[es.Day]:864e5,[es.Week]:6048e5,[es.Month]:26298e5,[es.Quarter]:78894e5,[es.Year]:315576e5},ss={1:es.Millisecond,1e3:es.Second,6e4:es.Minute,36e5:es.Hour,864e5:es.Day,6048e5:es.Week,26298e5:es.Month,78894e5:es.Quarter,315576e5:es.Year},rs=["era","year","quarter","month","weekOfYear","weekday","day","dayPeriod","hour","minute","second","timeZoneName"];function ns(t,e,i){let s=e;const r={};for(const e of i){let i=0;switch(e){case es.Year:i=Yi(s,t),s=ts(s,i);break;case es.Quarter:i=Bi(s,t),s=Ji(s,i);break;case es.Month:i=Hi(s,t),s=Oi(s,-i);break;case es.Week:i=Fi(s,t),s=Xi(s,i);break;case es.Day:i=Ri(s,t),s=qi(s,i);break;case es.Hour:i=Ii(s,t),s=Qi(s,i);break;case es.Minute:i=Vi(s,t),s=Gi(s,i);break;case es.Second:i=zi(s,t),s=Zi(s,i);break;case es.Millisecond:i=Li(s,t),s=Ki(s,i);break;default:throw new Error(`Unknown duration part: ${e}`)}r[e]=i}return r}function os(t,e,i){const s=ns(t,e,i);return i.map((t=>s[t]))}const as={[es.Year]:"Y",[es.Month]:"M",[es.Week]:"W",[es.Day]:"D",[es.Hour]:"H",[es.Minute]:"M",[es.Second]:"S"},ls=[es.Year,es.Month,es.Week,es.Day],cs=[es.Hour,es.Minute,es.Second];const hs=a`
|
333
328
|
::part(part-suffix) {
|
334
329
|
font-size: 0.4em;
|
335
330
|
line-height: 1;
|
336
331
|
}
|
337
|
-
`;function
|
332
|
+
`;function us(t,e){Bt(t)&&(t=le(t)),Yt(t)||(t=[t,t]);const i=[qt(t[0])?t[0]:xi(t[0]),qt(t[1])?t[1]:xi(t[1])];if(!Ni(i[0])||!Ni(i[1]))throw new Error(`value ${t[0]} or ${t[1]} is not a valid date.`);const s=Math.abs(i[1].getTime()-function(t,e,i){const s=is[i],r=t.getTime();return r-r%s+e.getTime()%s}(i[0],i[1],e));return{durationInMilliseconds:s,from:i[0],to:i[1]}}class ps extends mi{constructor(){super(...arguments),this.__precision=[es.Second,es.Day],this.__initialValuePlain=null,this.__partsOptions=null,this.__from=new Date,this.__to=new Date,this.__minPrecision=es.Second,this.__maxPrecision=es.Day,this.__availableDurationParts=[],this.__dateTimeFieldLabels={}}get precision(){return this.__precision}set precision(t){Bt(t)&&(t=le(t)),this.__precision=t,this.__minPrecision=Yt(this.__precision)?this.__precision[0]:this.__precision,this.__maxPrecision=Yt(this.__precision)?this.__precision[1]:this.__precision,this.__availableDurationParts=Object.values(es).reverse().map((t=>{const e=is[this.__minPrecision],i=is[this.__maxPrecision],s=is[t];return{type:t,available:s>=e&&s<=i}})).filter((t=>t.available))}get value(){return super.value}set value(t){const{from:e,to:i,durationInMilliseconds:s}=us(t,this.__minPrecision);this.__from=e,this.__to=i,super.value=s}get initialValue(){return super.initialValue}set initialValue(t){this.__initialValuePlain=t;const{durationInMilliseconds:e}=us(t,this.__minPrecision);super.initialValue=e}get partsOptions(){return super.partsOptions}set partsOptions(t){this.__partsOptions=t,super.partsOptions={minPlaces:[2,void 0],...this.__partsOptions}}sampleSplit(t){const e=Lt(this.__availableDurationParts,(t=>t.type)),i=e.map((()=>[]));for(const s of t){const t=this.numberAdapter.toNumber(s);os(new Date(Math.min(t,0)),new Date(Math.max(t,0)),e).forEach(((t,e)=>i[e].push(t)))}return i}generateAriaLabel(){return function(t){const e=ls.map((e=>Ht(t[e])?`${t[e]}${as[e]}`:"")),i=cs.map((e=>Ht(t[e])?`${t[e]}${as[e]}`:""));return`P${e.join("")}T${i.join("")}`}(ns(Wi(this.__from,this.__to)?this.__from:this.__to,Wi(this.__from,this.__to)?this.__to:this.__from,Lt(this.__availableDurationParts,(t=>t.type))))}connectedCallback(){this.role="timer",this.partsOptions=this.__partsOptions??{},this.initialValue=this.__initialValuePlain,this.precision=this.__precision,super.connectedCallback()}shouldRebuildParts(t){return super.shouldRebuildParts(t)||t.has("precision")}willUpdate(t){super.willUpdate(t),t.has("locale")&&(this.__dateTimeFieldLabels=function(t){const e=new Intl.DisplayNames(t,{type:"dateTimeField"});return rs.reduce(((t,i)=>(t[i]=e.of(i)??"",t)),{})}(this.localeInstance))}render(){const t=this.extractCellStyles(),e=this.extractDigitStyles(),i=this.extractPartStyles(),s=this.extractAnimationOptions(),r=this.extractKeyframes(),n=Lt(this.__availableDurationParts,(t=>t.type));return z`
|
338
333
|
<timered-counter-roller
|
339
334
|
class="timered-counter timered-counter-datetime-duration"
|
340
335
|
exportparts="group, part, digit, cell, prefix, suffix, part-suffix"
|
@@ -353,9 +348,9 @@ function dt(t,e){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
353
348
|
@roller-animation-start=${this.dispatchTimeredCounterAnimationStart}
|
354
349
|
@roller-animation-end=${this.dispatchTimeredCounterAnimationEnd}
|
355
350
|
><slot name="prefix" slot="prefix"></slot
|
356
|
-
><slot name="suffix" slot="suffix"></slot>${
|
351
|
+
><slot name="suffix" slot="suffix"></slot>${wt(this.parts,((t,e)=>e),((t,e)=>z`<span slot=${`part-suffix-${e}`} class="duration-unit"
|
357
352
|
>${this.__dateTimeFieldLabels[n[e]]}</span
|
358
353
|
>`))}
|
359
354
|
</timered-counter-roller>
|
360
|
-
`}}
|
355
|
+
`}}ps.styles=[...mi.styles,hs],t([ht({reflect:!0,converter:t=>Ft(t)?t:le(t)})],ps.prototype,"precision",null),li("timered-counter-datetime-duration",ps);const ds=t=>t;export{is as DurationPartMillisecond,ss as DurationPartMillisecondToType,es as DurationPartType,mi as TimeredCounter,de as TimeredCounterAdapter,ps as TimeredCounterDatetimeDuration,gi as TimeredCounterNumber,$i as TimeredCounterString,De as cubicBezier,Ze as easeInBack,ni as easeInBounce,Ke as easeInCirc,Ie as easeInCubic,ei as easeInElastic,We as easeInExpo,ti as easeInOutBack,oi as easeInOutBounce,Je as easeInOutCirc,Ve as easeInOutCubic,si as easeInOutElastic,Qe as easeInOutExpo,Ue as easeInOutQuad,Be as easeInOutQuart,Ye as easeInOutQuint,Ne as easeInOutSine,Re as easeInQuad,je as easeInQuart,ze as easeInQuint,Te as easeInSine,Xe as easeOutBack,ri as easeOutBounce,Ge as easeOutCirc,Le as easeOutCubic,ii as easeOutElastic,qe as easeOutExpo,ke as easeOutQuad,He as easeOutQuart,Fe as easeOutQuint,Me as easeOutSine,ds as linear,Ce as noop,ye as registerAdapter,_e as registerNumberAdapter,ge as registerStringAdapter,fe as setNumberAdapter,me as setStringAdapter};
|
361
356
|
//# sourceMappingURL=timered-counter.esm-browser.js.map
|