@microsoft/fast-element 2.0.0-beta.4 → 2.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -474,8 +474,13 @@ const Observable = FAST.getById(2 /* KernelServiceId.observable */, () => {
474
474
  const previousWatcher = watcher;
475
475
  watcher = this.needsRefresh ? this : void 0;
476
476
  this.needsRefresh = this.isVolatileBinding;
477
- const result = this.binding(source, context !== null && context !== void 0 ? context : ExecutionContext.default);
478
- watcher = previousWatcher;
477
+ let result;
478
+ try {
479
+ result = this.binding(source, context !== null && context !== void 0 ? context : ExecutionContext.default);
480
+ }
481
+ finally {
482
+ watcher = previousWatcher;
483
+ }
479
484
  return result;
480
485
  }
481
486
  dispose() {
@@ -845,10 +850,311 @@ const SpliceStrategySupport = Object.freeze({
845
850
  const reset = new Splice(0, emptyArray, 0);
846
851
  reset.reset = true;
847
852
  const resetSplices = [reset];
853
+ // Note: This function is *based* on the computation of the Levenshtein
854
+ // "edit" distance. The one change is that "updates" are treated as two
855
+ // edits - not one. With Array splices, an update is really a delete
856
+ // followed by an add. By retaining this, we optimize for "keeping" the
857
+ // maximum array items in the original array. For example:
858
+ //
859
+ // 'xxxx123' to '123yyyy'
860
+ //
861
+ // With 1-edit updates, the shortest path would be just to update all seven
862
+ // characters. With 2-edit updates, we delete 4, leave 3, and add 4. This
863
+ // leaves the substring '123' intact.
864
+ function calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd) {
865
+ // "Deletion" columns
866
+ const rowCount = oldEnd - oldStart + 1;
867
+ const columnCount = currentEnd - currentStart + 1;
868
+ const distances = new Array(rowCount);
869
+ let north;
870
+ let west;
871
+ // "Addition" rows. Initialize null column.
872
+ for (let i = 0; i < rowCount; ++i) {
873
+ distances[i] = new Array(columnCount);
874
+ distances[i][0] = i;
875
+ }
876
+ // Initialize null row
877
+ for (let j = 0; j < columnCount; ++j) {
878
+ distances[0][j] = j;
879
+ }
880
+ for (let i = 1; i < rowCount; ++i) {
881
+ for (let j = 1; j < columnCount; ++j) {
882
+ if (current[currentStart + j - 1] === old[oldStart + i - 1]) {
883
+ distances[i][j] = distances[i - 1][j - 1];
884
+ }
885
+ else {
886
+ north = distances[i - 1][j] + 1;
887
+ west = distances[i][j - 1] + 1;
888
+ distances[i][j] = north < west ? north : west;
889
+ }
890
+ }
891
+ }
892
+ return distances;
893
+ }
894
+ // This starts at the final weight, and walks "backward" by finding
895
+ // the minimum previous weight recursively until the origin of the weight
896
+ // matrix.
897
+ function spliceOperationsFromEditDistances(distances) {
898
+ let i = distances.length - 1;
899
+ let j = distances[0].length - 1;
900
+ let current = distances[i][j];
901
+ const edits = [];
902
+ while (i > 0 || j > 0) {
903
+ if (i === 0) {
904
+ edits.push(2 /* Edit.add */);
905
+ j--;
906
+ continue;
907
+ }
908
+ if (j === 0) {
909
+ edits.push(3 /* Edit.delete */);
910
+ i--;
911
+ continue;
912
+ }
913
+ const northWest = distances[i - 1][j - 1];
914
+ const west = distances[i - 1][j];
915
+ const north = distances[i][j - 1];
916
+ let min;
917
+ if (west < north) {
918
+ min = west < northWest ? west : northWest;
919
+ }
920
+ else {
921
+ min = north < northWest ? north : northWest;
922
+ }
923
+ if (min === northWest) {
924
+ if (northWest === current) {
925
+ edits.push(0 /* Edit.leave */);
926
+ }
927
+ else {
928
+ edits.push(1 /* Edit.update */);
929
+ current = northWest;
930
+ }
931
+ i--;
932
+ j--;
933
+ }
934
+ else if (min === west) {
935
+ edits.push(3 /* Edit.delete */);
936
+ i--;
937
+ current = west;
938
+ }
939
+ else {
940
+ edits.push(2 /* Edit.add */);
941
+ j--;
942
+ current = north;
943
+ }
944
+ }
945
+ return edits.reverse();
946
+ }
947
+ function sharedPrefix(current, old, searchLength) {
948
+ for (let i = 0; i < searchLength; ++i) {
949
+ if (current[i] !== old[i]) {
950
+ return i;
951
+ }
952
+ }
953
+ return searchLength;
954
+ }
955
+ function sharedSuffix(current, old, searchLength) {
956
+ let index1 = current.length;
957
+ let index2 = old.length;
958
+ let count = 0;
959
+ while (count < searchLength && current[--index1] === old[--index2]) {
960
+ count++;
961
+ }
962
+ return count;
963
+ }
964
+ function intersect(start1, end1, start2, end2) {
965
+ // Disjoint
966
+ if (end1 < start2 || end2 < start1) {
967
+ return -1;
968
+ }
969
+ // Adjacent
970
+ if (end1 === start2 || end2 === start1) {
971
+ return 0;
972
+ }
973
+ // Non-zero intersect, span1 first
974
+ if (start1 < start2) {
975
+ if (end1 < end2) {
976
+ return end1 - start2; // Overlap
977
+ }
978
+ return end2 - start2; // Contained
979
+ }
980
+ // Non-zero intersect, span2 first
981
+ if (end2 < end1) {
982
+ return end2 - start1; // Overlap
983
+ }
984
+ return end1 - start1; // Contained
985
+ }
986
+ /**
987
+ * @remarks
988
+ * Lacking individual splice mutation information, the minimal set of
989
+ * splices can be synthesized given the previous state and final state of an
990
+ * array. The basic approach is to calculate the edit distance matrix and
991
+ * choose the shortest path through it.
992
+ *
993
+ * Complexity: O(l * p)
994
+ * l: The length of the current array
995
+ * p: The length of the old array
996
+ */
997
+ function calc(current, currentStart, currentEnd, old, oldStart, oldEnd) {
998
+ let prefixCount = 0;
999
+ let suffixCount = 0;
1000
+ const minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
1001
+ if (currentStart === 0 && oldStart === 0) {
1002
+ prefixCount = sharedPrefix(current, old, minLength);
1003
+ }
1004
+ if (currentEnd === current.length && oldEnd === old.length) {
1005
+ suffixCount = sharedSuffix(current, old, minLength - prefixCount);
1006
+ }
1007
+ currentStart += prefixCount;
1008
+ oldStart += prefixCount;
1009
+ currentEnd -= suffixCount;
1010
+ oldEnd -= suffixCount;
1011
+ if (currentEnd - currentStart === 0 && oldEnd - oldStart === 0) {
1012
+ return emptyArray;
1013
+ }
1014
+ if (currentStart === currentEnd) {
1015
+ const splice = new Splice(currentStart, [], 0);
1016
+ while (oldStart < oldEnd) {
1017
+ splice.removed.push(old[oldStart++]);
1018
+ }
1019
+ return [splice];
1020
+ }
1021
+ else if (oldStart === oldEnd) {
1022
+ return [new Splice(currentStart, [], currentEnd - currentStart)];
1023
+ }
1024
+ const ops = spliceOperationsFromEditDistances(calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd));
1025
+ const splices = [];
1026
+ let splice = void 0;
1027
+ let index = currentStart;
1028
+ let oldIndex = oldStart;
1029
+ for (let i = 0; i < ops.length; ++i) {
1030
+ switch (ops[i]) {
1031
+ case 0 /* Edit.leave */:
1032
+ if (splice !== void 0) {
1033
+ splices.push(splice);
1034
+ splice = void 0;
1035
+ }
1036
+ index++;
1037
+ oldIndex++;
1038
+ break;
1039
+ case 1 /* Edit.update */:
1040
+ if (splice === void 0) {
1041
+ splice = new Splice(index, [], 0);
1042
+ }
1043
+ splice.addedCount++;
1044
+ index++;
1045
+ splice.removed.push(old[oldIndex]);
1046
+ oldIndex++;
1047
+ break;
1048
+ case 2 /* Edit.add */:
1049
+ if (splice === void 0) {
1050
+ splice = new Splice(index, [], 0);
1051
+ }
1052
+ splice.addedCount++;
1053
+ index++;
1054
+ break;
1055
+ case 3 /* Edit.delete */:
1056
+ if (splice === void 0) {
1057
+ splice = new Splice(index, [], 0);
1058
+ }
1059
+ splice.removed.push(old[oldIndex]);
1060
+ oldIndex++;
1061
+ break;
1062
+ // no default
1063
+ }
1064
+ }
1065
+ if (splice !== void 0) {
1066
+ splices.push(splice);
1067
+ }
1068
+ return splices;
1069
+ }
1070
+ function merge(splice, splices) {
1071
+ let inserted = false;
1072
+ let insertionOffset = 0;
1073
+ for (let i = 0; i < splices.length; i++) {
1074
+ const current = splices[i];
1075
+ current.index += insertionOffset;
1076
+ if (inserted) {
1077
+ continue;
1078
+ }
1079
+ const intersectCount = intersect(splice.index, splice.index + splice.removed.length, current.index, current.index + current.addedCount);
1080
+ if (intersectCount >= 0) {
1081
+ // Merge the two splices
1082
+ splices.splice(i, 1);
1083
+ i--;
1084
+ insertionOffset -= current.addedCount - current.removed.length;
1085
+ splice.addedCount += current.addedCount - intersectCount;
1086
+ const deleteCount = splice.removed.length + current.removed.length - intersectCount;
1087
+ if (!splice.addedCount && !deleteCount) {
1088
+ // merged splice is a noop. discard.
1089
+ inserted = true;
1090
+ }
1091
+ else {
1092
+ let currentRemoved = current.removed;
1093
+ if (splice.index < current.index) {
1094
+ // some prefix of splice.removed is prepended to current.removed.
1095
+ const prepend = splice.removed.slice(0, current.index - splice.index);
1096
+ prepend.push(...currentRemoved);
1097
+ currentRemoved = prepend;
1098
+ }
1099
+ if (splice.index + splice.removed.length >
1100
+ current.index + current.addedCount) {
1101
+ // some suffix of splice.removed is appended to current.removed.
1102
+ const append = splice.removed.slice(current.index + current.addedCount - splice.index);
1103
+ currentRemoved.push(...append);
1104
+ }
1105
+ splice.removed = currentRemoved;
1106
+ if (current.index < splice.index) {
1107
+ splice.index = current.index;
1108
+ }
1109
+ }
1110
+ }
1111
+ else if (splice.index < current.index) {
1112
+ // Insert splice here.
1113
+ inserted = true;
1114
+ splices.splice(i, 0, splice);
1115
+ i++;
1116
+ const offset = splice.addedCount - splice.removed.length;
1117
+ current.index += offset;
1118
+ insertionOffset += offset;
1119
+ }
1120
+ }
1121
+ if (!inserted) {
1122
+ splices.push(splice);
1123
+ }
1124
+ }
1125
+ function project(array, changes) {
1126
+ let splices = [];
1127
+ const initialSplices = [];
1128
+ for (let i = 0, ii = changes.length; i < ii; i++) {
1129
+ merge(changes[i], initialSplices);
1130
+ }
1131
+ for (let i = 0, ii = initialSplices.length; i < ii; ++i) {
1132
+ const splice = initialSplices[i];
1133
+ if (splice.addedCount === 1 && splice.removed.length === 1) {
1134
+ if (splice.removed[0] !== array[splice.index]) {
1135
+ splices.push(splice);
1136
+ }
1137
+ continue;
1138
+ }
1139
+ splices = splices.concat(calc(array, splice.index, splice.index + splice.addedCount, splice.removed, 0, splice.removed.length));
1140
+ }
1141
+ return splices;
1142
+ }
1143
+ /**
1144
+ * A SpliceStrategy that attempts to merge all splices into the minimal set of
1145
+ * splices needed to represent the change from the old array to the new array.
1146
+ * @public
1147
+ */
848
1148
  let defaultSpliceStrategy = Object.freeze({
849
- support: SpliceStrategySupport.splice,
1149
+ support: SpliceStrategySupport.optimized,
850
1150
  normalize(previous, current, changes) {
851
- return previous === void 0 ? changes !== null && changes !== void 0 ? changes : emptyArray : resetSplices;
1151
+ if (previous === void 0) {
1152
+ if (changes === void 0) {
1153
+ return emptyArray;
1154
+ }
1155
+ return changes.length > 1 ? project(current, changes) : changes;
1156
+ }
1157
+ return resetSplices;
852
1158
  },
853
1159
  pop(array, observer, pop, args) {
854
1160
  const notEmpty = array.length > 0;
@@ -2014,8 +2320,10 @@ class HTMLView {
2014
2320
  node.parentNode.insertBefore(this.fragment, node);
2015
2321
  }
2016
2322
  else {
2017
- const parentNode = node.parentNode;
2018
2323
  const end = this.lastChild;
2324
+ if (node.previousSibling === end)
2325
+ return;
2326
+ const parentNode = node.parentNode;
2019
2327
  let current = this.firstChild;
2020
2328
  let next;
2021
2329
  while (current !== end) {
@@ -2637,6 +2945,9 @@ class RepeatBehavior {
2637
2945
  this.template = this.templateBindingObserver.observe(this.source, this.context);
2638
2946
  this.refreshAllViews(true);
2639
2947
  }
2948
+ else if (!args[0]) {
2949
+ return;
2950
+ }
2640
2951
  else if (args[0].reset) {
2641
2952
  this.refreshAllViews();
2642
2953
  }
@@ -2812,7 +3123,7 @@ HTMLDirective.define(RepeatDirective);
2812
3123
  function repeat(items, template, options = defaultRepeatOptions) {
2813
3124
  const dataBinding = normalizeBinding(items);
2814
3125
  const templateBinding = normalizeBinding(template);
2815
- return new RepeatDirective(dataBinding, templateBinding, options);
3126
+ return new RepeatDirective(dataBinding, templateBinding, Object.assign(Object.assign({}, defaultRepeatOptions), options));
2816
3127
  }
2817
3128
 
2818
3129
  const selectElements = (value) => value.nodeType === 1;
@@ -3700,6 +4011,9 @@ function define(type, nameOrDef) {
3700
4011
  }
3701
4012
  return FASTElementDefinition.compose(this, type).define().type;
3702
4013
  }
4014
+ function from(BaseType) {
4015
+ return createFASTElement(BaseType);
4016
+ }
3703
4017
  /**
3704
4018
  * A minimal base class for FASTElements that also provides
3705
4019
  * static helpers for working with FASTElements.
@@ -3711,9 +4025,7 @@ const FASTElement = Object.assign(createFASTElement(HTMLElement), {
3711
4025
  * provided base type.
3712
4026
  * @param BaseType - The base element type to inherit from.
3713
4027
  */
3714
- from(BaseType) {
3715
- return createFASTElement(BaseType);
3716
- },
4028
+ from,
3717
4029
  /**
3718
4030
  * Defines a platform custom element based on the provided type and definition.
3719
4031
  * @param type - The custom element type to define.
@@ -1 +1 @@
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 t=new Function("return this")();t.globalThis=t}}(),globalThis.trustedTypes||(globalThis.trustedTypes={createPolicy:(t,e)=>e});const t={configurable:!1,enumerable:!1,writable:!1};void 0===globalThis.FAST&&Reflect.defineProperty(globalThis,"FAST",Object.assign({value:Object.create(null)},t));const e=globalThis.FAST;if(void 0===e.getById){const s=Object.create(null);Reflect.defineProperty(e,"getById",Object.assign({value(t,e){let i=s[t];return void 0===i&&(i=e?s[t]=e():null),i}},t))}const s=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;function i(t){return t===document?document.body:t}let n=0;class r{constructor(t){this.styles=t,this.styleClass="fast-"+ ++n}addStylesTo(t){t=i(t);const e=this.styles,s=this.styleClass;for(let i=0;i<e.length;i++){const n=document.createElement("style");n.innerHTML=e[i],n.className=s,t.append(n)}}removeStylesFrom(t){const e=t.querySelectorAll(`.${this.styleClass}`);t=i(t);for(let s=0,i=e.length;s<i;++s)t.removeChild(e[s])}}s||e.getById(5,(()=>r));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 t=Object.create(null);Reflect.defineProperty(l,"getById",Object.assign({value(e,s){let i=t[e];return void 0===i&&(i=s?t[e]=s():null),i}},o))}void 0===l.error&&Object.assign(l,{warn(){},error:t=>new Error(`Error ${t}`),addMessages(){}});const h=Object.freeze([]);function a(){const t=new Map;return Object.freeze({register:e=>!t.has(e.type)&&(t.set(e.type,e),!0),getByType:e=>t.get(e),getForInstance:e=>t.get(e.constructor)})}const c=t=>"function"==typeof t,d=t=>"string"==typeof t,u=l.getById(1,(()=>{const t=[],e=[],s=globalThis.requestAnimationFrame;let i=!0;function n(){if(e.length)throw e.shift()}function r(s){try{s.call()}catch(s){if(!i)throw t.length=0,s;e.push(s),setTimeout(n,0)}}function o(){let e=0;for(;e<t.length;)if(r(t[e]),e++,e>1024){for(let s=0,i=t.length-e;s<i;s++)t[s]=t[s+e];t.length-=e,e=0}t.length=0}function l(e){t.push(e),t.length<2&&(i?s(o):o())}return Object.freeze({enqueue:l,next:()=>new Promise(l),process:o,setMode:t=>i=t})}));class f{constructor(t,e){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.subject=t,this.sub1=e}has(t){return void 0===this.spillover?this.sub1===t||this.sub2===t:-1!==this.spillover.indexOf(t)}subscribe(t){const e=this.spillover;if(void 0===e){if(this.has(t))return;if(void 0===this.sub1)return void(this.sub1=t);if(void 0===this.sub2)return void(this.sub2=t);this.spillover=[this.sub1,this.sub2,t],this.sub1=void 0,this.sub2=void 0}else{-1===e.indexOf(t)&&e.push(t)}}unsubscribe(t){const e=this.spillover;if(void 0===e)this.sub1===t?this.sub1=void 0:this.sub2===t&&(this.sub2=void 0);else{const s=e.indexOf(t);-1!==s&&e.splice(s,1)}}notify(t){const e=this.spillover,s=this.subject;if(void 0===e){const e=this.sub1,i=this.sub2;void 0!==e&&e.handleChange(s,t),void 0!==i&&i.handleChange(s,t)}else for(let i=0,n=e.length;i<n;++i)e[i].handleChange(s,t)}}class p{constructor(t){this.subscribers={},this.subjectSubscribers=null,this.subject=t}notify(t){var e,s;null===(e=this.subscribers[t])||void 0===e||e.notify(t),null===(s=this.subjectSubscribers)||void 0===s||s.notify(t)}subscribe(t,e){var s,i;let n;n=e?null!==(s=this.subscribers[e])&&void 0!==s?s:this.subscribers[e]=new f(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new f(this.subject),n.subscribe(t)}unsubscribe(t,e){var s,i;e?null===(s=this.subscribers[e])||void 0===s||s.unsubscribe(t):null===(i=this.subjectSubscribers)||void 0===i||i.unsubscribe(t)}}const b=l.getById(2,(()=>{const t=u.enqueue,e=/(:|&&|\|\||if)/,s=new WeakMap,i=new WeakMap;let n,r=t=>{throw l.error(1101)};function o(t){var e;let i=null!==(e=t.$fastController)&&void 0!==e?e:s.get(t);return void 0===i&&(Array.isArray(t)?i=r(t):s.set(t,i=new p(t))),i}function h(t){let e=i.get(t);if(void 0===e){let s=Reflect.getPrototypeOf(t);for(;void 0===e&&null!==s;)e=i.get(s),s=Reflect.getPrototypeOf(s);e=void 0===e?[]:e.slice(0),i.set(t,e)}return e}class a{constructor(t){this.name=t,this.field=`_${t}`,this.callback=`${t}Changed`}getValue(t){return void 0!==n&&n.watch(t,this.name),t[this.field]}setValue(t,e){const s=this.field,i=t[s];if(i!==e){t[s]=e;const n=t[this.callback];c(n)&&n.call(t,i,e),o(t).notify(this.name)}}}class b extends f{constructor(t,e,s=!1){super(t,e),this.binding=t,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(t){this.isAsync=this.needsQueue=t}observe(t,e){this.needsRefresh&&null!==this.last&&this.dispose();const s=n;n=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;const i=this.binding(t,null!=e?e:m.default);return n=s,i}dispose(){if(null!==this.last){let t=this.first;for(;void 0!==t;)t.notifier.unsubscribe(this,t.propertyName),t=t.next;this.last=null,this.needsRefresh=this.needsQueue=this.isAsync}}watch(t,e){const s=this.last,i=o(t),r=null===s?this.first:{};if(r.propertySource=t,r.propertyName=e,r.notifier=i,i.subscribe(this,e),null!==s){if(!this.needsRefresh){let e;n=void 0,e=s.propertySource[s.propertyName],n=this,t===e&&(this.needsRefresh=!0)}s.next=r}this.last=r}handleChange(){this.needsQueue?(this.needsQueue=!1,t(this)):this.isAsync||this.call()}call(){null!==this.last&&(this.needsQueue=this.isAsync,this.notify(this))}*records(){let t=this.first;for(;void 0!==t;)yield t,t=t.next}}return Object.freeze({setArrayObserverFactory(t){r=t},getNotifier:o,track(t,e){n&&n.watch(t,e)},trackVolatile(){n&&(n.needsRefresh=!0)},notify(t,e){o(t).notify(e)},defineProperty(t,e){d(e)&&(e=new a(e)),h(t).push(e),Reflect.defineProperty(t,e.name,{enumerable:!0,get(){return e.getValue(this)},set(t){e.setValue(this,t)}})},getAccessors:h,binding(t,e,s=this.isVolatileBinding(t)){return new b(t,e,s)},isVolatileBinding:t=>e.test(t.toString())})}));function g(t,e){b.defineProperty(t,e)}function v(t,e,s){return Object.assign({},s,{get(){return b.trackVolatile(),s.get.apply(this)}})}const y=l.getById(3,(()=>{let t=null;return{get:()=>t,set(e){t=e}}}));class m{constructor(t=null,e=null){this.index=0,this.length=0,this.parent=t,this.parentContext=e}get event(){return y.get()}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}updatePosition(t,e){this.index=t,this.length=e}createChildContext(t){return new m(t,this)}createItemContext(t,e){const s=Object.create(this);return s.index=t,s.length=e,s}static setEvent(t){y.set(t)}static create(){return new m}}m.default=new m,b.defineProperty(m.prototype,"index"),b.defineProperty(m.prototype,"length");class w{constructor(t,e,s){this.index=t,this.removed=e,this.addedCount=s}adjustTo(t){let e=this.index;const s=t.length;return e>s?e=s-this.addedCount:e<0&&(e=s+this.removed.length+e-this.addedCount),this.index=e<0?0:e,this}}const C=Object.freeze({reset:1,splice:2,optimized:3}),x=new w(0,h,0);x.reset=!0;const T=[x];let S=Object.freeze({support:C.splice,normalize:(t,e,s)=>void 0===t?null!=s?s:h:T,pop(t,e,s,i){const n=t.length>0,r=s.apply(t,i);return n&&e.addSplice(new w(t.length,[r],0)),r},push(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new w(t.length-i.length,[],i.length).adjustTo(t)),n},reverse(t,e,s,i){const n=s.apply(t,i);return e.reset(t),n},shift(t,e,s,i){const n=t.length>0,r=s.apply(t,i);return n&&e.addSplice(new w(0,[r],0)),r},sort(t,e,s,i){const n=s.apply(t,i);return e.reset(t),n},splice(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new w(+i[0],n,i.length>2?i.length-2:0).adjustTo(t)),n},unshift(t,e,s,i){const n=s.apply(t,i);return e.addSplice(new w(0,[],i.length).adjustTo(t)),n}});const O=Object.freeze({reset:T,setDefaultStrategy(t){S=t}});function B(t,e,s){Reflect.defineProperty(t,e,{value:s,enumerable:!1})}class A extends f{constructor(t){super(t),this.oldCollection=void 0,this.splices=void 0,this.needsQueue=!0,this._strategy=null,this._lengthObserver=void 0,this.call=this.flush,B(t,"$fastController",this)}get strategy(){return this._strategy}set strategy(t){this._strategy=t}get lengthObserver(){let t=this._lengthObserver;if(void 0===t){const e=this.subject;this._lengthObserver=t={length:e.length,handleChange(){this.length!==e.length&&(this.length=e.length,b.notify(t,"length"))}},this.subscribe(t)}return t}subscribe(t){this.flush(),super.subscribe(t)}addSplice(t){void 0===this.splices?this.splices=[t]:this.splices.push(t),this.enqueue()}reset(t){this.oldCollection=t,this.enqueue()}flush(){var t;const e=this.splices,s=this.oldCollection;void 0===e&&void 0===s||(this.needsQueue=!0,this.splices=void 0,this.oldCollection=void 0,this.notify((null!==(t=this._strategy)&&void 0!==t?t:S).normalize(s,this.subject,e)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,u.enqueue(this))}}let j=!1;const $=Object.freeze({enable(){if(j)return;j=!0,b.setArrayObserverFactory((t=>new A(t)));const t=Array.prototype;t.$fastPatch||(B(t,"$fastPatch",1),[t.pop,t.push,t.reverse,t.shift,t.sort,t.splice,t.unshift].forEach((e=>{t[e.name]=function(...t){var s;const i=this.$fastController;return void 0===i?e.apply(this,t):(null!==(s=i.strategy)&&void 0!==s?s:S)[e.name](this,i,e,t)}})))}});function I(t){if(!t)return 0;let e=t.$fastController;return void 0===e&&($.enable(),e=b.getNotifier(t)),b.track(e.lengthObserver,"length"),t.length}const k=new Map;let P;function V(t){return t.map((t=>t instanceof N?V(t.styles):[t])).reduce(((t,e)=>t.concat(e)),[])}class N{constructor(t){this.styles=t,this.targets=new WeakSet,this._strategy=null,this.behaviors=t.map((t=>t instanceof N?t.behaviors:null)).reduce(((t,e)=>null===e?t:null===t?e:t.concat(e)),null)}get strategy(){return null===this._strategy&&this.withStrategy(P),this._strategy}addStylesTo(t){this.strategy.addStylesTo(t),this.targets.add(t)}removeStylesFrom(t){this.strategy.removeStylesFrom(t),this.targets.delete(t)}isAttachedTo(t){return this.targets.has(t)}withBehaviors(...t){return this.behaviors=null===this.behaviors?t:this.behaviors.concat(t),this}withStrategy(t){return this._strategy=new t(V(this.styles)),this}static setDefaultStrategy(t){P=t}static normalize(t){return void 0===t?void 0:Array.isArray(t)?new N(t):t instanceof N?t:new N([t])}}N.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;class _{constructor(t){this.sheets=t.map((t=>{if(t instanceof CSSStyleSheet)return t;let e=k.get(t);return void 0===e&&(e=new CSSStyleSheet,e.replaceSync(t),k.set(t,e)),e}))}addStylesTo(t){t.adoptedStyleSheets=[...t.adoptedStyleSheets,...this.sheets]}removeStylesFrom(t){const e=this.sheets;t.adoptedStyleSheets=t.adoptedStyleSheets.filter((t=>-1===e.indexOf(t)))}}N.setDefaultStrategy(l.getById(5,(()=>_)));const E=a(),F=Object.freeze({getForInstance:E.getForInstance,getByType:E.getByType,define:t=>(E.register({type:t}),t)});function L(){return function(t){F.define(t)}}function M(t,e){const s=[];let i="";const n=[],r=t=>{n.push(t)};for(let n=0,o=t.length-1;n<o;++n){i+=t[n];let o=e[n];void 0!==F.getForInstance(o)&&(o=o.createCSS(r)),o instanceof N||o instanceof CSSStyleSheet?(""!==i.trim()&&(s.push(i),i=""),s.push(o)):i+=o}return i+=t[t.length-1],""!==i.trim()&&s.push(i),{styles:s,behaviors:n}}const z=(t,...e)=>{const{styles:s,behaviors:i}=M(t,e),n=new N(s);return i.length?n.withBehaviors(...i):n};class R{constructor(t,e){this.behaviors=e,this.css="";const s=t.reduce(((t,e)=>(d(e)?this.css+=e:t.push(e),t)),[]);s.length&&(this.styles=new N(s))}createCSS(t){return this.behaviors.forEach(t),this.styles&&t(this),this.css}bind(t){t.$fastController.addStyles(this.styles)}unbind(t){t.$fastController.removeStyles(this.styles)}}F.define(R);const H=z.partial=(t,...e)=>{const{styles:s,behaviors:i}=M(t,e);return new R(s,i)},D=Object.freeze({queueUpdate:u.enqueue,nextUpdate:u.next,processUpdates:u.process,setAttribute(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)},setBooleanAttribute(t,e,s){s?t.setAttribute(e,""):t.removeAttribute(e)}}),q=`fast-${Math.random().toString(36).substring(2,8)}`,Q=`${q}{`,W=`}${q}`,U=W.length;let G=0;const J=()=>`${q}-${++G}`,K=Object.freeze({interpolation:t=>`${Q}${t}${W}`,attribute:t=>`${J()}="${Q}${t}${W}"`,comment:t=>`\x3c!--${Q}${t}${W}--\x3e`}),X=Object.freeze({parse(t,e){const s=t.split(Q);if(1===s.length)return null;const i=[];for(let t=0,n=s.length;t<n;++t){const n=s[t],r=n.indexOf(W);let o;if(-1===r)o=n;else{const t=n.substring(0,r);i.push(e[t]),o=n.substring(r+U)}""!==o&&i.push(o)}return i}}),Y=a(),Z=Object.freeze({getForInstance:Y.getForInstance,getByType:Y.getByType,define:(t,e)=>((e=e||{}).type=t,Y.register(e),t)});function tt(t){return function(e){Z.define(e,t)}}class et{}const st=Object.freeze({none:0,attribute:1,booleanAttribute:2,property:3,content:4,tokenList:5,event:6,assign(t,e){if(e)switch(t.sourceAspect=e,e[0]){case":":switch(t.targetAspect=e.substring(1),t.targetAspect){case"innerHTML":default:t.aspectType=st.property;break;case"classList":t.aspectType=st.tokenList}break;case"?":t.targetAspect=e.substring(1),t.aspectType=st.booleanAttribute;break;case"@":t.targetAspect=e.substring(1),t.aspectType=st.event;break;default:"class"===e?(t.targetAspect="className",t.aspectType=st.property):(t.targetAspect=e,t.aspectType=st.attribute)}else t.aspectType=st.content}});class it{constructor(t){this.options=t,this.id=J()}createBehavior(t){return this}createHTML(t){return K.attribute(t(this))}}const nt=globalThis.TrustedHTML?t=>(e,s)=>{const i=t(e,s);if(i instanceof TrustedHTML)return i;throw l.error(1202)}:t=>t;class rt extends et{constructor(t,e){super(),this.evaluate=t,this.isVolatile=e}createObserver(t,e){return b.binding(this.evaluate,e,this.isVolatile)}}class ot extends et{constructor(t){super(),this.evaluate=t}createObserver(){return this}observe(t,e){return this.evaluate(t,e)}dispose(){}}function lt(t,e,s,i,n){if(null==s&&(s=""),s.create){t.textContent="";let e=t.$fastView;void 0===e?e=s.create():t.$fastTemplate!==s&&(e.isComposed&&(e.remove(),e.unbind()),e=s.create()),e.isComposed?e.needsBindOnly&&(e.needsBindOnly=!1,e.bind(i,n)):(e.isComposed=!0,e.bind(i,n),e.insertBefore(t),t.$fastView=e,t.$fastTemplate=s)}else{const e=t.$fastView;void 0!==e&&e.isComposed&&(e.isComposed=!1,e.remove(),e.needsBindOnly?e.needsBindOnly=!1:e.unbind()),t.textContent=s}}function ht(t,e,s){var i;const n=`${this.directive.id}-t`,r=null!==(i=t[n])&&void 0!==i?i:t[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;const h=t[e];if(null!=s&&s.length){const t=s.split(/\s+/);for(let e=0,s=t.length;e<s;++e){const s=t[e];""!==s&&(o[s]=l,h.add(s))}}if(r.v=l+1,0!==l){l-=1;for(const t in o)o[t]===l&&h.remove(t)}}class at{constructor(t,e){this.directive=t,this.updateTarget=e,this.observerProperty=`${t.id}-o`}bind(t,e,s){const i=this.directive,n=s[i.nodeId],r=this.getObserver(n);r.target=n,r.source=t,r.context=e,this.updateTarget(n,i.targetAspect,r.observe(t,e),t,e)}unbind(t,e,s){const i=s[this.directive.nodeId],n=this.getObserver(i);n.dispose(),n.target=null,n.source=null,n.context=null}handleChange(t,e){const s=e.target,i=e.source,n=e.context;this.updateTarget(s,this.directive.targetAspect,e.observe(i,n),i,n)}getObserver(t){var e;return null!==(e=t[this.observerProperty])&&void 0!==e?e:t[this.observerProperty]=this.directive.dataBinding.createObserver(this.directive,this)}createBehavior(t){return this}}class ct extends at{unbind(t,e,s){super.unbind(t,e,s);const i=s[this.directive.nodeId].$fastView;void 0!==i&&i.isComposed&&(i.unbind(),i.needsBindOnly=!0)}}class dt{constructor(t){this.directive=t,this.sourceProperty=`${t.id}-s`,this.contextProperty=`${t.id}-c`}bind(t,e,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=t,n[this.contextProperty]=e,n.addEventListener(i.targetAspect,this,i.dataBinding.options)}unbind(t,e,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=n[this.contextProperty]=null,n.removeEventListener(i.targetAspect,this,i.dataBinding.options)}createBehavior(t){return this}handleEvent(t){const e=t.currentTarget;m.setEvent(t);const s=this.directive.dataBinding.evaluate(e[this.sourceProperty],e[this.contextProperty]);m.setEvent(null),!0!==s&&t.preventDefault()}}class ut{constructor(t){this.dataBinding=t,this.factory=null,this.id=J(),this.aspectType=st.content}createHTML(t){return K.interpolation(t(this))}createBehavior(t){if(null==this.factory)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=nt(this.dataBinding.evaluate)),this.aspectType){case 1:this.factory=new at(this,D.setAttribute);break;case 2:this.factory=new at(this,D.setBooleanAttribute);break;case 3:this.factory=new at(this,((t,e,s)=>t[e]=s));break;case 4:this.factory=new ct(this,lt);break;case 5:this.factory=new at(this,ht);break;case 6:this.factory=new dt(this);break;default:throw l.error(1205)}return this.factory.createBehavior(t)}}function ft(t,e=b.isVolatileBinding(t)){return new rt(t,e)}function pt(t){return new ot(t)}function bt(t,e){const s=new rt(t,!1);return s.options=e,s}function gt(t){return c(t)?ft(t):t instanceof et?t:pt((()=>t))}function vt(t,e){const s=t.parentNode;let i,n=t;for(;n!==e;)i=n.nextSibling,s.removeChild(n),n=i;s.removeChild(e)}Z.define(ut,{aspected:!0});class yt{constructor(t,e,s){this.fragment=t,this.factories=e,this.targets=s,this.behaviors=null,this.source=null,this.context=null,this.firstChild=t.firstChild,this.lastChild=t.lastChild}appendTo(t){t.appendChild(this.fragment)}insertBefore(t){if(this.fragment.hasChildNodes())t.parentNode.insertBefore(this.fragment,t);else{const e=t.parentNode,s=this.lastChild;let i,n=this.firstChild;for(;n!==s;)i=n.nextSibling,e.insertBefore(n,t),n=i;e.insertBefore(s,t)}}remove(){const t=this.fragment,e=this.lastChild;let s,i=this.firstChild;for(;i!==e;)s=i.nextSibling,t.appendChild(i),i=s;t.appendChild(e)}dispose(){vt(this.firstChild,this.lastChild),this.unbind()}bind(t,e){let s=this.behaviors;const i=this.source;if(i===t)return;this.source=t,this.context=e;const n=this.targets;if(null!==i)for(let r=0,o=s.length;r<o;++r){const o=s[r];o.unbind(i,e,n),o.bind(t,e,n)}else if(null===s){this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let r=0,o=i.length;r<o;++r){const o=i[r].createBehavior(n);o.bind(t,e,n),s[r]=o}}else for(let i=0,r=s.length;i<r;++i)s[i].bind(t,e,n)}unbind(){const t=this.source;if(null===t)return;const e=this.targets,s=this.context,i=this.behaviors;for(let n=0,r=i.length;n<r;++n)i[n].unbind(t,s,e);this.source=null,this.context=null}static disposeContiguousBatch(t){if(0!==t.length){vt(t[0].firstChild,t[t.length-1].lastChild);for(let e=0,s=t.length;e<s;++e)t[e].unbind()}}}const mt=(t,e)=>`${t}.${e}`,wt={},Ct={index:0,node:null};function xt(t){t.startsWith("fast-")||l.warn(1204,{name:t})}const Tt=new Proxy(document.createElement("div"),{get(t,e){xt(e);const s=Reflect.get(t,e);return c(s)?s.bind(t):s},set:(t,e,s)=>(xt(e),Reflect.set(t,e,s))});class St{constructor(t,e){this.fragment=t,this.directives=e,this.proto=null,this.nodeIds=new Set,this.descriptors={},this.factories=[]}addFactory(t,e,s,i){this.nodeIds.has(s)||(this.nodeIds.add(s),this.addTargetDescriptor(e,s,i)),t.nodeId=s,this.factories.push(t)}freeze(){return this.proto=Object.create(null,this.descriptors),this}addTargetDescriptor(t,e,s){const i=this.descriptors;if("r"===e||"h"===e||i[e])return;if(!i[t]){const e=t.lastIndexOf("."),s=t.substring(0,e),i=parseInt(t.substring(e+1));this.addTargetDescriptor(s,t,i)}let n=wt[e];if(!n){const i=`_${e}`;wt[e]=n={get(){var e;return null!==(e=this[i])&&void 0!==e?e:this[i]=this[t].childNodes[s]}}}i[e]=n}createView(t){const e=this.fragment.cloneNode(!0),s=Object.create(this.proto);s.r=e,s.h=null!=t?t:Tt;for(const t of this.nodeIds)s[t];return new yt(e,this.factories,s)}}function Ot(t,e,s,i,n,r=!1){const o=s.attributes,l=t.directives;for(let h=0,a=o.length;h<a;++h){const c=o[h],d=c.value,u=X.parse(d,l);let f=null;null===u?r&&(f=new ut(pt((()=>d))),st.assign(f,c.name)):f=kt.aggregate(u),null!==f&&(s.removeAttributeNode(c),h--,a--,t.addFactory(f,e,i,n))}}function Bt(t,e,s){let i=0,n=e.firstChild;for(;n;){const e=At(t,s,n,i);n=e.node,i=e.index}}function At(t,e,s,i){const n=mt(e,i);switch(s.nodeType){case 1:Ot(t,e,s,n,i),Bt(t,s,n);break;case 3:return function(t,e,s,i,n){const r=X.parse(e.textContent,t.directives);if(null===r)return Ct.node=e.nextSibling,Ct.index=n+1,Ct;let o,l=o=e;for(let e=0,h=r.length;e<h;++e){const h=r[e];0!==e&&(n++,i=mt(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),d(h)?o.textContent=h:(o.textContent=" ",st.assign(h),t.addFactory(h,s,i,n)),l=o}return Ct.index=n+1,Ct.node=l.nextSibling,Ct}(t,s,e,n,i);case 8:const r=X.parse(s.data,t.directives);null!==r&&t.addFactory(kt.aggregate(r),e,n,i)}return Ct.index=i+1,Ct.node=s.nextSibling,Ct}const jt={createHTML:t=>t};let $t=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",jt):jt;const It=$t,kt={setHTMLPolicy(t){if($t!==It)throw l.error(1201);$t=t},compile(t,e){let s;if(d(t)){s=document.createElement("TEMPLATE"),s.innerHTML=$t.createHTML(t);const e=s.content.firstElementChild;null!==e&&"TEMPLATE"===e.tagName&&(s=e)}else s=t;const i=document.adoptNode(s.content),n=new St(i,e);return Ot(n,"",s,"h",0,!0),(function(t,e){return t&&8==t.nodeType&&null!==X.parse(t.data,e)}(i.firstChild,e)||1===i.childNodes.length&&Object.keys(e).length>0)&&i.insertBefore(document.createComment(""),i.firstChild),Bt(n,i,"r"),Ct.node=null,n.freeze()},setDefaultStrategy(t){this.compile=t},aggregate(t){if(1===t.length)return t[0];let e,s,i=!1;const n=t.length,r=t.map((t=>d(t)?()=>t:(e=t.sourceAspect||e,s=t.dataBinding||s,i=i||t.dataBinding.isVolatile,t.dataBinding.evaluate)));s.evaluate=(t,e)=>{let s="";for(let i=0;i<n;++i)s+=r[i](t,e);return s},s.isVolatile=i;const o=new ut(s);return st.assign(o,e),o}};class Pt{constructor(t,e){this.result=null,this.html=t,this.factories=e}create(t){return null===this.result&&(this.result=kt.compile(this.html,this.factories)),this.result.createView(t)}render(t,e,s,i){const n=this.create(null!=s?s:e);return n.bind(t,null!=i?i:m.default),n.appendTo(e),n}}const Vt=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Nt(t,e,s){const i=Vt.exec(e);return null!==i&&st.assign(t,i[2]),t.createHTML(s)}function _t(t,...e){let s="";const i=Object.create(null),n=t=>{var e;const s=null!==(e=t.id)&&void 0!==e?e:t.id=J();return i[s]=t,s};for(let i=0,r=t.length-1;i<r;++i){const r=t[i],o=e[i];let l;if(s+=r,c(o))s+=Nt(new ut(ft(o)),r,n);else if(d(o)){const t=Vt.exec(r);if(null!==t){const e=new ut(pt((()=>o)));st.assign(e,t[2]),s+=e.createHTML(n)}else s+=o}else o instanceof et?s+=Nt(new ut(o),r,n):void 0===(l=Z.getForInstance(o))?s+=Nt(new ut(pt((()=>o))),r,n):l.aspected?s+=Nt(o,r,n):s+=o.createHTML(n)}return new Pt(s+t[t.length-1],i)}class Et extends it{bind(t,e,s){t[this.options]=s[this.nodeId]}unbind(){}}Z.define(Et);const Ft=t=>new Et(t);function Lt(t,e){const s=c(t)?t:()=>t,i=c(e)?e:()=>e;return(t,e)=>s(t,e)?i(t,e):null}const Mt=Object.freeze({positioning:!1,recycle:!0});function zt(t,e,s,i){t.bind(e[s],i)}function Rt(t,e,s,i){t.bind(e[s],i.createItemContext(s,e.length))}class Ht{constructor(t,e){this.directive=t,this.location=e,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.context=void 0,this.childContext=void 0,this.bindView=zt,this.itemsBindingObserver=t.dataBinding.createObserver(t,this),this.templateBindingObserver=t.templateBinding.createObserver(t,this),t.options.positioning&&(this.bindView=Rt)}bind(t,e){this.source=t,this.context=e,this.childContext=e.createChildContext(t),this.items=this.itemsBindingObserver.observe(t,this.context),this.template=this.templateBindingObserver.observe(t,this.context),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.dispose(),this.templateBindingObserver.dispose()}handleChange(t,e){e===this.itemsBindingObserver?(this.items=this.itemsBindingObserver.observe(this.source,this.context),this.observeItems(),this.refreshAllViews()):e===this.templateBindingObserver?(this.template=this.templateBindingObserver.observe(this.source,this.context),this.refreshAllViews(!0)):e[0].reset?this.refreshAllViews():this.updateViews(e)}observeItems(t=!1){if(!this.items)return void(this.items=h);const e=this.itemsObserver,s=this.itemsObserver=b.getNotifier(this.items),i=e!==s;i&&null!==e&&e.unsubscribe(this),(i||t)&&s.subscribe(this)}updateViews(t){const e=this.views,s=this.childContext,i=this.bindView,n=this.items,r=this.template,o=this.directive.options.recycle,l=[];let h=0,a=0;for(let c=0,d=t.length;c<d;++c){const d=t[c],u=d.removed;let f=0,p=d.index;const b=p+d.addedCount,g=e.splice(d.index,u.length);for(a=l.length+g.length;p<b;++p){const t=e[p],c=t?t.firstChild:this.location;let d;o&&a>0?(f<=a&&g.length>0?(d=g[f],f++):(d=l[h],h++),a--):d=r.create(),e.splice(p,0,d),i(d,n,p,s),d.insertBefore(c)}g[f]&&l.push(...g.slice(f))}for(let t=h,e=l.length;t<e;++t)l[t].dispose();if(this.directive.options.positioning)for(let t=0,s=e.length;t<s;++t)e[t].context.updatePosition(t,s)}refreshAllViews(t=!1){const e=this.items,s=this.template,i=this.location,n=this.bindView,r=this.childContext;let o=e.length,l=this.views,h=l.length;if(0!==o&&!t&&this.directive.options.recycle||(yt.disposeContiguousBatch(l),h=0),0===h){this.views=l=new Array(o);for(let t=0;t<o;++t){const o=s.create();n(o,e,t,r),l[t]=o,o.insertBefore(i)}}else{let t=0;for(;t<o;++t)if(t<h){n(l[t],e,t,r)}else{const o=s.create();n(o,e,t,r),l.push(o),o.insertBefore(i)}const a=l.splice(t,h-t);for(t=0,o=a.length;t<o;++t)a[t].dispose()}}unbindAllViews(){const t=this.views;for(let e=0,s=t.length;e<s;++e)t[e].unbind()}}class Dt{constructor(t,e,s){this.dataBinding=t,this.templateBinding=e,this.options=s,this.id=J(),$.enable()}createHTML(t){return K.comment(t(this))}createBehavior(t){return new Ht(this,t[this.nodeId])}}function qt(t,e,s=Mt){const i=gt(t),n=gt(e);return new Dt(i,n,s)}Z.define(Dt);const Qt=t=>1===t.nodeType,Wt=t=>t?e=>1===e.nodeType&&e.matches(t):Qt;class Ut extends it{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(t,e,s){const i=s[this.nodeId];i[this.sourceProperty]=t,this.updateTarget(t,this.computeNodes(i)),this.observe(i)}unbind(t,e,s){const i=s[this.nodeId];this.updateTarget(t,h),this.disconnect(i),i[this.sourceProperty]=null}getSource(t){return t[this.sourceProperty]}updateTarget(t,e){t[this.options.property]=e}computeNodes(t){let e=this.getNodes(t);return"filter"in this.options&&(e=e.filter(this.options.filter)),e}}class Gt extends Ut{observe(t){t.addEventListener("slotchange",this)}disconnect(t){t.removeEventListener("slotchange",this)}getNodes(t){return t.assignedNodes(this.options)}handleEvent(t){const e=t.currentTarget;this.updateTarget(this.getSource(e),this.computeNodes(e))}}function Jt(t){return d(t)&&(t={property:t}),new Gt(t)}Z.define(Gt);class Kt extends Ut{constructor(t){super(t),this.observerProperty=`${this.id}-o`,this.handleEvent=(t,e)=>{const s=e.target;this.updateTarget(this.getSource(s),this.computeNodes(s))},t.childList=!0}observe(t){var e;const s=null!==(e=t[this.observerProperty])&&void 0!==e?e:t[this.observerProperty]=new MutationObserver(this.handleEvent);s.target=t,s.observe(t,this.options)}disconnect(t){const e=t[this.observerProperty];e.target=null,e.disconnect()}getNodes(t){return"selector"in this.options?Array.from(t.querySelectorAll(this.options.selector)):Array.from(t.childNodes)}}function Xt(t){return d(t)&&(t={property:t}),new Kt(t)}Z.define(Kt);const Yt={toView:t=>t?"true":"false",fromView:t=>null!=t&&"false"!==t&&!1!==t&&0!==t};function Zt(t){if(null==t)return null;const e=1*t;return isNaN(e)?null:e}const te={toView(t){const e=Zt(t);return e?e.toString():e},fromView:Zt};class ee{constructor(t,e,s=e.toLowerCase(),i="reflect",n){this.guards=new Set,this.Owner=t,this.name=e,this.attribute=s,this.mode=i,this.converter=n,this.fieldName=`_${e}`,this.callbackName=`${e}Changed`,this.hasCallback=this.callbackName in t.prototype,"boolean"===i&&void 0===n&&(this.converter=Yt)}setValue(t,e){const s=t[this.fieldName],i=this.converter;void 0!==i&&(e=i.fromView(e)),s!==e&&(t[this.fieldName]=e,this.tryReflectToAttribute(t),this.hasCallback&&t[this.callbackName](s,e),t.$fastController.notify(this.name))}getValue(t){return b.track(t,this.name),t[this.fieldName]}onAttributeChangedCallback(t,e){this.guards.has(t)||(this.guards.add(t),this.setValue(t,e),this.guards.delete(t))}tryReflectToAttribute(t){const e=this.mode,s=this.guards;s.has(t)||"fromView"===e||u.enqueue((()=>{s.add(t);const i=t[this.fieldName];switch(e){case"reflect":const e=this.converter;D.setAttribute(t,this.attribute,void 0!==e?e.toView(i):i);break;case"boolean":D.setBooleanAttribute(t,this.attribute,i)}s.delete(t)}))}static collect(t,...e){const s=[];e.push(t.attributes);for(let i=0,n=e.length;i<n;++i){const n=e[i];if(void 0!==n)for(let e=0,i=n.length;e<i;++e){const i=n[e];d(i)?s.push(new ee(t,i)):s.push(new ee(t,i.property,i.attribute,i.mode,i.converter))}}return s}}function se(t,e){let s;function i(t,e){arguments.length>1&&(s.property=e);const i=t.constructor.attributes||(t.constructor.attributes=[]);i.push(s)}return arguments.length>1?(s={},void i(t,e)):(s=void 0===t?{}:t,i)}const ie={mode:"open"},ne={},re=l.getById(4,(()=>a()));class oe{constructor(t,e=t.definition){this.platformDefined=!1,d(e)&&(e={name:e}),this.type=t,this.name=e.name,this.template=e.template;const s=t.prototype,i=ee.collect(t,e.attributes),n=new Array(i.length),r={},o={};for(let t=0,e=i.length;t<e;++t){const e=i[t];n[t]=e.attribute,r[e.name]=e,o[e.attribute]=e,b.defineProperty(s,e)}Reflect.defineProperty(t,"observedAttributes",{value:n,enumerable:!0}),this.attributes=i,this.propertyLookup=r,this.attributeLookup=o,this.shadowOptions=void 0===e.shadowOptions?ie:null===e.shadowOptions?void 0:Object.assign(Object.assign({},ie),e.shadowOptions),this.elementOptions=void 0===e.elementOptions?ne:Object.assign(Object.assign({},ne),e.elementOptions),this.styles=N.normalize(e.styles),re.register(this)}get isDefined(){return this.platformDefined}define(t=customElements){const e=this.type;return t.get(this.name)||(this.platformDefined=!0,t.define(this.name,e,this.elementOptions)),this}static compose(t,e){const s=re.getByType(t);return new oe(s?class extends t{}:t,e)}}oe.getByType=re.getByType,oe.getForInstance=re.getForInstance;const le=new WeakMap,he={bubbles:!0,composed:!0,cancelable:!0};function ae(t){var e,s;return null!==(s=null!==(e=t.shadowRoot)&&void 0!==e?e:le.get(t))&&void 0!==s?s:null}class ce extends p{constructor(t,e){super(t),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=t,this.definition=e;const s=e.shadowOptions;if(void 0!==s){let e=t.shadowRoot;e?this.hasExistingShadowRoot=!0:(e=t.attachShadow(s),"closed"===s.mode&&le.set(t,e))}const i=b.getAccessors(t);if(i.length>0){const e=this.boundObservables=Object.create(null);for(let s=0,n=i.length;s<n;++s){const n=i[s].name,r=t[n];void 0!==r&&(delete t[n],e[n]=r)}}}get isConnected(){return b.track(this,"isConnected"),this._isConnected}setIsConnected(t){this._isConnected=t,b.notify(this,"isConnected")}get template(){var t;if(null===this._template){const e=this.definition;this.element.resolveTemplate?this._template=this.element.resolveTemplate():e.template&&(this._template=null!==(t=e.template)&&void 0!==t?t:null)}return this._template}set template(t){this._template!==t&&(this._template=t,this.needsInitialization||this.renderTemplate(t))}get styles(){var t;if(null===this._styles){const e=this.definition;this.element.resolveStyles?this._styles=this.element.resolveStyles():e.styles&&(this._styles=null!==(t=e.styles)&&void 0!==t?t:null)}return this._styles}set styles(t){this._styles!==t&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=t,this.needsInitialization||this.addStyles(t))}addStyles(t){if(!t)return;const e=ae(this.element)||this.element.getRootNode();if(t instanceof HTMLElement)e.append(t);else if(!t.isAttachedTo(e)){const s=t.behaviors;t.addStylesTo(e),null!==s&&this.addBehaviors(s)}}removeStyles(t){if(!t)return;const e=ae(this.element)||this.element.getRootNode();if(t instanceof HTMLElement)e.removeChild(t);else if(t.isAttachedTo(e)){const s=t.behaviors;t.removeStylesFrom(e),null!==s&&this.removeBehaviors(s)}}addBehaviors(t){var e;const s=null!==(e=this.behaviors)&&void 0!==e?e:this.behaviors=new Map,i=t.length,n=[];for(let e=0;e<i;++e){const i=t[e];s.has(i)?s.set(i,s.get(i)+1):(s.set(i,1),n.push(i))}if(this._isConnected){const t=this.element,e=m.default;for(let s=0;s<n.length;++s)n[s].bind(t,e)}}removeBehaviors(t,e=!1){const s=this.behaviors;if(null===s)return;const i=t.length,n=[];for(let r=0;r<i;++r){const i=t[r];if(s.has(i)){const t=s.get(i)-1;0===t||e?s.delete(i)&&n.push(i):s.set(i,t)}}if(this._isConnected){const t=this.element,e=m.default;for(let s=0;s<n.length;++s)n[s].unbind(t,e)}}onConnectedCallback(){if(this._isConnected)return;const t=this.element,e=m.default;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(t,e);const s=this.behaviors;if(null!==s)for(const i of s.keys())i.bind(t,e);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const t=this.view;null!==t&&t.unbind();const e=this.behaviors;if(null!==e){const t=this.element,s=m.default;for(const i of e.keys())i.unbind(t,s)}}onAttributeChangedCallback(t,e,s){const i=this.definition.attributeLookup[t];void 0!==i&&i.onAttributeChangedCallback(this.element,s)}emit(t,e,s){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(t,Object.assign(Object.assign({detail:e},he),s)))}finishInitialization(){const t=this.element,e=this.boundObservables;if(null!==e){const s=Object.keys(e);for(let i=0,n=s.length;i<n;++i){const n=s[i];t[n]=e[n]}this.boundObservables=null}this.renderTemplate(this.template),this.addStyles(this.styles),this.needsInitialization=!1}renderTemplate(t){var e;const s=this.element,i=null!==(e=ae(s))&&void 0!==e?e:s;if(null!==this.view)this.view.dispose(),this.view=null;else if(!this.needsInitialization||this.hasExistingShadowRoot){this.hasExistingShadowRoot=!1;for(let t=i.firstChild;null!==t;t=i.firstChild)i.removeChild(t)}t&&(this.view=t.render(s,i,s))}static forCustomElement(t){const e=t.$fastController;if(void 0!==e)return e;const s=oe.getForInstance(t);if(void 0===s)throw l.error(1401);return t.$fastController=new ce(t,s)}}function de(t){return class extends t{constructor(){super(),ce.forCustomElement(this)}$emit(t,e,s){return this.$fastController.emit(t,e,s)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(t,e,s){this.$fastController.onAttributeChangedCallback(t,e,s)}}}function ue(t,e){return c(t)?oe.compose(t,e).define().type:oe.compose(this,t).define().type}const fe=Object.assign(de(HTMLElement),{from:t=>de(t),define:ue,compose:function(t,e){return c(t)?oe.compose(t,e):oe.compose(this,t)}});function pe(t){return function(e){ue(e,t)}}export{_ as AdoptedStyleSheetsStrategy,$ as ArrayObserver,st as Aspect,ee as AttributeDefinition,et as Binding,at as BindingBehavior,F as CSSDirective,Kt as ChildrenDirective,kt as Compiler,ct as ContentBehavior,ce as Controller,D as DOM,N as ElementStyles,dt as EventBehavior,m as ExecutionContext,l as FAST,fe as FASTElement,oe as FASTElementDefinition,ut as HTMLBindingDirective,Z as HTMLDirective,yt as HTMLView,K as Markup,Ut as NodeObservationDirective,b as Observable,X as Parser,p as PropertyChangeNotifier,Et as RefDirective,Ht as RepeatBehavior,Dt as RepeatDirective,Gt as SlottedDirective,w as Splice,O as SpliceStrategy,C as SpliceStrategySupport,it as StatelessAttachedAttributeDirective,f as SubscriberSet,u as Updates,Pt as ViewTemplate,se as attr,ft as bind,Yt as booleanConverter,Xt as children,a as createTypeRegistry,z as css,L as cssDirective,H as cssPartial,pe as customElement,Wt as elements,h as emptyArray,_t as html,tt as htmlDirective,I as lengthOf,bt as listener,gt as normalizeBinding,te as nullableNumberConverter,g as observable,pt as oneTime,Ft as ref,qt as repeat,Jt as slotted,v as volatile,Lt as when};
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))}const s=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;function i(e){return e===document?document.body:e}let n=0;class r{constructor(e){this.styles=e,this.styleClass="fast-"+ ++n}addStylesTo(e){e=i(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.querySelectorAll(`.${this.styleClass}`);e=i(e);for(let s=0,i=t.length;s<i;++s)e.removeChild(t[s])}}s||t.getById(5,(()=>r));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 h=Object.freeze([]);function c(){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=>e.get(t.constructor)})}const a=e=>"function"==typeof e,d=e=>"string"==typeof e,u=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 f{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 p{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 f(this.subject):null!==(i=this.subjectSubscribers)&&void 0!==i?i:this.subjectSubscribers=new f(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 g=l.getById(2,(()=>{const e=u.enqueue,t=/(:|&&|\|\||if)/,s=new WeakMap,i=new WeakMap;let n,r=e=>{throw l.error(1101)};function o(e){var t;let i=null!==(t=e.$fastController)&&void 0!==t?t:s.get(e);return void 0===i&&(Array.isArray(e)?i=r(e):s.set(e,i=new p(e))),i}function h(e){let t=i.get(e);if(void 0===t){let s=Reflect.getPrototypeOf(e);for(;void 0===t&&null!==s;)t=i.get(s),s=Reflect.getPrototypeOf(s);t=void 0===t?[]:t.slice(0),i.set(e,t)}return t}class c{constructor(e){this.name=e,this.field=`_${e}`,this.callback=`${e}Changed`}getValue(e){return void 0!==n&&n.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];a(n)&&n.call(e,i,t),o(e).notify(this.name)}}}class g extends f{constructor(e,t,s=!1){super(e,t),this.binding=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}observe(e,t){this.needsRefresh&&null!==this.last&&this.dispose();const s=n;let i;n=this.needsRefresh?this:void 0,this.needsRefresh=this.isVolatileBinding;try{i=this.binding(e,null!=t?t:m.default)}finally{n=s}return i}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=o(e),r=null===s?this.first:{};if(r.propertySource=e,r.propertyName=t,r.notifier=i,i.subscribe(this,t),null!==s){if(!this.needsRefresh){let t;n=void 0,t=s.propertySource[s.propertyName],n=this,e===t&&(this.needsRefresh=!0)}s.next=r}this.last=r}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){r=e},getNotifier:o,track(e,t){n&&n.watch(e,t)},trackVolatile(){n&&(n.needsRefresh=!0)},notify(e,t){o(e).notify(t)},defineProperty(e,t){d(t)&&(t=new c(t)),h(e).push(t),Reflect.defineProperty(e,t.name,{enumerable:!0,get(){return t.getValue(this)},set(e){t.setValue(this,e)}})},getAccessors:h,binding(e,t,s=this.isVolatileBinding(e)){return new g(e,t,s)},isVolatileBinding:e=>t.test(e.toString())})}));function b(e,t){g.defineProperty(e,t)}function v(e,t,s){return Object.assign({},s,{get(){return g.trackVolatile(),s.get.apply(this)}})}const y=l.getById(3,(()=>{let e=null;return{get:()=>e,set(t){e=t}}}));class m{constructor(e=null,t=null){this.index=0,this.length=0,this.parent=e,this.parentContext=t}get event(){return y.get()}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}updatePosition(e,t){this.index=e,this.length=t}createChildContext(e){return new m(e,this)}createItemContext(e,t){const s=Object.create(this);return s.index=e,s.length=t,s}static setEvent(e){y.set(e)}static create(){return new m}}m.default=new m,g.defineProperty(m.prototype,"index"),g.defineProperty(m.prototype,"length");class w{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 C=Object.freeze({reset:1,splice:2,optimized:3}),x=new w(0,h,0);x.reset=!0;const T=[x];function S(e,t,s,i,n,r){let o=0,l=0;const c=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,c)),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,c-o)),n+=o,r-=l,(s-=l)-(t+=o)==0&&r-n==0)return h;if(t===s){const e=new w(t,[],0);for(;n<r;)e.removed.push(i[n++]);return[e]}if(n===r)return[new w(t,[],s-t)];const a=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 c,a;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]:(c=h[s-1][r]+1,a=h[s][r-1]+1,h[s][r]=c<a?c:a);return h}(e,t,s,i,n,r)),d=[];let u,f=t,p=n;for(let e=0;e<a.length;++e)switch(a[e]){case 0:void 0!==u&&(d.push(u),u=void 0),f++,p++;break;case 1:void 0===u&&(u=new w(f,[],0)),u.addedCount++,f++,u.removed.push(i[p]),p++;break;case 2:void 0===u&&(u=new w(f,[],0)),u.addedCount++,f++;break;case 3:void 0===u&&(u=new w(f,[],0)),u.removed.push(i[p]),p++}return void 0!==u&&d.push(u),d}function O(e,t){let s=!1,i=0;for(let h=0;h<t.length;h++){const c=t[h];if(c.index+=i,s)continue;const a=(n=e.index,r=e.index+e.removed.length,o=c.index,l=c.index+c.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(a>=0){t.splice(h,1),h--,i-=c.addedCount-c.removed.length,e.addedCount+=c.addedCount-a;const n=e.removed.length+c.removed.length-a;if(e.addedCount||n){let t=c.removed;if(e.index<c.index){const s=e.removed.slice(0,c.index-e.index);s.push(...t),t=s}if(e.index+e.removed.length>c.index+c.addedCount){const s=e.removed.slice(c.index+c.addedCount-e.index);t.push(...s)}e.removed=t,c.index<e.index&&(e.index=c.index)}else s=!0}else if(e.index<c.index){s=!0,t.splice(h,0,e),h++;const n=e.addedCount-e.removed.length;c.index+=n,i+=n}}var n,r,o,l;s||t.push(e)}let A=Object.freeze({support:C.optimized,normalize:(e,t,s)=>void 0===e?void 0===s?h:s.length>1?function(e,t){let s=[];const i=[];for(let e=0,s=t.length;e<s;e++)O(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(S(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:T,pop(e,t,s,i){const n=e.length>0,r=s.apply(e,i);return n&&t.addSplice(new w(e.length,[r],0)),r},push(e,t,s,i){const n=s.apply(e,i);return t.addSplice(new w(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 w(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 w(+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 w(0,[],i.length).adjustTo(e)),n}});const B=Object.freeze({reset:T,setDefaultStrategy(e){A=e}});function j(e,t,s){Reflect.defineProperty(e,t,{value:s,enumerable:!1})}class $ extends f{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,j(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,g.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:A).normalize(s,this.subject,t)))}enqueue(){this.needsQueue&&(this.needsQueue=!1,u.enqueue(this))}}let I=!1;const k=Object.freeze({enable(){if(I)return;I=!0,g.setArrayObserverFactory((e=>new $(e)));const e=Array.prototype;e.$fastPatch||(j(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:A)[t.name](this,i,t,e)}})))}});function P(e){if(!e)return 0;let t=e.$fastController;return void 0===t&&(k.enable(),t=g.getNotifier(e)),g.track(t.lengthObserver,"length"),e.length}const V=new Map;let N;function _(e){return e.map((e=>e instanceof E?_(e.styles):[e])).reduce(((e,t)=>e.concat(t)),[])}class E{constructor(e){this.styles=e,this.targets=new WeakSet,this._strategy=null,this.behaviors=e.map((e=>e instanceof E?e.behaviors:null)).reduce(((e,t)=>null===t?e:null===e?t:e.concat(t)),null)}get strategy(){return null===this._strategy&&this.withStrategy(N),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){N=e}static normalize(e){return void 0===e?void 0:Array.isArray(e)?new E(e):e instanceof E?e:new E([e])}}E.supportsAdoptedStyleSheets=Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype;class F{constructor(e){this.sheets=e.map((e=>{if(e instanceof CSSStyleSheet)return e;let t=V.get(e);return void 0===t&&(t=new CSSStyleSheet,t.replaceSync(e),V.set(e,t)),t}))}addStylesTo(e){e.adoptedStyleSheets=[...e.adoptedStyleSheets,...this.sheets]}removeStylesFrom(e){const t=this.sheets;e.adoptedStyleSheets=e.adoptedStyleSheets.filter((e=>-1===t.indexOf(e)))}}E.setDefaultStrategy(l.getById(5,(()=>F)));const L=c(),M=Object.freeze({getForInstance:L.getForInstance,getByType:L.getByType,define:e=>(L.register({type:e}),e)});function z(){return function(e){M.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!==M.getForInstance(o)&&(o=o.createCSS(r)),o instanceof E||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 H=(e,...t)=>{const{styles:s,behaviors:i}=R(e,t),n=new E(s);return i.length?n.withBehaviors(...i):n};class D{constructor(e,t){this.behaviors=t,this.css="";const s=e.reduce(((e,t)=>(d(t)?this.css+=t:e.push(t),e)),[]);s.length&&(this.styles=new E(s))}createCSS(e){return this.behaviors.forEach(e),this.styles&&e(this),this.css}bind(e){e.$fastController.addStyles(this.styles)}unbind(e){e.$fastController.removeStyles(this.styles)}}M.define(D);const q=H.partial=(e,...t)=>{const{styles:s,behaviors:i}=R(e,t);return new D(s,i)},Q=Object.freeze({queueUpdate:u.enqueue,nextUpdate:u.next,processUpdates:u.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)}}),W=`fast-${Math.random().toString(36).substring(2,8)}`,U=`${W}{`,G=`}${W}`,J=G.length;let K=0;const X=()=>`${W}-${++K}`,Y=Object.freeze({interpolation:e=>`${U}${e}${G}`,attribute:e=>`${X()}="${U}${e}${G}"`,comment:e=>`\x3c!--${U}${e}${G}--\x3e`}),Z=Object.freeze({parse(e,t){const s=e.split(U);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(G);let o;if(-1===r)o=n;else{const e=n.substring(0,r);i.push(t[e]),o=n.substring(r+J)}""!==o&&i.push(o)}return i}}),ee=c(),te=Object.freeze({getForInstance:ee.getForInstance,getByType:ee.getByType,define:(e,t)=>((t=t||{}).type=e,ee.register(t),e)});function se(e){return function(t){te.define(t,e)}}class ie{}const ne=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":":switch(e.targetAspect=t.substring(1),e.targetAspect){case"innerHTML":default:e.aspectType=ne.property;break;case"classList":e.aspectType=ne.tokenList}break;case"?":e.targetAspect=t.substring(1),e.aspectType=ne.booleanAttribute;break;case"@":e.targetAspect=t.substring(1),e.aspectType=ne.event;break;default:"class"===t?(e.targetAspect="className",e.aspectType=ne.property):(e.targetAspect=t,e.aspectType=ne.attribute)}else e.aspectType=ne.content}});class re{constructor(e){this.options=e,this.id=X()}createBehavior(e){return this}createHTML(e){return Y.attribute(e(this))}}const oe=globalThis.TrustedHTML?e=>(t,s)=>{const i=e(t,s);if(i instanceof TrustedHTML)return i;throw l.error(1202)}:e=>e;class le extends ie{constructor(e,t){super(),this.evaluate=e,this.isVolatile=t}createObserver(e,t){return g.binding(this.evaluate,t,this.isVolatile)}}class he extends ie{constructor(e){super(),this.evaluate=e}createObserver(){return this}observe(e,t){return this.evaluate(e,t)}dispose(){}}function ce(e,t,s,i,n){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,n)):(t.isComposed=!0,t.bind(i,n),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 ae(e,t,s){var i;const n=`${this.directive.id}-t`,r=null!==(i=e[n])&&void 0!==i?i:e[n]={c:0,v:Object.create(null)},o=r.v;let l=r.c;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)}}class de{constructor(e,t){this.directive=e,this.updateTarget=t,this.observerProperty=`${e.id}-o`}bind(e,t,s){const i=this.directive,n=s[i.nodeId],r=this.getObserver(n);r.target=n,r.source=e,r.context=t,this.updateTarget(n,i.targetAspect,r.observe(e,t),e,t)}unbind(e,t,s){const i=s[this.directive.nodeId],n=this.getObserver(i);n.dispose(),n.target=null,n.source=null,n.context=null}handleChange(e,t){const s=t.target,i=t.source,n=t.context;this.updateTarget(s,this.directive.targetAspect,t.observe(i,n),i,n)}getObserver(e){var t;return null!==(t=e[this.observerProperty])&&void 0!==t?t:e[this.observerProperty]=this.directive.dataBinding.createObserver(this.directive,this)}createBehavior(e){return this}}class ue extends de{unbind(e,t,s){super.unbind(e,t,s);const i=s[this.directive.nodeId].$fastView;void 0!==i&&i.isComposed&&(i.unbind(),i.needsBindOnly=!0)}}class fe{constructor(e){this.directive=e,this.sourceProperty=`${e.id}-s`,this.contextProperty=`${e.id}-c`}bind(e,t,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=e,n[this.contextProperty]=t,n.addEventListener(i.targetAspect,this,i.dataBinding.options)}unbind(e,t,s){const i=this.directive,n=s[i.nodeId];n[this.sourceProperty]=n[this.contextProperty]=null,n.removeEventListener(i.targetAspect,this,i.dataBinding.options)}createBehavior(e){return this}handleEvent(e){const t=e.currentTarget;m.setEvent(e);const s=this.directive.dataBinding.evaluate(t[this.sourceProperty],t[this.contextProperty]);m.setEvent(null),!0!==s&&e.preventDefault()}}class pe{constructor(e){this.dataBinding=e,this.factory=null,this.id=X(),this.aspectType=ne.content}createHTML(e){return Y.interpolation(e(this))}createBehavior(e){if(null==this.factory)switch("innerHTML"===this.targetAspect&&(this.dataBinding.evaluate=oe(this.dataBinding.evaluate)),this.aspectType){case 1:this.factory=new de(this,Q.setAttribute);break;case 2:this.factory=new de(this,Q.setBooleanAttribute);break;case 3:this.factory=new de(this,((e,t,s)=>e[t]=s));break;case 4:this.factory=new ue(this,ce);break;case 5:this.factory=new de(this,ae);break;case 6:this.factory=new fe(this);break;default:throw l.error(1205)}return this.factory.createBehavior(e)}}function ge(e,t=g.isVolatileBinding(e)){return new le(e,t)}function be(e){return new he(e)}function ve(e,t){const s=new le(e,!1);return s.options=t,s}function ye(e){return a(e)?ge(e):e instanceof ie?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)}te.define(pe,{aspected:!0});class we{constructor(e,t,s){this.fragment=e,this.factories=t,this.targets=s,this.behaviors=null,this.source=null,this.context=null,this.firstChild=e.firstChild,this.lastChild=e.lastChild}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()}bind(e,t){let s=this.behaviors;const i=this.source;if(i===e)return;this.source=e,this.context=t;const n=this.targets;if(null!==i)for(let r=0,o=s.length;r<o;++r){const o=s[r];o.unbind(i,t,n),o.bind(e,t,n)}else if(null===s){this.behaviors=s=new Array(this.factories.length);const i=this.factories;for(let r=0,o=i.length;r<o;++r){const o=i[r].createBehavior(n);o.bind(e,t,n),s[r]=o}}else for(let i=0,r=s.length;i<r;++i)s[i].bind(e,t,n)}unbind(){const e=this.source;if(null===e)return;const t=this.targets,s=this.context,i=this.behaviors;for(let n=0,r=i.length;n<r;++n)i[n].unbind(e,s,t);this.source=null,this.context=null}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()}}}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 a(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 h=0,c=o.length;h<c;++h){const a=o[h],d=a.value,u=Z.parse(d,l);let f=null;null===u?r&&(f=new pe(be((()=>d))),ne.assign(f,a.name)):f=Ve.aggregate(u),null!==f&&(s.removeAttributeNode(a),h--,c--,e.addFactory(f,t,i,n))}}function je(e,t,s){let i=0,n=t.firstChild;for(;n;){const t=$e(e,s,n,i);n=t.node,i=t.index}}function $e(e,t,s,i){const n=Ce(t,i);switch(s.nodeType){case 1:Be(e,t,s,n,i),je(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,h=r.length;t<h;++t){const h=r[t];0!==t&&(n++,i=Ce(s,n),o=l.parentNode.insertBefore(document.createTextNode(""),l.nextSibling)),d(h)?o.textContent=h:(o.textContent=" ",ne.assign(h),e.addFactory(h,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(Ve.aggregate(r),t,n,i)}return Te.index=i+1,Te.node=s.nextSibling,Te}const Ie={createHTML:e=>e};let ke=globalThis.trustedTypes?globalThis.trustedTypes.createPolicy("fast-html",Ie):Ie;const Pe=ke,Ve={setHTMLPolicy(e){if(ke!==Pe)throw l.error(1201);ke=e},compile(e,t){let s;if(d(e)){s=document.createElement("TEMPLATE"),s.innerHTML=ke.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),je(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=>d(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 ne.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=Ve.compile(this.html,this.factories)),this.result.createView(e)}render(e,t,s,i){const n=this.create(null!=s?s:t);return n.bind(e,null!=i?i:m.default),n.appendTo(t),n}}const _e=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function Ee(e,t,s){const i=_e.exec(t);return null!==i&&ne.assign(e,i[2]),e.createHTML(s)}function Fe(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,a(o))s+=Ee(new pe(ge(o)),r,n);else if(d(o)){const e=_e.exec(r);if(null!==e){const t=new pe(be((()=>o)));ne.assign(t,e[2]),s+=t.createHTML(n)}else s+=o}else o instanceof ie?s+=Ee(new pe(o),r,n):void 0===(l=te.getForInstance(o))?s+=Ee(new pe(be((()=>o))),r,n):l.aspected?s+=Ee(o,r,n):s+=o.createHTML(n)}return new Ne(s+e[e.length-1],i)}class Le extends re{bind(e,t,s){e[this.options]=s[this.nodeId]}unbind(){}}te.define(Le);const Me=e=>new Le(e);function ze(e,t){const s=a(e)?e:()=>e,i=a(t)?t:()=>t;return(e,t)=>s(e,t)?i(e,t):null}const Re=Object.freeze({positioning:!1,recycle:!0});function He(e,t,s,i){e.bind(t[s],i)}function De(e,t,s,i){e.bind(t[s],i.createItemContext(s,t.length))}class qe{constructor(e,t){this.directive=e,this.location=t,this.source=null,this.views=[],this.items=null,this.itemsObserver=null,this.context=void 0,this.childContext=void 0,this.bindView=He,this.itemsBindingObserver=e.dataBinding.createObserver(e,this),this.templateBindingObserver=e.templateBinding.createObserver(e,this),e.options.positioning&&(this.bindView=De)}bind(e,t){this.source=e,this.context=t,this.childContext=t.createChildContext(e),this.items=this.itemsBindingObserver.observe(e,this.context),this.template=this.templateBindingObserver.observe(e,this.context),this.observeItems(!0),this.refreshAllViews()}unbind(){this.source=null,this.items=null,null!==this.itemsObserver&&this.itemsObserver.unsubscribe(this),this.unbindAllViews(),this.itemsBindingObserver.dispose(),this.templateBindingObserver.dispose()}handleChange(e,t){if(t===this.itemsBindingObserver)this.items=this.itemsBindingObserver.observe(this.source,this.context),this.observeItems(),this.refreshAllViews();else if(t===this.templateBindingObserver)this.template=this.templateBindingObserver.observe(this.source,this.context),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=h);const t=this.itemsObserver,s=this.itemsObserver=g.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.childContext,i=this.bindView,n=this.items,r=this.template,o=this.directive.options.recycle,l=[];let h=0,c=0;for(let a=0,d=e.length;a<d;++a){const d=e[a],u=d.removed;let f=0,p=d.index;const g=p+d.addedCount,b=t.splice(d.index,u.length);for(c=l.length+b.length;p<g;++p){const e=t[p],a=e?e.firstChild:this.location;let d;o&&c>0?(f<=c&&b.length>0?(d=b[f],f++):(d=l[h],h++),c--):d=r.create(),t.splice(p,0,d),i(d,n,p,s),d.insertBefore(a)}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)t[e].context.updatePosition(e,s)}refreshAllViews(e=!1){const t=this.items,s=this.template,i=this.location,n=this.bindView,r=this.childContext;let o=t.length,l=this.views,h=l.length;if(0!==o&&!e&&this.directive.options.recycle||(we.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 c=l.splice(e,h-e);for(e=0,o=c.length;e<o;++e)c[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(),k.enable()}createHTML(e){return Y.comment(e(this))}createBehavior(e){return new qe(this,e[this.nodeId])}}function We(e,t,s=Re){const i=ye(e),n=ye(t);return new Qe(i,n,Object.assign(Object.assign({},Re),s))}te.define(Qe);const Ue=e=>1===e.nodeType,Ge=e=>e?t=>1===t.nodeType&&t.matches(e):Ue;class Je extends re{constructor(){super(...arguments),this.sourceProperty=`${this.id}-s`}bind(e,t,s){const i=s[this.nodeId];i[this.sourceProperty]=e,this.updateTarget(e,this.computeNodes(i)),this.observe(i)}unbind(e,t,s){const i=s[this.nodeId];this.updateTarget(e,h),this.disconnect(i),i[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 Ke extends Je{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 d(e)&&(e={property:e}),new Ke(e)}te.define(Ke);class Ye extends Je{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 d(e)&&(e={property:e}),new Ye(e)}te.define(Ye);const et={toView:e=>e?"true":"false",fromView:e=>null!=e&&"false"!==e&&!1!==e&&0!==e};function tt(e){if(null==e)return null;const t=1*e;return isNaN(t)?null:t}const st={toView(e){const t=tt(e);return t?t.toString():t},fromView:tt};class it{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=et)}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 g.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||u.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(e.attributes);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];d(i)?s.push(new it(e,i)):s.push(new it(e,i.property,i.attribute,i.mode,i.converter))}}return s}}function nt(e,t){let s;function i(e,t){arguments.length>1&&(s.property=t);const i=e.constructor.attributes||(e.constructor.attributes=[]);i.push(s)}return arguments.length>1?(s={},void i(e,t)):(s=void 0===e?{}:e,i)}const rt={mode:"open"},ot={},lt=l.getById(4,(()=>c()));class ht{constructor(e,t=e.definition){this.platformDefined=!1,d(t)&&(t={name:t}),this.type=e,this.name=t.name,this.template=t.template;const s=e.prototype,i=it.collect(e,t.attributes),n=new Array(i.length),r={},o={};for(let e=0,t=i.length;e<t;++e){const t=i[e];n[e]=t.attribute,r[t.name]=t,o[t.attribute]=t,g.defineProperty(s,t)}Reflect.defineProperty(e,"observedAttributes",{value:n,enumerable:!0}),this.attributes=i,this.propertyLookup=r,this.attributeLookup=o,this.shadowOptions=void 0===t.shadowOptions?rt:null===t.shadowOptions?void 0:Object.assign(Object.assign({},rt),t.shadowOptions),this.elementOptions=void 0===t.elementOptions?ot:Object.assign(Object.assign({},ot),t.elementOptions),this.styles=E.normalize(t.styles),lt.register(this)}get isDefined(){return this.platformDefined}define(e=customElements){const t=this.type;return e.get(this.name)||(this.platformDefined=!0,e.define(this.name,t,this.elementOptions)),this}static compose(e,t){const s=lt.getByType(e);return new ht(s?class extends e{}:e,t)}}ht.getByType=lt.getByType,ht.getForInstance=lt.getForInstance;const ct=new WeakMap,at={bubbles:!0,composed:!0,cancelable:!0};function dt(e){var t,s;return null!==(s=null!==(t=e.shadowRoot)&&void 0!==t?t:ct.get(e))&&void 0!==s?s:null}class ut extends p{constructor(e,t){super(e),this.boundObservables=null,this.behaviors=null,this.needsInitialization=!0,this.hasExistingShadowRoot=!1,this._template=null,this._styles=null,this._isConnected=!1,this.$fastController=this,this.view=null,this.element=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&&ct.set(e,t))}const i=g.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 g.track(this,"isConnected"),this._isConnected}setIsConnected(e){this._isConnected=e,g.notify(this,"isConnected")}get template(){var e;if(null===this._template){const t=this.definition;this.element.resolveTemplate?this._template=this.element.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 styles(){var e;if(null===this._styles){const t=this.definition;this.element.resolveStyles?this._styles=this.element.resolveStyles():t.styles&&(this._styles=null!==(e=t.styles)&&void 0!==e?e:null)}return this._styles}set styles(e){this._styles!==e&&(null!==this._styles&&this.removeStyles(this._styles),this._styles=e,this.needsInitialization||this.addStyles(e))}addStyles(e){if(!e)return;const t=dt(this.element)||this.element.getRootNode();if(e instanceof HTMLElement)t.append(e);else if(!e.isAttachedTo(t)){const s=e.behaviors;e.addStylesTo(t),null!==s&&this.addBehaviors(s)}}removeStyles(e){if(!e)return;const t=dt(this.element)||this.element.getRootNode();if(e instanceof HTMLElement)t.removeChild(e);else if(e.isAttachedTo(t)){const s=e.behaviors;e.removeStylesFrom(t),null!==s&&this.removeBehaviors(s)}}addBehaviors(e){var t;const s=null!==(t=this.behaviors)&&void 0!==t?t:this.behaviors=new Map,i=e.length,n=[];for(let t=0;t<i;++t){const i=e[t];s.has(i)?s.set(i,s.get(i)+1):(s.set(i,1),n.push(i))}if(this._isConnected){const e=this.element,t=m.default;for(let s=0;s<n.length;++s)n[s].bind(e,t)}}removeBehaviors(e,t=!1){const s=this.behaviors;if(null===s)return;const i=e.length,n=[];for(let r=0;r<i;++r){const i=e[r];if(s.has(i)){const e=s.get(i)-1;0===e||t?s.delete(i)&&n.push(i):s.set(i,e)}}if(this._isConnected){const e=this.element,t=m.default;for(let s=0;s<n.length;++s)n[s].unbind(e,t)}}onConnectedCallback(){if(this._isConnected)return;const e=this.element,t=m.default;this.needsInitialization?this.finishInitialization():null!==this.view&&this.view.bind(e,t);const s=this.behaviors;if(null!==s)for(const i of s.keys())i.bind(e,t);this.setIsConnected(!0)}onDisconnectedCallback(){if(!this._isConnected)return;this.setIsConnected(!1);const e=this.view;null!==e&&e.unbind();const t=this.behaviors;if(null!==t){const e=this.element,s=m.default;for(const i of t.keys())i.unbind(e,s)}}onAttributeChangedCallback(e,t,s){const i=this.definition.attributeLookup[e];void 0!==i&&i.onAttributeChangedCallback(this.element,s)}emit(e,t,s){return!!this._isConnected&&this.element.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign({detail:t},at),s)))}finishInitialization(){const e=this.element,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.styles),this.needsInitialization=!1}renderTemplate(e){var t;const s=this.element,i=null!==(t=dt(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))}static forCustomElement(e){const t=e.$fastController;if(void 0!==t)return t;const s=ht.getForInstance(e);if(void 0===s)throw l.error(1401);return e.$fastController=new ut(e,s)}}function ft(e){return class extends e{constructor(){super(),ut.forCustomElement(this)}$emit(e,t,s){return this.$fastController.emit(e,t,s)}connectedCallback(){this.$fastController.onConnectedCallback()}disconnectedCallback(){this.$fastController.onDisconnectedCallback()}attributeChangedCallback(e,t,s){this.$fastController.onAttributeChangedCallback(e,t,s)}}}function pt(e,t){return a(e)?ht.compose(e,t).define().type:ht.compose(this,e).define().type}const gt=Object.assign(ft(HTMLElement),{from:function(e){return ft(e)},define:pt,compose:function(e,t){return a(e)?ht.compose(e,t):ht.compose(this,e)}});function bt(e){return function(t){pt(t,e)}}export{F as AdoptedStyleSheetsStrategy,k as ArrayObserver,ne as Aspect,it as AttributeDefinition,ie as Binding,de as BindingBehavior,M as CSSDirective,Ye as ChildrenDirective,Ve as Compiler,ue as ContentBehavior,ut as Controller,Q as DOM,E as ElementStyles,fe as EventBehavior,m as ExecutionContext,l as FAST,gt as FASTElement,ht as FASTElementDefinition,pe as HTMLBindingDirective,te as HTMLDirective,we as HTMLView,Y as Markup,Je as NodeObservationDirective,g as Observable,Z as Parser,p as PropertyChangeNotifier,Le as RefDirective,qe as RepeatBehavior,Qe as RepeatDirective,Ke as SlottedDirective,w as Splice,B as SpliceStrategy,C as SpliceStrategySupport,re as StatelessAttachedAttributeDirective,f as SubscriberSet,u as Updates,Ne as ViewTemplate,nt as attr,ge as bind,et as booleanConverter,Ze as children,c as createTypeRegistry,H as css,z as cssDirective,q as cssPartial,bt as customElement,Ge as elements,h as emptyArray,Fe as html,se as htmlDirective,P as lengthOf,ve as listener,ye as normalizeBinding,st as nullableNumberConverter,b as observable,be as oneTime,Me as ref,We as repeat,Xe as slotted,v as volatile,ze as when};
@@ -1203,28 +1203,11 @@ export declare interface FASTElement extends HTMLElement {
1203
1203
  * static helpers for working with FASTElements.
1204
1204
  * @public
1205
1205
  */
1206
- export declare const FASTElement: (new () => HTMLElement & FASTElement) & {
1207
- /**
1208
- * Creates a new FASTElement base class inherited from the
1209
- * provided base type.
1210
- * @param BaseType - The base element type to inherit from.
1211
- */
1212
- from<TBase extends {
1213
- new (): HTMLElement;
1214
- prototype: HTMLElement;
1215
- }>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
1216
- /**
1217
- * Defines a platform custom element based on the provided type and definition.
1218
- * @param type - The custom element type to define.
1219
- * @param nameOrDef - The name of the element to define or a definition object
1220
- * that describes the element to define.
1221
- */
1206
+ export declare const FASTElement: {
1207
+ new (): FASTElement;
1222
1208
  define: typeof define;
1223
- /**
1224
- * Defines metadata for a FASTElement which can be used to later define the element.
1225
- * @public
1226
- */
1227
1209
  compose: typeof compose;
1210
+ from: typeof from;
1228
1211
  };
1229
1212
 
1230
1213
  /**
@@ -1338,6 +1321,8 @@ export declare interface FASTGlobal {
1338
1321
  addMessages(messages: Record<number, string>): void;
1339
1322
  }
1340
1323
 
1324
+ declare function from<TBase extends typeof HTMLElement>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
1325
+
1341
1326
  /**
1342
1327
  * Transforms a template literal string into a ViewTemplate.
1343
1328
  * @param strings - The string fragments that are interpolated with the values.
@@ -392,13 +392,11 @@ export interface FASTElement extends HTMLElement {
392
392
  }
393
393
 
394
394
  // @public
395
- export const FASTElement: (new () => HTMLElement & FASTElement) & {
396
- from<TBase extends {
397
- new (): HTMLElement;
398
- prototype: HTMLElement;
399
- }>(BaseType: TBase): new () => InstanceType<TBase> & FASTElement;
395
+ export const FASTElement: {
396
+ new (): FASTElement;
400
397
  define: typeof define;
401
398
  compose: typeof compose;
399
+ from: typeof from;
402
400
  };
403
401
 
404
402
  // @public
@@ -862,8 +860,9 @@ export function when<TSource = any, TReturn = any>(condition: Expression<TSource
862
860
 
863
861
  // Warnings were encountered during analysis:
864
862
  //
865
- // dist/dts/components/fast-element.d.ts:73:5 - (ae-forgotten-export) The symbol "define" needs to be exported by the entry point index.d.ts
866
- // dist/dts/components/fast-element.d.ts:78:5 - (ae-forgotten-export) The symbol "compose" needs to be exported by the entry point index.d.ts
863
+ // dist/dts/components/fast-element.d.ts:60:5 - (ae-forgotten-export) The symbol "define" needs to be exported by the entry point index.d.ts
864
+ // dist/dts/components/fast-element.d.ts:61:5 - (ae-forgotten-export) The symbol "compose" needs to be exported by the entry point index.d.ts
865
+ // dist/dts/components/fast-element.d.ts:62:5 - (ae-forgotten-export) The symbol "from" needs to be exported by the entry point index.d.ts
867
866
 
868
867
  // (No @packageDocumentation comment for this package)
869
868