zen-temple 0.8.0.dev2__tar.gz → 0.8.0.dev3__tar.gz
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.
- {zen_temple-0.8.0.dev2/zen_temple.egg-info → zen_temple-0.8.0.dev3}/PKG-INFO +2 -3
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/README.md +1 -1
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/pyproject.toml +1 -2
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/config.py +4 -0
- zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/chunks/BMzctSst.js +3 -0
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/chunks/Di8ZsIy9.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/chunks/Bw6xzrRa.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/chunks/BzG_oq9x.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/chunks/CtABtqz2.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/chunks/XlHZvgoz.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/chunks/D4O6x9Xd.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/chunks/CMKNcsLx.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/chunks/DOYvtSAW.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/chunks/Dim5Qrbc.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/chunks/De3h01gF.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/chunks/vcQmI_jl.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/chunks/DhV6Y-fS.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/chunks/Bzm0LJcY.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/chunks/DuMb4BeH.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/chunks/D29zeWca.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/chunks/FEdmPbYo.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/chunks/BNYTtC8R.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/chunks/QyfongKu.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/chunks/MUlhZiy-.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/chunks/YBXudzKe.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/entry/app.BCKGHBfK.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/entry/app.0UiafPNw.js +2 -2
- zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/entry/start.BVSx8zWu.js +1 -0
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/nodes/0.C1KLbRIr.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/nodes/0.BnfhwhG8.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/nodes/1.BEiXiMJH.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/nodes/1.B52aYb6r.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/nodes/10.BORtnk4v.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/nodes/10.KYehsUaE.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/nodes/11.BJJGBwQ-.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/nodes/11.CYdJz1x6.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/nodes/12.C6edvE2r.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/nodes/12.zb6TSANG.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/nodes/3.CSw1pSa3.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/nodes/3.ByBDFMBZ.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/nodes/4.CLzZQPdJ.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/nodes/4.Cnh0j-rC.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/nodes/5.kR-oqe6s.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/nodes/5.6Nb_wPGJ.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/nodes/6.DoHd8zI4.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/nodes/6.BukOtZkW.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/nodes/7.DuKvzWrc.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/nodes/7.CKetbgLB.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/nodes/8.CSw1pSa3.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/nodes/8.ByBDFMBZ.js +1 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/nodes/9.CUolMULc.js → zen_temple-0.8.0.dev3/zen_temple/explorer/_app/immutable/nodes/9.o_o4x0FR.js +1 -1
- zen_temple-0.8.0.dev3/zen_temple/explorer/_app/version.json +1 -0
- {zen_temple-0.8.0.dev2/zen_temple/explorer/energy_balance/storage → zen_temple-0.8.0.dev3/zen_temple/explorer/energy_balance}/index.html +7 -7
- {zen_temple-0.8.0.dev2/zen_temple/explorer/energy_balance → zen_temple-0.8.0.dev3/zen_temple/explorer/energy_balance/nodal}/index.html +7 -7
- {zen_temple-0.8.0.dev2/zen_temple/explorer/energy_balance/nodal → zen_temple-0.8.0.dev3/zen_temple/explorer/energy_balance/storage}/index.html +7 -7
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/energy_system/index.html +7 -7
- zen_temple-0.8.0.dev3/zen_temple/explorer/index.html +52 -0
- zen_temple-0.8.0.dev3/zen_temple/explorer/map/index.html +52 -0
- zen_temple-0.8.0.dev3/zen_temple/explorer/transition/capacity/index.html +52 -0
- zen_temple-0.8.0.dev3/zen_temple/explorer/transition/costs/index.html +52 -0
- zen_temple-0.8.0.dev3/zen_temple/explorer/transition/emissions/index.html +52 -0
- zen_temple-0.8.0.dev3/zen_temple/explorer/transition/index.html +52 -0
- zen_temple-0.8.0.dev3/zen_temple/explorer/transition/production/index.html +52 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/main.py +12 -1
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/repositories/solution_repository.py +6 -5
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/routers/solutions.py +29 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3/zen_temple.egg-info}/PKG-INFO +2 -3
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple.egg-info/SOURCES.txt +25 -25
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple.egg-info/requires.txt +0 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/chunks/Clc2RgKt.js +0 -3
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/immutable/entry/start.DyEmpZ_V.js +0 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/_app/version.json +0 -1
- zen_temple-0.8.0.dev2/zen_temple/explorer/index.html +0 -52
- zen_temple-0.8.0.dev2/zen_temple/explorer/map/index.html +0 -52
- zen_temple-0.8.0.dev2/zen_temple/explorer/transition/capacity/index.html +0 -52
- zen_temple-0.8.0.dev2/zen_temple/explorer/transition/costs/index.html +0 -52
- zen_temple-0.8.0.dev2/zen_temple/explorer/transition/emissions/index.html +0 -52
- zen_temple-0.8.0.dev2/zen_temple/explorer/transition/index.html +0 -52
- zen_temple-0.8.0.dev2/zen_temple/explorer/transition/production/index.html +0 -52
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/LICENSE +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/setup.cfg +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/__init__.py +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/errors.py +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/env.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/assets/0.D3uwYcTK.css +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/assets/6.CYef66zj.css +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/assets/bootstrap-icons.BeopsB42.woff +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/assets/bootstrap-icons.mSm7cUeB.woff2 +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/assets/zen_garden_small.Bbfqs-kl.png +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/43hnhKVC.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/ACDB_Pwg.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/B0XvHRIv.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/B1FUqnGQ.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/B34HR-o6.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/BGj-pI5n.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/BI-3sHG-.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/BXl3LOEh.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/CgsLtv0Y.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/CkuyqXbc.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/CpFZsRVk.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/CqS7hfz2.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/Cxfa8IfO.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/D5i9uzhf.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/Dmw0JB4Z.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/DsnmJJEf.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/mRNW5lWq.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/chunks/y0Hysjl8.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/_app/immutable/nodes/2.B-Vnw287.js +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/apple-touch-icon.png +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/favicon-96x96.png +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/favicon.ico +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/favicon.svg +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/logo.png +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/site.webmanifest +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/web-app-manifest-192x192.png +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/explorer/web-app-manifest-512x512.png +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/models/__init__.py +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/models/solution.py +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/py.typed +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/repositories/__init__.py +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/routers/__init__.py +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple/utils.py +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple.egg-info/dependency_links.txt +0 -0
- {zen_temple-0.8.0.dev2 → zen_temple-0.8.0.dev3}/zen_temple.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: zen_temple
|
|
3
|
-
Version: 0.8.0.
|
|
3
|
+
Version: 0.8.0.dev3
|
|
4
4
|
Summary: The visualization plattform for ZEN-garden
|
|
5
5
|
Author-email: ZEN-garden developers <zen-garden@ethz.ch>
|
|
6
6
|
Project-URL: Homepage, https://github.com/ZEN-universe/ZEN-temple
|
|
@@ -13,7 +13,6 @@ Description-Content-Type: text/markdown
|
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: uvicorn
|
|
15
15
|
Requires-Dist: fastapi[standard]
|
|
16
|
-
Requires-Dist: fastapi-cache2
|
|
17
16
|
Requires-Dist: python-dotenv
|
|
18
17
|
Requires-Dist: zen-garden
|
|
19
18
|
Requires-Dist: mypy>=1.14.1
|
|
@@ -51,7 +50,7 @@ Perform the following steps to install ZEN-temple:
|
|
|
51
50
|
1. Create a new conda environment, activate it, and install all dependencies:
|
|
52
51
|
|
|
53
52
|
```bash
|
|
54
|
-
conda create --name <your-env-name> python==3.
|
|
53
|
+
conda create --name <your-env-name> python==3.13
|
|
55
54
|
conda activate <your-env-name>
|
|
56
55
|
pip install -e .[mypy]
|
|
57
56
|
```
|
|
@@ -28,7 +28,7 @@ Perform the following steps to install ZEN-temple:
|
|
|
28
28
|
1. Create a new conda environment, activate it, and install all dependencies:
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
conda create --name <your-env-name> python==3.
|
|
31
|
+
conda create --name <your-env-name> python==3.13
|
|
32
32
|
conda activate <your-env-name>
|
|
33
33
|
pip install -e .[mypy]
|
|
34
34
|
```
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "zen_temple"
|
|
7
|
-
version = "0.8.0.
|
|
7
|
+
version = "0.8.0.dev3"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="ZEN-garden developers", email="zen-garden@ethz.ch" },
|
|
10
10
|
]
|
|
@@ -20,7 +20,6 @@ classifiers = [
|
|
|
20
20
|
dependencies = [
|
|
21
21
|
"uvicorn",
|
|
22
22
|
"fastapi[standard]",
|
|
23
|
-
"fastapi-cache2",
|
|
24
23
|
"python-dotenv",
|
|
25
24
|
"zen-garden",
|
|
26
25
|
"mypy>=1.14.1",
|
|
@@ -7,6 +7,7 @@ load_dotenv()
|
|
|
7
7
|
|
|
8
8
|
class Config:
|
|
9
9
|
def __init__(self) -> None:
|
|
10
|
+
self.APP_DEBUG: bool = os.getenv("APP_DEBUG", "false").lower() == "true"
|
|
10
11
|
self.SOLUTION_FOLDER: str = os.getenv("SOLUTION_FOLDER", "./outputs")
|
|
11
12
|
self.EPS = float(os.getenv("EPS", 1e-6))
|
|
12
13
|
self.RESPONSE_SIGNIFICANT_DIGITS = int(os.getenv("RESPONSE_SIGNIFICANT_DIGITS", 4))
|
|
@@ -17,6 +18,9 @@ class Config:
|
|
|
17
18
|
for key, val in self.__dict__.items():
|
|
18
19
|
if val is None:
|
|
19
20
|
raise Exception(f"Env-Variable {key} is missing!")
|
|
21
|
+
|
|
22
|
+
def is_debug(self) -> bool:
|
|
23
|
+
return self.APP_DEBUG
|
|
20
24
|
|
|
21
25
|
|
|
22
26
|
config = Config()
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{o as qe,g as kt}from"./D5i9uzhf.js";import{aF as ye,bh as Et,e as U,h as L,i as P,k as Me,j as St}from"./ACDB_Pwg.js";const F=[];function Ie(e,t=ye){let n=null;const r=new Set;function a(o){if(Et(e,o)&&(e=o,n)){const c=!F.length;for(const l of r)l[1](),F.push(l,e);if(c){for(let l=0;l<F.length;l+=2)F[l][0](F[l+1]);F.length=0}}}function s(o){a(o(e))}function i(o,c=ye){const l=[o,c];return r.add(l),r.size===1&&(n=t(a,s)||ye),o(e),()=>{r.delete(l),r.size===0&&n&&(n(),n=null)}}return{set:a,update:s,subscribe:i}}class fe{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Ue{constructor(t,n){this.status=t,this.location=n}}class Le extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function At(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function Rt(e){return e.split("%25").map(decodeURI).join("%25")}function Tt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function ve({href:e}){return e.split("#")[0]}function It(e,t,n,r=!1){const a=new URL(e);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(i,o){if(o==="get"||o==="getAll"||o==="has")return l=>(n(l),i[o](l));t();const c=Reflect.get(i,o);return typeof c=="function"?c.bind(i):c}}),enumerable:!0,configurable:!0});const s=["href","pathname","search","toString","toJSON"];r&&s.push("hash");for(const i of s)Object.defineProperty(a,i,{get(){return t(),e[i]},enumerable:!0,configurable:!0});return a}function Ut(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;const Lt=new TextDecoder;function Pt(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const xt=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&H.delete(Pe(e)),xt(e,t));const H=new Map;function Ct(e,t){const n=Pe(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:a,...s}=JSON.parse(r.textContent);const i=r.getAttribute("data-ttl");return i&&H.set(n,{body:a,init:s,ttl:1e3*Number(i)}),r.getAttribute("data-b64")!==null&&(a=Pt(a)),Promise.resolve(new Response(a,s))}return window.fetch(e,t)}function Ot(e,t,n){if(H.size>0){const r=Pe(e,n),a=H.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n?.cache))return new Response(a.body,a.init);H.delete(r)}}return window.fetch(t,n)}function Pe(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${Ut(...a)}"]`}return r}const Nt=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function $t(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${Qe(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const s=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(s)return t.push({name:s[1],matcher:s[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const i=r.split(/\[(.+?)\](?!\])/);return"/"+i.map((c,l)=>{if(l%2){if(c.startsWith("x+"))return be(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return be(String.fromCharCode(...c.slice(2).split("-").map(y=>parseInt(y,16))));const d=Nt.exec(c),[,p,u,f,h]=d;return t.push({name:f,matcher:h,optional:!!p,rest:!!u,chained:u?l===1&&i[0]==="":!1}),u?"([^]*?)":p?"([^/]*)?":"([^/]+?)"}return be(c)}).join("")}).join("")}/?$`),params:t}}function jt(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Qe(e){return e.slice(1).split("/").filter(jt)}function Dt(e,t,n){const r={},a=e.slice(1),s=a.filter(o=>o!==void 0);let i=0;for(let o=0;o<t.length;o+=1){const c=t[o];let l=a[o-i];if(c.chained&&c.rest&&i&&(l=a.slice(o-i,o+1).filter(d=>d).join("/"),i=0),l===void 0){c.rest&&(r[c.name]="");continue}if(!c.matcher||n[c.matcher](l)){r[c.name]=l;const d=t[o+1],p=a[o+1];d&&!d.rest&&d.optional&&p&&c.chained&&(i=0),!d&&!p&&Object.keys(r).length===s.length&&(i=0);continue}if(c.optional&&c.chained){i++;continue}return}if(!i)return r}function be(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}const Bt=/\[(\[)?(\.\.\.)?(\w+?)(?:=(\w+))?\]\]?/g;function Pn(e,t){const n=Qe(e),r=e!="/"&&e.endsWith("/");return"/"+n.map(a=>a.replace(Bt,(s,i,o,c)=>{const l=t[c];if(!l){if(i||o&&l!==void 0)return"";throw new Error(`Missing parameter '${c}' in route ${e}`)}if(l.startsWith("/")||l.endsWith("/"))throw new Error(`Parameter '${c}' in route ${e} cannot start or end with a slash -- this would cause an invalid route like foo//bar`);return l})).filter(Boolean).join("/")+(r?"/":"")}function Ft({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([o,[c,l,d]])=>{const{pattern:p,params:u}=$t(o),f={id:o,exec:h=>{const y=p.exec(h);if(y)return Dt(y,u,r)},errors:[1,...d||[]].map(h=>e[h]),layouts:[0,...l||[]].map(i),leaf:s(c)};return f.errors.length=f.layouts.length=Math.max(f.errors.length,f.layouts.length),f});function s(o){const c=o<0;return c&&(o=~o),[c,e[o]]}function i(o){return o===void 0?o:[a.has(o),e[o]]}}function et(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Ve(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const I=globalThis.__sveltekit_1d117ne?.base??"",qt=globalThis.__sveltekit_1d117ne?.assets??I??"",Mt="1763988032073",tt="sveltekit:snapshot",nt="sveltekit:scroll",xe="sveltekit:states",rt="sveltekit:pageurl",D="sveltekit:history",G="sveltekit:navigation",$={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},Q=location.origin;function ue(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function de(){return{x:pageXOffset,y:pageYOffset}}function q(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const Ge={...$,"":$.hover};function at(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function ot(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=at(e)}}function Se(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const o=location.hash.split("#")[1]||"/";r.hash=`#${o}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,s=!r||!!a||he(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),i=r?.origin===Q&&e.hasAttribute("download");return{url:r,external:s,target:a,download:i}}function ne(e){let t=null,n=null,r=null,a=null,s=null,i=null,o=e;for(;o&&o!==document.documentElement;)r===null&&(r=q(o,"preload-code")),a===null&&(a=q(o,"preload-data")),t===null&&(t=q(o,"keepfocus")),n===null&&(n=q(o,"noscroll")),s===null&&(s=q(o,"reload")),i===null&&(i=q(o,"replacestate")),o=at(o);function c(l){switch(l){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Ge[r??"off"],preload_data:Ge[a??"off"],keepfocus:c(t),noscroll:c(n),reload:c(s),replace_state:c(i)}}function We(e){const t=Ie(e);let n=!0;function r(){n=!0,t.update(i=>i)}function a(i){n=!1,t.set(i)}function s(i){let o;return t.subscribe(c=>{(o===void 0||n&&c!==o)&&i(o=c)})}return{notify:r,set:a,subscribe:s}}const st={v:()=>{}};function Vt(){const{set:e,subscribe:t}=Ie(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${qt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const i=(await a.json()).version!==Mt;return i&&(e(!0),st.v(),clearTimeout(n)),i}catch{return!1}}return{subscribe:t,check:r}}function he(e,t,n){return e.origin!==Q||!e.pathname.startsWith(t)?!0:n?!(e.pathname===t+"/"||e.pathname===t+"/index.html"||e.protocol==="file:"&&e.pathname.replace(/\/[^/]+\.html?$/,"")===t):!1}function xn(e){}function Gt(e){const t=Yt(e),n=new ArrayBuffer(t.length),r=new DataView(n);for(let a=0;a<n.byteLength;a++)r.setUint8(a,t.charCodeAt(a));return n}const Wt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Yt(e){e.length%4===0&&(e=e.replace(/==?$/,""));let t="",n=0,r=0;for(let a=0;a<e.length;a++)n<<=6,n|=Wt.indexOf(e[a]),r+=6,r===24&&(t+=String.fromCharCode((n&16711680)>>16),t+=String.fromCharCode((n&65280)>>8),t+=String.fromCharCode(n&255),n=r=0);return r===12?(n>>=4,t+=String.fromCharCode(n)):r===18&&(n>>=2,t+=String.fromCharCode((n&65280)>>8),t+=String.fromCharCode(n&255)),t}const Ht=-1,Kt=-2,zt=-3,Jt=-4,Xt=-5,Zt=-6;function Qt(e,t){if(typeof e=="number")return a(e,!0);if(!Array.isArray(e)||e.length===0)throw new Error("Invalid input");const n=e,r=Array(n.length);function a(s,i=!1){if(s===Ht)return;if(s===zt)return NaN;if(s===Jt)return 1/0;if(s===Xt)return-1/0;if(s===Zt)return-0;if(i||typeof s!="number")throw new Error("Invalid input");if(s in r)return r[s];const o=n[s];if(!o||typeof o!="object")r[s]=o;else if(Array.isArray(o))if(typeof o[0]=="string"){const c=o[0],l=t?.[c];if(l)return r[s]=l(a(o[1]));switch(c){case"Date":r[s]=new Date(o[1]);break;case"Set":const d=new Set;r[s]=d;for(let f=1;f<o.length;f+=1)d.add(a(o[f]));break;case"Map":const p=new Map;r[s]=p;for(let f=1;f<o.length;f+=2)p.set(a(o[f]),a(o[f+1]));break;case"RegExp":r[s]=new RegExp(o[1],o[2]);break;case"Object":r[s]=Object(o[1]);break;case"BigInt":r[s]=BigInt(o[1]);break;case"null":const u=Object.create(null);r[s]=u;for(let f=1;f<o.length;f+=2)u[o[f]]=a(o[f+1]);break;case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":{const f=globalThis[c],h=new f(a(o[1]));r[s]=o[2]!==void 0?h.subarray(o[2],o[3]):h;break}case"ArrayBuffer":{const f=o[1],h=Gt(f);r[s]=h;break}case"Temporal.Duration":case"Temporal.Instant":case"Temporal.PlainDate":case"Temporal.PlainTime":case"Temporal.PlainDateTime":case"Temporal.PlainMonthDay":case"Temporal.PlainYearMonth":case"Temporal.ZonedDateTime":{const f=c.slice(9);r[s]=Temporal[f].from(o[1]);break}case"URL":{const f=new URL(o[1]);r[s]=f;break}case"URLSearchParams":{const f=new URLSearchParams(o[1]);r[s]=f;break}default:throw new Error(`Unknown type ${c}`)}}else{const c=new Array(o.length);r[s]=c;for(let l=0;l<o.length;l+=1){const d=o[l];d!==Kt&&(c[l]=a(d))}}else{const c={};r[s]=c;for(const l in o){if(l==="__proto__")throw new Error("Cannot parse an object with a `__proto__` property");const d=o[l];c[l]=a(d)}}return r[s]}return a(0)}const it=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...it];const en=new Set([...it]);[...en];function tn(e){return e.filter(t=>t!=null)}const nn="x-sveltekit-invalidated",rn="x-sveltekit-trailing-slash";function re(e){return e instanceof fe||e instanceof Le?e.status:500}function an(e){return e instanceof Le?e.text:"Internal Error"}let A,J,ke;const on=qe.toString().includes("$$")||/function \w+\(\) \{\}/.test(qe.toString());on?(A={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},J={current:null},ke={current:!1}):(A=new class{#e=U({});get data(){return L(this.#e)}set data(t){P(this.#e,t)}#t=U(null);get form(){return L(this.#t)}set form(t){P(this.#t,t)}#n=U(null);get error(){return L(this.#n)}set error(t){P(this.#n,t)}#r=U({});get params(){return L(this.#r)}set params(t){P(this.#r,t)}#a=U({id:null});get route(){return L(this.#a)}set route(t){P(this.#a,t)}#o=U({});get state(){return L(this.#o)}set state(t){P(this.#o,t)}#s=U(-1);get status(){return L(this.#s)}set status(t){P(this.#s,t)}#i=U(new URL("https://example.com"));get url(){return L(this.#i)}set url(t){P(this.#i,t)}},J=new class{#e=U(null);get current(){return L(this.#e)}set current(t){P(this.#e,t)}},ke=new class{#e=U(!1);get current(){return L(this.#e)}set current(t){P(this.#e,t)}},st.v=()=>ke.current=!0);function sn(e){Object.assign(A,e)}const cn="/__data.json",ln=".html__data.json";function fn(e){return e.endsWith(".html")?e.replace(/\.html$/,ln):e.replace(/\/$/,"")+cn}const Ye={spanContext(){return un},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},un={traceId:"",spanId:"",traceFlags:0},{tick:dn}=kt,hn=St??(e=>e()),pn=new Set(["icon","shortcut icon","apple-touch-icon"]),B=et(nt)??{},X=et(tt)??{},N={url:We({}),page:We({}),navigating:Ie(null),updated:Vt()};function Ce(e){B[e]=de()}function gn(e,t){let n=e+1;for(;B[n];)delete B[n],n+=1;for(n=t+1;X[n];)delete X[n],n+=1}function W(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function ct(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(I||"/");e&&await e.update()}}function He(){}let Oe,Ae,ae,x,Re,k;const oe=[],se=[];let C=null;const te=new Map,lt=new Set,_n=new Set,K=new Set;let w={branch:[],error:null,url:null},Ne=!1,ie=!1,Ke=!0,Z=!1,Y=!1,ft=!1,$e=!1,je,S,T,j;const z=new Set,ze=new Map;async function $n(e,t,n){globalThis.__sveltekit_1d117ne?.data&&globalThis.__sveltekit_1d117ne.data,document.URL!==location.href&&(location.href=location.href),k=e,await e.hooks.init?.(),Oe=Ft(e),x=document.documentElement,Re=t,Ae=e.nodes[0],ae=e.nodes[1],Ae(),ae(),S=history.state?.[D],T=history.state?.[G],S||(S=T=Date.now(),history.replaceState({...history.state,[D]:S,[G]:T},""));const r=B[S];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await Rn(Re,n)):(await M({type:"enter",url:ue(k.hash?In(new URL(location.href)):location.href),replace_state:!0}),a()),An()}function mn(){oe.length=0,$e=!1}function ut(e){se.some(t=>t?.snapshot)&&(X[e]=se.map(t=>t?.snapshot?.capture()))}function dt(e){X[e]?.forEach((t,n)=>{se[n]?.snapshot?.restore(t)})}function Je(){Ce(S),Ve(nt,B),ut(T),Ve(tt,X)}async function ht(e,t,n,r){let a;t.invalidateAll&&(C=null),await M({type:"goto",url:ue(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{t.invalidateAll&&($e=!0,a=[...ze.keys()]),t.invalidate&&t.invalidate.forEach(Sn)}}),t.invalidateAll&&Me().then(Me).then(()=>{ze.forEach(({resource:s},i)=>{a?.includes(i)&&s.refresh?.()})})}async function wn(e){if(e.id!==C?.id){const t={};z.add(t),C={id:e.id,token:t,promise:_t({...e,preload:t}).then(n=>(z.delete(t),n.type==="loaded"&&n.state.error&&(C=null),n))}}return C.promise}async function Ee(e){const t=(await ge(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].map(n=>n?.[1]()))}function pt(e,t,n){w=e.state;const r=document.querySelector("style[data-sveltekit]");if(r&&r.remove(),Object.assign(A,e.props.page),je=new k.root({target:t,props:{...e.props,stores:N,components:se},hydrate:n,sync:!1}),dt(T),n){const a={from:null,to:{params:w.params,route:{id:w.route?.id??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};K.forEach(s=>s(a))}ie=!0}function ce({url:e,params:t,branch:n,status:r,error:a,route:s,form:i}){let o="never";if(I&&(e.pathname===I||e.pathname===I+"/"))o="always";else for(const f of n)f?.slash!==void 0&&(o=f.slash);e.pathname=At(e.pathname,o),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:n,error:a,route:s},props:{constructors:tn(n).map(f=>f.node.component),page:_e(A)}};i!==void 0&&(c.props.form=i);let l={},d=!A,p=0;for(let f=0;f<Math.max(n.length,w.branch.length);f+=1){const h=n[f],y=w.branch[f];h?.data!==y?.data&&(d=!0),h&&(l={...l,...h.data},d&&(c.props[`data_${p}`]=l),p+=1)}return(!w.url||e.href!==w.url.href||w.error!==a||i!==void 0&&i!==A.form||d)&&(c.props.page={error:a,params:t,route:{id:s?.id??null},state:{},status:r,url:new URL(e),form:i??null,data:d?l:A.data}),c}async function De({loader:e,parent:t,url:n,params:r,route:a,server_data_node:s}){let i=null,o=!0;const c={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();if(l.universal?.load){let d=function(...u){for(const f of u){const{href:h}=new URL(f,n);c.dependencies.add(h)}};const p={tracing:{enabled:!1,root:Ye,current:Ye},route:new Proxy(a,{get:(u,f)=>(o&&(c.route=!0),u[f])}),params:new Proxy(r,{get:(u,f)=>(o&&c.params.add(f),u[f])}),data:s?.data??null,url:It(n,()=>{o&&(c.url=!0)},u=>{o&&c.search_params.add(u)},k.hash),async fetch(u,f){u instanceof Request&&(f={body:u.method==="GET"||u.method==="HEAD"?void 0:await u.blob(),cache:u.cache,credentials:u.credentials,headers:[...u.headers].length>0?u?.headers:void 0,integrity:u.integrity,keepalive:u.keepalive,method:u.method,mode:u.mode,redirect:u.redirect,referrer:u.referrer,referrerPolicy:u.referrerPolicy,signal:u.signal,...f});const{resolved:h,promise:y}=gt(u,f,n);return o&&d(h.href),y},setHeaders:()=>{},depends:d,parent(){return o&&(c.parent=!0),t()},untrack(u){o=!1;try{return u()}finally{o=!0}}};i=await l.universal.load.call(null,p)??null}return{node:l,loader:e,server:s,universal:l.universal?.load?{type:"data",data:i,uses:c}:null,data:i??s?.data??null,slash:l.universal?.trailingSlash??s?.slash}}function gt(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const s=ie?Ot(r,a.href,t):Ct(r,t);return{resolved:a,promise:s}}function Xe(e,t,n,r,a,s){if($e)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const i of a.search_params)if(r.has(i))return!0;for(const i of a.params)if(s[i]!==w.params[i])return!0;for(const i of a.dependencies)if(oe.some(o=>o(new URL(i))))return!0;return!1}function Be(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function yn(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),s=t.searchParams.getAll(r);a.every(i=>s.includes(i))&&s.every(i=>a.includes(i))&&n.delete(r)}return n}function Ze({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:_e(A),constructors:[]}}}async function _t({id:e,invalidating:t,url:n,params:r,route:a,preload:s}){if(C?.id===e)return z.delete(C.token),C.promise;const{errors:i,layouts:o,leaf:c}=a,l=[...o,c];i.forEach(m=>m?.().catch(()=>{})),l.forEach(m=>m?.[1]().catch(()=>{}));let d=null;const p=w.url?e!==le(w.url):!1,u=w.route?a.id!==w.route.id:!1,f=yn(w.url,n);let h=!1;const y=l.map((m,g)=>{const v=w.branch[g],b=!!m?.[0]&&(v?.loader!==m[1]||Xe(h,u,p,f,v.server?.uses,r));return b&&(h=!0),b});if(y.some(Boolean)){try{d=await yt(n,y)}catch(m){const g=await V(m,{url:n,params:r,route:{id:e}});return z.has(s)?Ze({error:g,url:n,params:r,route:a}):pe({status:re(m),error:g,url:n,route:a})}if(d.type==="redirect")return d}const E=d?.nodes;let _=!1;const O=l.map(async(m,g)=>{if(!m)return;const v=w.branch[g],b=E?.[g];if((!b||b.type==="skip")&&m[1]===v?.loader&&!Xe(_,u,p,f,v.universal?.uses,r))return v;if(_=!0,b?.type==="error")throw b;return De({loader:m[1],url:n,params:r,route:a,parent:async()=>{const me={};for(let we=0;we<g;we+=1)Object.assign(me,(await O[we])?.data);return me},server_data_node:Be(b===void 0&&m[0]?{type:"skip"}:b??null,m[0]?v?.server:void 0)})});for(const m of O)m.catch(()=>{});const R=[];for(let m=0;m<l.length;m+=1)if(l[m])try{R.push(await O[m])}catch(g){if(g instanceof Ue)return{type:"redirect",location:g.location};if(z.has(s))return Ze({error:await V(g,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let v=re(g),b;if(E?.includes(g))v=g.status??v,b=g.error;else if(g instanceof fe)b=g.body;else{if(await N.updated.check())return await ct(),await W(n);b=await V(g,{params:r,url:n,route:{id:a.id}})}const ee=await vn(m,R,i);return ee?ce({url:n,params:r,branch:R.slice(0,ee.idx).concat(ee.node),status:v,error:b,route:a}):await wt(n,{id:a.id},b,v)}else R.push(void 0);return ce({url:n,params:r,branch:R,status:200,error:null,route:a,form:t?void 0:null})}async function vn(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function pe({status:e,error:t,url:n,route:r}){const a={};let s=null;if(k.server_loads[0]===0)try{const o=await yt(n,[!0]);if(o.type!=="data"||o.nodes[0]&&o.nodes[0].type!=="data")throw 0;s=o.nodes[0]??null}catch{(n.origin!==Q||n.pathname!==location.pathname||Ne)&&await W(n)}try{const o=await De({loader:Ae,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Be(s)}),c={node:await ae(),loader:ae,universal:null,server:null,data:null};return ce({url:n,params:a,branch:[o,c],status:e,error:t,route:null})}catch(o){if(o instanceof Ue)return ht(new URL(o.location,location.href),{},0);throw o}}async function bn(e){const t=e.href;if(te.has(t))return te.get(t);let n;try{const r=(async()=>{let a=await k.hooks.reroute({url:new URL(e),fetch:async(s,i)=>gt(s,i,e).promise})??e;if(typeof a=="string"){const s=new URL(e);k.hash?s.hash=a:s.pathname=a,a=s}return a})();te.set(t,r),n=await r}catch{te.delete(t);return}return n}async function ge(e,t){if(e&&!he(e,I,k.hash)){const n=await bn(e);if(!n)return;const r=kn(n);for(const a of Oe){const s=a.exec(r);if(s)return{id:le(e),invalidating:t,route:a,params:Tt(s),url:e}}}}function kn(e){return Rt(k.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(I.length))||"/"}function le(e){return(k.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function mt({url:e,type:t,intent:n,delta:r,event:a}){let s=!1;const i=Fe(w,n,e,t);r!==void 0&&(i.navigation.delta=r),a!==void 0&&(i.navigation.event=a);const o={...i.navigation,cancel:()=>{s=!0,i.reject(new Error("navigation cancelled"))}};return Z||lt.forEach(c=>c(o)),s?null:i}async function M({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:s,state:i={},redirect_count:o=0,nav_token:c={},accept:l=He,block:d=He,event:p}){const u=j;j=c;const f=await ge(t,!1),h=e==="enter"?Fe(w,f,t,e):mt({url:t,type:e,delta:n?.delta,intent:f,event:p});if(!h){d(),j===c&&(j=u);return}const y=S,E=T;l(),Z=!0,ie&&h.navigation.type!=="enter"&&N.navigating.set(J.current=h.navigation);let _=f&&await _t(f);if(!_){if(he(t,I,k.hash))return await W(t,s);_=await wt(t,{id:null},await V(new Le(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,s)}if(t=f?.url||t,j!==c)return h.reject(new Error("navigation aborted")),!1;if(_.type==="redirect"){if(o<20){await M({type:e,url:new URL(_.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:s,state:i,redirect_count:o+1,nav_token:c}),h.fulfil(void 0);return}_=await pe({status:500,error:await V(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else _.props.page.status>=400&&await N.updated.check()&&(await ct(),await W(t,s));if(mn(),Ce(y),ut(E),_.props.page.url.pathname!==t.pathname&&(t.pathname=_.props.page.url.pathname),i=n?n.state:i,!n){const g=s?0:1,v={[D]:S+=g,[G]:T+=g,[xe]:i};(s?history.replaceState:history.pushState).call(history,v,"",t),s||gn(S,T)}if(C=null,_.props.page.state=i,ie){const g=(await Promise.all(Array.from(_n,v=>v(h.navigation)))).filter(v=>typeof v=="function");if(g.length>0){let v=function(){g.forEach(b=>{K.delete(b)})};g.push(v),g.forEach(b=>{K.add(b)})}w=_.state,_.props.page&&(_.props.page.url=t),je.$set(_.props),sn(_.props.page),ft=!0}else pt(_,Re,!1);const{activeElement:O}=document;await dn();let R=n?n.scroll:a?de():null;if(Ke){const g=t.hash&&document.getElementById(bt(t));if(R)scrollTo(R.x,R.y);else if(g){g.scrollIntoView();const{top:v,left:b}=g.getBoundingClientRect();R={x:pageXOffset+b,y:pageYOffset+v}}else scrollTo(0,0)}const m=document.activeElement!==O&&document.activeElement!==document.body;!r&&!m&&Tn(t,R),Ke=!0,_.props.page&&Object.assign(A,_.props.page),Z=!1,e==="popstate"&&dt(T),h.fulfil(void 0),K.forEach(g=>g(h.navigation)),N.navigating.set(J.current=null)}async function wt(e,t,n,r,a){return e.origin===Q&&e.pathname===location.pathname&&!Ne?await pe({status:r,error:n,url:e,route:t}):await W(e,a)}function En(){let e,t,n;x.addEventListener("mousemove",o=>{const c=o.target;clearTimeout(e),e=setTimeout(()=>{s(c,$.hover)},20)});function r(o){o.defaultPrevented||s(o.composedPath()[0],$.tap)}x.addEventListener("mousedown",r),x.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(o=>{for(const c of o)c.isIntersecting&&(Ee(new URL(c.target.href)),a.unobserve(c.target))},{threshold:0});async function s(o,c){const l=ot(o,x),d=l===t&&c>=n;if(!l||d)return;const{url:p,external:u,download:f}=Se(l,I,k.hash);if(u||f)return;const h=ne(l),y=p&&le(w.url)===le(p);if(!(h.reload||y))if(c<=h.preload_data){t=l,n=$.tap;const E=await ge(p,!1);if(!E)return;wn(E)}else c<=h.preload_code&&(t=l,n=c,Ee(p))}function i(){a.disconnect();for(const o of x.querySelectorAll("a")){const{url:c,external:l,download:d}=Se(o,I,k.hash);if(l||d)continue;const p=ne(o);p.reload||(p.preload_code===$.viewport&&a.observe(o),p.preload_code===$.eager&&Ee(c))}}K.add(i),i()}function V(e,t){if(e instanceof fe)return e.body;const n=re(e),r=an(e);return k.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function jn(e,t={}){return e=new URL(ue(e)),e.origin!==Q?Promise.reject(new Error("goto: invalid URL")):ht(e,t,0)}function Sn(e){if(typeof e=="function")oe.push(e);else{const{href:t}=new URL(e,location.href);oe.push(n=>n.href===t)}}function Dn(e,t){const n={[D]:S,[G]:T,[rt]:A.url.href,[xe]:t};history.replaceState(n,"",ue(e)),A.state=t,je.$set({page:hn(()=>_e(A))})}function An(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(Je(),!Z){const r=Fe(w,void 0,null,"leave"),a={...r.navigation,cancel:()=>{n=!0,r.reject(new Error("navigation cancelled"))}};lt.forEach(s=>s(a))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Je()}),navigator.connection?.saveData||En(),x.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=ot(t.composedPath()[0],x);if(!n)return;const{url:r,external:a,target:s,download:i}=Se(n,I,k.hash);if(!r)return;if(s==="_parent"||s==="_top"){if(window.parent!==window)return}else if(s&&s!=="_self")return;const o=ne(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||i)return;const[l,d]=(k.hash?r.hash.replace(/^#/,""):r.href).split("#"),p=l===ve(location);if(a||o.reload&&(!p||!d)){mt({url:r,type:"link",event:t})?Z=!0:t.preventDefault();return}if(d!==void 0&&p){const[,u]=w.url.href.split("#");if(u===d){if(t.preventDefault(),d===""||d==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const f=n.ownerDocument.getElementById(decodeURIComponent(d));f&&(f.scrollIntoView(),f.focus())}return}if(Y=!0,Ce(S),e(r),!o.replace_state)return;Y=!1}t.preventDefault(),await new Promise(u=>{requestAnimationFrame(()=>{setTimeout(u,0)}),setTimeout(u,100)}),await M({type:"link",url:r,keepfocus:o.keepfocus,noscroll:o.noscroll,replace_state:o.replace_state??r.href===location.href,event:t})}),x.addEventListener("submit",t=>{if(t.defaultPrevented)return;const n=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if((r?.formTarget||n.target)==="_blank"||(r?.formMethod||n.method)!=="get")return;const i=new URL(r?.hasAttribute("formaction")&&r?.formAction||n.action);if(he(i,I,!1))return;const o=t.target,c=ne(o);if(c.reload)return;t.preventDefault(),t.stopPropagation();const l=new FormData(o,r);i.search=new URLSearchParams(l).toString(),M({type:"form",url:i,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??i.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!Te){if(t.state?.[D]){const n=t.state[D];if(j={},n===S)return;const r=B[n],a=t.state[xe]??{},s=new URL(t.state[rt]??location.href),i=t.state[G],o=w.url?ve(location)===ve(w.url):!1;if(i===T&&(ft||o)){a!==A.state&&(A.state=a),e(s),B[S]=de(),r&&scrollTo(r.x,r.y),S=n;return}const l=n-S;await M({type:"popstate",url:s,popped:{state:a,scroll:r,delta:l},accept:()=>{S=n,T=i},block:()=>{history.go(-l)},nav_token:j,event:t})}else if(!Y){const n=new URL(location.href);e(n),k.hash&&location.reload()}}}),addEventListener("hashchange",()=>{Y&&(Y=!1,history.replaceState({...history.state,[D]:++S,[G]:T},"",location.href))});for(const t of document.querySelectorAll("link"))pn.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&N.navigating.set(J.current=null)});function e(t){w.url=A.url=t,N.page.set(_e(A)),N.page.notify()}}async function Rn(e,{status:t=200,error:n,node_ids:r,params:a,route:s,server_route:i,data:o,form:c}){Ne=!0;const l=new URL(location.href);let d;({params:a={},route:s={id:null}}=await ge(l,!1)||{}),d=Oe.find(({id:f})=>f===s.id);let p,u=!0;try{const f=r.map(async(y,E)=>{const _=o[E];return _?.uses&&(_.uses=vt(_.uses)),De({loader:k.nodes[y],url:l,params:a,route:s,parent:async()=>{const O={};for(let R=0;R<E;R+=1)Object.assign(O,(await f[R]).data);return O},server_data_node:Be(_)})}),h=await Promise.all(f);if(d){const y=d.layouts;for(let E=0;E<y.length;E++)y[E]||h.splice(E,0,void 0)}p=ce({url:l,params:a,branch:h,status:t,error:n,form:c,route:d??null})}catch(f){if(f instanceof Ue){await W(new URL(f.location,location.href));return}p=await pe({status:re(f),error:await V(f,{url:l,params:a,route:s}),url:l,route:s}),e.textContent="",u=!1}p.props.page&&(p.props.page.state={}),pt(p,e,u)}async function yt(e,t){const n=new URL(e);n.pathname=fn(e.pathname),e.pathname.endsWith("/")&&n.searchParams.append(rn,"1"),n.searchParams.append(nn,t.map(s=>s?"1":"0").join(""));const r=window.fetch,a=await r(n.href,{});if(!a.ok){let s;throw a.headers.get("content-type")?.includes("application/json")?s=await a.json():a.status===404?s="Not Found":a.status===500&&(s="Internal Error"),new fe(a.status,s)}return new Promise(async s=>{const i=new Map,o=a.body.getReader();function c(d){return Qt(d,{...k.decoders,Promise:p=>new Promise((u,f)=>{i.set(p,{fulfil:u,reject:f})})})}let l="";for(;;){const{done:d,value:p}=await o.read();if(d&&!l)break;for(l+=!p&&l?`
|
|
2
|
+
`:Lt.decode(p,{stream:!0});;){const u=l.indexOf(`
|
|
3
|
+
`);if(u===-1)break;const f=JSON.parse(l.slice(0,u));if(l=l.slice(u+1),f.type==="redirect")return s(f);if(f.type==="data")f.nodes?.forEach(h=>{h?.type==="data"&&(h.uses=vt(h.uses),h.data=c(h.data))}),s(f);else if(f.type==="chunk"){const{id:h,data:y,error:E}=f,_=i.get(h);i.delete(h),E?_.reject(c(E)):_.fulfil(c(y))}}}})}function vt(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}let Te=!1;function Tn(e,t=null){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=bt(e);if(r&&document.getElementById(r)){const{x:s,y:i}=t??de();setTimeout(()=>{const o=history.state;Te=!0,location.replace(`#${r}`),k.hash&&location.replace(e.hash),history.replaceState(o,"",e.hash),scrollTo(s,i),Te=!1})}else{const s=document.body,i=s.getAttribute("tabindex");s.tabIndex=-1,s.focus({preventScroll:!0,focusVisible:!1}),i!==null?s.setAttribute("tabindex",i):s.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const s=[];for(let i=0;i<a.rangeCount;i+=1)s.push(a.getRangeAt(i));setTimeout(()=>{if(a.rangeCount===s.length){for(let i=0;i<a.rangeCount;i+=1){const o=s[i],c=a.getRangeAt(i);if(o.commonAncestorContainer!==c.commonAncestorContainer||o.startContainer!==c.startContainer||o.endContainer!==c.endContainer||o.startOffset!==c.startOffset||o.endOffset!==c.endOffset)return}a.removeAllRanges()}})}}}function Fe(e,t,n,r){let a,s;const i=new Promise((c,l)=>{a=c,s=l});return i.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n},willUnload:!t,type:r,complete:i},fulfil:a,reject:s}}function _e(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function In(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function bt(e){let t;if(k.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{Pn as a,I as b,$n as c,jn as g,xn as l,A as p,Dn as r,N as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./DsnmJJEf.js";import{A as x,p as w,f as y,a as k,s as l,d as o,r as n,t as I,b as T,c as A}from"./ACDB_Pwg.js";import{d as B,s as E}from"./D5i9uzhf.js";import{r as F,s as p}from"./Cxfa8IfO.js";import{s as u,c as b}from"./
|
|
1
|
+
import"./DsnmJJEf.js";import{A as x,p as w,f as y,a as k,s as l,d as o,r as n,t as I,b as T,c as A}from"./ACDB_Pwg.js";import{d as B,s as E}from"./D5i9uzhf.js";import{r as F,s as p}from"./Cxfa8IfO.js";import{s as u,c as b}from"./YBXudzKe.js";import{a as L}from"./CkuyqXbc.js";import{p as _}from"./y0Hysjl8.js";import{i as U}from"./CtABtqz2.js";function j(d,a){a.onUpdate?.()}var q=y('<!> <div class="relative mb-2"><input class="appearance-none absolute inset-y-0 w-12" type="checkbox" role="switch"/> <label class="inline-flex"><div><div></div></div> </label></div>',1);function N(d,a){const s=x();w(a,!0);let t=_(a,"value",15),f=_(a,"texts",19,()=>["on","off"]);var m=q(),v=k(m);U(v,{get label(){return a.label},get formId(){return s}});var c=l(v,2),e=o(c);F(e),e.__change=[j,a];var i=l(e,2),r=o(i),g=o(r);n(r);var h=l(r);n(i),n(c),I(()=>{p(e,"id",s),p(i,"for",s),u(r,1,b(["h-6 w-12 rounded-full flex me-2 px-1",t()?"bg-blue-500":"bg-gray-400 dark:bg-gray-600"])),u(g,1,b(["bg-white h-4 w-4 rounded-full transition-transform duration-300 mt-1",t()?"translate-x-6":""])),E(h,` ${(t()?f()[0]:f()[1])??""}`)}),L(e,t),T(d,m),A()}B(["change"]);export{N as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./DsnmJJEf.js";import{b as Le,s as Be,c as pt,o as ot,d as ct}from"./D5i9uzhf.js";import{H as ft,aw as gt,Q as mt,a1 as vt,C as it,f as ne,d as q,r as z,s as le,aF as Ze,b as ie,t as ye,p as qe,u as ve,j as Oe,h as x,e as Te,i as we,c as ze,A as bt,a as Ve,m as Ae,g as Re,k as nt,aI as ht}from"./ACDB_Pwg.js";import{i as Ce}from"./BI-3sHG-.js";import{p as W}from"./y0Hysjl8.js";import{t as wt,j as yt,h as Pe,g as at,u as _t,s as _e,c as Se}from"./MUlhZiy-.js";import{s as St}from"./Cxfa8IfO.js";import"./mRNW5lWq.js";function Ot(o,e){var t=void 0,s;ft(()=>{t!==(t=e())&&(s&&(gt(s),s=null),t&&(s=mt(()=>{vt(()=>t(o))})))})}function We(o,e={},t,s){for(var i in t){var n=t[i];e[i]!==n&&(t[i]==null?o.style.removeProperty(i):o.style.setProperty(i,n,s))}}function Lt(o,e,t,s){var i=o.__style;if(it||i!==e){var n=wt(e,s);(!it||n!==o.getAttribute("style"))&&(n==null?o.removeAttribute("style"):o.style.cssText=n),o.__style=e}else s&&(Array.isArray(s)?(We(o,t?.[0],s[0]),We(o,t?.[1],s[1],"important")):We(o,t,s));return s}function Ct(o){return Array.from(new Set(o))}function _s(o){return o.map(e=>({value:e,label:e}))}function Ss(o,e,t){return Object.entries(o).filter(([s,i])=>{const n=i.split(",");return t&&!e.includes(n[0])&&e.includes(n[1])||!t&&e.includes(n[0])&&!e.includes(n[1])}).map(([s,i])=>s)}var Et=ne('<label class="fw-medium fs-4"> </label>'),xt=ne('<div class="fw-medium fs-4"> </div>'),kt=ne('<div class="flex justify-between items-center mb-1"><div class="uppercase text-gray-600 dark:text-gray-400 tracking-wide text-sm"><!></div> <!></div>');function At(o,e){var t=kt(),s=q(t),i=q(s);{var n=d=>{var h=Et(),p=q(h,!0);z(h),ye(()=>{St(h,"for",e.formId),Be(p,e.label)}),ie(d,h)},l=d=>{var h=xt(),p=q(h,!0);z(h),ye(()=>Be(p,e.label)),ie(d,h)};Ce(i,d=>{e.formId?d(n):d(l,!1)})}z(s);var c=le(s,2);Le(c,()=>e.rightSide??Ze),z(t),ie(o,t)}class Tt{main;placeholder;values;single;max;value;valueText;valueDelete;valueOut;deselect;deselectPath;arrow;arrowClose;arrowOpen;content;contentOpen;dirAbove;dirBelow;search;searchHighlighter;searching;addable;addablePath;list;optgroup;optgroupLabel;optgroupLabelText;optgroupActions;optgroupSelectAll;optgroupSelectAllBox;optgroupSelectAllCheck;optgroupClosable;option;optionDelete;highlighted;mainOpen;close;selected;error;disabled;hide;constructor(e){e||(e={}),this.main=e.main||"ss-main",this.placeholder=e.placeholder||"ss-placeholder",this.values=e.values||"ss-values",this.single=e.single||"ss-single",this.max=e.max||"ss-max",this.value=e.value||"ss-value",this.valueText=e.valueText||"ss-value-text",this.valueDelete=e.valueDelete||"ss-value-delete",this.valueOut=e.valueOut||"ss-value-out",this.deselect=e.deselect||"ss-deselect",this.deselectPath=e.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=e.arrow||"ss-arrow",this.arrowClose=e.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=e.arrowOpen||"M10,70 L50,30 L90,70",this.content=e.content||"ss-content",this.contentOpen=e.contentOpen||"ss-open",this.dirAbove=e.dirAbove||"ss-dir-above",this.dirBelow=e.dirBelow||"ss-dir-below",this.search=e.search||"ss-search",this.searchHighlighter=e.searchHighlighter||"ss-search-highlight",this.searching=e.searching||"ss-searching",this.addable=e.addable||"ss-addable",this.addablePath=e.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=e.list||"ss-list",this.optgroup=e.optgroup||"ss-optgroup",this.optgroupLabel=e.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=e.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=e.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=e.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=e.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=e.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=e.optgroupClosable||"ss-closable",this.option=e.option||"ss-option",this.optionDelete=e.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=e.highlighted||"ss-highlighted",this.mainOpen=e.mainOpen||"ss-open",this.close=e.close||"ss-close",this.selected=e.selected||"ss-selected",this.error=e.error||"ss-error",this.disabled=e.disabled||"ss-disabled",this.hide=e.hide||"ss-hide"}}function $e(){return Math.random().toString(36).substring(2,10)}function Dt(o,e){function t(i,n){return n&&i&&i.classList&&i.classList.contains(n)||n&&i&&i.dataset&&i.dataset.id&&i.dataset.id===e?i:null}function s(i,n){return!i||i===document?null:t(i,n)?i:s(i.parentNode,n)}return t(o,e)||s(o,e)}function je(o,e=50,t=!1){let s;return function(...i){const n=self,l=()=>{s=null,t||o.apply(n,i)},c=t&&!s;clearTimeout(s),s=setTimeout(l,e),c&&o.apply(n,i)}}function Je(o,e){return JSON.stringify(o)===JSON.stringify(e)}function Pt(o){const e=o.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,t=>"-"+t.toLowerCase());return o[0]===o[0].toUpperCase()?e.substring(1):e}class V{id;value;text;html;defaultSelected;selected;display;disabled;placeholder;class;style;data;mandatory;constructor(e){this.id=!e.id||e.id===""?$e():e.id,this.value=e.value===void 0?e.text||"":e.value||"",this.text=e.text||"",this.html=e.html||"",this.defaultSelected=e.defaultSelected!==void 0?e.defaultSelected:!1,this.selected=e.selected!==void 0?e.selected:!1,this.display=e.display!==void 0?e.display:!0,this.disabled=e.disabled!==void 0?e.disabled:!1,this.mandatory=e.mandatory!==void 0?e.mandatory:!1,this.placeholder=e.placeholder!==void 0?e.placeholder:!1,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class he{id;label;selectAll;selectAllText;closable;options;constructor(e){if(this.id=!e.id||e.id===""?$e():e.id,this.label=e.label||"",this.selectAll=e.selectAll===void 0?!1:e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const t of e.options)this.options.push(new V(t))}}class Nt{selectType="single";data=[];selectedOrder=[];constructor(e,t){this.selectType=e,this.setData(t)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let t of e)if(t)if(t instanceof he||"label"in t){if(!("label"in t))return new Error("Optgroup must have a label");if("options"in t&&t.options)for(let s of t.options){const i=this.validateOption(s);if(i)return i}}else if(t instanceof V||"text"in t){const s=this.validateOption(t);if(s)return s}else return new Error("Data object must be a valid optgroup or option");return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let t=[];return e.forEach(s=>{if(s){if(s instanceof he||"label"in s){let i=[];"options"in s&&s.options&&s.options.forEach(n=>{i.push(new V(n))}),i.length>0&&t.push(new he(s))}(s instanceof V||"text"in s)&&t.push(new V(s))}}),t}setData(e,t=!1){const s=this.partialToFullData(e);if(t){const i=this.getSelectedOptions(),n=[];i.forEach(l=>{let c=!1;for(const d of s){if(d instanceof V&&d.id===l.id){c=!0;break}if(d instanceof he){for(const h of d.options)if(h.id===l.id){c=!0;break}}}c||n.push(l)}),this.data=[...n,...s]}else this.data=s;this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e,t=!1){if(t){let s=[new V(e)];this.setData(s.concat(this.getData()))}else this.setData(this.getData().concat(new V(e)))}setSelectedBy(e,t){let s=null,i=!1;const n=[];for(let c of this.data){if(c instanceof he)for(let d of c.options){s||(s=d);let h=d[e]||"";d.selected=i?!1:t.includes(h),d.selected&&(n.push(d),this.selectType==="single"&&(i=!0))}c instanceof V&&(s||(s=c),c.selected=i?!1:t.includes(c[e]),c.selected&&(n.push(c),this.selectType==="single"&&(i=!0)))}this.selectType==="single"&&s&&!i&&(s.selected=!0,n.push(s));const l=t.map(c=>n.find(d=>d[e]===c)?.id||"");this.selectedOrder=l}getSelected(){return this.getSelectedOptions().map(e=>e.id)}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}getSelectedOptions(){return this.filter(e=>e.selected,!1)}getOptgroupByID(e){for(let t of this.data)if(t instanceof he&&t.id===e)return t;return null}getOptionByID(e){let t=this.filter(s=>s.id===e,!1);return t.length?t[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let t of this.data)if(t instanceof he?e=t.options[0]:t instanceof V&&(e=t),e)break;return e}search(e,t){return e=e.trim(),e===""?this.getData():this.filter(s=>t(s,e),!0)}filter(e,t){const s=[];return this.data.forEach(i=>{if(i instanceof he){let n=[];if(i.options.forEach(l=>{(!e||e(l))&&(t?n.push(new V(l)):s.push(new V(l)))}),n.length>0){let l=new he(i);l.options=n,s.push(l)}}i instanceof V&&(!e||e(i))&&s.push(new V(i))}),s}selectedOrderOptions(e){const t=[];return this.selectedOrder.forEach(s=>{const i=e.find(n=>n.id===s);i&&t.push(i)}),e.forEach(s=>{let i=!1;t.forEach(n=>{if(s.id===n.id){i=!0;return}}),i||t.push(s)}),t}}class Mt{settings;store;callbacks;lastSelectedOption;main;content;classes;constructor(e,t,s,i){this.store=s,this.settings=e,this.classes=t,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentPosition!=="relative"&&(this.content.main.style.top="-9999px",this.content.main.style.left="-9999px",this.content.main.style.margin="0",this.content.main.style.width="auto"),this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.main.main.setAttribute("aria-disabled","false"),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.main.main.setAttribute("aria-disabled","true"),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.setAttribute("aria-expanded","true");const e=this.settings.openPosition==="up"?this.classes.dirAbove:this.classes.dirBelow;this.main.main.classList.add(e),this.content.main.classList.add(e),this.content.main.classList.add(this.classes.contentOpen),this.content.search.input.removeAttribute("aria-hidden"),this.moveContent();const t=this.store.getSelectedOptions();if(t.length){const s=t[t.length-1].id,i=this.content.list.querySelector('[data-id="'+s+'"]');i&&this.ensureElementInView(this.content.list,i)}}close(){this.main.main.setAttribute("aria-expanded","false"),this.main.arrow.path.setAttribute("d",this.classes.arrowClose),this.content.main.classList.remove(this.classes.contentOpen),this.content.search.input.setAttribute("aria-hidden","true"),this.main.main.removeAttribute("aria-activedescendant");const e=this.getAnimationTiming();setTimeout(()=>{this.main.main.classList.remove(this.classes.dirAbove,this.classes.dirBelow),this.content.main.classList.remove(this.classes.dirAbove,this.classes.dirBelow)},e)}getAnimationTiming(){const e=getComputedStyle(this.content.main).getPropertyValue("--ss-animation-timing").trim();if(e){if(e.endsWith("ms"))return parseFloat(e);if(e.endsWith("s"))return parseFloat(e)*1e3}return 200}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),this.settings.style!==""&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const e of this.settings.class)e.trim()!==""&&(this.main.main.classList.add(e.trim()),this.content.main.classList.add(e.trim()));(this.settings.contentPosition==="relative"||this.settings.contentPosition==="fixed")&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){const e=this.content.list.id;this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",e),this.main.main.setAttribute("aria-expanded","false"),this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("aria-label",this.settings.ariaLabel+" listbox"),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.content.search.input.setAttribute("aria-controls",e)}mainDiv(){const e=document.createElement("div");e.dataset.id=this.settings.id,e.setAttribute("aria-label",this.settings.ariaLabel),e.tabIndex=0,e.onkeydown=h=>{switch(h.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),h.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const p=this.content.list.querySelector("."+this.classes.highlighted);return p&&p.click(),!1;case"Escape":return this.callbacks.close(),!1}return h.key.length===1&&this.callbacks.open(),!0},e.onclick=h=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const t=document.createElement("div");t.classList.add(this.classes.values),e.appendChild(t);const s=document.createElement("div");s.classList.add(this.classes.deselect);const i=this.store?.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&i&&i.length<=0?s.classList.add(this.classes.hide):s.classList.remove(this.classes.hide),s.onclick=h=>{if(h.stopPropagation(),this.settings.disabled)return;let p=!0;const f=this.store.getSelectedOptions(),g=[];if(this.callbacks.beforeChange&&(p=this.callbacks.beforeChange(g,f)===!0),p){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const O=this.store.getFirstOption(),N=O?O.id:"";this.callbacks.setSelected(N,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.deselectPath),n.appendChild(l),s.appendChild(n),e.appendChild(s);const c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.classList.add(this.classes.arrow),c.setAttribute("viewBox","0 0 100 100");const d=document.createElementNS("http://www.w3.org/2000/svg","path");return d.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&c.classList.add(this.classes.hide),c.appendChild(d),e.appendChild(c),{main:e,values:t,deselect:{main:s,svg:n,path:l},arrow:{main:c,path:d}}}mainFocus(e){e!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter(i=>i.placeholder,!1);let t=this.settings.placeholderText;e.length&&(e[0].html!==""?t=e[0].html:e[0].text!==""&&(t=e[0].text));const s=document.createElement("div");return s.classList.add(this.classes.placeholder),s.innerHTML=t,s}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const e=this.store.filter(s=>s.selected&&!s.placeholder,!1),t=e.length>0?e[0]:null;if(!t)this.main.values.innerHTML=this.placeholder().outerHTML;else{const s=document.createElement("div");s.classList.add(this.classes.single),t.html?s.innerHTML=t.html:s.innerText=t.text,this.main.values.innerHTML=s.outerHTML}!this.settings.allowDeselect||!e.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,t=this.store.filter(i=>i.selected&&i.display,!1);if(t.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.placeholder);i&&i.remove()}if(t.length>this.settings.maxValuesShown){const i=document.createElement("div");i.classList.add(this.classes.max),i.textContent=this.settings.maxValuesMessage.replace("{number}",t.length.toString()),this.main.values.innerHTML=i.outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.max);i&&i.remove()}this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t));let s=[];for(let i=0;i<e.length;i++){const n=e[i],l=n.getAttribute("data-id");l&&(t.filter(c=>c.id===l,!1).length||s.push(n))}for(const i of s)i.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(i)&&this.main.values.removeChild(i)},100);e=this.main.values.childNodes;for(let i=0;i<t.length;i++){let n=!0;for(let l=0;l<e.length;l++)t[i].id===String(e[l].dataset.id)&&(n=!1);n&&(this.settings.keepOrder?this.main.values.appendChild(this.multipleValue(t[i])):e.length===0?this.main.values.appendChild(this.multipleValue(t[i])):i===0?this.main.values.insertBefore(this.multipleValue(t[i]),e[i]):e[i-1].insertAdjacentElement("afterend",this.multipleValue(t[i])))}}multipleValue(e){const t=document.createElement("div");t.classList.add(this.classes.value),t.dataset.id=e.id;const s=document.createElement("div");if(s.classList.add(this.classes.valueText),s.textContent=e.text,t.appendChild(s),!e.mandatory){const i=document.createElement("div");i.classList.add(this.classes.valueDelete),i.setAttribute("tabindex","0"),i.onclick=c=>{if(c.preventDefault(),c.stopPropagation(),this.settings.disabled)return;let d=!0;const h=this.store.getSelectedOptions(),p=h.filter(f=>f.selected&&f.id!==e.id,!0);if(!(this.settings.minSelected&&p.length<this.settings.minSelected)&&(this.callbacks.beforeChange&&(d=this.callbacks.beforeChange(p,h)===!0),d)){let f=[];for(const g of p){if(g instanceof he)for(const O of g.options)O.id&&f.push(O.id);g instanceof V&&f.push(g.id)}this.callbacks.setSelected(f,!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(p),this.updateDeselectAll()}};const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optionDelete),n.appendChild(l),i.appendChild(n),t.appendChild(i),i.onkeydown=c=>{c.key==="Enter"&&i.click()}}return t}contentDiv(){const e=document.createElement("div");e.dataset.id=this.settings.id;const t=this.searchDiv();e.appendChild(t.main);const s=this.listDiv();return e.appendChild(s),{main:e,search:t,list:s}}moveContent(){if(this.settings.contentPosition==="relative"){this.moveContentBelow();return}if(this.settings.openPosition==="down"){this.moveContentBelow();return}else if(this.settings.openPosition==="up"){this.moveContentAbove();return}this.putContent()==="up"?this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),t=document.createElement("input"),s=document.createElement("div");e.classList.add(this.classes.search);const i={main:e,input:t};if(this.settings.showSearch||(e.classList.add(this.classes.hide),t.readOnly=!0),t.type="search",t.placeholder=this.settings.searchPlaceholder,t.tabIndex=-1,t.setAttribute("aria-label",this.settings.searchPlaceholder),t.setAttribute("aria-autocomplete","list"),t.setAttribute("autocapitalize","off"),t.setAttribute("autocomplete","off"),t.setAttribute("autocorrect","off"),t.setAttribute("aria-hidden","true"),t.oninput=je(n=>{this.callbacks.search(n.target.value)},100),t.onkeydown=n=>{switch(n.key){case"ArrowUp":case"ArrowDown":return n.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case" ":const l=this.content.list.querySelector("."+this.classes.highlighted);return l?(l.click(),!1):!0;case"Enter":const c=this.content.list.querySelector("."+this.classes.highlighted);return c?(c.click(),!1):this.callbacks.addable?(s.click(),!1):!0}return!0},e.appendChild(t),this.callbacks.addable){s.classList.add(this.classes.addable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.addablePath),n.appendChild(l),s.appendChild(n),s.onclick=c=>{if(c.preventDefault(),c.stopPropagation(),!this.callbacks.addable)return;const d=this.content.search.input.value.trim();if(d===""){this.content.search.input.focus();return}const h=f=>{let g=new V(f);if(this.callbacks.addOption(g),this.settings.isMultiple){let O=this.store.getSelected();O.push(g.id),this.callbacks.setSelected(O,!0)}else this.callbacks.setSelected([g.id],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout(()=>{this.callbacks.close()},100)},p=this.callbacks.addable(d);p===!1||p===void 0||p===null||(p instanceof Promise?p.then(f=>{typeof f=="string"?h({text:f,value:f}):p instanceof Error?this.renderError(p.message):h(f)}):typeof p=="string"?h({text:p,value:p}):p instanceof Error?this.renderError(p.message):h(p))},e.appendChild(s),i.addable={main:s,svg:n,path:l}}return i}searchFocus(){this.content.search.input.focus({preventScroll:!0})}getOptions(e=!1,t=!1,s=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),t&&(i+=":not(."+this.classes.disabled+")"),s&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const t=this.getOptions(!0,!0,!0);if(t.length===0)return;if(t.length===1&&!t[0].classList.contains(this.classes.highlighted)){t[0].classList.add(this.classes.highlighted);return}let s=!1;for(const n of t)n.classList.contains(this.classes.highlighted)&&(s=!0);if(!s){for(const n of t)if(n.classList.contains(this.classes.selected)){n.classList.add(this.classes.highlighted);break}}for(let n=0;n<t.length;n++)if(t[n].classList.contains(this.classes.highlighted)){const l=t[n];l.classList.remove(this.classes.highlighted);const c=l.parentElement;if(c&&c.classList.contains(this.classes.mainOpen)){const p=c.querySelector("."+this.classes.optgroupLabel);p&&p.click()}let d=t[e==="down"?n+1<t.length?n+1:0:n-1>=0?n-1:t.length-1];d.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,d),d.id&&this.main.main.setAttribute("aria-activedescendant",d.id);const h=d.parentElement;if(h&&h.classList.contains(this.classes.close)){const p=h.querySelector("."+this.classes.optgroupLabel);p&&p.click()}return}const i=t[e==="down"?0:t.length-1];i.classList.add(this.classes.highlighted),i.id&&this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const e=document.createElement("div");e.classList.add(this.classes.list);const t=this.settings.id+"-list";return e.id=t,e.dataset.id=t,e}renderError(e){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.error),t.textContent=e,this.content.list.appendChild(t)}renderSearching(){this.content.list.innerHTML="";const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e)}renderOptions(e){if(this.content.list.innerHTML="",e.length===0){const s=document.createElement("div");s.classList.add(this.classes.search),this.callbacks.addable?s.innerHTML=this.settings.addableText.replace("{value}",this.content.search.input.value):s.innerHTML=this.settings.searchText,this.content.list.appendChild(s);return}this.settings.allowDeselect&&!this.settings.isMultiple&&(this.store.filter(s=>s.placeholder,!1).length||this.store.addOption(new V({text:"",value:"",selected:!1,placeholder:!0}),!0));const t=document.createDocumentFragment();for(const s of e){if(s instanceof he){const i=document.createElement("div");i.classList.add(this.classes.optgroup);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabel),i.appendChild(n);const l=document.createElement("div");l.classList.add(this.classes.optgroupLabelText),l.textContent=s.label,n.appendChild(l);const c=document.createElement("div");if(c.classList.add(this.classes.optgroupActions),n.appendChild(c),this.settings.isMultiple&&s.selectAll){const d=document.createElement("div");d.classList.add(this.classes.optgroupSelectAll);let h=!0;for(const N of s.options)if(!N.selected){h=!1;break}h&&d.classList.add(this.classes.selected);const p=document.createElement("span");p.textContent=s.selectAllText,d.appendChild(p);const f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("viewBox","0 0 100 100"),d.appendChild(f);const g=document.createElementNS("http://www.w3.org/2000/svg","path");g.setAttribute("d",this.classes.optgroupSelectAllBox),f.appendChild(g);const O=document.createElementNS("http://www.w3.org/2000/svg","path");O.setAttribute("d",this.classes.optgroupSelectAllCheck),f.appendChild(O),d.addEventListener("click",N=>{N.preventDefault(),N.stopPropagation();const $=this.store.getSelected();if(h){const B=$.filter(X=>{for(const K of s.options)if(X===K.id)return!1;return!0});this.callbacks.setSelected(B,!0);return}else{let B=s.options.map(K=>K.id).filter(K=>K!==void 0);const X=$.concat(B);for(const K of s.options)K.id&&!this.store.getOptionByID(K.id)&&this.callbacks.addOption(new V(K));this.callbacks.setSelected(X,!0);return}}),c.appendChild(d)}if(s.closable!=="off"){const d=document.createElement("div");d.classList.add(this.classes.optgroupClosable);const h=document.createElementNS("http://www.w3.org/2000/svg","svg");h.setAttribute("viewBox","0 0 100 100"),h.classList.add(this.classes.arrow),d.appendChild(h);const p=document.createElementNS("http://www.w3.org/2000/svg","path");h.appendChild(p),s.options.some(f=>f.selected)||this.content.search.input.value.trim()!==""?(d.classList.add(this.classes.mainOpen),p.setAttribute("d",this.classes.arrowOpen)):s.closable==="open"?(i.classList.add(this.classes.mainOpen),p.setAttribute("d",this.classes.arrowOpen)):s.closable==="close"&&(i.classList.add(this.classes.close),p.setAttribute("d",this.classes.arrowClose)),n.addEventListener("click",f=>{f.preventDefault(),f.stopPropagation(),i.classList.contains(this.classes.close)?(i.classList.remove(this.classes.close),i.classList.add(this.classes.mainOpen),p.setAttribute("d",this.classes.arrowOpen)):(i.classList.remove(this.classes.mainOpen),i.classList.add(this.classes.close),p.setAttribute("d",this.classes.arrowClose))}),c.appendChild(d)}i.appendChild(n);for(const d of s.options)i.appendChild(this.option(new V(d))),t.appendChild(i)}s instanceof V&&t.appendChild(this.option(s))}this.content.list.appendChild(t)}option(e){if(e.placeholder){const s=document.createElement("div");return s.classList.add(this.classes.option),s.classList.add(this.classes.hide),s}const t=document.createElement("div");return t.dataset.id=e.id,t.id=this.settings.id+"-"+e.id,t.classList.add(this.classes.option),t.setAttribute("role","option"),e.class&&e.class.split(" ").forEach(s=>{t.classList.add(s)}),e.style&&(t.style.cssText=e.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?t.innerHTML=this.highlightText(e.html!==""?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):e.html!==""?t.innerHTML=e.html:t.textContent=e.text,this.settings.showOptionTooltips&&t.textContent&&t.setAttribute("title",t.textContent),e.display||t.classList.add(this.classes.hide),e.disabled&&t.classList.add(this.classes.disabled),e.selected&&this.settings.hideSelected&&t.classList.add(this.classes.hide),e.selected?(t.classList.add(this.classes.selected),t.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",t.id)):(t.classList.remove(this.classes.selected),t.setAttribute("aria-selected","false")),t.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation();const i=this.store.getSelected(),n=s.currentTarget,l=String(n.dataset.id),c=s.ctrlKey||s.metaKey;if(e.disabled||!this.settings.isMultiple&&e.selected&&!this.settings.allowDeselect||e.selected&&e.mandatory||this.settings.isMultiple&&this.settings.maxSelected<=i.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=i.length&&e.selected&&!c)return;let d=!1;const h=this.store.getSelectedOptions();let p=[];if(this.settings.isMultiple){const f=h.some(g=>g.id===l);if(s.shiftKey&&this.lastSelectedOption){const g=this.store.getDataOptions(),O=g.findIndex($=>$.id===this.lastSelectedOption.id),N=g.findIndex($=>$.id===e.id);if(O>=0&&N>=0){const $=Math.min(O,N),B=Math.max(O,N),X=g.slice($,B+1).filter(K=>!h.find(oe=>oe.id===K.id));h.length+X.length<=this.settings.maxSelected?p=h.concat(X):p=h}else p=h}else c?(f?p=h.filter(g=>g.id!==l):p=h.concat(e),this.lastSelectedOption=e):(f?p=h.filter(g=>g.id!==l):p=h.concat(e),this.lastSelectedOption=e)}if(this.settings.isMultiple||(e.selected?p=[]:p=[e]),this.callbacks.beforeChange||(d=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(p,h)===!1?d=!1:d=!0),d){this.store.getOptionByID(l)||this.callbacks.addOption(e),this.callbacks.setSelected(p.map(g=>g.id),!1);const f=s.ctrlKey||s.metaKey||s.shiftKey;this.settings.closeOnSelect&&!(this.settings.isMultiple&&f)&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(p)}}),t}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,t,s){const i=t.trim();if(i==="")return e;const n=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=document.createElement("div");l.innerHTML=e;const c=d=>{if(d.nodeType===Node.TEXT_NODE){const h=d.textContent||"",p=new RegExp("("+n+")","i");if(p.test(h)){const f=document.createElement("span");h.split(p).forEach((g,O)=>{if(g&&p.test(g)){const N=document.createElement("mark");N.className=s,N.textContent=g,f.appendChild(N)}else g&&f.appendChild(document.createTextNode(g))}),d.parentNode?.replaceChild(f,d)}}else d.nodeType===Node.ELEMENT_NODE&&Array.from(d.childNodes).forEach(h=>c(h))};return Array.from(l.childNodes).forEach(d=>c(d)),l.innerHTML}moveContentAbove(){const e=this.main.main.offsetHeight,t=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.dirBelow),this.main.main.classList.add(this.classes.dirAbove),this.content.main.classList.remove(this.classes.dirBelow),this.content.main.classList.add(this.classes.dirAbove);const s=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+t-1)+"px 0px 0px 0px",this.content.main.style.top=s.top+s.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=s.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=s.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.dirAbove),this.main.main.classList.add(this.classes.dirBelow),this.content.main.classList.remove(this.classes.dirAbove),this.content.main.classList.add(this.classes.dirBelow);const e=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=e.top+e.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=e.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,t){const s=e.scrollTop+e.offsetTop,i=s+e.clientHeight,n=t.offsetTop,l=n+t.clientHeight;n<s?e.scrollTop-=s-n:l>i&&(e.scrollTop+=l-i)}putContent(){const e=this.main.main.offsetHeight,t=this.main.main.getBoundingClientRect(),s=this.content.main.offsetHeight;return window.innerHeight-(t.top+e)<=s&&t.top>s?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),t=e&&e.length>0,s=this.settings.isMultiple,i=this.settings.allowDeselect,n=this.main.deselect.main,l=this.classes.hide;i&&!(s&&!t)?n.classList.remove(l):n.classList.add(l)}}class Rt{select;onValueChange;onClassChange;onDisabledChange;onOptionsChange;onLabelClick;listen=!1;observer=null;isUpdating=!1;pendingOptionsChange=null;preventNativeSelect=null;preventNativeSelectMousedown=null;preventNativeSelectFocus=null;constructor(e){this.select=e,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.position="absolute",this.select.style.width="1px",this.select.style.height="1px",this.select.style.opacity="0",this.select.style.overflow="hidden",this.select.style.pointerEvents="none",this.select.style.margin="0",this.select.style.padding="0",this.select.style.borderWidth="0",this.select.style.clip="rect(0 0 0 0)",this.select.setAttribute("aria-hidden","true"),this.preventNativeSelect||(this.preventNativeSelect=e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()},this.preventNativeSelectMousedown=e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()},this.preventNativeSelectFocus=e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()},this.select.addEventListener("click",this.preventNativeSelect,{capture:!0,passive:!1}),this.select.addEventListener("mousedown",this.preventNativeSelectMousedown,{capture:!0,passive:!1}),this.select.addEventListener("focus",this.preventNativeSelectFocus,{capture:!0,passive:!1}))}showUI(){this.select.removeAttribute("tabindex"),this.select.style.position="",this.select.style.width="",this.select.style.height="",this.select.style.opacity="",this.select.style.overflow="",this.select.style.pointerEvents="",this.select.style.margin="",this.select.style.padding="",this.select.style.borderWidth="",this.select.style.clip="",this.select.removeAttribute("aria-hidden"),this.preventNativeSelect&&(this.select.removeEventListener("click",this.preventNativeSelect,{capture:!0}),this.preventNativeSelect=null),this.preventNativeSelectMousedown&&(this.select.removeEventListener("mousedown",this.preventNativeSelectMousedown,{capture:!0}),this.preventNativeSelectMousedown=null),this.preventNativeSelectFocus&&(this.select.removeEventListener("focus",this.preventNativeSelectFocus,{capture:!0}),this.preventNativeSelectFocus=null)}changeListen(e){this.listen=e,e&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),e||this.observer&&this.observer.disconnect()}valueChange(e){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedOptions()),!0}observeCall(e){if(!this.listen)return;let t=!1,s=!1,i=!1,n=!1;for(const l of e){if(l.target===this.select&&(l.attributeName==="disabled"&&(s=!0),l.attributeName==="class"&&(t=!0),l.type==="childList")){for(const c of Array.from(l.addedNodes))if(c.nodeName==="OPTION"&&c.value===this.select.value){n=!0;break}i=!0}(l.target.nodeName==="OPTGROUP"||l.target.nodeName==="OPTION")&&(i=!0)}if(t&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),s&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),i&&this.onOptionsChange){if(this.isUpdating){if(this.select.options.length>0){const l=this.getData();l.length>0&&(this.pendingOptionsChange=l)}n&&this.select.dispatchEvent(new Event("change"));return}this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0)}n&&this.select.dispatchEvent(new Event("change"))}getData(){let e=[];const t=this.select.childNodes;for(const s of t)s.nodeName==="OPTGROUP"&&e.push(this.getDataFromOptgroup(s)),s.nodeName==="OPTION"&&e.push(this.getDataFromOption(s));return e}getDataFromOptgroup(e){let t={id:e.id,label:e.label,selectAll:e.dataset?e.dataset.selectall==="true":!1,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const s=e.childNodes;for(const i of s)i.nodeName==="OPTION"&&t.options.push(this.getDataFromOption(i));return t}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",defaultSelected:e.defaultSelected,selected:e.selected,display:e.style.display!=="none",disabled:e.disabled,mandatory:e.dataset?e.dataset.mandatory==="true":!1,placeholder:e.dataset.placeholder==="true",class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedOptions(){let e=[];const t=this.select.childNodes;for(const s of t){if(s.nodeName==="OPTGROUP"){const i=s.childNodes;for(const n of i)if(n.nodeName==="OPTION"){const l=n;l.selected&&e.push(this.getDataFromOption(l))}}if(s.nodeName==="OPTION"){const i=s;i.selected&&e.push(this.getDataFromOption(i))}}return e}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}setSelected(e){this.changeListen(!1);const t=this.select.childNodes;for(const s of t){if(s.nodeName==="OPTGROUP"){const i=s.childNodes;for(const n of i)if(n.nodeName==="OPTION"){const l=n;l.selected=e.includes(l.id)}}if(s.nodeName==="OPTION"){const i=s;i.selected=e.includes(i.id)}}this.changeListen(!0)}setSelectedByValue(e){this.changeListen(!1);const t=this.select.childNodes;for(const s of t){if(s.nodeName==="OPTGROUP"){const i=s.childNodes;for(const n of i)if(n.nodeName==="OPTION"){const l=n;l.selected=e.includes(l.value)}}if(s.nodeName==="OPTION"){const i=s;i.selected=e.includes(i.value)}}this.changeListen(!0)}updateSelect(e,t,s){this.changeListen(!1),e&&(this.select.dataset.id=e),t&&(this.select.style.cssText=t),s&&(this.select.className="",s.forEach(i=>{i.trim()!==""&&this.select.classList.add(i.trim())})),this.changeListen(!0)}updateOptions(e){if(!(!e||e.length===0)){this.isUpdating=!0,this.pendingOptionsChange=null,this.changeListen(!1),this.select.innerHTML="";for(const t of e)t instanceof he&&this.select.appendChild(this.createOptgroup(t)),t instanceof V&&this.select.appendChild(this.createOption(t));if(this.select.dispatchEvent(new Event("change",{bubbles:!0})),this.changeListen(!0),this.isUpdating=!1,this.pendingOptionsChange!==null){const t=this.pendingOptionsChange;t.length>0&&this.onOptionsChange?(this.pendingOptionsChange=null,this.changeListen(!1),this.onOptionsChange(t),this.changeListen(!0)):this.pendingOptionsChange=null}}}createOptgroup(e){const t=document.createElement("optgroup");if(t.id=e.id,t.label=e.label,e.selectAll&&(t.dataset.selectAll="true"),e.closable!=="off"&&(t.dataset.closable=e.closable),e.options)for(const s of e.options)t.appendChild(this.createOption(s));return t}createOption(e){const t=document.createElement("option");return t.id=e.id,t.value=e.value,t.textContent=e.text,e.html!==""&&t.setAttribute("data-html",e.html),t.defaultSelected=e.defaultSelected,t.selected=e.selected,e.disabled&&(t.disabled=!0),e.display||(t.style.display="none"),e.placeholder&&t.setAttribute("data-placeholder","true"),e.mandatory&&t.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach(s=>{t.classList.add(s)}),e.data&&typeof e.data=="object"&&Object.keys(e.data).forEach(s=>{t.setAttribute("data-"+Pt(s),e.data[s])}),t}setupLabelHandlers(){const e=[],t=this.select.id;t&&document.querySelectorAll(`label[for="${t}"]`).forEach(i=>e.push(i));let s=this.select.parentElement;for(;s&&s!==document.body;){if(s.tagName==="LABEL"){e.push(s);break}s=s.parentElement}Array.from(new Set(e)).forEach(i=>{if(i.__slimSelectLabelHandler)return;const n=l=>{const c=l.target;l.preventDefault(),c===i&&this.onLabelClick&&this.onLabelClick()};i.__slimSelectLabelHandler=n,i.addEventListener("click",n,{capture:!0,passive:!1})})}removeLabelHandlers(){const e=[],t=this.select.id;t&&document.querySelectorAll(`label[for="${t}"]`).forEach(i=>e.push(i));let s=this.select.parentElement;for(;s&&s!==document.body;){if(s.tagName==="LABEL"){e.push(s);break}s=s.parentElement}Array.from(new Set(e)).forEach(i=>{const n=i.__slimSelectLabelHandler;n&&(i.removeEventListener("click",n,{capture:!0}),delete i.__slimSelectLabelHandler)})}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.preventNativeSelect&&(this.select.removeEventListener("click",this.preventNativeSelect,{capture:!0}),this.preventNativeSelect=null),this.preventNativeSelectMousedown&&(this.select.removeEventListener("mousedown",this.preventNativeSelectMousedown,{capture:!0}),this.preventNativeSelectMousedown=null),this.preventNativeSelectFocus&&(this.select.removeEventListener("focus",this.preventNativeSelectFocus,{capture:!0}),this.preventNativeSelectFocus=null),this.observer&&(this.observer.disconnect(),this.observer=null),this.removeLabelHandlers(),delete this.select.dataset.id,this.showUI()}}class It{id="";style="";class=[];isMultiple=!1;isOpen=!1;isFullOpen=!1;intervalMove=null;disabled;alwaysOpen;showSearch;focusSearch;keepSearch;ariaLabel;searchPlaceholder;searchText;searchingText;searchHighlight;closeOnSelect;contentLocation;contentPosition;openPosition;placeholderText;allowDeselect;hideSelected;keepOrder;showOptionTooltips;minSelected;maxSelected;timeoutDelay;maxValuesShown;maxValuesMessage;addableText;constructor(e){e||(e={}),this.id="ss-"+$e(),this.style=e.style||"",this.class=e.class||[],this.disabled=e.disabled!==void 0?e.disabled:!1,this.alwaysOpen=e.alwaysOpen!==void 0?e.alwaysOpen:!1,this.showSearch=e.showSearch!==void 0?e.showSearch:!0,this.focusSearch=e.focusSearch!==void 0?e.focusSearch:!0,this.keepSearch=e.keepSearch!==void 0?e.keepSearch:!1,this.ariaLabel=e.ariaLabel||"Combobox",this.searchPlaceholder=e.searchPlaceholder||"Search...",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=e.searchHighlight!==void 0?e.searchHighlight:!1,this.closeOnSelect=e.closeOnSelect!==void 0?e.closeOnSelect:!0,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.placeholderText=e.placeholderText!==void 0?e.placeholderText:"Select Value",this.allowDeselect=e.allowDeselect!==void 0?e.allowDeselect:!1,this.hideSelected=e.hideSelected!==void 0?e.hideSelected:!1,this.keepOrder=e.keepOrder!==void 0?e.keepOrder:!1,this.showOptionTooltips=e.showOptionTooltips!==void 0?e.showOptionTooltips:!1,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected",this.addableText=e.addableText||'Press "Enter" to add {value}'}}class Ft{selectEl;settings;cssClasses;select;store;render;openTimeout=null;closeTimeout=null;events={search:void 0,searchFilter:(e,t)=>e.text.toLowerCase().indexOf(t.toLowerCase())!==-1,addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0};constructor(e){if(this.selectEl=typeof e.select=="string"?document.querySelector(e.select):e.select,!this.selectEl){e.events&&e.events.error&&e.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new It(e.settings),this.cssClasses=new Tt(e.cssClasses);const t=["beforeOpen","afterOpen","beforeClose","afterClose"];for(const c in e.events)e.events.hasOwnProperty(c)&&(t.indexOf(c)!==-1?this.events[c]=je(e.events[c],100):this.events[c]=e.events[c]);this.settings.disabled=e.settings?.disabled?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new Rt(this.selectEl),this.selectEl.id||(this.selectEl.id=this.settings.id),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=c=>{this.setSelected(c.map(d=>d.id))},this.select.onClassChange=c=>{this.settings.class=c,this.render.updateClassStyles()},this.select.onDisabledChange=c=>{c?this.disable():this.enable()},this.select.onOptionsChange=c=>{this.setData(c||[])},this.select.onLabelClick=()=>{this.settings.disabled||(this.settings.isOpen?this.close():this.open())};const s=e.data?e.data:this.select.getData();this.store=new Nt(this.settings.isMultiple?"multiple":"single",s),e.data&&this.select.updateOptions(this.store.getData());const i={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new Mt(this.settings,this.cssClasses,this.store,i),this.render.renderValues(),this.render.renderOptions(this.store.getData());const n=this.selectEl.getAttribute("aria-label"),l=this.selectEl.getAttribute("aria-labelledby");n?this.render.main.main.setAttribute("aria-label",n):l&&this.render.main.main.setAttribute("aria-labelledby",l),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),this.settings.openPosition==="auto"&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.select.setupLabelHandlers(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(e){const t=this.store.getSelected(),s=this.store.validateDataArray(e);if(s){this.events.error&&this.events.error(s);return}this.store.setData(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!Je(t,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let e=this.store.getSelectedOptions();return this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e)),e.map(t=>t.value)}setSelected(e,t=!0){const s=this.store.getSelected(),i=this.store.getDataOptions();e=Array.isArray(e)?e:[e];const n=[];for(const c of e){if(i.find(d=>d.id==c)){n.push(c);continue}for(const d of i.filter(h=>h.value==c))n.push(d.id)}this.store.setSelectedBy("id",n);const l=this.store.getData();this.select.updateOptions(l),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(l),t&&this.events.afterChange&&!Je(s,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const t=this.store.getSelected();this.store.getDataOptions().some(i=>i.value===(e.value??e.text))||this.store.addOption(e);const s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!Je(t,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.settings.focusSearch&&this.render.searchFocus(),this.settings.isOpen=!0,this.openTimeout=setTimeout(()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)},this.settings.timeoutDelay),this.settings.contentPosition==="absolute"&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(e=null){!this.settings.isOpen||this.settings.alwaysOpen||(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),!this.settings.keepSearch&&this.render.content.search.input.value!==""&&this.search(""),this.render.mainFocus(e),this.settings.isOpen=!1,this.settings.isFullOpen=!1,this.closeTimeout=setTimeout(()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)},this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(e){if(this.render.content.search.input.value!==e&&(this.render.content.search.input.value=e),e===""){this.render.renderOptions(this.store.getData());return}if(!this.events.search){const s=e===""?this.store.getData():this.store.search(e,this.events.searchFilter);this.render.renderOptions(s);return}this.render.renderSearching();const t=this.events.search(e,this.store.getSelectedOptions());if(t instanceof Promise){t.then(s=>{this.store.setData(s,!0),this.select.updateOptions(this.store.getData()),this.render.renderOptions(this.store.getData())}).catch(s=>{this.render.renderError(typeof s=="string"?s:s.message)});return}else Array.isArray(t)?(this.store.setData(t,!0),this.select.updateOptions(this.store.getData()),this.render.renderOptions(this.store.getData())):this.render.renderError("Search event must return a promise or an array of data")}destroy(){this.openTimeout&&(clearTimeout(this.openTimeout),this.openTimeout=null),this.closeTimeout&&(clearTimeout(this.closeTimeout),this.closeTimeout=null),this.settings.intervalMove&&(clearInterval(this.settings.intervalMove),this.settings.intervalMove=null),document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),this.settings.openPosition==="auto"&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}windowResize=je(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()});windowScroll=je(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()});documentClick=e=>{this.settings.isOpen&&e.target&&!Dt(e.target,this.settings.id)&&this.close(e.type)};windowVisibilityChange=()=>{document.hidden&&this.close()}}var Bt=ne('<select class="slim mb-2"></select>');function jt(o,e){qe(e,!0);let t=W(e,"value",15),s=W(e,"multiple",3,!1),i,n=Te(!1),l="";function c(f){Oe(()=>{i=new Ft({select:f,data:h(),settings:{id:e.id,ariaLabel:e.label,isMultiple:s()||!1,showSearch:!1,maxValuesShown:100,allowDeselect:!0,closeOnSelect:!s()},cssClasses:{deselect:"hidden"},events:{afterChange:g=>{s()?d(g.map(O=>O.value)):d(g[0]?.value)},beforeChange(g){if(!(s()||g.length>0))return i?.close(),!1}}}),l=JSON.stringify(e.options),Array.isArray(t())?i.setSelected(t().map(g=>g.toString()),!1):i.setSelected(t()||"",!1)})}pt(()=>{i&&(i.destroy(),i=void 0)}),ve(()=>{t(),Oe(async()=>{if(x(n)){we(n,!1);return}i&&i.setSelected(t()||[],!1)})}),ve(()=>{e.options,Oe(async()=>{if(JSON.stringify(e.options)===l||(l=JSON.stringify(e.options),!i))return;const f=i.getSelected();i.setData(h());let g;s()?g=f.filter(O=>e.options.find(N=>N.value===O)):g=e.options.some(O=>O.value===f[0])?f[0]:"",i.setSelected(g,!1)})}),ve(()=>{e.disabled,Oe(()=>{i&&(e.disabled?i.disable():i.enable())})});function d(f){t(f),we(n,!0),e.onUpdate(f)}function h(){return yt(e.options.map(f=>new V({...f})))}var p=Bt();Ot(p,()=>c),ye(()=>p.multiple=s()),ie(o,p),ze()}var Ut=ne('<div class="text-gray-500 dark:text-gray-400 italic">No options available</div>'),Ht=ne("<!> <!>",1);function Qe(o,e){const t=bt();qe(e,!0);let s=W(e,"value",15),i=W(e,"disabled",3,!1),n=W(e,"onUpdate",3,()=>{}),l=Ae(()=>e.options.map(g=>typeof g=="string"?{text:g,value:g}:{text:g.label,value:g.value}));var c=Ht(),d=Ve(c);At(d,{get label(){return e.label},get formId(){return t}});var h=le(d,2);{var p=g=>{var O=Ut();ie(g,O)},f=g=>{jt(g,{get id(){return t},get label(){return e.label},get options(){return x(l)},get disabled(){return i()},get onUpdate(){return n()},get value(){return s()},set value(O){s(O)}})};Ce(h,g=>{x(l).length==0?g(p):g(f,!1)})}ie(o,c),ze()}function Vt(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Ue={exports:{}};/* @license
|
|
1
|
+
import"./DsnmJJEf.js";import{b as Le,s as Be,c as pt,o as ot,d as ct}from"./D5i9uzhf.js";import{H as ft,aw as gt,Q as mt,a1 as vt,C as it,f as ne,d as q,r as z,s as le,aF as Ze,b as ie,t as ye,p as qe,u as ve,j as Oe,h as x,e as Te,i as we,c as ze,A as bt,a as Ve,m as Ae,g as Re,k as nt,aI as ht}from"./ACDB_Pwg.js";import{i as Ce}from"./BI-3sHG-.js";import{p as W}from"./y0Hysjl8.js";import{t as wt,j as yt,h as Pe,g as at,u as _t,s as _e,c as Se}from"./YBXudzKe.js";import{s as St}from"./Cxfa8IfO.js";import"./mRNW5lWq.js";function Ot(o,e){var t=void 0,s;ft(()=>{t!==(t=e())&&(s&&(gt(s),s=null),t&&(s=mt(()=>{vt(()=>t(o))})))})}function We(o,e={},t,s){for(var i in t){var n=t[i];e[i]!==n&&(t[i]==null?o.style.removeProperty(i):o.style.setProperty(i,n,s))}}function Lt(o,e,t,s){var i=o.__style;if(it||i!==e){var n=wt(e,s);(!it||n!==o.getAttribute("style"))&&(n==null?o.removeAttribute("style"):o.style.cssText=n),o.__style=e}else s&&(Array.isArray(s)?(We(o,t?.[0],s[0]),We(o,t?.[1],s[1],"important")):We(o,t,s));return s}function Ct(o){return Array.from(new Set(o))}function _s(o){return o.map(e=>({value:e,label:e}))}function Ss(o,e,t){return Object.entries(o).filter(([s,i])=>{const n=i.split(",");return t&&!e.includes(n[0])&&e.includes(n[1])||!t&&e.includes(n[0])&&!e.includes(n[1])}).map(([s,i])=>s)}var Et=ne('<label class="fw-medium fs-4"> </label>'),xt=ne('<div class="fw-medium fs-4"> </div>'),kt=ne('<div class="flex justify-between items-center mb-1"><div class="uppercase text-gray-600 dark:text-gray-400 tracking-wide text-sm"><!></div> <!></div>');function At(o,e){var t=kt(),s=q(t),i=q(s);{var n=d=>{var h=Et(),p=q(h,!0);z(h),ye(()=>{St(h,"for",e.formId),Be(p,e.label)}),ie(d,h)},l=d=>{var h=xt(),p=q(h,!0);z(h),ye(()=>Be(p,e.label)),ie(d,h)};Ce(i,d=>{e.formId?d(n):d(l,!1)})}z(s);var c=le(s,2);Le(c,()=>e.rightSide??Ze),z(t),ie(o,t)}class Tt{main;placeholder;values;single;max;value;valueText;valueDelete;valueOut;deselect;deselectPath;arrow;arrowClose;arrowOpen;content;contentOpen;dirAbove;dirBelow;search;searchHighlighter;searching;addable;addablePath;list;optgroup;optgroupLabel;optgroupLabelText;optgroupActions;optgroupSelectAll;optgroupSelectAllBox;optgroupSelectAllCheck;optgroupClosable;option;optionDelete;highlighted;mainOpen;close;selected;error;disabled;hide;constructor(e){e||(e={}),this.main=e.main||"ss-main",this.placeholder=e.placeholder||"ss-placeholder",this.values=e.values||"ss-values",this.single=e.single||"ss-single",this.max=e.max||"ss-max",this.value=e.value||"ss-value",this.valueText=e.valueText||"ss-value-text",this.valueDelete=e.valueDelete||"ss-value-delete",this.valueOut=e.valueOut||"ss-value-out",this.deselect=e.deselect||"ss-deselect",this.deselectPath=e.deselectPath||"M10,10 L90,90 M10,90 L90,10",this.arrow=e.arrow||"ss-arrow",this.arrowClose=e.arrowClose||"M10,30 L50,70 L90,30",this.arrowOpen=e.arrowOpen||"M10,70 L50,30 L90,70",this.content=e.content||"ss-content",this.contentOpen=e.contentOpen||"ss-open",this.dirAbove=e.dirAbove||"ss-dir-above",this.dirBelow=e.dirBelow||"ss-dir-below",this.search=e.search||"ss-search",this.searchHighlighter=e.searchHighlighter||"ss-search-highlight",this.searching=e.searching||"ss-searching",this.addable=e.addable||"ss-addable",this.addablePath=e.addablePath||"M50,10 L50,90 M10,50 L90,50",this.list=e.list||"ss-list",this.optgroup=e.optgroup||"ss-optgroup",this.optgroupLabel=e.optgroupLabel||"ss-optgroup-label",this.optgroupLabelText=e.optgroupLabelText||"ss-optgroup-label-text",this.optgroupActions=e.optgroupActions||"ss-optgroup-actions",this.optgroupSelectAll=e.optgroupSelectAll||"ss-selectall",this.optgroupSelectAllBox=e.optgroupSelectAllBox||"M60,10 L10,10 L10,90 L90,90 L90,50",this.optgroupSelectAllCheck=e.optgroupSelectAllCheck||"M30,45 L50,70 L90,10",this.optgroupClosable=e.optgroupClosable||"ss-closable",this.option=e.option||"ss-option",this.optionDelete=e.optionDelete||"M10,10 L90,90 M10,90 L90,10",this.highlighted=e.highlighted||"ss-highlighted",this.mainOpen=e.mainOpen||"ss-open",this.close=e.close||"ss-close",this.selected=e.selected||"ss-selected",this.error=e.error||"ss-error",this.disabled=e.disabled||"ss-disabled",this.hide=e.hide||"ss-hide"}}function $e(){return Math.random().toString(36).substring(2,10)}function Dt(o,e){function t(i,n){return n&&i&&i.classList&&i.classList.contains(n)||n&&i&&i.dataset&&i.dataset.id&&i.dataset.id===e?i:null}function s(i,n){return!i||i===document?null:t(i,n)?i:s(i.parentNode,n)}return t(o,e)||s(o,e)}function je(o,e=50,t=!1){let s;return function(...i){const n=self,l=()=>{s=null,t||o.apply(n,i)},c=t&&!s;clearTimeout(s),s=setTimeout(l,e),c&&o.apply(n,i)}}function Je(o,e){return JSON.stringify(o)===JSON.stringify(e)}function Pt(o){const e=o.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g,t=>"-"+t.toLowerCase());return o[0]===o[0].toUpperCase()?e.substring(1):e}class V{id;value;text;html;defaultSelected;selected;display;disabled;placeholder;class;style;data;mandatory;constructor(e){this.id=!e.id||e.id===""?$e():e.id,this.value=e.value===void 0?e.text||"":e.value||"",this.text=e.text||"",this.html=e.html||"",this.defaultSelected=e.defaultSelected!==void 0?e.defaultSelected:!1,this.selected=e.selected!==void 0?e.selected:!1,this.display=e.display!==void 0?e.display:!0,this.disabled=e.disabled!==void 0?e.disabled:!1,this.mandatory=e.mandatory!==void 0?e.mandatory:!1,this.placeholder=e.placeholder!==void 0?e.placeholder:!1,this.class=e.class||"",this.style=e.style||"",this.data=e.data||{}}}class he{id;label;selectAll;selectAllText;closable;options;constructor(e){if(this.id=!e.id||e.id===""?$e():e.id,this.label=e.label||"",this.selectAll=e.selectAll===void 0?!1:e.selectAll,this.selectAllText=e.selectAllText||"Select All",this.closable=e.closable||"off",this.options=[],e.options)for(const t of e.options)this.options.push(new V(t))}}class Nt{selectType="single";data=[];selectedOrder=[];constructor(e,t){this.selectType=e,this.setData(t)}validateDataArray(e){if(!Array.isArray(e))return new Error("Data must be an array");for(let t of e)if(t)if(t instanceof he||"label"in t){if(!("label"in t))return new Error("Optgroup must have a label");if("options"in t&&t.options)for(let s of t.options){const i=this.validateOption(s);if(i)return i}}else if(t instanceof V||"text"in t){const s=this.validateOption(t);if(s)return s}else return new Error("Data object must be a valid optgroup or option");return null}validateOption(e){return"text"in e?null:new Error("Option must have a text")}partialToFullData(e){let t=[];return e.forEach(s=>{if(s){if(s instanceof he||"label"in s){let i=[];"options"in s&&s.options&&s.options.forEach(n=>{i.push(new V(n))}),i.length>0&&t.push(new he(s))}(s instanceof V||"text"in s)&&t.push(new V(s))}}),t}setData(e,t=!1){const s=this.partialToFullData(e);if(t){const i=this.getSelectedOptions(),n=[];i.forEach(l=>{let c=!1;for(const d of s){if(d instanceof V&&d.id===l.id){c=!0;break}if(d instanceof he){for(const h of d.options)if(h.id===l.id){c=!0;break}}}c||n.push(l)}),this.data=[...n,...s]}else this.data=s;this.selectType==="single"&&this.setSelectedBy("id",this.getSelected())}getData(){return this.filter(null,!0)}getDataOptions(){return this.filter(null,!1)}addOption(e,t=!1){if(t){let s=[new V(e)];this.setData(s.concat(this.getData()))}else this.setData(this.getData().concat(new V(e)))}setSelectedBy(e,t){let s=null,i=!1;const n=[];for(let c of this.data){if(c instanceof he)for(let d of c.options){s||(s=d);let h=d[e]||"";d.selected=i?!1:t.includes(h),d.selected&&(n.push(d),this.selectType==="single"&&(i=!0))}c instanceof V&&(s||(s=c),c.selected=i?!1:t.includes(c[e]),c.selected&&(n.push(c),this.selectType==="single"&&(i=!0)))}this.selectType==="single"&&s&&!i&&(s.selected=!0,n.push(s));const l=t.map(c=>n.find(d=>d[e]===c)?.id||"");this.selectedOrder=l}getSelected(){return this.getSelectedOptions().map(e=>e.id)}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}getSelectedOptions(){return this.filter(e=>e.selected,!1)}getOptgroupByID(e){for(let t of this.data)if(t instanceof he&&t.id===e)return t;return null}getOptionByID(e){let t=this.filter(s=>s.id===e,!1);return t.length?t[0]:null}getSelectType(){return this.selectType}getFirstOption(){let e=null;for(let t of this.data)if(t instanceof he?e=t.options[0]:t instanceof V&&(e=t),e)break;return e}search(e,t){return e=e.trim(),e===""?this.getData():this.filter(s=>t(s,e),!0)}filter(e,t){const s=[];return this.data.forEach(i=>{if(i instanceof he){let n=[];if(i.options.forEach(l=>{(!e||e(l))&&(t?n.push(new V(l)):s.push(new V(l)))}),n.length>0){let l=new he(i);l.options=n,s.push(l)}}i instanceof V&&(!e||e(i))&&s.push(new V(i))}),s}selectedOrderOptions(e){const t=[];return this.selectedOrder.forEach(s=>{const i=e.find(n=>n.id===s);i&&t.push(i)}),e.forEach(s=>{let i=!1;t.forEach(n=>{if(s.id===n.id){i=!0;return}}),i||t.push(s)}),t}}class Mt{settings;store;callbacks;lastSelectedOption;main;content;classes;constructor(e,t,s,i){this.store=s,this.settings=e,this.classes=t,this.callbacks=i,this.lastSelectedOption=null,this.main=this.mainDiv(),this.content=this.contentDiv(),this.updateClassStyles(),this.updateAriaAttributes(),this.settings.contentPosition!=="relative"&&(this.content.main.style.top="-9999px",this.content.main.style.left="-9999px",this.content.main.style.margin="0",this.content.main.style.width="auto"),this.settings.contentLocation&&this.settings.contentLocation.appendChild(this.content.main)}enable(){this.main.main.classList.remove(this.classes.disabled),this.main.main.setAttribute("aria-disabled","false"),this.content.search.input.disabled=!1}disable(){this.main.main.classList.add(this.classes.disabled),this.main.main.setAttribute("aria-disabled","true"),this.content.search.input.disabled=!0}open(){this.main.arrow.path.setAttribute("d",this.classes.arrowOpen),this.main.main.setAttribute("aria-expanded","true");const e=this.settings.openPosition==="up"?this.classes.dirAbove:this.classes.dirBelow;this.main.main.classList.add(e),this.content.main.classList.add(e),this.content.main.classList.add(this.classes.contentOpen),this.content.search.input.removeAttribute("aria-hidden"),this.moveContent();const t=this.store.getSelectedOptions();if(t.length){const s=t[t.length-1].id,i=this.content.list.querySelector('[data-id="'+s+'"]');i&&this.ensureElementInView(this.content.list,i)}}close(){this.main.main.setAttribute("aria-expanded","false"),this.main.arrow.path.setAttribute("d",this.classes.arrowClose),this.content.main.classList.remove(this.classes.contentOpen),this.content.search.input.setAttribute("aria-hidden","true"),this.main.main.removeAttribute("aria-activedescendant");const e=this.getAnimationTiming();setTimeout(()=>{this.main.main.classList.remove(this.classes.dirAbove,this.classes.dirBelow),this.content.main.classList.remove(this.classes.dirAbove,this.classes.dirBelow)},e)}getAnimationTiming(){const e=getComputedStyle(this.content.main).getPropertyValue("--ss-animation-timing").trim();if(e){if(e.endsWith("ms"))return parseFloat(e);if(e.endsWith("s"))return parseFloat(e)*1e3}return 200}updateClassStyles(){if(this.main.main.className="",this.main.main.removeAttribute("style"),this.content.main.className="",this.content.main.removeAttribute("style"),this.main.main.classList.add(this.classes.main),this.content.main.classList.add(this.classes.content),this.settings.style!==""&&(this.main.main.style.cssText=this.settings.style,this.content.main.style.cssText=this.settings.style),this.settings.class.length)for(const e of this.settings.class)e.trim()!==""&&(this.main.main.classList.add(e.trim()),this.content.main.classList.add(e.trim()));(this.settings.contentPosition==="relative"||this.settings.contentPosition==="fixed")&&this.content.main.classList.add("ss-"+this.settings.contentPosition)}updateAriaAttributes(){const e=this.content.list.id;this.main.main.role="combobox",this.main.main.setAttribute("aria-haspopup","listbox"),this.main.main.setAttribute("aria-controls",e),this.main.main.setAttribute("aria-expanded","false"),this.content.list.setAttribute("role","listbox"),this.content.list.setAttribute("aria-label",this.settings.ariaLabel+" listbox"),this.settings.isMultiple&&this.content.list.setAttribute("aria-multiselectable","true"),this.content.search.input.setAttribute("aria-controls",e)}mainDiv(){const e=document.createElement("div");e.dataset.id=this.settings.id,e.setAttribute("aria-label",this.settings.ariaLabel),e.tabIndex=0,e.onkeydown=h=>{switch(h.key){case"ArrowUp":case"ArrowDown":return this.callbacks.open(),h.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Enter":case" ":this.callbacks.open();const p=this.content.list.querySelector("."+this.classes.highlighted);return p&&p.click(),!1;case"Escape":return this.callbacks.close(),!1}return h.key.length===1&&this.callbacks.open(),!0},e.onclick=h=>{this.settings.disabled||(this.settings.isOpen?this.callbacks.close():this.callbacks.open())};const t=document.createElement("div");t.classList.add(this.classes.values),e.appendChild(t);const s=document.createElement("div");s.classList.add(this.classes.deselect);const i=this.store?.getSelectedOptions();!this.settings.allowDeselect||this.settings.isMultiple&&i&&i.length<=0?s.classList.add(this.classes.hide):s.classList.remove(this.classes.hide),s.onclick=h=>{if(h.stopPropagation(),this.settings.disabled)return;let p=!0;const f=this.store.getSelectedOptions(),g=[];if(this.callbacks.beforeChange&&(p=this.callbacks.beforeChange(g,f)===!0),p){if(this.settings.isMultiple)this.callbacks.setSelected([],!1),this.updateDeselectAll();else{const O=this.store.getFirstOption(),N=O?O.id:"";this.callbacks.setSelected(N,!1)}this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(this.store.getSelectedOptions())}};const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.deselectPath),n.appendChild(l),s.appendChild(n),e.appendChild(s);const c=document.createElementNS("http://www.w3.org/2000/svg","svg");c.classList.add(this.classes.arrow),c.setAttribute("viewBox","0 0 100 100");const d=document.createElementNS("http://www.w3.org/2000/svg","path");return d.setAttribute("d",this.classes.arrowClose),this.settings.alwaysOpen&&c.classList.add(this.classes.hide),c.appendChild(d),e.appendChild(c),{main:e,values:t,deselect:{main:s,svg:n,path:l},arrow:{main:c,path:d}}}mainFocus(e){e!=="click"&&this.main.main.focus({preventScroll:!0})}placeholder(){const e=this.store.filter(i=>i.placeholder,!1);let t=this.settings.placeholderText;e.length&&(e[0].html!==""?t=e[0].html:e[0].text!==""&&(t=e[0].text));const s=document.createElement("div");return s.classList.add(this.classes.placeholder),s.innerHTML=t,s}renderValues(){if(!this.settings.isMultiple){this.renderSingleValue();return}this.renderMultipleValues(),this.updateDeselectAll()}renderSingleValue(){const e=this.store.filter(s=>s.selected&&!s.placeholder,!1),t=e.length>0?e[0]:null;if(!t)this.main.values.innerHTML=this.placeholder().outerHTML;else{const s=document.createElement("div");s.classList.add(this.classes.single),t.html?s.innerHTML=t.html:s.innerText=t.text,this.main.values.innerHTML=s.outerHTML}!this.settings.allowDeselect||!e.length?this.main.deselect.main.classList.add(this.classes.hide):this.main.deselect.main.classList.remove(this.classes.hide)}renderMultipleValues(){let e=this.main.values.childNodes,t=this.store.filter(i=>i.selected&&i.display,!1);if(t.length===0){this.main.values.innerHTML=this.placeholder().outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.placeholder);i&&i.remove()}if(t.length>this.settings.maxValuesShown){const i=document.createElement("div");i.classList.add(this.classes.max),i.textContent=this.settings.maxValuesMessage.replace("{number}",t.length.toString()),this.main.values.innerHTML=i.outerHTML;return}else{const i=this.main.values.querySelector("."+this.classes.max);i&&i.remove()}this.settings.keepOrder&&(t=this.store.selectedOrderOptions(t));let s=[];for(let i=0;i<e.length;i++){const n=e[i],l=n.getAttribute("data-id");l&&(t.filter(c=>c.id===l,!1).length||s.push(n))}for(const i of s)i.classList.add(this.classes.valueOut),setTimeout(()=>{this.main.values.hasChildNodes()&&this.main.values.contains(i)&&this.main.values.removeChild(i)},100);e=this.main.values.childNodes;for(let i=0;i<t.length;i++){let n=!0;for(let l=0;l<e.length;l++)t[i].id===String(e[l].dataset.id)&&(n=!1);n&&(this.settings.keepOrder?this.main.values.appendChild(this.multipleValue(t[i])):e.length===0?this.main.values.appendChild(this.multipleValue(t[i])):i===0?this.main.values.insertBefore(this.multipleValue(t[i]),e[i]):e[i-1].insertAdjacentElement("afterend",this.multipleValue(t[i])))}}multipleValue(e){const t=document.createElement("div");t.classList.add(this.classes.value),t.dataset.id=e.id;const s=document.createElement("div");if(s.classList.add(this.classes.valueText),s.textContent=e.text,t.appendChild(s),!e.mandatory){const i=document.createElement("div");i.classList.add(this.classes.valueDelete),i.setAttribute("tabindex","0"),i.onclick=c=>{if(c.preventDefault(),c.stopPropagation(),this.settings.disabled)return;let d=!0;const h=this.store.getSelectedOptions(),p=h.filter(f=>f.selected&&f.id!==e.id,!0);if(!(this.settings.minSelected&&p.length<this.settings.minSelected)&&(this.callbacks.beforeChange&&(d=this.callbacks.beforeChange(p,h)===!0),d)){let f=[];for(const g of p){if(g instanceof he)for(const O of g.options)O.id&&f.push(O.id);g instanceof V&&f.push(g.id)}this.callbacks.setSelected(f,!1),this.settings.closeOnSelect&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(p),this.updateDeselectAll()}};const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.optionDelete),n.appendChild(l),i.appendChild(n),t.appendChild(i),i.onkeydown=c=>{c.key==="Enter"&&i.click()}}return t}contentDiv(){const e=document.createElement("div");e.dataset.id=this.settings.id;const t=this.searchDiv();e.appendChild(t.main);const s=this.listDiv();return e.appendChild(s),{main:e,search:t,list:s}}moveContent(){if(this.settings.contentPosition==="relative"){this.moveContentBelow();return}if(this.settings.openPosition==="down"){this.moveContentBelow();return}else if(this.settings.openPosition==="up"){this.moveContentAbove();return}this.putContent()==="up"?this.moveContentAbove():this.moveContentBelow()}searchDiv(){const e=document.createElement("div"),t=document.createElement("input"),s=document.createElement("div");e.classList.add(this.classes.search);const i={main:e,input:t};if(this.settings.showSearch||(e.classList.add(this.classes.hide),t.readOnly=!0),t.type="search",t.placeholder=this.settings.searchPlaceholder,t.tabIndex=-1,t.setAttribute("aria-label",this.settings.searchPlaceholder),t.setAttribute("aria-autocomplete","list"),t.setAttribute("autocapitalize","off"),t.setAttribute("autocomplete","off"),t.setAttribute("autocorrect","off"),t.setAttribute("aria-hidden","true"),t.oninput=je(n=>{this.callbacks.search(n.target.value)},100),t.onkeydown=n=>{switch(n.key){case"ArrowUp":case"ArrowDown":return n.key==="ArrowDown"?this.highlight("down"):this.highlight("up"),!1;case"Tab":return this.callbacks.close(),!0;case"Escape":return this.callbacks.close(),!1;case" ":const l=this.content.list.querySelector("."+this.classes.highlighted);return l?(l.click(),!1):!0;case"Enter":const c=this.content.list.querySelector("."+this.classes.highlighted);return c?(c.click(),!1):this.callbacks.addable?(s.click(),!1):!0}return!0},e.appendChild(t),this.callbacks.addable){s.classList.add(this.classes.addable);const n=document.createElementNS("http://www.w3.org/2000/svg","svg");n.setAttribute("viewBox","0 0 100 100");const l=document.createElementNS("http://www.w3.org/2000/svg","path");l.setAttribute("d",this.classes.addablePath),n.appendChild(l),s.appendChild(n),s.onclick=c=>{if(c.preventDefault(),c.stopPropagation(),!this.callbacks.addable)return;const d=this.content.search.input.value.trim();if(d===""){this.content.search.input.focus();return}const h=f=>{let g=new V(f);if(this.callbacks.addOption(g),this.settings.isMultiple){let O=this.store.getSelected();O.push(g.id),this.callbacks.setSelected(O,!0)}else this.callbacks.setSelected([g.id],!0);this.callbacks.search(""),this.settings.closeOnSelect&&setTimeout(()=>{this.callbacks.close()},100)},p=this.callbacks.addable(d);p===!1||p===void 0||p===null||(p instanceof Promise?p.then(f=>{typeof f=="string"?h({text:f,value:f}):p instanceof Error?this.renderError(p.message):h(f)}):typeof p=="string"?h({text:p,value:p}):p instanceof Error?this.renderError(p.message):h(p))},e.appendChild(s),i.addable={main:s,svg:n,path:l}}return i}searchFocus(){this.content.search.input.focus({preventScroll:!0})}getOptions(e=!1,t=!1,s=!1){let i="."+this.classes.option;return e&&(i+=":not(."+this.classes.placeholder+")"),t&&(i+=":not(."+this.classes.disabled+")"),s&&(i+=":not(."+this.classes.hide+")"),Array.from(this.content.list.querySelectorAll(i))}highlight(e){const t=this.getOptions(!0,!0,!0);if(t.length===0)return;if(t.length===1&&!t[0].classList.contains(this.classes.highlighted)){t[0].classList.add(this.classes.highlighted);return}let s=!1;for(const n of t)n.classList.contains(this.classes.highlighted)&&(s=!0);if(!s){for(const n of t)if(n.classList.contains(this.classes.selected)){n.classList.add(this.classes.highlighted);break}}for(let n=0;n<t.length;n++)if(t[n].classList.contains(this.classes.highlighted)){const l=t[n];l.classList.remove(this.classes.highlighted);const c=l.parentElement;if(c&&c.classList.contains(this.classes.mainOpen)){const p=c.querySelector("."+this.classes.optgroupLabel);p&&p.click()}let d=t[e==="down"?n+1<t.length?n+1:0:n-1>=0?n-1:t.length-1];d.classList.add(this.classes.highlighted),this.ensureElementInView(this.content.list,d),d.id&&this.main.main.setAttribute("aria-activedescendant",d.id);const h=d.parentElement;if(h&&h.classList.contains(this.classes.close)){const p=h.querySelector("."+this.classes.optgroupLabel);p&&p.click()}return}const i=t[e==="down"?0:t.length-1];i.classList.add(this.classes.highlighted),i.id&&this.main.main.setAttribute("aria-activedescendant",i.id),this.ensureElementInView(this.content.list,i)}listDiv(){const e=document.createElement("div");e.classList.add(this.classes.list);const t=this.settings.id+"-list";return e.id=t,e.dataset.id=t,e}renderError(e){this.content.list.innerHTML="";const t=document.createElement("div");t.classList.add(this.classes.error),t.textContent=e,this.content.list.appendChild(t)}renderSearching(){this.content.list.innerHTML="";const e=document.createElement("div");e.classList.add(this.classes.searching),e.textContent=this.settings.searchingText,this.content.list.appendChild(e)}renderOptions(e){if(this.content.list.innerHTML="",e.length===0){const s=document.createElement("div");s.classList.add(this.classes.search),this.callbacks.addable?s.innerHTML=this.settings.addableText.replace("{value}",this.content.search.input.value):s.innerHTML=this.settings.searchText,this.content.list.appendChild(s);return}this.settings.allowDeselect&&!this.settings.isMultiple&&(this.store.filter(s=>s.placeholder,!1).length||this.store.addOption(new V({text:"",value:"",selected:!1,placeholder:!0}),!0));const t=document.createDocumentFragment();for(const s of e){if(s instanceof he){const i=document.createElement("div");i.classList.add(this.classes.optgroup);const n=document.createElement("div");n.classList.add(this.classes.optgroupLabel),i.appendChild(n);const l=document.createElement("div");l.classList.add(this.classes.optgroupLabelText),l.textContent=s.label,n.appendChild(l);const c=document.createElement("div");if(c.classList.add(this.classes.optgroupActions),n.appendChild(c),this.settings.isMultiple&&s.selectAll){const d=document.createElement("div");d.classList.add(this.classes.optgroupSelectAll);let h=!0;for(const N of s.options)if(!N.selected){h=!1;break}h&&d.classList.add(this.classes.selected);const p=document.createElement("span");p.textContent=s.selectAllText,d.appendChild(p);const f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("viewBox","0 0 100 100"),d.appendChild(f);const g=document.createElementNS("http://www.w3.org/2000/svg","path");g.setAttribute("d",this.classes.optgroupSelectAllBox),f.appendChild(g);const O=document.createElementNS("http://www.w3.org/2000/svg","path");O.setAttribute("d",this.classes.optgroupSelectAllCheck),f.appendChild(O),d.addEventListener("click",N=>{N.preventDefault(),N.stopPropagation();const $=this.store.getSelected();if(h){const B=$.filter(X=>{for(const K of s.options)if(X===K.id)return!1;return!0});this.callbacks.setSelected(B,!0);return}else{let B=s.options.map(K=>K.id).filter(K=>K!==void 0);const X=$.concat(B);for(const K of s.options)K.id&&!this.store.getOptionByID(K.id)&&this.callbacks.addOption(new V(K));this.callbacks.setSelected(X,!0);return}}),c.appendChild(d)}if(s.closable!=="off"){const d=document.createElement("div");d.classList.add(this.classes.optgroupClosable);const h=document.createElementNS("http://www.w3.org/2000/svg","svg");h.setAttribute("viewBox","0 0 100 100"),h.classList.add(this.classes.arrow),d.appendChild(h);const p=document.createElementNS("http://www.w3.org/2000/svg","path");h.appendChild(p),s.options.some(f=>f.selected)||this.content.search.input.value.trim()!==""?(d.classList.add(this.classes.mainOpen),p.setAttribute("d",this.classes.arrowOpen)):s.closable==="open"?(i.classList.add(this.classes.mainOpen),p.setAttribute("d",this.classes.arrowOpen)):s.closable==="close"&&(i.classList.add(this.classes.close),p.setAttribute("d",this.classes.arrowClose)),n.addEventListener("click",f=>{f.preventDefault(),f.stopPropagation(),i.classList.contains(this.classes.close)?(i.classList.remove(this.classes.close),i.classList.add(this.classes.mainOpen),p.setAttribute("d",this.classes.arrowOpen)):(i.classList.remove(this.classes.mainOpen),i.classList.add(this.classes.close),p.setAttribute("d",this.classes.arrowClose))}),c.appendChild(d)}i.appendChild(n);for(const d of s.options)i.appendChild(this.option(new V(d))),t.appendChild(i)}s instanceof V&&t.appendChild(this.option(s))}this.content.list.appendChild(t)}option(e){if(e.placeholder){const s=document.createElement("div");return s.classList.add(this.classes.option),s.classList.add(this.classes.hide),s}const t=document.createElement("div");return t.dataset.id=e.id,t.id=this.settings.id+"-"+e.id,t.classList.add(this.classes.option),t.setAttribute("role","option"),e.class&&e.class.split(" ").forEach(s=>{t.classList.add(s)}),e.style&&(t.style.cssText=e.style),this.settings.searchHighlight&&this.content.search.input.value.trim()!==""?t.innerHTML=this.highlightText(e.html!==""?e.html:e.text,this.content.search.input.value,this.classes.searchHighlighter):e.html!==""?t.innerHTML=e.html:t.textContent=e.text,this.settings.showOptionTooltips&&t.textContent&&t.setAttribute("title",t.textContent),e.display||t.classList.add(this.classes.hide),e.disabled&&t.classList.add(this.classes.disabled),e.selected&&this.settings.hideSelected&&t.classList.add(this.classes.hide),e.selected?(t.classList.add(this.classes.selected),t.setAttribute("aria-selected","true"),this.main.main.setAttribute("aria-activedescendant",t.id)):(t.classList.remove(this.classes.selected),t.setAttribute("aria-selected","false")),t.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation();const i=this.store.getSelected(),n=s.currentTarget,l=String(n.dataset.id),c=s.ctrlKey||s.metaKey;if(e.disabled||!this.settings.isMultiple&&e.selected&&!this.settings.allowDeselect||e.selected&&e.mandatory||this.settings.isMultiple&&this.settings.maxSelected<=i.length&&!e.selected||this.settings.isMultiple&&this.settings.minSelected>=i.length&&e.selected&&!c)return;let d=!1;const h=this.store.getSelectedOptions();let p=[];if(this.settings.isMultiple){const f=h.some(g=>g.id===l);if(s.shiftKey&&this.lastSelectedOption){const g=this.store.getDataOptions(),O=g.findIndex($=>$.id===this.lastSelectedOption.id),N=g.findIndex($=>$.id===e.id);if(O>=0&&N>=0){const $=Math.min(O,N),B=Math.max(O,N),X=g.slice($,B+1).filter(K=>!h.find(oe=>oe.id===K.id));h.length+X.length<=this.settings.maxSelected?p=h.concat(X):p=h}else p=h}else c?(f?p=h.filter(g=>g.id!==l):p=h.concat(e),this.lastSelectedOption=e):(f?p=h.filter(g=>g.id!==l):p=h.concat(e),this.lastSelectedOption=e)}if(this.settings.isMultiple||(e.selected?p=[]:p=[e]),this.callbacks.beforeChange||(d=!0),this.callbacks.beforeChange&&(this.callbacks.beforeChange(p,h)===!1?d=!1:d=!0),d){this.store.getOptionByID(l)||this.callbacks.addOption(e),this.callbacks.setSelected(p.map(g=>g.id),!1);const f=s.ctrlKey||s.metaKey||s.shiftKey;this.settings.closeOnSelect&&!(this.settings.isMultiple&&f)&&this.callbacks.close(),this.callbacks.afterChange&&this.callbacks.afterChange(p)}}),t}destroy(){this.main.main.remove(),this.content.main.remove()}highlightText(e,t,s){const i=t.trim();if(i==="")return e;const n=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=document.createElement("div");l.innerHTML=e;const c=d=>{if(d.nodeType===Node.TEXT_NODE){const h=d.textContent||"",p=new RegExp("("+n+")","i");if(p.test(h)){const f=document.createElement("span");h.split(p).forEach((g,O)=>{if(g&&p.test(g)){const N=document.createElement("mark");N.className=s,N.textContent=g,f.appendChild(N)}else g&&f.appendChild(document.createTextNode(g))}),d.parentNode?.replaceChild(f,d)}}else d.nodeType===Node.ELEMENT_NODE&&Array.from(d.childNodes).forEach(h=>c(h))};return Array.from(l.childNodes).forEach(d=>c(d)),l.innerHTML}moveContentAbove(){const e=this.main.main.offsetHeight,t=this.content.main.offsetHeight;this.main.main.classList.remove(this.classes.dirBelow),this.main.main.classList.add(this.classes.dirAbove),this.content.main.classList.remove(this.classes.dirBelow),this.content.main.classList.add(this.classes.dirAbove);const s=this.main.main.getBoundingClientRect();this.content.main.style.margin="-"+(e+t-1)+"px 0px 0px 0px",this.content.main.style.top=s.top+s.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=s.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=s.width+"px"}moveContentBelow(){this.main.main.classList.remove(this.classes.dirAbove),this.main.main.classList.add(this.classes.dirBelow),this.content.main.classList.remove(this.classes.dirAbove),this.content.main.classList.add(this.classes.dirBelow);const e=this.main.main.getBoundingClientRect();this.content.main.style.margin="-1px 0px 0px 0px",this.settings.contentPosition!=="relative"&&(this.content.main.style.top=e.top+e.height+(this.settings.contentPosition==="fixed"?0:window.scrollY)+"px",this.content.main.style.left=e.left+(this.settings.contentPosition==="fixed"?0:window.scrollX)+"px",this.content.main.style.width=e.width+"px")}ensureElementInView(e,t){const s=e.scrollTop+e.offsetTop,i=s+e.clientHeight,n=t.offsetTop,l=n+t.clientHeight;n<s?e.scrollTop-=s-n:l>i&&(e.scrollTop+=l-i)}putContent(){const e=this.main.main.offsetHeight,t=this.main.main.getBoundingClientRect(),s=this.content.main.offsetHeight;return window.innerHeight-(t.top+e)<=s&&t.top>s?"up":"down"}updateDeselectAll(){if(!this.store||!this.settings)return;const e=this.store.getSelectedOptions(),t=e&&e.length>0,s=this.settings.isMultiple,i=this.settings.allowDeselect,n=this.main.deselect.main,l=this.classes.hide;i&&!(s&&!t)?n.classList.remove(l):n.classList.add(l)}}class Rt{select;onValueChange;onClassChange;onDisabledChange;onOptionsChange;onLabelClick;listen=!1;observer=null;isUpdating=!1;pendingOptionsChange=null;preventNativeSelect=null;preventNativeSelectMousedown=null;preventNativeSelectFocus=null;constructor(e){this.select=e,this.valueChange=this.valueChange.bind(this),this.select.addEventListener("change",this.valueChange,{passive:!0}),this.observer=new MutationObserver(this.observeCall.bind(this)),this.changeListen(!0)}enable(){this.select.disabled=!1}disable(){this.select.disabled=!0}hideUI(){this.select.tabIndex=-1,this.select.style.position="absolute",this.select.style.width="1px",this.select.style.height="1px",this.select.style.opacity="0",this.select.style.overflow="hidden",this.select.style.pointerEvents="none",this.select.style.margin="0",this.select.style.padding="0",this.select.style.borderWidth="0",this.select.style.clip="rect(0 0 0 0)",this.select.setAttribute("aria-hidden","true"),this.preventNativeSelect||(this.preventNativeSelect=e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()},this.preventNativeSelectMousedown=e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()},this.preventNativeSelectFocus=e=>{e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()},this.select.addEventListener("click",this.preventNativeSelect,{capture:!0,passive:!1}),this.select.addEventListener("mousedown",this.preventNativeSelectMousedown,{capture:!0,passive:!1}),this.select.addEventListener("focus",this.preventNativeSelectFocus,{capture:!0,passive:!1}))}showUI(){this.select.removeAttribute("tabindex"),this.select.style.position="",this.select.style.width="",this.select.style.height="",this.select.style.opacity="",this.select.style.overflow="",this.select.style.pointerEvents="",this.select.style.margin="",this.select.style.padding="",this.select.style.borderWidth="",this.select.style.clip="",this.select.removeAttribute("aria-hidden"),this.preventNativeSelect&&(this.select.removeEventListener("click",this.preventNativeSelect,{capture:!0}),this.preventNativeSelect=null),this.preventNativeSelectMousedown&&(this.select.removeEventListener("mousedown",this.preventNativeSelectMousedown,{capture:!0}),this.preventNativeSelectMousedown=null),this.preventNativeSelectFocus&&(this.select.removeEventListener("focus",this.preventNativeSelectFocus,{capture:!0}),this.preventNativeSelectFocus=null)}changeListen(e){this.listen=e,e&&this.observer&&this.observer.observe(this.select,{subtree:!0,childList:!0,attributes:!0}),e||this.observer&&this.observer.disconnect()}valueChange(e){return this.listen&&this.onValueChange&&this.onValueChange(this.getSelectedOptions()),!0}observeCall(e){if(!this.listen)return;let t=!1,s=!1,i=!1,n=!1;for(const l of e){if(l.target===this.select&&(l.attributeName==="disabled"&&(s=!0),l.attributeName==="class"&&(t=!0),l.type==="childList")){for(const c of Array.from(l.addedNodes))if(c.nodeName==="OPTION"&&c.value===this.select.value){n=!0;break}i=!0}(l.target.nodeName==="OPTGROUP"||l.target.nodeName==="OPTION")&&(i=!0)}if(t&&this.onClassChange&&this.onClassChange(this.select.className.split(" ")),s&&this.onDisabledChange&&(this.changeListen(!1),this.onDisabledChange(this.select.disabled),this.changeListen(!0)),i&&this.onOptionsChange){if(this.isUpdating){if(this.select.options.length>0){const l=this.getData();l.length>0&&(this.pendingOptionsChange=l)}n&&this.select.dispatchEvent(new Event("change"));return}this.changeListen(!1),this.onOptionsChange(this.getData()),this.changeListen(!0)}n&&this.select.dispatchEvent(new Event("change"))}getData(){let e=[];const t=this.select.childNodes;for(const s of t)s.nodeName==="OPTGROUP"&&e.push(this.getDataFromOptgroup(s)),s.nodeName==="OPTION"&&e.push(this.getDataFromOption(s));return e}getDataFromOptgroup(e){let t={id:e.id,label:e.label,selectAll:e.dataset?e.dataset.selectall==="true":!1,selectAllText:e.dataset?e.dataset.selectalltext:"Select all",closable:e.dataset?e.dataset.closable:"off",options:[]};const s=e.childNodes;for(const i of s)i.nodeName==="OPTION"&&t.options.push(this.getDataFromOption(i));return t}getDataFromOption(e){return{id:e.id,value:e.value,text:e.text,html:e.dataset&&e.dataset.html?e.dataset.html:"",defaultSelected:e.defaultSelected,selected:e.selected,display:e.style.display!=="none",disabled:e.disabled,mandatory:e.dataset?e.dataset.mandatory==="true":!1,placeholder:e.dataset.placeholder==="true",class:e.className,style:e.style.cssText,data:e.dataset}}getSelectedOptions(){let e=[];const t=this.select.childNodes;for(const s of t){if(s.nodeName==="OPTGROUP"){const i=s.childNodes;for(const n of i)if(n.nodeName==="OPTION"){const l=n;l.selected&&e.push(this.getDataFromOption(l))}}if(s.nodeName==="OPTION"){const i=s;i.selected&&e.push(this.getDataFromOption(i))}}return e}getSelectedValues(){return this.getSelectedOptions().map(e=>e.value)}setSelected(e){this.changeListen(!1);const t=this.select.childNodes;for(const s of t){if(s.nodeName==="OPTGROUP"){const i=s.childNodes;for(const n of i)if(n.nodeName==="OPTION"){const l=n;l.selected=e.includes(l.id)}}if(s.nodeName==="OPTION"){const i=s;i.selected=e.includes(i.id)}}this.changeListen(!0)}setSelectedByValue(e){this.changeListen(!1);const t=this.select.childNodes;for(const s of t){if(s.nodeName==="OPTGROUP"){const i=s.childNodes;for(const n of i)if(n.nodeName==="OPTION"){const l=n;l.selected=e.includes(l.value)}}if(s.nodeName==="OPTION"){const i=s;i.selected=e.includes(i.value)}}this.changeListen(!0)}updateSelect(e,t,s){this.changeListen(!1),e&&(this.select.dataset.id=e),t&&(this.select.style.cssText=t),s&&(this.select.className="",s.forEach(i=>{i.trim()!==""&&this.select.classList.add(i.trim())})),this.changeListen(!0)}updateOptions(e){if(!(!e||e.length===0)){this.isUpdating=!0,this.pendingOptionsChange=null,this.changeListen(!1),this.select.innerHTML="";for(const t of e)t instanceof he&&this.select.appendChild(this.createOptgroup(t)),t instanceof V&&this.select.appendChild(this.createOption(t));if(this.select.dispatchEvent(new Event("change",{bubbles:!0})),this.changeListen(!0),this.isUpdating=!1,this.pendingOptionsChange!==null){const t=this.pendingOptionsChange;t.length>0&&this.onOptionsChange?(this.pendingOptionsChange=null,this.changeListen(!1),this.onOptionsChange(t),this.changeListen(!0)):this.pendingOptionsChange=null}}}createOptgroup(e){const t=document.createElement("optgroup");if(t.id=e.id,t.label=e.label,e.selectAll&&(t.dataset.selectAll="true"),e.closable!=="off"&&(t.dataset.closable=e.closable),e.options)for(const s of e.options)t.appendChild(this.createOption(s));return t}createOption(e){const t=document.createElement("option");return t.id=e.id,t.value=e.value,t.textContent=e.text,e.html!==""&&t.setAttribute("data-html",e.html),t.defaultSelected=e.defaultSelected,t.selected=e.selected,e.disabled&&(t.disabled=!0),e.display||(t.style.display="none"),e.placeholder&&t.setAttribute("data-placeholder","true"),e.mandatory&&t.setAttribute("data-mandatory","true"),e.class&&e.class.split(" ").forEach(s=>{t.classList.add(s)}),e.data&&typeof e.data=="object"&&Object.keys(e.data).forEach(s=>{t.setAttribute("data-"+Pt(s),e.data[s])}),t}setupLabelHandlers(){const e=[],t=this.select.id;t&&document.querySelectorAll(`label[for="${t}"]`).forEach(i=>e.push(i));let s=this.select.parentElement;for(;s&&s!==document.body;){if(s.tagName==="LABEL"){e.push(s);break}s=s.parentElement}Array.from(new Set(e)).forEach(i=>{if(i.__slimSelectLabelHandler)return;const n=l=>{const c=l.target;l.preventDefault(),c===i&&this.onLabelClick&&this.onLabelClick()};i.__slimSelectLabelHandler=n,i.addEventListener("click",n,{capture:!0,passive:!1})})}removeLabelHandlers(){const e=[],t=this.select.id;t&&document.querySelectorAll(`label[for="${t}"]`).forEach(i=>e.push(i));let s=this.select.parentElement;for(;s&&s!==document.body;){if(s.tagName==="LABEL"){e.push(s);break}s=s.parentElement}Array.from(new Set(e)).forEach(i=>{const n=i.__slimSelectLabelHandler;n&&(i.removeEventListener("click",n,{capture:!0}),delete i.__slimSelectLabelHandler)})}destroy(){this.changeListen(!1),this.select.removeEventListener("change",this.valueChange),this.preventNativeSelect&&(this.select.removeEventListener("click",this.preventNativeSelect,{capture:!0}),this.preventNativeSelect=null),this.preventNativeSelectMousedown&&(this.select.removeEventListener("mousedown",this.preventNativeSelectMousedown,{capture:!0}),this.preventNativeSelectMousedown=null),this.preventNativeSelectFocus&&(this.select.removeEventListener("focus",this.preventNativeSelectFocus,{capture:!0}),this.preventNativeSelectFocus=null),this.observer&&(this.observer.disconnect(),this.observer=null),this.removeLabelHandlers(),delete this.select.dataset.id,this.showUI()}}class It{id="";style="";class=[];isMultiple=!1;isOpen=!1;isFullOpen=!1;intervalMove=null;disabled;alwaysOpen;showSearch;focusSearch;keepSearch;ariaLabel;searchPlaceholder;searchText;searchingText;searchHighlight;closeOnSelect;contentLocation;contentPosition;openPosition;placeholderText;allowDeselect;hideSelected;keepOrder;showOptionTooltips;minSelected;maxSelected;timeoutDelay;maxValuesShown;maxValuesMessage;addableText;constructor(e){e||(e={}),this.id="ss-"+$e(),this.style=e.style||"",this.class=e.class||[],this.disabled=e.disabled!==void 0?e.disabled:!1,this.alwaysOpen=e.alwaysOpen!==void 0?e.alwaysOpen:!1,this.showSearch=e.showSearch!==void 0?e.showSearch:!0,this.focusSearch=e.focusSearch!==void 0?e.focusSearch:!0,this.keepSearch=e.keepSearch!==void 0?e.keepSearch:!1,this.ariaLabel=e.ariaLabel||"Combobox",this.searchPlaceholder=e.searchPlaceholder||"Search...",this.searchText=e.searchText||"No Results",this.searchingText=e.searchingText||"Searching...",this.searchHighlight=e.searchHighlight!==void 0?e.searchHighlight:!1,this.closeOnSelect=e.closeOnSelect!==void 0?e.closeOnSelect:!0,this.contentLocation=e.contentLocation||document.body,this.contentPosition=e.contentPosition||"absolute",this.openPosition=e.openPosition||"auto",this.placeholderText=e.placeholderText!==void 0?e.placeholderText:"Select Value",this.allowDeselect=e.allowDeselect!==void 0?e.allowDeselect:!1,this.hideSelected=e.hideSelected!==void 0?e.hideSelected:!1,this.keepOrder=e.keepOrder!==void 0?e.keepOrder:!1,this.showOptionTooltips=e.showOptionTooltips!==void 0?e.showOptionTooltips:!1,this.minSelected=e.minSelected||0,this.maxSelected=e.maxSelected||1e3,this.timeoutDelay=e.timeoutDelay||200,this.maxValuesShown=e.maxValuesShown||20,this.maxValuesMessage=e.maxValuesMessage||"{number} selected",this.addableText=e.addableText||'Press "Enter" to add {value}'}}class Ft{selectEl;settings;cssClasses;select;store;render;openTimeout=null;closeTimeout=null;events={search:void 0,searchFilter:(e,t)=>e.text.toLowerCase().indexOf(t.toLowerCase())!==-1,addable:void 0,beforeChange:void 0,afterChange:void 0,beforeOpen:void 0,afterOpen:void 0,beforeClose:void 0,afterClose:void 0};constructor(e){if(this.selectEl=typeof e.select=="string"?document.querySelector(e.select):e.select,!this.selectEl){e.events&&e.events.error&&e.events.error(new Error("Could not find select element"));return}if(this.selectEl.tagName!=="SELECT"){e.events&&e.events.error&&e.events.error(new Error("Element isnt of type select"));return}this.selectEl.dataset.ssid&&this.destroy(),this.settings=new It(e.settings),this.cssClasses=new Tt(e.cssClasses);const t=["beforeOpen","afterOpen","beforeClose","afterClose"];for(const c in e.events)e.events.hasOwnProperty(c)&&(t.indexOf(c)!==-1?this.events[c]=je(e.events[c],100):this.events[c]=e.events[c]);this.settings.disabled=e.settings?.disabled?e.settings.disabled:this.selectEl.disabled,this.settings.isMultiple=this.selectEl.multiple,this.settings.style=this.selectEl.style.cssText,this.settings.class=this.selectEl.className.split(" "),this.select=new Rt(this.selectEl),this.selectEl.id||(this.selectEl.id=this.settings.id),this.select.updateSelect(this.settings.id,this.settings.style,this.settings.class),this.select.hideUI(),this.select.onValueChange=c=>{this.setSelected(c.map(d=>d.id))},this.select.onClassChange=c=>{this.settings.class=c,this.render.updateClassStyles()},this.select.onDisabledChange=c=>{c?this.disable():this.enable()},this.select.onOptionsChange=c=>{this.setData(c||[])},this.select.onLabelClick=()=>{this.settings.disabled||(this.settings.isOpen?this.close():this.open())};const s=e.data?e.data:this.select.getData();this.store=new Nt(this.settings.isMultiple?"multiple":"single",s),e.data&&this.select.updateOptions(this.store.getData());const i={open:this.open.bind(this),close:this.close.bind(this),addable:this.events.addable?this.events.addable:void 0,setSelected:this.setSelected.bind(this),addOption:this.addOption.bind(this),search:this.search.bind(this),beforeChange:this.events.beforeChange,afterChange:this.events.afterChange};this.render=new Mt(this.settings,this.cssClasses,this.store,i),this.render.renderValues(),this.render.renderOptions(this.store.getData());const n=this.selectEl.getAttribute("aria-label"),l=this.selectEl.getAttribute("aria-labelledby");n?this.render.main.main.setAttribute("aria-label",n):l&&this.render.main.main.setAttribute("aria-labelledby",l),this.selectEl.parentNode&&this.selectEl.parentNode.insertBefore(this.render.main.main,this.selectEl.nextSibling),window.addEventListener("resize",this.windowResize,!1),this.settings.openPosition==="auto"&&window.addEventListener("scroll",this.windowScroll,!1),document.addEventListener("visibilitychange",this.windowVisibilityChange),this.settings.disabled&&this.disable(),this.settings.alwaysOpen&&this.open(),this.select.setupLabelHandlers(),this.selectEl.slim=this}enable(){this.settings.disabled=!1,this.select.enable(),this.render.enable()}disable(){this.settings.disabled=!0,this.select.disable(),this.render.disable()}getData(){return this.store.getData()}setData(e){const t=this.store.getSelected(),s=this.store.validateDataArray(e);if(s){this.events.error&&this.events.error(s);return}this.store.setData(e);const i=this.store.getData();this.select.updateOptions(i),this.render.renderValues(),this.render.renderOptions(i),this.events.afterChange&&!Je(t,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}getSelected(){let e=this.store.getSelectedOptions();return this.settings.keepOrder&&(e=this.store.selectedOrderOptions(e)),e.map(t=>t.value)}setSelected(e,t=!0){const s=this.store.getSelected(),i=this.store.getDataOptions();e=Array.isArray(e)?e:[e];const n=[];for(const c of e){if(i.find(d=>d.id==c)){n.push(c);continue}for(const d of i.filter(h=>h.value==c))n.push(d.id)}this.store.setSelectedBy("id",n);const l=this.store.getData();this.select.updateOptions(l),this.render.renderValues(),this.render.content.search.input.value!==""?this.search(this.render.content.search.input.value):this.render.renderOptions(l),t&&this.events.afterChange&&!Je(s,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}addOption(e){const t=this.store.getSelected();this.store.getDataOptions().some(i=>i.value===(e.value??e.text))||this.store.addOption(e);const s=this.store.getData();this.select.updateOptions(s),this.render.renderValues(),this.render.renderOptions(s),this.events.afterChange&&!Je(t,this.store.getSelected())&&this.events.afterChange(this.store.getSelectedOptions())}open(){this.settings.disabled||this.settings.isOpen||(this.events.beforeOpen&&this.events.beforeOpen(),this.render.open(),this.settings.showSearch&&this.settings.focusSearch&&this.render.searchFocus(),this.settings.isOpen=!0,this.openTimeout=setTimeout(()=>{this.events.afterOpen&&this.events.afterOpen(),this.settings.isOpen&&(this.settings.isFullOpen=!0),document.addEventListener("click",this.documentClick)},this.settings.timeoutDelay),this.settings.contentPosition==="absolute"&&(this.settings.intervalMove&&clearInterval(this.settings.intervalMove),this.settings.intervalMove=setInterval(this.render.moveContent.bind(this.render),500)))}close(e=null){!this.settings.isOpen||this.settings.alwaysOpen||(this.events.beforeClose&&this.events.beforeClose(),this.render.close(),!this.settings.keepSearch&&this.render.content.search.input.value!==""&&this.search(""),this.render.mainFocus(e),this.settings.isOpen=!1,this.settings.isFullOpen=!1,this.closeTimeout=setTimeout(()=>{this.events.afterClose&&this.events.afterClose(),document.removeEventListener("click",this.documentClick)},this.settings.timeoutDelay),this.settings.intervalMove&&clearInterval(this.settings.intervalMove))}search(e){if(this.render.content.search.input.value!==e&&(this.render.content.search.input.value=e),e===""){this.render.renderOptions(this.store.getData());return}if(!this.events.search){const s=e===""?this.store.getData():this.store.search(e,this.events.searchFilter);this.render.renderOptions(s);return}this.render.renderSearching();const t=this.events.search(e,this.store.getSelectedOptions());if(t instanceof Promise){t.then(s=>{this.store.setData(s,!0),this.select.updateOptions(this.store.getData()),this.render.renderOptions(this.store.getData())}).catch(s=>{this.render.renderError(typeof s=="string"?s:s.message)});return}else Array.isArray(t)?(this.store.setData(t,!0),this.select.updateOptions(this.store.getData()),this.render.renderOptions(this.store.getData())):this.render.renderError("Search event must return a promise or an array of data")}destroy(){this.openTimeout&&(clearTimeout(this.openTimeout),this.openTimeout=null),this.closeTimeout&&(clearTimeout(this.closeTimeout),this.closeTimeout=null),this.settings.intervalMove&&(clearInterval(this.settings.intervalMove),this.settings.intervalMove=null),document.removeEventListener("click",this.documentClick),window.removeEventListener("resize",this.windowResize,!1),this.settings.openPosition==="auto"&&window.removeEventListener("scroll",this.windowScroll,!1),document.removeEventListener("visibilitychange",this.windowVisibilityChange),this.store.setData([]),this.render.destroy(),this.select.destroy()}windowResize=je(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()});windowScroll=je(()=>{!this.settings.isOpen&&!this.settings.isFullOpen||this.render.moveContent()});documentClick=e=>{this.settings.isOpen&&e.target&&!Dt(e.target,this.settings.id)&&this.close(e.type)};windowVisibilityChange=()=>{document.hidden&&this.close()}}var Bt=ne('<select class="slim mb-2"></select>');function jt(o,e){qe(e,!0);let t=W(e,"value",15),s=W(e,"multiple",3,!1),i,n=Te(!1),l="";function c(f){Oe(()=>{i=new Ft({select:f,data:h(),settings:{id:e.id,ariaLabel:e.label,isMultiple:s()||!1,showSearch:!1,maxValuesShown:100,allowDeselect:!0,closeOnSelect:!s()},cssClasses:{deselect:"hidden"},events:{afterChange:g=>{s()?d(g.map(O=>O.value)):d(g[0]?.value)},beforeChange(g){if(!(s()||g.length>0))return i?.close(),!1}}}),l=JSON.stringify(e.options),Array.isArray(t())?i.setSelected(t().map(g=>g.toString()),!1):i.setSelected(t()||"",!1)})}pt(()=>{i&&(i.destroy(),i=void 0)}),ve(()=>{t(),Oe(async()=>{if(x(n)){we(n,!1);return}i&&i.setSelected(t()||[],!1)})}),ve(()=>{e.options,Oe(async()=>{if(JSON.stringify(e.options)===l||(l=JSON.stringify(e.options),!i))return;const f=i.getSelected();i.setData(h());let g;s()?g=f.filter(O=>e.options.find(N=>N.value===O)):g=e.options.some(O=>O.value===f[0])?f[0]:"",i.setSelected(g,!1)})}),ve(()=>{e.disabled,Oe(()=>{i&&(e.disabled?i.disable():i.enable())})});function d(f){t(f),we(n,!0),e.onUpdate(f)}function h(){return yt(e.options.map(f=>new V({...f})))}var p=Bt();Ot(p,()=>c),ye(()=>p.multiple=s()),ie(o,p),ze()}var Ut=ne('<div class="text-gray-500 dark:text-gray-400 italic">No options available</div>'),Ht=ne("<!> <!>",1);function Qe(o,e){const t=bt();qe(e,!0);let s=W(e,"value",15),i=W(e,"disabled",3,!1),n=W(e,"onUpdate",3,()=>{}),l=Ae(()=>e.options.map(g=>typeof g=="string"?{text:g,value:g}:{text:g.label,value:g.value}));var c=Ht(),d=Ve(c);At(d,{get label(){return e.label},get formId(){return t}});var h=le(d,2);{var p=g=>{var O=Ut();ie(g,O)},f=g=>{jt(g,{get id(){return t},get label(){return e.label},get options(){return x(l)},get disabled(){return i()},get onUpdate(){return n()},get value(){return s()},set value(O){s(O)}})};Ce(h,g=>{x(l).length==0?g(p):g(f,!1)})}ie(o,c),ze()}function Vt(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Ue={exports:{}};/* @license
|
|
2
2
|
Papa Parse
|
|
3
3
|
v5.5.3
|
|
4
4
|
https://github.com/mholt/PapaParse
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./DsnmJJEf.js";import{p as q,f as c,a as z,s as n,d as m,h as e,r as d,t as A,b,m as B,c as C}from"./ACDB_Pwg.js";import{d as D,s as E}from"./D5i9uzhf.js";import{i as G}from"./BI-3sHG-.js";import{e as H,s as I,c as J,i as K}from"./
|
|
1
|
+
import"./DsnmJJEf.js";import{p as q,f as c,a as z,s as n,d as m,h as e,r as d,t as A,b,m as B,c as C}from"./ACDB_Pwg.js";import{d as D,s as E}from"./D5i9uzhf.js";import{i as G}from"./BI-3sHG-.js";import{e as H,s as I,c as J,i as K}from"./YBXudzKe.js";import{r as M,s as k}from"./Cxfa8IfO.js";import{b as N}from"./CkuyqXbc.js";import{p as _}from"./y0Hysjl8.js";import{i as O}from"./CtABtqz2.js";function P(p,a,v){a()(v())}var Q=c('<div class="bg-blue-500 h-2 w-2 rounded-full"></div>'),T=c('<div class="relative"><input class="appearance-none absolute inset-y-0 w-4" type="radio"/> <label class="flex items-center"><div><!></div> </label></div>'),V=c('<!> <div class="flex gap-2 mb-2" role="radiogroup"></div>',1);function se(p,a){q(a,!0);const v=[];let t=_(a,"value",15),g=_(a,"disabled",3,!1),R=_(a,"onUpdate",3,()=>{}),U=B(()=>a.options.map(s=>typeof s=="string"?{label:s,value:s}:s));var h=V(),x=z(h);O(x,{get label(){return a.label}});var y=n(x,2);H(y,21,()=>e(U),K,(s,r)=>{var u=T(),l=m(u);M(l),l.__change=[P,R,t];var w,o=n(l,2),i=m(o),j=m(i);{var F=f=>{var S=Q();b(f,S)};G(j,f=>{t()===e(r).value&&f(F)})}d(i);var L=n(i);d(o),d(u),A(()=>{k(l,"id","radio-"+e(r).value),l.disabled=g(),w!==(w=e(r).value)&&(l.value=(l.__value=e(r).value)??""),k(o,"for","radio-"+e(r).value),I(i,1,J(["h-4 w-4 border-2 rounded-full me-2 flex items-center justify-center",!g()&&t()===e(r).value?"border-blue-500":"border-gray-400 dark:border-gray-600"])),E(L,` ${e(r).label??""}`)}),N(v,[],l,()=>(e(r).value,t()),t),b(s,u)}),d(y),b(p,h),C()}D(["change"]);export{se as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./DsnmJJEf.js";import{d as C,o as L,e as m,s as M}from"./D5i9uzhf.js";import{p as T,f as x,a as q,e as r,h as e,i as o,s as _,b as h,c as z,d as F,r as P,t as R}from"./ACDB_Pwg.js";import{i as $}from"./BI-3sHG-.js";import{s as y}from"./
|
|
1
|
+
import"./DsnmJJEf.js";import{d as C,o as L,e as m,s as M}from"./D5i9uzhf.js";import{p as T,f as x,a as q,e as r,h as e,i as o,s as _,b as h,c as z,d as F,r as P,t as R}from"./ACDB_Pwg.js";import{i as $}from"./BI-3sHG-.js";import{s as y}from"./CtABtqz2.js";import{b as j}from"./y0Hysjl8.js";var A=(n,a)=>{o(a,!0)},D=(n,a)=>{o(a,!1)},E=x('<div class="absolute font-normal -translate-x-1/2 -translate-y-full z-3 border bg-gray-200 dark:bg-gray-800 border-black dark:border-white rounded-lg p-2"> <svg class="absolute -translate-x-1/2 left-1/2" width="20" height="10"><polygon points="0,0 20,0 10,10" class="fill-gray-200 dark:fill-gray-800"></polygon><path d="M0,0 L10,10 L20,0" class="fill-none stroke-black dark:stroke-white"></path></svg></div>'),G=x('<button aria-label="Help tooltip"><i class="bi bi-question-circle-fill text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"></i></button> <!>',1);function S(n,a){T(a,!0);let l=r(void 0),u=r(!1),f=r(!1),d=r(0),p=r(0);function v(){if(e(l)){const t=e(l).getBoundingClientRect();o(d,t.top,!0),o(p,t.left+t.width/2)}}L(()=>{v()});var c=G(),s=q(c);s.__mouseover=[A,u],s.__focusout=[D,f],j(s,t=>o(l,t),()=>e(l));var k=_(s,2);{var w=t=>{var i=E();let b;var g=F(i),H=_(g);y(H,"",{},{bottom:"-10px"}),P(i),R(B=>{b=y(i,"",b,B),M(g,`${a.content??""} `)},[()=>({top:`${e(d)-10}px`,left:`${e(p)}px`})]),h(t,i)};$(k,t=>{(e(u)||e(f))&&t(w)})}m("focus",s,()=>{o(f,!0),v()}),m("mouseleave",s,()=>{o(u,!1)}),h(n,c),z()}C(["mouseover","focusout"]);export{S as H};
|