@ixfx/ui 0.43.0 → 0.45.0

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/bundle/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import * as _ixfx_rx0 from "@ixfx/rx";
2
- import { Reactive, ReactiveInitial, ReactiveNonInitial, ReactiveWritable } from "@ixfx/rx";
3
1
  import * as _ixfx_core0 from "@ixfx/core";
4
2
  import { Interval, Pathed } from "@ixfx/core";
3
+ import * as Rx from "@ixfx/rx";
4
+ import { Reactive, ReactiveInitial, ReactiveNonInitial, ReactiveWritable } from "@ixfx/rx";
5
5
  import { HslScalar } from "@ixfx/visual/colour";
6
6
  import { EventSourceOptions } from "@ixfx/rx/from";
7
7
  import { Colour } from "@ixfx/visual";
@@ -21,12 +21,16 @@ import { Colour } from "@ixfx/visual";
21
21
  * @param interval Tiemout before event gets triggered
22
22
  * @returns
23
23
  */
24
- declare const browserResizeObservable: (elem: Readonly<Element>, interval?: Interval) => _ixfx_rx0.Reactive<ResizeObserverEntry[]>;
24
+ declare const browserResizeObservable: (elem: Readonly<Element>, interval?: Interval) => Rx.Reactive<ResizeObserverEntry[]>;
25
25
  /**
26
26
  * Returns an Reactive for window resize. Default 100ms debounce.
27
27
  * @param elapsed
28
28
  * @returns
29
29
  */
30
+ declare const windowResize: (elapsed?: Interval) => Rx.Reactive<{
31
+ innerWidth: number;
32
+ innerHeight: number;
33
+ }>;
30
34
  //# sourceMappingURL=browser-resize.d.ts.map
31
35
  //#endregion
32
36
  //#region src/rx/browser-theme-change.d.ts
@@ -41,7 +45,7 @@ declare const browserResizeObservable: (elem: Readonly<Element>, interval?: Inte
41
45
  * });
42
46
  * ```
43
47
  */
44
- declare const cssClassChange: (target?: HTMLElement) => _ixfx_rx0.Reactive<MutationRecord[]>;
48
+ declare const cssClassChange: (target?: HTMLElement) => Rx.Reactive<MutationRecord[]>;
45
49
  //# sourceMappingURL=browser-theme-change.d.ts.map
46
50
  //#endregion
47
51
  //#region src/rx/colour.d.ts
@@ -281,10 +285,10 @@ declare function domForm<T extends Record<string, any>>(formElOrQuery: HTMLFormE
281
285
  * @param query
282
286
  * @returns
283
287
  */
284
- declare function fromDomQuery(query: string): _ixfx_rx0.Reactive<HTMLElement[]> & {
288
+ declare function fromDomQuery(query: string): Rx.Reactive<HTMLElement[]> & {
285
289
  set(value: HTMLElement[]): void;
286
290
  } & {
287
- onField(fieldName: string, handler: (result: _ixfx_rx0.ObjectFieldHandler) => void): () => void;
291
+ onField(fieldName: string, handler: (result: Rx.ObjectFieldHandler) => void): () => void;
288
292
  onDiff(changes: (changes: Pathed.PathDataChange<any>[]) => void): () => void;
289
293
  update(changedPart: (_ixfx_core0.RecursivePartial<HTMLElement> | undefined)[]): HTMLElement[];
290
294
  updateField(field: string, value: any): void;
@@ -300,7 +304,7 @@ declare function fromDomQuery(query: string): _ixfx_rx0.Reactive<HTMLElement[]>
300
304
  * @param source
301
305
  * @param bindOpts
302
306
  */
303
- declare const bindText: <TSource>(source: _ixfx_rx0.Reactive<TSource>, elOrQuery: string | HTMLElement | null, bindOpts?: Partial<DomBindSourceValue<TSource, string>>) => PipeDomBinding;
307
+ declare const bindText: <TSource>(source: Rx.Reactive<TSource>, elOrQuery: string | HTMLElement | null, bindOpts?: Partial<DomBindSourceValue<TSource, string>>) => PipeDomBinding;
304
308
  /**
305
309
  * Updates an element's `value` (as well as the 'value' attribute) when the source value changes.s
306
310
  * @param source
@@ -308,7 +312,7 @@ declare const bindText: <TSource>(source: _ixfx_rx0.Reactive<TSource>, elOrQuery
308
312
  * @param bindOpts
309
313
  * @returns
310
314
  */
311
- declare const bindValueText: <TSource>(source: _ixfx_rx0.Reactive<TSource>, elOrQuery: string | HTMLInputElement | null, bindOpts?: Partial<DomBindSourceValue<TSource, string>>) => PipeDomBinding;
315
+ declare const bindValueText: <TSource>(source: Rx.Reactive<TSource>, elOrQuery: string | HTMLInputElement | null, bindOpts?: Partial<DomBindSourceValue<TSource, string>>) => PipeDomBinding;
312
316
  /**
313
317
  * Updates an element's `innerHTML` when the source value changes
314
318
  * ```js
@@ -321,7 +325,7 @@ declare const bindValueText: <TSource>(source: _ixfx_rx0.Reactive<TSource>, elOr
321
325
  * @param bindOpts
322
326
  * @returns
323
327
  */
324
- declare const bindHtml: <TSource>(source: _ixfx_rx0.Reactive<TSource>, elOrQuery: string | HTMLElement | null, bindOpts?: DomBindSourceValue<TSource, string>) => PipeDomBinding;
328
+ declare const bindHtml: <TSource>(source: Rx.Reactive<TSource>, elOrQuery: string | HTMLElement | null, bindOpts?: DomBindSourceValue<TSource, string>) => PipeDomBinding;
325
329
  /**
326
330
  * Shortcut to bind to an elements attribute
327
331
  * @param elOrQuery
@@ -402,7 +406,7 @@ declare const bindHtml: <TSource>(source: _ixfx_rx0.Reactive<TSource>, elOrQuery
402
406
  * @param source Source of data
403
407
  * @param binds Bindings
404
408
  */
405
- declare const bindElement: <TSource, TDestination>(source: _ixfx_rx0.Reactive<TSource>, elOrQuery: string | HTMLElement | null, ...binds: (DomBindSourceValue<TSource, TDestination> & DomBindValueTarget)[]) => PipeDomBinding;
409
+ declare const bindElement: <TSource, TDestination>(source: Rx.Reactive<TSource>, elOrQuery: string | HTMLElement | null, ...binds: (DomBindSourceValue<TSource, TDestination> & DomBindValueTarget)[]) => PipeDomBinding;
406
410
  /**
407
411
  * Binds `source` to one or more element(s). One or more bindings for the same source
408
412
  * can be provided.
@@ -434,7 +438,7 @@ declare const bindElement: <TSource, TDestination>(source: _ixfx_rx0.Reactive<TS
434
438
  * @param bindsUnresolvedElements
435
439
  * @returns
436
440
  */
437
- declare const bind: <TSource, TDestination>(source: _ixfx_rx0.Reactive<TSource>, ...bindsUnresolvedElements: DomBindUnresolvedSource<TSource, TDestination>[]) => PipeDomBinding;
441
+ declare const bind: <TSource, TDestination>(source: Rx.Reactive<TSource>, ...bindsUnresolvedElements: DomBindUnresolvedSource<TSource, TDestination>[]) => PipeDomBinding;
438
442
  /**
439
443
  * Calls `updater` whenever `source` produces a value. Useful when several fields from a value
440
444
  * are needed to update an element.
@@ -457,7 +461,7 @@ declare const bind: <TSource, TDestination>(source: _ixfx_rx0.Reactive<TSource>,
457
461
  * @param updater
458
462
  * @returns
459
463
  */
460
- declare const bindUpdate: <V>(source: _ixfx_rx0.Reactive<V>, elOrQuery: string | HTMLElement, updater: (v: V, el: HTMLElement) => void) => PipeDomBinding;
464
+ declare const bindUpdate: <V>(source: Rx.Reactive<V>, elOrQuery: string | HTMLElement, updater: (v: V, el: HTMLElement) => void) => PipeDomBinding;
461
465
  /**
462
466
  * Updates a HTML element based on diffs on an object.
463
467
  * ```js
@@ -491,7 +495,7 @@ declare const bindUpdate: <V>(source: _ixfx_rx0.Reactive<V>, elOrQuery: string |
491
495
  * @param opts
492
496
  * @returns
493
497
  */
494
- declare const bindDiffUpdate: <V>(source: _ixfx_rx0.ReactiveDiff<V>, elOrQuery: string | HTMLElement | null, updater: (diffs: Pathed.PathDataChange<any>[], el: HTMLElement) => void, opts?: Partial<BindUpdateOpts<V>>) => PipeDomBinding & {
498
+ declare const bindDiffUpdate: <V>(source: Rx.ReactiveDiff<V>, elOrQuery: string | HTMLElement | null, updater: (diffs: Pathed.PathDataChange<any>[], el: HTMLElement) => void, opts?: Partial<BindUpdateOpts<V>>) => PipeDomBinding & {
495
499
  refresh: () => void;
496
500
  };
497
501
  /**
@@ -522,10 +526,10 @@ declare const bindDiffUpdate: <V>(source: _ixfx_rx0.ReactiveDiff<V>, elOrQuery:
522
526
  * @param source
523
527
  * @param options
524
528
  */
525
- declare const elements: <T>(source: _ixfx_rx0.ReactiveDiff<T> | (_ixfx_rx0.ReactiveDiff<T> & _ixfx_rx0.ReactiveInitial<T>), options: Partial<ElementsOptions>) => void;
529
+ declare const elements: <T>(source: Rx.ReactiveDiff<T> | (Rx.ReactiveDiff<T> & Rx.ReactiveInitial<T>), options: Partial<ElementsOptions>) => void;
526
530
  declare function win(): {
527
531
  dispose: (reason?: string) => void;
528
- size: _ixfx_rx0.Reactive<{
532
+ size: Rx.Reactive<{
529
533
  lazy: string;
530
534
  transform: () => {
531
535
  width: number;
@@ -540,7 +544,7 @@ declare function win(): {
540
544
  };
541
545
  };
542
546
  };
543
- pointer: _ixfx_rx0.Reactive<{
547
+ pointer: Rx.Reactive<{
544
548
  lazy: string;
545
549
  transform: (args: Event | undefined) => {
546
550
  x: number;
@@ -558,8 +562,8 @@ declare function win(): {
558
562
  };
559
563
  //# sourceMappingURL=dom.d.ts.map
560
564
  declare namespace index_d_exports {
561
- export { BindUpdateOpts, DomBindInputOptions, DomBindResolvedSource, DomBindSourceValue, DomBindTargetNode, DomBindTargetNodeResolved, DomBindUnresolvedSource, DomBindValueTarget, DomCreateOptions, DomFormOptions, DomNumberInputValueOptions, DomValueOptions, ElementBind, ElementsOptions, PipeDomBinding, ReactiveColour, bind, bindDiffUpdate, bindElement, bindHtml, bindText, bindUpdate, bindValueText, browserResizeObservable, colour, cssClassChange, domForm, domHslInputValue, domInputValue, domNumberInputValue, elements, fromDomQuery, win };
565
+ export { BindUpdateOpts, DomBindInputOptions, DomBindResolvedSource, DomBindSourceValue, DomBindTargetNode, DomBindTargetNodeResolved, DomBindUnresolvedSource, DomBindValueTarget, DomCreateOptions, DomFormOptions, DomNumberInputValueOptions, DomValueOptions, ElementBind, ElementsOptions, PipeDomBinding, ReactiveColour, bind, bindDiffUpdate, bindElement, bindHtml, bindText, bindUpdate, bindValueText, browserResizeObservable, colour, cssClassChange, domForm, domHslInputValue, domInputValue, domNumberInputValue, elements, fromDomQuery, win, windowResize };
562
566
  }
563
567
  //#endregion
564
- export { index_d_exports as Rx };
568
+ export { index_d_exports as RxUi };
565
569
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/rx/browser-resize.ts","../../src/rx/browser-theme-change.ts","../../src/rx/colour.ts","../../src/rx/dom-types.ts","../../src/rx/dom-source.ts","../../src/rx/dom.ts","../../src/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CAAA,EAAA,EAAA,EAAA,EAkQnJ,WAlQmJ,EAAA,GAAA,IAAA,EAAA,IAAA,CAAA,EAmQhM,OAnQgM,CAmQxL,cAnQwL,CAmQzK,CAnQyK,CAAA,CAAA,EAAA,GAoQrM,cApQqM,GAAA;EAgBvM,OAAA,EAAA,GAAA,GAAA,IAAA;AAiGD,CAAA;;;;;;;;AAuDC;AAwBD;;;;;;;;AA4BC;AAmCD;;;;;;;;;;;AAKiB,cAyEJ,QAzEI,EAAA,CAAA,CAAA,CAAA,CAAA,MAAA,EAyEmB,SAAA,CAAG,YAzEtB,CAyEmC,CAzEnC,CAAA,GAAA,CAyEyC,SAAA,CAAG,YAzE5C,CAyEyD,CAzEzD,CAAA,GAyE8D,SAAA,CAAG,eAzEjE,CAyEiF,CAzEjF,CAAA,CAAA,EAAA,OAAA,EAyE+F,OAzE/F,CAyEuG,eAzEvG,CAAA,EAAA,GAAA,IAAA;AAyEJ,iBAqKG,GAAA,CAAA,CAZf,EAAA;EAAA,OAAA,EAAA,CAAA,MAAA,CAAA,EAAA,MAAA,EAAA,GAAA,IAAA;EAAA,IAzJmD,EAqKjC,SAAA,CAAA,QArKiC,CAAA;IAAhB,IAAA,EAAA,MAAG;IAAmC,SAAA,EAAA,GAAA,GAAA;MAAhB,KAAG,EAAA,MAAA;MAAqC,MAAA,EAAA,MAAA;IAAnB,CAAA;EAAkB,CAAA,CAAA,GAAuB;IAAR,IAAA,EAAA,EAAA;MAAO,IAAA,EAAA,MAAA;MAqKpG,SAAA,EAAA,GAAA,GAAA;QAAA,KAAA,EAAA,MAAA;QAAA,MAAA,EAAA,MAAA;MASG,CAAA;IAAK,CAAA;;EAAA,OAAA,EAAA,SAAA,CAAA,QAAA,CAAA;;sBAAL;;;;;;;wBAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/rx/browser-resize.ts","../../src/rx/browser-theme-change.ts","../../src/rx/colour.ts","../../src/rx/dom-types.ts","../../src/rx/dom-source.ts","../../src/r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AAA,SAAA,EAAA,GAAA;MAAK,CAAA,EAAA,MAAA;MAAL,CAAA,EAAA,MAAA;IAAK,CAAA;;;;wBAAL"}
package/bundle/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{__export as e}from"./chunk-Cl8Af3a2.js";const t=(e,t)=>{let n=he(Object.keys(e),Object.keys(t));return n};function n(...e){for(let t of e){let e=typeof t==`object`?t:t();if(e===void 0||e.success)continue;throw i(e)}return!0}function r(e){return typeof e==`object`?!e.success:!1}function i(e){if(typeof e.error==`string`)throw Error(e.error,{cause:e.info});if(e.error instanceof Error)throw e.error;return Error(JSON.stringify(e.error),{cause:e.info})}const a=(...e)=>{let t;for(let n of e){if(t=typeof n==`object`?n:n(),t===void 0)continue;if(!t.success)return t}if(!t)throw Error(`No results`);return t},o=(e,t=``,n=`?`,r)=>{if(e===null)return{success:!1,error:`Parameter '${n}' is null`,info:r};if(e===void 0)return{success:!1,error:`Parameter '${n}' is undefined`,info:r};if(Number.isNaN(e))return{success:!1,error:`Parameter '${n}' is NaN`,info:r};if(typeof e!=`number`)return{success:!1,error:`Parameter '${n}' is not a number (${JSON.stringify(e)})`,info:r};switch(t){case`finite`:if(!Number.isFinite(e))return{success:!1,error:`Parameter '${n} must be finite (Got: ${e})`,info:r};break;case`positive`:if(e<0)return{success:!1,error:`Parameter '${n}' must be at least zero (${e})`,info:r};break;case`negative`:if(e>0)return{success:!1,error:`Parameter '${n}' must be zero or lower (${e})`,info:r};break;case`aboveZero`:if(e<=0)return{success:!1,error:`Parameter '${n}' must be above zero (${e})`,info:r};break;case`belowZero`:if(e>=0)return{success:!1,error:`Parameter '${n}' must be below zero (${e})`,info:r};break;case`percentage`:if(e>1||e<0)return{success:!1,error:`Parameter '${n}' must be in percentage range (0 to 1). (${e})`,info:r};break;case`nonZero`:if(e===0)return{success:!1,error:`Parameter '${n}' must non-zero. (${e})`,info:r};break;case`bipolar`:if(e>1||e<-1)return{success:!1,error:`Parameter '${n}' must be in bipolar percentage range (-1 to 1). (${e})`,info:r};break}return{success:!0,value:e,info:r}},s=(e,t=`?`,n)=>o(e,`percentage`,t,n),c=(e,t=``,n=`?`)=>a(o(e,t,n),()=>Number.isInteger(e)?{success:!0,value:e}:{success:!1,error:`Param '${n}' is not an integer`}),l=(e,t,n,r=`?`)=>typeof e==`number`?Number.isNaN(e)?{success:!1,error:`Param '${r}' is not within range ${t}-${n}. Got: NaN`}:Number.isFinite(e)?e<t?{success:!1,error:`Param '${r}' is below range ${t}-${n}. Got: ${e}`}:e>n?{success:!1,error:`Param '${r}' is above range ${t}-${n}. Got: ${e}`}:{success:!0,value:e}:{success:!1,error:`Param '${r}' is not within range ${t}-${n}. Got: infinite`}:{success:!1,error:`Param '${r}' is not a number type. Got type: '${typeof e}' value: '${JSON.stringify(e)}'`},u=e=>{if(typeof e!=`object`||!e)return{success:!1,error:`Value is null or not object type`};let t=Object.getPrototypeOf(e),n=(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e);return n?{success:!0,value:e}:{success:!1,error:`Fancy object`}},d=e=>{let t=typeof e;return t===`symbol`?{success:!1,error:`Symbol type`}:t===`function`?{success:!1,error:`Function type`}:t===`bigint`||t===`number`||t===`string`||t===`boolean`?{success:!0,value:e}:u(e)};function f(e){return typeof e==`number`||typeof e==`string`||typeof e==`bigint`||typeof e==`boolean`}const p=(e,t)=>e===t,m=(e,t,n)=>JSON.stringify(e)===JSON.stringify(t),h=(e,t)=>{for(let n of t)if(e.has(n))return e.get(n)},g=(e,t)=>{if(e===void 0)throw Error(`Param 'target' is undefined`);if(e===null)throw Error(`Param 'target' is null`);if(typeof e!=`object`)throw Error(`Param 'target' is not an object (got: ${typeof e})`);if(t){let t=[];for(let n in e){let r=e[n];d(r)&&t.push([n,r])}return t}else return Object.entries(e)};function*ee(e,t,n={}){if(e===void 0){yield{path:n.pathPrefix??``,value:t,state:`added`};return}if(t===void 0){yield{path:n.pathPrefix??``,previous:e,value:void 0,state:`removed`};return}let r=n.asPartial??!1,i=n.undefinedValueMeansRemoved??!1,a=n.pathPrefix??``,o=n.deepEntries??!1,s=n.eq??m,c=n.includeMissingFromA??!1,l=n.includeParents??!1;if(f(e)&&f(t)){e!==t&&(yield{path:a,value:t,previous:e,state:`change`});return}if(f(t)){yield{path:a,value:t,previous:e,state:`change`};return}let u=g(e,o),d=new Set;for(let[e,o]of u){d.add(e);let c=e in t,u=t[e];if(typeof o==`object`&&o)if(c){if(u===void 0)throw Error(`Pathed.compareData Value for key ${e} is undefined`);{let r=[...ee(o,u,{...n,pathPrefix:a+e+`.`})];if(r.length>0){for(let e of r)yield e;l&&(yield{path:a+e,value:t[e],previous:o,state:`change`})}}}else{if(r)continue;yield{path:a+e,value:void 0,previous:o,state:`removed`}}else{let t=a+e;if(c)u===void 0&&i?yield{path:t,previous:o,value:void 0,state:`removed`}:s(o,u,t)||(yield{path:t,previous:o,value:u,state:`change`});else{if(r)continue;yield{path:t,previous:o,value:void 0,state:`removed`}}}}if(c){let e=g(t,o);for(let[t,n]of e){if(d.has(t))continue;yield{path:a+t,previous:void 0,value:n,state:`added`}}}}const te=(e,t,n,r=!1)=>{if(t===void 0)throw Error(`Parameter 'path' is undefined`);if(typeof t!=`string`)throw Error(`Parameter 'path' should be a string. Got: ${typeof t}`);if(e===void 0)throw Error(`Parameter 'target' is undefined`);if(e===null)throw Error(`Parameter 'target' is null`);let i=t.split(`.`),a=_(e,i,n,r);return a},_=(e,n,r,i)=>{if(n.length===0){if(i)return r;if(Array.isArray(e)&&!Array.isArray(r))throw Error(`Expected array value, got: '${JSON.stringify(r)}'. Set allowShapeChange=true to ignore.`);if(!Array.isArray(e)&&Array.isArray(r))throw Error(`Unexpected array value, got: '${JSON.stringify(r)}'. Set allowShapeChange=true to ignore.`);if(typeof e!=typeof r)throw Error(`Cannot reassign object type. (${typeof e} -> ${typeof r}). Set allowShapeChange=true to ignore.`);if(typeof e==`object`&&!Array.isArray(e)){let n=t(e,r);if(n.a.length>0)throw Error(`New value is missing key(s): ${n.a.join(`,`)}`);if(n.b.length>0)throw Error(`New value cannot add new key(s): ${n.b.join(`,`)}`)}return r}let a=n.shift();if(!a)return r;let o=me(a);if(o&&Array.isArray(e)){let t=Number.parseInt(a);if(t>=e.length&&!i)throw Error(`Array index ${t.toString()} is outside of the existing length of ${e.length.toString()}. Use allowShapeChange=true to permit this.`);let o=[...e];return o[t]=_(o[t],n,r,i),o}else if(a in e){let t={...e};return t[a]=_(t[a],n,r,i),t}else throw Error(`Path ${a} not found in data`)},ne=(e,t,n=`.`)=>{if(typeof t!=`string`)throw Error(`Param 'path' ought to be a string. Got: '${typeof t}'`);if(t.length===0)throw Error(`Param string 'path' is empty`);if(e===void 0)throw Error(`Param 'object' is undefined`);if(e===null)throw Error(`Param 'object' is null`);let r=t.split(n),i=re(e,r,t);return i},re=(e,t,n)=>{if(e===void 0)return{success:!1,error:`Param 'object' is undefined. Position: ${n}`};if(t.length===0)return{success:!1,error:`Path has been exhausted. position: ${n}`};let r=t.shift();if(!r)return{success:!1,error:`Unexpected empty split path. Position: ${n}`};let i=me(r);if(i&&Array.isArray(e)){let i=Number.parseInt(r);return e[i]===void 0?{success:!1,error:`Index '${i}' does not exist. Length: ${e.length}. Position: ${n}`}:t.length===0?{value:e[i],success:!0}:re(e[i],t,t.join(`.`))}else if(typeof e==`object`&&r in e)return t.length===0?{value:e[r],success:!0}:re(e[r],t,t.join(`.`));else return{success:!1,error:`Path '${r}' not found. Position: ${n}`}};function*ie(e,t=!1,n=2**53-1,r=``){e!=null&&(yield*ae(e,r,t,n))}function*ae(e,t,n=!1,r){if(!(r<=0)&&typeof e==`object`)for(let i of Object.entries(e)){let e=(t.length>0?t+`.`:``)+i[0],a=i[1],o=typeof a!=`object`;(n&&o||!n)&&(yield{path:e,value:a}),yield*ae(a,e,n,r-1)}}const oe=(e,t,r={})=>{let i=v(t,0);n(c(i,`positive`,`interval`));let a=r.fireBeforeWait??!1,o=r.onStartCalled,s=r.signal,l=!1,u=`idle`,d=0,f=0,p=performance.now(),m=t??0,h=!1,g,ee=()=>{g!==void 0&&(globalThis.clearTimeout(g),g=void 0,d=0,p=NaN)},te=e=>{i===0?typeof requestAnimationFrame>`u`?g=globalThis.setTimeout(e,0):(g=void 0,requestAnimationFrame(e)):g=globalThis.setTimeout(e,i)},_=()=>{h||(h=!0,u!==`idle`&&(u=`idle`,ee()))},ne=async()=>{if(s?.aborted&&(u=`idle`),u===`idle`)return;u=`running`,d++,f++;let t=e(d,performance.now()-p),n=typeof t==`object`?await t:t;if(!h){if(u=`scheduled`,n!==void 0&&!n){_();return}h||te(ne)}},re=()=>{if(l)throw Error(`Disposed`);if(h=!1,o!==void 0){let e=o(d,performance.now()-p);switch(e){case`cancel`:_();return;case`reset`:ie();return;case`dispose`:l=!0,_();return}}u===`idle`&&(d=0,p=performance.now(),u=`scheduled`,a?ne():te(ne))},ie=()=>{if(l)throw Error(`Disposed`);h=!1,d=0,p=NaN,u!==`idle`&&_(),re()};return{start:re,reset:ie,cancel:_,get interval(){return m},get runState(){return u},get startCountTotal(){return f},get startCount(){return d},set interval(e){let t=v(e,0);n(c(t,`positive`,`interval`)),i=t,m=e},get isDisposed(){return l},get elapsedMs(){return performance.now()-p}}},se=()=>{let e=performance.now();return()=>{let t=performance.now(),n=t-e;return e=t,n}};function*ce(e,t=`.`){for(;e.length>0;){yield e;let n=de(e,t);if(n===e)break;e=n}}function*le(e,t=`.`){for(;e.length>0;){yield e;let n=ue(e,t,{ifNoMatch:`original`,fromEnd:!0});if(n===e)break;e=n}}const ue=(e,t,n={})=>{let r=fe(e,t,n);return r[0]},de=(e,t,n={})=>{let r=fe(e,t,n);return r[1]},fe=(e,t,n={})=>{if(e===void 0)throw Error(`Param 'source' is undefined`);let r=n.fallback,i=n.ifNoMatch??(r?`fallback`:`original`);if(i===`original`&&(r=e),i===`fallback`&&r===void 0)throw Error(`Fallback must be provided`);let a=n.startPos??void 0,o=n.fromEnd??!1,s=o?e.lastIndexOf(t,a):e.indexOf(t,a);if(s<0&&i===`throw`)throw Error(`Match '${t}' not found in source.`);return s<0&&i===`original`?[e,e]:s<0&&i===`fallback`?[r,r]:[e.slice(0,s),e.slice(Math.max(0,s+t.length))]},pe=e=>{let t=e=>e.replaceAll(/([!$()*+./:=?[\\\]^{|}])/g,`\\$1`);e=e.split(`*`).map(e=>t(e)).join(`.*`),e=`^`+e+`$`;let n=new RegExp(e);return e=>n.test(e)},me=e=>{if(e===void 0)return!1;if(typeof e==`string`){let t=Number.parseInt(e);return Number.isNaN(t)?!1:t.toString()===e.toString()}return typeof e==`number`?Number.isNaN(e)||!Number.isFinite(e)?!1:Math.round(e)===e:!1},he=(e,t,n=p)=>{let r=[],i=[],a=[];for(let a of e){let e=!1;for(let r of t)if(n(a,r)){e=!0;break}e?r.push(a):i.push(a)}for(let r of t){let t=!1;for(let i of e)n(r,i)&&(t=!0);t||a.push(r)}let o=i.length===0&&a.length===0;return{shared:r,isSame:o,a:i,b:a}};function v(e,t){if(ge(e)){if(typeof e==`number`)return e;let t=e.millis??0;return t+=(e.hours??0)*60*60*1e3,t+=(e.mins??0)*60*1e3,t+=(e.secs??0)*1e3,t}else{if(t!==void 0)return t;throw Error(`Not a valid interval: ${JSON.stringify(e)}`)}}function ge(e){if(e==null)return!1;if(typeof e==`number`)return!(Number.isNaN(e)||!Number.isFinite(e));if(typeof e!=`object`)return!1;let t=`millis`in e,n=`secs`in e,r=`mins`in e,i=`hours`in e;return t&&!o(e.millis).success||n&&!o(e.secs).success||r&&!o(e.mins).success||i&&!o(e.hours).success?!1:!!(t||n||i||r)}const _e=e=>typeof e==`string`?e:e instanceof Error?e.message:e;(typeof window>`u`||!(`requestAnimationFrame`in window))&&typeof window>`u`&&(globalThis.requestAnimationFrame=e=>{setTimeout(e,1)});const ve=e=>{let t=v(e,1),r=e.signal,i=e.value;return n(o(t,`positive`,`timeoutMs`)),t===0?new Promise(e=>requestAnimationFrame(t=>{e(i)})):new Promise((e,n)=>{let a=()=>{clearTimeout(o),r?(r.removeEventListener(`abort`,a),n(Error(r.reason))):n(Error(`Cancelled`))};r&&r.addEventListener(`abort`,a);let o=setTimeout(()=>{if(r?.removeEventListener(`abort`,a),r?.aborted){n(Error(r.reason));return}e(i)},t)})},ye=(e,t)=>{if(e===void 0)throw Error(`callback parameter is undefined`);let a=v(t);n(c(a,`aboveZero`,`interval`));let o,s=0,l=0,u=0,d=`idle`,f=()=>{s=0,globalThis.clearTimeout(o),d=`idle`},p=async(n=t,a)=>{let p=new Promise((t,p)=>{s=performance.now();let h=v(n),g=c(h,`aboveZero`,`altTimeoutMs`);if(r(g)){p(i(g));return}switch(d){case`scheduled`:m();break;case`running`:break}d=`scheduled`,o=globalThis.setTimeout(async()=>{if(d!==`scheduled`){console.warn(`Timeout skipping execution since state is not 'scheduled'`),f();return}let n=a??[];l++,u++,d=`running`,await e(performance.now()-s,...n),d=`idle`,f(),t()},h)});return p},m=()=>{d!==`idle`&&f()};return{start:p,cancel:m,get runState(){return d},get startCount(){return l},get startCountTotal(){return u}}};var be=class{#handlers;#counter=0;#id=Math.floor(Math.random()*100);constructor(){this.#handlers=[]}isEmpty(){return this.#handlers.length===0}add(e,t={}){this.#counter++;let n=t.once??!1,r={id:`${this.#id} - ${this.#counter}`,handler:e,once:n};return this.#handlers.push(r),r.id}remove(e){let t=this.#handlers.length;return this.#handlers=this.#handlers.filter(t=>t.id!==e),this.#handlers.length!==t}notify(e){for(let t of this.#handlers)t.handler(e),t.once&&this.remove(t.id)}clear(){this.#handlers=[]}};const xe=e=>typeof e==`string`?e:JSON.stringify(e),Se=(e,t=xe)=>{let n=new Set,r=[],i=e.flat(10);for(let e of i){let i=t(e);if(n.has(i))continue;n.add(i),r.push(e)}return r};var Ce=class{#store=new Map;get(e){let t=this.#store.get(e);return t?[...t]:[]}size(e){let t=this.#store.get(e);return t?t.length:0}*iterateKey(e){let t=this.#store.get(e);t&&(yield*t.values())}*iterateValues(){for(let e of this.#store.keys())yield*this.iterateKey(e)}*iterateKeys(){yield*this.#store.keys()}addKeyedValues(e,...t){let n=this.#store.get(e);n||(n=[],this.#store.set(e,n)),n.push(...t)}deleteKeyValue(e,t){let n=this.#store.get(e);if(!n)return!1;let r=n.filter(e=>e!==t);return r.length===n.length?!1:(this.#store.set(e,r),!0)}clear(){this.#store.clear()}},we=class{#listeners=new Ce;#disposed=!1;dispose(){this.#disposed||this.clearEventListeners()}get isDisposed(){return this.#disposed}fireEvent(e,t){if(this.#disposed)throw Error(`Disposed`);for(let n of this.#listeners.iterateKey(e))n(t,this)}addEventListener(e,t){if(this.#disposed)throw Error(`Disposed`);this.#listeners.addKeyedValues(e,t)}removeEventListener(e,t){this.#disposed||this.#listeners.deleteKeyValue(e,t)}clearEventListeners(){this.#disposed||this.#listeners.clear()}};const Te=e=>typeof e!=`object`||!e?!1:Symbol.asyncIterator in e,Ee=e=>typeof e!=`object`||!e?!1:Symbol.iterator in e,De=(e,t,n)=>{let r=t.length+n.length,i=e.capacity??r,a=r-i,o=e.discardPolicy??`additions`;switch(o){case`additions`:return t.length===0?n.slice(0,n.length-a):t.length===e.capacity?t:[...t,...n.slice(0,a-1)];case`newer`:if(a>=t.length)return t.length===0?[...n.slice(0,i-1),n.at(-1)]:n.slice(Math.max(0,n.length-i),Math.min(n.length,i)+1);{let e=Math.max(1,n.length-t.length),r=n.slice(n.length-e,n.length),a=t.slice(0,Math.min(t.length,i-1)),o=[...a,...r];return o}case`older`:return[...t,...n].slice(a);default:throw Error(`Unknown overflow policy ${o}`)}},Oe=(e,t,...n)=>{if(e===void 0)throw Error(`opts parameter undefined`);let r=t.length+n.length,i=e.capacity&&r>e.capacity,a=i?De(e,t,n):[...t,...n];if(e.capacity&&a.length!==e.capacity&&i)throw Error(`Bug! Expected return to be at capacity. Return len: ${a.length} capacity: ${e.capacity} opts: ${JSON.stringify(e)}`);if(!e.capacity&&a.length!==r)throw Error(`Bug! Return length not expected. Return len: ${a.length} expected: ${r} opts: ${JSON.stringify(e)}`);return a},ke=(e,t)=>{if(t.length===0)throw Error(`Queue is empty`);return t.slice(1)},Ae=(e,t)=>t[0],je=(e,t)=>t.length===0,Me=(e,t)=>e.capacity?t.length>=e.capacity:!1;var Ne=class extends we{options;data;eq;constructor(e={},t=[]){if(super(),e===void 0)throw Error(`opts parameter undefined`);this.options=e,this.data=t,this.eq=e.eq??p}clear(){let e=[...this.data];this.data=[],this.fireEvent(`removed`,{finalData:this.data,removed:e}),this.onClear()}onClear(){}at(e){if(e>=this.data.length)throw Error(`Index outside bounds of queue`);let t=this.data.at(e);if(t===void 0)throw Error(`Index appears to be outside range of queue`);return t}enqueue(...e){this.data=Oe(this.options,this.data,...e);let t=this.data.length;return this.onEnqueue(this.data,e),t}onEnqueue(e,t){this.fireEvent(`enqueue`,{added:t,finalData:e})}dequeue(){let e=Ae(this.options,this.data);if(e!==void 0)return this.data=ke(this.options,this.data),this.fireEvent(`dequeue`,{removed:e,finalData:this.data}),this.onRemoved([e],this.data),e}onRemoved(e,t){this.fireEvent(`removed`,{removed:e,finalData:t})}removeWhere(e){let t=this.data.length,n=this.data.filter(t=>e(t));return n.length===0?0:(this.data=this.data.filter(t=>!e(t)),this.onRemoved(n,this.data),t-this.data.length)}toArray(){return[...this.data]}get isEmpty(){return je(this.options,this.data)}get isFull(){return Me(this.options,this.data)}get length(){return this.data.length}get peek(){return Ae(this.options,this.data)}};async function Pe(e,t){let n=v(t,1e3),r=await Promise.race([(async()=>{await ve({millis:n,signal:t.signal})})(),(async()=>await e.next())()]);if(r===void 0)throw Error(`Timeout`);return r}const Fe=(e,t)=>{let[n,r]=Ie(e);if(!n)throw Error(r);let i=t??Object.keys(n.states)[0];if(n.states[i]===void 0)throw TypeError(`Initial state ('${i}') not found`);let a=Be(n.states);if(a===void 0)throw Error(`Could not normalise transitions`);return Object.freeze({value:i,visited:[],machine:Object.freeze(Object.fromEntries(a))})},Ie=e=>e===void 0?[void 0,`Parameter undefined`]:e===null?[void 0,`Parameter null`]:`states`in e?[e,``]:typeof e==`object`?[{states:e},``]:[void 0,`Unexpected type: ${typeof e}. Expected object`],Le=e=>{Ve(e);let t=e.machine[e.value];return t.length===1&&t[0].state===null?[]:t},Re=e=>{let t=Le(e);return t.map(e=>e.state)},ze=e=>{let t=e=>{if(e===null)return{state:null};if(typeof e==`string`)return{state:e};if(typeof e==`object`&&`state`in e){let t=e.state;if(typeof t!=`string`)throw TypeError(`Target 'state' field is not a string. Got: ${typeof t}`);return`preconditions`in e?{state:t,preconditions:e.preconditions}:{state:t}}else throw Error(`Unexpected type: ${typeof e}. Expected string or object with 'state' field.`)};if(Array.isArray(e)){let n=!1,r=e.map(e=>{let r=t(e);if(!r)throw Error(`Invalid target`);return n||=r.state===null,r});if(n&&r.length>1)throw Error(`Cannot have null as an possible state`);return r}else{let n=t(e);return n?[n]:void 0}},Be=e=>{let t=new Map;for(let[n,r]of Object.entries(e)){if(n===void 0)throw TypeError(`Top-level undefined state`);if(r===void 0)throw TypeError(`Undefined target state for ${n}`);if(t.has(n))throw Error(`State defined twice: ${n}`);if(n.includes(` `))throw Error(`State names cannot contain spaces`);t.set(n,[])}for(let[n,r]of Object.entries(e)){let e=ze(r);if(e===void 0)throw Error(`Could not normalise target`);if(e!==null){let r=new Set;for(let i of e){if(r.has(i.state))throw Error(`Target state '${i.state}' already exists for '${n}'`);if(r.add(i.state),i.state===null)continue;if(!t.has(i.state))throw Error(`Target state '${i.state}' is not defined as a top-level state. Defined under: '${n}'`)}t.set(n,e)}}return t},Ve=e=>{if(e===void 0)throw TypeError(`Param 'state' is undefined`);if(typeof e.value!=`string`)throw TypeError(`Existing state is not a string`)},y=(e,t)=>(Ve(e),He(e,t),Object.freeze({value:t,machine:e.machine,visited:Se([e.visited,[e.value]])})),He=(e,t)=>{if(t===null)throw Error(`Cannot transition to null state`);if(t===void 0)throw Error(`Cannot transition to undefined state`);if(typeof t!=`string`)throw TypeError(`Parameter 'toState' should be a string. Got: ${typeof t}`);let n=Re(e);if(n.length===0)throw Error(`Machine is in terminal state`);if(!n.includes(t))throw Error(`Target state '${t}' not available at current state '${e.value}'. Possible states: ${n.join(`, `)}`)};function Ue(e,t={}){let n=t.maximumRepeats??2**53-1,r=t.closeOnError??!0,i=t.interval?v(t.interval):-1,a=t.manual??!1;if(t.interval===void 0&&t.manual===void 0&&(a=!0),a&&t.interval)throw Error(`If option 'manual' is set, option 'interval' cannot be used`);let o=v(t.predelay,0),s=t.lazy??`very`,c=t.signal,l=new AbortController,u=e=>{l.abort(e)},d=0,f=!1,p=e=>{g.dispose(e),f=!1,h&&h.cancel()},m=async()=>{if(!f)return!1;if(o&&await ve(o),d>=n)return p(`Maximum repeats reached ${n.toString()}`),!1;try{if(c?.aborted)return p(`Signal (${c.aborted})`),!1;let t=await e(u);return d++,g.set(t),!0}catch(e){return r?(p(`Function error: ${_e(e)}`),!1):(g.signal(`warn`,_e(e)),!0)}},h=a?void 0:oe(async()=>{let e=await m();if(!e)return!1;if(l.signal.aborted)return p(`callback function aborted (${l.signal.reason})`),!1},i),g=Ze({lazy:s,onStart(){f=!0,h&&h.start()},onStop(){f=!1,h&&h.cancel()}});return s===`never`&&h&&h.start(),{...g,ping:m}}function We(e,t={}){let n=t.lazy??`very`,r=t.traceLifecycle?e=>{console.log(`Rx.From.iterator ${e}`)}:e=>{},i=v(t.readInterval,5),a=v(t.readTimeout,300*1e3),o=t.whenStopped??`continue`,s,c,l=Fe({idle:[`wait_for_next`],wait_for_next:[`processing_result`,`stopping`,`disposed`],processing_result:[`queued`,`disposed`,`stopping`],queued:[`wait_for_next`,`disposed`,`stopping`],stopping:`idle`,disposed:null},`idle`),u=()=>{r(`onExternalSignal`),c?.abort(t.signal?.reason)};t.signal&&t.signal.addEventListener(`abort`,u,{once:!0});let d=async()=>{r(`read. State: ${l.value}`),c=new AbortController;try{l=y(l,`wait_for_next`);let e=await Pe(s,{signal:c.signal,millis:a});if(l=y(l,`processing_result`),c.abort(`nextWithTimeout completed`),e.done&&(r(`read v.done true`),f.dispose(`Generator complete`),l=y(l,`disposed`)),l.value===`stopping`){r(`read. sm.value = stopping`),l=y(l,`idle`);return}if(l.value===`disposed`){r(`read. sm.value = disposed`);return}f.set(e.value)}catch(e){f.dispose(`Generator error: ${e.toString()}`);return}l.value===`processing_result`?(l=y(l,`queued`),r(`scheduling read. State: ${l.value}`),setTimeout(d,i)):l=y(l,`idle`)},f=Ze({...t,lazy:n,onStart(){r(`onStart state: ${l.value} whenStopped: ${o}`),l.value===`idle`&&((l.value===`idle`&&o===`reset`||s===void 0)&&(s=Te(e)?e[Symbol.asyncIterator]():e[Symbol.iterator]()),d())},onStop(){r(`onStop state: ${l.value} whenStopped: ${o}`),l=y(l,`stopping`),o===`reset`&&(r(`onStop reiniting iterator`),s=Te(e)?e[Symbol.asyncIterator]():e[Symbol.iterator]())},onDispose(e){r(`onDispose (${e})`),c?.abort(`Rx.From.iterator disposed (${e})`),t.signal&&t.signal.removeEventListener(`abort`,u)}});return f}function Ge(e){return e.value===void 0?`signal`in e&&e.signal!==void 0:!1}function Ke(e){return e.value!==void 0}const b=e=>{if(!qe(e))return!1;if(`last`in e){let t=e.last();if(t!==void 0)return!0}return!1},qe=e=>typeof e!=`object`||!e?!1:`on`in e&&`onValue`in e,Je=e=>!(typeof e!=`object`||!(`source`in e)||!(`annotate`in e)),Ye=(e,t={})=>{if(qe(e))return e;let n=t.generator??{lazy:`initial`,interval:5},r=t.function??{lazy:`very`};if(Array.isArray(e))return We(e.values(),n);if(typeof e==`function`)return Ue(e,r);if(typeof e==`object`){if(Je(e))return e.source;if(Ee(e)||Te(e))return We(e,n)}throw TypeError(`Unable to resolve source. Supports: array, Reactive, Async/Iterable. Got type: ${typeof e}`)};function Xe(e,t){let n=t.lazy??`initial`,r=t.disposeIfSourceDone??!0,i=t.onValue??(e=>{}),a=Ye(e),o,s=t.debugLabel?`[${t.debugLabel}]`:``,c=()=>{o!==void 0&&(o(),o=void 0,t.onStop&&t.onStop())},l=()=>{o===void 0&&(t.onStart&&t.onStart(),o=a.on(e=>{Ge(e)?e.signal===`done`?(c(),u.signal(e.signal,e.context),r&&u.dispose(`Upstream source ${s} has completed (${e.context??``})`)):u.signal(e.signal,e.context):Ke(e)&&i(e.value)}))},u=Ze({...t,lazy:n,onStart:l,onStop:c});return u}function Ze(e){let t=e.lazy??`initial`,n=e.onStop??(()=>{}),r=e.onStart??(()=>{});e.debugLabel&&`${e.debugLabel}`;let i=x({...e,onFirstSubscribe(){t!==`never`&&r()},onNoSubscribers(){t===`very`&&n()}});return t===`never`&&r(),i}function x(e={}){let t,n=!1,r=!1,i=!0,a=e.onFirstSubscribe??void 0,o=e.onNoSubscribers??void 0,s=e.debugLabel?`[${e.debugLabel}]`:``,c=()=>{t!==void 0&&t.isEmpty&&(i||(i=!0,r=!1,o&&o()))},l=e=>{if(n)throw Error(`Disposed, cannot subscribe ${s}`);t===void 0&&(t=new be);let o=t.add(e);return i=!1,r||(r=!0,a&&a()),()=>{t?.remove(o),c()}};return{dispose:r=>{n||(t?.notify({value:void 0,signal:`done`,context:`Disposed: ${r}`}),n=!0,e.onDispose&&e.onDispose(r))},isDisposed:()=>n,removeAllSubscribers:()=>{t?.clear(),c()},set:e=>{if(n)throw Error(`${s} Disposed, cannot set`);t?.notify({value:e})},signal:(e,r)=>{if(n)throw Error(`${s} Disposed, cannot signal`);t?.notify({signal:e,value:void 0,context:r})},on:e=>l(e),onValue:e=>{let t=l(t=>{Ke(t)&&e(t.value)});return t}}}function Qe(e,t={}){let n=t.eq??m,a=x(),o=x(),s=[],c=e,l=!1,u=e=>{let n=[...ee(c??{},e,{...t,includeMissingFromA:!0})];n.length!==0&&(c=e,a.set(e),o.set(n))},d=(e,t)=>{for(let[n,r,i]of s)n(e)&&i.notify({fieldName:e,pattern:r,value:t})},f={asPartial:!0,includeParents:!0},p=e=>{if(c===void 0){c=e,a.set(c);for(let[t,n]of Object.entries(e))d(t,n);return c}else{let t=[...ee(c,e,f)];if(t.length===0)return c;c={...c,...e},a.set(c),o.set(t);for(let e of t)d(e.path,e.value);return c}},h=(e,s)=>{if(c===void 0)throw Error(`Cannot update value when it has not already been set`);let l=ne(c,e);if(r(l))throw i(l);if(n(l.value,s,e))return;let u=[...ee(l.value,s,{...t,includeMissingFromA:!0})];u=u.map(t=>t.path.length>0?{...t,path:e+`.`+t.path}:{...t,path:e});let f=te(c,e,s,!0);c=f,a.set(f),o.set(u),d(e,s)},g=e=>{l||(o.dispose(e),a.dispose(e),l=!0)};return{dispose:g,isDisposed(){return l},updateField:h,last:()=>c,on:a.on,onValue:a.onValue,onDiff:o.onValue,onField(e,t){let n=pe(e),r=new be;s.push([n,e,r]);let i=r.add(t);return()=>r.remove(i)},set:u,update:p}}const $e=e=>({on:e.on,dispose:e.dispose,isDisposed:e.isDisposed,onValue:e.onValue});function et(e,t,n,r={}){let i;if(typeof e==`string`){if(i=document.querySelector(e),i===null)throw Error(`Target query did not resolve to an element. Query: '${e}'`)}else i=e;if(i===null)throw Error(`Param 'targetOrQuery' is null`);let a=r.debugLifecycle??!1,o=r.debugFiring??!1,s=r.lazy??!1;n===void 0&&(n={});let c=Qe(n,{deepEntries:!0}),l=!1,u=!1,d=e=>{o&&console.log(`Reactive.event '${t}' firing '${JSON.stringify(e)}`),c.set(e)},f=()=>{l&&(l=!1,i.removeEventListener(t,d),a&&console.log(`Rx.From.event remove '${t}'`))},p=()=>{l||(l=!0,i.addEventListener(t,d),a&&console.log(`Rx.From.event add '${t}'`))};return s||p(),{last:()=>(s&&p(),c.last()),dispose:e=>{u||(u=!0,f(),c.dispose(e))},isDisposed(){return u},on:e=>(s&&p(),c.on(e)),onValue:e=>(s&&p(),c.onValue(e))}}function tt(e,t,n={}){let r;if(typeof e==`string`){if(r=document.querySelector(e),r===null)throw Error(`Target query did not resolve to an element. Query: '${e}'`)}else r=e;if(r===null)throw Error(`Param 'targetOrQuery' is null`);let i=n.debugLifecycle??!1,a=n.debugFiring??!1,o=n.fireInitial??!1,s=0,c=se(),l=Ze({lazy:n.lazy??`very`,onStart(){r.addEventListener(t,u),i&&console.log(`Rx.From.eventTrigger add '${t}'`),o&&s===0&&((i||a)&&console.log(`Rx.From.eventTrigger: firing initial`),u())},onStop(){r.removeEventListener(t,u),i&&console.log(`Rx.From.eventTrigger remove '${t}'`)}}),u=e=>{a&&console.log(`Rx.From.eventTrigger '${t}' triggered'`),l.set({sinceLast:c(),total:++s})};return l}const S=e=>{let t=nt(e);if(t.success)return t.value;throw i(t)},nt=e=>{if(typeof e==`string`){let t=document.querySelector(e);if(t===null){let t=e.startsWith(`#`)?`Query '${e}' did not match anything. Try '#id', 'div', or '.class'`:`Query '${e}' did not match anything. Did you mean '#${e}?`;return{success:!1,error:t}}e=t}else if(e===null)return{success:!1,error:`Param 'domQueryOrEl' is null`};else if(e===void 0)return{success:!1,error:`Param 'domQueryOrEl' is undefined`};let t=e;return{success:!0,value:t}};function rt(e,t,n={}){let r=n.traceInput??!1,i=n.traceOutput??!1,a=Xe(e,{lazy:`initial`,...n,onValue(e){let n=t(e);r&&i?console.log(`Rx.Ops.transform input: ${JSON.stringify(e)} output: ${JSON.stringify(n)}`):r?console.log(`Rx.Ops.transform input: ${JSON.stringify(e)}`):i&&console.log(`Rx.Ops.transform output: ${JSON.stringify(n)}`),a.set(n)}});return $e(a)}function it(e,t={}){let n=v(t.elapsed,50),r,i=ye(()=>{let e=r;e&&(a.set(e),r=void 0)},n),a=Xe(e,{...t,onValue(e){r=e,i.start()}});return $e(a)}function at(e){return t=>it(t,e)}function ot(e={}){let t=x(e);return{dispose:t.dispose,isDisposed:t.isDisposed,set(e){t.set(e)},on:t.on,onValue:t.onValue}}function st(e){let t=ct(e);return{dispose:t.dispose,isDisposed:t.isDisposed,on:t.on,onValue:t.onValue}}function ct(e){let t=()=>{},n=ot({onFirstSubscribe(){t=e(n)},onNoSubscribers(){t&&t()}});return{...n,onValue:e=>n.on(t=>{Ke(t)&&e(t.value)})}}const lt=(e,t)=>{if(e===null)throw Error(`Param 'elem' is null. Expected element to observe`);if(e===void 0)throw Error(`Param 'elem' is undefined. Expected element to observe`);let n=st(t=>{let n=new ResizeObserver(e=>{t.set(e)});return n.observe(e),()=>{n.unobserve(e)}});return at({elapsed:t??100})(n)},ut=(e=document.documentElement)=>{let t=st(t=>{let n=new MutationObserver(e=>{t.set(e)}),r={attributeFilter:[`class`],attributes:!0};return n.observe(e,r),()=>{n.disconnect()}});return t};function dt(e){let t=e,n=x(),r=e=>{t=e,n.set(e)};return{dispose:n.dispose,isDisposed:n.isDisposed,last:()=>t,on:n.on,onValue:n.onValue,set:r,setHsl:e=>{r(e)}}}var ft=Object.defineProperty,pt=(e,t,n)=>t in e?ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mt=(e,t)=>{for(var n in t)ft(e,n,{get:t[n],enumerable:!0})},C=(e,t,n)=>pt(e,typeof t==`symbol`?t:t+``,n);function w(e,t){if(e)return;let n=t?Error(t):Error(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);throw n.name=`colorizr`,n}var T={hsl:[`h`,`s`,`l`],oklab:[`l`,`a`,`b`],oklch:[`l`,`c`,`h`],rgb:[`r`,`g`,`b`]},ht=[`hsl`,`oklab`,`oklch`,`rgb`],gt=Math.PI/180,E={l:[.3963377773761749,.2158037573099136],m:[-.1055613458156586,-.0638541728258133],s:[-.0894841775298119,-1.2914855480194092]},D={l:[.4122214708,.5363325363,.0514459929],m:[.2119034982,.6806995451,.1073969566],s:[.0883024619,.2817188376,.6299787005]},O={l:[.2104542553,.793617785,.0040720468],a:[1.9779984951,2.428592205,.4505937099],b:[.0259040371,.7827717662,.808675766]},k={r:[4.076741636075958,-3.307711539258063,.2309699031821043],g:[-1.2684379732850315,2.609757349287688,-.341319376002657],b:[-.0041960761386756,-.7034186179359362,1.7076146940746117]},A=5,_t=180/Math.PI,j={alpha:`amount must be a number between 0 and 1`,hueRange:`hue must be a number between 0 and 360`,input:`input is required`,inputHex:`input is required and must be a hex`,inputNumber:`input is required and must be a number`,inputString:`input is required and must be a string`,invalid:`invalid input`,invalidCSS:`invalid CSS string`,left:`left is required and must be a string`,lightnessRange:`lightness must be a number between 0 and 1`,options:`invalid options`,right:`right is required and must be a string`,threshold:`threshold must be a number between 0 and 255`},vt={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,grey:`#808080`,green:`#008000`,greenyellow:`#adff2f`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`};function yt(e){return Array.isArray(e)&&e.length===6}function M(e){return F(e)&&Object.keys(vt).includes(e.toLowerCase())}function N(e){return typeof e==`number`&&!Number.isNaN(e)}function P(e){if(!e)return!1;let{toString:t}=Object.prototype,n=Object.getPrototypeOf(e);return t.call(e)===`[object Object]`&&(n===null||n===Object.getPrototypeOf({}))}function F(e,t=!0){let n=typeof e==`string`;return t?n&&!!e.trim().length:n}function bt(e){return xt(e)||wt(e)||St(e)||Ct(e)}function I(e){return F(e)?/^#([\da-f]{3,4}|[\da-f]{6,8})$/i.test(e):!1}function xt(e){if(!P(e))return!1;let t=Object.entries(e);return!!t.length&&t.every(([e,t])=>e===`h`?t>=0&&t<=360:e===`alpha`?t>=0&&t<=1:T.hsl.includes(e)&&t>=0&&t<=100)}function St(e){if(!P(e))return!1;let t=Object.entries(e);return!!t.length&&t.every(([e,t])=>e===`l`?t>=0&&t<=100:e===`alpha`?t>=0&&t<=1:T.oklab.includes(e)&&t>=-1&&t<=1)}function Ct(e){if(!P(e))return!1;let t=Object.entries(e);return!!t.length&&t.every(([e,t])=>e===`l`?t>=0&&t<=100:e===`alpha`?t>=0&&t<=1:T.oklch.includes(e)&&t>=0&&t<=(e===`h`?360:1))}function wt(e){if(!P(e))return!1;let t=Object.entries(e);return!!t.length&&t.every(([e,t])=>e===`alpha`?t>=0&&t<=1:T.rgb.includes(e)&&t>=0&&t<=255)}function L(e,t){w(bt(e),j.invalid);let n=t;return!n||(n>1&&(n/=100),n===1)?e:{...e,alpha:n}}function R(e,t=0,n=100){return Math.min(Math.max(e,t),n)}function Tt(e,t){w(N(e),j.inputNumber);let n=e+t;return n>360&&(n%=360),n<0&&(n+=360),Math.abs(n)}function z(e,t,n){switch(w(N(e),`Input is not a number`),w(ht.includes(t),`Invalid model${t?`: ${t}`:``}`),w(T[t].includes(n),`Invalid key${n?`: ${n}`:``}`),t){case`hsl`:return w(T.hsl.includes(n),`Invalid key`),[`s`,`l`].includes(n)?R(e):R(e,0,360);case`rgb`:return w(T.rgb.includes(n),`Invalid key`),R(e,0,255);default:throw Error(`Invalid inputs`)}}function B(e,t){let n=T[t],r={hsl:xt,oklab:St,oklch:Ct,rgb:wt};w(P(e)||Array.isArray(e),j.invalid);let i=Array.isArray(e)?{[n[0]]:e[0],[n[1]]:e[1],[n[2]]:e[2]}:e;return w(r[t](i),`invalid ${t} color`),i}function V(e,t=A,n=!0){let r=new Map(Object.entries(e));for(let[e,i]of r.entries())r.set(e,H(i,t,n));return Object.fromEntries(r)}function H(e,t=2,n=!0){if(!N(e)||e===0)return 0;if(n){let n=10**t;return Math.round(e*n)/n}let r=Math.abs(e),i=Math.abs(Math.ceil(Math.log(r)/Math.LN10));i===0?i=2:i>t&&(i=t);let a=t-(i<0?0:i);a<=1&&t>1?a=2:(a>t||a===0)&&(a=t);let o=10**a;return Math.round(e*o)/o}function Et(e,t){return w(I(e),j.inputHex),w(N(t),j.inputNumber),t>=1?kt(e):`${kt(e)}${Dt(t)}`}function Dt(e){w(N(e),j.inputNumber);let t=e;return e>1&&(t/=100),Math.round(t*255).toString(16).padStart(2,`0`)}function Ot(e){w(I(e),j.inputString);let t=e.substring(7,9);return t?H(parseInt(t,16)/255):1}function kt(e){return w(I(e),j.inputHex),e.length===5?e.substring(0,4):e.substring(0,7)}var U={};mt(U,{hex2hsl:()=>jt,hex2oklab:()=>Ft,hex2oklch:()=>Bt,hex2rgb:()=>W,hsl2hex:()=>Ut,hsl2oklab:()=>Wt,hsl2oklch:()=>Gt,hsl2rgb:()=>q,oklab2hex:()=>Yt,oklab2hsl:()=>Xt,oklab2oklch:()=>Rt,oklab2rgb:()=>Jt,oklch2hex:()=>tn,oklch2hsl:()=>nn,oklch2oklab:()=>$t,oklch2rgb:()=>en,rgb2hex:()=>Ht,rgb2hsl:()=>G,rgb2oklab:()=>K,rgb2oklch:()=>zt});function At(e){w(I(e),j.inputHex);let t=e.replace(`#`,``);if(t.length===3||t.length===4){let e=[...t];t=``,e.forEach(e=>{t+=`${e}${e}`})}let n=`#${t}`;return w(I(n),`invalid hex`),n}function W(e){w(I(e),j.inputHex);let t=At(e).slice(1);return{r:parseInt(t.charAt(0)+t.charAt(1),16),g:parseInt(t.charAt(2)+t.charAt(3),16),b:parseInt(t.charAt(4)+t.charAt(5),16)}}function G(e){let t=B(e,`rgb`),n=z(t.r,`rgb`,`r`)/255,r=z(t.g,`rgb`,`g`)/255,i=z(t.b,`rgb`,`b`)/255,a=Math.min(n,r,i),o=Math.max(n,r,i),s=o-a,c=0,l,u=(o+a)/2,d;switch(o){case n:d=s?(r-i)/s:0,c=60*d;break;case r:d=(i-n)/s,c=60*d+120;break;case i:d=(n-r)/s,c=60*d+240;break;default:break}return c<0&&(c=360+c),l=a===o?0:u<.5?s/(2*u):s/(2-2*u),{h:Math.abs(+(c%360).toFixed(2)),s:+(l*100).toFixed(2),l:+(u*100).toFixed(2)}}function jt(e){return w(I(e),j.inputHex),G(W(e))}var{cbrt:Mt,sign:Nt}=Math;function Pt(e){let t=Math.abs(e);return t<.04045?e/12.92:(Nt(e)||1)*((t+.055)/1.055)**2.4}function K(e,t=A){let n=B(e,`rgb`),[r,i,a]=[Pt(n.r/255),Pt(n.g/255),Pt(n.b/255)],o=Mt(D.l[0]*r+D.l[1]*i+D.l[2]*a),s=Mt(D.m[0]*r+D.m[1]*i+D.m[2]*a),c=Mt(D.s[0]*r+D.s[1]*i+D.s[2]*a),l={l:O.l[0]*o+O.l[1]*s-O.l[2]*c,a:O.a[0]*o-O.a[1]*s+O.a[2]*c,b:O.b[0]*o+O.b[1]*s-O.b[2]*c};return V(l,t)}function Ft(e,t){return w(I(e),j.inputHex),K(W(e),t)}var{atan2:It,sqrt:Lt}=Math;function Rt(e,t){let{l:n,a:r,b:i}=V(B(e,`oklab`)),a=Lt(r**2+i**2),o=(It(i,r)*_t+360)%360;return H(a*1e4)===0&&(o=0),V({l:n,c:a,h:o},t)}function zt(e,t){let n=B(e,`rgb`);return Rt(K(n,t),t)}function Bt(e,t){return w(I(e),j.inputHex),zt(W(e),t)}function Vt(e,t,n){w(N(e)&&N(t)&&N(n),`point, chroma and h are required`);let r=n;return r<0&&(r+=1),r>1&&--r,H(r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e,4)}function q(e){let t=B(e,`hsl`),n=H(t.h)/360,r=H(t.s)/100,i=H(t.l)/100,a,o,s,c,l;return r===0?(a=i,o=i,s=i):(l=i<.5?i*(1+r):i+r-i*r,c=2*i-l,a=Vt(c,l,n+1/3),o=Vt(c,l,n),s=Vt(c,l,n-1/3)),{r:Math.round(a*255),g:Math.round(o*255),b:Math.round(s*255)}}function Ht(e){let t=B(e,`rgb`);return`#${Object.values(t).map(e=>`0${Math.floor(e).toString(16)}`.slice(-2)).join(``)}`}function Ut(e){let t=B(e,`hsl`);return Ht(q(t))}function Wt(e,t){let n=B(e,`hsl`);return K(q(n),t)}function Gt(e,t){let n=B(e,`hsl`);return zt(q(n),t)}var{abs:Kt}=Math;function qt(e){let t=Kt(e),n=e<0?-1:1;return t>.0031308?n*(t**(1/2.4)*1.055-.055):e*12.92}function Jt(e,t=0){let{l:n,a:r,b:i}=B(e,`oklab`),a=(n+E.l[0]*r+E.l[1]*i)**3,o=(n+E.m[0]*r+E.m[1]*i)**3,s=(n+E.s[0]*r+E.s[1]*i)**3,c=255*qt(k.r[0]*a+k.r[1]*o+k.r[2]*s),l=255*qt(k.g[0]*a+k.g[1]*o+k.g[2]*s),u=255*qt(k.b[0]*a+k.b[1]*o+k.b[2]*s);return{r:R(H(c,t),0,255),g:R(H(l,t),0,255),b:R(H(u,t),0,255)}}function Yt(e){let t=B(e,`oklab`);return Ht(Jt(t))}function Xt(e){let t=B(e,`oklab`);return G(Jt(t))}var{sin:Zt,cos:Qt}=Math;function $t(e,t){let{l:n,c:r,h:i}=B(e,`oklch`);return(Number.isNaN(i)||i<0)&&(i=0),V({l:n,a:r*Qt(i*gt),b:r*Zt(i*gt)},t)}function en(e,t=0){let n=B(e,`oklch`);return Jt($t(n),t)}function tn(e){let t=B(e,`oklch`);return Ht(en(t))}function nn(e){let t=B(e,`oklch`);return G(en(t))}function J(e){if(w(F(e),j.inputString),I(e)){let t=T.rgb,{r:n,g:r,b:i}=W(e),a=Ot(e);return{model:`rgb`,[t[0]]:n,[t[1]]:r,[t[2]]:i,alpha:a<1?a:void 0}}let t=/(?:(rgb|hsl|oklab|oklch)a?\s*\(\s*([\d%.-]+)\s*[ ,/]\s*([\d%.-]+)\s*[ ,/]\s*([\d%.-]+)(?:\s*[ ,/]\s*([\d%.-]+))?\s*\))/i,n=t.exec(e);w(yt(n),j.invalidCSS);let r=n[1],i=T[r],a=n[5]?parseFloat(n[5]):1;return a>1&&(a/=100),{model:r,[i[0]]:parseFloat(n[2]),[i[1]]:parseFloat(n[3]),[i[2]]:parseFloat(n[4]),alpha:a<1?a:void 0}}function Y(e,t){w(F(e),j.inputString);let n,r=M(e)?vt[e.toLowerCase()]:e,i=t??(I(r)?`hex`:J(r).model),a=e=>Object.values(e);if(I(r)){let e=Ot(r);switch(i){case`hsl`:n=L(jt(r),e);break;case`oklab`:n=L(Ft(r),e);break;case`oklch`:n=L(Bt(r),e);break;case`rgb`:n=L(W(r),e);break;default:n=`${kt(r)}${e===1?``:Dt(e)}`;break}return n}switch(i){case`hsl`:{let{alpha:e,model:t,...i}=J(r);[`oklab`,`oklch`].includes(t)&&i.l>1&&(i.l=H(i.l/100,A)),n=L(t===`hsl`?i:U[`${t}2hsl`](a(i)),e);break}case`oklab`:{let{alpha:e,model:t,...i}=J(r);[`oklab`,`oklch`].includes(t)&&i.l>1&&(i.l=H(i.l/100,A)),n=L(t===`oklab`?i:U[`${t}2oklab`](a(i)),e);break}case`oklch`:{let{alpha:e,model:t,...i}=J(r);[`oklab`,`oklch`].includes(t)&&i.l>1&&(i.l=H(i.l/100,A)),n=L(t===`oklch`?i:U[`${t}2oklch`](a(i)),e);break}case`rgb`:{let{alpha:e,model:t,...i}=J(r);[`oklab`,`oklch`].includes(t)&&i.l>1&&(i.l/=100),n=L(t===`rgb`?i:U[`${t}2rgb`](a(i)),e);break}case`hex`:default:{let{alpha:e,model:t,...i}=J(r),o=``;[`oklab`,`oklch`].includes(t)&&i.l>1&&(i.l=H(i.l/100,A)),e&&(o=Dt(e)),n=`${U[`${t}2hex`](a(i))}${o}`;break}}return n}function rn(e){w(!!e,j.input);let t={};if(F(e)){let{alpha:n=1}=J(e),r=I(e)?`hex`:J(e).model;t.hex=Et(Y(e,`hex`),n),t.hsl=L(Y(e,`hsl`),n),t.oklab=L(Y(e,`oklab`),n),t.oklch=L(Y(e,`oklch`),n),t.rgb=L(Y(e,`rgb`),n),t.alpha=n,t.type=r}else if(P(e)){let{alpha:n=1}=e;if(xt(e))t.hsl={h:z(e.h,`hsl`,`h`),s:z(e.s,`hsl`,`s`),l:z(e.l,`hsl`,`l`)},t.rgb=q(t.hsl),t.oklab=Wt(t.hsl),t.oklch=Gt(t.hsl),t.type=`hsl`;else if(St(e))t.hsl=Xt(e),t.oklab=e,t.oklch=Rt(e),t.rgb=Jt(e),t.type=`oklab`;else if(Ct(e))t.hsl=nn(e),t.oklab=$t(e),t.oklch=e,t.rgb=en(e),t.type=`oklch`;else if(wt(e))t.rgb={r:z(e.r,`rgb`,`r`),g:z(e.g,`rgb`,`g`),b:z(e.b,`rgb`,`b`)},t.hsl=G(t.rgb),t.oklab=K(t.rgb),t.oklch=zt(t.rgb),t.type=`rgb`;else throw Error(`invalid color`);t.hex=Et(Ut(t.hsl),n),t.hsl=L(t.hsl,n),t.oklab=L(t.oklab,n),t.oklch=L(t.oklch,n),t.rgb=L(t.rgb,n),t.alpha=n}else throw Error(j.input);return t}function an(e,t,n=A){w(F(e),j.left),w(F(t),j.right);let r=Y(e,`rgb`),i=Y(t,`rgb`),a=(r.r*299+r.g*587+r.b*114)/1e3,o=(i.r*299+i.g*587+i.b*114)/1e3;return H(Math.abs(o-a),n)}function on(e){w(F(e),j.inputString);let{r:t,g:n,b:r}=Y(e,`rgb`),i=Math.max(t,n,r),a=Math.min(t,n,r);return H((i-a)/255,4)}function sn(e,t){w(F(e),j.left),w(F(t),j.right);let n=Y(e,`rgb`),r=Y(t,`rgb`);return Math.max(n.r,r.r)-Math.min(n.r,r.r)+(Math.max(n.g,r.g)-Math.min(n.g,r.g))+(Math.max(n.b,r.b)-Math.min(n.b,r.b))}function cn(e){w(F(e),j.inputString);let{r:t,g:n,b:r}=Y(e,`rgb`),i=[t/255,n/255,r/255];for(let e=0;e<i.length;e++)i[e]<=.03928?i[e]/=12.92:i[e]=((i[e]+.055)/1.055)**2.4;return H(.2126*i[0]+.7152*i[1]+.0722*i[2],4)}function ln(e,t){w(F(e),j.left),w(F(t),j.right);let n=cn(e),r=cn(t);return H(n>=r?(n+.05)/(r+.05):(r+.05)/(n+.05))}function un(e,t){w(F(e),j.left),w(F(t),j.right);let n=500,r=125,i=sn(e,t),a=ln(e,t),o=an(e,t),s=o>=r,c=i>=n,l=0;return s&&c?l=2:(s||c)&&(l=1),{brightnessDifference:o,colorDifference:i,compliant:l,contrast:a,largeAA:a>=3,largeAAA:a>=4.5,normalAA:a>=4.5,normalAAA:a>=7}}function dn(e){if(I(e)||M(e))return`hex`;if(F(e))return J(e).model;if(xt(e))return`hsl`;if(St(e))return`oklab`;if(Ct(e))return`oklch`;if(wt(e))return`rgb`;throw Error(j.invalid)}function fn(e,t){let n=M(e)?vt[e.toLowerCase()]:e,r=dn(n);if(r===t)return n;let i=`${r}2${t}`,a=U[i];if(!a)throw Error(`Converter not found for ${r} to ${t}`);switch(r){case`hex`:return t===`hex`?n:a(n);case`hsl`:return t===`hsl`?n:a(n);case`oklab`:return t===`oklab`?n:a(n);case`oklch`:return t===`oklch`?n:a(n);default:return t===`rgb`?n:a(n)}}function X(e,t={}){w(I(e)||bt(e),j.invalid);let{alpha:n,format:r=`hex`,precision:i=A,separator:a=` `}=t,o=n&&n!==1?`${H(n*100)}%`:null,s=[],c=a;switch(r){case`hsl`:{let{h:t,s:n,l:r}=fn(e,`hsl`);s=[t,`${n}%`,`${r}%`];break}case`oklab`:{c=` `;let{l:t,a:n,b:r}=V(fn(e,`oklab`),i);s=[`${H(t*100,i)}%`,n,r];break}case`oklch`:{c=` `;let{l:t,c:n,h:r}=V(fn(e,`oklch`),i);s=[`${H(t*100,i)}%`,n,r];break}case`rgb`:{let{r:t,g:n,b:r}=fn(e,`rgb`);s=[t,n,r];break}default:{let t=kt(fn(e,`hex`));return n&&n!==1?`${t}${Dt(n)}`:t}}return`${r}(${s.join(c)}${o?` / ${o}`:``})`}function pn(e,t,n){return(r,i)=>{w(F(r),j.inputString),w(N(i),j.alpha);let a=Y(r,`hsl`),o=I(r)||M(r)?`hex`:J(r).model;return X({...a,[e]:R(a[e]+(t===`+`?i:-i),0,100)},{format:n??o})}}function mn(e,t,n){return pn(`l`,`-`,n)(e,t)}function hn(e,t,n){return pn(`s`,`-`,n)(e,t)}function gn(e,t,n){w(F(e),j.inputString),w(N(t),`degrees must be a number`);let r=Y(e,`hsl`),i=I(e)||M(e)?`hex`:J(e).model;return X({...r,h:Tt(r.h,t)},{format:n??i})}function _n(e){w(F(e),j.inputString);let t=I(e)||M(e)?`hex`:J(e).model,n=Y(e,`hex`);return X(gn(n,180),{format:t})}function vn(e,t,n){return pn(`l`,`+`,n)(e,t)}function yn(e,t,n){w(F(e),j.inputString),w(N(t),j.alpha);let r=I(e)||M(e)?`hex`:J(e).model,i=Y(e,`rgb`);return X(i,{format:n??r,alpha:t})}function bn(e){if(w(F(e),j.inputString),I(e))return Ot(e);if(Object.keys(vt).includes(e))return 1;let{alpha:t}=J(e);return t||1}function xn(e,t,n){return pn(`s`,`+`,n)(e,t)}function Sn(e,t={}){let{darkColor:n=`#000000`,lightColor:r=`#ffffff`,threshold:i=128}=t;w(F(e),j.inputString),w(i>=0&&i<=255,j.threshold);try{let{r:t,g:a,b:o}=W(Y(e,`hex`)),s=(t*299+a*587+o*114)/1e3;return s>=i?n:r}catch(t){return console.warn(`Invalid color input: ${e}`),console.warn(t),n}}function Cn(e,t,n){w(F(e),j.inputString),w(N(t),j.alpha),w(t>=-1&&t<=1,j.alpha);let r=Y(e,`oklab`),i=H(R(bn(e)-t,0,1));return X(r,{format:n,alpha:i})}var wn=class{constructor(e,t={}){C(this,`alpha`),C(this,`hex`),C(this,`hsl`),C(this,`oklab`),C(this,`oklch`),C(this,`rgb`),C(this,`type`),w(!!e,`color is required`);let{alpha:n,hex:r,hsl:i,oklab:a,oklch:o,rgb:s,type:c}=rn(e);this.hex=r,this.hsl=i,this.oklab=a,this.oklch=o,this.rgb=s,this.alpha=n,this.type=t.format??c}get css(){return this.selectedColor}get red(){return Number(this.rgb.r)}get green(){return Number(this.rgb.g)}get blue(){return Number(this.rgb.b)}get hue(){return Number(this.hsl.h)}get saturation(){return Number(this.hsl.s)}get lightness(){return Number(this.hsl.l)}get luminance(){return cn(this.selectedColor)}get chroma(){return on(this.selectedColor)}get opacity(){return bn(this.selectedColor)}get textColor(){return Sn(this.selectedColor)}get selectedColor(){return X(this[this.type],{format:this.type,alpha:this.alpha})}brightnessDifference(e){return an(this.selectedColor,e)}colorDifference(e){return sn(this.selectedColor,e)}compare(e){return un(this.selectedColor,e)}contrast(e){return ln(this.selectedColor,e)}format(e,t){return X(this.rgb,{alpha:this.alpha,format:e,precision:t})}lighten(e){return vn(this.selectedColor,e)}darken(e){return mn(this.selectedColor,e)}saturate(e){return xn(this.selectedColor,e)}desaturate(e){return hn(this.selectedColor,e)}invert(){return _n(this.selectedColor)}opacify(e=.9){return yn(this.selectedColor,e,this.type)}rotate(e){return gn(this.selectedColor,e)}transparentize(e=.1){return Cn(this.selectedColor,e,this.type)}};function Tn(e,t){let n=Y(e,t);return X(n,{format:t})}var En=wn;const Dn=e=>(typeof e==`object`&&(!(`h`in e&&`s`in e&&`l`in e)||!(`unit`in e)||`space`in e&&e.space),!1),On=e=>(typeof e==`object`&&(!(`r`in e&&`g`in e&&`b`in e)||!(`unit`in e)||`space`in e&&e.space),!1),kn=e=>{if(`r`in e&&`g`in e&&`b`in e){if(!(`unit`in e))if(e.r<=1&&e.g<=1&&e.b<=1)e.unit=`scalar`;else if(e.r>255&&e.g<=255&&e.b<=255)return;else e.unit=`8bit`;return`space`in e||(e.space=`srgb`),e}},An=e=>{if(`h`in e&&`s`in e&&`l`in e){if(!(`unit`in e))if(e.r<=1&&e.g<=1&&e.b<=1)e.unit=`scalar`;else if(e.s>100&&e.l<=100)return;else e.unit=`absolute`;return`space`in e||(e.space=`hsl`),e}},jn=e=>{if(typeof e==`object`){if(!(`l`in e&&`c`in e&&`h`in e)||!(`unit`in e))return!1;if(`space`in e&&(e.space===`lch`||e.space==`oklch`))return!0}return!1},Mn=e=>typeof e==`string`?!0:typeof e==`object`?!!(Dn(e)||jn(e)||On(e)):!1,Nn=Object.freeze({h:0,s:0,l:0,opacity:0,unit:`absolute`,space:`hsl`});function Pn(e,t={}){return In(jt(e),t)}function Z(e,t={}){if(e=e.toLowerCase(),e.startsWith(`hsla(`))throw Error(`hsla() not supported`);if(e.startsWith(`rgba(`))throw Error(`rgba() not supported`);if(e.startsWith(`#`))return Pn(e,t);if(e.startsWith(`--`))try{er(e)}catch(e){if(t.fallbackString!==void 0)return Z(t.fallbackString);if(t.fallbackColour!==void 0)return t.fallbackColour;throw e}if(e===`transparent`)return Nn;if(Q[e]!==void 0)return Pn(Q[e],t);if(e.startsWith(`rgb(`)){let n=dr(e);return In(n,t)}if(!e.startsWith(`hsl(`))try{e=Tn(e,`hsl`)}catch(n){if(t.fallbackString)e=t.fallbackString;else throw n}try{let n=Hn(e);return t.scalar?Rn(n):Ln(n)}catch(e){if(t.fallbackColour)return t.fallbackColour;throw e}}const Fn=e=>{let t=Ln(e),n=`hsl(${t.h}deg ${t.s}% ${t.l}%`;return`opacity`in t&&t.opacity!==void 0&&t.opacity<100&&(n+=` / ${t.opacity}%`),n+=`)`,n};function In(e,t={}){if(e==null&&t.fallbackColour)return t.fallbackColour;let r=t.scalar??!0;return n(l(e.h,0,360,`h`),l(e.s,0,100,`s`),l(e.l,0,100,`l`),s(e.alpha??1,`alpha`)),r?Bn(e.h/360,e.s/100,e.l/100,e.alpha??1):Vn(e.h,e.s,e.l,(e.alpha??1)*100)}const Ln=e=>{if(typeof e==`string`)return Z(e,{scalar:!1});if(On(e))return Ln(In(dr(e),{scalar:!1}));let t=e;return zn(t),t.unit===`absolute`?t:{h:t.h*360,s:t.s*100,l:t.l*100,opacity:(t.opacity??1)*100,unit:`absolute`,space:`hsl`}},Rn=e=>{if(typeof e==`string`)return Z(e,{scalar:!0});if(On(e))return Rn(In(dr(e),{scalar:!0}));let t=e;return zn(t),t.unit===`scalar`?t:{h:t.h/360,s:t.s/100,l:t.l/100,opacity:(t.opacity??1)/100,unit:`scalar`,space:`hsl`}},zn=e=>{let{h:t,s:r,l:i,opacity:a,space:s,unit:c}=e;if(s!==`hsl`)throw Error(`Space is expected to be 'hsl'. Got: ${s}`);if(c===`absolute`)n(o(t,`finite`,`h`),l(r,0,100,`s`),l(i,0,100,`l`),()=>{if(typeof a==`number`)return l(a,0,100,`opacity`)});else if(c===`scalar`)n(o(t,`percentage`,`h`),o(r,`percentage`,`s`),o(i,`percentage`,`l`),()=>{if(typeof a==`number`)return o(a,`percentage`,`opacity`)});else throw Error(`Unit is expected to be 'absolute' or 'scalar'. Got: ${c}`)};function Bn(e=.5,t=1,n=.5,r=1){let i={unit:`scalar`,space:`hsl`,h:e,s:t,l:n,opacity:r};return zn(i),i}function Vn(e=200,t=100,n=50,r=100){let i={unit:`absolute`,space:`hsl`,h:e,s:t,l:n,opacity:r};return zn(i),i}function Hn(e){if(e.startsWith(`hsla`))throw Error(`hsla() is not supported`);if(!e.startsWith(`hsl(`))throw Error(`Expected hsl(..) CSS colour`);let t=e.indexOf(`(`),n=e.indexOf(`)`);if(n<t)throw Error(`Is hsl() not terminated? Missing ')'`);let r=e.substring(t+1,n),i=r.split(/[\s,]+/);if(i.length<3)throw Error(`Expected three tokens. Got: ${i.length} length`);let a=!1;i[0].endsWith(`%`)&&(a=!0),i[1].endsWith(`%`)&&i[2].endsWith(`%`)&&(a=!0);let o=(e,t)=>{if(e===`none`)return 0;if(e.endsWith(`%`))return Number.parseFloat(e.substring(0,e.length-1))/100;e.endsWith(`deg`)&&t===0&&(e=e.substring(0,e.length-3));let n=Number.parseFloat(e);return t===0?n/360:t===3?n:n/100},s=(e,t)=>{if(e===`none`)return 0;if(e.endsWith(`%`)){let n=Number.parseFloat(e.substring(0,e.length-1));return t===0?n*360:n}if(e.endsWith(`deg`)&&t===0)return Number.parseFloat(e.substring(0,e.length-3));let n=Number.parseFloat(e);return n};return i.length>3&&i[3]===`/`&&(i=[i[0],i[1],i[2],i[4]]),a?Bn(o(i[0],0),o(i[1],1),o(i[2],2),o(i[3]??`100%`,3)):Vn(s(i[0],0),s(i[1],1),s(i[2],2),s(i[3]??`100%`,3))}function Un(e){if(typeof e==`string`){let t=Z(e,{scalar:!1});return Un(t)}e=Ln(e);let t=q({h:e.h,s:e.s,l:e.l});return{...t,alpha:(e.opacity??100)/100*255}}const Wn=.4,Gn=e=>{let{l:t,c:r,h:i,opacity:a,space:o,unit:c}=e;if(o!==`oklch`)throw Error(`Space is expected to be 'oklch'. Got: ${o}`);if(c===`absolute`)n(s(t,`l`),()=>{if(typeof r==`number`)return l(r,0,Wn,`c`)},()=>{if(typeof i==`number`)return l(r,0,360,`h`)},s(a??1,`opacity`));else if(c===`scalar`)n(s(t,`l`),s(r,`c`),s(i,`h`),s(e.opacity??1,`opacity`));else throw Error(`Unit is expected to be 'absolute' or 'scalar'. Got: ${c}`)};function Kn(e,t={}){if(e==null&&t.fallbackColour)return t.fallbackColour;let r=t.scalar??!0;return n(s(e.l,`l`),s(e.c,`c`),l(e.h,0,360,`h`),s(e.alpha??1,`alpha`)),r?Zn(e.l,e.c/Wn,e.h/360,e.alpha??1):Qn(e.l,e.c,e.h,e.alpha??1)}const qn=(e,t={})=>Kn(Bt(e),t),Jn=Object.freeze({l:0,c:0,h:0,opacity:0,unit:`absolute`,space:`oklch`});function Yn(e,t={}){if(e=e.toLowerCase(),e.startsWith(`#`))return qn(e,t);if(e===`transparent`)return Jn;if(Q[e]!==void 0)return qn(Q[e],t);if(e.startsWith(`rgb(`)){let n=or(ur(e)),r=zt({r:n.r,g:n.g,b:n.b});return Kn(r,t)}if(!e.startsWith(`hsl(`)&&!e.startsWith(`oklch(`))try{let t=Tn(e,`oklch`);e=t}catch(n){if(t.fallbackString)e=t.fallbackString;else throw n}let n=new En(e),r=n.oklch;return Kn(r,t)}const Xn=(e,t=3)=>{Gn(e);let{l:n,c:r,h:i,opacity:a}=e,o=``;switch(e.unit){case`absolute`:o=`oklch(${(n*100).toFixed(t)}% ${r.toFixed(t)} ${i.toFixed(t)}`;break;case`scalar`:o=`oklch(${n.toFixed(t)} ${(r*Wn).toFixed(t)} ${(i*360).toFixed(t)}`;break}return a!==void 0&&a!==1&&(o+=` / ${a.toFixed(t)}`),o+=`)`,o};function Zn(e=.7,t=.1,n=.5,r=1){let i={unit:`scalar`,space:`oklch`,l:e,c:t,h:n,opacity:r};return Gn(i),i}const Qn=(e,t,n,r=1)=>{let i={space:`oklch`,unit:`absolute`,opacity:r,l:e,c:t,h:n};return Gn(i),i},$n=e=>{if(e.startsWith(`#`))return tr(e,!0);if(Q[e]!==void 0)return tr(Q[e],!0);if(e.startsWith(`--`)){let t=getComputedStyle(document.body).getPropertyValue(e).trim();if(t.length===0||t===null)throw Error(`Variable missing: ${e}`);return $n(t)}if(e=e.toLowerCase(),e.startsWith(`hsl(`))return Z(e,{scalar:!0});if(e.startsWith(`rgb(`))return rr(e,{scalar:!0});if(e.startsWith(`oklch(`))return Yn(e,{scalar:!0});throw Error(`String colour is not a hex colour, CSS variable nor well-defined colour. Input: '${e}'`)},er=(e,t)=>{if(e.startsWith(`--`)){let n=getComputedStyle(document.body).getPropertyValue(e).trim();if(n.length===0||n===null){if(t!==void 0)return t;throw Error(`CSS variable missing: '${e}'`)}return er(n)}return Q[e]===void 0?e:Q[e]},Q={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`,transparent:`#00000000`};function tr(e,t=!0){return ar(W(e),{scalar:t})}const nr=Object.freeze({r:0,g:0,b:0,opacity:0,unit:`8bit`,space:`srgb`});function rr(e,t={}){if(e=e.toLowerCase(),e.startsWith(`hsla(`))throw Error(`hsla() not supported`);if(e.startsWith(`rgba(`))throw Error(`rgba() not supported`);let n=t.scalar??!0;if(e.startsWith(`#`))return tr(e,n);if(e===`transparent`)return nr;if(Q[e]!==void 0&&tr(Q[e],n),e.startsWith(`hsl(`)){let n=Un(e);return ar(n,t)}if(!e.startsWith(`rgb(`))try{e=Tn(e,`rgb`)}catch(n){if(t.fallbackString)e=t.fallbackString;else throw n}try{let t=ur(e);return n?sr(t):or(t)}catch(e){if(t.fallbackColour)return t.fallbackColour;throw e}}const ir=e=>{switch($(e),e.unit){case`8bit`:return e.opacity===void 0||e.opacity===255?`rgb(${e.r} ${e.g} ${e.b})`:`rgb(${e.r} ${e.g} ${e.b} / ${(e.opacity??255)/255})`;case`scalar`:return e.opacity===void 0||e.opacity===1?`rgb(${e.r*100}% ${e.g*100}% ${e.b*100}%)`:`rgb(${e.r*100}% ${e.g*100}% ${e.b*100}% / ${(e.opacity??1)*100}%)`;default:throw Error(`Unknown unit: ${e.unit}`)}};function ar(e,t={}){return t.scalar?{r:e.r/255,g:e.g/255,b:e.b/255,opacity:e.alpha??1,unit:`scalar`,space:`srgb`}:{r:e.r,g:e.g,b:e.b,opacity:e.alpha??255,unit:`8bit`,space:`srgb`}}const or=e=>typeof e==`string`?rr(e,{scalar:!1}):Dn(e)?or(ar(Un(e),{scalar:!1})):($(e),e.unit===`8bit`?e:{r:e.r*255,g:e.g*255,b:e.b*255,opacity:(e.opacity??1)*255,unit:`8bit`,space:`srgb`}),sr=e=>typeof e==`string`?rr(e,{scalar:!0}):Dn(e)?sr(ar(Un(e),{scalar:!0})):($(e),e.unit===`scalar`?e:{r:e.r/255,g:e.g/255,b:e.b/255,opacity:(e.opacity??1)/255,unit:`scalar`,space:`srgb`}),$=e=>{let{r:t,g:r,b:i,opacity:a,space:s,unit:c}=e;if(s!==`srgb`)throw Error(`Space is expected to be 'srgb'. Got: ${s}`);if(c===`8bit`)n(l(t,0,255,`r`),l(r,0,255,`g`),l(i,0,255,`b`),()=>{if(typeof a==`number`)return l(a,0,255,`opacity`)});else if(c===`scalar`)n(o(t,`percentage`,`r`),o(r,`percentage`,`g`),o(i,`percentage`,`b`),()=>{if(typeof a==`number`)return o(a,`percentage`,`opacity`)});else throw Error(`Unit is expected to be '8bit' or 'scalar'. Got: ${c}`)};function cr(e=100,t=100,n=100,r=255){let i={unit:`8bit`,space:`srgb`,r:e,g:t,b:n,opacity:r};return $(i),i}function lr(e=.5,t=.5,n=.5,r=1){let i={unit:`scalar`,space:`srgb`,r:e,g:t,b:n,opacity:r};return $(i),i}function ur(e){if(e.startsWith(`rgba`))throw Error(`RGBA is not supported`);if(!e.startsWith(`rgb(`))throw Error(`Expected rgb(..) CSS colour`);let t=e.indexOf(`(`),n=e.indexOf(`)`);if(n<t)throw Error(`Is rgb() not terminated? Missing ')'`);let r=e.substring(t+1,n),i=r.split(/[\s,]+/);if(i.length<3)throw Error(`Expected three tokens. Got: ${i.length} length`);let a=0;for(let e of i)e.endsWith(`%`)&&a++;let o=(e,t)=>e.endsWith(`%`)?Number.parseFloat(e.substring(0,e.length-1))/100:t<3?Number.parseFloat(e)/255:Number.parseFloat(e),s=(e,t)=>e.endsWith(`%`)?Number.parseFloat(e.substring(0,e.length-1))/100*255:t<3?Number.parseFloat(e):Number.parseFloat(e)*255;return i.length>3&&i[3]===`/`&&(i=[i[0],i[1],i[2],i[4]]),a>1?lr(o(i[0],0),o(i[1],1),o(i[2],2),o(i[3]??`1`,3)):cr(s(i[0],0),s(i[1],1),s(i[2],2),s(i[3]??`1`,3))}function dr(e){if(typeof e==`string`){let t=rr(e,{scalar:!1});return dr(t)}e=or(e);let t=G({r:e.r,g:e.g,b:e.b});return{...t,alpha:(e.opacity??255)/255}}const fr=e=>{if(typeof e==`string`)return e;if(Dn(e))return Fn(e);if(On(e))return ir(e);if(jn(e))return Xn(e);let t=kn(e);if(t)return ir(t);let n=An(e);if(n)return Fn(n);throw Error(`Unknown colour format: '${JSON.stringify(e)}'`)},pr=e=>{switch(e.space){case`hsl`:zn(e);break;case`srgb`:$(e);break;default:throw Error(`Unknown colour space: '${e.space}'`)}},mr=e=>{if(!Mn(e))throw Error(`Could not parse input. Expected CSS colour string or structured colour {r,g,b}, {h,s,l} etc.`);let t;if(t=typeof e==`string`?$n(e):e,t===void 0)throw Error(`Could not parse input. Expected CSS colour string or structured colour {r,g,b}, {h,s,l} etc.`);return pr(t),t};function hr(e,t={}){let n=_r(e,t),r=n.el,i=t.relative??!1,a=t.inverted??!1,o=rt(n,e=>Number.parseFloat(e));i&&(r.max=a?`0`:`1`,r.min=a?`1`:`0`,r.hasAttribute(`step`)||(r.step=`0.1`)),r.getAttribute(`type`)===null&&(r.type=`range`);let s=e=>{n.set(e.toString())};return{...o,last(){return Number.parseFloat(n.last())},set:s}}function gr(e,t={}){let n=_r(e,{...t,upstreamFilter:e=>typeof e==`object`?fr(e):e}),r=rt(n,e=>Z(e,{scalar:!0,ensureSafe:!0}));return{...r,last(){return Z(n.last(),{scalar:!0,ensureSafe:!0})},set(e){n.set(Fn(e))}}}function _r(e,t={}){let n=typeof e==`string`?document.querySelector(e):e;if(n===null&&typeof e==`string`)throw Error(`Element query could not be resolved '${e}'`);if(n===null)throw Error(`targetOrQuery is null`);let r=S(e),i=t.when??`changed`,a=i===`changed`?`change`:`input`,o=t.emitInitialValue??!1,s=t.fallbackValue??``,c=t.upstreamSource,l=()=>{},u=t.attributeName,d=t.fieldName;d===void 0&&u===void 0&&(u=d=`value`);let f=()=>{let e;return u&&(e=r.getAttribute(u)),d&&(e=r[d]),e??=s,e},p=e=>{u&&r.setAttribute(u,e),d&&(r[d]=e)},m=e=>{e=t.upstreamFilter?t.upstreamFilter(e):e,p(e)};c&&(l=c.onValue(m),b(c)&&m(c.last()));let h=tt(r,a,{fireInitial:o,debugFiring:t.debugFiring??!1,debugLifecycle:t.debugLifecycle??!1}),g=rt(h,e=>f());return{...g,el:r,last(){return f()},set(e){p(e)},dispose(e){l(),g.dispose(e),h.dispose(e)}}}function vr(e,t={}){let n=S(e),r=t.when??`changed`,i=r===`changed`?`change`:`input`,a=t.emitInitialValue??!1,o=t.upstreamSource,s=new Map,c=()=>{},l=()=>{let e=new FormData(n),t=[];for(let[n,r]of e.entries()){let e=r.toString(),i=s.get(n);if(!i){let t=u(n,e);t&&(i=t.type===`range`||t.type===`number`?`number`:t.type===`color`?`colour`:t.type===`checkbox`&&(r===`true`||r===`on`)?`boolean`:`string`,s.set(n,i))}if(i===`number`)t.push([n,Number.parseFloat(e)]);else if(i===`boolean`){let r=e===`true`;t.push([n,r])}else if(i===`colour`){let r=fr(e);t.push([n,rr(r,{scalar:!1})])}else t.push([n,r.toString()])}for(let e of n.querySelectorAll(`input[type="checkbox"]`))!e.checked&&e.value===`true`&&t.push([e.name,!1]);let r=Object.fromEntries(t);return r},u=(e,t)=>{let r=n.querySelector(`[name="${e}"]`);if(!r){console.warn(`Form does not contain an element with name="${e}"`);return}if(r.type===`radio`){let r=n.querySelector(`[name="${e}"][value="${t}"]`);if(!r){console.warn(`Form does not contain radio option for name=${e} value=${t}`);return}return r}return r},d=(e,t)=>{let n=u(e,t);if(n&&(n.nodeName===`INPUT`||n.nodeName===`SELECT`)){if(n.type===`color`)typeof t==`object`&&(t=fr(t));else if(n.type===`checkbox`)if(typeof t==`boolean`){n.checked=t;return}else console.warn(`Rx.Sources.domForm: Trying to set non boolean type to a checkbox. Name: ${e} Value: ${t} (${typeof t})`);else if(n.type===`radio`){n.checked=!0;return}n.value=t}},f=e=>{for(let[n,r]of Object.entries(e)){let e=s.get(n);e||(e=typeof r,e===`object`&&(mr(r),e=`colour`),s.set(n,e));let i=t.upstreamFilter?t.upstreamFilter(n,r):r;d(n,i)}};o&&(c=o.onValue(f),b(o)&&f(o.last()));let p=tt(n,i,{fireInitial:a,debugFiring:t.debugFiring??!1,debugLifecycle:t.debugLifecycle??!1}),m=rt(p,e=>l());return{...m,el:n,last(){return l()},set:f,setNamedValue:d,dispose(e){c(),m.dispose(e),p.dispose(e)}}}function yr(e){let t=[...document.querySelectorAll(e)];return Qe(t)}const br=(e,t,n={})=>Cr(e,t,{...n,elField:`textContent`}),xr=(e,t,n={})=>Cr(e,t,{...n,elField:`value`,attribName:`value`}),Sr=(e,t,n={})=>Cr(e,t,{...n,elField:`innerHTML`}),Cr=(e,t,...n)=>{if(t===null)throw Error(`Param 'elOrQuery' is null`);if(t===void 0)throw Error(`Param 'elOrQuery' is undefined`);let r=S(t),i=[];n.length===0?i.push({elField:`textContent`}):i=[...n];let a=i.map(e=>`element`in e?e:{...e,element:r});return Dr(e,...a)},wr=(e,t)=>{let n=Tr(e);return e=>{n(e,t)}},Tr=e=>{if(e.elField!==void 0||e.cssVariable===void 0&&e.attribName===void 0&&e.cssProperty===void 0&&e.textContent===void 0&&e.htmlContent===void 0){let t=e.elField??`textContent`;return(e,n)=>{n[t]=e}}if(e.attribName!==void 0){let t=e.attribName;return(e,n)=>{n.setAttribute(t,e)}}if(e.textContent)return(e,t)=>{t.textContent=e};if(e.htmlContent)return(e,t)=>{t.innerHTML=e};if(e.cssVariable!==void 0){let t=e.cssVariable;return t.startsWith(`--`)||(t=`--`+t),(e,n)=>{n.style.setProperty(t,e)}}return e.cssProperty===void 0?(e,t)=>{}:(t,n)=>{n.style[e.cssProperty]=t}},Er=e=>{if(!(!e.transform&&!e.transformValue)){if(e.transformValue){if(e.sourceField===void 0)throw Error(`Expects 'sourceField' to be set when 'transformValue' is set`);return t=>{let n=t[e.sourceField];return e.transformValue(n)}}else if(e.transform){if(e.sourceField!==void 0)throw Error(`If 'transform' is set, 'sourceField' is ignored`);return t=>e.transform(t)}}},Dr=(e,...t)=>{let n=t.map(e=>{if(e.element&&e.element!==void 0)return e;if(e.query)return{...e,element:S(e.query)};throw Error(`Unable to resolve element. Missing 'element' or 'query' values on bind. ${JSON.stringify(e)}`)}),r=n.map(e=>({update:wr(e,e.element),transformer:Er(e),sourceField:e.sourceField})),i=e=>{for(let t of r)if(t.transformer)t.update(t.transformer(e));else{let n=t.sourceField?e[t.sourceField]:e;typeof n==`object`?(t.sourceField,t.update(JSON.stringify(n))):t.update(n)}},a=e.on(e=>{Ke(e)?i(e.value):Ge(e)&&console.warn(e)});return b(e)&&i(e.last()),{remove:e=>{if(a(),e)for(let e of n)e.element.remove()}}},Or=(e,t,n)=>{let r=S(t),i=e=>{n(e,r)},a=e.on(e=>{Ke(e)?(console.log(e),i(e.value)):console.warn(e)});return b(e)&&i(e.last()),{remove:e=>{a(),e&&r.remove()}}},kr=(e,t,n,r={})=>{if(t===null)throw Error(`Param 'elOrQuery' is null`);if(t===void 0)throw Error(`Param 'elOrQuery' is undefined`);let i=S(t),a=e=>{n(e,i)},o=e.onDiff(e=>{a(e)}),s=()=>{b(e)&&r.initial&&r.initial(e.last(),i)};return s(),{refresh:()=>{s()},remove:e=>{o(),e&&i.remove()}}},Ar=(e,t)=>{let n=t.container?S(t.container):document.body,r=t.defaultTag??`div`,i=new Map,a=new Map;for(let[e,n]of Object.entries(t.binds??{})){let t=n.tagName??r;a.set(e,{...n,update:Tr(n),transform:Er(n),tagName:t,path:e})}let o=e=>{let t=h(a,ce(e));if(t!==void 0)return t;if(!e.includes(`.`))return a.get(`_root`)};function*s(e){for(let t of le(e))a.has(t)&&(yield a.get(t));a.has(`_root`)&&e.includes(`.`)&&(yield a.get(`_root`))}let c=(e,t)=>{let a=jr(e);console.log(`Rx.Dom.elements.create: ${e} rooted: ${a} value: ${JSON.stringify(t)}`);let c=o(jr(e)),u=r;c?.tagName&&(u=c.tagName);let d=document.createElement(u);d.setAttribute(`data-path`,e),l(e,d,t);let f;for(let t of s(a))if(t?.nestChildren){let n=ue(e,`.`),r=t.path.replace(`_root`,n);if(f=i.get(r),f!==void 0)break}(f??n).append(d),i.set(e,d),console.log(`Added el: ${e}`)},l=(e,t,n)=>{console.log(`Rx.dom.update path: ${e} value:`,n);let r=o(jr(e));r===void 0?(typeof n==`object`&&(n=JSON.stringify(n)),t.textContent=n):(r.transform&&(n=r.transform(n)),r.update(n,t))},u=e=>{let t=new Ne({},e),n=t.dequeue(),r=new Set;for(;n!==void 0;){let e=n.path;if(!(`previous`in n)||n.previous===void 0){console.log(`Rx.Dom.elements.changes no previous. path: ${e}`),c(e,n.value);let i=[...ie(n.value,!1,2**53-1,e)];console.log(i);for(let e of i)r.has(e.path)||(t.enqueue(e),r.add(e.path))}else if(n.value===void 0){let t=i.get(e);t===void 0?console.warn(`No element to delete? ${e} `):(console.log(`Rx.Dom.elements.changes delete ${e}`),t.remove())}else{let t=i.get(e);t===void 0?(console.warn(`Rx.Dom.elements.changes No element to update ? ${e} `),c(e,n.value)):l(e,t,n.value)}n=t.dequeue()}};if(e.onDiff(e=>{u(e)}),b(e)){let t=e.last();u([...ie(t,!1,1)])}},jr=e=>{let t=de(e,`.`);return t===e?`_root`:`_root.`+t};function Mr(){let e=()=>({width:window.innerWidth,height:window.innerHeight}),t=et(window,`resize`,{lazy:`very`,transform:()=>e()}),n=et(window,`pointermove`,{lazy:`very`,transform:e=>{if(e===void 0)return{x:0,y:0};let t=e;return{x:t.x,y:t.y}}}),r=(e=`Reactive.win.dispose`)=>{t.dispose(e),n.dispose(e)};return{dispose:r,size:t,pointer:n}}var Nr={};e(Nr,{bind:()=>Dr,bindDiffUpdate:()=>kr,bindElement:()=>Cr,bindHtml:()=>Sr,bindText:()=>br,bindUpdate:()=>Or,bindValueText:()=>xr,browserResizeObservable:()=>lt,colour:()=>dt,cssClassChange:()=>ut,domForm:()=>vr,domHslInputValue:()=>gr,domInputValue:()=>_r,domNumberInputValue:()=>hr,elements:()=>Ar,fromDomQuery:()=>yr,win:()=>Mr});export{Nr as Rx};
1
+ import{__export as e}from"./chunk-Cl8Af3a2.js";const t=(e,t)=>{let n=he(Object.keys(e),Object.keys(t));return n};function n(...e){for(let t of e){let e=typeof t==`object`?t:t();if(e===void 0||e.success)continue;throw i(e)}return!0}function r(e){return typeof e==`object`?!e.success:!1}function i(e){if(typeof e.error==`string`)throw Error(e.error,{cause:e.info});if(e.error instanceof Error)throw e.error;return Error(JSON.stringify(e.error),{cause:e.info})}const a=(...e)=>{let t;for(let n of e){if(t=typeof n==`object`?n:n(),t===void 0)continue;if(!t.success)return t}if(!t)throw Error(`No results`);return t},o=(e,t=``,n=`?`,r)=>{if(e===null)return{success:!1,error:`Parameter '${n}' is null`,info:r};if(e===void 0)return{success:!1,error:`Parameter '${n}' is undefined`,info:r};if(Number.isNaN(e))return{success:!1,error:`Parameter '${n}' is NaN`,info:r};if(typeof e!=`number`)return{success:!1,error:`Parameter '${n}' is not a number (${JSON.stringify(e)})`,info:r};switch(t){case`finite`:if(!Number.isFinite(e))return{success:!1,error:`Parameter '${n} must be finite (Got: ${e})`,info:r};break;case`positive`:if(e<0)return{success:!1,error:`Parameter '${n}' must be at least zero (${e})`,info:r};break;case`negative`:if(e>0)return{success:!1,error:`Parameter '${n}' must be zero or lower (${e})`,info:r};break;case`aboveZero`:if(e<=0)return{success:!1,error:`Parameter '${n}' must be above zero (${e})`,info:r};break;case`belowZero`:if(e>=0)return{success:!1,error:`Parameter '${n}' must be below zero (${e})`,info:r};break;case`percentage`:if(e>1||e<0)return{success:!1,error:`Parameter '${n}' must be in percentage range (0 to 1). (${e})`,info:r};break;case`nonZero`:if(e===0)return{success:!1,error:`Parameter '${n}' must non-zero. (${e})`,info:r};break;case`bipolar`:if(e>1||e<-1)return{success:!1,error:`Parameter '${n}' must be in bipolar percentage range (-1 to 1). (${e})`,info:r};break}return{success:!0,value:e,info:r}},s=(e,t=`?`,n)=>o(e,`percentage`,t,n),c=(e,t=``,n=`?`)=>a(o(e,t,n),()=>Number.isInteger(e)?{success:!0,value:e}:{success:!1,error:`Param '${n}' is not an integer`}),l=(e,t,n,r=`?`)=>typeof e==`number`?Number.isNaN(e)?{success:!1,error:`Param '${r}' is not within range ${t}-${n}. Got: NaN`}:Number.isFinite(e)?e<t?{success:!1,error:`Param '${r}' is below range ${t}-${n}. Got: ${e}`}:e>n?{success:!1,error:`Param '${r}' is above range ${t}-${n}. Got: ${e}`}:{success:!0,value:e}:{success:!1,error:`Param '${r}' is not within range ${t}-${n}. Got: infinite`}:{success:!1,error:`Param '${r}' is not a number type. Got type: '${typeof e}' value: '${JSON.stringify(e)}'`},u=e=>{if(typeof e!=`object`||!e)return{success:!1,error:`Value is null or not object type`};let t=Object.getPrototypeOf(e),n=(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e);return n?{success:!0,value:e}:{success:!1,error:`Fancy object`}},d=e=>{let t=typeof e;return t===`symbol`?{success:!1,error:`Symbol type`}:t===`function`?{success:!1,error:`Function type`}:t===`bigint`||t===`number`||t===`string`||t===`boolean`?{success:!0,value:e}:u(e)};function f(e){return typeof e==`number`||typeof e==`string`||typeof e==`bigint`||typeof e==`boolean`}const p=(e,t)=>e===t,m=(e,t,n)=>JSON.stringify(e)===JSON.stringify(t),h=(e,t)=>{for(let n of t)if(e.has(n))return e.get(n)},g=(e,t)=>{if(e===void 0)throw Error(`Param 'target' is undefined`);if(e===null)throw Error(`Param 'target' is null`);if(typeof e!=`object`)throw Error(`Param 'target' is not an object (got: ${typeof e})`);if(t){let t=[];for(let n in e){let r=e[n];d(r)&&t.push([n,r])}return t}else return Object.entries(e)};function*ee(e,t,n={}){if(e===void 0){yield{path:n.pathPrefix??``,value:t,state:`added`};return}if(t===void 0){yield{path:n.pathPrefix??``,previous:e,value:void 0,state:`removed`};return}let r=n.asPartial??!1,i=n.skipInstances??new WeakSet,a=n.undefinedValueMeansRemoved??!1,o=n.pathPrefix??``,s=n.deepEntries??!1,c=n.eq??m,l=n.includeMissingFromA??!1,u=n.includeParents??!1;if(f(e)&&f(t)){e!==t&&(yield{path:o,value:t,previous:e,state:`change`});return}if(f(t)){yield{path:o,value:t,previous:e,state:`change`};return}let d=g(e,s),p=new Set;for(let[e,s]of d){p.add(e);let l=e in t,d=t[e];if(typeof s==`object`&&s){if(i.has(s))continue;if(i.add(s),l){if(d===void 0)throw Error(`Pathed.compareData Value for key ${e} is undefined`);{let r=[...ee(s,d,{...n,skipInstances:i,pathPrefix:o+e+`.`})];if(r.length>0){for(let e of r)yield e;u&&(yield{path:o+e,value:t[e],previous:s,state:`change`})}}}else{if(r)continue;yield{path:o+e,value:void 0,previous:s,state:`removed`}}}else{let t=o+e;if(l)d===void 0&&a?yield{path:t,previous:s,value:void 0,state:`removed`}:c(s,d,t)||(yield{path:t,previous:s,value:d,state:`change`});else{if(r)continue;yield{path:t,previous:s,value:void 0,state:`removed`}}}}if(l){let e=g(t,s);for(let[t,n]of e){if(p.has(t))continue;yield{path:o+t,previous:void 0,value:n,state:`added`}}}}const te=(e,t,n,r=!1)=>{if(t===void 0)throw Error(`Parameter 'path' is undefined`);if(typeof t!=`string`)throw Error(`Parameter 'path' should be a string. Got: ${typeof t}`);if(e===void 0)throw Error(`Parameter 'target' is undefined`);if(e===null)throw Error(`Parameter 'target' is null`);let i=t.split(`.`),a=_(e,i,n,r);return a},_=(e,n,r,i)=>{if(n.length===0){if(i)return r;if(Array.isArray(e)&&!Array.isArray(r))throw Error(`Expected array value, got: '${JSON.stringify(r)}'. Set allowShapeChange=true to ignore.`);if(!Array.isArray(e)&&Array.isArray(r))throw Error(`Unexpected array value, got: '${JSON.stringify(r)}'. Set allowShapeChange=true to ignore.`);if(typeof e!=typeof r)throw Error(`Cannot reassign object type. (${typeof e} -> ${typeof r}). Set allowShapeChange=true to ignore.`);if(typeof e==`object`&&!Array.isArray(e)){let n=t(e,r);if(n.a.length>0)throw Error(`New value is missing key(s): ${n.a.join(`,`)}`);if(n.b.length>0)throw Error(`New value cannot add new key(s): ${n.b.join(`,`)}`)}return r}let a=n.shift();if(!a)return r;let o=me(a);if(o&&Array.isArray(e)){let t=Number.parseInt(a);if(t>=e.length&&!i)throw Error(`Array index ${t.toString()} is outside of the existing length of ${e.length.toString()}. Use allowShapeChange=true to permit this.`);let o=[...e];return o[t]=_(o[t],n,r,i),o}else if(a in e){let t={...e};return t[a]=_(t[a],n,r,i),t}else throw Error(`Path ${a} not found in data`)},ne=(e,t,n=`.`)=>{if(typeof t!=`string`)throw Error(`Param 'path' ought to be a string. Got: '${typeof t}'`);if(t.length===0)throw Error(`Param string 'path' is empty`);if(e===void 0)throw Error(`Param 'object' is undefined`);if(e===null)throw Error(`Param 'object' is null`);let r=t.split(n),i=re(e,r,t);return i},re=(e,t,n)=>{if(e===void 0)return{success:!1,error:`Param 'object' is undefined. Position: ${n}`};if(t.length===0)return{success:!1,error:`Path has been exhausted. position: ${n}`};let r=t.shift();if(!r)return{success:!1,error:`Unexpected empty split path. Position: ${n}`};let i=me(r);if(i&&Array.isArray(e)){let i=Number.parseInt(r);return e[i]===void 0?{success:!1,error:`Index '${i}' does not exist. Length: ${e.length}. Position: ${n}`}:t.length===0?{value:e[i],success:!0}:re(e[i],t,t.join(`.`))}else if(typeof e==`object`&&r in e)return t.length===0?{value:e[r],success:!0}:re(e[r],t,t.join(`.`));else return{success:!1,error:`Path '${r}' not found. Position: ${n}`}};function*ie(e,t=!1,n=2**53-1,r=``){e!=null&&(yield*ae(e,r,t,n))}function*ae(e,t,n=!1,r){if(!(r<=0)&&typeof e==`object`)for(let i of Object.entries(e)){let e=(t.length>0?t+`.`:``)+i[0],a=i[1],o=typeof a!=`object`;(n&&o||!n)&&(yield{path:e,value:a}),yield*ae(a,e,n,r-1)}}const oe=(e,t,r={})=>{let i=v(t,0);n(c(i,`positive`,`interval`));let a=r.fireBeforeWait??!1,o=r.onStartCalled,s=r.signal,l=!1,u=`idle`,d=0,f=0,p=performance.now(),m=t??0,h=!1,g,ee=()=>{g!==void 0&&(globalThis.clearTimeout(g),g=void 0,d=0,p=NaN)},te=e=>{i===0?typeof requestAnimationFrame>`u`?g=globalThis.setTimeout(e,0):(g=void 0,requestAnimationFrame(e)):g=globalThis.setTimeout(e,i)},_=()=>{h||(h=!0,u!==`idle`&&(u=`idle`,ee()))},ne=async()=>{if(s?.aborted&&(u=`idle`),u===`idle`)return;u=`running`,d++,f++;let t=e(d,performance.now()-p),n=typeof t==`object`?await t:t;if(!h){if(u=`scheduled`,n!==void 0&&!n){_();return}h||te(ne)}},re=()=>{if(l)throw Error(`Disposed`);if(h=!1,o!==void 0){let e=o(d,performance.now()-p);switch(e){case`cancel`:_();return;case`reset`:ie();return;case`dispose`:l=!0,_();return}}u===`idle`&&(d=0,p=performance.now(),u=`scheduled`,a?ne():te(ne))},ie=()=>{if(l)throw Error(`Disposed`);h=!1,d=0,p=NaN,u!==`idle`&&_(),re()};return{start:re,reset:ie,cancel:_,get interval(){return m},get runState(){return u},get startCountTotal(){return f},get startCount(){return d},set interval(e){let t=v(e,0);n(c(t,`positive`,`interval`)),i=t,m=e},get isDisposed(){return l},get elapsedMs(){return performance.now()-p}}},se=()=>{let e=performance.now();return()=>{let t=performance.now(),n=t-e;return e=t,n}};function*ce(e,t=`.`){for(;e.length>0;){yield e;let n=de(e,t);if(n===e)break;e=n}}function*le(e,t=`.`){for(;e.length>0;){yield e;let n=ue(e,t,{ifNoMatch:`original`,fromEnd:!0});if(n===e)break;e=n}}const ue=(e,t,n={})=>{let r=fe(e,t,n);return r[0]},de=(e,t,n={})=>{let r=fe(e,t,n);return r[1]},fe=(e,t,n={})=>{if(e===void 0)throw Error(`Param 'source' is undefined`);let r=n.fallback,i=n.ifNoMatch??(r?`fallback`:`original`);if(i===`original`&&(r=e),i===`fallback`&&r===void 0)throw Error(`Fallback must be provided`);let a=n.startPos??void 0,o=n.fromEnd??!1,s=o?e.lastIndexOf(t,a):e.indexOf(t,a);if(s<0&&i===`throw`)throw Error(`Match '${t}' not found in source.`);return s<0&&i===`original`?[e,e]:s<0&&i===`fallback`?[r,r]:[e.slice(0,s),e.slice(Math.max(0,s+t.length))]},pe=e=>{let t=e=>e.replaceAll(/([!$()*+./:=?[\\\]^{|}])/g,`\\$1`);e=e.split(`*`).map(e=>t(e)).join(`.*`),e=`^`+e+`$`;let n=new RegExp(e);return e=>n.test(e)},me=e=>{if(e===void 0)return!1;if(typeof e==`string`){let t=Number.parseInt(e);return Number.isNaN(t)?!1:t.toString()===e.toString()}return typeof e==`number`?Number.isNaN(e)||!Number.isFinite(e)?!1:Math.round(e)===e:!1},he=(e,t,n=p)=>{let r=[],i=[],a=[];for(let a of e){let e=!1;for(let r of t)if(n(a,r)){e=!0;break}e?r.push(a):i.push(a)}for(let r of t){let t=!1;for(let i of e)n(r,i)&&(t=!0);t||a.push(r)}let o=i.length===0&&a.length===0;return{shared:r,isSame:o,a:i,b:a}};function v(e,t){if(ge(e)){if(typeof e==`number`)return e;let t=e.millis??0;return t+=(e.hours??0)*60*60*1e3,t+=(e.mins??0)*60*1e3,t+=(e.secs??0)*1e3,t}else{if(t!==void 0)return t;throw Error(`Not a valid interval: ${JSON.stringify(e)}`)}}function ge(e){if(e==null)return!1;if(typeof e==`number`)return!(Number.isNaN(e)||!Number.isFinite(e));if(typeof e!=`object`)return!1;let t=`millis`in e,n=`secs`in e,r=`mins`in e,i=`hours`in e;return t&&!o(e.millis).success||n&&!o(e.secs).success||r&&!o(e.mins).success||i&&!o(e.hours).success?!1:!!(t||n||i||r)}const _e=e=>typeof e==`string`?e:e instanceof Error?e.message:e;(typeof window>`u`||!(`requestAnimationFrame`in window))&&typeof window>`u`&&(globalThis.requestAnimationFrame=e=>{setTimeout(e,1)});const ve=e=>{let t=v(e,1),r=e.signal,i=e.value;return n(o(t,`positive`,`timeoutMs`)),t===0?new Promise(e=>requestAnimationFrame(t=>{e(i)})):new Promise((e,n)=>{let a=()=>{clearTimeout(o),r?(r.removeEventListener(`abort`,a),n(Error(r.reason))):n(Error(`Cancelled`))};r&&r.addEventListener(`abort`,a);let o=setTimeout(()=>{if(r?.removeEventListener(`abort`,a),r?.aborted){n(Error(r.reason));return}e(i)},t)})},ye=(e,t)=>{if(e===void 0)throw Error(`callback parameter is undefined`);let a=v(t);n(c(a,`aboveZero`,`interval`));let o,s=0,l=0,u=0,d=`idle`,f=()=>{s=0,globalThis.clearTimeout(o),d=`idle`},p=async(n=t,a)=>{let p=new Promise((t,p)=>{s=performance.now();let h=v(n),g=c(h,`aboveZero`,`altTimeoutMs`);if(r(g)){p(i(g));return}switch(d){case`scheduled`:m();break;case`running`:break}d=`scheduled`,o=globalThis.setTimeout(async()=>{if(d!==`scheduled`){console.warn(`Timeout skipping execution since state is not 'scheduled'`),f();return}let n=a??[];l++,u++,d=`running`,await e(performance.now()-s,...n),d=`idle`,f(),t()},h)});return p},m=()=>{d!==`idle`&&f()};return{start:p,cancel:m,get runState(){return d},get startCount(){return l},get startCountTotal(){return u}}};var be=class{#handlers;#counter=0;#id=Math.floor(Math.random()*100);constructor(){this.#handlers=[]}isEmpty(){return this.#handlers.length===0}add(e,t={}){this.#counter++;let n=t.once??!1,r={id:`${this.#id} - ${this.#counter}`,handler:e,once:n};return this.#handlers.push(r),r.id}remove(e){let t=this.#handlers.length;return this.#handlers=this.#handlers.filter(t=>t.id!==e),this.#handlers.length!==t}notify(e){for(let t of this.#handlers)t.handler(e),t.once&&this.remove(t.id)}clear(){this.#handlers=[]}};const xe=e=>typeof e==`string`?e:JSON.stringify(e),Se=(e,t=xe)=>{let n=new Set,r=[],i=e.flat(10);for(let e of i){let i=t(e);if(n.has(i))continue;n.add(i),r.push(e)}return r};var Ce=class{#store=new Map;get(e){let t=this.#store.get(e);return t?[...t]:[]}size(e){let t=this.#store.get(e);return t?t.length:0}*iterateKey(e){let t=this.#store.get(e);t&&(yield*t.values())}*iterateValues(){for(let e of this.#store.keys())yield*this.iterateKey(e)}*iterateKeys(){yield*this.#store.keys()}addKeyedValues(e,...t){let n=this.#store.get(e);n||(n=[],this.#store.set(e,n)),n.push(...t)}deleteKeyValue(e,t){let n=this.#store.get(e);if(!n)return!1;let r=n.filter(e=>e!==t);return r.length===n.length?!1:(this.#store.set(e,r),!0)}clear(){this.#store.clear()}},we=class{#listeners=new Ce;#disposed=!1;dispose(){this.#disposed||this.clearEventListeners()}get isDisposed(){return this.#disposed}fireEvent(e,t){if(this.#disposed)throw Error(`Disposed`);for(let n of this.#listeners.iterateKey(e))n(t,this)}addEventListener(e,t){if(this.#disposed)throw Error(`Disposed`);this.#listeners.addKeyedValues(e,t)}removeEventListener(e,t){this.#disposed||this.#listeners.deleteKeyValue(e,t)}clearEventListeners(){this.#disposed||this.#listeners.clear()}};const Te=e=>typeof e!=`object`||!e?!1:Symbol.asyncIterator in e,Ee=e=>typeof e!=`object`||!e?!1:Symbol.iterator in e,De=(e,t,n)=>{let r=t.length+n.length,i=e.capacity??r,a=r-i,o=e.discardPolicy??`additions`;switch(o){case`additions`:return t.length===0?n.slice(0,n.length-a):t.length===e.capacity?t:[...t,...n.slice(0,a-1)];case`newer`:if(a>=t.length)return t.length===0?[...n.slice(0,i-1),n.at(-1)]:n.slice(Math.max(0,n.length-i),Math.min(n.length,i)+1);{let e=Math.max(1,n.length-t.length),r=n.slice(n.length-e,n.length),a=t.slice(0,Math.min(t.length,i-1)),o=[...a,...r];return o}case`older`:return[...t,...n].slice(a);default:throw Error(`Unknown overflow policy ${o}`)}},Oe=(e,t,...n)=>{if(e===void 0)throw Error(`opts parameter undefined`);let r=t.length+n.length,i=e.capacity&&r>e.capacity,a=i?De(e,t,n):[...t,...n];if(e.capacity&&a.length!==e.capacity&&i)throw Error(`Bug! Expected return to be at capacity. Return len: ${a.length} capacity: ${e.capacity} opts: ${JSON.stringify(e)}`);if(!e.capacity&&a.length!==r)throw Error(`Bug! Return length not expected. Return len: ${a.length} expected: ${r} opts: ${JSON.stringify(e)}`);return a},ke=(e,t)=>{if(t.length===0)throw Error(`Queue is empty`);return t.slice(1)},Ae=(e,t)=>t[0],je=(e,t)=>t.length===0,Me=(e,t)=>e.capacity?t.length>=e.capacity:!1;var Ne=class extends we{options;data;eq;constructor(e={},t=[]){if(super(),e===void 0)throw Error(`opts parameter undefined`);this.options=e,this.data=t,this.eq=e.eq??p}clear(){let e=[...this.data];this.data=[],this.fireEvent(`removed`,{finalData:this.data,removed:e}),this.onClear()}onClear(){}at(e){if(e>=this.data.length)throw Error(`Index outside bounds of queue`);let t=this.data.at(e);if(t===void 0)throw Error(`Index appears to be outside range of queue`);return t}enqueue(...e){this.data=Oe(this.options,this.data,...e);let t=this.data.length;return this.onEnqueue(this.data,e),t}onEnqueue(e,t){this.fireEvent(`enqueue`,{added:t,finalData:e})}dequeue(){let e=Ae(this.options,this.data);if(e!==void 0)return this.data=ke(this.options,this.data),this.fireEvent(`dequeue`,{removed:e,finalData:this.data}),this.onRemoved([e],this.data),e}onRemoved(e,t){this.fireEvent(`removed`,{removed:e,finalData:t})}removeWhere(e){let t=this.data.length,n=this.data.filter(t=>e(t));return n.length===0?0:(this.data=this.data.filter(t=>!e(t)),this.onRemoved(n,this.data),t-this.data.length)}toArray(){return[...this.data]}get isEmpty(){return je(this.options,this.data)}get isFull(){return Me(this.options,this.data)}get length(){return this.data.length}get peek(){return Ae(this.options,this.data)}};async function Pe(e,t){let n=v(t,1e3),r=await Promise.race([(async()=>{await ve({millis:n,signal:t.signal})})(),(async()=>await e.next())()]);if(r===void 0)throw Error(`Timeout`);return r}const Fe=(e,t)=>{let[n,r]=Ie(e);if(!n)throw Error(r);let i=t??Object.keys(n.states)[0];if(n.states[i]===void 0)throw TypeError(`Initial state ('${i}') not found`);let a=Be(n.states);if(a===void 0)throw Error(`Could not normalise transitions`);return Object.freeze({value:i,visited:[],machine:Object.freeze(Object.fromEntries(a))})},Ie=e=>e===void 0?[void 0,`Parameter undefined`]:e===null?[void 0,`Parameter null`]:`states`in e?[e,``]:typeof e==`object`?[{states:e},``]:[void 0,`Unexpected type: ${typeof e}. Expected object`],Le=e=>{Ve(e);let t=e.machine[e.value];return t.length===1&&t[0].state===null?[]:t},Re=e=>{let t=Le(e);return t.map(e=>e.state)},ze=e=>{let t=e=>{if(e===null)return{state:null};if(typeof e==`string`)return{state:e};if(typeof e==`object`&&`state`in e){let t=e.state;if(typeof t!=`string`)throw TypeError(`Target 'state' field is not a string. Got: ${typeof t}`);return`preconditions`in e?{state:t,preconditions:e.preconditions}:{state:t}}else throw Error(`Unexpected type: ${typeof e}. Expected string or object with 'state' field.`)};if(Array.isArray(e)){let n=!1,r=e.map(e=>{let r=t(e);if(!r)throw Error(`Invalid target`);return n||=r.state===null,r});if(n&&r.length>1)throw Error(`Cannot have null as an possible state`);return r}else{let n=t(e);return n?[n]:void 0}},Be=e=>{let t=new Map;for(let[n,r]of Object.entries(e)){if(n===void 0)throw TypeError(`Top-level undefined state`);if(r===void 0)throw TypeError(`Undefined target state for ${n}`);if(t.has(n))throw Error(`State defined twice: ${n}`);if(n.includes(` `))throw Error(`State names cannot contain spaces`);t.set(n,[])}for(let[n,r]of Object.entries(e)){let e=ze(r);if(e===void 0)throw Error(`Could not normalise target`);if(e!==null){let r=new Set;for(let i of e){if(r.has(i.state))throw Error(`Target state '${i.state}' already exists for '${n}'`);if(r.add(i.state),i.state===null)continue;if(!t.has(i.state))throw Error(`Target state '${i.state}' is not defined as a top-level state. Defined under: '${n}'`)}t.set(n,e)}}return t},Ve=e=>{if(e===void 0)throw TypeError(`Param 'state' is undefined`);if(typeof e.value!=`string`)throw TypeError(`Existing state is not a string`)},y=(e,t)=>(Ve(e),He(e,t),Object.freeze({value:t,machine:e.machine,visited:Se([e.visited,[e.value]])})),He=(e,t)=>{if(t===null)throw Error(`Cannot transition to null state`);if(t===void 0)throw Error(`Cannot transition to undefined state`);if(typeof t!=`string`)throw TypeError(`Parameter 'toState' should be a string. Got: ${typeof t}`);let n=Re(e);if(n.length===0)throw Error(`Machine is in terminal state`);if(!n.includes(t))throw Error(`Target state '${t}' not available at current state '${e.value}'. Possible states: ${n.join(`, `)}`)};function Ue(e,t={}){let n=t.maximumRepeats??2**53-1,r=t.closeOnError??!0,i=t.interval?v(t.interval):-1,a=t.manual??!1;if(t.interval===void 0&&t.manual===void 0&&(a=!0),a&&t.interval)throw Error(`If option 'manual' is set, option 'interval' cannot be used`);let o=v(t.predelay,0),s=t.lazy??`very`,c=t.signal,l=new AbortController,u=e=>{l.abort(e)},d=0,f=!1,p=e=>{g.dispose(e),f=!1,h&&h.cancel()},m=async()=>{if(!f)return!1;if(o&&await ve(o),d>=n)return p(`Maximum repeats reached ${n.toString()}`),!1;try{if(c?.aborted)return p(`Signal (${c.aborted})`),!1;let t=await e(u);return d++,g.set(t),!0}catch(e){return r?(p(`Function error: ${_e(e)}`),!1):(g.signal(`warn`,_e(e)),!0)}},h=a?void 0:oe(async()=>{let e=await m();if(!e)return!1;if(l.signal.aborted)return p(`callback function aborted (${l.signal.reason})`),!1},i),g=Ze({lazy:s,onStart(){f=!0,h&&h.start()},onStop(){f=!1,h&&h.cancel()}});return s===`never`&&h&&h.start(),{...g,ping:m}}function We(e,t={}){let n=t.lazy??`very`,r=t.traceLifecycle?e=>{console.log(`Rx.From.iterator ${e}`)}:e=>{},i=v(t.readInterval,5),a=v(t.readTimeout,300*1e3),o=t.whenStopped??`continue`,s,c,l=Fe({idle:[`wait_for_next`],wait_for_next:[`processing_result`,`stopping`,`disposed`],processing_result:[`queued`,`disposed`,`stopping`],queued:[`wait_for_next`,`disposed`,`stopping`],stopping:`idle`,disposed:null},`idle`),u=()=>{r(`onExternalSignal`),c?.abort(t.signal?.reason)};t.signal&&t.signal.addEventListener(`abort`,u,{once:!0});let d=async()=>{r(`read. State: ${l.value}`),c=new AbortController;try{l=y(l,`wait_for_next`);let e=await Pe(s,{signal:c.signal,millis:a});if(l=y(l,`processing_result`),c.abort(`nextWithTimeout completed`),e.done&&(r(`read v.done true`),f.dispose(`Generator complete`),l=y(l,`disposed`)),l.value===`stopping`){r(`read. sm.value = stopping`),l=y(l,`idle`);return}if(l.value===`disposed`){r(`read. sm.value = disposed`);return}f.set(e.value)}catch(e){f.dispose(`Generator error: ${e.toString()}`);return}l.value===`processing_result`?(l=y(l,`queued`),r(`scheduling read. State: ${l.value}`),setTimeout(d,i)):l=y(l,`idle`)},f=Ze({...t,lazy:n,onStart(){r(`onStart state: ${l.value} whenStopped: ${o}`),l.value===`idle`&&((l.value===`idle`&&o===`reset`||s===void 0)&&(s=Te(e)?e[Symbol.asyncIterator]():e[Symbol.iterator]()),d())},onStop(){r(`onStop state: ${l.value} whenStopped: ${o}`),l=y(l,`stopping`),o===`reset`&&(r(`onStop reiniting iterator`),s=Te(e)?e[Symbol.asyncIterator]():e[Symbol.iterator]())},onDispose(e){r(`onDispose (${e})`),c?.abort(`Rx.From.iterator disposed (${e})`),t.signal&&t.signal.removeEventListener(`abort`,u)}});return f}function Ge(e){return e.value===void 0?`signal`in e&&e.signal!==void 0:!1}function Ke(e){return e.value!==void 0}const b=e=>{if(!qe(e))return!1;if(`last`in e){let t=e.last();if(t!==void 0)return!0}return!1},qe=e=>typeof e!=`object`||!e?!1:`on`in e&&`onValue`in e,Je=e=>!(typeof e!=`object`||!(`source`in e)||!(`annotate`in e)),Ye=(e,t={})=>{if(qe(e))return e;let n=t.generator??{lazy:`initial`,interval:5},r=t.function??{lazy:`very`};if(Array.isArray(e))return We(e.values(),n);if(typeof e==`function`)return Ue(e,r);if(typeof e==`object`){if(Je(e))return e.source;if(Ee(e)||Te(e))return We(e,n)}throw TypeError(`Unable to resolve source. Supports: array, Reactive, Async/Iterable. Got type: ${typeof e}`)};function Xe(e,t){let n=t.lazy??`initial`,r=t.disposeIfSourceDone??!0,i=t.onValue??(e=>{}),a=Ye(e),o,s=t.debugLabel?`[${t.debugLabel}]`:``,c=()=>{o!==void 0&&(o(),o=void 0,t.onStop&&t.onStop())},l=()=>{o===void 0&&(t.onStart&&t.onStart(),o=a.on(e=>{Ge(e)?e.signal===`done`?(c(),u.signal(e.signal,e.context),r&&u.dispose(`Upstream source ${s} has completed (${e.context??``})`)):u.signal(e.signal,e.context):Ke(e)&&i(e.value)}))},u=Ze({...t,lazy:n,onStart:l,onStop:c});return u}function Ze(e){let t=e.lazy??`initial`,n=e.onStop??(()=>{}),r=e.onStart??(()=>{});e.debugLabel&&`${e.debugLabel}`;let i=x({...e,onFirstSubscribe(){t!==`never`&&r()},onNoSubscribers(){t===`very`&&n()}});return t===`never`&&r(),i}function x(e={}){let t,n=!1,r=!1,i=!0,a=e.onFirstSubscribe??void 0,o=e.onNoSubscribers??void 0,s=e.debugLabel?`[${e.debugLabel}]`:``,c=()=>{t!==void 0&&t.isEmpty&&(i||(i=!0,r=!1,o&&o()))},l=e=>{if(n)throw Error(`Disposed, cannot subscribe ${s}`);t===void 0&&(t=new be);let o=t.add(e);return i=!1,r||(r=!0,a&&a()),()=>{t?.remove(o),c()}};return{dispose:r=>{n||(t?.notify({value:void 0,signal:`done`,context:`Disposed: ${r}`}),n=!0,e.onDispose&&e.onDispose(r))},isDisposed:()=>n,removeAllSubscribers:()=>{t?.clear(),c()},set:e=>{if(n)throw Error(`${s} Disposed, cannot set`);t?.notify({value:e})},signal:(e,r)=>{if(n)throw Error(`${s} Disposed, cannot signal`);t?.notify({signal:e,value:void 0,context:r})},on:e=>l(e),onValue:e=>{let t=l(t=>{Ke(t)&&e(t.value)});return t}}}function Qe(e,t={}){let n=t.eq??m,a=x(),o=x(),s=[],c=e,l=!1,u=e=>{let n=[...ee(c??{},e,{...t,includeMissingFromA:!0})];n.length!==0&&(c=e,a.set(e),o.set(n))},d=(e,t)=>{for(let[n,r,i]of s)n(e)&&i.notify({fieldName:e,pattern:r,value:t})},f={asPartial:!0,includeParents:!0},p=e=>{if(c===void 0){c=e,a.set(c);for(let[t,n]of Object.entries(e))d(t,n);return c}else{let t=[...ee(c,e,f)];if(t.length===0)return c;c={...c,...e},a.set(c),o.set(t);for(let e of t)d(e.path,e.value);return c}},h=(e,s)=>{if(c===void 0)throw Error(`Cannot update value when it has not already been set`);let l=ne(c,e);if(r(l))throw i(l);if(n(l.value,s,e))return;let u=[...ee(l.value,s,{...t,includeMissingFromA:!0})];u=u.map(t=>t.path.length>0?{...t,path:e+`.`+t.path}:{...t,path:e});let f=te(c,e,s,!0);c=f,a.set(f),o.set(u),d(e,s)},g=e=>{l||(o.dispose(e),a.dispose(e),l=!0)};return{dispose:g,isDisposed(){return l},updateField:h,last:()=>c,on:a.on,onValue:a.onValue,onDiff:o.onValue,onField(e,t){let n=pe(e),r=new be;s.push([n,e,r]);let i=r.add(t);return()=>r.remove(i)},set:u,update:p}}const $e=e=>({on:e.on,dispose:e.dispose,isDisposed:e.isDisposed,onValue:e.onValue});function et(e,t,n,r={}){let i;if(typeof e==`string`){if(i=document.querySelector(e),i===null)throw Error(`Target query did not resolve to an element. Query: '${e}'`)}else i=e;if(i===null)throw Error(`Param 'targetOrQuery' is null`);let a=r.debugLifecycle??!1,o=r.debugFiring??!1;r.diff;let s=r.lazy??!1;n===void 0&&(n={});let c=Qe(n,{deepEntries:!0}),l=!1,u=!1,d=e=>{o&&console.log(`Reactive.event '${t}' firing '${JSON.stringify(e)}`),c.set(e)},f=()=>{l&&(l=!1,i.removeEventListener(t,d),a&&console.log(`Rx.From.event remove '${t}'`))},p=()=>{l||(l=!0,i.addEventListener(t,d),a&&console.log(`Rx.From.event add '${t}'`))};return s||p(),{last:()=>(s&&p(),c.last()),dispose:e=>{u||(u=!0,f(),c.dispose(e))},isDisposed(){return u},on:e=>(s&&p(),c.on(e)),onValue:e=>(s&&p(),c.onValue(e))}}function tt(e,t,n={}){let r;if(typeof e==`string`){if(r=document.querySelector(e),r===null)throw Error(`Target query did not resolve to an element. Query: '${e}'`)}else r=e;if(r===null)throw Error(`Param 'targetOrQuery' is null`);let i=n.debugLifecycle??!1,a=n.debugFiring??!1,o=n.fireInitial??!1,s=0,c=se(),l=Ze({lazy:n.lazy??`very`,onStart(){r.addEventListener(t,u),i&&console.log(`Rx.From.eventTrigger add '${t}'`),o&&s===0&&((i||a)&&console.log(`Rx.From.eventTrigger: firing initial`),u())},onStop(){r.removeEventListener(t,u),i&&console.log(`Rx.From.eventTrigger remove '${t}'`)}}),u=e=>{a&&console.log(`Rx.From.eventTrigger '${t}' triggered'`),l.set({sinceLast:c(),total:++s})};return l}const S=e=>{let t=nt(e);if(t.success)return t.value;throw i(t)},nt=e=>{if(typeof e==`string`){let t=document.querySelector(e);if(t===null){let t=e.startsWith(`#`)?`Query '${e}' did not match anything. Try '#id', 'div', or '.class'`:`Query '${e}' did not match anything. Did you mean '#${e}?`;return{success:!1,error:t}}e=t}else if(e===null)return{success:!1,error:`Param 'domQueryOrEl' is null`};else if(e===void 0)return{success:!1,error:`Param 'domQueryOrEl' is undefined`};let t=e;return{success:!0,value:t}};function rt(e,t,n={}){let r=n.traceInput??!1,i=n.traceOutput??!1,a=Xe(e,{lazy:`initial`,...n,onValue(e){let n=t(e);r&&i?console.log(`Rx.Ops.transform input: ${JSON.stringify(e)} output: ${JSON.stringify(n)}`):r?console.log(`Rx.Ops.transform input: ${JSON.stringify(e)}`):i&&console.log(`Rx.Ops.transform output: ${JSON.stringify(n)}`),a.set(n)}});return $e(a)}function it(e,t={}){let n=v(t.elapsed,50),r,i=ye(()=>{let e=r;e&&(a.set(e),r=void 0)},n),a=Xe(e,{...t,onValue(e){r=e,i.start()}});return $e(a)}function at(e){return t=>it(t,e)}function ot(e={}){let t=x(e);return{dispose:t.dispose,isDisposed:t.isDisposed,set(e){t.set(e)},on:t.on,onValue:t.onValue}}function st(e){let t=ct(e);return{dispose:t.dispose,isDisposed:t.isDisposed,on:t.on,onValue:t.onValue}}function ct(e){let t=()=>{},n=ot({onFirstSubscribe(){t=e(n)},onNoSubscribers(){t&&t()}});return{...n,onValue:e=>n.on(t=>{Ke(t)&&e(t.value)})}}const lt=(e,t)=>{if(e===null)throw Error(`Param 'elem' is null. Expected element to observe`);if(e===void 0)throw Error(`Param 'elem' is undefined. Expected element to observe`);let n=st(t=>{let n=new ResizeObserver(e=>{t.set(e)});return n.observe(e),()=>{n.unobserve(e)}});return at({elapsed:t??100})(n)},ut=e=>at({elapsed:e??100})(et(window,`resize`,{innerWidth:0,innerHeight:0})),dt=(e=document.documentElement)=>{let t=st(t=>{let n=new MutationObserver(e=>{t.set(e)}),r={attributeFilter:[`class`],attributes:!0};return n.observe(e,r),()=>{n.disconnect()}});return t};function ft(e){let t=e,n=x(),r=e=>{t=e,n.set(e)};return{dispose:n.dispose,isDisposed:n.isDisposed,last:()=>t,on:n.on,onValue:n.onValue,set:r,setHsl:e=>{r(e)}}}var pt=Object.defineProperty,mt=(e,t,n)=>t in e?pt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ht=(e,t)=>{for(var n in t)pt(e,n,{get:t[n],enumerable:!0})},C=(e,t,n)=>mt(e,typeof t==`symbol`?t:t+``,n);function w(e,t){if(e)return;let n=t?Error(t):Error(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);throw n.name=`colorizr`,n}var T={hsl:[`h`,`s`,`l`],oklab:[`l`,`a`,`b`],oklch:[`l`,`c`,`h`],rgb:[`r`,`g`,`b`]},gt=[`hsl`,`oklab`,`oklch`,`rgb`],_t=Math.PI/180,E={l:[.3963377773761749,.2158037573099136],m:[-.1055613458156586,-.0638541728258133],s:[-.0894841775298119,-1.2914855480194092]},D={l:[.4122214708,.5363325363,.0514459929],m:[.2119034982,.6806995451,.1073969566],s:[.0883024619,.2817188376,.6299787005]},O={l:[.2104542553,.793617785,.0040720468],a:[1.9779984951,2.428592205,.4505937099],b:[.0259040371,.7827717662,.808675766]},k={r:[4.076741636075958,-3.307711539258063,.2309699031821043],g:[-1.2684379732850315,2.609757349287688,-.341319376002657],b:[-.0041960761386756,-.7034186179359362,1.7076146940746117]},A=5,vt=180/Math.PI,j={alpha:`amount must be a number between 0 and 1`,hueRange:`hue must be a number between 0 and 360`,input:`input is required`,inputHex:`input is required and must be a hex`,inputNumber:`input is required and must be a number`,inputString:`input is required and must be a string`,invalid:`invalid input`,invalidCSS:`invalid CSS string`,left:`left is required and must be a string`,lightnessRange:`lightness must be a number between 0 and 1`,options:`invalid options`,right:`right is required and must be a string`,threshold:`threshold must be a number between 0 and 255`},yt={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,grey:`#808080`,green:`#008000`,greenyellow:`#adff2f`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`};function bt(e){return Array.isArray(e)&&e.length===6}function M(e){return F(e)&&Object.keys(yt).includes(e.toLowerCase())}function N(e){return typeof e==`number`&&!Number.isNaN(e)}function P(e){if(!e)return!1;let{toString:t}=Object.prototype,n=Object.getPrototypeOf(e);return t.call(e)===`[object Object]`&&(n===null||n===Object.getPrototypeOf({}))}function F(e,t=!0){let n=typeof e==`string`;return t?n&&!!e.trim().length:n}function xt(e){return St(e)||Tt(e)||Ct(e)||wt(e)}function I(e){return F(e)?/^#([\da-f]{3,4}|[\da-f]{6,8})$/i.test(e):!1}function St(e){if(!P(e))return!1;let t=Object.entries(e);return!!t.length&&t.every(([e,t])=>e===`h`?t>=0&&t<=360:e===`alpha`?t>=0&&t<=1:T.hsl.includes(e)&&t>=0&&t<=100)}function Ct(e){if(!P(e))return!1;let t=Object.entries(e);return!!t.length&&t.every(([e,t])=>e===`l`?t>=0&&t<=100:e===`alpha`?t>=0&&t<=1:T.oklab.includes(e)&&t>=-1&&t<=1)}function wt(e){if(!P(e))return!1;let t=Object.entries(e);return!!t.length&&t.every(([e,t])=>e===`l`?t>=0&&t<=100:e===`alpha`?t>=0&&t<=1:T.oklch.includes(e)&&t>=0&&t<=(e===`h`?360:1))}function Tt(e){if(!P(e))return!1;let t=Object.entries(e);return!!t.length&&t.every(([e,t])=>e===`alpha`?t>=0&&t<=1:T.rgb.includes(e)&&t>=0&&t<=255)}function L(e,t){w(xt(e),j.invalid);let n=t;return!n||(n>1&&(n/=100),n===1)?e:{...e,alpha:n}}function R(e,t=0,n=100){return Math.min(Math.max(e,t),n)}function Et(e,t){w(N(e),j.inputNumber);let n=e+t;return n>360&&(n%=360),n<0&&(n+=360),Math.abs(n)}function z(e,t,n){switch(w(N(e),`Input is not a number`),w(gt.includes(t),`Invalid model${t?`: ${t}`:``}`),w(T[t].includes(n),`Invalid key${n?`: ${n}`:``}`),t){case`hsl`:return w(T.hsl.includes(n),`Invalid key`),[`s`,`l`].includes(n)?R(e):R(e,0,360);case`rgb`:return w(T.rgb.includes(n),`Invalid key`),R(e,0,255);default:throw Error(`Invalid inputs`)}}function B(e,t){let n=T[t],r={hsl:St,oklab:Ct,oklch:wt,rgb:Tt};w(P(e)||Array.isArray(e),j.invalid);let i=Array.isArray(e)?{[n[0]]:e[0],[n[1]]:e[1],[n[2]]:e[2]}:e;return w(r[t](i),`invalid ${t} color`),i}function V(e,t=A,n=!0){let r=new Map(Object.entries(e));for(let[e,i]of r.entries())r.set(e,H(i,t,n));return Object.fromEntries(r)}function H(e,t=2,n=!0){if(!N(e)||e===0)return 0;if(n){let n=10**t;return Math.round(e*n)/n}let r=Math.abs(e),i=Math.abs(Math.ceil(Math.log(r)/Math.LN10));i===0?i=2:i>t&&(i=t);let a=t-(i<0?0:i);a<=1&&t>1?a=2:(a>t||a===0)&&(a=t);let o=10**a;return Math.round(e*o)/o}function Dt(e,t){return w(I(e),j.inputHex),w(N(t),j.inputNumber),t>=1?At(e):`${At(e)}${Ot(t)}`}function Ot(e){w(N(e),j.inputNumber);let t=e;return e>1&&(t/=100),Math.round(t*255).toString(16).padStart(2,`0`)}function kt(e){w(I(e),j.inputString);let t=e.substring(7,9);return t?H(parseInt(t,16)/255):1}function At(e){return w(I(e),j.inputHex),e.length===5?e.substring(0,4):e.substring(0,7)}var U={};ht(U,{hex2hsl:()=>Mt,hex2oklab:()=>It,hex2oklch:()=>Vt,hex2rgb:()=>W,hsl2hex:()=>Wt,hsl2oklab:()=>Gt,hsl2oklch:()=>Kt,hsl2rgb:()=>q,oklab2hex:()=>Xt,oklab2hsl:()=>Zt,oklab2oklch:()=>zt,oklab2rgb:()=>Yt,oklch2hex:()=>nn,oklch2hsl:()=>rn,oklch2oklab:()=>en,oklch2rgb:()=>tn,rgb2hex:()=>Ut,rgb2hsl:()=>G,rgb2oklab:()=>K,rgb2oklch:()=>Bt});function jt(e){w(I(e),j.inputHex);let t=e.replace(`#`,``);if(t.length===3||t.length===4){let e=[...t];t=``,e.forEach(e=>{t+=`${e}${e}`})}let n=`#${t}`;return w(I(n),`invalid hex`),n}function W(e){w(I(e),j.inputHex);let t=jt(e).slice(1);return{r:parseInt(t.charAt(0)+t.charAt(1),16),g:parseInt(t.charAt(2)+t.charAt(3),16),b:parseInt(t.charAt(4)+t.charAt(5),16)}}function G(e){let t=B(e,`rgb`),n=z(t.r,`rgb`,`r`)/255,r=z(t.g,`rgb`,`g`)/255,i=z(t.b,`rgb`,`b`)/255,a=Math.min(n,r,i),o=Math.max(n,r,i),s=o-a,c=0,l,u=(o+a)/2,d;switch(o){case n:d=s?(r-i)/s:0,c=60*d;break;case r:d=(i-n)/s,c=60*d+120;break;case i:d=(n-r)/s,c=60*d+240;break;default:break}return c<0&&(c=360+c),l=a===o?0:u<.5?s/(2*u):s/(2-2*u),{h:Math.abs(+(c%360).toFixed(2)),s:+(l*100).toFixed(2),l:+(u*100).toFixed(2)}}function Mt(e){return w(I(e),j.inputHex),G(W(e))}var{cbrt:Nt,sign:Pt}=Math;function Ft(e){let t=Math.abs(e);return t<.04045?e/12.92:(Pt(e)||1)*((t+.055)/1.055)**2.4}function K(e,t=A){let n=B(e,`rgb`),[r,i,a]=[Ft(n.r/255),Ft(n.g/255),Ft(n.b/255)],o=Nt(D.l[0]*r+D.l[1]*i+D.l[2]*a),s=Nt(D.m[0]*r+D.m[1]*i+D.m[2]*a),c=Nt(D.s[0]*r+D.s[1]*i+D.s[2]*a),l={l:O.l[0]*o+O.l[1]*s-O.l[2]*c,a:O.a[0]*o-O.a[1]*s+O.a[2]*c,b:O.b[0]*o+O.b[1]*s-O.b[2]*c};return V(l,t)}function It(e,t){return w(I(e),j.inputHex),K(W(e),t)}var{atan2:Lt,sqrt:Rt}=Math;function zt(e,t){let{l:n,a:r,b:i}=V(B(e,`oklab`)),a=Rt(r**2+i**2),o=(Lt(i,r)*vt+360)%360;return H(a*1e4)===0&&(o=0),V({l:n,c:a,h:o},t)}function Bt(e,t){let n=B(e,`rgb`);return zt(K(n,t),t)}function Vt(e,t){return w(I(e),j.inputHex),Bt(W(e),t)}function Ht(e,t,n){w(N(e)&&N(t)&&N(n),`point, chroma and h are required`);let r=n;return r<0&&(r+=1),r>1&&--r,H(r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e,4)}function q(e){let t=B(e,`hsl`),n=H(t.h)/360,r=H(t.s)/100,i=H(t.l)/100,a,o,s,c,l;return r===0?(a=i,o=i,s=i):(l=i<.5?i*(1+r):i+r-i*r,c=2*i-l,a=Ht(c,l,n+1/3),o=Ht(c,l,n),s=Ht(c,l,n-1/3)),{r:Math.round(a*255),g:Math.round(o*255),b:Math.round(s*255)}}function Ut(e){let t=B(e,`rgb`);return`#${Object.values(t).map(e=>`0${Math.floor(e).toString(16)}`.slice(-2)).join(``)}`}function Wt(e){let t=B(e,`hsl`);return Ut(q(t))}function Gt(e,t){let n=B(e,`hsl`);return K(q(n),t)}function Kt(e,t){let n=B(e,`hsl`);return Bt(q(n),t)}var{abs:qt}=Math;function Jt(e){let t=qt(e),n=e<0?-1:1;return t>.0031308?n*(t**(1/2.4)*1.055-.055):e*12.92}function Yt(e,t=0){let{l:n,a:r,b:i}=B(e,`oklab`),a=(n+E.l[0]*r+E.l[1]*i)**3,o=(n+E.m[0]*r+E.m[1]*i)**3,s=(n+E.s[0]*r+E.s[1]*i)**3,c=255*Jt(k.r[0]*a+k.r[1]*o+k.r[2]*s),l=255*Jt(k.g[0]*a+k.g[1]*o+k.g[2]*s),u=255*Jt(k.b[0]*a+k.b[1]*o+k.b[2]*s);return{r:R(H(c,t),0,255),g:R(H(l,t),0,255),b:R(H(u,t),0,255)}}function Xt(e){let t=B(e,`oklab`);return Ut(Yt(t))}function Zt(e){let t=B(e,`oklab`);return G(Yt(t))}var{sin:Qt,cos:$t}=Math;function en(e,t){let{l:n,c:r,h:i}=B(e,`oklch`);return(Number.isNaN(i)||i<0)&&(i=0),V({l:n,a:r*$t(i*_t),b:r*Qt(i*_t)},t)}function tn(e,t=0){let n=B(e,`oklch`);return Yt(en(n),t)}function nn(e){let t=B(e,`oklch`);return Ut(tn(t))}function rn(e){let t=B(e,`oklch`);return G(tn(t))}function J(e){if(w(F(e),j.inputString),I(e)){let t=T.rgb,{r:n,g:r,b:i}=W(e),a=kt(e);return{model:`rgb`,[t[0]]:n,[t[1]]:r,[t[2]]:i,alpha:a<1?a:void 0}}let t=/(?:(rgb|hsl|oklab|oklch)a?\s*\(\s*([\d%.-]+)\s*[ ,/]\s*([\d%.-]+)\s*[ ,/]\s*([\d%.-]+)(?:\s*[ ,/]\s*([\d%.-]+))?\s*\))/i,n=t.exec(e);w(bt(n),j.invalidCSS);let r=n[1],i=T[r],a=n[5]?parseFloat(n[5]):1;return a>1&&(a/=100),{model:r,[i[0]]:parseFloat(n[2]),[i[1]]:parseFloat(n[3]),[i[2]]:parseFloat(n[4]),alpha:a<1?a:void 0}}function Y(e,t){w(F(e),j.inputString);let n,r=M(e)?yt[e.toLowerCase()]:e,i=t??(I(r)?`hex`:J(r).model),a=e=>Object.values(e);if(I(r)){let e=kt(r);switch(i){case`hsl`:n=L(Mt(r),e);break;case`oklab`:n=L(It(r),e);break;case`oklch`:n=L(Vt(r),e);break;case`rgb`:n=L(W(r),e);break;default:n=`${At(r)}${e===1?``:Ot(e)}`;break}return n}switch(i){case`hsl`:{let{alpha:e,model:t,...i}=J(r);[`oklab`,`oklch`].includes(t)&&i.l>1&&(i.l=H(i.l/100,A)),n=L(t===`hsl`?i:U[`${t}2hsl`](a(i)),e);break}case`oklab`:{let{alpha:e,model:t,...i}=J(r);[`oklab`,`oklch`].includes(t)&&i.l>1&&(i.l=H(i.l/100,A)),n=L(t===`oklab`?i:U[`${t}2oklab`](a(i)),e);break}case`oklch`:{let{alpha:e,model:t,...i}=J(r);[`oklab`,`oklch`].includes(t)&&i.l>1&&(i.l=H(i.l/100,A)),n=L(t===`oklch`?i:U[`${t}2oklch`](a(i)),e);break}case`rgb`:{let{alpha:e,model:t,...i}=J(r);[`oklab`,`oklch`].includes(t)&&i.l>1&&(i.l/=100),n=L(t===`rgb`?i:U[`${t}2rgb`](a(i)),e);break}case`hex`:default:{let{alpha:e,model:t,...i}=J(r),o=``;[`oklab`,`oklch`].includes(t)&&i.l>1&&(i.l=H(i.l/100,A)),e&&(o=Ot(e)),n=`${U[`${t}2hex`](a(i))}${o}`;break}}return n}function an(e){w(!!e,j.input);let t={};if(F(e)){let{alpha:n=1}=J(e),r=I(e)?`hex`:J(e).model;t.hex=Dt(Y(e,`hex`),n),t.hsl=L(Y(e,`hsl`),n),t.oklab=L(Y(e,`oklab`),n),t.oklch=L(Y(e,`oklch`),n),t.rgb=L(Y(e,`rgb`),n),t.alpha=n,t.type=r}else if(P(e)){let{alpha:n=1}=e;if(St(e))t.hsl={h:z(e.h,`hsl`,`h`),s:z(e.s,`hsl`,`s`),l:z(e.l,`hsl`,`l`)},t.rgb=q(t.hsl),t.oklab=Gt(t.hsl),t.oklch=Kt(t.hsl),t.type=`hsl`;else if(Ct(e))t.hsl=Zt(e),t.oklab=e,t.oklch=zt(e),t.rgb=Yt(e),t.type=`oklab`;else if(wt(e))t.hsl=rn(e),t.oklab=en(e),t.oklch=e,t.rgb=tn(e),t.type=`oklch`;else if(Tt(e))t.rgb={r:z(e.r,`rgb`,`r`),g:z(e.g,`rgb`,`g`),b:z(e.b,`rgb`,`b`)},t.hsl=G(t.rgb),t.oklab=K(t.rgb),t.oklch=Bt(t.rgb),t.type=`rgb`;else throw Error(`invalid color`);t.hex=Dt(Wt(t.hsl),n),t.hsl=L(t.hsl,n),t.oklab=L(t.oklab,n),t.oklch=L(t.oklch,n),t.rgb=L(t.rgb,n),t.alpha=n}else throw Error(j.input);return t}function on(e,t,n=A){w(F(e),j.left),w(F(t),j.right);let r=Y(e,`rgb`),i=Y(t,`rgb`),a=(r.r*299+r.g*587+r.b*114)/1e3,o=(i.r*299+i.g*587+i.b*114)/1e3;return H(Math.abs(o-a),n)}function sn(e){w(F(e),j.inputString);let{r:t,g:n,b:r}=Y(e,`rgb`),i=Math.max(t,n,r),a=Math.min(t,n,r);return H((i-a)/255,4)}function cn(e,t){w(F(e),j.left),w(F(t),j.right);let n=Y(e,`rgb`),r=Y(t,`rgb`);return Math.max(n.r,r.r)-Math.min(n.r,r.r)+(Math.max(n.g,r.g)-Math.min(n.g,r.g))+(Math.max(n.b,r.b)-Math.min(n.b,r.b))}function ln(e){w(F(e),j.inputString);let{r:t,g:n,b:r}=Y(e,`rgb`),i=[t/255,n/255,r/255];for(let e=0;e<i.length;e++)i[e]<=.03928?i[e]/=12.92:i[e]=((i[e]+.055)/1.055)**2.4;return H(.2126*i[0]+.7152*i[1]+.0722*i[2],4)}function un(e,t){w(F(e),j.left),w(F(t),j.right);let n=ln(e),r=ln(t);return H(n>=r?(n+.05)/(r+.05):(r+.05)/(n+.05))}function dn(e,t){w(F(e),j.left),w(F(t),j.right);let n=500,r=125,i=cn(e,t),a=un(e,t),o=on(e,t),s=o>=r,c=i>=n,l=0;return s&&c?l=2:(s||c)&&(l=1),{brightnessDifference:o,colorDifference:i,compliant:l,contrast:a,largeAA:a>=3,largeAAA:a>=4.5,normalAA:a>=4.5,normalAAA:a>=7}}function fn(e){if(I(e)||M(e))return`hex`;if(F(e))return J(e).model;if(St(e))return`hsl`;if(Ct(e))return`oklab`;if(wt(e))return`oklch`;if(Tt(e))return`rgb`;throw Error(j.invalid)}function pn(e,t){let n=M(e)?yt[e.toLowerCase()]:e,r=fn(n);if(r===t)return n;let i=`${r}2${t}`,a=U[i];if(!a)throw Error(`Converter not found for ${r} to ${t}`);switch(r){case`hex`:return t===`hex`?n:a(n);case`hsl`:return t===`hsl`?n:a(n);case`oklab`:return t===`oklab`?n:a(n);case`oklch`:return t===`oklch`?n:a(n);default:return t===`rgb`?n:a(n)}}function X(e,t={}){w(I(e)||xt(e),j.invalid);let{alpha:n,format:r=`hex`,precision:i=A,separator:a=` `}=t,o=n&&n!==1?`${H(n*100)}%`:null,s=[],c=a;switch(r){case`hsl`:{let{h:t,s:n,l:r}=pn(e,`hsl`);s=[t,`${n}%`,`${r}%`];break}case`oklab`:{c=` `;let{l:t,a:n,b:r}=V(pn(e,`oklab`),i);s=[`${H(t*100,i)}%`,n,r];break}case`oklch`:{c=` `;let{l:t,c:n,h:r}=V(pn(e,`oklch`),i);s=[`${H(t*100,i)}%`,n,r];break}case`rgb`:{let{r:t,g:n,b:r}=pn(e,`rgb`);s=[t,n,r];break}default:{let t=At(pn(e,`hex`));return n&&n!==1?`${t}${Ot(n)}`:t}}return`${r}(${s.join(c)}${o?` / ${o}`:``})`}function mn(e,t,n){return(r,i)=>{w(F(r),j.inputString),w(N(i),j.alpha);let a=Y(r,`hsl`),o=I(r)||M(r)?`hex`:J(r).model;return X({...a,[e]:R(a[e]+(t===`+`?i:-i),0,100)},{format:n??o})}}function hn(e,t,n){return mn(`l`,`-`,n)(e,t)}function gn(e,t,n){return mn(`s`,`-`,n)(e,t)}function _n(e,t,n){w(F(e),j.inputString),w(N(t),`degrees must be a number`);let r=Y(e,`hsl`),i=I(e)||M(e)?`hex`:J(e).model;return X({...r,h:Et(r.h,t)},{format:n??i})}function vn(e){w(F(e),j.inputString);let t=I(e)||M(e)?`hex`:J(e).model,n=Y(e,`hex`);return X(_n(n,180),{format:t})}function yn(e,t,n){return mn(`l`,`+`,n)(e,t)}function bn(e,t,n){w(F(e),j.inputString),w(N(t),j.alpha);let r=I(e)||M(e)?`hex`:J(e).model,i=Y(e,`rgb`);return X(i,{format:n??r,alpha:t})}function xn(e){if(w(F(e),j.inputString),I(e))return kt(e);if(Object.keys(yt).includes(e))return 1;let{alpha:t}=J(e);return t||1}function Sn(e,t,n){return mn(`s`,`+`,n)(e,t)}function Cn(e,t={}){let{darkColor:n=`#000000`,lightColor:r=`#ffffff`,threshold:i=128}=t;w(F(e),j.inputString),w(i>=0&&i<=255,j.threshold);try{let{r:t,g:a,b:o}=W(Y(e,`hex`)),s=(t*299+a*587+o*114)/1e3;return s>=i?n:r}catch(t){return console.warn(`Invalid color input: ${e}`),console.warn(t),n}}function wn(e,t,n){w(F(e),j.inputString),w(N(t),j.alpha),w(t>=-1&&t<=1,j.alpha);let r=Y(e,`oklab`),i=H(R(xn(e)-t,0,1));return X(r,{format:n,alpha:i})}var Tn=class{constructor(e,t={}){C(this,`alpha`),C(this,`hex`),C(this,`hsl`),C(this,`oklab`),C(this,`oklch`),C(this,`rgb`),C(this,`type`),w(!!e,`color is required`);let{alpha:n,hex:r,hsl:i,oklab:a,oklch:o,rgb:s,type:c}=an(e);this.hex=r,this.hsl=i,this.oklab=a,this.oklch=o,this.rgb=s,this.alpha=n,this.type=t.format??c}get css(){return this.selectedColor}get red(){return Number(this.rgb.r)}get green(){return Number(this.rgb.g)}get blue(){return Number(this.rgb.b)}get hue(){return Number(this.hsl.h)}get saturation(){return Number(this.hsl.s)}get lightness(){return Number(this.hsl.l)}get luminance(){return ln(this.selectedColor)}get chroma(){return sn(this.selectedColor)}get opacity(){return xn(this.selectedColor)}get textColor(){return Cn(this.selectedColor)}get selectedColor(){return X(this[this.type],{format:this.type,alpha:this.alpha})}brightnessDifference(e){return on(this.selectedColor,e)}colorDifference(e){return cn(this.selectedColor,e)}compare(e){return dn(this.selectedColor,e)}contrast(e){return un(this.selectedColor,e)}format(e,t){return X(this.rgb,{alpha:this.alpha,format:e,precision:t})}lighten(e){return yn(this.selectedColor,e)}darken(e){return hn(this.selectedColor,e)}saturate(e){return Sn(this.selectedColor,e)}desaturate(e){return gn(this.selectedColor,e)}invert(){return vn(this.selectedColor)}opacify(e=.9){return bn(this.selectedColor,e,this.type)}rotate(e){return _n(this.selectedColor,e)}transparentize(e=.1){return wn(this.selectedColor,e,this.type)}};function En(e,t){let n=Y(e,t);return X(n,{format:t})}var Dn=Tn;const On=e=>!(typeof e!=`object`||!(`h`in e)||!(`s`in e)||!(`l`in e)||!(`unit`in e)||!(`space`in e)||e.space!==`hsl`),kn=e=>typeof e!=`object`||!(`r`in e)||!(`g`in e)||!(`b`in e)||!(`space`in e)||!(`unit`in e)?!1:e.space===`srgb`,An=e=>{if(`r`in e&&`g`in e&&`b`in e){if(!(`unit`in e))if(e.r<=1&&e.g<=1&&e.b<=1)e.unit=`scalar`;else if(e.r>255&&e.g<=255&&e.b<=255)return;else e.unit=`8bit`;return`space`in e||(e.space=`srgb`),e}},jn=e=>{if(`h`in e&&`s`in e&&`l`in e){if(!(`unit`in e))if(e.r<=1&&e.g<=1&&e.b<=1)e.unit=`scalar`;else if(e.s>100&&e.l<=100)return;else e.unit=`absolute`;return`space`in e||(e.space=`hsl`),e}},Mn=e=>typeof e!=`object`||!(`l`in e)||!(`c`in e)||!(`h`in e)||!(`unit`in e)||!(`space`in e)?!1:e.space===`lch`||e.space===`oklch`,Nn=e=>typeof e==`string`?!0:typeof e==`object`?!!(On(e)||Mn(e)||kn(e)):!1,Pn=Object.freeze({h:0,s:0,l:0,opacity:0,unit:`absolute`,space:`hsl`});function Fn(e,t={}){return Ln(Mt(e),t)}function Z(e,t={}){if(e=e.toLowerCase(),e.startsWith(`hsla(`))throw Error(`hsla() not supported`);if(e.startsWith(`rgba(`))throw Error(`rgba() not supported`);if(e.startsWith(`#`))return Fn(e,t);if(e.startsWith(`--`))try{e=tr(e)}catch(n){if(t.fallbackString!==void 0&&(e=t.fallbackString),t.fallbackColour!==void 0)return t.fallbackColour;throw n}if(e===`transparent`)return Pn;if(Q[e]!==void 0)return Fn(Q[e],t);if(e.startsWith(`rgb(`)){let n=fr(e);return Ln(n,t)}if(!e.startsWith(`hsl(`))try{e=En(e,`hsl`)}catch(n){if(t.fallbackString)e=t.fallbackString;else throw n}try{let n=Un(e);return t.scalar?zn(n):Rn(n)}catch(e){if(t.fallbackColour)return t.fallbackColour;throw e}}const In=e=>{let t=Rn(e),n=`hsl(${t.h}deg ${t.s}% ${t.l}%`;return`opacity`in t&&t.opacity!==void 0&&t.opacity<100&&(n+=` / ${t.opacity}%`),n+=`)`,n};function Ln(e,t={}){if(e==null&&t.fallbackColour)return t.fallbackColour;let r=t.scalar??!0;return n(l(e.h,0,360,`h`),l(e.s,0,100,`s`),l(e.l,0,100,`l`),s(e.alpha??1,`alpha`)),r?Vn(e.h/360,e.s/100,e.l/100,e.alpha??1):Hn(e.h,e.s,e.l,(e.alpha??1)*100)}const Rn=e=>{if(typeof e==`string`)return Z(e,{scalar:!1});if(kn(e))return Rn(Ln(fr(e),{scalar:!1}));let t=e;return Bn(t),t.unit===`absolute`?t:{h:t.h*360,s:t.s*100,l:t.l*100,opacity:(t.opacity??1)*100,unit:`absolute`,space:`hsl`}},zn=e=>{if(typeof e==`string`)return Z(e,{scalar:!0});if(kn(e))return zn(Ln(fr(e),{scalar:!0}));let t=e;return Bn(t),t.unit===`scalar`?t:{h:t.h/360,s:t.s/100,l:t.l/100,opacity:(t.opacity??1)/100,unit:`scalar`,space:`hsl`}},Bn=e=>{let{h:t,s:r,l:i,opacity:a,space:s,unit:c}=e;if(s!==`hsl`)throw Error(`Space is expected to be 'hsl'. Got: ${s}`);if(c===`absolute`)n(o(t,`finite`,`h`),l(r,0,100,`s`),l(i,0,100,`l`),()=>{if(typeof a==`number`)return l(a,0,100,`opacity`)});else if(c===`scalar`)n(o(t,`percentage`,`h`),o(r,`percentage`,`s`),o(i,`percentage`,`l`),()=>{if(typeof a==`number`)return o(a,`percentage`,`opacity`)});else throw Error(`Unit is expected to be 'absolute' or 'scalar'. Got: ${c}`)};function Vn(e=.5,t=1,n=.5,r=1){let i={unit:`scalar`,space:`hsl`,h:e,s:t,l:n,opacity:r};return Bn(i),i}function Hn(e=200,t=100,n=50,r=100){let i={unit:`absolute`,space:`hsl`,h:e,s:t,l:n,opacity:r};return Bn(i),i}function Un(e){if(e.startsWith(`hsla`))throw Error(`hsla() is not supported`);if(!e.startsWith(`hsl(`))throw Error(`Expected hsl(..) CSS colour`);let t=e.indexOf(`(`),n=e.indexOf(`)`);if(n<t)throw Error(`Is hsl() not terminated? Missing ')'`);let r=e.substring(t+1,n),i=r.split(/[\s,]+/);if(i.length<3)throw Error(`Expected three tokens. Got: ${i.length} length`);let a=!1;i[0].endsWith(`%`)&&(a=!0),i[1].endsWith(`%`)&&i[2].endsWith(`%`)&&(a=!0);let o=(e,t)=>{if(e===`none`)return 0;if(e.endsWith(`%`))return Number.parseFloat(e.substring(0,e.length-1))/100;e.endsWith(`deg`)&&t===0&&(e=e.substring(0,e.length-3));let n=Number.parseFloat(e);return t===0?n/360:t===3?n:n/100},s=(e,t)=>{if(e===`none`)return 0;if(e.endsWith(`%`)){let n=Number.parseFloat(e.substring(0,e.length-1));return t===0?n*360:n}if(e.endsWith(`deg`)&&t===0)return Number.parseFloat(e.substring(0,e.length-3));let n=Number.parseFloat(e);return n};return i.length>3&&i[3]===`/`&&(i=[i[0],i[1],i[2],i[4]]),a?Vn(o(i[0],0),o(i[1],1),o(i[2],2),o(i[3]??`100%`,3)):Hn(s(i[0],0),s(i[1],1),s(i[2],2),s(i[3]??`100%`,3))}function Wn(e){if(typeof e==`string`){let t=Z(e,{scalar:!1});return Wn(t)}e=Rn(e);let t=q({h:e.h,s:e.s,l:e.l});return{...t,alpha:(e.opacity??100)/100*255}}const Gn=.4,Kn=e=>{let{l:t,c:r,h:i,opacity:a,space:o,unit:c}=e;if(o!==`oklch`)throw Error(`Space is expected to be 'oklch'. Got: ${o}`);if(c===`absolute`)n(s(t,`l`),()=>{if(typeof r==`number`)return l(r,0,Gn,`c`)},()=>{if(typeof i==`number`)return l(r,0,360,`h`)},s(a??1,`opacity`));else if(c===`scalar`)n(s(t,`l`),s(r,`c`),s(i,`h`),s(e.opacity??1,`opacity`));else throw Error(`Unit is expected to be 'absolute' or 'scalar'. Got: ${c}`)};function qn(e,t={}){if(e==null&&t.fallbackColour)return t.fallbackColour;let r=t.scalar??!0;return n(s(e.l,`l`),s(e.c,`c`),l(e.h,0,360,`h`),s(e.alpha??1,`alpha`)),r?Qn(e.l,e.c/Gn,e.h/360,e.alpha??1):$n(e.l,e.c,e.h,e.alpha??1)}const Jn=(e,t={})=>qn(Vt(e),t),Yn=Object.freeze({l:0,c:0,h:0,opacity:0,unit:`absolute`,space:`oklch`});function Xn(e,t={}){if(e=e.toLowerCase(),e.startsWith(`#`))return Jn(e,t);if(e===`transparent`)return Yn;if(Q[e]!==void 0)return Jn(Q[e],t);if(e.startsWith(`rgb(`)){let n=sr(dr(e)),r=Bt({r:n.r,g:n.g,b:n.b});return qn(r,t)}if(!e.startsWith(`hsl(`)&&!e.startsWith(`oklch(`))try{let t=En(e,`oklch`);e=t}catch(n){if(t.fallbackString)e=t.fallbackString;else throw n}let n=new Dn(e),r=n.oklch;return qn(r,t)}const Zn=(e,t=3)=>{Kn(e);let{l:n,c:r,h:i,opacity:a}=e,o=``;switch(e.unit){case`absolute`:o=`oklch(${(n*100).toFixed(t)}% ${r.toFixed(t)} ${i.toFixed(t)}`;break;case`scalar`:o=`oklch(${n.toFixed(t)} ${(r*Gn).toFixed(t)} ${(i*360).toFixed(t)}`;break}return a!==void 0&&a!==1&&(o+=` / ${a.toFixed(t)}`),o+=`)`,o};function Qn(e=.7,t=.1,n=.5,r=1){let i={unit:`scalar`,space:`oklch`,l:e,c:t,h:n,opacity:r};return Kn(i),i}const $n=(e,t,n,r=1)=>{let i={space:`oklch`,unit:`absolute`,opacity:r,l:e,c:t,h:n};return Kn(i),i},er=e=>{if(e.startsWith(`#`))return nr(e,!0);if(Q[e]!==void 0)return nr(Q[e],!0);if(e.startsWith(`--`)){let t=getComputedStyle(document.body).getPropertyValue(e).trim();if(t.length===0||t===null)throw Error(`Variable missing: ${e}`);return er(t)}if(e=e.toLowerCase(),e.startsWith(`hsl(`))return Z(e,{scalar:!0});if(e.startsWith(`rgb(`))return ir(e,{scalar:!0});if(e.startsWith(`oklch(`))return Xn(e,{scalar:!0});throw Error(`String colour is not a hex colour, CSS variable nor well-defined colour. Input: '${e}'`)},tr=(e,t)=>{if(e.startsWith(`--`)){let n=getComputedStyle(document.body).getPropertyValue(e).trim();if(n.length===0||n===null){if(t!==void 0)return t;throw Error(`CSS variable missing: '${e}'`)}return tr(n)}return Q[e]===void 0?e:Q[e]},Q={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`,transparent:`#00000000`};function nr(e,t=!0){return or(W(e),{scalar:t})}const rr=Object.freeze({r:0,g:0,b:0,opacity:0,unit:`8bit`,space:`srgb`});function ir(e,t={}){if(e=e.toLowerCase(),e.startsWith(`hsla(`))throw Error(`hsla() not supported`);if(e.startsWith(`rgba(`))throw Error(`rgba() not supported`);let n=t.scalar??!0;if(e.startsWith(`#`))return nr(e,n);if(e===`transparent`)return rr;if(Q[e]!==void 0&&nr(Q[e],n),e.startsWith(`hsl(`)){let n=Wn(e);return or(n,t)}if(!e.startsWith(`rgb(`))try{e=En(e,`rgb`)}catch(n){if(t.fallbackString)e=t.fallbackString;else throw n}try{let t=dr(e);return n?cr(t):sr(t)}catch(e){if(t.fallbackColour)return t.fallbackColour;throw e}}const ar=e=>{switch($(e),e.unit){case`8bit`:return e.opacity===void 0||e.opacity===255?`rgb(${e.r} ${e.g} ${e.b})`:`rgb(${e.r} ${e.g} ${e.b} / ${(e.opacity??255)/255})`;case`scalar`:return e.opacity===void 0||e.opacity===1?`rgb(${e.r*100}% ${e.g*100}% ${e.b*100}%)`:`rgb(${e.r*100}% ${e.g*100}% ${e.b*100}% / ${(e.opacity??1)*100}%)`;default:throw Error(`Unknown unit: ${e.unit}`)}};function or(e,t={}){return t.scalar?{r:e.r/255,g:e.g/255,b:e.b/255,opacity:e.alpha??1,unit:`scalar`,space:`srgb`}:{r:e.r,g:e.g,b:e.b,opacity:e.alpha??255,unit:`8bit`,space:`srgb`}}const sr=e=>typeof e==`string`?ir(e,{scalar:!1}):On(e)?sr(or(Wn(e),{scalar:!1})):($(e),e.unit===`8bit`?e:{r:e.r*255,g:e.g*255,b:e.b*255,opacity:(e.opacity??1)*255,unit:`8bit`,space:`srgb`}),cr=e=>typeof e==`string`?ir(e,{scalar:!0}):On(e)?cr(or(Wn(e),{scalar:!0})):($(e),e.unit===`scalar`?e:{r:e.r/255,g:e.g/255,b:e.b/255,opacity:(e.opacity??1)/255,unit:`scalar`,space:`srgb`}),$=e=>{let{r:t,g:r,b:i,opacity:a,space:s,unit:c}=e;if(s!==`srgb`)throw Error(`Space is expected to be 'srgb'. Got: ${s}`);if(c===`8bit`)n(l(t,0,255,`r`),l(r,0,255,`g`),l(i,0,255,`b`),()=>{if(typeof a==`number`)return l(a,0,255,`opacity`)});else if(c===`scalar`)n(o(t,`percentage`,`r`),o(r,`percentage`,`g`),o(i,`percentage`,`b`),()=>{if(typeof a==`number`)return o(a,`percentage`,`opacity`)});else throw Error(`Unit is expected to be '8bit' or 'scalar'. Got: ${c}`)};function lr(e=100,t=100,n=100,r=255){let i={unit:`8bit`,space:`srgb`,r:e,g:t,b:n,opacity:r};return $(i),i}function ur(e=.5,t=.5,n=.5,r=1){let i={unit:`scalar`,space:`srgb`,r:e,g:t,b:n,opacity:r};return $(i),i}function dr(e){if(e.startsWith(`rgba`))throw Error(`RGBA is not supported`);if(!e.startsWith(`rgb(`))throw Error(`Expected rgb(..) CSS colour`);let t=e.indexOf(`(`),n=e.indexOf(`)`);if(n<t)throw Error(`Is rgb() not terminated? Missing ')'`);let r=e.substring(t+1,n),i=r.split(/[\s,]+/);if(i.length<3)throw Error(`Expected three tokens. Got: ${i.length} length`);let a=0;for(let e of i)e.endsWith(`%`)&&a++;let o=(e,t)=>e.endsWith(`%`)?Number.parseFloat(e.substring(0,e.length-1))/100:t<3?Number.parseFloat(e)/255:Number.parseFloat(e),s=(e,t)=>e.endsWith(`%`)?Number.parseFloat(e.substring(0,e.length-1))/100*255:t<3?Number.parseFloat(e):Number.parseFloat(e)*255;return i.length>3&&i[3]===`/`&&(i=[i[0],i[1],i[2],i[4]]),a>1?ur(o(i[0],0),o(i[1],1),o(i[2],2),o(i[3]??`1`,3)):lr(s(i[0],0),s(i[1],1),s(i[2],2),s(i[3]??`1`,3))}function fr(e){if(typeof e==`string`){let t=ir(e,{scalar:!1});return fr(t)}e=sr(e);let t=G({r:e.r,g:e.g,b:e.b});return{...t,alpha:(e.opacity??255)/255}}const pr=e=>{if(typeof e==`string`)return e;if(On(e))return In(e);if(kn(e))return ar(e);if(Mn(e))return Zn(e);let t=An(e);if(t)return ar(t);let n=jn(e);if(n)return In(n);throw Error(`Unknown colour format: '${JSON.stringify(e)}'`)},mr=e=>{switch(e.space){case`hsl`:Bn(e);break;case`srgb`:$(e);break;case`oklch`:Kn(e);break;default:throw Error(`Unsupported colour space: '${e.space}'`)}},hr=e=>{if(!Nn(e))throw Error(`Could not parse input. Expected CSS colour string or structured colour {r,g,b}, {h,s,l} etc. Got: ${JSON.stringify(e)}`);let t;if(t=typeof e==`string`?er(e):e,t===void 0)throw Error(`Could not parse input. Expected CSS colour string or structured colour {r,g,b}, {h,s,l} etc.`);return mr(t),t};function gr(e,t={}){let n=vr(e,t),r=n.el,i=t.relative??!1,a=t.inverted??!1,o=rt(n,e=>Number.parseFloat(e));i&&(r.max=a?`0`:`1`,r.min=a?`1`:`0`,r.hasAttribute(`step`)||(r.step=`0.1`)),r.getAttribute(`type`)===null&&(r.type=`range`);let s=e=>{n.set(e.toString())};return{...o,last(){return Number.parseFloat(n.last())},set:s}}function _r(e,t={}){let n=vr(e,{...t,upstreamFilter:e=>typeof e==`object`?pr(e):e}),r=rt(n,e=>Z(e,{scalar:!0,ensureSafe:!0}));return{...r,last(){return Z(n.last(),{scalar:!0,ensureSafe:!0})},set(e){n.set(In(e))}}}function vr(e,t={}){let n=typeof e==`string`?document.querySelector(e):e;if(n===null&&typeof e==`string`)throw Error(`Element query could not be resolved '${e}'`);if(n===null)throw Error(`targetOrQuery is null`);let r=S(e),i=t.when??`changed`,a=i===`changed`?`change`:`input`,o=t.emitInitialValue??!1,s=t.fallbackValue??``,c=t.upstreamSource,l=()=>{},u=t.attributeName,d=t.fieldName;d===void 0&&u===void 0&&(u=d=`value`);let f=()=>{let e;return u&&(e=r.getAttribute(u)),d&&(e=r[d]),e??=s,e},p=e=>{u&&r.setAttribute(u,e),d&&(r[d]=e)},m=e=>{e=t.upstreamFilter?t.upstreamFilter(e):e,p(e)};c&&(l=c.onValue(m),b(c)&&m(c.last()));let h=tt(r,a,{fireInitial:o,debugFiring:t.debugFiring??!1,debugLifecycle:t.debugLifecycle??!1}),g=rt(h,e=>f());return{...g,el:r,last(){return f()},set(e){p(e)},dispose(e){l(),g.dispose(e),h.dispose(e)}}}function yr(e,t={}){let n=S(e),r=t.when??`changed`,i=r===`changed`?`change`:`input`,a=t.emitInitialValue??!1,o=t.upstreamSource,s=new Map,c=()=>{},l=()=>{let e=new FormData(n),t=[];for(let[n,r]of e.entries()){let e=r.toString(),i=s.get(n);if(!i){let t=u(n,e);t&&(i=t.type===`range`||t.type===`number`?`number`:t.type===`color`?`colour`:t.type===`checkbox`&&(r===`true`||r===`on`)?`boolean`:`string`,s.set(n,i))}if(i===`number`)t.push([n,Number.parseFloat(e)]);else if(i===`boolean`){let r=e===`true`;t.push([n,r])}else if(i===`colour`){let r=pr(e);t.push([n,ir(r,{scalar:!1})])}else t.push([n,r.toString()])}for(let e of n.querySelectorAll(`input[type="checkbox"]`))!e.checked&&e.value===`true`&&t.push([e.name,!1]);let r=Object.fromEntries(t);return r},u=(e,t)=>{let r=n.querySelector(`[name="${e}"]`);if(!r){console.warn(`Form does not contain an element with name="${e}"`);return}if(r.type===`radio`){let r=n.querySelector(`[name="${e}"][value="${t}"]`);if(!r){console.warn(`Form does not contain radio option for name=${e} value=${t}`);return}return r}return r},d=(e,t)=>{let n=u(e,t);if(n&&(n.nodeName===`INPUT`||n.nodeName===`SELECT`)){if(n.type===`color`)typeof t==`object`&&(t=pr(t));else if(n.type===`checkbox`)if(typeof t==`boolean`){n.checked=t;return}else console.warn(`Rx.Sources.domForm: Trying to set non boolean type to a checkbox. Name: ${e} Value: ${t} (${typeof t})`);else if(n.type===`radio`){n.checked=!0;return}n.value=t}},f=e=>{for(let[n,r]of Object.entries(e)){let e=s.get(n);e||(e=typeof r,e===`object`&&(hr(r),e=`colour`),s.set(n,e));let i=t.upstreamFilter?t.upstreamFilter(n,r):r;d(n,i)}};o&&(c=o.onValue(f),b(o)&&f(o.last()));let p=tt(n,i,{fireInitial:a,debugFiring:t.debugFiring??!1,debugLifecycle:t.debugLifecycle??!1}),m=rt(p,e=>l());return{...m,el:n,last(){return l()},set:f,setNamedValue:d,dispose(e){c(),m.dispose(e),p.dispose(e)}}}function br(e){let t=[...document.querySelectorAll(e)];return Qe(t)}const xr=(e,t,n={})=>wr(e,t,{...n,elField:`textContent`}),Sr=(e,t,n={})=>wr(e,t,{...n,elField:`value`,attribName:`value`}),Cr=(e,t,n={})=>wr(e,t,{...n,elField:`innerHTML`}),wr=(e,t,...n)=>{if(t===null)throw Error(`Param 'elOrQuery' is null`);if(t===void 0)throw Error(`Param 'elOrQuery' is undefined`);let r=S(t),i=[];n.length===0?i.push({elField:`textContent`}):i=[...n];let a=i.map(e=>`element`in e?e:{...e,element:r});return Or(e,...a)},Tr=(e,t)=>{let n=Er(e);return e=>{n(e,t)}},Er=e=>{if(e.elField!==void 0||e.cssVariable===void 0&&e.attribName===void 0&&e.cssProperty===void 0&&e.textContent===void 0&&e.htmlContent===void 0){let t=e.elField??`textContent`;return(e,n)=>{n[t]=e}}if(e.attribName!==void 0){let t=e.attribName;return(e,n)=>{n.setAttribute(t,e)}}if(e.textContent)return(e,t)=>{t.textContent=e};if(e.htmlContent)return(e,t)=>{t.innerHTML=e};if(e.cssVariable!==void 0){let t=e.cssVariable;return t.startsWith(`--`)||(t=`--`+t),(e,n)=>{n.style.setProperty(t,e)}}return e.cssProperty===void 0?(e,t)=>{}:(t,n)=>{n.style[e.cssProperty]=t}},Dr=e=>{if(!(!e.transform&&!e.transformValue)){if(e.transformValue){if(e.sourceField===void 0)throw Error(`Expects 'sourceField' to be set when 'transformValue' is set`);return t=>{let n=t[e.sourceField];return e.transformValue(n)}}else if(e.transform){if(e.sourceField!==void 0)throw Error(`If 'transform' is set, 'sourceField' is ignored`);return t=>e.transform(t)}}},Or=(e,...t)=>{let n=t.map(e=>{if(e.element&&e.element!==void 0)return e;if(e.query)return{...e,element:S(e.query)};throw Error(`Unable to resolve element. Missing 'element' or 'query' values on bind. ${JSON.stringify(e)}`)}),r=n.map(e=>({update:Tr(e,e.element),transformer:Dr(e),sourceField:e.sourceField})),i=e=>{for(let t of r)if(t.transformer)t.update(t.transformer(e));else{let n=t.sourceField?e[t.sourceField]:e;typeof n==`object`?(t.sourceField,t.update(JSON.stringify(n))):t.update(n)}},a=e.on(e=>{Ke(e)?i(e.value):Ge(e)&&console.warn(e)});return b(e)&&i(e.last()),{remove:e=>{if(a(),e)for(let e of n)e.element.remove()}}},kr=(e,t,n)=>{let r=S(t),i=e=>{n(e,r)},a=e.on(e=>{Ke(e)?(console.log(e),i(e.value)):console.warn(e)});return b(e)&&i(e.last()),{remove:e=>{a(),e&&r.remove()}}},Ar=(e,t,n,r={})=>{if(t===null)throw Error(`Param 'elOrQuery' is null`);if(t===void 0)throw Error(`Param 'elOrQuery' is undefined`);let i=S(t),a=e=>{n(e,i)},o=e.onDiff(e=>{a(e)}),s=()=>{b(e)&&r.initial&&r.initial(e.last(),i)};return s(),{refresh:()=>{s()},remove:e=>{o(),e&&i.remove()}}},jr=(e,t)=>{let n=t.container?S(t.container):document.body,r=t.defaultTag??`div`,i=new Map,a=new Map;for(let[e,n]of Object.entries(t.binds??{})){let t=n.tagName??r;a.set(e,{...n,update:Er(n),transform:Dr(n),tagName:t,path:e})}let o=e=>{let t=h(a,ce(e));if(t!==void 0)return t;if(!e.includes(`.`))return a.get(`_root`)};function*s(e){for(let t of le(e))a.has(t)&&(yield a.get(t));a.has(`_root`)&&e.includes(`.`)&&(yield a.get(`_root`))}let c=(e,t)=>{let a=Mr(e);console.log(`Rx.Dom.elements.create: ${e} rooted: ${a} value: ${JSON.stringify(t)}`);let c=o(Mr(e)),u=r;c?.tagName&&(u=c.tagName);let d=document.createElement(u);d.setAttribute(`data-path`,e),l(e,d,t);let f;for(let t of s(a))if(t?.nestChildren){let n=ue(e,`.`),r=t.path.replace(`_root`,n);if(f=i.get(r),f!==void 0)break}(f??n).append(d),i.set(e,d),console.log(`Added el: ${e}`)},l=(e,t,n)=>{console.log(`Rx.dom.update path: ${e} value:`,n);let r=o(Mr(e));r===void 0?(typeof n==`object`&&(n=JSON.stringify(n)),t.textContent=n):(r.transform&&(n=r.transform(n)),r.update(n,t))},u=e=>{let t=new Ne({},e),n=t.dequeue(),r=new Set;for(;n!==void 0;){let e=n.path;if(!(`previous`in n)||n.previous===void 0){console.log(`Rx.Dom.elements.changes no previous. path: ${e}`),c(e,n.value);let i=[...ie(n.value,!1,2**53-1,e)];console.log(i);for(let e of i)r.has(e.path)||(t.enqueue(e),r.add(e.path))}else if(n.value===void 0){let t=i.get(e);t===void 0?console.warn(`No element to delete? ${e} `):(console.log(`Rx.Dom.elements.changes delete ${e}`),t.remove())}else{let t=i.get(e);t===void 0?(console.warn(`Rx.Dom.elements.changes No element to update ? ${e} `),c(e,n.value)):l(e,t,n.value)}n=t.dequeue()}};if(e.onDiff(e=>{u(e)}),b(e)){let t=e.last();u([...ie(t,!1,1)])}},Mr=e=>{let t=de(e,`.`);return t===e?`_root`:`_root.`+t};function Nr(){let e=()=>({width:window.innerWidth,height:window.innerHeight}),t=et(window,`resize`,{lazy:`very`,transform:()=>e()}),n=et(window,`pointermove`,{lazy:`very`,transform:e=>{if(e===void 0)return{x:0,y:0};let t=e;return{x:t.x,y:t.y}}}),r=(e=`Reactive.win.dispose`)=>{t.dispose(e),n.dispose(e)};return{dispose:r,size:t,pointer:n}}var Pr={};e(Pr,{bind:()=>Or,bindDiffUpdate:()=>Ar,bindElement:()=>wr,bindHtml:()=>Cr,bindText:()=>xr,bindUpdate:()=>kr,bindValueText:()=>Sr,browserResizeObservable:()=>lt,colour:()=>ft,cssClassChange:()=>dt,domForm:()=>yr,domHslInputValue:()=>_r,domInputValue:()=>vr,domNumberInputValue:()=>gr,elements:()=>jr,fromDomQuery:()=>br,win:()=>Nr,windowResize:()=>ut});export{Pr as RxUi};
2
2
  //# sourceMappingURL=index.js.map