@microsoft/fast-element
Advanced tools
Comparing version 2.0.0-beta.14 to 2.0.0-beta.15
@@ -5,2 +5,23 @@ { | ||
{ | ||
"date": "Tue, 25 Oct 2022 20:24:32 GMT", | ||
"tag": "@microsoft/fast-element_v2.0.0-beta.15", | ||
"version": "2.0.0-beta.15", | ||
"comments": { | ||
"prerelease": [ | ||
{ | ||
"author": "nicholasrice@users.noreply.github.com", | ||
"package": "@microsoft/fast-element", | ||
"commit": "220cc7e0e0de490e51cc8b6f42ff46b03228beaa", | ||
"comment": "Updated the ElementController to connect behaviors prior to rendering element templates" | ||
}, | ||
{ | ||
"author": "nicholasrice@users.noreply.github.com", | ||
"package": "@microsoft/fast-element", | ||
"commit": "32ca5de5feda4870ed36329f58ded4a0a0421f02", | ||
"comment": "Added support to fast-element to support element hydration and the `defer-hydration` attribute" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Fri, 14 Oct 2022 18:26:11 GMT", | ||
@@ -7,0 +28,0 @@ "tag": "@microsoft/fast-element_v2.0.0-beta.14", |
# Change Log - @microsoft/fast-element | ||
This log was last generated on Fri, 14 Oct 2022 18:26:11 GMT and should not be manually modified. | ||
This log was last generated on Tue, 25 Oct 2022 20:24:32 GMT and should not be manually modified. | ||
<!-- Start content --> | ||
## 2.0.0-beta.15 | ||
Tue, 25 Oct 2022 20:24:32 GMT | ||
### Changes | ||
- Updated the ElementController to connect behaviors prior to rendering element templates (nicholasrice@users.noreply.github.com) | ||
- Added support to fast-element to support element hydration and the `defer-hydration` attribute (nicholasrice@users.noreply.github.com) | ||
## 2.0.0-beta.14 | ||
@@ -8,0 +17,0 @@ |
import { StyleStrategy, StyleTarget } from "../interfaces.js"; | ||
import { PropertyChangeNotifier } from "../observation/notifier.js"; | ||
import { ElementStyles } from "../styles/element-styles.js"; | ||
import type { HostBehavior, HostController } from "../styles/host.js"; | ||
import { PropertyChangeNotifier } from "../observation/notifier.js"; | ||
import type { ElementViewTemplate } from "../templating/template.js"; | ||
import type { ElementView } from "../templating/view.js"; | ||
import { ElementStyles } from "../styles/element-styles.js"; | ||
import { FASTElementDefinition } from "./fast-definitions.js"; | ||
/** | ||
* A type that instantiates an ElementController | ||
* @public | ||
*/ | ||
export interface ElementControllerStrategy { | ||
new (element: HTMLElement, definition: FASTElementDefinition): ElementController; | ||
} | ||
/** | ||
* Controls the lifecycle and rendering of a `FASTElement`. | ||
@@ -116,3 +123,2 @@ * @public | ||
emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): void | boolean; | ||
private finishInitialization; | ||
private renderTemplate; | ||
@@ -128,2 +134,8 @@ /** | ||
static forCustomElement(element: HTMLElement): ElementController; | ||
/** | ||
* Sets the strategy that ElementController.forCustomElement uses to construct | ||
* ElementController instances for an element. | ||
* @param strategy - The strategy to use. | ||
*/ | ||
static setStrategy(strategy: ElementControllerStrategy): void; | ||
} | ||
@@ -130,0 +142,0 @@ /** |
@@ -27,2 +27,2 @@ export type { Callable, Constructable, Disposable, FASTGlobal, Mutable, StyleStrategy, StyleTarget, TrustedTypes, TrustedTypesPolicy, } from "./interfaces.js"; | ||
export * from "./components/attributes.js"; | ||
export { ElementController } from "./components/element-controller.js"; | ||
export { ElementController, ElementControllerStrategy, } from "./components/element-controller.js"; |
@@ -23,1 +23,15 @@ /** | ||
export declare function composedContains(reference: HTMLElement, test: HTMLElement): boolean; | ||
/** | ||
* @internal | ||
*/ | ||
export declare class UnobservableMutationObserver extends MutationObserver { | ||
private readonly callback; | ||
private observedNodes; | ||
/** | ||
* An extension of MutationObserver that supports unobserving nodes. | ||
* @param callback - The callback to invoke when observed nodes are changed. | ||
*/ | ||
constructor(callback: MutationCallback); | ||
observe(target: Node, options?: MutationObserverInit | undefined): void; | ||
unobserve(target: Node): void; | ||
} |
@@ -18,2 +18,3 @@ import "../interfaces.js"; | ||
} | ||
let elementControllerStrategy; | ||
/** | ||
@@ -260,8 +261,13 @@ * Controls the lifecycle and rendering of a `FASTElement`. | ||
} | ||
if (this.needsInitialization) { | ||
this.finishInitialization(); | ||
// If we have any observables that were bound, re-apply their values. | ||
if (this.boundObservables !== null) { | ||
const element = this.source; | ||
const boundObservables = this.boundObservables; | ||
const propertyNames = Object.keys(boundObservables); | ||
for (let i = 0, ii = propertyNames.length; i < ii; ++i) { | ||
const propertyName = propertyNames[i]; | ||
element[propertyName] = boundObservables[propertyName]; | ||
} | ||
this.boundObservables = null; | ||
} | ||
else if (this.view !== null) { | ||
this.view.bind(this.source); | ||
} | ||
const behaviors = this.behaviors; | ||
@@ -273,2 +279,10 @@ if (behaviors !== null) { | ||
} | ||
if (this.needsInitialization) { | ||
this.renderTemplate(this.template); | ||
this.addStyles(this.mainStyles); | ||
this.needsInitialization = false; | ||
} | ||
else if (this.view !== null) { | ||
this.view.bind(this.source); | ||
} | ||
this.setIsConnected(true); | ||
@@ -320,18 +334,2 @@ } | ||
} | ||
finishInitialization() { | ||
const element = this.source; | ||
const boundObservables = this.boundObservables; | ||
// If we have any observables that were bound, re-apply their values. | ||
if (boundObservables !== null) { | ||
const propertyNames = Object.keys(boundObservables); | ||
for (let i = 0, ii = propertyNames.length; i < ii; ++i) { | ||
const propertyName = propertyNames[i]; | ||
element[propertyName] = boundObservables[propertyName]; | ||
} | ||
this.boundObservables = null; | ||
} | ||
this.renderTemplate(this.template); | ||
this.addStyles(this.mainStyles); | ||
this.needsInitialization = false; | ||
} | ||
renderTemplate(template) { | ||
@@ -380,5 +378,15 @@ var _a; | ||
} | ||
return (element.$fastController = new ElementController(element, definition)); | ||
return (element.$fastController = new elementControllerStrategy(element, definition)); | ||
} | ||
/** | ||
* Sets the strategy that ElementController.forCustomElement uses to construct | ||
* ElementController instances for an element. | ||
* @param strategy - The strategy to use. | ||
*/ | ||
static setStrategy(strategy) { | ||
elementControllerStrategy = strategy; | ||
} | ||
} | ||
// Set default strategy for ElementController | ||
ElementController.setStrategy(ElementController); | ||
/** | ||
@@ -385,0 +393,0 @@ * Converts a styleTarget into the operative target. When the provided target is an Element |
@@ -30,2 +30,2 @@ export * from "./platform.js"; | ||
export * from "./components/attributes.js"; | ||
export { ElementController } from "./components/element-controller.js"; | ||
export { ElementController, } from "./components/element-controller.js"; |
@@ -45,1 +45,28 @@ /** | ||
} | ||
/** | ||
* @internal | ||
*/ | ||
export class UnobservableMutationObserver extends MutationObserver { | ||
/** | ||
* An extension of MutationObserver that supports unobserving nodes. | ||
* @param callback - The callback to invoke when observed nodes are changed. | ||
*/ | ||
constructor(callback) { | ||
function handler(mutations) { | ||
this.callback.call(null, mutations.filter(record => this.observedNodes.has(record.target))); | ||
} | ||
super(handler); | ||
this.callback = callback; | ||
this.observedNodes = new Set(); | ||
} | ||
observe(target, options) { | ||
this.observedNodes.add(target); | ||
super.observe(target, options); | ||
} | ||
unobserve(target) { | ||
this.observedNodes.delete(target); | ||
if (this.observedNodes.size < 1) { | ||
this.disconnect(); | ||
} | ||
} | ||
} |
@@ -1,1 +0,1 @@ | ||
!function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t}),void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",{value:Object.create(null),configurable:!1,enumerable:!1,writable:!1});const e=globalThis.FAST,t={1101:"Must call enableArrayObservation before observing arrays.",1201:"The HTML policy can only be set once.",1202:"To bind innerHTML, you must use a TrustedTypesPolicy.",1203:"View=>Model update skipped. To use twoWay binding, the target property must be observable.",1204:"No host element is present. Cannot bind host with ${name}.",1205:"The requested binding behavior is not supported by the binding engine.",1401:"Missing FASTElement definition.",1501:"No registration for Context/Interface '${name}'.",1502:"Dependency injection resolver for '${key}' returned a null factory.",1503:"Invalid dependency injection resolver strategy specified '${strategy}'.",1504:"Unable to autoregister dependency.",1505:"Unable to resolve dependency injection key '${key}'.",1506:"'${name}' is a native function and therefore cannot be safely constructed by DI. If this is intentional, please use a callback or cachedCallback resolver.",1507:"Attempted to jitRegister something that is not a constructor '${value}'. Did you forget to register this dependency?",1508:"Attempted to jitRegister an intrinsic type '${value}'. Did you forget to add @inject(Key)?",1509:"Attempted to jitRegister an interface '${value}'.",1510:"A valid resolver was not returned from the register method.",1511:"Key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?",1512:"'${key}' not registered. Did you forget to add @singleton()?",1513:"Cyclic dependency found '${name}'.",1514:"Injected properties that are updated on changes to DOM connectivity require the target object to be an instance of FASTElement."},s=/(\$\{\w+?})/g,i=/\$\{(\w+?)}/g,n=Object.freeze({});function r(e,t){return e.split(s).map((e=>{var s;const n=e.replace(i,"$1");return String(null!==(s=t[n])&&void 0!==s?s:e)})).join("")}Object.assign(e,{addMessages(e){Object.assign(t,e)},warn(e,s=n){var i;const o=null!==(i=t[e])&&void 0!==i?i:"Unknown Warning";console.warn(r(o,s))},error(e,s=n){var i;const o=null!==(i=t[e])&&void 0!==i?i:"Unknown Error";return new Error(r(o,s))}});const o={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},o));const l=globalThis.FAST;if(void 0===l.getById){const e=Object.create(null);Reflect.defineProperty(l,"getById",Object.assign({value(t,s){let i=e[t];return void 0===i&&(i=s?e[t]=s():null),i}},o))}void 0===l.error&&Object.assign(l,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const a=Object.freeze([]);function h(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance(t){if(null!=t)return e.get(t.constructor)}})}function c(){const e=new WeakMap;return function(t){let s=e.get(t);if(void 0===s){let i=Reflect.getPrototypeOf(t);for(;void 0===s&&null!==i;)s=e.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),e.set(t,s)}return s}}const d=e=>"function"==typeof e,u=e=>"string"==typeof e,f=l.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class p{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class g{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new p(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new p(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const b=Object.freeze({unknown:void 0,coupled:1}),v=l.getById(2,(()=>{const e=f.enqueue,t=/(:|&&|\|\||if)/,s=new WeakMap;let i,n=e=>{throw l.error(1101)};function r(e){var t;let i=null!==(t=e.$fastController)&&void 0!==t?t:s.get(e);return void 0===i&&(Array.isArray(e)?i=n(e):s.set(e,i=new g(e))),i}const o=c();class a{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==i&&i.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];d(n)&&n.call(e,i,t),r(e).notify(this.name)}}}class h extends p{constructor(e,t,s=!1){super(e,t),this.expression=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}bind(e){this.controller=e;const t=this.observe(e.source,e.context);return!e.isBound&&this.requiresUnbind(e)&&e.onUnbind(this),t}requiresUnbind(e){return e.sourceLifetime!==b.coupled||this.first!==this.last||this.first.propertySource!==e.source}unbind(e){this.dispose()}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=i;let n;i=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;try{n=this.expression(e,t)}finally{i=s}return n}disconnect(){this.dispose()}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,n=r(e),o=null===s?this.first:{};if(o.propertySource=e,o.propertyName=t,o.notifier=n,n.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;i=void 0,t=s.propertySource[s.propertyName],i=this,e===t&&(this.needsRefresh=!0)}s.next=o}this.last=o}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){n=e},getNotifier:r,track(e,t){i&&i.watch(e,t)},trackVolatile(){i&&(i.needsRefresh=!0)},notify(e,t){r(e).notify(t)},defineProperty(e,t){u(t)&&(t=new a(t)),o(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:o,binding(e,t,s=this.isVolatileBinding(e)){return new h(e,t,s)},isVolatileBinding:e=>t.test(e.toString())})}));function y(e,t){v.defineProperty(e,t)}function m(e,t,s){return Object.assign({},s,{get(){return v.trackVolatile(),s.get.apply(this)}})}const w=l.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}})),C=Object.freeze({default:{index:0,length:0,get event(){return C.getEvent()},eventDetail(){return this.event.detail},eventTarget(){return this.event.target}},getEvent:()=>w.get(),setEvent(e){w.set(e)}});class x{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const T=Object.freeze({reset:1,splice:2,optimized:3}),S=new x(0,a,0);S.reset=!0;const O=[S];function A(e,t,s,i,n,r){let o=0,l=0;const h=Math.min(s-t,r-n);if(0===t&&0===n&&(o=function(e,t,s){for(let i=0;i<s;++i)if(e[i]!==t[i])return i;return s}(e,i,h)),s===e.length&&r===i.length&&(l=function(e,t,s){let i=e.length,n=t.length,r=0;for(;r<s&&e[--i]===t[--n];)r++;return r}(e,i,h-o)),n+=o,r-=l,(s-=l)-(t+=o)==0&&r-n==0)return a;if(t===s){const e=new x(t,[],0);for(;n<r;)e.removed.push(i[n++]);return[e]}if(n===r)return[new x(t,[],s-t)];const c=function(e){let t=e.length-1,s=e[0].length-1,i=e[t][s];const n=[];for(;t>0||s>0;){if(0===t){n.push(2),s--;continue}if(0===s){n.push(3),t--;continue}const r=e[t-1][s-1],o=e[t-1][s],l=e[t][s-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===i?n.push(0):(n.push(1),i=r),t--,s--):a===o?(n.push(3),t--,i=o):(n.push(2),s--,i=l)}return n.reverse()}(function(e,t,s,i,n,r){const o=r-n+1,l=s-t+1,a=new Array(o);let h,c;for(let e=0;e<o;++e)a[e]=new Array(l),a[e][0]=e;for(let e=0;e<l;++e)a[0][e]=e;for(let s=1;s<o;++s)for(let r=1;r<l;++r)e[t+r-1]===i[n+s-1]?a[s][r]=a[s-1][r-1]:(h=a[s-1][r]+1,c=a[s][r-1]+1,a[s][r]=h<c?h:c);return a}(e,t,s,i,n,r)),d=[];let u,f=t,p=n;for(let e=0;e<c.length;++e)switch(c[e]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,p++;break;case 1:void 0===u&&(u=new x(f,[],0)),u.addedCount++,f++,u.removed.push(i[p]),p++;break;case 2:void 0===u&&(u=new x(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=new x(f,[],0)),u.removed.push(i[p]),p++}return void 0!==u&&d.push(u),d}function B(e,t){let s=!1,i=0;for(let a=0;a<t.length;a++){const h=t[a];if(h.index+=i,s)continue;const c=(n=e.index,r=e.index+e.removed.length,o=h.index,l=h.index+h.addedCount,r<o||l<n?-1:r===o||l===n?0:n<o?r<l?r-o:l-o:l<r?l-n:r-n);if(c>=0){t.splice(a,1),a--,i-=h.addedCount-h.removed.length,e.addedCount+=h.addedCount-c;const n=e.removed.length+h.removed.length-c;if(e.addedCount||n){let t=h.removed;if(e.index<h.index){const s=e.removed.slice(0,h.index-e.index);s.push(...t),t=s}if(e.index+e.removed.length>h.index+h.addedCount){const s=e.removed.slice(h.index+h.addedCount-e.index);t.push(...s)}e.removed=t,h.index<e.index&&(e.index=h.index)}else s=!0}else if(e.index<h.index){s=!0,t.splice(a,0,e),a++;const n=e.addedCount-e.removed.length;h.index+=n,i+=n}}var n,r,o,l;s||t.push(e)}let k=Object.freeze({support:T.optimized,normalize:(e,t,s)=>void 0===e?void 0===s?a:s.length>1?function(e,t){let s=[];const i=[];for(let e=0,s=t.length;e<s;e++)B(t[e],i);for(let t=0,n=i.length;t<n;++t){const n=i[t];1!==n.addedCount||1!==n.removed.length?s=s.concat(A(e,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==e[n.index]&&s.push(n)}return s}(t,s):s:O,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new x(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new x(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(0,[],i.length).adjustTo(e)),n}});const j=Object.freeze({reset:O,setDefaultStrategy(e){k=e}});function $(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class I extends p{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,$(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,v.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:k).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,f.enqueue(this))}}let V=!1;const E=Object.freeze({enable(){if(V)return;V=!0,v.setArrayObserverFactory((e=>new I(e)));const e=Array.prototype;e.$fastPatch||($(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:k)[t.name](this,i,t,e)}})))}});function N(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(E.enable(),t=v.getNotifier(e)),v.track(t.lengthObserver,"length"),e.length}let M;function F(e){return e.map((e=>e instanceof L?F(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class L{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof L?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(M),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e(F(this.styles)),this}static setDefaultStrategy(e){M=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new L(e):e instanceof L?e:new L([e])}}L.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;const z=h(),_=Object.freeze({getForInstance:z.getForInstance,getByType:z.getByType,define:e=>(z.register({type:e}),e)});function P(){return function(e){_.define(e)}}function R(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==_.getForInstance(o)&&(o=o.createCSS(r)),o instanceof L||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const D=(e,...t)=>{const{styles:s,behaviors:i}=R(e,t),n=new L(s);return i.length?n.withBehaviors(...i):n};class H{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(u(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new L(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}addedCallback(e){e.addStyles(this.styles)}removedCallback(e){e.removeStyles(this.styles)}}_.define(H);const U=D.partial=(e,...t)=>{const{styles:s,behaviors:i}=R(e,t);return new H(s,i)},q=Object.freeze({queueUpdate:f.enqueue,nextUpdate:f.next,processUpdates:f.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),Q=`fast-${Math.random().toString(36).substring(2,8)}`,W=`${Q}{`,K=`}${Q}`,G=K.length;let J=0;const X=()=>`${Q}-${++J}`,Y=Object.freeze({interpolation:e=>`${W}${e}${K}`,attribute:e=>`${X()}="${W}${e}${K}"`,comment:e=>`\x3c!--${W}${e}${K}--\x3e`}),Z=Object.freeze({parse(e,t){const s=e.split(W);if(1===s.length)return null;const i=[];for(let e=0,n=s.length;e<n;++e){const n=s[e],r=n.indexOf(K);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+G)}""!==o&&i.push(o)}return i}}),ee=Object.freeze({create(e){const t=[],s={};let i=null,n=!1;return{source:e,context:C.default,targets:s,get isBound(){return n},addBehaviorFactory(e,t){const s=e.nodeId||(e.nodeId=X());e.id||(e.id=X()),this.addTarget(s,t),this.addBehavior(e.createBehavior())},addTarget(e,t){s[e]=t},addBehavior(e){t.push(e),n&&e.bind(this)},onUnbind(e){null===i&&(i=[]),i.push(e)},connectedCallback(e){n||(n=!0,t.forEach((e=>e.bind(this))))},disconnectedCallback(e){n&&(n=!1,null!==i&&i.forEach((e=>e.unbind(this))))}}}}),te=h(),se=Object.freeze({getForInstance:te.getForInstance,getByType:te.getByType,define:(e,t)=>((t=t||{}).type=e,te.register(t),e)});function ie(e){return function(t){se.define(t,e)}}class ne{constructor(e,t=!1){this.evaluate=e,this.isVolatile=t}}const re=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":e.targetAspect=t.substring(1),e.aspectType="classList"===e.targetAspect?re.tokenList:re.property;break;case"?":e.targetAspect=t.substring(1),e.aspectType=re.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=re.event;break;default:e.targetAspect=t,e.aspectType=re.attribute}else e.aspectType=re.content}});class oe{constructor(e){this.options=e,this.id=X()}createHTML(e){return Y.attribute(e(this))}createBehavior(){return this}}const le=globalThis.TrustedHTML?e=>(t,s)=>{const i=e(t,s);if(i instanceof TrustedHTML)return i;throw l.error(1202)}:e=>e;class ae extends ne{createObserver(e,t){return v.binding(this.evaluate,t,this.isVolatile)}}class he extends ne{createObserver(){return this}bind(e){return this.evaluate(e.source,e.context)}}function ce(e,t,s,i){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i.source,i.context)):(t.isComposed=!0,t.bind(i.source,i.context),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function de(e,t,s){var i;const n=`${this.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={v:0,cv:Object.create(null)},o=r.cv;let l=r.v;const a=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,a.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&a.remove(e)}}const ue=(e,t,s)=>e[t]=s,fe=()=>{};class pe{constructor(e){this.dataBinding=e,this.updateTarget=null,this.id=X(),this.aspectType=re.content,this.data=`${this.id}-d`}createHTML(e){return Y.interpolation(e(this))}createBehavior(){if(null===this.updateTarget)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=le(this.dataBinding.evaluate)),this.aspectType){case 1:this.updateTarget=q.setAttribute;break;case 2:this.updateTarget=q.setBooleanAttribute;break;case 3:this.updateTarget=ue;break;case 4:this.updateTarget=ce;break;case 5:this.updateTarget=de;break;case 6:this.updateTarget=fe;break;default:throw l.error(1205)}return this}bind(e){var t;const s=e.targets[this.nodeId];switch(this.updateTarget){case fe:s[this.data]=e,s.addEventListener(this.targetAspect,this,this.dataBinding.options);break;case ce:e.onUnbind(this);default:const i=null!==(t=s[this.data])&&void 0!==t?t:s[this.data]=this.dataBinding.createObserver(this,this);i.target=s,i.controller=e,this.updateTarget(s,this.targetAspect,i.bind(e),e)}}unbind(e){const t=e.targets[this.nodeId].$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}handleEvent(e){const t=e.currentTarget[this.data];if(t.isBound){C.setEvent(e);const s=this.dataBinding.evaluate(t.source,t.context);C.setEvent(null),!0!==s&&e.preventDefault()}}handleChange(e,t){const s=t.target,i=t.controller;this.updateTarget(s,this.targetAspect,t.bind(i),i)}}function ge(e,t=v.isVolatileBinding(e)){return new ae(e,t)}function be(e){return new he(e)}function ve(e,t){const s=new ae(e,!1);return s.options=t,s}function ye(e){return d(e)?ge(e):e instanceof ne?e:be((()=>e))}function me(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}se.define(pe,{aspected:!0});class we{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.unbindables=[],this.source=null,this.isBound=!1,this.sourceLifetime=b.unknown,this.context=this,this.index=0,this.length=0,this.firstChild=e.firstChild,this.lastChild=e.lastChild}get event(){return C.getEvent()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=this.lastChild;if(e.previousSibling===t)return;const s=e.parentNode;let i,n=this.firstChild;for(;n!==t;)i=n.nextSibling,s.insertBefore(n,e),n=i;s.insertBefore(t,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){me(this.firstChild,this.lastChild),this.unbind()}onUnbind(e){this.unbindables.push(e)}bind(e,t=this){if(this.source===e)return;let s=this.behaviors;if(null===s){this.source=e,this.context=t,this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let e=0,t=i.length;e<t;++e){const t=i[e].createBehavior();t.bind(this),s[e]=t}}else{null!==this.source&&this.evaluateUnbindables(),this.isBound=!1,this.source=e,this.context=t;for(let e=0,t=s.length;e<t;++e)s[e].bind(this)}this.isBound=!0}unbind(){this.isBound&&null!==this.source&&(this.evaluateUnbindables(),this.source=null,this.context=this,this.isBound=!1)}evaluateUnbindables(){const e=this.unbindables;for(let t=0,s=e.length;t<s;++t)e[t].unbind(this);e.length=0}static disposeContiguousBatch(e){if(0!==e.length){me(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}v.defineProperty(we.prototype,"index"),v.defineProperty(we.prototype,"length");const Ce=(e,t)=>`${e}.${t}`,xe={},Te={index:0,node:null};function Se(e){e.startsWith("fast-")||l.warn(1204,{name:e})}const Oe=new Proxy(document.createElement("div"),{get(e,t){Se(t);const s=Reflect.get(e,t);return d(s)?s.bind(e):s},set:(e,t,s)=>(Se(t),Reflect.set(e,t,s))});class Ae{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=xe[t];if(!n){const i=`_${t}`;xe[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:Oe;for(const e of this.nodeIds)s[e];return new we(t,this.factories,s)}}function Be(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let a=0,h=o.length;a<h;++a){const c=o[a],d=c.value,u=Z.parse(d,l);let f=null;null===u?r&&(f=new pe(be((()=>d))),re.assign(f,c.name)):f=Ee.aggregate(u),null!==f&&(s.removeAttributeNode(c),a--,h--,e.addFactory(f,t,i,n))}}function ke(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=je(e,s,n,i);n=t.node,i=t.index}}function je(e,t,s,i){const n=Ce(t,i);switch(s.nodeType){case 1:Be(e,t,s,n,i),ke(e,s,n);break;case 3:return function(e,t,s,i,n){const r=Z.parse(t.textContent,e.directives);if(null===r)return Te.node=t.nextSibling,Te.index=n+1,Te;let o,l=o=t;for(let t=0,a=r.length;t<a;++t){const a=r[t];0!==t&&(n++,i=Ce(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),u(a)?o.textContent=a:(o.textContent=" ",re.assign(a),e.addFactory(a,s,i,n)),l=o}return Te.index=n+1,Te.node=l.nextSibling,Te}(e,s,t,n,i);case 8:const r=Z.parse(s.data,e.directives);null!==r&&e.addFactory(Ee.aggregate(r),t,n,i)}return Te.index=i+1,Te.node=s.nextSibling,Te}const $e={createHTML:e=>e};let Ie=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",$e):$e;const Ve=Ie,Ee={setHTMLPolicy(e){if(Ie!==Ve)throw l.error(1201);Ie=e},compile(e,t){let s;if(u(e)){s=document.createElement("TEMPLATE"),s.innerHTML=Ie.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new Ae(i,t);return Be(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==Z.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),ke(n,i,"r"),Te.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>u(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const o=new pe(s);return re.assign(o,t),o}};class Ne{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=Ee.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s){const i=this.create(s);return i.bind(e),i.appendTo(t),i}}const Me=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Fe(e,t,s){const i=Me.exec(t);return null!==i&&re.assign(e,i[2]),e.createHTML(s)}function Le(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=X();return i[s]=e,s};for(let i=0,r=e.length-1;i<r;++i){const r=e[i],o=t[i];let l;if(s+=r,d(o))s+=Fe(new pe(ge(o)),r,n);else if(u(o)){const e=Me.exec(r);if(null!==e){const t=new pe(be((()=>o)));re.assign(t,e[2]),s+=t.createHTML(n)}else s+=o}else o instanceof ne?s+=Fe(new pe(o),r,n):void 0===(l=se.getForInstance(o))?s+=Fe(new pe(be((()=>o))),r,n):l.aspected?s+=Fe(o,r,n):s+=o.createHTML(n)}return new Ne(s+e[e.length-1],i)}class ze extends oe{bind(e){e.source[this.options]=e.targets[this.nodeId]}}se.define(ze);const _e=e=>new ze(e);function Pe(e,t){const s=d(e)?e:()=>e,i=d(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const Re=Object.freeze({positioning:!1,recycle:!0});function De(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.bind(t[s])}function He(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.context.length=t.length,e.context.index=s,e.bind(t[s])}class Ue{constructor(e){this.directive=e,this.items=null,this.itemsObserver=null,this.bindView=De,this.views=[],this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=He)}bind(e){this.location=e.targets[this.directive.nodeId],this.controller=e,this.items=this.itemsBindingObserver.bind(e),this.template=this.templateBindingObserver.bind(e),this.observeItems(!0),this.refreshAllViews(),e.onUnbind(this)}unbind(){null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else{if(!t[0])return;t[0].reset?this.refreshAllViews():this.updateViews(t)}}observeItems(e=!1){if(!this.items)return void(this.items=a);const t=this.itemsObserver,s=this.itemsObserver=v.getNotifier(this.items),i=t!==s;i&&null!==t&&t.unsubscribe(this),(i||e)&&s.subscribe(this)}updateViews(e){const t=this.views,s=this.bindView,i=this.items,n=this.template,r=this.controller,o=this.directive.options.recycle,l=[];let a=0,h=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,p=d.index;const g=p+d.addedCount,b=t.splice(d.index,u.length),v=h=l.length+b.length;for(;p<g;++p){const e=t[p],c=e?e.firstChild:this.location;let d;o&&h>0?(f<=v&&b.length>0?(d=b[f],f++):(d=l[a],a++),h--):d=n.create(),t.splice(p,0,d),s(d,i,p,r),d.insertBefore(c)}b[f]&&l.push(...b.slice(f))}for(let e=a,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e){const i=t[e].context;i.length=s,i.index=e}}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.controller;let o=t.length,l=this.views,a=l.length;if(0!==o&&!e&&this.directive.options.recycle||(we.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<a){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const h=l.splice(e,a-e);for(e=0,o=h.length;e<o;++e)h[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class qe{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=X(),E.enable()}createHTML(e){return Y.comment(e(this))}createBehavior(){return new Ue(this)}}function Qe(e,t,s=Re){const i=ye(e),n=ye(t);return new qe(i,n,Object.assign(Object.assign({},Re),s))}se.define(qe);const We=e=>1===e.nodeType,Ke=e=>e?t=>1===t.nodeType&&t.matches(e):We;class Ge extends oe{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e){const t=e.targets[this.nodeId];t[this.sourceProperty]=e.source,this.updateTarget(e.source,this.computeNodes(t)),this.observe(t),e.onUnbind(this)}unbind(e){const t=e.targets[this.nodeId];this.updateTarget(e.source,a),this.disconnect(t),t[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class Je extends Ge{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function Xe(e){return u(e)&&(e={property:e}),new Je(e)}se.define(Je);class Ye extends Ge{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function Ze(e){return u(e)&&(e={property:e}),new Ye(e)}se.define(Ye);const et=Object.freeze({locate:c()}),tt={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function st(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const it={toView(e){const t=st(e);return t?t.toString():t},fromView:st};class nt{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=tt)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return v.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||f.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;q.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":q.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(et.locate(e));for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];u(i)?s.push(new nt(e,i)):s.push(new nt(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function rt(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t),et.locate(e.constructor).push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const ot={mode:"open"},lt={},at=new Set,ht=l.getById(4,(()=>h()));class ct{constructor(e,t=e.definition){var s;this.platformDefined=!1,u(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template,this.registry=null!==(s=t.registry)&&void 0!==s?s:customElements;const i=e.prototype,n=nt.collect(e,t.attributes),r=new Array(n.length),o={},l={};for(let e=0,t=n.length;e<t;++e){const t=n[e];r[e]=t.attribute,o[t.name]=t,l[t.attribute]=t,v.defineProperty(i,t)}Reflect.defineProperty(e,"observedAttributes",{value:r,enumerable:!0}),this.attributes=n,this.propertyLookup=o,this.attributeLookup=l,this.shadowOptions=void 0===t.shadowOptions?ot:null===t.shadowOptions?void 0:Object.assign(Object.assign({},ot),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?lt:Object.assign(Object.assign({},lt),t.elementOptions),this.styles=L.normalize(t.styles),ht.register(this)}get isDefined(){return this.platformDefined}define(e=this.registry){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){return at.has(e)||ht.getByType(e)?new ct(class extends e{},t):new ct(e,t)}static registerBaseType(e){at.add(e)}}ct.getByType=ht.getByType,ct.getForInstance=ht.getForInstance;const dt={bubbles:!0,composed:!0,cancelable:!0},ut=new WeakMap;function ft(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:ut.get(e))&&void 0!==s?s:null}class pt extends g{constructor(e,t){super(e),this.boundObservables=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._isConnected=!1,this.behaviors=null,this._mainStyles=null,this.$fastController=this,this.view=null,this.source=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&ut.set(e,t))}const i=v.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return v.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,v.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.source.resolveTemplate?this._template=this.source.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get mainStyles(){var e;if(null===this._mainStyles){const t=this.definition;this.source.resolveStyles?this._mainStyles=this.source.resolveStyles():t.styles&&(this._mainStyles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._mainStyles}set mainStyles(e){this._mainStyles!==e&&(null!==this._mainStyles&&this.removeStyles(this._mainStyles),this._mainStyles=e,this.needsInitialization||this.addStyles(e))}addBehavior(e){var t,s;const i=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,n=null!==(s=i.get(e))&&void 0!==s?s:0;0===n?(i.set(e,1),e.addedCallback&&e.addedCallback(this),e.connectedCallback&&this.isConnected&&e.connectedCallback(this)):i.set(e,n+1)}removeBehavior(e,t=!1){const s=this.behaviors;if(null===s)return;const i=s.get(e);void 0!==i&&(1===i||t?(s.delete(e),e.disconnectedCallback&&this.isConnected&&e.disconnectedCallback(this),e.removedCallback&&e.removedCallback(this)):s.set(e,i-1))}addStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=ft(s))&&void 0!==t?t:this.source).append(e)}else if(!e.isAttachedTo(s)){const t=e.behaviors;if(e.addStylesTo(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}removeStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=ft(s))&&void 0!==t?t:s).removeChild(e)}else if(e.isAttachedTo(s)){const t=e.behaviors;if(e.removeStylesFrom(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}connect(){if(this._isConnected)return;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(this.source);const e=this.behaviors;if(null!==e)for(const t of e.keys())t.connectedCallback&&t.connectedCallback(this);this.setIsConnected(!0)}disconnect(){if(!this._isConnected)return;this.setIsConnected(!1),null!==this.view&&this.view.unbind();const e=this.behaviors;if(null!==e)for(const t of e.keys())t.disconnectedCallback&&t.disconnectedCallback(this)}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.source,s)}emit(e,t,s){return!!this._isConnected&&this.source.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},dt),s)))}finishInitialization(){const e=this.source,t=this.boundObservables;if(null!==t){const s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.mainStyles),this.needsInitialization=!1}renderTemplate(e){var t;const s=this.source,i=null!==(t=ft(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s),this.view.sourceLifetime=b.coupled)}static forCustomElement(e){const t=e.$fastController;if(void 0!==t)return t;const s=ct.getForInstance(e);if(void 0===s)throw l.error(1401);return e.$fastController=new pt(e,s)}}function gt(e){var t;return"adoptedStyleSheets"in e?e:null!==(t=ft(e))&&void 0!==t?t:e.getRootNode()}class bt{constructor(e){const t=bt.styleSheetCache;this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let s=t.get(e);return void 0===s&&(s=new CSSStyleSheet,s.replaceSync(e),t.set(e,s)),s}))}addStylesTo(e){const t=gt(e);t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=gt(e),s=this.sheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter((e=>-1===s.indexOf(e)))}}bt.styleSheetCache=new Map;let vt=0;function yt(e){return e===document?document.body:e}function mt(e){const t=class extends e{constructor(){super(),pt.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.connect()}disconnectedCallback(){this.$fastController.disconnect()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}};return ct.registerBaseType(t),t}function wt(e,t){return d(e)?ct.compose(e,t).define().type:ct.compose(this,e).define().type}L.setDefaultStrategy(L.supportsAdoptedStyleSheets?bt:class{constructor(e){this.styles=e,this.styleClass="fast-"+ ++vt}addStylesTo(e){e=yt(gt(e));const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=(e=yt(gt(e))).querySelectorAll(`.${this.styleClass}`);t[0].parentNode;for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}});const Ct=Object.assign(mt(HTMLElement),{from:function(e){return mt(e)},define:wt,compose:function(e,t){return d(e)?ct.compose(e,t):ct.compose(this,e)}});function xt(e){return function(t){wt(t,e)}}export{E as ArrayObserver,re as Aspect,et as AttributeConfiguration,nt as AttributeDefinition,ne as Binding,_ as CSSDirective,Ye as ChildrenDirective,Ee as Compiler,q as DOM,pt as ElementController,L as ElementStyles,C as ExecutionContext,l as FAST,Ct as FASTElement,ct as FASTElementDefinition,pe as HTMLBindingDirective,se as HTMLDirective,we as HTMLView,Y as Markup,Ge as NodeObservationDirective,v as Observable,Z as Parser,g as PropertyChangeNotifier,ze as RefDirective,Ue as RepeatBehavior,qe as RepeatDirective,Je as SlottedDirective,b as SourceLifetime,x as Splice,j as SpliceStrategy,T as SpliceStrategySupport,oe as StatelessAttachedAttributeDirective,p as SubscriberSet,f as Updates,ee as ViewBehaviorOrchestrator,Ne as ViewTemplate,rt as attr,ge as bind,tt as booleanConverter,Ze as children,c as createMetadataLocator,h as createTypeRegistry,D as css,P as cssDirective,U as cssPartial,xt as customElement,Ke as elements,a as emptyArray,Le as html,ie as htmlDirective,N as lengthOf,ve as listener,ye as normalizeBinding,it as nullableNumberConverter,y as observable,be as oneTime,_e as ref,Qe as repeat,Xe as slotted,m as volatile,Pe as when}; | ||
!function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t}),void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",{value:Object.create(null),configurable:!1,enumerable:!1,writable:!1});const e=globalThis.FAST,t={1101:"Must call enableArrayObservation before observing arrays.",1201:"The HTML policy can only be set once.",1202:"To bind innerHTML, you must use a TrustedTypesPolicy.",1203:"View=>Model update skipped. To use twoWay binding, the target property must be observable.",1204:"No host element is present. Cannot bind host with ${name}.",1205:"The requested binding behavior is not supported by the binding engine.",1401:"Missing FASTElement definition.",1501:"No registration for Context/Interface '${name}'.",1502:"Dependency injection resolver for '${key}' returned a null factory.",1503:"Invalid dependency injection resolver strategy specified '${strategy}'.",1504:"Unable to autoregister dependency.",1505:"Unable to resolve dependency injection key '${key}'.",1506:"'${name}' is a native function and therefore cannot be safely constructed by DI. If this is intentional, please use a callback or cachedCallback resolver.",1507:"Attempted to jitRegister something that is not a constructor '${value}'. Did you forget to register this dependency?",1508:"Attempted to jitRegister an intrinsic type '${value}'. Did you forget to add @inject(Key)?",1509:"Attempted to jitRegister an interface '${value}'.",1510:"A valid resolver was not returned from the register method.",1511:"Key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?",1512:"'${key}' not registered. Did you forget to add @singleton()?",1513:"Cyclic dependency found '${name}'.",1514:"Injected properties that are updated on changes to DOM connectivity require the target object to be an instance of FASTElement."},s=/(\$\{\w+?})/g,i=/\$\{(\w+?)}/g,n=Object.freeze({});function r(e,t){return e.split(s).map((e=>{var s;const n=e.replace(i,"$1");return String(null!==(s=t[n])&&void 0!==s?s:e)})).join("")}Object.assign(e,{addMessages(e){Object.assign(t,e)},warn(e,s=n){var i;const o=null!==(i=t[e])&&void 0!==i?i:"Unknown Warning";console.warn(r(o,s))},error(e,s=n){var i;const o=null!==(i=t[e])&&void 0!==i?i:"Unknown Error";return new Error(r(o,s))}});const o={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},o));const l=globalThis.FAST;if(void 0===l.getById){const e=Object.create(null);Reflect.defineProperty(l,"getById",Object.assign({value(t,s){let i=e[t];return void 0===i&&(i=s?e[t]=s():null),i}},o))}void 0===l.error&&Object.assign(l,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const a=Object.freeze([]);function h(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance(t){if(null!=t)return e.get(t.constructor)}})}function c(){const e=new WeakMap;return function(t){let s=e.get(t);if(void 0===s){let i=Reflect.getPrototypeOf(t);for(;void 0===s&&null!==i;)s=e.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),e.set(t,s)}return s}}const d=e=>"function"==typeof e,u=e=>"string"==typeof e,f=l.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class p{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class g{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new p(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new p(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const b=Object.freeze({unknown:void 0,coupled:1}),v=l.getById(2,(()=>{const e=f.enqueue,t=/(:|&&|\|\||if)/,s=new WeakMap;let i,n=e=>{throw l.error(1101)};function r(e){var t;let i=null!==(t=e.$fastController)&&void 0!==t?t:s.get(e);return void 0===i&&(Array.isArray(e)?i=n(e):s.set(e,i=new g(e))),i}const o=c();class a{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==i&&i.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];d(n)&&n.call(e,i,t),r(e).notify(this.name)}}}class h extends p{constructor(e,t,s=!1){super(e,t),this.expression=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}bind(e){this.controller=e;const t=this.observe(e.source,e.context);return!e.isBound&&this.requiresUnbind(e)&&e.onUnbind(this),t}requiresUnbind(e){return e.sourceLifetime!==b.coupled||this.first!==this.last||this.first.propertySource!==e.source}unbind(e){this.dispose()}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=i;let n;i=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;try{n=this.expression(e,t)}finally{i=s}return n}disconnect(){this.dispose()}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,n=r(e),o=null===s?this.first:{};if(o.propertySource=e,o.propertyName=t,o.notifier=n,n.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;i=void 0,t=s.propertySource[s.propertyName],i=this,e===t&&(this.needsRefresh=!0)}s.next=o}this.last=o}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){n=e},getNotifier:r,track(e,t){i&&i.watch(e,t)},trackVolatile(){i&&(i.needsRefresh=!0)},notify(e,t){r(e).notify(t)},defineProperty(e,t){u(t)&&(t=new a(t)),o(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:o,binding(e,t,s=this.isVolatileBinding(e)){return new h(e,t,s)},isVolatileBinding:e=>t.test(e.toString())})}));function y(e,t){v.defineProperty(e,t)}function m(e,t,s){return Object.assign({},s,{get(){return v.trackVolatile(),s.get.apply(this)}})}const w=l.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}})),C=Object.freeze({default:{index:0,length:0,get event(){return C.getEvent()},eventDetail(){return this.event.detail},eventTarget(){return this.event.target}},getEvent:()=>w.get(),setEvent(e){w.set(e)}});class x{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const T=Object.freeze({reset:1,splice:2,optimized:3}),S=new x(0,a,0);S.reset=!0;const O=[S];function A(e,t,s,i,n,r){let o=0,l=0;const h=Math.min(s-t,r-n);if(0===t&&0===n&&(o=function(e,t,s){for(let i=0;i<s;++i)if(e[i]!==t[i])return i;return s}(e,i,h)),s===e.length&&r===i.length&&(l=function(e,t,s){let i=e.length,n=t.length,r=0;for(;r<s&&e[--i]===t[--n];)r++;return r}(e,i,h-o)),n+=o,r-=l,(s-=l)-(t+=o)==0&&r-n==0)return a;if(t===s){const e=new x(t,[],0);for(;n<r;)e.removed.push(i[n++]);return[e]}if(n===r)return[new x(t,[],s-t)];const c=function(e){let t=e.length-1,s=e[0].length-1,i=e[t][s];const n=[];for(;t>0||s>0;){if(0===t){n.push(2),s--;continue}if(0===s){n.push(3),t--;continue}const r=e[t-1][s-1],o=e[t-1][s],l=e[t][s-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===i?n.push(0):(n.push(1),i=r),t--,s--):a===o?(n.push(3),t--,i=o):(n.push(2),s--,i=l)}return n.reverse()}(function(e,t,s,i,n,r){const o=r-n+1,l=s-t+1,a=new Array(o);let h,c;for(let e=0;e<o;++e)a[e]=new Array(l),a[e][0]=e;for(let e=0;e<l;++e)a[0][e]=e;for(let s=1;s<o;++s)for(let r=1;r<l;++r)e[t+r-1]===i[n+s-1]?a[s][r]=a[s-1][r-1]:(h=a[s-1][r]+1,c=a[s][r-1]+1,a[s][r]=h<c?h:c);return a}(e,t,s,i,n,r)),d=[];let u,f=t,p=n;for(let e=0;e<c.length;++e)switch(c[e]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,p++;break;case 1:void 0===u&&(u=new x(f,[],0)),u.addedCount++,f++,u.removed.push(i[p]),p++;break;case 2:void 0===u&&(u=new x(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=new x(f,[],0)),u.removed.push(i[p]),p++}return void 0!==u&&d.push(u),d}function B(e,t){let s=!1,i=0;for(let a=0;a<t.length;a++){const h=t[a];if(h.index+=i,s)continue;const c=(n=e.index,r=e.index+e.removed.length,o=h.index,l=h.index+h.addedCount,r<o||l<n?-1:r===o||l===n?0:n<o?r<l?r-o:l-o:l<r?l-n:r-n);if(c>=0){t.splice(a,1),a--,i-=h.addedCount-h.removed.length,e.addedCount+=h.addedCount-c;const n=e.removed.length+h.removed.length-c;if(e.addedCount||n){let t=h.removed;if(e.index<h.index){const s=e.removed.slice(0,h.index-e.index);s.push(...t),t=s}if(e.index+e.removed.length>h.index+h.addedCount){const s=e.removed.slice(h.index+h.addedCount-e.index);t.push(...s)}e.removed=t,h.index<e.index&&(e.index=h.index)}else s=!0}else if(e.index<h.index){s=!0,t.splice(a,0,e),a++;const n=e.addedCount-e.removed.length;h.index+=n,i+=n}}var n,r,o,l;s||t.push(e)}let k=Object.freeze({support:T.optimized,normalize:(e,t,s)=>void 0===e?void 0===s?a:s.length>1?function(e,t){let s=[];const i=[];for(let e=0,s=t.length;e<s;e++)B(t[e],i);for(let t=0,n=i.length;t<n;++t){const n=i[t];1!==n.addedCount||1!==n.removed.length?s=s.concat(A(e,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==e[n.index]&&s.push(n)}return s}(t,s):s:O,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new x(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new x(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new x(0,[],i.length).adjustTo(e)),n}});const j=Object.freeze({reset:O,setDefaultStrategy(e){k=e}});function $(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class I extends p{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,$(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,v.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:k).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,f.enqueue(this))}}let V=!1;const E=Object.freeze({enable(){if(V)return;V=!0,v.setArrayObserverFactory((e=>new I(e)));const e=Array.prototype;e.$fastPatch||($(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:k)[t.name](this,i,t,e)}})))}});function N(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(E.enable(),t=v.getNotifier(e)),v.track(t.lengthObserver,"length"),e.length}let M;function F(e){return e.map((e=>e instanceof L?F(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class L{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof L?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(M),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e(F(this.styles)),this}static setDefaultStrategy(e){M=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new L(e):e instanceof L?e:new L([e])}}L.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;const _=h(),z=Object.freeze({getForInstance:_.getForInstance,getByType:_.getByType,define:e=>(_.register({type:e}),e)});function P(){return function(e){z.define(e)}}function R(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==z.getForInstance(o)&&(o=o.createCSS(r)),o instanceof L||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const D=(e,...t)=>{const{styles:s,behaviors:i}=R(e,t),n=new L(s);return i.length?n.withBehaviors(...i):n};class H{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(u(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new L(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}addedCallback(e){e.addStyles(this.styles)}removedCallback(e){e.removeStyles(this.styles)}}z.define(H);const U=D.partial=(e,...t)=>{const{styles:s,behaviors:i}=R(e,t);return new H(s,i)},q=Object.freeze({queueUpdate:f.enqueue,nextUpdate:f.next,processUpdates:f.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),Q=`fast-${Math.random().toString(36).substring(2,8)}`,W=`${Q}{`,K=`}${Q}`,G=K.length;let J=0;const X=()=>`${Q}-${++J}`,Y=Object.freeze({interpolation:e=>`${W}${e}${K}`,attribute:e=>`${X()}="${W}${e}${K}"`,comment:e=>`\x3c!--${W}${e}${K}--\x3e`}),Z=Object.freeze({parse(e,t){const s=e.split(W);if(1===s.length)return null;const i=[];for(let e=0,n=s.length;e<n;++e){const n=s[e],r=n.indexOf(K);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+G)}""!==o&&i.push(o)}return i}}),ee=Object.freeze({create(e){const t=[],s={};let i=null,n=!1;return{source:e,context:C.default,targets:s,get isBound(){return n},addBehaviorFactory(e,t){const s=e.nodeId||(e.nodeId=X());e.id||(e.id=X()),this.addTarget(s,t),this.addBehavior(e.createBehavior())},addTarget(e,t){s[e]=t},addBehavior(e){t.push(e),n&&e.bind(this)},onUnbind(e){null===i&&(i=[]),i.push(e)},connectedCallback(e){n||(n=!0,t.forEach((e=>e.bind(this))))},disconnectedCallback(e){n&&(n=!1,null!==i&&i.forEach((e=>e.unbind(this))))}}}}),te=h(),se=Object.freeze({getForInstance:te.getForInstance,getByType:te.getByType,define:(e,t)=>((t=t||{}).type=e,te.register(t),e)});function ie(e){return function(t){se.define(t,e)}}class ne{constructor(e,t=!1){this.evaluate=e,this.isVolatile=t}}const re=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":e.targetAspect=t.substring(1),e.aspectType="classList"===e.targetAspect?re.tokenList:re.property;break;case"?":e.targetAspect=t.substring(1),e.aspectType=re.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=re.event;break;default:e.targetAspect=t,e.aspectType=re.attribute}else e.aspectType=re.content}});class oe{constructor(e){this.options=e,this.id=X()}createHTML(e){return Y.attribute(e(this))}createBehavior(){return this}}const le=globalThis.TrustedHTML?e=>(t,s)=>{const i=e(t,s);if(i instanceof TrustedHTML)return i;throw l.error(1202)}:e=>e;class ae extends ne{createObserver(e,t){return v.binding(this.evaluate,t,this.isVolatile)}}class he extends ne{createObserver(){return this}bind(e){return this.evaluate(e.source,e.context)}}function ce(e,t,s,i){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i.source,i.context)):(t.isComposed=!0,t.bind(i.source,i.context),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function de(e,t,s){var i;const n=`${this.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={v:0,cv:Object.create(null)},o=r.cv;let l=r.v;const a=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,a.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&a.remove(e)}}const ue=(e,t,s)=>e[t]=s,fe=()=>{};class pe{constructor(e){this.dataBinding=e,this.updateTarget=null,this.id=X(),this.aspectType=re.content,this.data=`${this.id}-d`}createHTML(e){return Y.interpolation(e(this))}createBehavior(){if(null===this.updateTarget)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=le(this.dataBinding.evaluate)),this.aspectType){case 1:this.updateTarget=q.setAttribute;break;case 2:this.updateTarget=q.setBooleanAttribute;break;case 3:this.updateTarget=ue;break;case 4:this.updateTarget=ce;break;case 5:this.updateTarget=de;break;case 6:this.updateTarget=fe;break;default:throw l.error(1205)}return this}bind(e){var t;const s=e.targets[this.nodeId];switch(this.updateTarget){case fe:s[this.data]=e,s.addEventListener(this.targetAspect,this,this.dataBinding.options);break;case ce:e.onUnbind(this);default:const i=null!==(t=s[this.data])&&void 0!==t?t:s[this.data]=this.dataBinding.createObserver(this,this);i.target=s,i.controller=e,this.updateTarget(s,this.targetAspect,i.bind(e),e)}}unbind(e){const t=e.targets[this.nodeId].$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}handleEvent(e){const t=e.currentTarget[this.data];if(t.isBound){C.setEvent(e);const s=this.dataBinding.evaluate(t.source,t.context);C.setEvent(null),!0!==s&&e.preventDefault()}}handleChange(e,t){const s=t.target,i=t.controller;this.updateTarget(s,this.targetAspect,t.bind(i),i)}}function ge(e,t=v.isVolatileBinding(e)){return new ae(e,t)}function be(e){return new he(e)}function ve(e,t){const s=new ae(e,!1);return s.options=t,s}function ye(e){return d(e)?ge(e):e instanceof ne?e:be((()=>e))}function me(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}se.define(pe,{aspected:!0});class we{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.unbindables=[],this.source=null,this.isBound=!1,this.sourceLifetime=b.unknown,this.context=this,this.index=0,this.length=0,this.firstChild=e.firstChild,this.lastChild=e.lastChild}get event(){return C.getEvent()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=this.lastChild;if(e.previousSibling===t)return;const s=e.parentNode;let i,n=this.firstChild;for(;n!==t;)i=n.nextSibling,s.insertBefore(n,e),n=i;s.insertBefore(t,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){me(this.firstChild,this.lastChild),this.unbind()}onUnbind(e){this.unbindables.push(e)}bind(e,t=this){if(this.source===e)return;let s=this.behaviors;if(null===s){this.source=e,this.context=t,this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let e=0,t=i.length;e<t;++e){const t=i[e].createBehavior();t.bind(this),s[e]=t}}else{null!==this.source&&this.evaluateUnbindables(),this.isBound=!1,this.source=e,this.context=t;for(let e=0,t=s.length;e<t;++e)s[e].bind(this)}this.isBound=!0}unbind(){this.isBound&&null!==this.source&&(this.evaluateUnbindables(),this.source=null,this.context=this,this.isBound=!1)}evaluateUnbindables(){const e=this.unbindables;for(let t=0,s=e.length;t<s;++t)e[t].unbind(this);e.length=0}static disposeContiguousBatch(e){if(0!==e.length){me(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}v.defineProperty(we.prototype,"index"),v.defineProperty(we.prototype,"length");const Ce=(e,t)=>`${e}.${t}`,xe={},Te={index:0,node:null};function Se(e){e.startsWith("fast-")||l.warn(1204,{name:e})}const Oe=new Proxy(document.createElement("div"),{get(e,t){Se(t);const s=Reflect.get(e,t);return d(s)?s.bind(e):s},set:(e,t,s)=>(Se(t),Reflect.set(e,t,s))});class Ae{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=xe[t];if(!n){const i=`_${t}`;xe[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:Oe;for(const e of this.nodeIds)s[e];return new we(t,this.factories,s)}}function Be(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let a=0,h=o.length;a<h;++a){const c=o[a],d=c.value,u=Z.parse(d,l);let f=null;null===u?r&&(f=new pe(be((()=>d))),re.assign(f,c.name)):f=Ee.aggregate(u),null!==f&&(s.removeAttributeNode(c),a--,h--,e.addFactory(f,t,i,n))}}function ke(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=je(e,s,n,i);n=t.node,i=t.index}}function je(e,t,s,i){const n=Ce(t,i);switch(s.nodeType){case 1:Be(e,t,s,n,i),ke(e,s,n);break;case 3:return function(e,t,s,i,n){const r=Z.parse(t.textContent,e.directives);if(null===r)return Te.node=t.nextSibling,Te.index=n+1,Te;let o,l=o=t;for(let t=0,a=r.length;t<a;++t){const a=r[t];0!==t&&(n++,i=Ce(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),u(a)?o.textContent=a:(o.textContent=" ",re.assign(a),e.addFactory(a,s,i,n)),l=o}return Te.index=n+1,Te.node=l.nextSibling,Te}(e,s,t,n,i);case 8:const r=Z.parse(s.data,e.directives);null!==r&&e.addFactory(Ee.aggregate(r),t,n,i)}return Te.index=i+1,Te.node=s.nextSibling,Te}const $e={createHTML:e=>e};let Ie=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",$e):$e;const Ve=Ie,Ee={setHTMLPolicy(e){if(Ie!==Ve)throw l.error(1201);Ie=e},compile(e,t){let s;if(u(e)){s=document.createElement("TEMPLATE"),s.innerHTML=Ie.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new Ae(i,t);return Be(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==Z.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),ke(n,i,"r"),Te.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>u(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const o=new pe(s);return re.assign(o,t),o}};class Ne{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=Ee.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s){const i=this.create(s);return i.bind(e),i.appendTo(t),i}}const Me=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Fe(e,t,s){const i=Me.exec(t);return null!==i&&re.assign(e,i[2]),e.createHTML(s)}function Le(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=X();return i[s]=e,s};for(let i=0,r=e.length-1;i<r;++i){const r=e[i],o=t[i];let l;if(s+=r,d(o))s+=Fe(new pe(ge(o)),r,n);else if(u(o)){const e=Me.exec(r);if(null!==e){const t=new pe(be((()=>o)));re.assign(t,e[2]),s+=t.createHTML(n)}else s+=o}else o instanceof ne?s+=Fe(new pe(o),r,n):void 0===(l=se.getForInstance(o))?s+=Fe(new pe(be((()=>o))),r,n):l.aspected?s+=Fe(o,r,n):s+=o.createHTML(n)}return new Ne(s+e[e.length-1],i)}class _e extends oe{bind(e){e.source[this.options]=e.targets[this.nodeId]}}se.define(_e);const ze=e=>new _e(e);function Pe(e,t){const s=d(e)?e:()=>e,i=d(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const Re=Object.freeze({positioning:!1,recycle:!0});function De(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.bind(t[s])}function He(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.context.length=t.length,e.context.index=s,e.bind(t[s])}class Ue{constructor(e){this.directive=e,this.items=null,this.itemsObserver=null,this.bindView=De,this.views=[],this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=He)}bind(e){this.location=e.targets[this.directive.nodeId],this.controller=e,this.items=this.itemsBindingObserver.bind(e),this.template=this.templateBindingObserver.bind(e),this.observeItems(!0),this.refreshAllViews(),e.onUnbind(this)}unbind(){null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else{if(!t[0])return;t[0].reset?this.refreshAllViews():this.updateViews(t)}}observeItems(e=!1){if(!this.items)return void(this.items=a);const t=this.itemsObserver,s=this.itemsObserver=v.getNotifier(this.items),i=t!==s;i&&null!==t&&t.unsubscribe(this),(i||e)&&s.subscribe(this)}updateViews(e){const t=this.views,s=this.bindView,i=this.items,n=this.template,r=this.controller,o=this.directive.options.recycle,l=[];let a=0,h=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,p=d.index;const g=p+d.addedCount,b=t.splice(d.index,u.length),v=h=l.length+b.length;for(;p<g;++p){const e=t[p],c=e?e.firstChild:this.location;let d;o&&h>0?(f<=v&&b.length>0?(d=b[f],f++):(d=l[a],a++),h--):d=n.create(),t.splice(p,0,d),s(d,i,p,r),d.insertBefore(c)}b[f]&&l.push(...b.slice(f))}for(let e=a,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e){const i=t[e].context;i.length=s,i.index=e}}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.controller;let o=t.length,l=this.views,a=l.length;if(0!==o&&!e&&this.directive.options.recycle||(we.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<a){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const h=l.splice(e,a-e);for(e=0,o=h.length;e<o;++e)h[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class qe{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=X(),E.enable()}createHTML(e){return Y.comment(e(this))}createBehavior(){return new Ue(this)}}function Qe(e,t,s=Re){const i=ye(e),n=ye(t);return new qe(i,n,Object.assign(Object.assign({},Re),s))}se.define(qe);const We=e=>1===e.nodeType,Ke=e=>e?t=>1===t.nodeType&&t.matches(e):We;class Ge extends oe{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e){const t=e.targets[this.nodeId];t[this.sourceProperty]=e.source,this.updateTarget(e.source,this.computeNodes(t)),this.observe(t),e.onUnbind(this)}unbind(e){const t=e.targets[this.nodeId];this.updateTarget(e.source,a),this.disconnect(t),t[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class Je extends Ge{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function Xe(e){return u(e)&&(e={property:e}),new Je(e)}se.define(Je);class Ye extends Ge{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function Ze(e){return u(e)&&(e={property:e}),new Ye(e)}se.define(Ye);const et=Object.freeze({locate:c()}),tt={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function st(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const it={toView(e){const t=st(e);return t?t.toString():t},fromView:st};class nt{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=tt)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return v.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||f.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;q.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":q.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(et.locate(e));for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];u(i)?s.push(new nt(e,i)):s.push(new nt(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function rt(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t),et.locate(e.constructor).push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const ot={mode:"open"},lt={},at=new Set,ht=l.getById(4,(()=>h()));class ct{constructor(e,t=e.definition){var s;this.platformDefined=!1,u(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template,this.registry=null!==(s=t.registry)&&void 0!==s?s:customElements;const i=e.prototype,n=nt.collect(e,t.attributes),r=new Array(n.length),o={},l={};for(let e=0,t=n.length;e<t;++e){const t=n[e];r[e]=t.attribute,o[t.name]=t,l[t.attribute]=t,v.defineProperty(i,t)}Reflect.defineProperty(e,"observedAttributes",{value:r,enumerable:!0}),this.attributes=n,this.propertyLookup=o,this.attributeLookup=l,this.shadowOptions=void 0===t.shadowOptions?ot:null===t.shadowOptions?void 0:Object.assign(Object.assign({},ot),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?lt:Object.assign(Object.assign({},lt),t.elementOptions),this.styles=L.normalize(t.styles),ht.register(this)}get isDefined(){return this.platformDefined}define(e=this.registry){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){return at.has(e)||ht.getByType(e)?new ct(class extends e{},t):new ct(e,t)}static registerBaseType(e){at.add(e)}}ct.getByType=ht.getByType,ct.getForInstance=ht.getForInstance;const dt={bubbles:!0,composed:!0,cancelable:!0},ut=new WeakMap;function ft(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:ut.get(e))&&void 0!==s?s:null}let pt;class gt extends g{constructor(e,t){super(e),this.boundObservables=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._isConnected=!1,this.behaviors=null,this._mainStyles=null,this.$fastController=this,this.view=null,this.source=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&ut.set(e,t))}const i=v.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return v.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,v.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.source.resolveTemplate?this._template=this.source.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get mainStyles(){var e;if(null===this._mainStyles){const t=this.definition;this.source.resolveStyles?this._mainStyles=this.source.resolveStyles():t.styles&&(this._mainStyles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._mainStyles}set mainStyles(e){this._mainStyles!==e&&(null!==this._mainStyles&&this.removeStyles(this._mainStyles),this._mainStyles=e,this.needsInitialization||this.addStyles(e))}addBehavior(e){var t,s;const i=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,n=null!==(s=i.get(e))&&void 0!==s?s:0;0===n?(i.set(e,1),e.addedCallback&&e.addedCallback(this),e.connectedCallback&&this.isConnected&&e.connectedCallback(this)):i.set(e,n+1)}removeBehavior(e,t=!1){const s=this.behaviors;if(null===s)return;const i=s.get(e);void 0!==i&&(1===i||t?(s.delete(e),e.disconnectedCallback&&this.isConnected&&e.disconnectedCallback(this),e.removedCallback&&e.removedCallback(this)):s.set(e,i-1))}addStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=ft(s))&&void 0!==t?t:this.source).append(e)}else if(!e.isAttachedTo(s)){const t=e.behaviors;if(e.addStylesTo(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}removeStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=ft(s))&&void 0!==t?t:s).removeChild(e)}else if(e.isAttachedTo(s)){const t=e.behaviors;if(e.removeStylesFrom(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}connect(){if(this._isConnected)return;if(null!==this.boundObservables){const e=this.source,t=this.boundObservables,s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}const e=this.behaviors;if(null!==e)for(const t of e.keys())t.connectedCallback&&t.connectedCallback(this);this.needsInitialization?(this.renderTemplate(this.template),this.addStyles(this.mainStyles),this.needsInitialization=!1):null!==this.view&&this.view.bind(this.source),this.setIsConnected(!0)}disconnect(){if(!this._isConnected)return;this.setIsConnected(!1),null!==this.view&&this.view.unbind();const e=this.behaviors;if(null!==e)for(const t of e.keys())t.disconnectedCallback&&t.disconnectedCallback(this)}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.source,s)}emit(e,t,s){return!!this._isConnected&&this.source.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},dt),s)))}renderTemplate(e){var t;const s=this.source,i=null!==(t=ft(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s),this.view.sourceLifetime=b.coupled)}static forCustomElement(e){const t=e.$fastController;if(void 0!==t)return t;const s=ct.getForInstance(e);if(void 0===s)throw l.error(1401);return e.$fastController=new pt(e,s)}static setStrategy(e){pt=e}}function bt(e){var t;return"adoptedStyleSheets"in e?e:null!==(t=ft(e))&&void 0!==t?t:e.getRootNode()}gt.setStrategy(gt);class vt{constructor(e){const t=vt.styleSheetCache;this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let s=t.get(e);return void 0===s&&(s=new CSSStyleSheet,s.replaceSync(e),t.set(e,s)),s}))}addStylesTo(e){const t=bt(e);t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=bt(e),s=this.sheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter((e=>-1===s.indexOf(e)))}}vt.styleSheetCache=new Map;let yt=0;function mt(e){return e===document?document.body:e}function wt(e){const t=class extends e{constructor(){super(),gt.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.connect()}disconnectedCallback(){this.$fastController.disconnect()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}};return ct.registerBaseType(t),t}function Ct(e,t){return d(e)?ct.compose(e,t).define().type:ct.compose(this,e).define().type}L.setDefaultStrategy(L.supportsAdoptedStyleSheets?vt:class{constructor(e){this.styles=e,this.styleClass="fast-"+ ++yt}addStylesTo(e){e=mt(bt(e));const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=(e=mt(bt(e))).querySelectorAll(`.${this.styleClass}`);t[0].parentNode;for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}});const xt=Object.assign(wt(HTMLElement),{from:function(e){return wt(e)},define:Ct,compose:function(e,t){return d(e)?ct.compose(e,t):ct.compose(this,e)}});function Tt(e){return function(t){Ct(t,e)}}export{E as ArrayObserver,re as Aspect,et as AttributeConfiguration,nt as AttributeDefinition,ne as Binding,z as CSSDirective,Ye as ChildrenDirective,Ee as Compiler,q as DOM,gt as ElementController,L as ElementStyles,C as ExecutionContext,l as FAST,xt as FASTElement,ct as FASTElementDefinition,pe as HTMLBindingDirective,se as HTMLDirective,we as HTMLView,Y as Markup,Ge as NodeObservationDirective,v as Observable,Z as Parser,g as PropertyChangeNotifier,_e as RefDirective,Ue as RepeatBehavior,qe as RepeatDirective,Je as SlottedDirective,b as SourceLifetime,x as Splice,j as SpliceStrategy,T as SpliceStrategySupport,oe as StatelessAttachedAttributeDirective,p as SubscriberSet,f as Updates,ee as ViewBehaviorOrchestrator,Ne as ViewTemplate,rt as attr,ge as bind,tt as booleanConverter,Ze as children,c as createMetadataLocator,h as createTypeRegistry,D as css,P as cssDirective,U as cssPartial,Tt as customElement,Ke as elements,a as emptyArray,Le as html,ie as htmlDirective,N as lengthOf,ve as listener,ye as normalizeBinding,it as nullableNumberConverter,y as observable,be as oneTime,ze as ref,Qe as repeat,Xe as slotted,m as volatile,Pe as when}; |
@@ -1,1 +0,1 @@ | ||
!function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t});const e={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},e));const t=globalThis.FAST;if(void 0===t.getById){const s=Object.create(null);Reflect.defineProperty(t,"getById",Object.assign({value(e,t){let i=s[e];return void 0===i&&(i=t?s[e]=t():null),i}},e))}void 0===t.error&&Object.assign(t,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const s=Object.freeze([]);function i(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance(t){if(null!=t)return e.get(t.constructor)}})}function n(){const e=new WeakMap;return function(t){let s=e.get(t);if(void 0===s){let i=Reflect.getPrototypeOf(t);for(;void 0===s&&null!==i;)s=e.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),e.set(t,s)}return s}}const r=e=>"function"==typeof e,o=e=>"string"==typeof e,l=t.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class h{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class a{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new h(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new h(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const c=Object.freeze({unknown:void 0,coupled:1}),d=t.getById(2,(()=>{const e=l.enqueue,s=/(:|&&|\|\||if)/,i=new WeakMap;let d,u=e=>{throw t.error(1101)};function f(e){var t;let s=null!==(t=e.$fastController)&&void 0!==t?t:i.get(e);return void 0===s&&(Array.isArray(e)?s=u(e):i.set(e,s=new a(e))),s}const p=n();class g{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==d&&d.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];r(n)&&n.call(e,i,t),f(e).notify(this.name)}}}class b extends h{constructor(e,t,s=!1){super(e,t),this.expression=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}bind(e){this.controller=e;const t=this.observe(e.source,e.context);return!e.isBound&&this.requiresUnbind(e)&&e.onUnbind(this),t}requiresUnbind(e){return e.sourceLifetime!==c.coupled||this.first!==this.last||this.first.propertySource!==e.source}unbind(e){this.dispose()}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=d;let i;d=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;try{i=this.expression(e,t)}finally{d=s}return i}disconnect(){this.dispose()}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,i=f(e),n=null===s?this.first:{};if(n.propertySource=e,n.propertyName=t,n.notifier=i,i.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;d=void 0,t=s.propertySource[s.propertyName],d=this,e===t&&(this.needsRefresh=!0)}s.next=n}this.last=n}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){u=e},getNotifier:f,track(e,t){d&&d.watch(e,t)},trackVolatile(){d&&(d.needsRefresh=!0)},notify(e,t){f(e).notify(t)},defineProperty(e,t){o(t)&&(t=new g(t)),p(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:p,binding(e,t,s=this.isVolatileBinding(e)){return new b(e,t,s)},isVolatileBinding:e=>s.test(e.toString())})}));function u(e,t){d.defineProperty(e,t)}function f(e,t,s){return Object.assign({},s,{get(){return d.trackVolatile(),s.get.apply(this)}})}const p=t.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}})),g=Object.freeze({default:{index:0,length:0,get event(){return g.getEvent()},eventDetail(){return this.event.detail},eventTarget(){return this.event.target}},getEvent:()=>p.get(),setEvent(e){p.set(e)}});class b{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const v=Object.freeze({reset:1,splice:2,optimized:3}),y=new b(0,s,0);y.reset=!0;const m=[y];function w(e,t,i,n,r,o){let l=0,h=0;const a=Math.min(i-t,o-r);if(0===t&&0===r&&(l=function(e,t,s){for(let i=0;i<s;++i)if(e[i]!==t[i])return i;return s}(e,n,a)),i===e.length&&o===n.length&&(h=function(e,t,s){let i=e.length,n=t.length,r=0;for(;r<s&&e[--i]===t[--n];)r++;return r}(e,n,a-l)),r+=l,o-=h,(i-=h)-(t+=l)==0&&o-r==0)return s;if(t===i){const e=new b(t,[],0);for(;r<o;)e.removed.push(n[r++]);return[e]}if(r===o)return[new b(t,[],i-t)];const c=function(e){let t=e.length-1,s=e[0].length-1,i=e[t][s];const n=[];for(;t>0||s>0;){if(0===t){n.push(2),s--;continue}if(0===s){n.push(3),t--;continue}const r=e[t-1][s-1],o=e[t-1][s],l=e[t][s-1];let h;h=o<l?o<r?o:r:l<r?l:r,h===r?(r===i?n.push(0):(n.push(1),i=r),t--,s--):h===o?(n.push(3),t--,i=o):(n.push(2),s--,i=l)}return n.reverse()}(function(e,t,s,i,n,r){const o=r-n+1,l=s-t+1,h=new Array(o);let a,c;for(let e=0;e<o;++e)h[e]=new Array(l),h[e][0]=e;for(let e=0;e<l;++e)h[0][e]=e;for(let s=1;s<o;++s)for(let r=1;r<l;++r)e[t+r-1]===i[n+s-1]?h[s][r]=h[s-1][r-1]:(a=h[s-1][r]+1,c=h[s][r-1]+1,h[s][r]=a<c?a:c);return h}(e,t,i,n,r,o)),d=[];let u,f=t,p=r;for(let e=0;e<c.length;++e)switch(c[e]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,p++;break;case 1:void 0===u&&(u=new b(f,[],0)),u.addedCount++,f++,u.removed.push(n[p]),p++;break;case 2:void 0===u&&(u=new b(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=new b(f,[],0)),u.removed.push(n[p]),p++}return void 0!==u&&d.push(u),d}function C(e,t){let s=!1,i=0;for(let h=0;h<t.length;h++){const a=t[h];if(a.index+=i,s)continue;const c=(n=e.index,r=e.index+e.removed.length,o=a.index,l=a.index+a.addedCount,r<o||l<n?-1:r===o||l===n?0:n<o?r<l?r-o:l-o:l<r?l-n:r-n);if(c>=0){t.splice(h,1),h--,i-=a.addedCount-a.removed.length,e.addedCount+=a.addedCount-c;const n=e.removed.length+a.removed.length-c;if(e.addedCount||n){let t=a.removed;if(e.index<a.index){const s=e.removed.slice(0,a.index-e.index);s.push(...t),t=s}if(e.index+e.removed.length>a.index+a.addedCount){const s=e.removed.slice(a.index+a.addedCount-e.index);t.push(...s)}e.removed=t,a.index<e.index&&(e.index=a.index)}else s=!0}else if(e.index<a.index){s=!0,t.splice(h,0,e),h++;const n=e.addedCount-e.removed.length;a.index+=n,i+=n}}var n,r,o,l;s||t.push(e)}let x=Object.freeze({support:v.optimized,normalize:(e,t,i)=>void 0===e?void 0===i?s:i.length>1?function(e,t){let s=[];const i=[];for(let e=0,s=t.length;e<s;e++)C(t[e],i);for(let t=0,n=i.length;t<n;++t){const n=i[t];1!==n.addedCount||1!==n.removed.length?s=s.concat(w(e,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==e[n.index]&&s.push(n)}return s}(t,i):i:m,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new b(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new b(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new b(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new b(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new b(0,[],i.length).adjustTo(e)),n}});const S=Object.freeze({reset:m,setDefaultStrategy(e){x=e}});function T(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class O extends h{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,T(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,d.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:x).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,l.enqueue(this))}}let B=!1;const A=Object.freeze({enable(){if(B)return;B=!0,d.setArrayObserverFactory((e=>new O(e)));const e=Array.prototype;e.$fastPatch||(T(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:x)[t.name](this,i,t,e)}})))}});function k(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(A.enable(),t=d.getNotifier(e)),d.track(t.lengthObserver,"length"),e.length}let j;function $(e){return e.map((e=>e instanceof I?$(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class I{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof I?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(j),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e($(this.styles)),this}static setDefaultStrategy(e){j=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new I(e):e instanceof I?e:new I([e])}}I.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;const V=i(),N=Object.freeze({getForInstance:V.getForInstance,getByType:V.getByType,define:e=>(V.register({type:e}),e)});function E(){return function(e){N.define(e)}}function _(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==N.getForInstance(o)&&(o=o.createCSS(r)),o instanceof I||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const z=(e,...t)=>{const{styles:s,behaviors:i}=_(e,t),n=new I(s);return i.length?n.withBehaviors(...i):n};class L{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(o(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new I(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}addedCallback(e){e.addStyles(this.styles)}removedCallback(e){e.removeStyles(this.styles)}}N.define(L);const F=z.partial=(e,...t)=>{const{styles:s,behaviors:i}=_(e,t);return new L(s,i)},M=Object.freeze({queueUpdate:l.enqueue,nextUpdate:l.next,processUpdates:l.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),P=`fast-${Math.random().toString(36).substring(2,8)}`,R=`${P}{`,H=`}${P}`,q=H.length;let D=0;const U=()=>`${P}-${++D}`,Q=Object.freeze({interpolation:e=>`${R}${e}${H}`,attribute:e=>`${U()}="${R}${e}${H}"`,comment:e=>`\x3c!--${R}${e}${H}--\x3e`}),W=Object.freeze({parse(e,t){const s=e.split(R);if(1===s.length)return null;const i=[];for(let e=0,n=s.length;e<n;++e){const n=s[e],r=n.indexOf(H);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+q)}""!==o&&i.push(o)}return i}}),G=Object.freeze({create(e){const t=[],s={};let i=null,n=!1;return{source:e,context:g.default,targets:s,get isBound(){return n},addBehaviorFactory(e,t){const s=e.nodeId||(e.nodeId=U());e.id||(e.id=U()),this.addTarget(s,t),this.addBehavior(e.createBehavior())},addTarget(e,t){s[e]=t},addBehavior(e){t.push(e),n&&e.bind(this)},onUnbind(e){null===i&&(i=[]),i.push(e)},connectedCallback(e){n||(n=!0,t.forEach((e=>e.bind(this))))},disconnectedCallback(e){n&&(n=!1,null!==i&&i.forEach((e=>e.unbind(this))))}}}}),J=i(),K=Object.freeze({getForInstance:J.getForInstance,getByType:J.getByType,define:(e,t)=>((t=t||{}).type=e,J.register(t),e)});function X(e){return function(t){K.define(t,e)}}class Y{constructor(e,t=!1){this.evaluate=e,this.isVolatile=t}}const Z=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":e.targetAspect=t.substring(1),e.aspectType="classList"===e.targetAspect?Z.tokenList:Z.property;break;case"?":e.targetAspect=t.substring(1),e.aspectType=Z.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=Z.event;break;default:e.targetAspect=t,e.aspectType=Z.attribute}else e.aspectType=Z.content}});class ee{constructor(e){this.options=e,this.id=U()}createHTML(e){return Q.attribute(e(this))}createBehavior(){return this}}const te=globalThis.TrustedHTML?e=>(s,i)=>{const n=e(s,i);if(n instanceof TrustedHTML)return n;throw t.error(1202)}:e=>e;class se extends Y{createObserver(e,t){return d.binding(this.evaluate,t,this.isVolatile)}}class ie extends Y{createObserver(){return this}bind(e){return this.evaluate(e.source,e.context)}}function ne(e,t,s,i){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i.source,i.context)):(t.isComposed=!0,t.bind(i.source,i.context),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function re(e,t,s){var i;const n=`${this.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={v:0,cv:Object.create(null)},o=r.cv;let l=r.v;const h=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,h.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&h.remove(e)}}const oe=(e,t,s)=>e[t]=s,le=()=>{};class he{constructor(e){this.dataBinding=e,this.updateTarget=null,this.id=U(),this.aspectType=Z.content,this.data=`${this.id}-d`}createHTML(e){return Q.interpolation(e(this))}createBehavior(){if(null===this.updateTarget)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=te(this.dataBinding.evaluate)),this.aspectType){case 1:this.updateTarget=M.setAttribute;break;case 2:this.updateTarget=M.setBooleanAttribute;break;case 3:this.updateTarget=oe;break;case 4:this.updateTarget=ne;break;case 5:this.updateTarget=re;break;case 6:this.updateTarget=le;break;default:throw t.error(1205)}return this}bind(e){var t;const s=e.targets[this.nodeId];switch(this.updateTarget){case le:s[this.data]=e,s.addEventListener(this.targetAspect,this,this.dataBinding.options);break;case ne:e.onUnbind(this);default:const i=null!==(t=s[this.data])&&void 0!==t?t:s[this.data]=this.dataBinding.createObserver(this,this);i.target=s,i.controller=e,this.updateTarget(s,this.targetAspect,i.bind(e),e)}}unbind(e){const t=e.targets[this.nodeId].$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}handleEvent(e){const t=e.currentTarget[this.data];if(t.isBound){g.setEvent(e);const s=this.dataBinding.evaluate(t.source,t.context);g.setEvent(null),!0!==s&&e.preventDefault()}}handleChange(e,t){const s=t.target,i=t.controller;this.updateTarget(s,this.targetAspect,t.bind(i),i)}}function ae(e,t=d.isVolatileBinding(e)){return new se(e,t)}function ce(e){return new ie(e)}function de(e,t){const s=new se(e,!1);return s.options=t,s}function ue(e){return r(e)?ae(e):e instanceof Y?e:ce((()=>e))}function fe(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}K.define(he,{aspected:!0});class pe{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.unbindables=[],this.source=null,this.isBound=!1,this.sourceLifetime=c.unknown,this.context=this,this.index=0,this.length=0,this.firstChild=e.firstChild,this.lastChild=e.lastChild}get event(){return g.getEvent()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=this.lastChild;if(e.previousSibling===t)return;const s=e.parentNode;let i,n=this.firstChild;for(;n!==t;)i=n.nextSibling,s.insertBefore(n,e),n=i;s.insertBefore(t,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){fe(this.firstChild,this.lastChild),this.unbind()}onUnbind(e){this.unbindables.push(e)}bind(e,t=this){if(this.source===e)return;let s=this.behaviors;if(null===s){this.source=e,this.context=t,this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let e=0,t=i.length;e<t;++e){const t=i[e].createBehavior();t.bind(this),s[e]=t}}else{null!==this.source&&this.evaluateUnbindables(),this.isBound=!1,this.source=e,this.context=t;for(let e=0,t=s.length;e<t;++e)s[e].bind(this)}this.isBound=!0}unbind(){this.isBound&&null!==this.source&&(this.evaluateUnbindables(),this.source=null,this.context=this,this.isBound=!1)}evaluateUnbindables(){const e=this.unbindables;for(let t=0,s=e.length;t<s;++t)e[t].unbind(this);e.length=0}static disposeContiguousBatch(e){if(0!==e.length){fe(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}d.defineProperty(pe.prototype,"index"),d.defineProperty(pe.prototype,"length");const ge=(e,t)=>`${e}.${t}`,be={},ve={index:0,node:null};function ye(e){e.startsWith("fast-")||t.warn(1204,{name:e})}const me=new Proxy(document.createElement("div"),{get(e,t){ye(t);const s=Reflect.get(e,t);return r(s)?s.bind(e):s},set:(e,t,s)=>(ye(t),Reflect.set(e,t,s))});class we{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=be[t];if(!n){const i=`_${t}`;be[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:me;for(const e of this.nodeIds)s[e];return new pe(t,this.factories,s)}}function Ce(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let h=0,a=o.length;h<a;++h){const c=o[h],d=c.value,u=W.parse(d,l);let f=null;null===u?r&&(f=new he(ce((()=>d))),Z.assign(f,c.name)):f=Ae.aggregate(u),null!==f&&(s.removeAttributeNode(c),h--,a--,e.addFactory(f,t,i,n))}}function xe(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=Se(e,s,n,i);n=t.node,i=t.index}}function Se(e,t,s,i){const n=ge(t,i);switch(s.nodeType){case 1:Ce(e,t,s,n,i),xe(e,s,n);break;case 3:return function(e,t,s,i,n){const r=W.parse(t.textContent,e.directives);if(null===r)return ve.node=t.nextSibling,ve.index=n+1,ve;let l,h=l=t;for(let t=0,a=r.length;t<a;++t){const a=r[t];0!==t&&(n++,i=ge(s,n),l=h.parentNode.insertBefore(document.createTextNode(""),h.nextSibling)),o(a)?l.textContent=a:(l.textContent=" ",Z.assign(a),e.addFactory(a,s,i,n)),h=l}return ve.index=n+1,ve.node=h.nextSibling,ve}(e,s,t,n,i);case 8:const r=W.parse(s.data,e.directives);null!==r&&e.addFactory(Ae.aggregate(r),t,n,i)}return ve.index=i+1,ve.node=s.nextSibling,ve}const Te={createHTML:e=>e};let Oe=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Te):Te;const Be=Oe,Ae={setHTMLPolicy(e){if(Oe!==Be)throw t.error(1201);Oe=e},compile(e,t){let s;if(o(e)){s=document.createElement("TEMPLATE"),s.innerHTML=Oe.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new we(i,t);return Ce(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==W.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),xe(n,i,"r"),ve.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>o(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const l=new he(s);return Z.assign(l,t),l}};class ke{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=Ae.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s){const i=this.create(s);return i.bind(e),i.appendTo(t),i}}const je=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function $e(e,t,s){const i=je.exec(t);return null!==i&&Z.assign(e,i[2]),e.createHTML(s)}function Ie(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=U();return i[s]=e,s};for(let i=0,l=e.length-1;i<l;++i){const l=e[i],h=t[i];let a;if(s+=l,r(h))s+=$e(new he(ae(h)),l,n);else if(o(h)){const e=je.exec(l);if(null!==e){const t=new he(ce((()=>h)));Z.assign(t,e[2]),s+=t.createHTML(n)}else s+=h}else h instanceof Y?s+=$e(new he(h),l,n):void 0===(a=K.getForInstance(h))?s+=$e(new he(ce((()=>h))),l,n):a.aspected?s+=$e(h,l,n):s+=h.createHTML(n)}return new ke(s+e[e.length-1],i)}class Ve extends ee{bind(e){e.source[this.options]=e.targets[this.nodeId]}}K.define(Ve);const Ne=e=>new Ve(e);function Ee(e,t){const s=r(e)?e:()=>e,i=r(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const _e=Object.freeze({positioning:!1,recycle:!0});function ze(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.bind(t[s])}function Le(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.context.length=t.length,e.context.index=s,e.bind(t[s])}class Fe{constructor(e){this.directive=e,this.items=null,this.itemsObserver=null,this.bindView=ze,this.views=[],this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=Le)}bind(e){this.location=e.targets[this.directive.nodeId],this.controller=e,this.items=this.itemsBindingObserver.bind(e),this.template=this.templateBindingObserver.bind(e),this.observeItems(!0),this.refreshAllViews(),e.onUnbind(this)}unbind(){null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else{if(!t[0])return;t[0].reset?this.refreshAllViews():this.updateViews(t)}}observeItems(e=!1){if(!this.items)return void(this.items=s);const t=this.itemsObserver,i=this.itemsObserver=d.getNotifier(this.items),n=t!==i;n&&null!==t&&t.unsubscribe(this),(n||e)&&i.subscribe(this)}updateViews(e){const t=this.views,s=this.bindView,i=this.items,n=this.template,r=this.controller,o=this.directive.options.recycle,l=[];let h=0,a=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,p=d.index;const g=p+d.addedCount,b=t.splice(d.index,u.length),v=a=l.length+b.length;for(;p<g;++p){const e=t[p],c=e?e.firstChild:this.location;let d;o&&a>0?(f<=v&&b.length>0?(d=b[f],f++):(d=l[h],h++),a--):d=n.create(),t.splice(p,0,d),s(d,i,p,r),d.insertBefore(c)}b[f]&&l.push(...b.slice(f))}for(let e=h,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e){const i=t[e].context;i.length=s,i.index=e}}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.controller;let o=t.length,l=this.views,h=l.length;if(0!==o&&!e&&this.directive.options.recycle||(pe.disposeContiguousBatch(l),h=0),0===h){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<h){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const a=l.splice(e,h-e);for(e=0,o=a.length;e<o;++e)a[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class Me{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=U(),A.enable()}createHTML(e){return Q.comment(e(this))}createBehavior(){return new Fe(this)}}function Pe(e,t,s=_e){const i=ue(e),n=ue(t);return new Me(i,n,Object.assign(Object.assign({},_e),s))}K.define(Me);const Re=e=>1===e.nodeType,He=e=>e?t=>1===t.nodeType&&t.matches(e):Re;class qe extends ee{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e){const t=e.targets[this.nodeId];t[this.sourceProperty]=e.source,this.updateTarget(e.source,this.computeNodes(t)),this.observe(t),e.onUnbind(this)}unbind(e){const t=e.targets[this.nodeId];this.updateTarget(e.source,s),this.disconnect(t),t[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class De extends qe{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function Ue(e){return o(e)&&(e={property:e}),new De(e)}K.define(De);class Qe extends qe{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function We(e){return o(e)&&(e={property:e}),new Qe(e)}K.define(Qe);const Ge=Object.freeze({locate:n()}),Je={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function Ke(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const Xe={toView(e){const t=Ke(e);return t?t.toString():t},fromView:Ke};class Ye{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=Je)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return d.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||l.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;M.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":M.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(Ge.locate(e));for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];o(i)?s.push(new Ye(e,i)):s.push(new Ye(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function Ze(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t),Ge.locate(e.constructor).push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const et={mode:"open"},tt={},st=new Set,it=t.getById(4,(()=>i()));class nt{constructor(e,t=e.definition){var s;this.platformDefined=!1,o(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template,this.registry=null!==(s=t.registry)&&void 0!==s?s:customElements;const i=e.prototype,n=Ye.collect(e,t.attributes),r=new Array(n.length),l={},h={};for(let e=0,t=n.length;e<t;++e){const t=n[e];r[e]=t.attribute,l[t.name]=t,h[t.attribute]=t,d.defineProperty(i,t)}Reflect.defineProperty(e,"observedAttributes",{value:r,enumerable:!0}),this.attributes=n,this.propertyLookup=l,this.attributeLookup=h,this.shadowOptions=void 0===t.shadowOptions?et:null===t.shadowOptions?void 0:Object.assign(Object.assign({},et),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?tt:Object.assign(Object.assign({},tt),t.elementOptions),this.styles=I.normalize(t.styles),it.register(this)}get isDefined(){return this.platformDefined}define(e=this.registry){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){return st.has(e)||it.getByType(e)?new nt(class extends e{},t):new nt(e,t)}static registerBaseType(e){st.add(e)}}nt.getByType=it.getByType,nt.getForInstance=it.getForInstance;const rt={bubbles:!0,composed:!0,cancelable:!0},ot=new WeakMap;function lt(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:ot.get(e))&&void 0!==s?s:null}class ht extends a{constructor(e,t){super(e),this.boundObservables=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._isConnected=!1,this.behaviors=null,this._mainStyles=null,this.$fastController=this,this.view=null,this.source=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&ot.set(e,t))}const i=d.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return d.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,d.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.source.resolveTemplate?this._template=this.source.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get mainStyles(){var e;if(null===this._mainStyles){const t=this.definition;this.source.resolveStyles?this._mainStyles=this.source.resolveStyles():t.styles&&(this._mainStyles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._mainStyles}set mainStyles(e){this._mainStyles!==e&&(null!==this._mainStyles&&this.removeStyles(this._mainStyles),this._mainStyles=e,this.needsInitialization||this.addStyles(e))}addBehavior(e){var t,s;const i=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,n=null!==(s=i.get(e))&&void 0!==s?s:0;0===n?(i.set(e,1),e.addedCallback&&e.addedCallback(this),e.connectedCallback&&this.isConnected&&e.connectedCallback(this)):i.set(e,n+1)}removeBehavior(e,t=!1){const s=this.behaviors;if(null===s)return;const i=s.get(e);void 0!==i&&(1===i||t?(s.delete(e),e.disconnectedCallback&&this.isConnected&&e.disconnectedCallback(this),e.removedCallback&&e.removedCallback(this)):s.set(e,i-1))}addStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=lt(s))&&void 0!==t?t:this.source).append(e)}else if(!e.isAttachedTo(s)){const t=e.behaviors;if(e.addStylesTo(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}removeStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=lt(s))&&void 0!==t?t:s).removeChild(e)}else if(e.isAttachedTo(s)){const t=e.behaviors;if(e.removeStylesFrom(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}connect(){if(this._isConnected)return;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(this.source);const e=this.behaviors;if(null!==e)for(const t of e.keys())t.connectedCallback&&t.connectedCallback(this);this.setIsConnected(!0)}disconnect(){if(!this._isConnected)return;this.setIsConnected(!1),null!==this.view&&this.view.unbind();const e=this.behaviors;if(null!==e)for(const t of e.keys())t.disconnectedCallback&&t.disconnectedCallback(this)}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.source,s)}emit(e,t,s){return!!this._isConnected&&this.source.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},rt),s)))}finishInitialization(){const e=this.source,t=this.boundObservables;if(null!==t){const s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.mainStyles),this.needsInitialization=!1}renderTemplate(e){var t;const s=this.source,i=null!==(t=lt(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s),this.view.sourceLifetime=c.coupled)}static forCustomElement(e){const s=e.$fastController;if(void 0!==s)return s;const i=nt.getForInstance(e);if(void 0===i)throw t.error(1401);return e.$fastController=new ht(e,i)}}function at(e){var t;return"adoptedStyleSheets"in e?e:null!==(t=lt(e))&&void 0!==t?t:e.getRootNode()}class ct{constructor(e){const t=ct.styleSheetCache;this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let s=t.get(e);return void 0===s&&(s=new CSSStyleSheet,s.replaceSync(e),t.set(e,s)),s}))}addStylesTo(e){const t=at(e);t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=at(e),s=this.sheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter((e=>-1===s.indexOf(e)))}}ct.styleSheetCache=new Map;let dt=0;function ut(e){return e===document?document.body:e}function ft(e){const t=class extends e{constructor(){super(),ht.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.connect()}disconnectedCallback(){this.$fastController.disconnect()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}};return nt.registerBaseType(t),t}function pt(e,t){return r(e)?nt.compose(e,t).define().type:nt.compose(this,e).define().type}I.setDefaultStrategy(I.supportsAdoptedStyleSheets?ct:class{constructor(e){this.styles=e,this.styleClass="fast-"+ ++dt}addStylesTo(e){e=ut(at(e));const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=(e=ut(at(e))).querySelectorAll(`.${this.styleClass}`);t[0].parentNode;for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}});const gt=Object.assign(ft(HTMLElement),{from:function(e){return ft(e)},define:pt,compose:function(e,t){return r(e)?nt.compose(e,t):nt.compose(this,e)}});function bt(e){return function(t){pt(t,e)}}export{A as ArrayObserver,Z as Aspect,Ge as AttributeConfiguration,Ye as AttributeDefinition,Y as Binding,N as CSSDirective,Qe as ChildrenDirective,Ae as Compiler,M as DOM,ht as ElementController,I as ElementStyles,g as ExecutionContext,t as FAST,gt as FASTElement,nt as FASTElementDefinition,he as HTMLBindingDirective,K as HTMLDirective,pe as HTMLView,Q as Markup,qe as NodeObservationDirective,d as Observable,W as Parser,a as PropertyChangeNotifier,Ve as RefDirective,Fe as RepeatBehavior,Me as RepeatDirective,De as SlottedDirective,c as SourceLifetime,b as Splice,S as SpliceStrategy,v as SpliceStrategySupport,ee as StatelessAttachedAttributeDirective,h as SubscriberSet,l as Updates,G as ViewBehaviorOrchestrator,ke as ViewTemplate,Ze as attr,ae as bind,Je as booleanConverter,We as children,n as createMetadataLocator,i as createTypeRegistry,z as css,E as cssDirective,F as cssPartial,bt as customElement,He as elements,s as emptyArray,Ie as html,X as htmlDirective,k as lengthOf,de as listener,ue as normalizeBinding,Xe as nullableNumberConverter,u as observable,ce as oneTime,Ne as ref,Pe as repeat,Ue as slotted,f as volatile,Ee as when}; | ||
!function(){if("undefined"==typeof globalThis)if("undefined"!=typeof global)global.globalThis=global;else if("undefined"!=typeof self)self.globalThis=self;else if("undefined"!=typeof window)window.globalThis=window;else{const e=new Function("return this")();e.globalThis=e}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(e,t)=>t});const e={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},e));const t=globalThis.FAST;if(void 0===t.getById){const s=Object.create(null);Reflect.defineProperty(t,"getById",Object.assign({value(e,t){let i=s[e];return void 0===i&&(i=t?s[e]=t():null),i}},e))}void 0===t.error&&Object.assign(t,{warn(){},error:e=>new Error(`Error ${e}`),addMessages(){}});const s=Object.freeze([]);function i(){const e=new Map;return Object.freeze({register:t=>!e.has(t.type)&&(e.set(t.type,t),!0),getByType:t=>e.get(t),getForInstance(t){if(null!=t)return e.get(t.constructor)}})}function n(){const e=new WeakMap;return function(t){let s=e.get(t);if(void 0===s){let i=Reflect.getPrototypeOf(t);for(;void 0===s&&null!==i;)s=e.get(i),i=Reflect.getPrototypeOf(i);s=void 0===s?[]:s.slice(0),e.set(t,s)}return s}}const r=e=>"function"==typeof e,o=e=>"string"==typeof e,l=t.getById(1,(()=>{const e=[],t=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(t.length)throw t.shift()}function r(s){try{s.call()}catch(s){if(!i)throw e.length=0,s;t.push(s),setTimeout(n,0)}}function o(){let t=0;for(;t<e.length;)if(r(e[t]),t++,t>1024){for(let s=0,i=e.length-t;s<i;s++)e[s]=e[s+t];e.length-=t,t=0}e.length=0}function l(t){e.push(t),e.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:e=>i=e})}));class a{constructor(e,t){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=e,this.sub1=t}has(e){return void 0===this.spillover?this.sub1===e||this.sub2===e:-1!==this.spillover.indexOf(e)}subscribe(e){const t=this.spillover;if(void 0===t){if(this.has(e))return;if(void 0===this.sub1)return void(this.sub1=e);if(void 0===this.sub2)return void(this.sub2=e);this.spillover=[this.sub1,this.sub2,e],this.sub1=void 0,this.sub2=void 0}else{-1===t.indexOf(e)&&t.push(e)}}unsubscribe(e){const t=this.spillover;if(void 0===t)this.sub1===e?this.sub1=void 0:this.sub2===e&&(this.sub2=void 0);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}}notify(e){const t=this.spillover,s=this.subject;if(void 0===t){const t=this.sub1,i=this.sub2;void 0!==t&&t.handleChange(s,e),void 0!==i&&i.handleChange(s,e)}else for(let i=0,n=t.length;i<n;++i)t[i].handleChange(s,e)}}class h{constructor(e){this.subscribers={},this.subjectSubscribers=null,this.subject=e}notify(e){var t,s;null===(t=this.subscribers[e])||void 0===t||t.notify(e),null===(s=this.subjectSubscribers)||void 0===s||s.notify(e)}subscribe(e,t){var s,i;let n;n=t?null!==(s=this.subscribers[t])&&void 0!==s?s:this.subscribers[t]=new a(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new a(this.subject),n.subscribe(e)}unsubscribe(e,t){var s,i;t?null===(s=this.subscribers[t])||void 0===s||s.unsubscribe(e):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(e)}}const c=Object.freeze({unknown:void 0,coupled:1}),d=t.getById(2,(()=>{const e=l.enqueue,s=/(:|&&|\|\||if)/,i=new WeakMap;let d,u=e=>{throw t.error(1101)};function f(e){var t;let s=null!==(t=e.$fastController)&&void 0!==t?t:i.get(e);return void 0===s&&(Array.isArray(e)?s=u(e):i.set(e,s=new h(e))),s}const p=n();class g{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==d&&d.watch(e,this.name),e[this.field]}setValue(e,t){const s=this.field,i=e[s];if(i!==t){e[s]=t;const n=e[this.callback];r(n)&&n.call(e,i,t),f(e).notify(this.name)}}}class b extends a{constructor(e,t,s=!1){super(e,t),this.expression=e,this.isVolatileBinding=s,this.needsRefresh=!0,this.needsQueue=!0,this.isAsync=!0,this.first=this,this.last=null,this.propertySource=void 0,this.propertyName=void 0,this.notifier=void 0,this.next=void 0}setMode(e){this.isAsync=this.needsQueue=e}bind(e){this.controller=e;const t=this.observe(e.source,e.context);return!e.isBound&&this.requiresUnbind(e)&&e.onUnbind(this),t}requiresUnbind(e){return e.sourceLifetime!==c.coupled||this.first!==this.last||this.first.propertySource!==e.source}unbind(e){this.dispose()}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=d;let i;d=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;try{i=this.expression(e,t)}finally{d=s}return i}disconnect(){this.dispose()}dispose(){if(null!==this.last){let e=this.first;for(;void 0!==e;)e.notifier.unsubscribe(this,e.propertyName),e=e.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(e,t){const s=this.last,i=f(e),n=null===s?this.first:{};if(n.propertySource=e,n.propertyName=t,n.notifier=i,i.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;d=void 0,t=s.propertySource[s.propertyName],d=this,e===t&&(this.needsRefresh=!0)}s.next=n}this.last=n}handleChange(){this.needsQueue?(this.needsQueue=!1,e(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let e=this.first;for(;void 0!==e;)yield e,e=e.next}}return Object.freeze({setArrayObserverFactory(e){u=e},getNotifier:f,track(e,t){d&&d.watch(e,t)},trackVolatile(){d&&(d.needsRefresh=!0)},notify(e,t){f(e).notify(t)},defineProperty(e,t){o(t)&&(t=new g(t)),p(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:p,binding(e,t,s=this.isVolatileBinding(e)){return new b(e,t,s)},isVolatileBinding:e=>s.test(e.toString())})}));function u(e,t){d.defineProperty(e,t)}function f(e,t,s){return Object.assign({},s,{get(){return d.trackVolatile(),s.get.apply(this)}})}const p=t.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}})),g=Object.freeze({default:{index:0,length:0,get event(){return g.getEvent()},eventDetail(){return this.event.detail},eventTarget(){return this.event.target}},getEvent:()=>p.get(),setEvent(e){p.set(e)}});class b{constructor(e,t,s){this.index=e,this.removed=t,this.addedCount=s}adjustTo(e){let t=this.index;const s=e.length;return t>s?t=s-this.addedCount:t<0&&(t=s+this.removed.length+t-this.addedCount),this.index=t<0?0:t,this}}const v=Object.freeze({reset:1,splice:2,optimized:3}),y=new b(0,s,0);y.reset=!0;const m=[y];function w(e,t,i,n,r,o){let l=0,a=0;const h=Math.min(i-t,o-r);if(0===t&&0===r&&(l=function(e,t,s){for(let i=0;i<s;++i)if(e[i]!==t[i])return i;return s}(e,n,h)),i===e.length&&o===n.length&&(a=function(e,t,s){let i=e.length,n=t.length,r=0;for(;r<s&&e[--i]===t[--n];)r++;return r}(e,n,h-l)),r+=l,o-=a,(i-=a)-(t+=l)==0&&o-r==0)return s;if(t===i){const e=new b(t,[],0);for(;r<o;)e.removed.push(n[r++]);return[e]}if(r===o)return[new b(t,[],i-t)];const c=function(e){let t=e.length-1,s=e[0].length-1,i=e[t][s];const n=[];for(;t>0||s>0;){if(0===t){n.push(2),s--;continue}if(0===s){n.push(3),t--;continue}const r=e[t-1][s-1],o=e[t-1][s],l=e[t][s-1];let a;a=o<l?o<r?o:r:l<r?l:r,a===r?(r===i?n.push(0):(n.push(1),i=r),t--,s--):a===o?(n.push(3),t--,i=o):(n.push(2),s--,i=l)}return n.reverse()}(function(e,t,s,i,n,r){const o=r-n+1,l=s-t+1,a=new Array(o);let h,c;for(let e=0;e<o;++e)a[e]=new Array(l),a[e][0]=e;for(let e=0;e<l;++e)a[0][e]=e;for(let s=1;s<o;++s)for(let r=1;r<l;++r)e[t+r-1]===i[n+s-1]?a[s][r]=a[s-1][r-1]:(h=a[s-1][r]+1,c=a[s][r-1]+1,a[s][r]=h<c?h:c);return a}(e,t,i,n,r,o)),d=[];let u,f=t,p=r;for(let e=0;e<c.length;++e)switch(c[e]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,p++;break;case 1:void 0===u&&(u=new b(f,[],0)),u.addedCount++,f++,u.removed.push(n[p]),p++;break;case 2:void 0===u&&(u=new b(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=new b(f,[],0)),u.removed.push(n[p]),p++}return void 0!==u&&d.push(u),d}function C(e,t){let s=!1,i=0;for(let a=0;a<t.length;a++){const h=t[a];if(h.index+=i,s)continue;const c=(n=e.index,r=e.index+e.removed.length,o=h.index,l=h.index+h.addedCount,r<o||l<n?-1:r===o||l===n?0:n<o?r<l?r-o:l-o:l<r?l-n:r-n);if(c>=0){t.splice(a,1),a--,i-=h.addedCount-h.removed.length,e.addedCount+=h.addedCount-c;const n=e.removed.length+h.removed.length-c;if(e.addedCount||n){let t=h.removed;if(e.index<h.index){const s=e.removed.slice(0,h.index-e.index);s.push(...t),t=s}if(e.index+e.removed.length>h.index+h.addedCount){const s=e.removed.slice(h.index+h.addedCount-e.index);t.push(...s)}e.removed=t,h.index<e.index&&(e.index=h.index)}else s=!0}else if(e.index<h.index){s=!0,t.splice(a,0,e),a++;const n=e.addedCount-e.removed.length;h.index+=n,i+=n}}var n,r,o,l;s||t.push(e)}let x=Object.freeze({support:v.optimized,normalize:(e,t,i)=>void 0===e?void 0===i?s:i.length>1?function(e,t){let s=[];const i=[];for(let e=0,s=t.length;e<s;e++)C(t[e],i);for(let t=0,n=i.length;t<n;++t){const n=i[t];1!==n.addedCount||1!==n.removed.length?s=s.concat(w(e,n.index,n.index+n.addedCount,n.removed,0,n.removed.length)):n.removed[0]!==e[n.index]&&s.push(n)}return s}(t,i):i:m,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new b(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new b(e.length-i.length,[],i.length).adjustTo(e)),n},reverse(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},shift(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new b(0,[r],0)),r},sort(e,t,s,i){const n=s.apply(e,i);return t.reset(e),n},splice(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new b(+i[0],n,i.length>2?i.length-2:0).adjustTo(e)),n},unshift(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new b(0,[],i.length).adjustTo(e)),n}});const S=Object.freeze({reset:m,setDefaultStrategy(e){x=e}});function T(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class O extends a{constructor(e){super(e),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,T(e,"$fastController",this)}get strategy(){return this._strategy}set strategy(e){this._strategy=e}get lengthObserver(){let e=this._lengthObserver;if(void 0===e){const t=this.subject;this._lengthObserver=e={length:t.length,handleChange(){this.length!==t.length&&(this.length=t.length,d.notify(e,"length"))}},this.subscribe(e)}return e}subscribe(e){this.flush(),super.subscribe(e)}addSplice(e){void 0===this.splices?this.splices=[e]:this.splices.push(e),this.enqueue()}reset(e){this.oldCollection=e,this.enqueue()}flush(){var e;const t=this.splices,s=this.oldCollection;void 0===t&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(e=this._strategy)&&void 0!==e?e:x).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,l.enqueue(this))}}let B=!1;const A=Object.freeze({enable(){if(B)return;B=!0,d.setArrayObserverFactory((e=>new O(e)));const e=Array.prototype;e.$fastPatch||(T(e,"$fastPatch",1),[e.pop,e.push,e.reverse,e.shift,e.sort,e.splice,e.unshift].forEach((t=>{e[t.name]=function(...e){var s;const i=this.$fastController;return void 0===i?t.apply(this,e):(null!==(s=i.strategy)&&void 0!==s?s:x)[t.name](this,i,t,e)}})))}});function k(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(A.enable(),t=d.getNotifier(e)),d.track(t.lengthObserver,"length"),e.length}let j;function $(e){return e.map((e=>e instanceof I?$(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class I{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof I?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(j),this._strategy}addStylesTo(e){this.strategy.addStylesTo(e),this.targets.add(e)}removeStylesFrom(e){this.strategy.removeStylesFrom(e),this.targets.delete(e)}isAttachedTo(e){return this.targets.has(e)}withBehaviors(...e){return this.behaviors=null===this.behaviors?e:this.behaviors.concat(e),this}withStrategy(e){return this._strategy=new e($(this.styles)),this}static setDefaultStrategy(e){j=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new I(e):e instanceof I?e:new I([e])}}I.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;const V=i(),N=Object.freeze({getForInstance:V.getForInstance,getByType:V.getByType,define:e=>(V.register({type:e}),e)});function E(){return function(e){N.define(e)}}function _(e,t){const s=[];let i="";const n=[],r=e=>{n.push(e)};for(let n=0,o=e.length-1;n<o;++n){i+=e[n];let o=t[n];void 0!==N.getForInstance(o)&&(o=o.createCSS(r)),o instanceof I||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=e[e.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const L=(e,...t)=>{const{styles:s,behaviors:i}=_(e,t),n=new I(s);return i.length?n.withBehaviors(...i):n};class z{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(o(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new I(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}addedCallback(e){e.addStyles(this.styles)}removedCallback(e){e.removeStyles(this.styles)}}N.define(z);const F=L.partial=(e,...t)=>{const{styles:s,behaviors:i}=_(e,t);return new z(s,i)},M=Object.freeze({queueUpdate:l.enqueue,nextUpdate:l.next,processUpdates:l.process,setAttribute(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)},setBooleanAttribute(e,t,s){s?e.setAttribute(t,""):e.removeAttribute(t)}}),P=`fast-${Math.random().toString(36).substring(2,8)}`,R=`${P}{`,H=`}${P}`,q=H.length;let D=0;const U=()=>`${P}-${++D}`,Q=Object.freeze({interpolation:e=>`${R}${e}${H}`,attribute:e=>`${U()}="${R}${e}${H}"`,comment:e=>`\x3c!--${R}${e}${H}--\x3e`}),W=Object.freeze({parse(e,t){const s=e.split(R);if(1===s.length)return null;const i=[];for(let e=0,n=s.length;e<n;++e){const n=s[e],r=n.indexOf(H);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+q)}""!==o&&i.push(o)}return i}}),G=Object.freeze({create(e){const t=[],s={};let i=null,n=!1;return{source:e,context:g.default,targets:s,get isBound(){return n},addBehaviorFactory(e,t){const s=e.nodeId||(e.nodeId=U());e.id||(e.id=U()),this.addTarget(s,t),this.addBehavior(e.createBehavior())},addTarget(e,t){s[e]=t},addBehavior(e){t.push(e),n&&e.bind(this)},onUnbind(e){null===i&&(i=[]),i.push(e)},connectedCallback(e){n||(n=!0,t.forEach((e=>e.bind(this))))},disconnectedCallback(e){n&&(n=!1,null!==i&&i.forEach((e=>e.unbind(this))))}}}}),J=i(),K=Object.freeze({getForInstance:J.getForInstance,getByType:J.getByType,define:(e,t)=>((t=t||{}).type=e,J.register(t),e)});function X(e){return function(t){K.define(t,e)}}class Y{constructor(e,t=!1){this.evaluate=e,this.isVolatile=t}}const Z=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(e,t){if(t)switch(e.sourceAspect=t,t[0]){case":":e.targetAspect=t.substring(1),e.aspectType="classList"===e.targetAspect?Z.tokenList:Z.property;break;case"?":e.targetAspect=t.substring(1),e.aspectType=Z.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=Z.event;break;default:e.targetAspect=t,e.aspectType=Z.attribute}else e.aspectType=Z.content}});class ee{constructor(e){this.options=e,this.id=U()}createHTML(e){return Q.attribute(e(this))}createBehavior(){return this}}const te=globalThis.TrustedHTML?e=>(s,i)=>{const n=e(s,i);if(n instanceof TrustedHTML)return n;throw t.error(1202)}:e=>e;class se extends Y{createObserver(e,t){return d.binding(this.evaluate,t,this.isVolatile)}}class ie extends Y{createObserver(){return this}bind(e){return this.evaluate(e.source,e.context)}}function ne(e,t,s,i){if(null==s&&(s=""),s.create){e.textContent="";let t=e.$fastView;void 0===t?t=s.create():e.$fastTemplate!==s&&(t.isComposed&&(t.remove(),t.unbind()),t=s.create()),t.isComposed?t.needsBindOnly&&(t.needsBindOnly=!1,t.bind(i.source,i.context)):(t.isComposed=!0,t.bind(i.source,i.context),t.insertBefore(e),e.$fastView=t,e.$fastTemplate=s)}else{const t=e.$fastView;void 0!==t&&t.isComposed&&(t.isComposed=!1,t.remove(),t.needsBindOnly?t.needsBindOnly=!1:t.unbind()),e.textContent=s}}function re(e,t,s){var i;const n=`${this.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={v:0,cv:Object.create(null)},o=r.cv;let l=r.v;const a=e[t];if(null!=s&&s.length){const e=s.split(/\s+/);for(let t=0,s=e.length;t<s;++t){const s=e[t];""!==s&&(o[s]=l,a.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const e in o)o[e]===l&&a.remove(e)}}const oe=(e,t,s)=>e[t]=s,le=()=>{};class ae{constructor(e){this.dataBinding=e,this.updateTarget=null,this.id=U(),this.aspectType=Z.content,this.data=`${this.id}-d`}createHTML(e){return Q.interpolation(e(this))}createBehavior(){if(null===this.updateTarget)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=te(this.dataBinding.evaluate)),this.aspectType){case 1:this.updateTarget=M.setAttribute;break;case 2:this.updateTarget=M.setBooleanAttribute;break;case 3:this.updateTarget=oe;break;case 4:this.updateTarget=ne;break;case 5:this.updateTarget=re;break;case 6:this.updateTarget=le;break;default:throw t.error(1205)}return this}bind(e){var t;const s=e.targets[this.nodeId];switch(this.updateTarget){case le:s[this.data]=e,s.addEventListener(this.targetAspect,this,this.dataBinding.options);break;case ne:e.onUnbind(this);default:const i=null!==(t=s[this.data])&&void 0!==t?t:s[this.data]=this.dataBinding.createObserver(this,this);i.target=s,i.controller=e,this.updateTarget(s,this.targetAspect,i.bind(e),e)}}unbind(e){const t=e.targets[this.nodeId].$fastView;void 0!==t&&t.isComposed&&(t.unbind(),t.needsBindOnly=!0)}handleEvent(e){const t=e.currentTarget[this.data];if(t.isBound){g.setEvent(e);const s=this.dataBinding.evaluate(t.source,t.context);g.setEvent(null),!0!==s&&e.preventDefault()}}handleChange(e,t){const s=t.target,i=t.controller;this.updateTarget(s,this.targetAspect,t.bind(i),i)}}function he(e,t=d.isVolatileBinding(e)){return new se(e,t)}function ce(e){return new ie(e)}function de(e,t){const s=new se(e,!1);return s.options=t,s}function ue(e){return r(e)?he(e):e instanceof Y?e:ce((()=>e))}function fe(e,t){const s=e.parentNode;let i,n=e;for(;n!==t;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(t)}K.define(ae,{aspected:!0});class pe{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.unbindables=[],this.source=null,this.isBound=!1,this.sourceLifetime=c.unknown,this.context=this,this.index=0,this.length=0,this.firstChild=e.firstChild,this.lastChild=e.lastChild}get event(){return g.getEvent()}get isEven(){return this.index%2==0}get isOdd(){return this.index%2!=0}get isFirst(){return 0===this.index}get isInMiddle(){return!this.isFirst&&!this.isLast}get isLast(){return this.index===this.length-1}eventDetail(){return this.event.detail}eventTarget(){return this.event.target}appendTo(e){e.appendChild(this.fragment)}insertBefore(e){if(this.fragment.hasChildNodes())e.parentNode.insertBefore(this.fragment,e);else{const t=this.lastChild;if(e.previousSibling===t)return;const s=e.parentNode;let i,n=this.firstChild;for(;n!==t;)i=n.nextSibling,s.insertBefore(n,e),n=i;s.insertBefore(t,e)}}remove(){const e=this.fragment,t=this.lastChild;let s,i=this.firstChild;for(;i!==t;)s=i.nextSibling,e.appendChild(i),i=s;e.appendChild(t)}dispose(){fe(this.firstChild,this.lastChild),this.unbind()}onUnbind(e){this.unbindables.push(e)}bind(e,t=this){if(this.source===e)return;let s=this.behaviors;if(null===s){this.source=e,this.context=t,this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let e=0,t=i.length;e<t;++e){const t=i[e].createBehavior();t.bind(this),s[e]=t}}else{null!==this.source&&this.evaluateUnbindables(),this.isBound=!1,this.source=e,this.context=t;for(let e=0,t=s.length;e<t;++e)s[e].bind(this)}this.isBound=!0}unbind(){this.isBound&&null!==this.source&&(this.evaluateUnbindables(),this.source=null,this.context=this,this.isBound=!1)}evaluateUnbindables(){const e=this.unbindables;for(let t=0,s=e.length;t<s;++t)e[t].unbind(this);e.length=0}static disposeContiguousBatch(e){if(0!==e.length){fe(e[0].firstChild,e[e.length-1].lastChild);for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}}d.defineProperty(pe.prototype,"index"),d.defineProperty(pe.prototype,"length");const ge=(e,t)=>`${e}.${t}`,be={},ve={index:0,node:null};function ye(e){e.startsWith("fast-")||t.warn(1204,{name:e})}const me=new Proxy(document.createElement("div"),{get(e,t){ye(t);const s=Reflect.get(e,t);return r(s)?s.bind(e):s},set:(e,t,s)=>(ye(t),Reflect.set(e,t,s))});class we{constructor(e,t){this.fragment=e,this.directives=t,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(e,t,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(t,s,i)),e.nodeId=s,this.factories.push(e)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(e,t,s){const i=this.descriptors;if("r"===t||"h"===t||i[t])return;if(!i[e]){const t=e.lastIndexOf("."),s=e.substring(0,t),i=parseInt(e.substring(t+1));this.addTargetDescriptor(s,e,i)}let n=be[t];if(!n){const i=`_${t}`;be[t]=n={get(){var t;return null!==(t=this[i])&&void 0!==t?t:this[i]=this[e].childNodes[s]}}}i[t]=n}createView(e){const t=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=t,s.h=null!=e?e:me;for(const e of this.nodeIds)s[e];return new pe(t,this.factories,s)}}function Ce(e,t,s,i,n,r=!1){const o=s.attributes,l=e.directives;for(let a=0,h=o.length;a<h;++a){const c=o[a],d=c.value,u=W.parse(d,l);let f=null;null===u?r&&(f=new ae(ce((()=>d))),Z.assign(f,c.name)):f=Ae.aggregate(u),null!==f&&(s.removeAttributeNode(c),a--,h--,e.addFactory(f,t,i,n))}}function xe(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=Se(e,s,n,i);n=t.node,i=t.index}}function Se(e,t,s,i){const n=ge(t,i);switch(s.nodeType){case 1:Ce(e,t,s,n,i),xe(e,s,n);break;case 3:return function(e,t,s,i,n){const r=W.parse(t.textContent,e.directives);if(null===r)return ve.node=t.nextSibling,ve.index=n+1,ve;let l,a=l=t;for(let t=0,h=r.length;t<h;++t){const h=r[t];0!==t&&(n++,i=ge(s,n),l=a.parentNode.insertBefore(document.createTextNode(""),a.nextSibling)),o(h)?l.textContent=h:(l.textContent=" ",Z.assign(h),e.addFactory(h,s,i,n)),a=l}return ve.index=n+1,ve.node=a.nextSibling,ve}(e,s,t,n,i);case 8:const r=W.parse(s.data,e.directives);null!==r&&e.addFactory(Ae.aggregate(r),t,n,i)}return ve.index=i+1,ve.node=s.nextSibling,ve}const Te={createHTML:e=>e};let Oe=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Te):Te;const Be=Oe,Ae={setHTMLPolicy(e){if(Oe!==Be)throw t.error(1201);Oe=e},compile(e,t){let s;if(o(e)){s=document.createElement("TEMPLATE"),s.innerHTML=Oe.createHTML(e);const t=s.content.firstElementChild;null!==t&&"TEMPLATE"===t.tagName&&(s=t)}else s=e;const i=document.adoptNode(s.content),n=new we(i,t);return Ce(n,"",s,"h",0,!0),(function(e,t){return e&&8==e.nodeType&&null!==W.parse(e.data,t)}(i.firstChild,t)||1===i.childNodes.length&&Object.keys(t).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),xe(n,i,"r"),ve.node=null,n.freeze()},setDefaultStrategy(e){this.compile=e},aggregate(e){if(1===e.length)return e[0];let t,s,i=!1;const n=e.length,r=e.map((e=>o(e)?()=>e:(t=e.sourceAspect||t,s=e.dataBinding||s,i=i||e.dataBinding.isVolatile,e.dataBinding.evaluate)));s.evaluate=(e,t)=>{let s="";for(let i=0;i<n;++i)s+=r[i](e,t);return s},s.isVolatile=i;const l=new ae(s);return Z.assign(l,t),l}};class ke{constructor(e,t){this.result=null,this.html=e,this.factories=t}create(e){return null===this.result&&(this.result=Ae.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s){const i=this.create(s);return i.bind(e),i.appendTo(t),i}}const je=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function $e(e,t,s){const i=je.exec(t);return null!==i&&Z.assign(e,i[2]),e.createHTML(s)}function Ie(e,...t){let s="";const i=Object.create(null),n=e=>{var t;const s=null!==(t=e.id)&&void 0!==t?t:e.id=U();return i[s]=e,s};for(let i=0,l=e.length-1;i<l;++i){const l=e[i],a=t[i];let h;if(s+=l,r(a))s+=$e(new ae(he(a)),l,n);else if(o(a)){const e=je.exec(l);if(null!==e){const t=new ae(ce((()=>a)));Z.assign(t,e[2]),s+=t.createHTML(n)}else s+=a}else a instanceof Y?s+=$e(new ae(a),l,n):void 0===(h=K.getForInstance(a))?s+=$e(new ae(ce((()=>a))),l,n):h.aspected?s+=$e(a,l,n):s+=a.createHTML(n)}return new ke(s+e[e.length-1],i)}class Ve extends ee{bind(e){e.source[this.options]=e.targets[this.nodeId]}}K.define(Ve);const Ne=e=>new Ve(e);function Ee(e,t){const s=r(e)?e:()=>e,i=r(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const _e=Object.freeze({positioning:!1,recycle:!0});function Le(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.bind(t[s])}function ze(e,t,s,i){e.context.parent=i.source,e.context.parentContext=i.context,e.context.length=t.length,e.context.index=s,e.bind(t[s])}class Fe{constructor(e){this.directive=e,this.items=null,this.itemsObserver=null,this.bindView=Le,this.views=[],this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=ze)}bind(e){this.location=e.targets[this.directive.nodeId],this.controller=e,this.items=this.itemsBindingObserver.bind(e),this.template=this.templateBindingObserver.bind(e),this.observeItems(!0),this.refreshAllViews(),e.onUnbind(this)}unbind(){null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.bind(this.controller),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.bind(this.controller),this.refreshAllViews(!0);else{if(!t[0])return;t[0].reset?this.refreshAllViews():this.updateViews(t)}}observeItems(e=!1){if(!this.items)return void(this.items=s);const t=this.itemsObserver,i=this.itemsObserver=d.getNotifier(this.items),n=t!==i;n&&null!==t&&t.unsubscribe(this),(n||e)&&i.subscribe(this)}updateViews(e){const t=this.views,s=this.bindView,i=this.items,n=this.template,r=this.controller,o=this.directive.options.recycle,l=[];let a=0,h=0;for(let c=0,d=e.length;c<d;++c){const d=e[c],u=d.removed;let f=0,p=d.index;const g=p+d.addedCount,b=t.splice(d.index,u.length),v=h=l.length+b.length;for(;p<g;++p){const e=t[p],c=e?e.firstChild:this.location;let d;o&&h>0?(f<=v&&b.length>0?(d=b[f],f++):(d=l[a],a++),h--):d=n.create(),t.splice(p,0,d),s(d,i,p,r),d.insertBefore(c)}b[f]&&l.push(...b.slice(f))}for(let e=a,t=l.length;e<t;++e)l[e].dispose();if(this.directive.options.positioning)for(let e=0,s=t.length;e<s;++e){const i=t[e].context;i.length=s,i.index=e}}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.controller;let o=t.length,l=this.views,a=l.length;if(0!==o&&!e&&this.directive.options.recycle||(pe.disposeContiguousBatch(l),a=0),0===a){this.views=l=new Array(o);for(let e=0;e<o;++e){const o=s.create();n(o,t,e,r),l[e]=o,o.insertBefore(i)}}else{let e=0;for(;e<o;++e)if(e<a){n(l[e],t,e,r)}else{const o=s.create();n(o,t,e,r),l.push(o),o.insertBefore(i)}const h=l.splice(e,a-e);for(e=0,o=h.length;e<o;++e)h[e].dispose()}}unbindAllViews(){const e=this.views;for(let t=0,s=e.length;t<s;++t)e[t].unbind()}}class Me{constructor(e,t,s){this.dataBinding=e,this.templateBinding=t,this.options=s,this.id=U(),A.enable()}createHTML(e){return Q.comment(e(this))}createBehavior(){return new Fe(this)}}function Pe(e,t,s=_e){const i=ue(e),n=ue(t);return new Me(i,n,Object.assign(Object.assign({},_e),s))}K.define(Me);const Re=e=>1===e.nodeType,He=e=>e?t=>1===t.nodeType&&t.matches(e):Re;class qe extends ee{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e){const t=e.targets[this.nodeId];t[this.sourceProperty]=e.source,this.updateTarget(e.source,this.computeNodes(t)),this.observe(t),e.onUnbind(this)}unbind(e){const t=e.targets[this.nodeId];this.updateTarget(e.source,s),this.disconnect(t),t[this.sourceProperty]=null}getSource(e){return e[this.sourceProperty]}updateTarget(e,t){e[this.options.property]=t}computeNodes(e){let t=this.getNodes(e);return"filter"in this.options&&(t=t.filter(this.options.filter)),t}}class De extends qe{observe(e){e.addEventListener("slotchange",this)}disconnect(e){e.removeEventListener("slotchange",this)}getNodes(e){return e.assignedNodes(this.options)}handleEvent(e){const t=e.currentTarget;this.updateTarget(this.getSource(t),this.computeNodes(t))}}function Ue(e){return o(e)&&(e={property:e}),new De(e)}K.define(De);class Qe extends qe{constructor(e){super(e),this.observerProperty=`${this.id}-o`,this.handleEvent=(e,t)=>{const s=t.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},e.childList=!0}observe(e){var t;const s=null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=e,s.observe(e,this.options)}disconnect(e){const t=e[this.observerProperty];t.target=null,t.disconnect()}getNodes(e){return"selector"in this.options?Array.from(e.querySelectorAll(this.options.selector)):Array.from(e.childNodes)}}function We(e){return o(e)&&(e={property:e}),new Qe(e)}K.define(Qe);const Ge=Object.freeze({locate:n()}),Je={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function Ke(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const Xe={toView(e){const t=Ke(e);return t?t.toString():t},fromView:Ke};class Ye{constructor(e,t,s=t.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=e,this.name=t,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${t}`,this.callbackName=`${t}Changed`,this.hasCallback=this.callbackName in e.prototype,"boolean"===i&&void 0===n&&(this.converter=Je)}setValue(e,t){const s=e[this.fieldName],i=this.converter;void 0!==i&&(t=i.fromView(t)),s!==t&&(e[this.fieldName]=t,this.tryReflectToAttribute(e),this.hasCallback&&e[this.callbackName](s,t),e.$fastController.notify(this.name))}getValue(e){return d.track(e,this.name),e[this.fieldName]}onAttributeChangedCallback(e,t){this.guards.has(e)||(this.guards.add(e),this.setValue(e,t),this.guards.delete(e))}tryReflectToAttribute(e){const t=this.mode,s=this.guards;s.has(e)||"fromView"===t||l.enqueue((()=>{s.add(e);const i=e[this.fieldName];switch(t){case"reflect":const t=this.converter;M.setAttribute(e,this.attribute,void 0!==t?t.toView(i):i);break;case"boolean":M.setBooleanAttribute(e,this.attribute,i)}s.delete(e)}))}static collect(e,...t){const s=[];t.push(Ge.locate(e));for(let i=0,n=t.length;i<n;++i){const n=t[i];if(void 0!==n)for(let t=0,i=n.length;t<i;++t){const i=n[t];o(i)?s.push(new Ye(e,i)):s.push(new Ye(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function Ze(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t),Ge.locate(e.constructor).push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const et={mode:"open"},tt={},st=new Set,it=t.getById(4,(()=>i()));class nt{constructor(e,t=e.definition){var s;this.platformDefined=!1,o(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template,this.registry=null!==(s=t.registry)&&void 0!==s?s:customElements;const i=e.prototype,n=Ye.collect(e,t.attributes),r=new Array(n.length),l={},a={};for(let e=0,t=n.length;e<t;++e){const t=n[e];r[e]=t.attribute,l[t.name]=t,a[t.attribute]=t,d.defineProperty(i,t)}Reflect.defineProperty(e,"observedAttributes",{value:r,enumerable:!0}),this.attributes=n,this.propertyLookup=l,this.attributeLookup=a,this.shadowOptions=void 0===t.shadowOptions?et:null===t.shadowOptions?void 0:Object.assign(Object.assign({},et),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?tt:Object.assign(Object.assign({},tt),t.elementOptions),this.styles=I.normalize(t.styles),it.register(this)}get isDefined(){return this.platformDefined}define(e=this.registry){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){return st.has(e)||it.getByType(e)?new nt(class extends e{},t):new nt(e,t)}static registerBaseType(e){st.add(e)}}nt.getByType=it.getByType,nt.getForInstance=it.getForInstance;const rt={bubbles:!0,composed:!0,cancelable:!0},ot=new WeakMap;function lt(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:ot.get(e))&&void 0!==s?s:null}let at;class ht extends h{constructor(e,t){super(e),this.boundObservables=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._isConnected=!1,this.behaviors=null,this._mainStyles=null,this.$fastController=this,this.view=null,this.source=e,this.definition=t;const s=t.shadowOptions;if(void 0!==s){let t=e.shadowRoot;t?this.hasExistingShadowRoot=!0:(t=e.attachShadow(s),"closed"===s.mode&&ot.set(e,t))}const i=d.getAccessors(e);if(i.length>0){const t=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=e[n];void 0!==r&&(delete e[n],t[n]=r)}}}get isConnected(){return d.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,d.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.source.resolveTemplate?this._template=this.source.resolveTemplate():t.template&&(this._template=null!==(e=t.template)&&void 0!==e?e:null)}return this._template}set template(e){this._template!==e&&(this._template=e,this.needsInitialization||this.renderTemplate(e))}get mainStyles(){var e;if(null===this._mainStyles){const t=this.definition;this.source.resolveStyles?this._mainStyles=this.source.resolveStyles():t.styles&&(this._mainStyles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._mainStyles}set mainStyles(e){this._mainStyles!==e&&(null!==this._mainStyles&&this.removeStyles(this._mainStyles),this._mainStyles=e,this.needsInitialization||this.addStyles(e))}addBehavior(e){var t,s;const i=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,n=null!==(s=i.get(e))&&void 0!==s?s:0;0===n?(i.set(e,1),e.addedCallback&&e.addedCallback(this),e.connectedCallback&&this.isConnected&&e.connectedCallback(this)):i.set(e,n+1)}removeBehavior(e,t=!1){const s=this.behaviors;if(null===s)return;const i=s.get(e);void 0!==i&&(1===i||t?(s.delete(e),e.disconnectedCallback&&this.isConnected&&e.disconnectedCallback(this),e.removedCallback&&e.removedCallback(this)):s.set(e,i-1))}addStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=lt(s))&&void 0!==t?t:this.source).append(e)}else if(!e.isAttachedTo(s)){const t=e.behaviors;if(e.addStylesTo(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}removeStyles(e){var t;if(!e)return;const s=this.source;if(e instanceof HTMLElement){(null!==(t=lt(s))&&void 0!==t?t:s).removeChild(e)}else if(e.isAttachedTo(s)){const t=e.behaviors;if(e.removeStylesFrom(s),null!==t)for(let e=0,s=t.length;e<s;++e)this.addBehavior(t[e])}}connect(){if(this._isConnected)return;if(null!==this.boundObservables){const e=this.source,t=this.boundObservables,s=Object.keys(t);for(let i=0,n=s.length;i<n;++i){const n=s[i];e[n]=t[n]}this.boundObservables=null}const e=this.behaviors;if(null!==e)for(const t of e.keys())t.connectedCallback&&t.connectedCallback(this);this.needsInitialization?(this.renderTemplate(this.template),this.addStyles(this.mainStyles),this.needsInitialization=!1):null!==this.view&&this.view.bind(this.source),this.setIsConnected(!0)}disconnect(){if(!this._isConnected)return;this.setIsConnected(!1),null!==this.view&&this.view.unbind();const e=this.behaviors;if(null!==e)for(const t of e.keys())t.disconnectedCallback&&t.disconnectedCallback(this)}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.source,s)}emit(e,t,s){return!!this._isConnected&&this.source.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},rt),s)))}renderTemplate(e){var t;const s=this.source,i=null!==(t=lt(s))&&void 0!==t?t:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let e=i.firstChild;null!==e;e=i.firstChild)i.removeChild(e)}e&&(this.view=e.render(s,i,s),this.view.sourceLifetime=c.coupled)}static forCustomElement(e){const s=e.$fastController;if(void 0!==s)return s;const i=nt.getForInstance(e);if(void 0===i)throw t.error(1401);return e.$fastController=new at(e,i)}static setStrategy(e){at=e}}function ct(e){var t;return"adoptedStyleSheets"in e?e:null!==(t=lt(e))&&void 0!==t?t:e.getRootNode()}ht.setStrategy(ht);class dt{constructor(e){const t=dt.styleSheetCache;this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let s=t.get(e);return void 0===s&&(s=new CSSStyleSheet,s.replaceSync(e),t.set(e,s)),s}))}addStylesTo(e){const t=ct(e);t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=ct(e),s=this.sheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter((e=>-1===s.indexOf(e)))}}dt.styleSheetCache=new Map;let ut=0;function ft(e){return e===document?document.body:e}function pt(e){const t=class extends e{constructor(){super(),ht.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.connect()}disconnectedCallback(){this.$fastController.disconnect()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}};return nt.registerBaseType(t),t}function gt(e,t){return r(e)?nt.compose(e,t).define().type:nt.compose(this,e).define().type}I.setDefaultStrategy(I.supportsAdoptedStyleSheets?dt:class{constructor(e){this.styles=e,this.styleClass="fast-"+ ++ut}addStylesTo(e){e=ft(ct(e));const t=this.styles,s=this.styleClass;for(let i=0;i<t.length;i++){const n=document.createElement("style");n.innerHTML=t[i],n.className=s,e.append(n)}}removeStylesFrom(e){const t=(e=ft(ct(e))).querySelectorAll(`.${this.styleClass}`);t[0].parentNode;for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}});const bt=Object.assign(pt(HTMLElement),{from:function(e){return pt(e)},define:gt,compose:function(e,t){return r(e)?nt.compose(e,t):nt.compose(this,e)}});function vt(e){return function(t){gt(t,e)}}export{A as ArrayObserver,Z as Aspect,Ge as AttributeConfiguration,Ye as AttributeDefinition,Y as Binding,N as CSSDirective,Qe as ChildrenDirective,Ae as Compiler,M as DOM,ht as ElementController,I as ElementStyles,g as ExecutionContext,t as FAST,bt as FASTElement,nt as FASTElementDefinition,ae as HTMLBindingDirective,K as HTMLDirective,pe as HTMLView,Q as Markup,qe as NodeObservationDirective,d as Observable,W as Parser,h as PropertyChangeNotifier,Ve as RefDirective,Fe as RepeatBehavior,Me as RepeatDirective,De as SlottedDirective,c as SourceLifetime,b as Splice,S as SpliceStrategy,v as SpliceStrategySupport,ee as StatelessAttachedAttributeDirective,a as SubscriberSet,l as Updates,G as ViewBehaviorOrchestrator,ke as ViewTemplate,Ze as attr,he as bind,Je as booleanConverter,We as children,n as createMetadataLocator,i as createTypeRegistry,L as css,E as cssDirective,F as cssPartial,vt as customElement,He as elements,s as emptyArray,Ie as html,X as htmlDirective,k as lengthOf,de as listener,ue as normalizeBinding,Xe as nullableNumberConverter,u as observable,ce as oneTime,Ne as ref,Pe as repeat,Ue as slotted,f as volatile,Ee as when}; |
@@ -261,2 +261,3 @@ ## API Report File for "@microsoft/fast-element" | ||
removeStyles(styles: ElementStyles | HTMLStyleElement | null | undefined): void; | ||
static setStrategy(strategy: ElementControllerStrategy): void; | ||
readonly source: TElement; | ||
@@ -269,2 +270,8 @@ get template(): ElementViewTemplate<TElement> | null; | ||
// @public | ||
export interface ElementControllerStrategy { | ||
// (undocumented) | ||
new (element: HTMLElement, definition: FASTElementDefinition): ElementController; | ||
} | ||
// @public | ||
export const elements: (selector?: string) => ElementsFilter; | ||
@@ -271,0 +278,0 @@ |
{ | ||
"name": "@microsoft/fast-element", | ||
"description": "A library for constructing Web Components", | ||
"version": "2.0.0-beta.14", | ||
"version": "2.0.0-beta.15", | ||
"author": { | ||
@@ -69,2 +69,10 @@ "name": "Microsoft", | ||
}, | ||
"./element-hydration": { | ||
"types": "./dist/dts/components/hydration.d.ts", | ||
"default": "./dist/esm/components/hydration.js" | ||
}, | ||
"./install-element-hydration": { | ||
"types": "./dist/dts/components/install-hydration.d.ts", | ||
"default": "./dist/esm/components/install-hydration.js" | ||
}, | ||
"./pending-task": { | ||
@@ -79,3 +87,4 @@ "types": "./dist/dts/pending-task.d.ts", | ||
"./dist/esm/debug.js", | ||
"./dist/esm/polyfills.js" | ||
"./dist/esm/polyfills.js", | ||
"./dist/esm/components/install-hydration.js" | ||
], | ||
@@ -82,0 +91,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1820552
128
45021