diff --git a/Makefile b/Makefile
index 54c28a5e85..b1cbc7e2f1 100644
--- a/Makefile
+++ b/Makefile
@@ -74,6 +74,7 @@ download-esm-modules: ## Download ECMAScript modules for the project
download-esm @github/relative-time-element $(JS_ESM_DIR)
download-esm @github/filter-input-element $(JS_ESM_DIR)
download-esm choices.js $(JS_ESM_DIR)
+ download-esm cally $(JS_ESM_DIR)
.cache/tandem: ## Install tandem, a tool for running multiple commands in parallel
@@ -100,6 +101,4 @@ download-esm-modules: ## Download ECMAScript modules for the project
cp node_modules/htmx.org/dist/ext/multi-swap.js $(JS_VENDOR_DIR)/htmx-ext-multi-swap.min.js
cp node_modules/alpinejs/dist/cdn.min.js $(JS_VENDOR_DIR)/alpine.min.js
cp node_modules/@alpinejs/focus/dist/cdn.min.js $(JS_VENDOR_DIR)/alpine-focus.min.js
- cp node_modules/daterangepicker/moment.min.js $(JS_VENDOR_DIR)/moment.min.js
- cp node_modules/daterangepicker/daterangepicker.js $(JS_VENDOR_DIR)/daterangepicker.min.js
@touch $@
diff --git a/hypha/apply/funds/templates/funds/includes/table_filter_and_search.html b/hypha/apply/funds/templates/funds/includes/table_filter_and_search.html
index ed12359bb2..66ad2fda96 100644
--- a/hypha/apply/funds/templates/funds/includes/table_filter_and_search.html
+++ b/hypha/apply/funds/templates/funds/includes/table_filter_and_search.html
@@ -103,59 +103,49 @@
{% enddropdown_menu %}
{% else %}
-
- {{ field.label }}
- {% heroicon_micro attributes.icon|default:"chevron-down" aria_hidden="true" size="16" class="hidden md:inline-block size-4 ms-0.5" %}
-
+ {% dropdown_menu title=field.label heading=field|get_dropdown_heading position="right" %}
+
+ {% heroicon_micro "chevron-left" aria_label="Previous" slot="previous" aria_hidden=true size=18 %}
+ {% heroicon_micro "chevron-right" aria_label="Next" slot="next" aria_hidden=true size=18 %}
+
+
+ {% enddropdown_menu %}
-
-
{% endif %}
diff --git a/hypha/apply/funds/templates/submissions/all.html b/hypha/apply/funds/templates/submissions/all.html
index 1557d609a7..99384764fe 100644
--- a/hypha/apply/funds/templates/submissions/all.html
+++ b/hypha/apply/funds/templates/submissions/all.html
@@ -46,6 +46,7 @@
hx-target="#main"
hx-push-url="true"
hx-swap="outerHTML transition:true"
+ name="querySubmissions"
>
{% dropdown_menu title="Filters" heading="Filter submissions" %}
@@ -322,19 +323,21 @@
x-show="!showSelectedSubmissions"
class="flex flex-wrap gap-2 items-center menu-filters"
>
-
-
-
+ {% dropdown_menu title="Submitted" heading="Filter by submitted date(s)" %}
+
+ {% heroicon_micro "chevron-left" aria_label="Previous" slot="previous" aria_hidden=true size=18 %}
+ {% heroicon_micro "chevron-right" aria_label="Next" slot="next" aria_hidden=true size=18 %}
+
+
+ {% enddropdown_menu %}
-
-
-
+ {% dropdown_menu title="Updated" heading="Filter by updated date(s)" %}
+
+ {% heroicon_micro "chevron-left" aria_label="Previous" slot="previous" aria_hidden=true size=18 %}
+ {% heroicon_micro "chevron-right" aria_label="Next" slot="next" aria_hidden=true size=18 %}
+
+
+ {% enddropdown_menu %}
{% dropdown_menu title="Status" heading="Filter by current status" enable_search=True %}
{% trans "No results matched your search" %
{% endspaceless %}{% endblock content %}
{% block extra_js %}
-
-
-
{% endblock %}
diff --git a/hypha/apply/funds/views/all.py b/hypha/apply/funds/views/all.py
index e8182ca557..f83753cce9 100644
--- a/hypha/apply/funds/views/all.py
+++ b/hypha/apply/funds/views/all.py
@@ -108,6 +108,8 @@ def submissions_all(
)
selected_sort = request.GET.get("sort")
page = request.GET.get("page", 1)
+ selected_updated_date = None
+ selected_submitted_date = None
can_view_archives = permissions.can_view_archived_submissions(request.user)
can_access_drafts = permissions.can_access_drafts(request.user)
@@ -143,12 +145,12 @@ def submissions_all(
qs = qs.exclude_draft()
if "submitted" in search_filters:
- qs = apply_date_filter(
+ qs, selected_submitted_date = apply_date_filter(
qs=qs, field="submit_time", values=search_filters["submitted"]
)
if "updated" in search_filters:
- qs = apply_date_filter(
+ qs, selected_updated_date = apply_date_filter(
qs=qs, field="last_update", values=search_filters["updated"]
)
@@ -323,6 +325,8 @@ def submissions_all(
"selected_reviewers": selected_reviewers,
"selected_meta_terms": selected_meta_terms,
"selected_category_options": selected_category_options,
+ "selected_updated_date": selected_updated_date,
+ "selected_submitted_date": selected_submitted_date,
"status_counts": status_counts,
"sort_options": sort_options,
"selected_sort": selected_sort,
diff --git a/hypha/apply/search/filters.py b/hypha/apply/search/filters.py
index cebebf8561..21eedab83c 100644
--- a/hypha/apply/search/filters.py
+++ b/hypha/apply/search/filters.py
@@ -1,23 +1,32 @@
import datetime as dt
+from typing import Tuple
-from django.db.models import Q
+from django.db.models import Q, QuerySet
from hypha.apply.search.query_parser import tokenize_date_filter_value
-def apply_date_filter(qs, field, values):
- """Given a queryset, a field name, and a list of date strings, filter the queryset."""
+def apply_date_filter(qs, field, values) -> Tuple[QuerySet, str]:
+ """Given a queryset, a field name, and a list of date strings, filter the queryset.
+
+ Returns:
+ tuple: the filtered queryset and the parsed date range in the format of `[YYYY-MM-DD start date]/[YYYY-MM-DD end date]`
+
+ """
q_obj = Q()
+ date_range = []
+
for date_str in values:
tokens = tokenize_date_filter_value(date_str)
+ date_range.append(f"{tokens[-3]}-{tokens[-2]:02}-{tokens[-1]:02}")
if q := date_filter_tokens_to_q_obj(tokens=tokens, field=field):
q_obj &= q
else:
return qs.none()
- return qs.filter(q_obj)
+ return (qs.filter(q_obj), "/".join(date_range))
def date_filter_tokens_to_q_obj(tokens: list, field: str) -> Q:
diff --git a/hypha/static_src/javascript/esm/cally-0-8-0.js b/hypha/static_src/javascript/esm/cally-0-8-0.js
new file mode 100644
index 0000000000..49ab51ac1d
--- /dev/null
+++ b/hypha/static_src/javascript/esm/cally-0-8-0.js
@@ -0,0 +1,7 @@
+/**
+ * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.
+ * Original file: /npm/cally@0.8.0/dist/cally.js
+ *
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
+ */
+class e{#e;#t=new Set;constructor(e){this.#e=e}get current(){return this.#e}set current(e){this.#e!=e&&(this.#e=e,this.#t.forEach((t=>t(e))))}on(e){return this.#t.add(e),()=>this.#t.delete(e)}}const t=t=>new e(t),n=Symbol.for("atomico.hooks");globalThis[n]=globalThis[n]||{};let o=globalThis[n];const r=Symbol.for("Atomico.suspense"),a=Symbol.for("Atomico.effect"),s=Symbol.for("Atomico.layoutEffect"),i=Symbol.for("Atomico.insertionEffect"),c=(e,t,n)=>{const{i:r,hooks:a}=o.c,s=a[r]=a[r]||{};return s.value=e(s.value),s.effect=t,s.tag=n,o.c.i++,a[r].value},l=()=>c(((e=t(o.c.host))=>e)),u=()=>o.c.update,d=Symbol.for;function h(e,t){const n=e.length;if(n!==t.length)return!1;for(let o=0;o"function"==typeof e,f=e=>"object"==typeof e,{isArray:y}=Array,m=(e,t)=>(!t||e instanceof HTMLStyleElement)&&"hydrate"in(e?.dataset||{});function b(e,t){let n;const o=e=>{let{length:r}=e;for(let a=0;a(e.addEventListener(t,n),()=>e.removeEventListener(t,n));class v{constructor(e,t,n){this.message=t,this.target=e,this.value=n}}class w extends v{}class k extends v{}const D="Custom",S={true:1,"":1,1:1};function x(e,t,n,o,r){const{type:a,reflect:s,event:i,value:c,attr:l=T(t)}=n?.name!=D&&f(n)&&null!=n?n:{type:n},u=a?.name===D&&a.map,d=null!=c?a!=Function&&p(c)?c:()=>c:null;Object.defineProperty(e,t,{configurable:!0,set(e){const n=this[t];d&&a!=Boolean&&null==e&&(e=d());const{error:o,value:r}=(u?N:P)(a,e);if(o&&null!=r)throw new w(this,`The value defined for prop '${t}' must be of type '${a.name}'`,r);n!=r&&(this._props[t]=r??void 0,this.update(),i&&C(this,i),this.updated.then((()=>{s&&(this._ignoreAttr=l,E(this,a,l,this[t]),this._ignoreAttr=null)})))},get(){return this._props[t]}}),d&&(r[t]=d()),o[l]={prop:t,type:a}}const C=(e,{type:t,base:n=CustomEvent,...o})=>e.dispatchEvent(new n(t,o)),T=e=>e.replace(/([A-Z])/g,"-$1").toLowerCase(),E=(e,t,n,o)=>null==o||t==Boolean&&!o?e.removeAttribute(n):e.setAttribute(n,t?.name===D&&t?.serialize?t?.serialize(o):f(o)?JSON.stringify(o):t==Boolean?"":o),N=({map:e},t)=>{try{return{value:e(t),error:!1}}catch{return{value:t,error:!0}}},P=(e,t)=>null==e||null==t?{value:t,error:!1}:e!=String&&""===t?{value:void 0,error:!1}:e==Object||e==Array||e==Symbol?{value:t,error:{}.toString.call(t)!==`[object ${e.name}]`}:t instanceof e?{value:t,error:e==Number&&Number.isNaN(t.valueOf())}:e==String||e==Number||e==Boolean?{value:t,error:e==Number?"number"!=typeof t||Number.isNaN(t):e==String?"string"!=typeof t:"boolean"!=typeof t}:{value:t,error:!0};let $=0;const A=(e,t=HTMLElement)=>{const n={},c={},l="prototype"in t&&t.prototype instanceof Element,u=l?t:"base"in t?t.base:HTMLElement,{props:d,styles:h}=l?e:t;return class extends u{constructor(){super(),this._setup(),this._render=()=>e({...this._props});for(const e in c)this[e]=c[e]}static get styles(){return[super.styles,h]}async _setup(){if(this._props)return;let e,t;this._props={},this.mounted=new Promise((n=>this.mount=()=>{n(),e!=this.parentNode&&(t!=e?this.unmounted.then(this.update):this.update()),e=this.parentNode})),this.unmounted=new Promise((o=>this.unmount=()=>{o(),(e!=this.parentNode||!this.isConnected)&&(n.cleanEffects(!0)()(),t=this.parentNode,e=null)})),this.symbolId=this.symbolId||Symbol(),this.symbolIdParent=Symbol();const n=((e,t,n=0)=>{let c={},l=!1;const u=(e,t)=>{for(const n in c){const o=c[n];o.effect&&o.tag===e&&(o.value=o.effect(o.value,t))}};return{load:a=>{let s;o.c={host:t,hooks:c,update:e,i:0,id:n};try{l=!1,s=a()}catch(e){if(e!==r)throw e;l=!0}finally{o.c=null}return s},cleanEffects:e=>(u(i,e),()=>(u(s,e),()=>{u(a,e)})),isSuspense:()=>l}})((()=>this.update()),this,(e=>(e?.dataset||{})?.hydrate||"c"+$++)(this));let c,l=!0;const u=m(this);this.update=()=>(c||(c=!0,this.updated=(this.updated||this.mounted).then((()=>{try{const e=n.load(this._render),t=n.cleanEffects();return e&&e.render(this,this.symbolId,u),c=!1,l&&!n.isSuspense()&&(l=!1,!u&&function(e){const{styles:t}=e.constructor,{shadowRoot:n}=e;if(n&&t.length){const e=[];b(t,(t=>{t&&(t instanceof Element?n.appendChild(t.cloneNode(!0)):e.push(t))})),e.length&&(n.adoptedStyleSheets=e)}}(this)),t()}finally{c=!1}})).then((e=>{e&&e()}))),this.updated),this.update()}connectedCallback(){this.mount(),super.connectedCallback&&super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),this.unmount()}attributeChangedCallback(e,t,o){if(n[e]){if(e===this._ignoreAttr||t===o)return;const{prop:r,type:a}=n[e];try{this[r]=((e,t)=>e==Boolean?!!S[t]:e==Number?Number(t):e==String?t:e==Array||e==Object?JSON.parse(t):e.name==D?t:new e(t))(a,o)}catch{throw new k(this,`The value defined as attr '${e}' cannot be parsed by type '${a.name}'`,o)}}else super.attributeChangedCallback(e,t,o)}static get props(){return{...super.props,...d}}static get observedAttributes(){const e=super.observedAttributes||[];for(const e in d)x(this.prototype,e,d[e],n,c);return Object.keys(n).concat(e)}}};const M=e=>(t,n)=>{c((([e,t]=[])=>((t||!t)&&(t&&h(t,n)?e=e||!0:(p(e)&&e(),e=null)),[e,n])),(([e,n],o)=>o?(p(e)&&e(),[]):[e||t(),n]),e)},U=M(a),F=M(i);class O extends Array{constructor(e,t){let n=!0;const o=e=>{try{t(e,this,n)}finally{n=!1}};super(void 0,o,t),o(e)}}const j=e=>{const t=u();return c(((n=new O(e,((e,n,o)=>{(e=p(e)?e(n[0]):e)!==n[0]&&(n[0]=e,o||t())})))=>n))},q=(e,t)=>{const[n]=c((([n,o,r=0]=[])=>((!o||o&&!h(o,t))&&(n=e()),[n,t,r])));return n},_=e=>{const{current:t}=l();if(!(e in t))throw new w(t,`For useProp("${e}"), the prop does not exist on the host.`,e);return c(((n=new O(t[e],((n,o)=>{n=p(n)?n(t[e]):n,t[e]=n})))=>(n[0]=t[e],n)))},z=(e,t={})=>{const n=l();return n[e]||(n[e]=(o=t.detail)=>C(n.current,{type:e,...t,detail:o})),n[e]},B=d("atomico/options");globalThis[B]=globalThis[B]||{sheet:!!document.adoptedStyleSheets};const L=globalThis[B],Y={checked:1,value:1,selected:1},I={list:1,type:1,size:1,form:1,width:1,height:1,src:1,href:1,slot:1},R={shadowDom:1,staticNode:1,cloneNode:1,children:1,key:1},H={},V=[];class W extends Text{}const J=d("atomico/id"),K=d("atomico/type"),Z=d("atomico/ref"),G=d("atomico/vnode"),Q=()=>{};function X(e,t,n){return te(this,e,t,n)}const ee=(e,t,...n)=>{const o=t||H;let{children:r}=o;if(r=r??(n.length?n:V),e===Q)return r;const a=e?e instanceof Node?1:e.prototype instanceof HTMLElement&&2:0;if(!1===a&&e instanceof Function)return e(r!=V?{children:r,...o}:o);const s=L.render||X;return{[K]:G,type:e,props:o,children:r,key:o.key,shadow:o.shadowDom,static:o.staticNode,raw:a,is:o.is,clone:o.cloneNode,render:s}};function te(e,t,n=J,o,r){let a;if(t&&t[n]&&t[n].vnode==e||e[K]!=G)return t;(e||!t)&&(r=r||"svg"==e.type,a="host"!=e.type&&(1==e.raw?(t&&e.clone?t[Z]:t)!=e.type:2==e.raw?!(t instanceof e.type):t?t[Z]||t.localName!=e.type:!t),a&&null!=e.type&&(1==e.raw&&e.clone?(o=!0,(t=e.type.cloneNode(!0))[Z]=e.type):t=1==e.raw?e.type:2==e.raw?new e.type:r?document.createElementNS("http://www.w3.org/2000/svg",e.type):document.createElement(e.type,e.is?{is:e.is}:void 0)));const s=t[n]?t[n]:H,{vnode:i=H,cycle:c=0}=s;let{fragment:l,handlers:u}=s;const{children:d=V,props:h=H}=i;if(u=a?{}:u||{},e.static&&!a)return t;if(e.shadow&&!t.shadowRoot&&t.attachShadow({mode:"open",...e.shadow}),e.props!=h&&function(e,t,n,o,r){for(const a in t)!(a in n)&&ne(e,a,t[a],null,r,o);for(const a in n)ne(e,a,t[a],n[a],r,o)}(t,h,e.props,u,r),e.children!==d){const a=e.shadow?t.shadowRoot:t;l=function(e,t,n,o,r,a){e=null==e?null:y(e)?e:[e];const s=t||function(e,t){const n=new W(""),o=new W("");let r;if(e[t?"prepend":"append"](n),t){let{lastElementChild:t}=e;for(;t;){const{previousElementSibling:e}=t;if(m(t,!0)&&!m(e,!0)){r=t;break}t=e}}return r?r.before(o):e.append(o),{markStart:n,markEnd:o}}(n,r),{markStart:i,markEnd:c,keyes:l}=s;let u;const d=l&&new Set;let h=i;if(e&&b(e,(e=>{if("object"==typeof e&&!e[K])return;const t=e[K]&&e.key,s=l&&null!=t&&l.get(t);h!=c&&h===s?d.delete(h):h=h==c?c:h.nextSibling;const i=l?s:h;let p=i;if(e[K])p=te(e,i,o,r,a);else{const t=e+"";!(p instanceof Text)||p instanceof W?p=new Text(t):p.data!=t&&(p.data=t)}p!=h&&(l&&d.delete(p),!i||l?(n.insertBefore(p,h),l&&h!=c&&d.add(h)):i==c?n.insertBefore(p,c):(n.replaceChild(p,i),h=p)),null!=t&&(u=u||new Map,u.set(t,p))})),h=h==c?c:h.nextSibling,t&&h!=c)for(;h!=c;){const e=h;h=h.nextSibling,e.remove()}return d&&d.forEach((e=>e.remove())),s.keyes=u,s}(e.children,l,a,n,!c&&o,(!r||"foreignObject"!=e.type)&&r)}return t[n]={vnode:e,handlers:u,fragment:l,cycle:c+1},t}function ne(e,t,n,o,r,a){if(n=n??null,o=o??null,(t="class"!=t||r?t:"className")in e&&Y[t]&&(n=e[t]),o!==n&&!R[t]&&"_"!=t[0])if("o"==t[0]&&"n"==t[1]&&(p(o)||p(n)))!function(e,t,n,o){if(o.handleEvent||(o.handleEvent=t=>o[t.type].call(e,t)),n){if(!o[t]){const r=n.capture||n.once||n.passive?Object.assign({},n):null;e.addEventListener(t,o,r)}o[t]=n}else o[t]&&(e.removeEventListener(t,o),delete o[t])}(e,t.slice(2),o,a);else if("ref"==t)o&&(p(o)?o(e):o.current=e);else if("style"==t){const{style:t}=e;o=o||"";const r=f(n=n||""),a=f(o);if(r)for(const e in n){if(!a)break;!(e in o)&&oe(t,e,null)}if(a)for(const e in o){const a=o[e];r&&n[e]===a||oe(t,e,a)}else t.cssText=o}else{const a="$"==t[0]?t.slice(1):t;a===t&&(!r&&!I[t]&&t in e||p(o)||p(n))?e[t]=o??"":null==o?e.removeAttribute(a):e.setAttribute(a,f(o)?JSON.stringify(o):o)}}function oe(e,t,n){let o="setProperty";null==n&&(o="removeProperty",n=null),~t.indexOf("-")?e[o](t,n):e[t]=n}const re={};function ae(e,...t){const n=(e.raw||e).reduce(((e,n,o)=>e+n+(t[o]||"")),"");return re[n]=re[n]||function(e){if(L.sheet){const t=new CSSStyleSheet;return t.replaceSync(e),t}{const t=document.createElement("style");return t.textContent=e,t}}(n)}const se=ee("host",{style:"display: contents"}),ie=d("atomico/context"),ce=e=>{const t=(e=>{const t=z("ConnectContext",{bubbles:!0,composed:!0}),n=()=>{let n;return t({id:e,connect(e){n=e}}),n},[o,r]=j(n);return U((()=>{o||(e[ie]||(e[ie]=customElements.whenDefined((new e).localName)),e[ie].then((()=>r(n))))}),[e]),o})(e),n=u();return U((()=>{if(t)return g(t,"UpdatedValue",n)}),[t]),(t||e).value},le=(e,t,n)=>(null==t?t={key:n}:t.key=n,ee(e,t)),ue=le,de=ae`*,*:before,*:after{box-sizing:border-box}button{padding:0;touch-action:manipulation;cursor:pointer;user-select:none}`,he=ae`.vh{position:absolute;transform:scale(0)}`;function pe(){const e=new Date;return new De(e.getFullYear(),e.getMonth()+1,e.getDate())}function fe(e,t=0){const n=ve(e),o=n.getUTCDay(),r=(o0?n:e}const ge={days:1};function ve(e){return new Date(Date.UTC(e.year,e.month-1,e.day??1))}const we=/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[0-1])$/,ke=(e,t)=>e.toString().padStart(t,"0");class De{constructor(e,t,n){this.year=e,this.month=t,this.day=n}add(e){const t=ve(this);if("days"in e)return t.setUTCDate(this.day+e.days),De.from(t);let{year:n,month:o}=this;"months"in e?(o=this.month+e.months,t.setUTCMonth(o-1)):(n=this.year+e.years,t.setUTCFullYear(n));const r=De.from(ve({year:n,month:o,day:1}));return be(De.from(t),r,me(r))}toString(){return`${ke(this.year,4)}-${ke(this.month,2)}-${ke(this.day,2)}`}toPlainYearMonth(){return new Se(this.year,this.month)}equals(e){return 0===De.compare(this,e)}static compare(e,t){return e.yeart.year?1:e.montht.month?1:e.dayt.day?1:0}static from(e){if("string"==typeof e){const t=e.match(we);if(!t)throw new TypeError(e);const[,n,o,r]=t;return new De(parseInt(n,10),parseInt(o,10),parseInt(r,10))}return new De(e.getUTCFullYear(),e.getUTCMonth()+1,e.getUTCDate())}}class Se{constructor(e,t){this.year=e,this.month=t}add(e){const t=ve(this),n=(e.months??0)+12*(e.years??0);return t.setUTCMonth(t.getUTCMonth()+n),new Se(t.getUTCFullYear(),t.getUTCMonth()+1)}equals(e){return this.year===e.year&&this.month===e.month}toPlainDate(){return new De(this.year,this.month,1)}}function xe(e,t){if(t)try{return e.from(t)}catch{}}function Ce(e){const[t,n]=_(e);return[q((()=>xe(De,t)),[t]),e=>n(e?.toString())]}function Te(e,t){return q((()=>new Intl.DateTimeFormat(t,{timeZone:"UTC",...e})),[t,e])}function Ee(e,t,n){const o=Te(e,n);return q((()=>{const e=[],n=new Date;for(var r=0;r<7;r++){e[(n.getUTCDay()-t+7)%7]=o.format(n),n.setUTCDate(n.getUTCDate()+1)}return e}),[t,o])}const Ne=(e,t,n)=>be(e,t,n)===e,Pe=e=>e.target.matches(":dir(ltr)"),$e={month:"long",day:"numeric"},Ae={month:"long"},Me={weekday:"long"},Ue={bubbles:!0};function Fe({props:e,context:t}){const{offset:n}=e,{firstDayOfWeek:o,isDateDisallowed:r,min:a,max:s,today:i,page:c,locale:l,focusedDate:u,formatWeekday:d}=t,h=i??pe(),p=Ee(Me,o,l),f=Ee(q((()=>({weekday:d})),[d]),o,l),y=Te($e,l),m=Te(Ae,l),b=q((()=>c.start.add({months:n})),[c,n]),g=q((()=>function(e,t=0){let n=fe(e.toPlainDate(),t);const o=ye(me(e),t),r=[];for(;De.compare(n,o)<0;){const e=[];for(let t=0;t<7;t++)e.push(n),n=n.add(ge);r.push(e)}return r}(b,o)),[b,o]),v=z("focusday",Ue),w=z("selectday",Ue),k=z("hoverday",Ue);function D(e){v(be(e,a,s))}function S(e){let t;switch(e.key){case"ArrowRight":t=u.add({days:Pe(e)?1:-1});break;case"ArrowLeft":t=u.add({days:Pe(e)?-1:1});break;case"ArrowDown":t=u.add({days:7});break;case"ArrowUp":t=u.add({days:-7});break;case"PageUp":t=u.add(e.shiftKey?{years:-1}:{months:-1});break;case"PageDown":t=u.add(e.shiftKey?{years:1}:{months:1});break;case"Home":t=fe(u,o);break;case"End":t=ye(u,o);break;default:return}D(t),e.preventDefault()}return{weeks:g,yearMonth:b,daysLong:p,daysVisible:f,formatter:m,getDayProps:function(e){const n=b.equals(e);if(!t.showOutsideDays&&!n)return;const o=e.equals(u),i=e.equals(h),c=ve(e),l=r?.(c),d=!Ne(e,a,s);let p,f="";if("range"===t.type){const[n,o]=t.value,r=n?.equals(e),a=o?.equals(e);p=n&&o&&Ne(e,n,o),f=`${r?"range-start":""} ${a?"range-end":""} ${!p||r||a?"":"range-inner"}`}else p="multi"===t.type?t.value.some((t=>t.equals(e))):t.value?.equals(e);return{part:`button day day-${c.getDay()} ${n?p?"selected":"":"outside"} ${l?"disallowed":""} ${i?"today":""} ${t.getDayParts?.(c)??""} ${f}`,tabindex:n&&o?0:-1,disabled:d,"aria-disabled":l?"true":void 0,"aria-pressed":n&&p,"aria-current":i?"date":void 0,"aria-label":y.format(c),onkeydown:S,onclick(){l||w(e),D(e)},onmouseover(){!l&&!d&&k(e)}}}}}const Oe=pe(),je=(e=>{const t=A((()=>(((e,t)=>{const n=l();F((()=>g(n.current,"ConnectContext",(n=>{e===n.detail.id&&(n.stopPropagation(),n.detail.connect(t))}))),[e])})(t,l().current),se)),{props:{value:{type:Object,event:{type:"UpdatedValue"},value:()=>e}}});return t.value=e,t})({type:"date",firstDayOfWeek:1,focusedDate:Oe,page:{start:Oe.toPlainYearMonth(),end:Oe.toPlainYearMonth()}});customElements.define("calendar-ctx",je);const qe=(e,t)=>(t+e)%7,_e=A((e=>{const n=ce(je),o=(e=>c(((n=t(e))=>n)))(),r=Fe({props:e,context:n});return ue("host",{shadowDom:!0,focus:function(){o.current.querySelector("button[tabindex='0']")?.focus()},children:[le("div",{id:"h",part:"heading",children:r.formatter.format(ve(r.yearMonth))}),ue("table",{ref:o,"aria-labelledby":"h",part:"table",children:[le("thead",{children:le("tr",{part:"tr head",children:r.daysLong.map(((e,t)=>ue("th",{part:`th day day-${qe(n.firstDayOfWeek,t)}`,scope:"col",children:[le("span",{class:"vh",children:e}),le("span",{"aria-hidden":"true",children:r.daysVisible[t]})]})))})}),le("tbody",{children:r.weeks.map(((e,t)=>le("tr",{part:"tr week",children:e.map(((e,t)=>{const n=r.getDayProps(e);return le("td",{part:"td",children:n&&le("button",{...n,children:e.day})},t)}))},t)))})]})]})}),{props:{offset:{type:Number,value:0}},styles:[de,he,ae`:host{--color-accent: black;--color-text-on-accent: white;display:flex;flex-direction:column;gap:.25rem;text-align:center;inline-size:fit-content}table{border-collapse:collapse;font-size:.875rem}th{font-weight:700;block-size:2.25rem}td{padding-inline:0}button{color:inherit;font-size:inherit;background:transparent;border:0;font-variant-numeric:tabular-nums;block-size:2.25rem;inline-size:2.25rem}button:hover:where(:not(:disabled,[aria-disabled])){background:#0000000d}button:is([aria-pressed=true],:focus-visible){background:var(--color-accent);color:var(--color-text-on-accent)}button:focus-visible{outline:1px solid var(--color-text-on-accent);outline-offset:-2px}button:disabled,:host::part(outside),:host::part(disallowed){cursor:default;opacity:.5}`]});function ze(e){return le("button",{part:`button ${e.name} ${e.onclick?"":"disabled"}`,onclick:e.onclick,"aria-disabled":e.onclick?null:"true",children:le("slot",{name:e.name,children:e.children})})}function Be(e){const t=ve(e.page.start),n=ve(e.page.end);return ue("div",{role:"group","aria-labelledby":"h",part:"container",children:[le("div",{id:"h",class:"vh","aria-live":"polite","aria-atomic":"true",children:e.formatVerbose.formatRange(t,n)}),ue("div",{part:"header",children:[le(ze,{name:"previous",onclick:e.previous,children:"Previous"}),le("slot",{part:"heading",name:"heading",children:le("div",{"aria-hidden":"true",children:e.format.formatRange(t,n)})}),le(ze,{name:"next",onclick:e.next,children:"Next"})]}),le(je,{value:e,onselectday:e.onSelect,onfocusday:e.onFocus,onhoverday:e.onHover,children:le("slot",{})})]})}customElements.define("calendar-month",_e);const Le={value:{type:String,value:""},min:{type:String,value:""},max:{type:String,value:""},today:{type:String,value:""},isDateDisallowed:{type:Function,value:e=>!1},formatWeekday:{type:String,value:()=>"narrow"},getDayParts:{type:Function,value:e=>""},firstDayOfWeek:{type:Number,value:()=>1},showOutsideDays:{type:Boolean,value:!1},locale:{type:String,value:()=>{}},months:{type:Number,value:1},focusedDate:{type:String,value:()=>{}},pageBy:{type:String,value:()=>"months"}},Ye=[de,he,ae`:host{display:block;inline-size:fit-content}[role=group]{display:flex;flex-direction:column;gap:1em}:host::part(header){display:flex;align-items:center;justify-content:space-between}:host::part(heading){font-weight:700;font-size:1.25em}button{display:flex;align-items:center;justify-content:center}button[aria-disabled]{cursor:default;opacity:.5}`],Ie={year:"numeric"},Re={year:"numeric",month:"long"};function He(e,t){return 12*(t.year-e.year)+t.month-e.month}const Ve=(e,t)=>({start:e=12===t?new Se(e.year,1):e,end:e.add({months:t-1})});function We({months:e,pageBy:t,locale:n,focusedDate:o,setFocusedDate:r}){const[a]=Ce("min"),[s]=Ce("max"),[i]=Ce("today"),c=z("focusday"),u=z("change"),d=q((()=>be(o??i??pe(),a,s)),[o,i,a,s]);function h(e){r(e),c(ve(e))}const{next:p,previous:f,page:y}=function({pageBy:e,focusedDate:t,months:n,max:o,min:r,goto:a}){const s="single"===e?1:n,[i,c]=j((()=>Ve(t.toPlainYearMonth(),n))),l=e=>c(Ve(i.start.add({months:e}),n)),u=e=>{const t=He(i.start,e.toPlainYearMonth());return t>=0&&t{if(u(t))return;const e=He(t.toPlainYearMonth(),i.start);a(t.add({months:e}))}),[i.start]),U((()=>{if(u(t))return;const e=He(i.start,t.toPlainYearMonth());l(-1===e?-s:e===n?s:Math.floor(e/n)*n)}),[t,s,n]),{page:i,previous:r&&u(r)?void 0:()=>l(-s),next:o&&u(o)?void 0:()=>l(s)}}({pageBy:t,focusedDate:d,months:e,min:a,max:s,goto:h}),m=l();function b(e){const t=e?.target??"day";"day"===t?m.current.querySelectorAll("calendar-month").forEach((t=>t.focus(e))):m.current.shadowRoot.querySelector(`[part~='${t}']`).focus(e)}return{format:Te(Ie,n),formatVerbose:Te(Re,n),page:y,focusedDate:d,dispatch:u,onFocus(e){e.stopPropagation(),h(e.detail),setTimeout(b)},min:a,max:s,today:i,next:p,previous:f,focus:b}}const Je=A((e=>{const[t,n]=Ce("value"),[o=t,r]=Ce("focusedDate"),a=We({...e,focusedDate:o,setFocusedDate:r});return le("host",{shadowDom:!0,focus:a.focus,children:le(Be,{...e,...a,type:"date",value:t,onSelect:function(e){n(e.detail),a.dispatch()}})})}),{props:Le,styles:Ye});customElements.define("calendar-date",Je);const Ke=(e,t)=>De.compare(e,t)<0?[e,t]:[t,e],Ze=A((e=>{const[t,n]=function(e){const[t="",n]=_(e);return[q((()=>{const[e,n]=t.split("/"),o=xe(De,e),r=xe(De,n);return o&&r?[o,r]:[]}),[t]),e=>n(`${e[0]}/${e[1]}`)]}("value"),[o=t[0],r]=Ce("focusedDate"),a=We({...e,focusedDate:o,setFocusedDate:r}),s=z("rangestart"),i=z("rangeend"),[c,l]=Ce("tentative"),[u,d]=j();function h(e){e.stopPropagation(),c&&d(e.detail)}U((()=>d(void 0)),[c]);const p=c?Ke(c,u??c):t;return le("host",{shadowDom:!0,focus:a.focus,children:le(Be,{...e,...a,type:"range",value:p,onFocus:function(e){a.onFocus(e),h(e)},onHover:h,onSelect:function(e){const t=e.detail;e.stopPropagation(),c?(n(Ke(c,t)),l(void 0),i(ve(t)),a.dispatch()):(l(t),s(ve(t)))}})})}),{props:{...Le,tentative:{type:String,value:""}},styles:Ye});customElements.define("calendar-range",Ze);const Ge=A((e=>{const[t,n]=function(e){const[t="",n]=_(e);return[q((()=>{const e=[];for(const n of t.trim().split(/\s+/)){const t=xe(De,n);t&&e.push(t)}return e}),[t]),e=>n(e.join(" "))]}("value"),[o=t[0],r]=Ce("focusedDate"),a=We({...e,focusedDate:o,setFocusedDate:r});return le("host",{shadowDom:!0,focus:a.focus,children:le(Be,{...e,...a,type:"multi",value:t,onSelect:function(e){const o=[...t],r=t.findIndex((t=>t.equals(e.detail)));r<0?o.push(e.detail):o.splice(r,1),n(o),a.dispatch()}})})}),{props:Le,styles:Ye});customElements.define("calendar-multi",Ge);export{Je as CalendarDate,_e as CalendarMonth,Ge as CalendarMulti,Ze as CalendarRange};export default null;
diff --git a/hypha/static_src/javascript/esm/choices.js-11-1-0.js b/hypha/static_src/javascript/esm/choices.js-11-1-0.js
new file mode 100644
index 0000000000..5a18c770ea
--- /dev/null
+++ b/hypha/static_src/javascript/esm/choices.js-11-1-0.js
@@ -0,0 +1,8 @@
+/**
+ * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.
+ * Original file: /npm/choices.js@11.1.0/public/assets/scripts/choices.mjs
+ *
+ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
+ */
+/*! choices.js v11.1.0 | © 2025 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
+var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};function t(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var i=function(){return i=Object.assign||function(e){for(var t,i=1,n=arguments.length;i/g,">").replace(/=0&&!window.matchMedia("(min-height: ".concat(e+1,"px)")).matches:"top"===this.position&&(i=!0),i},e.prototype.setActiveDescendant=function(e){this.element.setAttribute("aria-activedescendant",e)},e.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},e.prototype.open=function(e,t){te(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(e,t)&&(te(this.element,this.classNames.flippedState),this.isFlipped=!0)},e.prototype.close=function(){ie(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(ie(this.element,this.classNames.flippedState),this.isFlipped=!1)},e.prototype.addFocusState=function(){te(this.element,this.classNames.focusState)},e.prototype.removeFocusState=function(){ie(this.element,this.classNames.focusState)},e.prototype.enable=function(){ie(this.element,this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),this.type===j&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1},e.prototype.disable=function(){te(this.element,this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),this.type===j&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0},e.prototype.wrap=function(e){var t=this.element,i=e.parentNode;i&&(e.nextSibling?i.insertBefore(t,e.nextSibling):i.appendChild(t)),t.appendChild(e)},e.prototype.unwrap=function(e){var t=this.element,i=t.parentNode;i&&(i.insertBefore(e,t),i.removeChild(t))},e.prototype.addLoadingState=function(){te(this.element,this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0},e.prototype.removeLoadingState=function(){ie(this.element,this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1},e}(),re=function(){function e(e){var t=e.element,i=e.type,n=e.classNames,s=e.preventPaste;this.element=t,this.type=i,this.classNames=n,this.preventPaste=s,this.isFocussed=this.element.isEqualNode(document.activeElement),this.isDisabled=t.disabled,this._onPaste=this._onPaste.bind(this),this._onInput=this._onInput.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this)}return Object.defineProperty(e.prototype,"placeholder",{set:function(e){this.element.placeholder=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.addEventListeners=function(){var e=this.element;e.addEventListener("paste",this._onPaste),e.addEventListener("input",this._onInput,{passive:!0}),e.addEventListener("focus",this._onFocus,{passive:!0}),e.addEventListener("blur",this._onBlur,{passive:!0})},e.prototype.removeEventListeners=function(){var e=this.element;e.removeEventListener("input",this._onInput),e.removeEventListener("paste",this._onPaste),e.removeEventListener("focus",this._onFocus),e.removeEventListener("blur",this._onBlur)},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.isDisabled=!0},e.prototype.focus=function(){this.isFocussed||this.element.focus()},e.prototype.blur=function(){this.isFocussed&&this.element.blur()},e.prototype.clear=function(e){return void 0===e&&(e=!0),this.element.value="",e&&this.setWidth(),this},e.prototype.setWidth=function(){var e=this.element;e.style.minWidth="".concat(e.placeholder.length+1,"ch"),e.style.width="".concat(e.value.length+1,"ch")},e.prototype.setActiveDescendant=function(e){this.element.setAttribute("aria-activedescendant",e)},e.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},e.prototype._onInput=function(){this.type!==j&&this.setWidth()},e.prototype._onPaste=function(e){this.preventPaste&&e.preventDefault()},e.prototype._onFocus=function(){this.isFocussed=!0},e.prototype._onBlur=function(){this.isFocussed=!1},e}(),ce=function(){function e(e){var t=e.element;this.element=t,this.scrollPos=this.element.scrollTop,this.height=this.element.offsetHeight}return e.prototype.prepend=function(e){var t=this.element.firstElementChild;t?this.element.insertBefore(e,t):this.element.append(e)},e.prototype.scrollToTop=function(){this.element.scrollTop=0},e.prototype.scrollToChildElement=function(e,t){var i=this;if(e){var n=this.element.offsetHeight,s=this.element.scrollTop+n,o=e.offsetHeight,r=e.offsetTop+o,c=t>0?this.element.scrollTop+r-s:e.offsetTop;requestAnimationFrame((function(){i._animateScroll(c,t)}))}},e.prototype._scrollDown=function(e,t,i){var n=(i-e)/t,s=n>1?n:1;this.element.scrollTop=e+s},e.prototype._scrollUp=function(e,t,i){var n=(e-i)/t,s=n>1?n:1;this.element.scrollTop=e-s},e.prototype._animateScroll=function(e,t){var i=this,n=this.element.scrollTop,s=!1;t>0?(this._scrollDown(n,4,e),ne&&(s=!0)),s&&requestAnimationFrame((function(){i._animateScroll(e,t)}))},e}(),ae=function(){function e(e){var t=e.element,i=e.classNames;this.element=t,this.classNames=i,this.isDisabled=!1}return Object.defineProperty(e.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.setAttribute("value",e),this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.conceal=function(){var e=this.element;te(e,this.classNames.input),e.hidden=!0,e.tabIndex=-1;var t=e.getAttribute("style");t&&e.setAttribute("data-choice-orig-style",t),e.setAttribute("data-choice","active")},e.prototype.reveal=function(){var e=this.element;ie(e,this.classNames.input),e.hidden=!1,e.removeAttribute("tabindex");var t=e.getAttribute("data-choice-orig-style");t?(e.removeAttribute("data-choice-orig-style"),e.setAttribute("style",t)):e.removeAttribute("style"),e.removeAttribute("data-choice")},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},e.prototype.triggerEvent=function(e,t){!function(e,t,i){void 0===i&&(i=null);var n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0});e.dispatchEvent(n)}(this.element,e,t||{})},e}(),he=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i}(ae),le=function(e,t){return void 0===t&&(t=!0),void 0===e?t:!!e},ue=function(e){if("string"==typeof e&&(e=e.split(" ").filter((function(e){return e.length}))),Array.isArray(e)&&e.length)return e},de=function(e,t,i){if(void 0===i&&(i=!0),"string"==typeof e){var n=q(e);return de({value:e,label:i||n===e?e:{escaped:n,raw:e},selected:!0},!1)}var s=e;if("choices"in s){if(!t)throw new TypeError("optGroup is not allowed");var o=s,r=o.choices.map((function(e){return de(e,!1)}));return{id:0,label:z(o.label)||o.value,active:!!r.length,disabled:!!o.disabled,choices:r}}var c=s;return{id:0,group:null,score:0,rank:0,value:c.value,label:c.label||c.value,active:le(c.active),selected:le(c.selected,!1),disabled:le(c.disabled,!1),placeholder:le(c.placeholder,!1),highlighted:!1,labelClass:ue(c.labelClass),labelDescription:c.labelDescription,customProperties:c.customProperties}},pe=function(e){return"SELECT"===e.tagName},fe=function(e){function i(t){var i=t.element,n=t.classNames,s=t.template,o=t.extractPlaceholder,r=e.call(this,{element:i,classNames:n})||this;return r.template=s,r.extractPlaceholder=o,r}return t(i,e),Object.defineProperty(i.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),i.prototype.addOptions=function(e){var t=this,i=document.createDocumentFragment();e.forEach((function(e){var n=e;if(!n.element){var s=t.template(n);i.appendChild(s),n.element=s}})),this.element.appendChild(i)},i.prototype.optionsAsChoices=function(){var e=this,t=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach((function(i){!function(e){return"OPTION"===e.tagName}(i)?function(e){return"OPTGROUP"===e.tagName}(i)&&t.push(e._optgroupToChoice(i)):t.push(e._optionToChoice(i))})),t},i.prototype._optionToChoice=function(e){return!e.hasAttribute("value")&&e.hasAttribute("placeholder")&&(e.setAttribute("value",""),e.value=""),{id:0,group:null,score:0,rank:0,value:e.value,label:e.label,element:e,active:!0,selected:this.extractPlaceholder?e.selected:e.hasAttribute("selected"),disabled:e.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(!e.value||e.hasAttribute("placeholder")),labelClass:void 0!==e.dataset.labelClass?ue(e.dataset.labelClass):void 0,labelDescription:void 0!==e.dataset.labelDescription?e.dataset.labelDescription:void 0,customProperties:ne(e.dataset.customProperties)}},i.prototype._optgroupToChoice=function(e){var t=this,i=e.querySelectorAll("option"),n=Array.from(i).map((function(e){return t._optionToChoice(e)}));return{id:0,label:e.label||"",element:e,active:!!n.length,disabled:e.disabled,choices:n}},i}(ae),me={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,closeDropdownOnSelect:"auto",singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(e){return!!e&&""!==e},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!1,duplicateItemsAllowed:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,shouldSort:!0,shouldSortItems:!1,sorter:function(e,t){var i=e.value,n=e.label,s=void 0===n?i:n,o=t.value,r=t.label,c=void 0===r?o:r;return z(s).localeCompare(z(c),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,placeholder:!0,placeholderValue:null,searchPlaceholderValue:null,prependValue:null,appendValue:null,renderSelectedChoices:"auto",loadingText:"Loading...",noResultsText:"No results found",noChoicesText:"No choices to choose from",itemSelectText:"Press to select",uniqueItemText:"Only unique values can be added",customAddItemText:"Only values matching specific conditions can be added",addItemText:function(e){return'Press Enter to add "'.concat(e,'"')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(e){return"Remove item: ".concat(e)},maxItemText:function(e){return"Only ".concat(e," values can be added")},valueComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:["choices"],containerInner:["choices__inner"],input:["choices__input"],inputCloned:["choices__input--cloned"],list:["choices__list"],listItems:["choices__list--multiple"],listSingle:["choices__list--single"],listDropdown:["choices__list--dropdown"],item:["choices__item"],itemSelectable:["choices__item--selectable"],itemDisabled:["choices__item--disabled"],itemChoice:["choices__item--choice"],description:["choices__description"],placeholder:["choices__placeholder"],group:["choices__group"],groupHeading:["choices__heading"],button:["choices__button"],activeState:["is-active"],focusState:["is-focused"],openState:["is-open"],disabledState:["is-disabled"],highlightedState:["is-highlighted"],selectedState:["is-selected"],flippedState:["is-flipped"],loadingState:["is-loading"],notice:["choices__notice"],addChoice:["choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},ge=function(e){var t=e.itemEl;t&&(t.remove(),e.itemEl=void 0)};var ve={groups:function(e,t){var i=e,n=!0;switch(t.type){case l:i.push(t.group);break;case h:i=[];break;default:n=!1}return{state:i,update:n}},items:function(e,t,i){var n=e,s=!0;switch(t.type){case u:t.item.selected=!0,(o=t.item.element)&&(o.selected=!0,o.setAttribute("selected","")),n.push(t.item);break;case d:var o;if(t.item.selected=!1,o=t.item.element){o.selected=!1,o.removeAttribute("selected");var c=o.parentElement;c&&pe(c)&&c.type===j&&(c.value="")}ge(t.item),n=n.filter((function(e){return e.id!==t.item.id}));break;case r:ge(t.choice),n=n.filter((function(e){return e.id!==t.choice.id}));break;case p:var a=t.highlighted,h=n.find((function(e){return e.id===t.item.id}));h&&h.highlighted!==a&&(h.highlighted=a,i&&function(e,t,i){var n=e.itemEl;n&&(ie(n,i),te(n,t))}(h,a?i.classNames.highlightedState:i.classNames.selectedState,a?i.classNames.selectedState:i.classNames.highlightedState));break;default:s=!1}return{state:n,update:s}},choices:function(e,t,i){var n=e,s=!0;switch(t.type){case o:n.push(t.choice);break;case r:t.choice.choiceEl=void 0,t.choice.group&&(t.choice.group.choices=t.choice.group.choices.filter((function(e){return e.id!==t.choice.id}))),n=n.filter((function(e){return e.id!==t.choice.id}));break;case u:case d:t.item.choiceEl=void 0;break;case c:var l=[];t.results.forEach((function(e){l[e.item.id]=e})),n.forEach((function(e){var t=l[e.id];void 0!==t?(e.score=t.score,e.rank=t.rank,e.active=!0):(e.score=0,e.rank=0,e.active=!1),i&&i.appendGroupInSearch&&(e.choiceEl=void 0)}));break;case a:n.forEach((function(e){e.active=t.active,i&&i.appendGroupInSearch&&(e.choiceEl=void 0)}));break;case h:n=[];break;default:s=!1}return{state:n,update:s}}},_e=function(){function e(e){this._state=this.defaultState,this._listeners=[],this._txn=0,this._context=e}return Object.defineProperty(e.prototype,"defaultState",{get:function(){return{groups:[],items:[],choices:[]}},enumerable:!1,configurable:!0}),e.prototype.changeSet=function(e){return{groups:e,items:e,choices:e}},e.prototype.reset=function(){this._state=this.defaultState;var e=this.changeSet(!0);this._txn?this._changeSet=e:this._listeners.forEach((function(t){return t(e)}))},e.prototype.subscribe=function(e){return this._listeners.push(e),this},e.prototype.dispatch=function(e){var t=this,i=this._state,n=!1,s=this._changeSet||this.changeSet(!1);Object.keys(ve).forEach((function(o){var r=ve[o](i[o],e,t._context);r.update&&(n=!0,s[o]=!0,i[o]=r.state)})),n&&(this._txn?this._changeSet=s:this._listeners.forEach((function(e){return e(s)})))},e.prototype.withTxn=function(e){this._txn++;try{e()}finally{if(this._txn=Math.max(0,this._txn-1),!this._txn){var t=this._changeSet;t&&(this._changeSet=void 0,this._listeners.forEach((function(e){return e(t)})))}}},Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this.state.items},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"highlightedActiveItems",{get:function(){return this.items.filter((function(e){return e.active&&e.highlighted}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"choices",{get:function(){return this.state.choices},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeChoices",{get:function(){return this.choices.filter((function(e){return e.active}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"searchableChoices",{get:function(){return this.choices.filter((function(e){return!e.disabled&&!e.placeholder}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"groups",{get:function(){return this.state.groups},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeGroups",{get:function(){var e=this;return this.state.groups.filter((function(t){var i=t.active&&!t.disabled,n=e.state.choices.some((function(e){return e.active&&!e.disabled}));return i&&n}),[])},enumerable:!1,configurable:!0}),e.prototype.inTxn=function(){return this._txn>0},e.prototype.getChoiceById=function(e){return this.activeChoices.find((function(t){return t.id===e}))},e.prototype.getGroupById=function(e){return this.groups.find((function(t){return t.id===e}))},e}(),ye="no-choices",be="no-results",Ee="add-choice",Ce="";function Se(e,t,i){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function we(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function Ie(e){for(var t=1;t{let i=Pe(e);this._keys.push(i),this._keyMap[i.id]=i,t+=i.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function Pe(e){let t=null,i=null,n=null,s=1,o=null;if(xe(e)||Ae(e))n=e,t=je(e),i=Re(e);else{if(!Fe.call(e,"name"))throw new Error((e=>`Missing ${e} property in key`)("name"));const r=e.name;if(n=r,Fe.call(e,"weight")&&(s=e.weight,s<=0))throw new Error((e=>`Property 'weight' in key '${e}' must be a positive integer`)(r));t=je(r),i=Re(r),o=e.getFn}return{path:t,id:i,weight:s,src:n,getFn:o}}function je(e){return Ae(e)?e:e.split(".")}function Re(e){return Ae(e)?e.join("."):e}const Ke={useExtendedSearch:!1,getFn:function(e,t){let i=[],n=!1;const s=(e,t,o)=>{if(Te(e))if(t[o]){const r=e[t[o]];if(!Te(r))return;if(o===t.length-1&&(xe(r)||Oe(r)||Le(r)))i.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(r));else if(Ae(r)){n=!0;for(let e=0,i=r.length;ee.score===t.score?e.idx{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,xe(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();xe(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,i=this.size();t{let s=t.getFn?t.getFn(e):this.getFn(e,t.path);if(Te(s))if(Ae(s)){let e=[];const t=[{nestedArrIndex:-1,value:s}];for(;t.length;){const{nestedArrIndex:i,value:n}=t.pop();if(Te(n))if(xe(n)&&!Ne(n)){let t={v:n,i:i,n:this.norm.get(n)};e.push(t)}else Ae(n)&&n.forEach(((e,i)=>{t.push({nestedArrIndex:i,value:e})}))}i.$[n]=e}else if(xe(s)&&!Ne(s)){let e={v:s,n:this.norm.get(s)};i.$[n]=e}})),this.records.push(i)}toJSON(){return{keys:this.keys,records:this.records}}}function $e(e,t,{getFn:i=Ve.getFn,fieldNormWeight:n=Ve.fieldNormWeight}={}){const s=new He({getFn:i,fieldNormWeight:n});return s.setKeys(e.map(Pe)),s.setSources(t),s.create(),s}function qe(e,{errors:t=0,currentLocation:i=0,expectedLocation:n=0,distance:s=Ve.distance,ignoreLocation:o=Ve.ignoreLocation}={}){const r=t/e.length;if(o)return r;const c=Math.abs(n-i);return s?r+c/s:c?1:r}const We=32;function Ue(e,t,i,{location:n=Ve.location,distance:s=Ve.distance,threshold:o=Ve.threshold,findAllMatches:r=Ve.findAllMatches,minMatchCharLength:c=Ve.minMatchCharLength,includeMatches:a=Ve.includeMatches,ignoreLocation:h=Ve.ignoreLocation}={}){if(t.length>We)throw new Error(`Pattern length exceeds max of ${We}.`);const l=t.length,u=e.length,d=Math.max(0,Math.min(n,u));let p=o,f=d;const m=c>1||a,g=m?Array(u):[];let v;for(;(v=e.indexOf(t,f))>-1;){let e=qe(t,{currentLocation:v,expectedLocation:d,distance:s,ignoreLocation:h});if(p=Math.min(e,p),f=v+l,m){let e=0;for(;e=a;o-=1){let r=o-1,c=i[e.charAt(r)];if(m&&(g[r]=+!!c),C[o]=(C[o+1]<<1|1)&c,n&&(C[o]|=(_[o+1]|_[o])<<1|1|_[o+1]),C[o]&E&&(y=qe(t,{errors:n,currentLocation:r,expectedLocation:d,distance:s,ignoreLocation:h}),y<=p)){if(p=y,f=r,f<=d)break;a=Math.max(1,2*d-f)}}if(qe(t,{errors:n+1,currentLocation:d,expectedLocation:d,distance:s,ignoreLocation:h})>p)break;_=C}const C={isMatch:f>=0,score:Math.max(.001,y)};if(m){const e=function(e=[],t=Ve.minMatchCharLength){let i=[],n=-1,s=-1,o=0;for(let r=e.length;o=t&&i.push([n,s]),n=-1)}return e[o-1]&&o-n>=t&&i.push([n,o-1]),i}(g,c);e.length?a&&(C.indices=e):C.isMatch=!1}return C}function Ge(e){let t={};for(let i=0,n=e.length;i{this.chunks.push({pattern:e,alphabet:Ge(e),startIndex:t})},l=this.pattern.length;if(l>We){let e=0;const t=l%We,i=l-t;for(;e{const{isMatch:f,score:m,indices:g}=Ue(e,t,d,{location:n+p,distance:s,threshold:o,findAllMatches:r,minMatchCharLength:c,includeMatches:i,ignoreLocation:a});f&&(u=!0),l+=m,f&&g&&(h=[...h,...g])}));let d={isMatch:u,score:u?l/this.chunks.length:1};return u&&i&&(d.indices=h),d}}class Je{constructor(e){this.pattern=e}static isMultiMatch(e){return Xe(e,this.multiRegex)}static isSingleMatch(e){return Xe(e,this.singleRegex)}search(){}}function Xe(e,t){const i=e.match(t);return i?i[1]:null}class Qe extends Je{constructor(e,{location:t=Ve.location,threshold:i=Ve.threshold,distance:n=Ve.distance,includeMatches:s=Ve.includeMatches,findAllMatches:o=Ve.findAllMatches,minMatchCharLength:r=Ve.minMatchCharLength,isCaseSensitive:c=Ve.isCaseSensitive,ignoreLocation:a=Ve.ignoreLocation}={}){super(e),this._bitapSearch=new ze(e,{location:t,threshold:i,distance:n,includeMatches:s,findAllMatches:o,minMatchCharLength:r,isCaseSensitive:c,ignoreLocation:a})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class Ye extends Je{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,i=0;const n=[],s=this.pattern.length;for(;(t=e.indexOf(this.pattern,i))>-1;)i=t+s,n.push([t,i-1]);const o=!!n.length;return{isMatch:o,score:o?0:1,indices:n}}}const Ze=[class extends Je{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},Ye,class extends Je{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends Je{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends Je{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends Je{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends Je{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},Qe],et=Ze.length,tt=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const it=new Set([Qe.type,Ye.type]);class nt{constructor(e,{isCaseSensitive:t=Ve.isCaseSensitive,includeMatches:i=Ve.includeMatches,minMatchCharLength:n=Ve.minMatchCharLength,ignoreLocation:s=Ve.ignoreLocation,findAllMatches:o=Ve.findAllMatches,location:r=Ve.location,threshold:c=Ve.threshold,distance:a=Ve.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:i,minMatchCharLength:n,findAllMatches:o,ignoreLocation:s,location:r,threshold:c,distance:a},this.pattern=t?e:e.toLowerCase(),this.query=function(e,t={}){return e.split("|").map((e=>{let i=e.trim().split(tt).filter((e=>e&&!!e.trim())),n=[];for(let e=0,s=i.length;e!(!e[rt]&&!e[ct]),ut=e=>({[rt]:Object.keys(e).map((t=>({[t]:e[t]})))});function dt(e,t,{auto:i=!0}={}){const n=e=>{let s=Object.keys(e);const o=(e=>!!e[at])(e);if(!o&&s.length>1&&!lt(e))return n(ut(e));if((e=>!Ae(e)&&Me(e)&&!lt(e))(e)){const n=o?e[at]:s[0],r=o?e[ht]:e[n];if(!xe(r))throw new Error((e=>`Invalid value for key ${e}`)(n));const c={keyId:Re(n),pattern:r};return i&&(c.searcher=ot(r,t)),c}let r={children:[],operator:s[0]};return s.forEach((t=>{const i=e[t];Ae(i)&&i.forEach((e=>{r.children.push(n(e))}))})),r};return lt(e)||(e=ut(e)),n(e)}function pt(e,t){const i=e.matches;t.matches=[],Te(i)&&i.forEach((e=>{if(!Te(e.indices)||!e.indices.length)return;const{indices:i,value:n}=e;let s={indices:i,value:n};e.key&&(s.key=e.key.src),e.idx>-1&&(s.refIndex=e.idx),t.matches.push(s)}))}function ft(e,t){t.score=e.score}class mt{constructor(e,t={},i){this.options=Ie(Ie({},Ve),t),this.options.useExtendedSearch,this._keyStore=new De(this.options.keys),this.setCollection(e,i)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof He))throw new Error("Incorrect 'index' type");this._myIndex=t||$e(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){Te(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let i=0,n=this._docs.length;i{let i=1;e.matches.forEach((({key:e,norm:n,score:s})=>{const o=e?e.weight:null;i*=Math.pow(0===s&&o?Number.EPSILON:s,(o||1)*(t?1:n))})),e.score=i}))}(c,{ignoreFieldNorm:r}),s&&c.sort(o),Oe(t)&&t>-1&&(c=c.slice(0,t)),function(e,t,{includeMatches:i=Ve.includeMatches,includeScore:n=Ve.includeScore}={}){const s=[];return i&&s.push(pt),n&&s.push(ft),e.map((e=>{const{idx:i}=e,n={item:t[i],refIndex:i};return s.length&&s.forEach((t=>{t(e,n)})),n}))}(c,this._docs,{includeMatches:i,includeScore:n})}_searchStringList(e){const t=ot(e,this.options),{records:i}=this._myIndex,n=[];return i.forEach((({v:e,i:i,n:s})=>{if(!Te(e))return;const{isMatch:o,score:r,indices:c}=t.searchIn(e);o&&n.push({item:e,idx:i,matches:[{score:r,value:e,norm:s,indices:c}]})})),n}_searchLogical(e){const t=dt(e,this.options),i=(e,t,n)=>{if(!e.children){const{keyId:i,searcher:s}=e,o=this._findMatches({key:this._keyStore.get(i),value:this._myIndex.getValueForItemAtKeyId(t,i),searcher:s});return o&&o.length?[{idx:n,item:t,matches:o}]:[]}const s=[];for(let o=0,r=e.children.length;o{if(Te(e)){let r=i(t,e,n);r.length&&(s[n]||(s[n]={idx:n,item:e,matches:[]},o.push(s[n])),r.forEach((({matches:e})=>{s[n].matches.push(...e)})))}})),o}_searchObjectList(e){const t=ot(e,this.options),{keys:i,records:n}=this._myIndex,s=[];return n.forEach((({$:e,i:n})=>{if(!Te(e))return;let o=[];i.forEach(((i,n)=>{o.push(...this._findMatches({key:i,value:e[n],searcher:t}))})),o.length&&s.push({idx:n,item:e,matches:o})})),s}_findMatches({key:e,value:t,searcher:i}){if(!Te(t))return[];let n=[];if(Ae(t))t.forEach((({v:t,i:s,n:o})=>{if(!Te(t))return;const{isMatch:r,score:c,indices:a}=i.searchIn(t);r&&n.push({score:c,key:e,value:t,idx:s,norm:o,indices:a})}));else{const{v:s,n:o}=t,{isMatch:r,score:c,indices:a}=i.searchIn(s);r&&n.push({score:c,key:e,value:s,norm:o,indices:a})}return n}}mt.version="7.0.0",mt.createIndex=$e,mt.parseIndex=function(e,{getFn:t=Ve.getFn,fieldNormWeight:i=Ve.fieldNormWeight}={}){const{keys:n,records:s}=e,o=new He({getFn:t,fieldNormWeight:i});return o.setKeys(n),o.setIndexRecords(s),o},mt.config=Ve,mt.parseQuery=dt,function(...e){st.push(...e)}(nt);var gt=function(){function e(e){this._haystack=[],this._fuseOptions=i(i({},e.fuseOptions),{keys:n([],e.searchFields,!0),includeMatches:!0})}return e.prototype.index=function(e){this._haystack=e,this._fuse&&this._fuse.setCollection(e)},e.prototype.reset=function(){this._haystack=[],this._fuse=void 0},e.prototype.isEmptyIndex=function(){return!this._haystack.length},e.prototype.search=function(e){return this._fuse||(this._fuse=new mt(this._haystack,this._fuseOptions)),this._fuse.search(e).map((function(e,t){return{item:e.item,score:e.score||0,rank:t+1}}))},e}();var vt=function(e,t,i){var n=e.dataset,s=t.customProperties,o=t.labelClass,r=t.labelDescription;o&&(n.labelClass=Z(o).join(" ")),r&&(n.labelDescription=r),i&&s&&("string"==typeof s?n.customProperties=s:"object"!=typeof s||function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(s)||(n.customProperties=JSON.stringify(s)))},_t=function(e,t,i){var n=t&&e.querySelector("label[for='".concat(t,"']")),s=n&&n.innerText;s&&i.setAttribute("aria-label",s)},yt={containerOuter:function(e,t,i,n,s,o,r){var c=e.classNames.containerOuter,a=document.createElement("div");return te(a,c),a.dataset.type=o,t&&(a.dir=t),n&&(a.tabIndex=0),i&&(a.setAttribute("role",s?"combobox":"listbox"),s?a.setAttribute("aria-autocomplete","list"):r||_t(this._docRoot,this.passedElement.element.id,a),a.setAttribute("aria-haspopup","true"),a.setAttribute("aria-expanded","false")),r&&a.setAttribute("aria-labelledby",r),a},containerInner:function(e){var t=e.classNames.containerInner,i=document.createElement("div");return te(i,t),i},itemList:function(e,t){var i=e.searchEnabled,n=e.classNames,s=n.list,o=n.listSingle,r=n.listItems,c=document.createElement("div");return te(c,s),te(c,t?o:r),this._isSelectElement&&i&&c.setAttribute("role","listbox"),c},placeholder:function(e,t){var i=e.allowHTML,n=e.classNames.placeholder,s=document.createElement("div");return te(s,n),Q(s,i,t),s},item:function(e,t,i){var n=e.allowHTML,s=e.removeItemButtonAlignLeft,o=e.removeItemIconText,r=e.removeItemLabelText,c=e.classNames,a=c.item,h=c.button,l=c.highlightedState,u=c.itemSelectable,d=c.placeholder,p=z(t.value),f=document.createElement("div");if(te(f,a),t.labelClass){var m=document.createElement("span");Q(m,n,t.label),te(m,t.labelClass),f.appendChild(m)}else Q(f,n,t.label);if(f.dataset.item="",f.dataset.id=t.id,f.dataset.value=p,vt(f,t,!0),(t.disabled||this.containerOuter.isDisabled)&&f.setAttribute("aria-disabled","true"),this._isSelectElement&&(f.setAttribute("aria-selected","true"),f.setAttribute("role","option")),t.placeholder&&(te(f,d),f.dataset.placeholder=""),te(f,t.highlighted?l:u),i){t.disabled&&ie(f,u),f.dataset.deletable="";var g=document.createElement("button");g.type="button",te(g,h),Q(g,!0,U(o,t.value));var v=U(r,t.value);v&&g.setAttribute("aria-label",v),g.dataset.button="",s?f.insertAdjacentElement("afterbegin",g):f.appendChild(g)}return f},choiceList:function(e,t){var i=e.classNames.list,n=document.createElement("div");return te(n,i),t||n.setAttribute("aria-multiselectable","true"),n.setAttribute("role","listbox"),n},choiceGroup:function(e,t){var i=e.allowHTML,n=e.classNames,s=n.group,o=n.groupHeading,r=n.itemDisabled,c=t.id,a=t.label,h=t.disabled,l=z(a),u=document.createElement("div");te(u,s),h&&te(u,r),u.setAttribute("role","group"),u.dataset.group="",u.dataset.id=c,u.dataset.value=l,h&&u.setAttribute("aria-disabled","true");var d=document.createElement("div");return te(d,o),Q(d,i,a||""),u.appendChild(d),u},choice:function(e,t,i,n){var s=e.allowHTML,o=e.classNames,r=o.item,c=o.itemChoice,a=o.itemSelectable,h=o.selectedState,l=o.itemDisabled,u=o.description,d=o.placeholder,p=t.label,f=z(t.value),m=document.createElement("div");m.id=t.elementId,te(m,r),te(m,c),n&&"string"==typeof p&&(p=X(s,p),p={trusted:p+=" (".concat(n,")")});var g=m;if(t.labelClass){var v=document.createElement("span");Q(v,s,p),te(v,t.labelClass),g=v,m.appendChild(v)}else Q(m,s,p);if(t.labelDescription){var _="".concat(t.elementId,"-description");g.setAttribute("aria-describedby",_);var y=document.createElement("span");Q(y,s,t.labelDescription),y.id=_,te(y,u),m.appendChild(y)}return t.selected&&te(m,h),t.placeholder&&te(m,d),m.setAttribute("role",t.group?"treeitem":"option"),m.dataset.choice="",m.dataset.id=t.id,m.dataset.value=f,i&&(m.dataset.selectText=i),t.group&&(m.dataset.groupId="".concat(t.group.id)),vt(m,t,!1),t.disabled?(te(m,l),m.dataset.choiceDisabled="",m.setAttribute("aria-disabled","true")):(te(m,a),m.dataset.choiceSelectable=""),m},input:function(e,t){var i=e.classNames,n=i.input,s=i.inputCloned,o=e.labelId,r=document.createElement("input");return r.type="search",te(r,n),te(r,s),r.autocomplete="off",r.autocapitalize="off",r.spellcheck=!1,r.setAttribute("aria-autocomplete","list"),t?r.setAttribute("aria-label",t):o||_t(this._docRoot,this.passedElement.element.id,r),r},dropdown:function(e){var t=e.classNames,i=t.list,n=t.listDropdown,s=document.createElement("div");return te(s,i),te(s,n),s.setAttribute("aria-expanded","false"),s},notice:function(e,t,i){var n=e.classNames,s=n.item,o=n.itemChoice,r=n.addChoice,c=n.noResults,a=n.noChoices,h=n.notice;void 0===i&&(i=Ce);var l=document.createElement("div");switch(Q(l,!0,t),te(l,s),te(l,o),te(l,h),i){case Ee:te(l,r);break;case be:te(l,c);break;case ye:te(l,a)}return i===Ee&&(l.dataset.choiceSelectable="",l.dataset.choice=""),l},option:function(e){var t=z(e.label),i=new Option(t,e.value,!1,e.selected);return vt(i,e,!0),i.disabled=e.disabled,e.selected&&i.setAttribute("selected",""),i}},bt="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,Et={},Ct=function(e){if(e)return e.dataset.id?parseInt(e.dataset.id,10):void 0},St="[data-choice-selectable]",wt=function(){function e(t,n){void 0===t&&(t="[data-choice]"),void 0===n&&(n={});var s=this;this.initialisedOK=void 0,this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0;var o=e.defaults;this.config=i(i(i({},o.allOptions),o.options),n),D.forEach((function(e){s.config[e]=i(i(i({},o.allOptions[e]),o.options[e]),n[e])}));var r=this.config;r.silent||this._validateConfig();var c=r.shadowRoot||document.documentElement;this._docRoot=c;var a="string"==typeof t?c.querySelector(t):t;if(!a||"object"!=typeof a||"INPUT"!==a.tagName&&!pe(a)){if(!a&&"string"==typeof t)throw TypeError("Selector ".concat(t," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}var h=a.type,l=h===P;(l||1!==r.maxItemCount)&&(r.singleModeForMultiSelect=!1),r.singleModeForMultiSelect&&(h=R);var u=h===j,d=h===R,p=u||d;if(this._elementType=h,this._isTextElement=l,this._isSelectOneElement=u,this._isSelectMultipleElement=d,this._isSelectElement=u||d,this._canAddUserChoices=l&&r.addItems||p&&r.addChoices,"boolean"!=typeof r.renderSelectedChoices&&(r.renderSelectedChoices="always"===r.renderSelectedChoices||u),"auto"===r.closeDropdownOnSelect?r.closeDropdownOnSelect=l||u||r.singleModeForMultiSelect:r.closeDropdownOnSelect=le(r.closeDropdownOnSelect),r.placeholder&&(r.placeholderValue?this._hasNonChoicePlaceholder=!0:a.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,r.placeholderValue=a.dataset.placeholder)),n.addItemFilter&&"function"!=typeof n.addItemFilter){var f=n.addItemFilter instanceof RegExp?n.addItemFilter:new RegExp(n.addItemFilter);r.addItemFilter=f.test.bind(f)}if(this._isTextElement)this.passedElement=new he({element:a,classNames:r.classNames});else{var m=a;this.passedElement=new fe({element:m,classNames:r.classNames,template:function(e){return s._templates.option(e)},extractPlaceholder:r.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new _e(r),this._currentValue="",r.searchEnabled=!l&&r.searchEnabled||d,this._canSearch=r.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(e,t){var i=e.id||e.name&&"".concat(e.name,"-").concat($(2))||$(4);return i=i.replace(/(:|\.|\[|\]|,)/g,""),"".concat(t,"-").concat(i)}(a,"choices-"),this._direction=a.dir,!this._direction){var g=window.getComputedStyle(a).direction;g!==window.getComputedStyle(document.documentElement).direction&&(this._direction=g)}if(this._idNames={itemChoice:"item-choice"},this._templates=o.templates,this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onInput=this._onInput.bind(this),this._onClick=this._onClick.bind(this),this._onTouchMove=this._onTouchMove.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseOver=this._onMouseOver.bind(this),this._onFormReset=this._onFormReset.bind(this),this._onSelectKey=this._onSelectKey.bind(this),this._onEnterKey=this._onEnterKey.bind(this),this._onEscapeKey=this._onEscapeKey.bind(this),this._onDirectionKey=this._onDirectionKey.bind(this),this._onDeleteKey=this._onDeleteKey.bind(this),this.passedElement.isActive)return r.silent||console.warn("Trying to initialise Choices on element already initialised",{element:t}),this.initialised=!0,void(this.initialisedOK=!1);this.init(),this._initialItems=this._store.items.map((function(e){return e.value}))}return Object.defineProperty(e,"defaults",{get:function(){return Object.preventExtensions({get options(){return Et},get allOptions(){return me},get templates(){return yt}})},enumerable:!1,configurable:!0}),e.prototype.init=function(){if(!this.initialised&&void 0===this.initialisedOK){var e;this._searcher=(e=this.config,new gt(e)),this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),this._isTextElement&&!this.config.addItems||this.passedElement.element.hasAttribute("disabled")||this.passedElement.element.closest("fieldset:disabled")?this.disable():(this.enable(),this._addEventListeners()),this._initStore(),this.initialised=!0,this.initialisedOK=!0;var t=this.config.callbackOnInit;"function"==typeof t&&t.call(this)}},e.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this._store._listeners=[],this.clearStore(!1),this._stopSearch(),this._templates=e.defaults.templates,this.initialised=!1,this.initialisedOK=void 0)},e.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},e.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},e.prototype.highlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.items.find((function(t){return t.id===e.id}));return!i||i.highlighted||(this._store.dispatch(H(i,!0)),t&&this.passedElement.triggerEvent(E,this._getChoiceForOutput(i))),this},e.prototype.unhighlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.items.find((function(t){return t.id===e.id}));return i&&i.highlighted?(this._store.dispatch(H(i,!1)),t&&this.passedElement.triggerEvent(S,this._getChoiceForOutput(i)),this):this},e.prototype.highlightAll=function(){var e=this;return this._store.withTxn((function(){e._store.items.forEach((function(t){t.highlighted||(e._store.dispatch(H(t,!0)),e.passedElement.triggerEvent(E,e._getChoiceForOutput(t)))}))})),this},e.prototype.unhighlightAll=function(){var e=this;return this._store.withTxn((function(){e._store.items.forEach((function(t){t.highlighted&&(e._store.dispatch(H(t,!1)),e.passedElement.triggerEvent(E,e._getChoiceForOutput(t)))}))})),this},e.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.withTxn((function(){t._store.items.filter((function(t){return t.value===e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeActiveItems=function(e){var t=this;return this._store.withTxn((function(){t._store.items.filter((function(t){return t.id!==e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeHighlightedItems=function(e){var t=this;return void 0===e&&(e=!1),this._store.withTxn((function(){t._store.highlightedActiveItems.forEach((function(i){t._removeItem(i),e&&t._triggerChange(i.value)}))})),this},e.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive||(void 0===e&&(e=!this._canSearch),requestAnimationFrame((function(){t.dropdown.show();var i=t.dropdown.element.getBoundingClientRect();t.containerOuter.open(i.bottom,i.height),e||t.input.focus(),t.passedElement.triggerEvent(f)}))),this},e.prototype.hideDropdown=function(e){var t=this;return this.dropdown.isActive?(requestAnimationFrame((function(){t.dropdown.hide(),t.containerOuter.close(),!e&&t._canSearch&&(t.input.removeActiveDescendant(),t.input.blur()),t.passedElement.triggerEvent(m)})),this):this},e.prototype.getValue=function(e){var t=this,i=this._store.items.map((function(i){return e?i.value:t._getChoiceForOutput(i)}));return this._isSelectOneElement||this.config.singleModeForMultiSelect?i[0]:i},e.prototype.setValue=function(e){var t=this;return this.initialisedOK?(this._store.withTxn((function(){e.forEach((function(e){e&&t._addChoice(de(e,!1))}))})),this._searcher.reset(),this):(this._warnChoicesInitFailed("setValue"),this)},e.prototype.setChoiceByValue=function(e){var t=this;return this.initialisedOK?(this._isTextElement||(this._store.withTxn((function(){(Array.isArray(e)?e:[e]).forEach((function(e){return t._findAndSelectChoiceByValue(e)})),t.unhighlightAll()})),this._searcher.reset()),this):(this._warnChoicesInitFailed("setChoiceByValue"),this)},e.prototype.setChoices=function(e,t,n,s,o,r){var c=this;if(void 0===e&&(e=[]),void 0===t&&(t="value"),void 0===n&&(n="label"),void 0===s&&(s=!1),void 0===o&&(o=!0),void 0===r&&(r=!1),!this.initialisedOK)return this._warnChoicesInitFailed("setChoices"),this;if(!this._isSelectElement)throw new TypeError("setChoices can't be used with INPUT based Choices");if("string"!=typeof t||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if("function"==typeof e){var a=e(this);if("function"==typeof Promise&&a instanceof Promise)return new Promise((function(e){return requestAnimationFrame(e)})).then((function(){return c._handleLoadingState(!0)})).then((function(){return a})).then((function(e){return c.setChoices(e,t,n,s,o,r)})).catch((function(e){c.config.silent||console.error(e)})).then((function(){return c._handleLoadingState(!1)})).then((function(){return c}));if(!Array.isArray(a))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof a));return this.setChoices(a,t,n,!1)}if(!Array.isArray(e))throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices");return this.containerOuter.removeLoadingState(),this._store.withTxn((function(){o&&(c._isSearching=!1),s&&c.clearChoices(!0,r);var a="value"===t,h="label"===n;e.forEach((function(e){if("choices"in e){var s=e;h||(s=i(i({},s),{label:s[n]})),c._addGroup(de(s,!0))}else{var o=e;h&&a||(o=i(i({},o),{value:o[t],label:o[n]}));var r=de(o,!1);c._addChoice(r),r.placeholder&&!c._hasNonChoicePlaceholder&&(c._placeholderValue=J(r.label))}})),c.unhighlightAll()})),this._searcher.reset(),this},e.prototype.refresh=function(e,t,i){var n=this;return void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),this._isSelectElement?(this._store.withTxn((function(){var s=n.passedElement.optionsAsChoices(),o={};i||n._store.items.forEach((function(e){e.id&&e.active&&e.selected&&(o[e.value]=!0)})),n.clearStore(!1);var r=function(e){i?n._store.dispatch(B(e)):o[e.value]&&(e.selected=!0)};s.forEach((function(e){"choices"in e?e.choices.forEach(r):r(e)})),n._addPredefinedChoices(s,t,e),n._isSearching&&n._searchChoices(n.input.value)})),this):(this.config.silent||console.warn("refresh method can only be used on choices backed by a